mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-30 03:11:22 +01:00
Quick fix for item eggs on entities, allow item frames.
This commit is contained in:
parent
aa126bf731
commit
7dc6a5d482
@ -3,8 +3,11 @@ package fr.neatmonster.nocheatplus.checks.inventory;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ComplexEntityPart;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -288,8 +291,12 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
counters.addPrimaryThread(idCancelDead, 1);
|
||||
return;
|
||||
}
|
||||
// TODO: Activate mob-egg check only for specific server versions.
|
||||
final ItemStack stack = player.getItemInHand();
|
||||
if (stack != null && stack.getType() == Material.MONSTER_EGG && items.isEnabled(player)){
|
||||
Entity entity = event.getRightClicked();
|
||||
if (stack != null && stack.getType() == Material.MONSTER_EGG
|
||||
&& (entity == null || entity instanceof LivingEntity || entity instanceof ComplexEntityPart)
|
||||
&& items.isEnabled(player)){
|
||||
event.setCancelled(true);
|
||||
counters.addPrimaryThread(idEggOnEntity, 1);
|
||||
return;
|
||||
@ -346,25 +353,25 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
open.check(player);
|
||||
}
|
||||
|
||||
// @EventHandler(priority = EventPriority.MONITOR)
|
||||
// public void onVehicleDestroy(final VehicleDestroyEvent event) {
|
||||
// final Entity entity = event.getVehicle();
|
||||
// if (entity instanceof InventoryHolder) { // Fail on 1.4 ?
|
||||
// checkInventoryHolder((InventoryHolder) entity);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @EventHandler(priority = EventPriority.MONITOR)
|
||||
// public void onBlockBreak(final BlockBreakEvent event) {
|
||||
// final Block block = event.getBlock();
|
||||
// if (block == null) {
|
||||
// return;
|
||||
// }
|
||||
// // TODO: + explosions !? + entity change block + ...
|
||||
// }
|
||||
//
|
||||
// private void checkInventoryHolder(InventoryHolder entity) {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
// @EventHandler(priority = EventPriority.MONITOR)
|
||||
// public void onVehicleDestroy(final VehicleDestroyEvent event) {
|
||||
// final Entity entity = event.getVehicle();
|
||||
// if (entity instanceof InventoryHolder) { // Fail on 1.4 ?
|
||||
// checkInventoryHolder((InventoryHolder) entity);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @EventHandler(priority = EventPriority.MONITOR)
|
||||
// public void onBlockBreak(final BlockBreakEvent event) {
|
||||
// final Block block = event.getBlock();
|
||||
// if (block == null) {
|
||||
// return;
|
||||
// }
|
||||
// // TODO: + explosions !? + entity change block + ...
|
||||
// }
|
||||
//
|
||||
// private void checkInventoryHolder(InventoryHolder entity) {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user