Removed Open Chests
Dieser Commit ist enthalten in:
Ursprung
92c37a69c6
Commit
0235db3e5f
@ -8,6 +8,8 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||||
@ -57,4 +59,12 @@ public class ArenaListener extends BasicListener {
|
|||||||
public void onHunger(FoodLevelChangeEvent e){
|
public void onHunger(FoodLevelChangeEvent e){
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
|
if(event.getView().getType() != InventoryType.PLAYER &&
|
||||||
|
event.getView().getType() != InventoryType.CRAFTING &&
|
||||||
|
event.getView().getType() != InventoryType.CREATIVE)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,22 +11,15 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import de.steamwar.misslewars.Config;
|
import de.steamwar.misslewars.Config;
|
||||||
import de.steamwar.misslewars.FightState;
|
import de.steamwar.misslewars.FightState;
|
||||||
import de.steamwar.misslewars.MWTeam;
|
|
||||||
import de.steamwar.misslewars.MissileWars;
|
import de.steamwar.misslewars.MissileWars;
|
||||||
import de.steamwar.misslewars.items.SpecialItem;
|
import de.steamwar.misslewars.items.SpecialItem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Snowball;
|
import org.bukkit.entity.Snowball;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -85,28 +78,4 @@ public class ItemListener extends BasicListener {
|
|||||||
}, Config.ShieldFlyTime);
|
}, Config.ShieldFlyTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
|
||||||
Inventory clicked = event.getClickedInventory();
|
|
||||||
if(MissileWars.getFightState() != FightState.FIGHTING) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(event.getClick().isShiftClick()){
|
|
||||||
ItemStack clickedOn = event.getCurrentItem();
|
|
||||||
|
|
||||||
if(
|
|
||||||
clickedOn != null &&
|
|
||||||
event.getView().getTopInventory().getType() != InventoryType.CRAFTING &&
|
|
||||||
clicked == event.getWhoClicked().getInventory())
|
|
||||||
event.setCancelled(true);
|
|
||||||
}else if (
|
|
||||||
clicked != event.getWhoClicked().getInventory() &&
|
|
||||||
clicked != null &&
|
|
||||||
clicked.getType() != InventoryType.PLAYER &&
|
|
||||||
event.getCursor() != null &&
|
|
||||||
event.getCursor().getType() != Material.AIR )
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren