mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 02:42:14 +01:00
e886d8118e
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing
38 lines
1.4 KiB
Diff
38 lines
1.4 KiB
Diff
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
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemCooldownPlayer.java b/src/main/java/net/minecraft/server/ItemCooldownPlayer.java
|
|
index 27cde8c15576efab9a60b5741c1cd54ed4b04c6c..9da02cf0a9a1b396c2ff0f79fdd2e95003399817 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemCooldownPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemCooldownPlayer.java
|
|
@@ -1,13 +1,25 @@
|
|
package net.minecraft.server;
|
|
|
|
+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);
|