Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Implement ItemMergeEvent
Dieser Commit ist enthalten in:
Ursprung
8f9ff9f6fd
Commit
2359f6fcb0
@ -66,7 +66,15 @@
|
|||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +202,11 @@
|
@@ -137,6 +156,7 @@
|
||||||
|
} else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemMergeEvent(this, entityitem).isCancelled()) return false; // CraftBukkit
|
||||||
|
itemstack1.count += itemstack.count;
|
||||||
|
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
|
||||||
|
entityitem.age = Math.min(entityitem.age, this.age);
|
||||||
|
@@ -183,6 +203,11 @@
|
||||||
} else if (this.getItemStack() != null && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) {
|
} else if (this.getItemStack() != null && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -78,7 +86,7 @@
|
|||||||
this.ac();
|
this.ac();
|
||||||
this.e = (int) ((float) this.e - f);
|
this.e = (int) ((float) this.e - f);
|
||||||
if (this.e <= 0) {
|
if (this.e <= 0) {
|
||||||
@@ -228,7 +252,18 @@
|
@@ -228,7 +253,18 @@
|
||||||
|
|
||||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
|
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
|
||||||
|
|
||||||
@ -98,7 +106,7 @@
|
|||||||
if (this.getItemStack() == null) {
|
if (this.getItemStack() == null) {
|
||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
@@ -240,6 +275,26 @@
|
@@ -240,6 +276,26 @@
|
||||||
ItemStack itemstack = this.getItemStack();
|
ItemStack itemstack = this.getItemStack();
|
||||||
int i = itemstack.count;
|
int i = itemstack.count;
|
||||||
|
|
||||||
|
@ -300,6 +300,19 @@ public class CraftEventFactory {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ItemMergeEvent
|
||||||
|
*/
|
||||||
|
public static ItemMergeEvent callItemMergeEvent(EntityItem merging, EntityItem mergingWith) {
|
||||||
|
org.bukkit.entity.Item entityMerging = (org.bukkit.entity.Item) merging.getBukkitEntity();
|
||||||
|
org.bukkit.entity.Item entityMergingWith = (org.bukkit.entity.Item) mergingWith.getBukkitEntity();
|
||||||
|
|
||||||
|
ItemMergeEvent event = new ItemMergeEvent(entityMerging, entityMergingWith);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PotionSplashEvent
|
* PotionSplashEvent
|
||||||
*/
|
*/
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren