Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-11-15 03:31:01 -08:00
commit 81b5317376
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.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
@ -160,10 +161,10 @@ public class GamePlayerManager implements Listener
if (Manager.GetGame() == null || !Manager.GetGame().InProgress())
return;
if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE)
if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE && event.getInventory().getType() == InventoryType.CREATIVE)
{
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
public void addClockPrevent(InventoryOpenEvent event)
{