FINGERS CROSSED

This commit is contained in:
Chiss 2014-11-15 22:29:53 +11:00
parent d16896e493
commit fb70b76d29
2 changed files with 3 additions and 39 deletions

View File

@ -16,6 +16,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -160,10 +161,10 @@ public class GamePlayerManager implements Listener
if (Manager.GetGame() == null || !Manager.GetGame().InProgress()) if (Manager.GetGame() == null || !Manager.GetGame().InProgress())
return; return;
if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE) if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE && event.getInventory().getType() == InventoryType.CREATIVE)
{ {
event.setCancelled(true); event.setCancelled(true);
// event.getWhoClicked().closeInventory(); event.getWhoClicked().closeInventory();
} }
} }

View File

@ -68,43 +68,6 @@ public class MiscManager implements Listener
} }
} }
@EventHandler(priority = EventPriority.LOWEST)
public void InventoryClickCancel(InventoryClickEvent event)
{
if (Manager.GetGame() == null)
return;
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
if (player == null)
return;
if (player.getGameMode() != GameMode.SURVIVAL && !player.isOp())
{
event.setCancelled(true);
// player.closeInventory();
}
else if (Manager.GetGame().IsLive() && !Manager.GetGame().IsAlive(player) && !((CraftPlayer)player).getHandle().spectating)
{
event.setCancelled(true);
// player.closeInventory();
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void InventoryClickClose(InventoryClickEvent event)
{
if (event.isCancelled())
{
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
if (player == null)
return;
if (event.getClickedInventory().getViewers().contains(player))
player.closeInventory();
}
}
@EventHandler @EventHandler
public void addClockPrevent(InventoryOpenEvent event) public void addClockPrevent(InventoryOpenEvent event)
{ {