Incognito Updates:

-ADD: Prompt in Tab to identify who is in vanish (Can be a * or [Vanish])
-ADD: Make it so /stats don't work on vanished staff.
-ADD: Make sure it can be toggled off on /vanish again or network leave. Staff get stuck with it when resigning. Should stay on in-between lobbies.
This commit is contained in:
Ben 2016-05-10 09:50:44 +01:00 committed by cnr
parent 8a75a5098c
commit 35c7b9a2bd
16 changed files with 85 additions and 39 deletions

View File

@ -1,33 +1,26 @@
package mineplex.core.achievement;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.command.StatsCommand;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.stats.event.StatChangeEvent;
public class AchievementManager extends MiniPlugin
{
private IncognitoManager _incognitoManager;
private StatsManager _statsManager;
private EloManager _eloManager;
@ -39,10 +32,11 @@ public class AchievementManager extends MiniPlugin
private boolean _shopEnabled = true;
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager, EloManager eloManager)
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager, IncognitoManager incognitoManager, EloManager eloManager)
{
super("Achievement Manager", statsManager.getPlugin());
_incognitoManager = incognitoManager;
_statsManager = statsManager;
_eloManager = eloManager;
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
@ -221,4 +215,9 @@ public class AchievementManager extends MiniPlugin
{
_shopEnabled = var;
}
public IncognitoManager getIncognito()
{
return _incognitoManager;
}
}

View File

@ -30,6 +30,11 @@ public class StatsCommand extends CommandBase<AchievementManager>
return;
}
if (/* StaffServer special case */Plugin.getIncognito() != null && Plugin.getIncognito().Get(target).Hidden)
{
return;
}
Plugin.openShop(caller, target);
}
}

View File

@ -69,17 +69,6 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
}
}
}
else
{
IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(caller));
if (!customEvent.isCancelled())
{
UtilServer.getPlayersCollection().forEach(player -> {
player.hidePlayer(caller);
});
}
}
runAsync(() -> _repository.setStatus(_clientManager.getAccountId(caller), enabled));
@ -150,6 +139,12 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{
other.hidePlayer(player);
}
Get(player).Hidden = !customEvent.isCancelled();
}
else
{
Get(player).Hidden = false;
}
if (Get(other).Status)
@ -160,6 +155,12 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{
player.hidePlayer(other);
}
Get(other).Hidden = !customEvent.isCancelled();
}
else
{
Get(other).Hidden = false;
}
}
}

View File

@ -12,12 +12,23 @@ public class IncognitoToggleCommand extends CommandBase<IncognitoManager>
{
public IncognitoToggleCommand(IncognitoManager plugin)
{
super(plugin, Rank.HELPER, "incognito", "vanish");
super(plugin, Rank.ALL, "incognito", "vanish");
}
@Override
public void Execute(Player caller, String[] args)
{
if (!Rank.HELPER.has(caller, Plugin.getClientManager().Get(caller).GetRank(), !Plugin.Get(caller).Status))
{
if (Plugin.Get(caller).Status)
{
UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito."));
Plugin.toggle(caller);
}
return;
}
if (Plugin.getPreferences().Get(caller).Invisibility && /* Hub Invis & Incognito stuck prevention */ !Plugin.Get(caller).Status)
{
UtilPlayer.message(caller, F.main("Incognito", "You are not allowed to toggle incognito on while Hub Invisibility is enabled."));

View File

@ -3,4 +3,5 @@ package mineplex.core.incognito.repository;
public class IncognitoClient
{
public boolean Status;
public boolean Hidden;
}

View File

@ -33,6 +33,8 @@ public class PlayerScoreboard
protected void addTeams(Player player)
{
_scoreboard.registerNewTeam("Vanished").setSuffix(C.cBlue + "*");
for (Rank rank : Rank.values())
{
if (rank != Rank.ALL)
@ -69,6 +71,16 @@ public class PlayerScoreboard
//Add Self to Other
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
if (_manager.getIncognitoManager().Get(otherPlayer).Hidden)
{
_scoreboard.getTeam("Vanished").addPlayer(otherPlayer);
}
if (_manager.getIncognitoManager().Get(player).Hidden)
{
_scoreboard.getTeam("Vanished").addPlayer(player);
}
}
}

View File

@ -13,6 +13,7 @@ import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -20,6 +21,7 @@ public class ScoreboardManager extends MiniPlugin
{
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private IncognitoManager _incognito;
//This stores current scoreboard for the player
private HashMap<Player, PlayerScoreboard> _playerScoreboards = new HashMap<Player, PlayerScoreboard>();
@ -32,12 +34,13 @@ public class ScoreboardManager extends MiniPlugin
private int _shineIndex;
private boolean _shineDirection = true;
public ScoreboardManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
public ScoreboardManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, IncognitoManager incognito)
{
super("Scoreboard Manager", plugin);
_clientManager = clientManager;
_donationManager = donationManager;
_incognito = incognito;
}
public CoreClientManager getClients()
@ -169,4 +172,9 @@ public class ScoreboardManager extends MiniPlugin
_shineDirection = !_shineDirection;
}
}
public IncognitoManager getIncognitoManager()
{
return _incognito;
}
}

