2020-08-25 14:01:03 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: KennyTV <jahnke.nassim@gmail.com>
|
|
|
|
Date: Tue, 25 Aug 2020 13:48:33 +0200
|
|
|
|
Subject: [PATCH] Add PlayerItemCooldownEvent
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java b/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java
|
|
|
|
index 5f70e39f4da2880a6f734a225be83061b00847c8..ef9ffad211473f1cbcd0b8fd200ff04ec2051f94 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java
|
|
|
|
@@ -3,14 +3,26 @@ package net.minecraft.world.item;
|
|
|
|
import net.minecraft.network.protocol.game.PacketPlayOutSetCooldown;
|
|
|
|
import net.minecraft.server.level.EntityPlayer;
|
2020-08-25 14:01:03 +02:00
|
|
|
|
|
|
|
+import io.papermc.paper.event.player.PlayerItemCooldownEvent; // Paper
|
|
|
|
+
|
|
|
|
public class ItemCooldownPlayer extends ItemCooldown {
|
|
|
|
|
|
|
|
- private final EntityPlayer a;
|
|
|
|
+ private final EntityPlayer a; public EntityPlayer getEntityPlayer() { return a; } // Paper - OBFHELPER
|
|
|
|
|
|
|
|
public ItemCooldownPlayer(EntityPlayer entityplayer) {
|
|
|
|
this.a = entityplayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public void setCooldown(Item item, int ticks) {
|
|
|
|
+ PlayerItemCooldownEvent event = new PlayerItemCooldownEvent(getEntityPlayer().getBukkitEntity(), org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), ticks);
|
|
|
|
+ if (event.callEvent()) {
|
|
|
|
+ super.setCooldown(item, event.getCooldown());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
protected void b(Item item, int i) {
|
|
|
|
super.b(item, i);
|