mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-12-28 17:47:41 +01:00
Added logging for players picking up arrows and tridents
This commit is contained in:
parent
a238045287
commit
0d7fa2dd59
@ -89,6 +89,7 @@ public final class ListenerHandler {
|
||||
pluginManager.registerEvents(new PlayerCommandListener(), plugin);
|
||||
pluginManager.registerEvents(new PlayerDeathListener(), plugin);
|
||||
pluginManager.registerEvents(new PlayerDropItemListener(), plugin);
|
||||
pluginManager.registerEvents(new PlayerPickupArrowListener(), plugin);
|
||||
pluginManager.registerEvents(new FoodLevelChangeListener(), plugin);
|
||||
pluginManager.registerEvents(new PlayerInteractEntityListener(), plugin);
|
||||
pluginManager.registerEvents(new PlayerJoinListener(), plugin);
|
||||
|
@ -0,0 +1,17 @@
|
||||
package net.coreprotect.listener;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
|
||||
import net.coreprotect.listener.entity.EntityPickupItemListener;
|
||||
|
||||
public class PlayerPickupArrowListener extends EntityPickupItemListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
protected void onPlayerPickupArrowEvent(PlayerPickupArrowEvent event) {
|
||||
EntityPickupItemListener.onItemPickup(event.getPlayer(), event.getArrow().getLocation(), event.getArrow().getItemStack());
|
||||
}
|
||||
|
||||
}
|
@ -18,23 +18,10 @@ import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
|
||||
public final class EntityPickupItemListener extends Queue implements Listener {
|
||||
public class EntityPickupItemListener extends Queue implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
protected void onEntityPickupItem(EntityPickupItemEvent event) {
|
||||
if (event.getEntityType() != EntityType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = event.getItem();
|
||||
Location location = item.getLocation();
|
||||
if (!Config.getConfig(location.getWorld()).ITEM_PICKUPS) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
ItemStack itemStack = item.getItemStack();
|
||||
if (itemStack == null) {
|
||||
protected static void onItemPickup(Player player, Location location, ItemStack itemStack) {
|
||||
if (itemStack == null || location == null || !Config.getConfig(location.getWorld()).ITEM_PICKUPS) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,4 +36,15 @@ public final class EntityPickupItemListener extends Queue implements Listener {
|
||||
Queue.queueItemTransaction(player.getName(), location.clone(), time, itemId);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
protected void onEntityPickupItem(EntityPickupItemEvent event) {
|
||||
if (event.getEntityType() != EntityType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
Item item = event.getItem();
|
||||
onItemPickup(player, item.getLocation(), item.getItemStack());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user