Remove silent chest opening mechanism (which was completely broken), and instead don't allow incognito staff to open chests
This commit is contained in:
parent
4bf19eebad
commit
dd3e009413
@ -57,7 +57,6 @@ import mineplex.core.explosion.Explosion;
|
|||||||
import mineplex.core.hologram.Hologram;
|
import mineplex.core.hologram.Hologram;
|
||||||
import mineplex.core.hologram.HologramManager;
|
import mineplex.core.hologram.HologramManager;
|
||||||
import mineplex.core.incognito.IncognitoManager;
|
import mineplex.core.incognito.IncognitoManager;
|
||||||
import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
|
|
||||||
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
||||||
import mineplex.core.movement.Movement;
|
import mineplex.core.movement.Movement;
|
||||||
import mineplex.core.npc.NpcManager;
|
import mineplex.core.npc.NpcManager;
|
||||||
@ -99,7 +98,6 @@ import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
|
|||||||
import mineplex.game.clans.clans.regions.ClansRegions;
|
import mineplex.game.clans.clans.regions.ClansRegions;
|
||||||
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
|
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
|
||||||
import mineplex.game.clans.clans.siege.SiegeManager;
|
import mineplex.game.clans.clans.siege.SiegeManager;
|
||||||
import mineplex.game.clans.clans.staff.SilentChestOpen;
|
|
||||||
import mineplex.game.clans.clans.supplyDrop.SupplyDropManager;
|
import mineplex.game.clans.clans.supplyDrop.SupplyDropManager;
|
||||||
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
|
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
|
||||||
import mineplex.game.clans.clans.war.WarManager;
|
import mineplex.game.clans.clans.war.WarManager;
|
||||||
@ -296,8 +294,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
|
|
||||||
new Field(plugin, creature, _condition, this, energy, serverName);
|
new Field(plugin, creature, _condition, this, energy, serverName);
|
||||||
|
|
||||||
new SilentChestOpen(this);
|
|
||||||
|
|
||||||
// Required managers to be initialized
|
// Required managers to be initialized
|
||||||
new Spawn(plugin, this);
|
new Spawn(plugin, this);
|
||||||
new NPCManager(this, _hologramManager);
|
new NPCManager(this, _hologramManager);
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.staff;
|
|
||||||
|
|
||||||
import org.bukkit.block.Chest;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
|
|
||||||
public class SilentChestInventory implements Listener
|
|
||||||
{
|
|
||||||
private Chest _chest;
|
|
||||||
private Inventory _inventory;
|
|
||||||
|
|
||||||
private Player _viewer;
|
|
||||||
|
|
||||||
public SilentChestInventory(Chest chest, Player viewer)
|
|
||||||
{
|
|
||||||
_chest = chest;
|
|
||||||
|
|
||||||
viewer.openInventory(_chest.getBlockInventory());
|
|
||||||
|
|
||||||
UtilServer.RegisterEvents(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void closeInventory(InventoryCloseEvent event)
|
|
||||||
{
|
|
||||||
if (event.getInventory().equals(_inventory) && event.getPlayer().equals(_viewer))
|
|
||||||
{
|
|
||||||
UtilServer.Unregister(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.staff;
|
|
||||||
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.Chest;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.incognito.IncognitoManager;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
|
|
||||||
public class SilentChestOpen extends MiniPlugin
|
|
||||||
{
|
|
||||||
private ClansManager _clansManager;
|
|
||||||
|
|
||||||
public SilentChestOpen(ClansManager clansManager)
|
|
||||||
{
|
|
||||||
super("Silent Chest", clansManager.getPlugin());
|
|
||||||
|
|
||||||
_clansManager = clansManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInteract(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!ClansManager.getInstance().getClientManager().hasRank(event.getPlayer(), Rank.CMOD))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.getClickedBlock() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BlockState block = event.getClickedBlock().getState();
|
|
||||||
|
|
||||||
if (!(block instanceof Chest))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Chest chest = (Chest) block;
|
|
||||||
|
|
||||||
UtilServer.RegisterEvents(new SilentChestInventory(chest, event.getPlayer()));
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -304,6 +304,25 @@ public class Gameplay extends MiniPlugin
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInteract(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.getClickedBlock().getType().equals(Material.CHEST)
|
||||||
|
&& !event.getClickedBlock().getType().equals(Material.TRAPPED_CHEST))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to use this whilst incognito."));
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable all Piston related events in Clans
|
* Disable all Piston related events in Clans
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user