Changed invis in hub to only be on server npc shops

Fixed /a for senior mods and developers.
This commit is contained in:
Jonathan Williams 2014-08-09 00:06:44 -05:00
parent 3d909b7cbe
commit 0de8d22e62
5 changed files with 43 additions and 7 deletions

View File

@ -106,6 +106,8 @@ public class F
{ {
if (rank == Rank.OWNER) return C.rOwner + "Owner"; if (rank == Rank.OWNER) return C.rOwner + "Owner";
else if (rank == Rank.ADMIN) return C.rAdmin + "Admin"; else if (rank == Rank.ADMIN) return C.rAdmin + "Admin";
else if (rank == Rank.DEVELOPER) return C.rAdmin + "Developer";
else if (rank == Rank.SNR_MODERATOR) return C.rMod + "Senior Mod";
else if (rank == Rank.MODERATOR) return C.rMod + "Mod"; else if (rank == Rank.MODERATOR) return C.rMod + "Mod";
else if (rank == Rank.HELPER) return C.rHelp + "Helper"; else if (rank == Rank.HELPER) return C.rHelp + "Helper";
else return C.rAll + "Player"; else return C.rAll + "Player";

View File

@ -1,12 +1,15 @@
package mineplex.hub.modules; package mineplex.hub.modules;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
@ -18,13 +21,15 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
public class VisibilityManager extends MiniPlugin public class VisibilityManager extends MiniPlugin
{ {
public HubManager Manager; public HubManager Manager;
private HashMap<Player, Integer> _particle = new HashMap<Player, Integer>();
private HashSet<Player> _hiddenPlayers = new HashSet<Player>();
public VisibilityManager(HubManager manager) public VisibilityManager(HubManager manager)
{ {
super("Visibility Manager", manager.GetPlugin()); super("Visibility Manager", manager.GetPlugin());
@ -32,6 +37,23 @@ public class VisibilityManager extends MiniPlugin
Manager = manager; Manager = manager;
} }
public void addHiddenPlayer(Player player)
{
_hiddenPlayers.add(player);
}
public void removeHiddenPlayer(Player player)
{
_hiddenPlayers.remove(player);
}
@EventHandler
public void removeHiddenPlayerOnQuit(PlayerQuitEvent event)
{
_hiddenPlayers.remove(event.getPlayer());
}
@EventHandler @EventHandler
public void UpdateVisibility(UpdateEvent event) public void UpdateVisibility(UpdateEvent event)
{ {
@ -40,7 +62,7 @@ public class VisibilityManager extends MiniPlugin
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
boolean hideMe = Manager.getPreferences().Get(player).Invisibility; boolean hideMe = Manager.getPreferences().Get(player).Invisibility || _hiddenPlayers.contains(player);
for (Player other : UtilServer.getPlayers()) for (Player other : UtilServer.getPlayers())
{ {
@ -48,8 +70,7 @@ public class VisibilityManager extends MiniPlugin
continue; continue;
if (hideMe || !Manager.getPreferences().Get(other).ShowPlayers || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || if (hideMe || !Manager.getPreferences().Get(other).ShowPlayers || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 ||
Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player) || Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player))
(player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE))
{ {
((CraftPlayer)other).hidePlayer(player, true, false); ((CraftPlayer)other).hidePlayer(player, true, false);
} }
@ -61,8 +82,6 @@ public class VisibilityManager extends MiniPlugin
} }
} }
public HashMap<Player, Integer> _particle = new HashMap<Player, Integer>();
@EventHandler @EventHandler
public void ParticleSwap(PlayerInteractEvent event) public void ParticleSwap(PlayerInteractEvent event)
{ {

View File

@ -757,4 +757,9 @@ public class ServerManager extends MiniPlugin
{ {
return _serverNpcShopMap.get("Castle Siege"); return _serverNpcShopMap.get("Castle Siege");
} }
public HubManager getHubManager()
{
return _hubManager;
}
} }

View File

@ -55,4 +55,14 @@ public class ServerNpcShop extends ShopBase<ServerManager>
} }
} }
} }
protected void OpenShopForPlayer(Player player)
{
Plugin.getHubManager().GetVisibility().addHiddenPlayer(player);
}
protected void CloseShopForPlayer(Player player)
{
Plugin.getHubManager().GetVisibility().removeHiddenPlayer(player);
}
} }

Binary file not shown.