mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-28 12:55:34 +01:00
Added logging and inventory rollback support for throwing snowballs and lingering potions
This commit is contained in:
parent
f5d13f8818
commit
42c6deff8a
@ -660,7 +660,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.useItemInHand() != Event.Result.DENY) {
|
if (event.useItemInHand() != Event.Result.DENY) {
|
||||||
List<Material> entityBlockTypes = Arrays.asList(Material.ARMOR_STAND, Material.END_CRYSTAL, Material.BOW, Material.CROSSBOW, Material.TRIDENT, Material.EXPERIENCE_BOTTLE, Material.SPLASH_POTION, Material.ENDER_PEARL, Material.FIREWORK_ROCKET, Material.EGG);
|
List<Material> entityBlockTypes = Arrays.asList(Material.ARMOR_STAND, Material.END_CRYSTAL, Material.BOW, Material.CROSSBOW, Material.TRIDENT, Material.EXPERIENCE_BOTTLE, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.ENDER_PEARL, Material.FIREWORK_ROCKET, Material.EGG, Material.SNOWBALL);
|
||||||
ItemStack handItem = null;
|
ItemStack handItem = null;
|
||||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||||
|
@ -72,8 +72,9 @@ public class ProjectileLaunchListener extends Queue implements Listener {
|
|||||||
UUID uuid = pair.getKey();
|
UUID uuid = pair.getKey();
|
||||||
Object[] data = pair.getValue();
|
Object[] data = pair.getValue();
|
||||||
ItemStack itemStack = (ItemStack) data[2];
|
ItemStack itemStack = (ItemStack) data[2];
|
||||||
|
Material entityMaterial = Util.getEntityMaterial(event.getEntityType());
|
||||||
boolean isBow = BOWS.contains(itemStack.getType());
|
boolean isBow = BOWS.contains(itemStack.getType());
|
||||||
if ((data[0].equals(key) || data[1].equals(key)) && (Util.getEntityMaterial(event.getEntityType()) == itemStack.getType() || isBow)) {
|
if ((data[0].equals(key) || data[1].equals(key)) && (entityMaterial == itemStack.getType() || (itemStack.getType() == Material.LINGERING_POTION && entityMaterial == Material.SPLASH_POTION) || isBow)) {
|
||||||
Player player = Bukkit.getServer().getPlayer(uuid);
|
Player player = Bukkit.getServer().getPlayer(uuid);
|
||||||
|
|
||||||
boolean thrownItem = (itemStack.getType() != Material.FIREWORK_ROCKET && !isBow);
|
boolean thrownItem = (itemStack.getType() != Material.FIREWORK_ROCKET && !isBow);
|
||||||
|
@ -813,6 +813,8 @@ public class Util extends Queue {
|
|||||||
return Material.FIREWORK_ROCKET;
|
return Material.FIREWORK_ROCKET;
|
||||||
case EGG:
|
case EGG:
|
||||||
return Material.EGG;
|
return Material.EGG;
|
||||||
|
case SNOWBALL:
|
||||||
|
return Material.SNOWBALL;
|
||||||
default:
|
default:
|
||||||
return BukkitAdapter.ADAPTER.getFrameType(type);
|
return BukkitAdapter.ADAPTER.getFrameType(type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user