SPIGOT-3417: Event for shearing snowman
Dieser Commit ist enthalten in:
Ursprung
6659ddf11a
Commit
e03b1a556d
@ -1,18 +1,17 @@
|
||||
--- a/net/minecraft/server/EntitySnowman.java
|
||||
+++ b/net/minecraft/server/EntitySnowman.java
|
||||
@@ -1,6 +1,11 @@
|
||||
@@ -1,6 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+import org.bukkit.event.block.EntityBlockFormEvent;
|
||||
+import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
||||
|
||||
@@ -59,7 +64,7 @@
|
||||
@@ -59,7 +63,7 @@
|
||||
}
|
||||
|
||||
if (this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) > 1.0F) {
|
||||
@ -21,7 +20,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
@@ -73,7 +78,7 @@
|
||||
@@ -73,7 +77,7 @@
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
|
||||
if (this.world.getType(blockposition).getMaterial() == Material.AIR && this.world.getBiome(blockposition).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) {
|
||||
@ -30,3 +29,19 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,6 +110,15 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
|
||||
if (itemstack.getItem() == Items.SHEARS && this.hasPumpkin() && !this.world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.setHasPumpkin(false);
|
||||
itemstack.damage(1, entityhuman);
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ public class CraftSnowman extends CraftGolem implements Snowman {
|
||||
|
||||
@Override
|
||||
public boolean isDerp() {
|
||||
return getHandle().hasPumpkin();
|
||||
return !getHandle().hasPumpkin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDerp(boolean derpMode) {
|
||||
getHandle().setHasPumpkin(derpMode);
|
||||
getHandle().setHasPumpkin(!derpMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren