Changed invis in hub to only be on server npc shops
Fixed /a for senior mods and developers.
This commit is contained in:
parent
3d909b7cbe
commit
0de8d22e62
@ -106,6 +106,8 @@ public class F
|
||||
{
|
||||
if (rank == Rank.OWNER) return C.rOwner + "Owner";
|
||||
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.HELPER) return C.rHelp + "Helper";
|
||||
else return C.rAll + "Player";
|
||||
|
@ -1,12 +1,15 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
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.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import mineplex.hub.HubManager;
|
||||
|
||||
public class VisibilityManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private HashMap<Player, Integer> _particle = new HashMap<Player, Integer>();
|
||||
private HashSet<Player> _hiddenPlayers = new HashSet<Player>();
|
||||
|
||||
public VisibilityManager(HubManager manager)
|
||||
{
|
||||
super("Visibility Manager", manager.GetPlugin());
|
||||
@ -32,6 +37,23 @@ public class VisibilityManager extends MiniPlugin
|
||||
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
|
||||
public void UpdateVisibility(UpdateEvent event)
|
||||
{
|
||||
@ -40,7 +62,7 @@ public class VisibilityManager extends MiniPlugin
|
||||
|
||||
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())
|
||||
{
|
||||
@ -48,8 +70,7 @@ public class VisibilityManager extends MiniPlugin
|
||||
continue;
|
||||
|
||||
if (hideMe || !Manager.getPreferences().Get(other).ShowPlayers || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 ||
|
||||
Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player) ||
|
||||
(player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE))
|
||||
Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player))
|
||||
{
|
||||
((CraftPlayer)other).hidePlayer(player, true, false);
|
||||
}
|
||||
@ -59,9 +80,7 @@ public class VisibilityManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> _particle = new HashMap<Player, Integer>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ParticleSwap(PlayerInteractEvent event)
|
||||
|
@ -757,4 +757,9 @@ public class ServerManager extends MiniPlugin
|
||||
{
|
||||
return _serverNpcShopMap.get("Castle Siege");
|
||||
}
|
||||
|
||||
public HubManager getHubManager()
|
||||
{
|
||||
return _hubManager;
|
||||
}
|
||||
}
|
||||
|
@ -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.
Loading…
Reference in New Issue
Block a user