View File

@ -1,5 +1,10 @@
package mineplex.game.clans;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.CustomTagFix;
import mineplex.core.FoodDupeFix;
import mineplex.core.account.CoreClientManager;
@ -56,11 +61,6 @@ import mineplex.game.clans.spawn.travel.TravelShop;
import mineplex.game.clans.world.WorldManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
public class Clans extends JavaPlugin
{
public static final String VERSION = "Beta 1.0";
@ -130,7 +130,7 @@ public class Clans extends JavaPlugin
StatsManager statsManager = new StatsManager(this, _clientManager);
EloManager eloManager = new EloManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, eloManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, incognito, eloManager);
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);

View File

@ -319,7 +319,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
EloManager eloManager = new EloManager(plugin, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager, eloManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager, incognitoManager, eloManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");

View File

@ -32,7 +32,7 @@ public class ClansScoreboardManager extends ScoreboardManager
public ClansScoreboardManager(JavaPlugin plugin, ClansManager clansManager, WarManager warManager, WorldEventManager worldEvent, TutorialManager tutorial, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager);
super(plugin, clientManager, donationManager, clansManager.getIncognitoManager());
_clansManager = clansManager;
_warManager = warManager;

View File

@ -164,7 +164,7 @@ public class MeridianScepter extends LegendaryItem
continue;
}
if (ClansManager.getInstance().getIncognitoManager().Get(closest).Status)
if (ClansManager.getInstance().getIncognitoManager().Get(closest).Hidden)
{
continue;
}

View File

@ -140,7 +140,7 @@ public class Hub extends JavaPlugin implements IRelation
StatsManager statsManager = new StatsManager(this, clientManager);
EloManager eloManager = new EloManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, eloManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager);
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
@ -149,7 +149,7 @@ public class Hub extends JavaPlugin implements IRelation
CustomDataManager customDataManager = new CustomDataManager(this, clientManager);
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager);
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);

View File

@ -73,6 +73,7 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.hologram.HologramManager;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.message.PrivateMessageEvent;
@ -164,6 +165,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private PlayerCountManager _playerCountManager;
private CustomDataManager _customDataManager;
private Punish _punishManager;
private IncognitoManager _incognito;
private ValentinesManager _valentinesManager;
// private HalloweenSpookinessManager _halloweenManager;
// private TrickOrTreatManager _trickOrTreatManager;
@ -187,10 +189,12 @@ public class HubManager extends MiniClientPlugin<HubClient>
// private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"};
private final ArrayList<NoteSong> _songs;
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, CustomDataManager customDataManager)
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, IncognitoManager incognito, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, CustomDataManager customDataManager)
{
super("Hub Manager", plugin);
_incognito = incognito;
_blockRestore = blockRestore;
_clientManager = clientManager;
_conditionManager = conditionManager;
@ -1103,4 +1107,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
}
}
public IncognitoManager getIncognitoManager()
{
return _incognito;
}
}

View File

@ -21,7 +21,7 @@ public class HubScoreboardManager extends MiniPlugin
{
super("Hub Scoreboard Manager", manager.getPlugin());
_scoreboardManager = new ScoreboardManager(manager.getPlugin(), clientManager, donationManager);
_scoreboardManager = new ScoreboardManager(manager.getPlugin(), clientManager, donationManager, manager.getIncognitoManager());
init();
}

View File

@ -62,7 +62,7 @@ public class StaffServer extends JavaPlugin
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
EloManager eloManager = new EloManager(this, clientManager);
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager, eloManager), serverStatusManager.getCurrentServerName());
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);

View File

@ -144,7 +144,7 @@ public class Arcade extends JavaPlugin
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, _clientManager);
EloManager eloManager = new EloManager(this, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, eloManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, incognito, eloManager);
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);