diff --git a/Patches/Bukkit-Patches/0030-Mineplex-Entity-Changes.patch b/Patches/Bukkit-Patches/0030-Mineplex-Entity-Changes.patch new file mode 100644 index 000000000..c9ad858a7 --- /dev/null +++ b/Patches/Bukkit-Patches/0030-Mineplex-Entity-Changes.patch @@ -0,0 +1,89 @@ +From 1826c70f0d5e8cd6161b7fb78f1cec042f0c2cbd Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Tue, 21 Apr 2015 19:12:35 -0400 +Subject: [PATCH] Mineplex - Entity Changes + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 48e2508..a94867b 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -215,7 +215,7 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { + * This method exists for legacy reasons to provide backwards + * compatibility. It will not exist at runtime and should not be used + * under any circumstances. +- * ++ * + * @return damage taken since the last no damage ticks time period + */ + @Deprecated +@@ -232,7 +232,7 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { + * This method exists for legacy reasons to provide backwards + * compatibility. It will not exist at runtime and should not be used + * under any circumstances. +- * ++ * + * @param damage amount of damage + */ + @Deprecated +@@ -392,4 +392,20 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { + * @return whether the operation was successful + */ + public boolean setLeashHolder(Entity holder); ++ ++ public boolean shouldBreakLeash(); ++ ++ public void setShouldBreakLeash(boolean shouldBreakLeash); ++ ++ public boolean shouldPullWhileLeashed(); ++ ++ public void setPullWhileLeashed(boolean pullWhileLeashed); ++ ++ public boolean isVegetated(); ++ ++ public void setVegetated(boolean vegetated); ++ ++ public boolean isGhost(); ++ ++ public void setGhost(boolean ghost); + } +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java +index 364451b..9d36cad 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java +@@ -1,21 +1,29 @@ + package org.bukkit.event.vehicle; + ++import org.bukkit.entity.Entity; + import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Vehicle; + import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; + import org.bukkit.event.HandlerList; + + /** + * Raised when a living entity exits a vehicle. + */ +-public class VehicleExitEvent extends VehicleEvent implements Cancellable { ++public class VehicleExitEvent extends Event implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; + private final LivingEntity exited; ++ private final Entity vehicle; + +- public VehicleExitEvent(final Vehicle vehicle, final LivingEntity exited) { +- super(vehicle); ++ public VehicleExitEvent(final Entity vehicle, final LivingEntity exited) { + this.exited = exited; ++ this.vehicle = vehicle; ++ } ++ ++ public Entity getVehicle() ++ { ++ return vehicle; + } + + /** +-- +2.3.5 + diff --git a/Patches/Bukkit-Patches/0032-Mineplex-Changes.patch b/Patches/Bukkit-Patches/0032-Mineplex-Changes.patch deleted file mode 100644 index db5551458..000000000 --- a/Patches/Bukkit-Patches/0032-Mineplex-Changes.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 8d364bbf8ea9d6632348ca84c5b075bcbe78098b Mon Sep 17 00:00:00 2001 -From: Shaun Bennett -Date: Sat, 29 Nov 2014 23:14:25 -0600 -Subject: [PATCH] Mineplex Changes - - -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -index 364451b..31dfe8e 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -@@ -1,21 +1,24 @@ - package org.bukkit.event.vehicle; - -+import org.bukkit.entity.Entity; - import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Vehicle; - import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; - import org.bukkit.event.HandlerList; - - /** - * Raised when a living entity exits a vehicle. - */ --public class VehicleExitEvent extends VehicleEvent implements Cancellable { -+public class VehicleExitEvent extends Event implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - private final LivingEntity exited; -+ private Entity vehicle; - -- public VehicleExitEvent(final Vehicle vehicle, final LivingEntity exited) { -- super(vehicle); -+ public VehicleExitEvent(final Entity vehicle, final LivingEntity exited) { - this.exited = exited; -+ this.vehicle = vehicle; - } - - /** -@@ -35,6 +38,11 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable { - this.cancelled = cancel; - } - -+ public Entity getVehicle() -+ { -+ return vehicle; -+ } -+ - @Override - public HandlerList getHandlers() { - return handlers; -diff --git a/src/main/java/org/bukkit/event/world/ChunkAddEntityEvent.java b/src/main/java/org/bukkit/event/world/ChunkAddEntityEvent.java -new file mode 100644 -index 0000000..6a2b07a ---- /dev/null -+++ b/src/main/java/org/bukkit/event/world/ChunkAddEntityEvent.java -@@ -0,0 +1,35 @@ -+package org.bukkit.event.world; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ -+/** -+ * Created by Shaun on 11/29/2014. -+ */ -+public class ChunkAddEntityEvent extends Event -+{ -+ private static final HandlerList handlers = new HandlerList(); -+ private Entity _entity; -+ -+ public ChunkAddEntityEvent(Entity entity) -+ { -+ _entity = entity; -+ } -+ -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+ -+ public Entity getEntity() -+ { -+ return _entity; -+ } -+ -+} -diff --git a/src/main/java/org/bukkit/event/world/ChunkPreLoadEvent.java b/src/main/java/org/bukkit/event/world/ChunkPreLoadEvent.java -new file mode 100644 -index 0000000..6764e30 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/world/ChunkPreLoadEvent.java -@@ -0,0 +1,62 @@ -+package org.bukkit.event.world; -+ -+import org.bukkit.World; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ -+/** -+ * Created by Shaun on 11/29/2014. -+ */ -+public class ChunkPreLoadEvent extends Event implements Cancellable -+{ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean _cancelled; -+ private World _world; -+ private int _x; -+ private int _z; -+ -+ public ChunkPreLoadEvent(World world, int x, int z) -+ { -+ _world = world; -+ _x = x; -+ _z = z; -+ } -+ -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+ -+ public World getWorld() -+ { -+ return _world; -+ } -+ -+ public int getX() -+ { -+ return _x; -+ } -+ -+ public int getZ() -+ { -+ return _z; -+ } -+ -+ @Override -+ public boolean isCancelled() -+ { -+ return _cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) -+ { -+ _cancelled = cancel; -+ } -+} --- -1.9.4.msysgit.0 - diff --git a/Patches/CraftBukkit-Patches/0158-Mineplex-Chunk-Changes.patch b/Patches/CraftBukkit-Patches/0158-Mineplex-Chunk-Changes.patch new file mode 100644 index 000000000..07130610f --- /dev/null +++ b/Patches/CraftBukkit-Patches/0158-Mineplex-Chunk-Changes.patch @@ -0,0 +1,235 @@ +From ae9ac1273b240b9fc5209bd5c7fe59bf1072e944 Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Sun, 19 Apr 2015 01:54:13 -0400 +Subject: [PATCH] Mineplex - Chunk Changes + + +diff --git a/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java +new file mode 100644 +index 0000000..3f16935 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java +@@ -0,0 +1,31 @@ ++package com.mineplex.spigot; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++public class ChunkAddEntityEvent extends Event ++{ ++ private static final HandlerList handlers = new HandlerList(); ++ private Entity _entity; ++ ++ public ChunkAddEntityEvent(Entity _entity) ++ { ++ this._entity = _entity; ++ } ++ ++ public Entity getEntity() ++ { ++ return _entity; ++ } ++ ++ public HandlerList getHandlers() ++ { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() ++ { ++ return handlers; ++ } ++} +diff --git a/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java +new file mode 100644 +index 0000000..21d75c7 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java +@@ -0,0 +1,60 @@ ++package com.mineplex.spigot; ++ ++import org.bukkit.World; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++public class ChunkPreLoadEvent extends Event implements Cancellable ++{ ++ private static final HandlerList handlers = new HandlerList(); ++ private boolean _cancelled; ++ private World _world; ++ private int _x; ++ private int _z; ++ ++ public ChunkPreLoadEvent(World world, int x, int z) ++ { ++ _world = world; ++ _x = x; ++ _z = z; ++ } ++ ++ public World getWorld() ++ { ++ return _world; ++ } ++ ++ public int getX() ++ { ++ return _x; ++ } ++ ++ public int getZ() ++ { ++ return _z; ++ } ++ ++ @Override ++ public boolean isCancelled() ++ { ++ return _cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) ++ { ++ _cancelled = cancel; ++ } ++ ++ @Override ++ public HandlerList getHandlers() ++ { ++ return null; ++ } ++ ++ public static HandlerList getHandlerList() ++ { ++ return handlers; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index d5922fe..0a0e778 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -11,6 +11,8 @@ import java.util.Map; + import java.util.Random; + import java.util.concurrent.Callable; + import java.util.concurrent.ConcurrentLinkedQueue; ++ ++import com.mineplex.spigot.ChunkAddEntityEvent; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -660,6 +662,9 @@ public class Chunk { + entity.die(); + } + ++ ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity); ++ Bukkit.getServer().getPluginManager().callEvent(event); ++ + int k = MathHelper.floor(entity.locY / 16.0D); + + if (k < 0) { +@@ -1317,6 +1322,10 @@ public class Chunk { + return this.done; + } + ++ public void setDone(boolean done) { ++ this.done = done; ++ } ++ + public void d(boolean flag) { + this.done = flag; + } +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 74710f9..b0d132f 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -8,6 +8,8 @@ import java.util.Iterator; + import java.util.List; + import java.util.Set; + import java.util.concurrent.ConcurrentHashMap; ++ ++import com.mineplex.spigot.ChunkPreLoadEvent; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -88,6 +90,13 @@ public class ChunkProviderServer implements IChunkProvider { + + } + ++ private boolean callChunkPreLoad(int i, int j) ++ { ++ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); ++ world.getServer().getPluginManager().callEvent(event); ++ return event.isCancelled(); ++ } ++ + // CraftBukkit start - Add async variant, provide compatibility + public Chunk getChunkIfLoaded(int x, int z) { + return chunks.get(LongHash.toLong(x, z)); +@@ -109,10 +118,30 @@ public class ChunkProviderServer implements IChunkProvider { + // We can only use the queue for already generated chunks + if (chunk == null && loader != null && loader.chunkExists(world, i, j)) { + if (runnable != null) { +- ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable); ++ if (callChunkPreLoad(i, j)) ++ { ++ runnable.run(); ++ chunk = new EmptyChunk(world, i, j); ++ chunk.setDone(true); ++ chunks.put(LongHash.toLong(i, j), chunk); ++ } ++ else ++ { ++ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable); ++ } ++ + return null; + } else { +- chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j); ++ if (callChunkPreLoad(i, j)) ++ { ++ chunk = new EmptyChunk(world, i, j); ++ chunk.setDone(true); ++ chunks.put(LongHash.toLong(i, j), chunk); ++ } ++ else ++ { ++ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j); ++ } + } + } else if (chunk == null) { + chunk = originalGetChunkAt(i, j); +@@ -131,6 +160,20 @@ public class ChunkProviderServer implements IChunkProvider { + boolean newChunk = false; + // CraftBukkit end + ++ Server server = world.getServer(); ++ ++ if (chunk == null && server != null) ++ { ++ if (callChunkPreLoad(i, j)) ++ { ++ chunk = new EmptyChunk(world, i, j); ++ chunk.setDone(true); ++ chunks.put(LongHash.toLong(i, j), chunk); ++ ++ return chunk; ++ } ++ } ++ + if (chunk == null) { + world.timings.syncChunkLoadTimer.startTiming(); // Spigot + chunk = this.loadChunk(i, j); +@@ -158,7 +201,6 @@ public class ChunkProviderServer implements IChunkProvider { + chunk.addEntities(); + + // CraftBukkit start +- Server server = world.getServer(); + if (server != null) { + /* + * If it's a new world, the first few chunks are generated inside +-- +2.3.5 + diff --git a/Patches/CraftBukkit-Patches/0159-Mineplex-Ignore-EULA.patch b/Patches/CraftBukkit-Patches/0159-Mineplex-Ignore-EULA.patch new file mode 100644 index 000000000..3ec80d4d8 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0159-Mineplex-Ignore-EULA.patch @@ -0,0 +1,22 @@ +From ea05a1c2416044cfea21d0442675b0094dbaecab Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Sun, 19 Apr 2015 02:01:08 -0400 +Subject: [PATCH] Mineplex - Ignore EULA + + +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 86ff385..95ff1d4 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -133,7 +133,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); + } + // Spigot End +- if (!this.p.a() && !eulaAgreed) { // Spigot ++ if (false && !this.p.a() && !eulaAgreed) { // Spigot + DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + this.p.b(); + return false; +-- +2.3.5 + diff --git a/Patches/CraftBukkit-Patches/0160-Mineplex-Entity-Changes.patch b/Patches/CraftBukkit-Patches/0160-Mineplex-Entity-Changes.patch new file mode 100644 index 000000000..064e460e1 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0160-Mineplex-Entity-Changes.patch @@ -0,0 +1,901 @@ +From 03e6d60b6ac992d560d2a404e3eae2f63085edda Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Tue, 21 Apr 2015 19:12:35 -0400 +Subject: [PATCH] Mineplex - Entity Changes + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index d6bef0b..c683d78 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -124,6 +124,20 @@ public abstract class Entity implements ICommandListener { + public void inactiveTick() { } + // Spigot end + ++ // Mineplex ++ private boolean _silent; ++ private boolean _invisible; ++ ++ public boolean isSilent() ++ { ++ return _silent; ++ } ++ ++ public void setSilent(boolean silent) ++ { ++ _silent = silent; ++ } ++ + public int getId() { + return this.id; + } +@@ -683,7 +697,9 @@ public abstract class Entity implements ICommandListener { + this.makeSound(this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + } + +- this.a(blockposition, block); ++ if (!isSilent()) ++ this.a(blockposition, block); ++ + block.a(this.world, blockposition, this); // CraftBukkit moved from above + } + } +@@ -785,7 +801,7 @@ public abstract class Entity implements ICommandListener { + } + + public void makeSound(String s, float f, float f1) { +- if (!this.R()) { ++ if (!isSilent() || !this.R()) { + this.world.makeSound(this, s, f, f1); + } + +@@ -1536,8 +1552,8 @@ public abstract class Entity implements ICommandListener { + if (entity == null) { + if (this.vehicle != null) { + // CraftBukkit start +- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) { +- VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); ++ if (this.bukkitEntity instanceof LivingEntity) { ++ VehicleExitEvent event = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); + pluginManager.callEvent(event); + + if (event.isCancelled() || vehicle != originalVehicle) { +@@ -1553,11 +1569,11 @@ public abstract class Entity implements ICommandListener { + this.vehicle = null; + } else { + // CraftBukkit start +- if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { ++ if ((this.bukkitEntity instanceof LivingEntity) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { + // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. + VehicleExitEvent exitEvent = null; +- if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) { +- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); ++ if (this.vehicle != null) { ++ exitEvent = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); + pluginManager.callEvent(exitEvent); + + if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) { +@@ -1679,9 +1695,20 @@ public abstract class Entity implements ICommandListener { + } + + public void setInvisible(boolean flag) { ++ if (isMineplexInvisible() && !flag) ++ return; ++ + this.b(5, flag); + } + ++ public boolean isMineplexInvisible() { ++ return _invisible; ++ } ++ ++ public void setMineplexInvisible(boolean flag) { ++ _invisible = flag; ++ } ++ + public void f(boolean flag) { + this.b(4, flag); + } +diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java +new file mode 100644 +index 0000000..bffd3dc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityBat.java +@@ -0,0 +1,206 @@ ++package net.minecraft.server; ++ ++import java.util.Calendar; ++ ++public class EntityBat extends EntityAmbient { ++ ++ private BlockPosition a; ++ private boolean _vegetated; ++ ++ public EntityBat(World world) { ++ super(world); ++ this.setSize(0.5F, 0.9F); ++ this.setAsleep(true); ++ ++ _vegetated = false; ++ } ++ ++ public void setVegetated(boolean flag) { ++ _vegetated = flag; ++ } ++ ++ public boolean isVegetated() { ++ return _vegetated; ++ } ++ ++ protected void h() { ++ super.h(); ++ this.datawatcher.a(16, new Byte((byte) 0)); ++ } ++ ++ protected float bB() { ++ return 0.1F; ++ } ++ ++ protected float bC() { ++ return super.bC() * 0.95F; ++ } ++ ++ protected String z() { ++ return this.isAsleep() && this.random.nextInt(4) != 0 ? null : "mob.bat.idle"; ++ } ++ ++ protected String bo() { ++ return "mob.bat.hurt"; ++ } ++ ++ protected String bp() { ++ return "mob.bat.death"; ++ } ++ ++ public boolean ae() { ++ return false; ++ } ++ ++ protected void s(Entity entity) {} ++ ++ protected void bL() {} ++ ++ protected void initAttributes() ++ { ++ super.initAttributes(); ++ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D); ++ } ++ ++ public boolean isAsleep() { ++ return (this.datawatcher.getByte(16) & 1) != 0; ++ } ++ ++ public void setAsleep(boolean flag) { ++ byte b0 = this.datawatcher.getByte(16); ++ ++ if (flag) { ++ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1))); ++ } else { ++ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2))); ++ } ++ ++ } ++ ++ public void t_() { ++ super.t_(); ++ ++ if (isVegetated()) ++ return; ++ ++ if (this.isAsleep()) { ++ this.motX = this.motY = this.motZ = 0.0D; ++ this.locY = (double) MathHelper.floor(this.locY) + 1.0D - (double) this.length; ++ } else { ++ this.motY *= 0.6000000238418579D; ++ } ++ ++ } ++ ++ protected void E() { ++ super.E(); ++ ++ if (isVegetated()) ++ return; ++ ++ BlockPosition blockposition = new BlockPosition(this); ++ BlockPosition blockposition1 = blockposition.up(); ++ ++ if (this.isAsleep()) { ++ if (!this.world.getType(blockposition1).getBlock().isOccluding()) { ++ this.setAsleep(false); ++ this.world.a((EntityHuman) null, 1015, blockposition, 0); ++ } else { ++ if (this.random.nextInt(200) == 0) { ++ this.aK = (float) this.random.nextInt(360); ++ } ++ ++ if (this.world.findNearbyPlayer(this, 4.0D) != null) { ++ this.setAsleep(false); ++ this.world.a((EntityHuman) null, 1015, blockposition, 0); ++ } ++ } ++ } else { ++ if (this.a != null && (!this.world.isEmpty(this.a) || this.a.getY() < 1)) { ++ this.a = null; ++ } ++ ++ if (this.a == null || this.random.nextInt(30) == 0 || this.a.c((double) ((int) this.locX), (double) ((int) this.locY), (double) ((int) this.locZ)) < 4.0D) { ++ this.a = new BlockPosition((int) this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int) this.locY + this.random.nextInt(6) - 2, (int) this.locZ + this.random.nextInt(7) - this.random.nextInt(7)); ++ } ++ ++ double d0 = (double) this.a.getX() + 0.5D - this.locX; ++ double d1 = (double) this.a.getY() + 0.1D - this.locY; ++ double d2 = (double) this.a.getZ() + 0.5D - this.locZ; ++ ++ this.motX += (Math.signum(d0) * 0.5D - this.motX) * 0.10000000149011612D; ++ this.motY += (Math.signum(d1) * 0.699999988079071D - this.motY) * 0.10000000149011612D; ++ this.motZ += (Math.signum(d2) * 0.5D - this.motZ) * 0.10000000149011612D; ++ float f = (float) (MathHelper.b(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) - 90.0F; ++ float f1 = MathHelper.g(f - this.yaw); ++ ++ this.ba = 0.5F; ++ this.yaw += f1; ++ if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).getBlock().isOccluding()) { ++ this.setAsleep(true); ++ } ++ } ++ ++ } ++ ++ protected boolean s_() { ++ return false; ++ } ++ ++ public void e(float f, float f1) {} ++ ++ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {} ++ ++ public boolean aI() { ++ return true; ++ } ++ ++ public boolean damageEntity(DamageSource damagesource, float f) { ++ if (this.isInvulnerable(damagesource)) { ++ return false; ++ } else { ++ if (!this.world.isClientSide && this.isAsleep()) { ++ this.setAsleep(false); ++ } ++ ++ return super.damageEntity(damagesource, f); ++ } ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ super.a(nbttagcompound); ++ this.datawatcher.watch(16, Byte.valueOf(nbttagcompound.getByte("BatFlags"))); ++ } ++ ++ public void b(NBTTagCompound nbttagcompound) { ++ super.b(nbttagcompound); ++ nbttagcompound.setByte("BatFlags", this.datawatcher.getByte(16)); ++ } ++ ++ public boolean bR() { ++ BlockPosition blockposition = new BlockPosition(this.locX, this.getBoundingBox().b, this.locZ); ++ ++ if (blockposition.getY() >= this.world.F()) { ++ return false; ++ } else { ++ int i = this.world.getLightLevel(blockposition); ++ byte b0 = 4; ++ ++ if (this.a(this.world.Y())) { ++ b0 = 7; ++ } else if (this.random.nextBoolean()) { ++ return false; ++ } ++ ++ return i > this.random.nextInt(b0) ? false : super.bR(); ++ } ++ } ++ ++ private boolean a(Calendar calendar) { ++ return calendar.get(2) + 1 == 10 && calendar.get(5) >= 20 || calendar.get(2) + 1 == 11 && calendar.get(5) <= 3; ++ } ++ ++ public float getHeadHeight() { ++ return this.length / 2.0F; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java +new file mode 100644 +index 0000000..53da5c2 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityBlaze.java +@@ -0,0 +1,207 @@ ++package net.minecraft.server; ++ ++public class EntityBlaze extends EntityMonster { ++ ++ private float a = 0.5F; ++ private int b; ++ ++ public EntityBlaze(World world) { ++ super(world); ++ this.fireProof = true; ++ this.b_ = 10; ++ this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this)); ++ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); ++ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); ++ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); ++ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); ++ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0])); ++ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true)); ++ } ++ ++ protected void initAttributes() { ++ super.initAttributes(); ++ this.getAttributeInstance(GenericAttributes.e).setValue(6.0D); ++ this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D); ++ this.getAttributeInstance(GenericAttributes.b).setValue(48.0D); ++ } ++ ++ protected void h() { ++ super.h(); ++ this.datawatcher.a(16, new Byte((byte) 0)); ++ } ++ ++ protected String z() { ++ return "mob.blaze.breathe"; ++ } ++ ++ protected String bo() { ++ return "mob.blaze.hit"; ++ } ++ ++ protected String bp() { ++ return "mob.blaze.death"; ++ } ++ ++ public float c(float f) { ++ return 1.0F; ++ } ++ ++ public void m() { ++ if (!isVegetated() && !this.onGround && this.motY < 0.0D) { ++ this.motY *= 0.6D; ++ } ++ ++ if (this.world.isClientSide) { ++ if (this.random.nextInt(24) == 0 && !this.R()) { ++ this.world.a(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F, false); ++ } ++ ++ for (int i = 0; i < 2; ++i) { ++ this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); ++ } ++ } ++ ++ super.m(); ++ } ++ ++ protected void E() { ++ if (this.U()) { ++ this.damageEntity(DamageSource.DROWN, 1.0F); ++ } ++ ++ --this.b; ++ if (this.b <= 0) { ++ this.b = 100; ++ this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F; ++ } ++ ++ EntityLiving entityliving = this.getGoalTarget(); ++ ++ if (!isVegetated() && entityliving != null && entityliving.locY + (double) entityliving.getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) { ++ this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D; ++ this.ai = true; ++ } ++ ++ super.E(); ++ } ++ ++ public void e(float f, float f1) {} ++ ++ protected Item getLoot() { ++ return Items.BLAZE_ROD; ++ } ++ ++ public boolean isBurning() { ++ return this.n(); ++ } ++ ++ protected void dropDeathLoot(boolean flag, int i) { ++ if (flag) { ++ int j = this.random.nextInt(2 + i); ++ ++ for (int k = 0; k < j; ++k) { ++ this.a(Items.BLAZE_ROD, 1); ++ } ++ } ++ ++ } ++ ++ public boolean n() { ++ return (this.datawatcher.getByte(16) & 1) != 0; ++ } ++ ++ public void a(boolean flag) { ++ byte b0 = this.datawatcher.getByte(16); ++ ++ if (flag) { ++ b0 = (byte) (b0 | 1); ++ } else { ++ b0 &= -2; ++ } ++ ++ this.datawatcher.watch(16, Byte.valueOf(b0)); ++ } ++ ++ protected boolean n_() { ++ return true; ++ } ++ ++ static class PathfinderGoalBlazeFireball extends PathfinderGoal { ++ ++ private EntityBlaze a; ++ private int b; ++ private int c; ++ ++ public PathfinderGoalBlazeFireball(EntityBlaze entityblaze) { ++ this.a = entityblaze; ++ this.a(3); ++ } ++ ++ public boolean a() { ++ EntityLiving entityliving = this.a.getGoalTarget(); ++ ++ return entityliving != null && entityliving.isAlive(); ++ } ++ ++ public void c() { ++ this.b = 0; ++ } ++ ++ public void d() { ++ this.a.a(false); ++ } ++ ++ public void e() { ++ --this.c; ++ EntityLiving entityliving = this.a.getGoalTarget(); ++ double d0 = this.a.h(entityliving); ++ ++ if (d0 < 4.0D) { ++ if (this.c <= 0) { ++ this.c = 20; ++ this.a.r(entityliving); ++ } ++ ++ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D); ++ } else if (d0 < 256.0D) { ++ double d1 = entityliving.locX - this.a.locX; ++ double d2 = entityliving.getBoundingBox().b + (double) (entityliving.length / 2.0F) - (this.a.locY + (double) (this.a.length / 2.0F)); ++ double d3 = entityliving.locZ - this.a.locZ; ++ ++ if (this.c <= 0) { ++ ++this.b; ++ if (this.b == 1) { ++ this.c = 60; ++ this.a.a(true); ++ } else if (this.b <= 4) { ++ this.c = 6; ++ } else { ++ this.c = 100; ++ this.b = 0; ++ this.a.a(false); ++ } ++ ++ if (this.b > 1) { ++ float f = MathHelper.c(MathHelper.sqrt(d0)) * 0.5F; ++ ++ this.a.world.a((EntityHuman) null, 1009, new BlockPosition((int) this.a.locX, (int) this.a.locY, (int) this.a.locZ), 0); ++ ++ for (int i = 0; i < 1; ++i) { ++ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.a.world, this.a, d1 + this.a.bc().nextGaussian() * (double) f, d2, d3 + this.a.bc().nextGaussian() * (double) f); ++ ++ entitysmallfireball.locY = this.a.locY + (double) (this.a.length / 2.0F) + 0.5D; ++ this.a.world.addEntity(entitysmallfireball); ++ } ++ } ++ } ++ ++ this.a.getControllerLook().a(entityliving, 10.0F, 10.0F); ++ } else { ++ this.a.getNavigation().n(); ++ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D); ++ } ++ ++ super.e(); ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +index 4bdcfc6..9539b66 100644 +--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +@@ -60,6 +60,18 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo + super.h(); + } + ++ public void setTargetBlock(int x, int y, int z) { ++ // Mineplex ++ this.a = x; ++ this.b = y; ++ this.c = z; ++ this.bA = null; ++ } ++ ++ public void setTargetEntity(Entity e) { ++ this.bA = e; ++ } ++ + public double[] b(int i, float f) { + if (this.getHealth() <= 0.0F) { + f = 0.0F; +@@ -170,7 +182,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo + this.c += this.random.nextGaussian() * 2.0D; + } + +- if (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) { ++ if (!isVegetated() && (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E)) { + this.cf(); + } + +@@ -253,7 +265,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo + this.bs.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.bt.t_(); + this.bt.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); +- if (!this.world.isClientSide && this.hurtTicks == 0) { ++ if (!this.world.isClientSide && this.hurtTicks == 0 && !isGhost()) { + this.a(this.world.getEntities(this, this.bs.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); + this.a(this.world.getEntities(this, this.bt.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); + this.b(this.world.getEntities(this, this.bn.getBoundingBox().grow(1.0D, 1.0D, 1.0D))); +diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +index ce91553..59ada33 100644 +--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +@@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity { + private float fallHurtAmount = 2.0F; + public NBTTagCompound tileEntityData; + ++ public boolean spectating; ++ + public EntityFallingBlock(World world) { + super(world); + } +@@ -42,7 +44,7 @@ public class EntityFallingBlock extends Entity { + protected void h() {} + + public boolean ad() { +- return !this.dead; ++ return !this.dead && !spectating; + } + + public void t_() { +@@ -219,6 +221,14 @@ public class EntityFallingBlock extends Entity { + + } + ++ @Override ++ public boolean damageEntity(DamageSource damagesource, float f) ++ { ++ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f); ++ ++ return true; ++ } ++ + public void a(boolean flag) { + this.hurtEntities = flag; + } +diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java +index 688099f..404dda2 100644 +--- a/src/main/java/net/minecraft/server/EntityHorse.java ++++ b/src/main/java/net/minecraft/server/EntityHorse.java +@@ -125,6 +125,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { + private void c(int i, boolean flag) { + int j = this.datawatcher.getInt(16); + ++ if (isVegetated()) ++ return; ++ + if (flag) { + this.datawatcher.watch(16, Integer.valueOf(j | i)); + } else { +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index d73395a..7a9eacb 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -133,7 +133,7 @@ public abstract class EntityHuman extends EntityLiving { + if (this.g != null) { + ItemStack itemstack = this.inventory.getItemInHand(); + +- if (itemstack == this.g) { ++ if (ItemStack.equals(itemstack, this.g)) { + if (this.h <= 25 && this.h % 4 == 0) { + this.b(itemstack, 5); + } +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index 9621ce0..463d578 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -35,6 +35,10 @@ public abstract class EntityInsentient extends EntityLiving { + private Entity bp; + private NBTTagCompound bq; + ++ private boolean _vegetated; ++ private boolean _shouldBreakLeash; ++ private boolean _pullWhileLeashed; ++ + public EntityInsentient(World world) { + super(world); + this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null); +@@ -53,6 +57,11 @@ public abstract class EntityInsentient extends EntityLiving { + // CraftBukkit start - default persistance to type's persistance value + this.persistent = !isTypeNotPersistent(); + // CraftBukkit end ++ ++ // Mineplex ++ _vegetated = false; ++ _shouldBreakLeash = true; ++ _pullWhileLeashed = true; + } + + protected void initAttributes() { +@@ -149,7 +158,7 @@ public abstract class EntityInsentient extends EntityLiving { + public void K() { + super.K(); + this.world.methodProfiler.a("mobBaseTick"); +- if (this.isAlive() && this.random.nextInt(1000) < this.a_++) { ++ if (this.isAlive() && !isSilent() && this.random.nextInt(1000) < this.a_++) { + this.a_ = -this.w(); + this.x(); + } +@@ -771,7 +780,7 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public final boolean e(EntityHuman entityhuman) { +- if (this.cc() && this.getLeashHolder() == entityhuman) { ++ if (this.cc() && this.getLeashHolder() == entityhuman && _shouldBreakLeash) { + // CraftBukkit start - fire PlayerUnleashEntityEvent + if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); +@@ -836,7 +845,7 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public void unleash(boolean flag, boolean flag1) { +- if (this.bo) { ++ if (this.bo && _shouldBreakLeash) { + this.bo = false; + this.bp = null; + if (!this.world.isClientSide && flag1) { +@@ -936,6 +945,32 @@ public abstract class EntityInsentient extends EntityLiving { + return this.datawatcher.getByte(15) != 0; + } + ++ public void setVegetated(boolean flag) { ++ _vegetated = flag; ++ } ++ ++ public void setShouldBreakLeash(boolean shouldBreakLeash) ++ { ++ _shouldBreakLeash = shouldBreakLeash; ++ } ++ ++ public void setPullWhileLeashed(boolean pullWhileLeashed) ++ { ++ _pullWhileLeashed = pullWhileLeashed; ++ } ++ ++ public boolean isVegetated() { ++ return _vegetated; ++ } ++ ++ public boolean shouldBreakLeash() { ++ return shouldBreakLeash(); ++ } ++ ++ public boolean shouldPullWhileLeashed() { ++ return _pullWhileLeashed; ++ } ++ + public static enum EnumEntityPositionType { + + ON_GROUND, IN_AIR, IN_WATER; +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 99b120a..12d735d 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -97,6 +97,8 @@ public abstract class EntityLiving extends Entity { + } + // Spigot end + ++ private boolean _ghost; ++ + public void G() { + this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); + } +@@ -1782,7 +1784,7 @@ public abstract class EntityLiving extends Entity { + } + + public boolean ad() { +- return !this.dead; ++ return !isGhost() && !this.dead; + } + + public boolean ae() { +@@ -1836,4 +1838,12 @@ public abstract class EntityLiving extends Entity { + protected void bP() { + this.updateEffects = true; + } ++ ++ public boolean isGhost() { ++ return _ghost; ++ } ++ ++ public void setGhost(boolean ghost) { ++ _ghost = ghost; ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 3854edf..c52d591 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -65,10 +65,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + // Spigot start + public boolean collidesWithEntities = true; + ++ // Mineplex ++ public boolean spectating; ++ + @Override + public boolean ad() + { +- return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) ++ return !spectating && this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) + } + + @Override +diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +index 2d22327..3aa9467 100644 +--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +@@ -9,6 +9,9 @@ public class EntityTNTPrimed extends Entity { + public float yield = 4; // CraftBukkit - add field + public boolean isIncendiary = false; // CraftBukkit - add field + ++ // Mineplex ++ public boolean spectating; ++ + public EntityTNTPrimed(World world) { + super(world); + this.k = true; +@@ -37,7 +40,7 @@ public class EntityTNTPrimed extends Entity { + } + + public boolean ad() { +- return !this.dead; ++ return !spectating && !this.dead; + } + + public void t_() { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 5317cff..3ab939f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -461,6 +461,54 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + return true; + } + ++ @Override ++ public boolean shouldBreakLeash() ++ { ++ return ((EntityInsentient) getHandle()).shouldBreakLeash(); ++ } ++ ++ @Override ++ public void setShouldBreakLeash(boolean shouldBreakLeash) ++ { ++ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash); ++ } ++ ++ @Override ++ public boolean shouldPullWhileLeashed() ++ { ++ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed(); ++ } ++ ++ @Override ++ public void setPullWhileLeashed(boolean pullWhileLeashed) ++ { ++ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed); ++ } ++ ++ @Override ++ public boolean isVegetated() ++ { ++ return ((EntityInsentient) getHandle()).isVegetated(); ++ } ++ ++ @Override ++ public void setVegetated(boolean vegetated) ++ { ++ ((EntityInsentient) getHandle()).setVegetated(vegetated); ++ } ++ ++ @Override ++ public boolean isGhost() ++ { ++ return getHandle().isGhost(); ++ } ++ ++ @Override ++ public void setGhost(boolean ghost) ++ { ++ getHandle().setGhost(ghost); ++ } ++ + @Deprecated + public int _INVALID_getLastDamage() { + return NumberConversions.ceil(getLastDamage()); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 06e014c..0adc2a9 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -874,10 +874,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + @Override + public void hidePlayer(Player player) { ++ hidePlayer(player, false, true); ++ } ++ ++ public void hidePlayer(Player player, boolean override, boolean hideList) { + Validate.notNull(player, "hidden player cannot be null"); + if (getHandle().playerConnection == null) return; + if (equals(player)) return; +- if (hiddenPlayers.contains(player.getUniqueId())) return; ++ if (!override && hiddenPlayers.contains(player.getUniqueId())) return; + hiddenPlayers.add(player.getUniqueId()); + + //remove this player from the hidden player's EntityTrackerEntry +@@ -889,7 +893,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + //remove the hidden player from this player user list +- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other)); ++ if (hideList) ++ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other)); + } + + @Override +@@ -1336,13 +1341,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + @Override + public boolean getCollidesWithEntities() + { +- return getHandle().collidesWithEntities; ++ return !getHandle().spectating; ++// return getHandle().collidesWithEntities; + } + + @Override + public void setCollidesWithEntities(boolean collides) + { +- getHandle().collidesWithEntities = collides; ++ getHandle().spectating = !collides; + getHandle().k = collides; // First boolean of Entity + } + +-- +2.3.5 + diff --git a/Patches/CraftBukkit-Patches/0161-Mineplex-Changes.patch b/Patches/CraftBukkit-Patches/0161-Mineplex-Changes.patch deleted file mode 100644 index e71f53f08..000000000 --- a/Patches/CraftBukkit-Patches/0161-Mineplex-Changes.patch +++ /dev/null @@ -1,2128 +0,0 @@ -From d9dfe49376fe2b1f709f9f20e62db39fd9381956 Mon Sep 17 00:00:00 2001 -From: Shaun Bennett -Date: Sun, 30 Nov 2014 00:10:38 -0600 -Subject: [PATCH] Mineplex Changes - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 858e12c..5c84ad2 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -16,6 +16,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - - import org.bukkit.Bukkit; // CraftBukkit -+import org.bukkit.event.world.ChunkAddEntityEvent; - - public class Chunk { - -@@ -648,6 +649,9 @@ public class Chunk { - entity.die(); - } - -+ ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity); -+ Bukkit.getServer().getPluginManager().callEvent(event); -+ - int k = MathHelper.floor(entity.locY / 16.0D); - - if (k < 0) { -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 9ee7e75..5b0d9ab 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -19,6 +19,7 @@ import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; - import org.bukkit.craftbukkit.util.LongHash; - import org.bukkit.craftbukkit.util.LongHashSet; - import org.bukkit.craftbukkit.util.LongObjectHashMap; -+import org.bukkit.event.world.ChunkPreLoadEvent; - import org.bukkit.event.world.ChunkUnloadEvent; - // CraftBukkit end - -@@ -107,10 +108,44 @@ public class ChunkProviderServer implements IChunkProvider { - // We can only use the queue for already generated chunks - if (chunk == null && loader != null && loader.chunkExists(world, i, j)) { - if (runnable != null) { -- ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable); -+ Server server = this.world.getServer(); -+ -+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); -+ server.getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) -+ { -+ runnable.run(); -+ -+ chunk = new EmptyChunk(world, i, j); -+ chunk.done = true; -+ chunks.put(LongHash.toLong(i, j), chunk); -+ } -+ else -+ { -+ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable); -+ } -+ - return null; - } else { -- chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j); -+ Server server = this.world.getServer(); -+ -+ if (server != null) -+ { -+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); -+ server.getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) -+ { -+ chunk = new EmptyChunk(world, i, j); -+ chunk.done = true; -+ chunks.put(LongHash.toLong(i, j), chunk); -+ } -+ else -+ { -+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j); -+ } -+ } - } - } else if (chunk == null) { - chunk = originalGetChunkAt(i, j); -@@ -129,6 +164,23 @@ public class ChunkProviderServer implements IChunkProvider { - boolean newChunk = false; - // CraftBukkit end - -+ Server server = this.world.getServer(); -+ -+ if (chunk == null && server != null) -+ { -+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); -+ server.getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) -+ { -+ chunk = new EmptyChunk(world, i, j); -+ chunk.done = true; -+ chunks.put(LongHash.toLong(i, j), chunk); -+ -+ return chunk; -+ } -+ } -+ - if (chunk == null) { - world.timings.syncChunkLoadTimer.startTiming(); // Spigot - chunk = this.loadChunk(i, j); -@@ -155,7 +207,6 @@ public class ChunkProviderServer implements IChunkProvider { - chunk.addEntities(); - - // CraftBukkit start -- Server server = world.getServer(); - if (server != null) { - /* - * If it's a new world, the first few chunks are generated inside -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 2806f1e..f37e8b4 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -86,7 +86,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); - } - // Spigot End -- if (!this.o.a() && !eulaAgreed) { // Spigot -+ if (false && !this.o.a() && !eulaAgreed) { // Spigot - DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); - this.o.b(); - return false; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b0a90d7..841b714 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -122,6 +122,9 @@ public abstract class Entity implements ICommandListener { - public void inactiveTick() { } - // Spigot end - -+ public boolean Silent; -+ public boolean Invisible; -+ - public int getId() { - return this.id; - } -@@ -684,7 +687,9 @@ public abstract class Entity implements ICommandListener { - this.makeSound(this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); - } - -- this.a(blockposition, block); -+ if (!Silent) -+ this.a(blockposition, block); -+ - block.a(this.world, blockposition, this); // CraftBukkit - moved from above - } - } -@@ -786,7 +791,7 @@ public abstract class Entity implements ICommandListener { - } - - public void makeSound(String s, float f, float f1) { -- if (!this.R()) { -+ if (!Silent && !this.R()) { - this.world.makeSound(this, s, f, f1); - } - -@@ -1541,8 +1546,8 @@ public abstract class Entity implements ICommandListener { - if (entity == null) { - if (this.vehicle != null) { - // CraftBukkit start -- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) { -- VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); -+ if ((this.bukkitEntity instanceof LivingEntity)) { -+ VehicleExitEvent event = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); - pluginManager.callEvent(event); - - if (event.isCancelled() || vehicle != originalVehicle) { -@@ -1558,11 +1563,11 @@ public abstract class Entity implements ICommandListener { - this.vehicle = null; - } else { - // CraftBukkit start -- if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { -+ if ((this.bukkitEntity instanceof LivingEntity)&& entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { - // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. - VehicleExitEvent exitEvent = null; -- if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) { -- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); -+ if (this.vehicle != null) { -+ exitEvent = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); - pluginManager.callEvent(exitEvent); - - if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) { -@@ -1686,6 +1691,9 @@ public abstract class Entity implements ICommandListener { - } - - public void setInvisible(boolean flag) { -+ if (Invisible && !flag) -+ return; -+ - this.b(5, flag); - } - -diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java -new file mode 100644 -index 0000000..aac4e0a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityBat.java -@@ -0,0 +1,208 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import java.util.Calendar; -+import net.minecraft.server.Block; -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.DamageSource; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityAmbient; -+import net.minecraft.server.EntityHuman; -+import net.minecraft.server.GenericAttributes; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.NBTTagCompound; -+import net.minecraft.server.World; -+ -+public class EntityBat extends EntityAmbient { -+ private BlockPosition a; -+ -+ public boolean Vegetated = false; -+ -+ public EntityBat(World var1) { -+ super(var1); -+ this.a(0.5F, 0.9F); -+ this.setAsleep(true); -+ } -+ -+ protected void h() { -+ super.h(); -+ this.datawatcher.a(16, new Byte((byte)0)); -+ } -+ -+ protected float bA() { -+ return 0.1F; -+ } -+ -+ protected float bB() { -+ return super.bB() * 0.95F; -+ } -+ -+ protected String z() { -+ return this.isAsleep() && this.random.nextInt(4) != 0?null:"mob.bat.idle"; -+ } -+ -+ protected String bn() { -+ return "mob.bat.hurt"; -+ } -+ -+ protected String bo() { -+ return "mob.bat.death"; -+ } -+ -+ public boolean ae() { -+ return false; -+ } -+ -+ protected void s(Entity var1) { -+ } -+ -+ protected void bK() { -+ } -+ -+ protected void aW() { -+ super.aW(); -+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D); -+ } -+ -+ public boolean isAsleep() { -+ return (this.datawatcher.getByte(16) & 1) != 0; -+ } -+ -+ public void setAsleep(boolean var1) { -+ byte var2 = this.datawatcher.getByte(16); -+ if(var1) { -+ this.datawatcher.watch(16, Byte.valueOf((byte)(var2 | 1))); -+ } else { -+ this.datawatcher.watch(16, Byte.valueOf((byte)(var2 & -2))); -+ } -+ -+ } -+ -+ public void s_() { -+ super.s_(); -+ -+ if (Vegetated) -+ return; -+ -+ if(this.isAsleep()) { -+ this.motX = this.motY = this.motZ = 0.0D; -+ this.locY = (double)MathHelper.floor(this.locY) + 1.0D - (double)this.length; -+ } else { -+ this.motY *= 0.6000000238418579D; -+ } -+ -+ } -+ -+ protected void E() { -+ super.E(); -+ -+ if (Vegetated) -+ return; -+ -+ BlockPosition var1 = new BlockPosition(this); -+ BlockPosition var2 = var1.up(); -+ if(this.isAsleep()) { -+ if(!this.world.getType(var2).getBlock().isOccluding()) { -+ this.setAsleep(false); -+ this.world.a((EntityHuman)null, 1015, var1, 0); -+ } else { -+ if(this.random.nextInt(200) == 0) { -+ this.aI = (float)this.random.nextInt(360); -+ } -+ -+ if(this.world.findNearbyPlayer(this, 4.0D) != null) { -+ this.setAsleep(false); -+ this.world.a((EntityHuman)null, 1015, var1, 0); -+ } -+ } -+ } else { -+ if(this.a != null && (!this.world.isEmpty(this.a) || this.a.getY() < 1)) { -+ this.a = null; -+ } -+ -+ if(this.a == null || this.random.nextInt(30) == 0 || this.a.c((double)((int)this.locX), (double)((int)this.locY), (double)((int)this.locZ)) < 4.0D) { -+ this.a = new BlockPosition((int)this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int)this.locY + this.random.nextInt(6) - 2, (int)this.locZ + this.random.nextInt(7) - this.random.nextInt(7)); -+ } -+ -+ double var3 = (double)this.a.getX() + 0.5D - this.locX; -+ double var5 = (double)this.a.getY() + 0.1D - this.locY; -+ double var7 = (double)this.a.getZ() + 0.5D - this.locZ; -+ this.motX += (Math.signum(var3) * 0.5D - this.motX) * 0.10000000149011612D; -+ this.motY += (Math.signum(var5) * 0.699999988079071D - this.motY) * 0.10000000149011612D; -+ this.motZ += (Math.signum(var7) * 0.5D - this.motZ) * 0.10000000149011612D; -+ float var9 = (float)(Math.atan2(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) - 90.0F; -+ float var10 = MathHelper.g(var9 - this.yaw); -+ this.aY = 0.5F; -+ this.yaw += var10; -+ if(this.random.nextInt(100) == 0 && this.world.getType(var2).getBlock().isOccluding()) { -+ this.setAsleep(true); -+ } -+ } -+ -+ } -+ -+ protected boolean r_() { -+ return false; -+ } -+ -+ public void e(float var1, float var2) { -+ } -+ -+ protected void a(double var1, boolean var3, Block var4, BlockPosition var5) { -+ } -+ -+ public boolean aH() { -+ return true; -+ } -+ -+ public boolean damageEntity(DamageSource var1, float var2) { -+ if(this.isInvulnerable(var1)) { -+ return false; -+ } else { -+ if(!this.world.isStatic && this.isAsleep()) { -+ this.setAsleep(false); -+ } -+ -+ return super.damageEntity(var1, var2); -+ } -+ } -+ -+ public void a(NBTTagCompound var1) { -+ super.a(var1); -+ this.datawatcher.watch(16, Byte.valueOf(var1.getByte("BatFlags"))); -+ } -+ -+ public void b(NBTTagCompound var1) { -+ super.b(var1); -+ var1.setByte("BatFlags", this.datawatcher.getByte(16)); -+ } -+ -+ public boolean bQ() { -+ BlockPosition var1 = new BlockPosition(this.locX, this.getBoundingBox().b, this.locZ); -+ if(var1.getY() >= 63) { -+ return false; -+ } else { -+ int var2 = this.world.getLightLevel(var1); -+ byte var3 = 4; -+ if(this.a((Calendar)this.world.Y())) { -+ var3 = 7; -+ } else if(this.random.nextBoolean()) { -+ return false; -+ } -+ -+ return var2 > this.random.nextInt(var3)?false:super.bQ(); -+ } -+ } -+ -+ private boolean a(Calendar var1) { -+ return var1.get(2) + 1 == 10 && var1.get(5) >= 20 || var1.get(2) + 1 == 11 && var1.get(5) <= 3; -+ } -+ -+ public float getHeadHeight() { -+ return this.length / 2.0F; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index ec94142..6e927a3 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -40,6 +40,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - public EntityEnderCrystal bx; - private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() - -+ public boolean Vegetated = false; -+ - public EntityEnderDragon(World world) { - super(world); - this.children = new EntityComplexPart[] { this.bl = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.bm = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bn = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bo = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bp = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bq = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.br = new EntityComplexPart(this, "wing", 4.0F, 4.0F)}; -@@ -167,7 +169,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - this.c += this.random.nextGaussian() * 2.0D; - } - -- if (this.bu || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.E) { -+ if (!Vegetated && this.bu || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.E) { - this.cd(); - } - -@@ -250,7 +252,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - this.bq.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); - this.br.s_(); - this.br.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); -- if (!this.world.isStatic && this.hurtTicks == 0) { -+ if (!this.world.isStatic && this.hurtTicks == 0 && !ghost) { - this.a(this.world.getEntities(this, this.bq.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); - this.a(this.world.getEntities(this, this.br.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); - this.b(this.world.getEntities(this, this.bl.getBoundingBox().grow(1.0D, 1.0D, 1.0D))); -@@ -298,6 +300,19 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - } - } - -+ public void setTargetBlock(int x, int y, int z) -+ { -+ this.a = x; -+ this.b = y; -+ this.c = z; -+ this.by = null; -+ } -+ -+ public void setTargetEntity(Entity entity) -+ { -+ this.by = entity; -+ } -+ - private void n() { - if (this.bx != null) { - if (this.bx.dead) { -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index fd78677..9f76410 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity { - private float fallHurtAmount = 2.0F; - public NBTTagCompound tileEntityData; - -+ public boolean spectating; -+ - public EntityFallingBlock(World world) { - super(world); - } -@@ -42,7 +44,15 @@ public class EntityFallingBlock extends Entity { - protected void h() {} - - public boolean ad() { -- return !this.dead; -+ return !this.dead && !spectating; -+ } -+ -+ @Override -+ public boolean damageEntity(DamageSource damagesource, float f) -+ { -+ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f); -+ -+ return true; - } - - public void s_() { -diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index 1d4354e..618aac9 100644 ---- a/src/main/java/net/minecraft/server/EntityHorse.java -+++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -117,6 +117,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { - private void c(int i, boolean flag) { - int j = this.datawatcher.getInt(16); - -+ if (Vegetated) -+ return; -+ - if (flag) { - this.datawatcher.watch(16, Integer.valueOf(j | i)); - } else { -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 4ef5e01..0aaf491 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -131,7 +131,7 @@ public abstract class EntityHuman extends EntityLiving { - if (this.g != null) { - ItemStack itemstack = this.inventory.getItemInHand(); - -- if (itemstack == this.g) { -+ if (ItemStack.equals(itemstack, this.g)) { - if (this.h <= 25 && this.h % 4 == 0) { - this.b(itemstack, 5); - } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index bc7f81e..cc6f7b9 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -35,6 +35,10 @@ public abstract class EntityInsentient extends EntityLiving { - private Entity bn; - private NBTTagCompound bo; - -+ public boolean Vegetated; -+ public boolean BreakLeash; -+ public boolean PullWhileLeashed; -+ - public EntityInsentient(World world) { - super(world); - this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null); -@@ -148,7 +152,7 @@ public abstract class EntityInsentient extends EntityLiving { - public void K() { - super.K(); - this.world.methodProfiler.a("mobBaseTick"); -- if (this.isAlive() && this.random.nextInt(1000) < this.a_++) { -+ if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) { - this.a_ = -this.w(); - this.x(); - } -@@ -764,7 +768,7 @@ public abstract class EntityInsentient extends EntityLiving { - } - - public final boolean e(EntityHuman entityhuman) { -- if (this.cb() && this.getLeashHolder() == entityhuman) { -+ if (this.cb() && this.getLeashHolder() == entityhuman && BreakLeash) { - // CraftBukkit start - fire PlayerUnleashEntityEvent - if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); -@@ -829,7 +833,7 @@ public abstract class EntityInsentient extends EntityLiving { - } - - public void unleash(boolean flag, boolean flag1) { -- if (this.bm) { -+ if (this.bm && BreakLeash) { - this.bm = false; - this.bn = null; - if (!this.world.isStatic && flag1) { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 9604034..aeeb9a5 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -91,6 +91,8 @@ public abstract class EntityLiving extends Entity { - } - // Spigot end - -+ public boolean ghost; -+ - public void G() { - this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); - } -@@ -1718,7 +1720,7 @@ public abstract class EntityLiving extends Entity { - } - - public boolean ae() { -- return !this.dead; -+ return !this.dead && !ghost; - } - - protected void ac() { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 67230f6..f59e611 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -62,13 +62,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public double maxHealthCache; - public boolean joining = true; - // CraftBukkit end -+ -+ public boolean spectating; -+ - // Spigot start - public boolean collidesWithEntities = true; - - @Override - public boolean ad() - { -- return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) -+ return !spectating && this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) - } - - @Override -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 3621faf..cc12f1b 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -9,6 +9,8 @@ public class EntityTNTPrimed extends Entity { - public float yield = 4; // CraftBukkit - add field - public boolean isIncendiary = false; // CraftBukkit - add field - -+ public boolean spectating = false; -+ - public EntityTNTPrimed(World world) { - super(world); - this.k = true; -@@ -37,7 +39,7 @@ public class EntityTNTPrimed extends Entity { - } - - public boolean ad() { -- return !this.dead; -+ return !this.dead && !spectating; - } - - public void s_() { -diff --git a/src/main/java/net/minecraft/server/IPacketVerifier.java b/src/main/java/net/minecraft/server/IPacketVerifier.java -new file mode 100644 -index 0000000..4a61c32 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/IPacketVerifier.java -@@ -0,0 +1,6 @@ -+package net.minecraft.server; -+ -+public interface IPacketVerifier -+{ -+ boolean verify(Packet packet); -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java -index e24f224..d8a2da9 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java -@@ -2,7 +2,7 @@ package net.minecraft.server; - - public class PacketPlayInCloseWindow implements Packet { - -- private int id; -+ public int id; - - public PacketPlayInCloseWindow() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java -new file mode 100644 -index 0000000..082e523 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java -@@ -0,0 +1,43 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.Entity; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutAnimation implements Packet { -+ public int a; -+ public int b; -+ -+ public PacketPlayOutAnimation() { -+ } -+ -+ public PacketPlayOutAnimation(Entity var1, int var2) { -+ this.a = var1.getId(); -+ this.b = var2; -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = var1.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.writeByte(this.b); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener listener) -+ { -+ a((PacketListenerPlayOut) listener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java -new file mode 100644 -index 0000000..275e765 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java -@@ -0,0 +1,46 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.Entity; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutAttachEntity implements Packet { -+ public int a; -+ public int b; -+ public int c; -+ -+ public PacketPlayOutAttachEntity() { -+ } -+ -+ public PacketPlayOutAttachEntity(int var1, Entity var2, Entity var3) { -+ this.a = var1; -+ this.b = var2.getId(); -+ this.c = var3 != null?var3.getId():-1; -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.b = var1.readInt(); -+ this.c = var1.readInt(); -+ this.a = var1.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.writeInt(this.b); -+ var1.writeInt(this.c); -+ var1.writeByte(this.a); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -new file mode 100644 -index 0000000..d4e9528 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -0,0 +1,48 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutEntity implements Packet { -+ public int a; -+ public byte b; -+ public byte c; -+ public byte d; -+ public byte e; -+ public byte f; -+ public boolean g; -+ public boolean h; -+ -+ public PacketPlayOutEntity() { -+ } -+ -+ public PacketPlayOutEntity(int var1) { -+ this.a = var1; -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public String toString() { -+ return "Entity_" + super.toString(); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -new file mode 100644 -index 0000000..7631d9f ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -@@ -0,0 +1,46 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.ItemStack; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutEntityEquipment implements Packet { -+ public int a; -+ public int b; -+ public ItemStack c; -+ -+ public PacketPlayOutEntityEquipment() { -+ } -+ -+ public PacketPlayOutEntityEquipment(int var1, int var2, ItemStack var3) { -+ this.a = var1; -+ this.b = var2; -+ this.c = var3 == null?null:var3.cloneItemStack(); -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = var1.readShort(); -+ this.c = var1.i(); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.writeShort(this.b); -+ var1.a(this.c); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -new file mode 100644 -index 0000000..6d54b76 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -@@ -0,0 +1,48 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import java.util.List; -+import net.minecraft.server.DataWatcher; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutEntityMetadata implements Packet { -+ public int a; -+ public List b; -+ -+ public PacketPlayOutEntityMetadata() { -+ } -+ -+ public PacketPlayOutEntityMetadata(int var1, DataWatcher var2, boolean var3) { -+ this.a = var1; -+ if(var3) { -+ this.b = var2.c(); -+ } else { -+ this.b = var2.b(); -+ } -+ -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = DataWatcher.b(var1); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ DataWatcher.a(this.b, var1); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -new file mode 100644 -index 0000000..6c5f222 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -0,0 +1,73 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.Entity; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutEntityTeleport implements Packet { -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ public byte e; -+ public byte f; -+ public boolean g; -+ -+ public PacketPlayOutEntityTeleport() { -+ } -+ -+ public PacketPlayOutEntityTeleport(Entity var1) { -+ this.a = var1.getId(); -+ this.b = MathHelper.floor(var1.locX * 32.0D); -+ this.c = MathHelper.floor(var1.locY * 32.0D); -+ this.d = MathHelper.floor(var1.locZ * 32.0D); -+ this.e = (byte)((int)(var1.yaw * 256.0F / 360.0F)); -+ this.f = (byte)((int)(var1.pitch * 256.0F / 360.0F)); -+ this.g = var1.onGround; -+ } -+ -+ public PacketPlayOutEntityTeleport(int var1, int var2, int var3, int var4, byte var5, byte var6, boolean var7) { -+ this.a = var1; -+ this.b = var2; -+ this.c = var3; -+ this.d = var4; -+ this.e = var5; -+ this.f = var6; -+ this.g = var7; -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = var1.readInt(); -+ this.c = var1.readInt(); -+ this.d = var1.readInt(); -+ this.e = var1.readByte(); -+ this.f = var1.readByte(); -+ this.g = var1.readBoolean(); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.writeInt(this.b); -+ var1.writeInt(this.c); -+ var1.writeInt(this.d); -+ var1.writeByte(this.e); -+ var1.writeByte(this.f); -+ var1.writeBoolean(this.g); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -new file mode 100644 -index 0000000..2cddb08 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -@@ -0,0 +1,79 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.Entity; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutEntityVelocity implements Packet { -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ -+ public PacketPlayOutEntityVelocity() { -+ } -+ -+ public PacketPlayOutEntityVelocity(Entity var1) { -+ this(var1.getId(), var1.motX, var1.motY, var1.motZ); -+ } -+ -+ public PacketPlayOutEntityVelocity(int var1, double var2, double var4, double var6) { -+ this.a = var1; -+ double var8 = 3.9D; -+ if(var2 < -var8) { -+ var2 = -var8; -+ } -+ -+ if(var4 < -var8) { -+ var4 = -var8; -+ } -+ -+ if(var6 < -var8) { -+ var6 = -var8; -+ } -+ -+ if(var2 > var8) { -+ var2 = var8; -+ } -+ -+ if(var4 > var8) { -+ var4 = var8; -+ } -+ -+ if(var6 > var8) { -+ var6 = var8; -+ } -+ -+ this.b = (int)(var2 * 8000.0D); -+ this.c = (int)(var4 * 8000.0D); -+ this.d = (int)(var6 * 8000.0D); -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = var1.readShort(); -+ this.c = var1.readShort(); -+ this.d = var1.readShort(); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.writeShort(this.b); -+ var1.writeShort(this.c); -+ var1.writeShort(this.d); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -new file mode 100644 -index 0000000..c7da28c ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -@@ -0,0 +1,78 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import java.util.List; -+import java.util.UUID; -+import net.minecraft.server.DataWatcher; -+import net.minecraft.server.EntityHuman; -+import net.minecraft.server.Item; -+import net.minecraft.server.ItemStack; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutNamedEntitySpawn implements Packet { -+ public int a; -+ public UUID b; -+ public int c; -+ public int d; -+ public int e; -+ public byte f; -+ public byte g; -+ public int h; -+ public DataWatcher i; -+ public List j; -+ -+ public PacketPlayOutNamedEntitySpawn() { -+ } -+ -+ public PacketPlayOutNamedEntitySpawn(EntityHuman var1) { -+ this.a = var1.getId(); -+ this.b = var1.getProfile().getId(); -+ this.c = MathHelper.floor(var1.locX * 32.0D); -+ this.d = MathHelper.floor(var1.locY * 32.0D); -+ this.e = MathHelper.floor(var1.locZ * 32.0D); -+ this.f = (byte)((int)(var1.yaw * 256.0F / 360.0F)); -+ this.g = (byte)((int)(var1.pitch * 256.0F / 360.0F)); -+ ItemStack var2 = var1.inventory.getItemInHand(); -+ this.h = var2 == null?0:Item.getId(var2.getItem()); -+ this.i = var1.getDataWatcher(); -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = var1.g(); -+ this.c = var1.readInt(); -+ this.d = var1.readInt(); -+ this.e = var1.readInt(); -+ this.f = var1.readByte(); -+ this.g = var1.readByte(); -+ this.h = var1.readShort(); -+ this.j = DataWatcher.b(var1); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.a(this.b); -+ var1.writeInt(this.c); -+ var1.writeInt(this.d); -+ var1.writeInt(this.e); -+ var1.writeByte(this.f); -+ var1.writeByte(this.g); -+ var1.writeShort(this.h); -+ this.i.a(var1); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -new file mode 100644 -index 0000000..d77bccf ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -0,0 +1,144 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import net.minecraft.server.Entity; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutSpawnEntity implements Packet { -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ public int e; -+ public int f; -+ public int g; -+ public int h; -+ public int i; -+ public int j; -+ public int k; -+ -+ public PacketPlayOutSpawnEntity() { -+ } -+ -+ public PacketPlayOutSpawnEntity(Entity var1, int var2) { -+ this(var1, var2, 0); -+ } -+ -+ public PacketPlayOutSpawnEntity(Entity var1, int var2, int var3) { -+ this.a = var1.getId(); -+ this.b = MathHelper.floor(var1.locX * 32.0D); -+ this.c = MathHelper.floor(var1.locY * 32.0D); -+ this.d = MathHelper.floor(var1.locZ * 32.0D); -+ this.h = MathHelper.d(var1.pitch * 256.0F / 360.0F); -+ this.i = MathHelper.d(var1.yaw * 256.0F / 360.0F); -+ this.j = var2; -+ this.k = var3; -+ if(var3 > 0) { -+ double var4 = var1.motX; -+ double var6 = var1.motY; -+ double var8 = var1.motZ; -+ double var10 = 3.9D; -+ if(var4 < -var10) { -+ var4 = -var10; -+ } -+ -+ if(var6 < -var10) { -+ var6 = -var10; -+ } -+ -+ if(var8 < -var10) { -+ var8 = -var10; -+ } -+ -+ if(var4 > var10) { -+ var4 = var10; -+ } -+ -+ if(var6 > var10) { -+ var6 = var10; -+ } -+ -+ if(var8 > var10) { -+ var8 = var10; -+ } -+ -+ this.e = (int)(var4 * 8000.0D); -+ this.f = (int)(var6 * 8000.0D); -+ this.g = (int)(var8 * 8000.0D); -+ } -+ -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.j = var1.readByte(); -+ this.b = var1.readInt(); -+ this.c = var1.readInt(); -+ this.d = var1.readInt(); -+ this.h = var1.readByte(); -+ this.i = var1.readByte(); -+ this.k = var1.readInt(); -+ if(this.k > 0) { -+ this.e = var1.readShort(); -+ this.f = var1.readShort(); -+ this.g = var1.readShort(); -+ } -+ -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.writeByte(this.j); -+ var1.writeInt(this.b); -+ var1.writeInt(this.c); -+ var1.writeInt(this.d); -+ var1.writeByte(this.h); -+ var1.writeByte(this.i); -+ var1.writeInt(this.k); -+ if(this.k > 0) { -+ var1.writeShort(this.e); -+ var1.writeShort(this.f); -+ var1.writeShort(this.g); -+ } -+ -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(int var1) { -+ this.b = var1; -+ } -+ -+ public void b(int var1) { -+ this.c = var1; -+ } -+ -+ public void c(int var1) { -+ this.d = var1; -+ } -+ -+ public void d(int var1) { -+ this.e = var1; -+ } -+ -+ public void e(int var1) { -+ this.f = var1; -+ } -+ -+ public void f(int var1) { -+ this.g = var1; -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -new file mode 100644 -index 0000000..c86fe82 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -@@ -0,0 +1,115 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import java.util.List; -+import net.minecraft.server.DataWatcher; -+import net.minecraft.server.EntityLiving; -+import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.Packet; -+import net.minecraft.server.PacketDataSerializer; -+import net.minecraft.server.PacketListenerPlayOut; -+ -+public class PacketPlayOutSpawnEntityLiving implements Packet { -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ public int e; -+ public int f; -+ public int g; -+ public int h; -+ public byte i; -+ public byte j; -+ public byte k; -+ public DataWatcher l; -+ public List m; -+ -+ public PacketPlayOutSpawnEntityLiving() { -+ } -+ -+ public PacketPlayOutSpawnEntityLiving(EntityLiving var1) { -+ this.a = var1.getId(); -+ this.b = (byte)EntityTypes.a(var1); -+ this.c = MathHelper.floor(var1.locX * 32.0D); -+ this.d = MathHelper.floor(var1.locY * 32.0D); -+ this.e = MathHelper.floor(var1.locZ * 32.0D); -+ this.i = (byte)((int)(var1.yaw * 256.0F / 360.0F)); -+ this.j = (byte)((int)(var1.pitch * 256.0F / 360.0F)); -+ this.k = (byte)((int)(var1.aI * 256.0F / 360.0F)); -+ double var2 = 3.9D; -+ double var4 = var1.motX; -+ double var6 = var1.motY; -+ double var8 = var1.motZ; -+ if(var4 < -var2) { -+ var4 = -var2; -+ } -+ -+ if(var6 < -var2) { -+ var6 = -var2; -+ } -+ -+ if(var8 < -var2) { -+ var8 = -var2; -+ } -+ -+ if(var4 > var2) { -+ var4 = var2; -+ } -+ -+ if(var6 > var2) { -+ var6 = var2; -+ } -+ -+ if(var8 > var2) { -+ var8 = var2; -+ } -+ -+ this.f = (int)(var4 * 8000.0D); -+ this.g = (int)(var6 * 8000.0D); -+ this.h = (int)(var8 * 8000.0D); -+ this.l = var1.getDataWatcher(); -+ } -+ -+ public void a(PacketDataSerializer var1) { -+ this.a = var1.e(); -+ this.b = var1.readByte() & 255; -+ this.c = var1.readInt(); -+ this.d = var1.readInt(); -+ this.e = var1.readInt(); -+ this.i = var1.readByte(); -+ this.j = var1.readByte(); -+ this.k = var1.readByte(); -+ this.f = var1.readShort(); -+ this.g = var1.readShort(); -+ this.h = var1.readShort(); -+ this.m = DataWatcher.b(var1); -+ } -+ -+ public void b(PacketDataSerializer var1) { -+ var1.b(this.a); -+ var1.writeByte(this.b & 255); -+ var1.writeInt(this.c); -+ var1.writeInt(this.d); -+ var1.writeInt(this.e); -+ var1.writeByte(this.i); -+ var1.writeByte(this.j); -+ var1.writeByte(this.k); -+ var1.writeShort(this.f); -+ var1.writeShort(this.g); -+ var1.writeShort(this.h); -+ this.l.a(var1); -+ } -+ -+ public void a(PacketListenerPlayOut var1) { -+ var1.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketProcessor.java b/src/main/java/net/minecraft/server/PacketProcessor.java -new file mode 100644 -index 0000000..e43149a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketProcessor.java -@@ -0,0 +1,43 @@ -+package net.minecraft.server; -+ -+import java.util.ArrayList; -+import java.util.List; -+ -+public class PacketProcessor -+{ -+ private List _packetVerifiers; -+ -+ public PacketProcessor() -+ { -+ _packetVerifiers = new ArrayList(); -+ } -+ -+ public void addPacketVerifier(IPacketVerifier verifier) -+ { -+ _packetVerifiers.add(verifier); -+ } -+ -+ public void processPacket(Packet packet, NetworkManager networkManager) -+ { -+ boolean addDefaultPacket = true; -+ -+ for (IPacketVerifier verifier : _packetVerifiers) -+ { -+ if (!verifier.verify(packet)) -+ { -+ addDefaultPacket = false; -+ } -+ } -+ -+ if (addDefaultPacket) -+ { -+ networkManager.handle(packet); -+ } -+ } -+ -+ public void clearVerifiers() -+ { -+ _packetVerifiers.clear(); -+ } -+ -+} -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 18b9e9b..105d821 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -83,6 +83,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - public boolean checkMovement = true; - private boolean processedDisconnect; // CraftBukkit - added - -+ public PacketProcessor _packetVerifier; -+ - public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { - this.minecraftServer = minecraftserver; - this.networkManager = networkmanager; -@@ -90,6 +92,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - this.player = entityplayer; - entityplayer.playerConnection = this; - -+ _packetVerifier = new PacketProcessor(); -+ - // CraftBukkit start - add fields and methods - this.server = minecraftserver.server; - } -@@ -833,7 +837,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - // CraftBukkit end - - try { -- this.networkManager.handle(packet); -+ _packetVerifier.processPacket(packet, this.networkManager); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); -@@ -1333,10 +1337,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - public void a(PacketPlayInCloseWindow packetplayinclosewindow) { - if (this.player.dead) return; // CraftBukkit - PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u()); -- -- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit -- -- this.player.p(); -+ -+ if (packetplayinclosewindow.id == player.activeContainer.windowId) -+ { -+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit -+ -+ this.player.p(); -+ } - } - - public void a(PacketPlayInWindowClick packetplayinwindowclick) { -diff --git a/src/main/java/net/minecraft/server/QueuedPacket.java b/src/main/java/net/minecraft/server/QueuedPacket.java -new file mode 100644 -index 0000000..5aceeb4 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/QueuedPacket.java -@@ -0,0 +1,27 @@ -+// -+// Source code recreated from a .class file by IntelliJ IDEA -+// (powered by Fernflower decompiler) -+// -+ -+package net.minecraft.server; -+ -+import io.netty.util.concurrent.GenericFutureListener; -+import net.minecraft.server.Packet; -+ -+public class QueuedPacket { -+ private final Packet a; -+ private final GenericFutureListener[] b; -+ -+ public QueuedPacket(Packet var1, GenericFutureListener... var2) { -+ this.a = var1; -+ this.b = var2; -+ } -+ -+ public static Packet a(QueuedPacket var0) { -+ return var0.a; -+ } -+ -+ public static GenericFutureListener[] b(QueuedPacket var0) { -+ return var0.b; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 762e469..533e1e2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -194,6 +194,8 @@ public abstract class World implements IBlockAccess { - - public final SpigotTimings.WorldTimingsHandler timings; // Spigot - -+ private Entity _startEntity; -+ - public CraftWorld getWorld() { - return this.world; - } -@@ -1628,14 +1630,43 @@ public abstract class World implements IBlockAccess { - } - - this.methodProfiler.b(); -- if (flag && entity.ad && entity.passenger != null) { -- if (!entity.passenger.dead && entity.passenger.vehicle == entity) { -+ if (flag && entity.ad && entity.passenger != null) -+ { -+// if (!entity.passenger.dead && entity.passenger.vehicle == entity) { -+// this.g(entity.passenger); -+// } else { -+// entity.passenger.vehicle = null; -+// entity.passenger = null; -+// } -+// } -+ if (!entity.passenger.dead && entity.passenger.vehicle == entity) -+ { -+ if (_startEntity == null) -+ _startEntity = entity; -+ - this.g(entity.passenger); -- } else { -+ } else if (entity == _startEntity) -+ { -+ for (StackTraceElement element : Thread.currentThread().getStackTrace()) -+ { -+ System.out.println(element); -+ } -+ -+ entity.passenger.vehicle = null; -+ entity.passenger = null; -+ _startEntity = null; -+ } else -+ { - entity.passenger.vehicle = null; - entity.passenger = null; -+ _startEntity = null; - } - } -+ else -+ { -+ _startEntity = null; -+ } -+ - - entity.tickTimer.stopTiming(); // Spigot - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d5ea292..ecee9f2 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1072,9 +1072,9 @@ public class CraftWorld implements World { - ( (EntityOcelot) entity ).spawnBonus = false; - } - // Spigot end -- if (entity instanceof EntityInsentient) { -- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); -- } -+// if (entity instanceof EntityInsentient) { -+// ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); -+// } - - world.addEntity(entity, reason); - return (T) entity.getBukkitEntity(); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5864a51..e6efa95 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -870,12 +870,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - } - -- @Override -- public void hidePlayer(Player player) { -+ public void hidePlayer(Player player) -+ { -+ hidePlayer(player, false, true); -+ } -+ -+ public void hidePlayer(Player player, boolean override, boolean hideList) { - Validate.notNull(player, "hidden player cannot be null"); - if (getHandle().playerConnection == null) return; - if (equals(player)) return; -- if (hiddenPlayers.contains(player.getUniqueId())) return; -+ if (!override && hiddenPlayers.contains(player.getUniqueId())) return; - hiddenPlayers.add(player.getUniqueId()); - - //remove this player from the hidden player's EntityTrackerEntry -@@ -887,7 +891,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - //remove the hidden player from this player user list -- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, other)); -+ if (hideList) -+ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, other)); - } - - @Override -@@ -1333,13 +1338,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - @Override - public boolean getCollidesWithEntities() - { -- return getHandle().collidesWithEntities; -+ return !getHandle().spectating; - } - - @Override - public void setCollidesWithEntities(boolean collides) - { -- getHandle().collidesWithEntities = collides; -+ getHandle().spectating = !collides; - getHandle().k = collides; // First boolean of Entity - } - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 7ae6f12..00c98cf 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -@@ -439,8 +439,8 @@ public class CraftInventory implements Inventory { - return InventoryType.ENCHANTING; - } else if (inventory instanceof TileEntityBrewingStand) { - return InventoryType.BREWING; -- } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) { -- return ((CraftInventoryCustom.MinecraftInventory) inventory).getType(); -+ } else if (inventory instanceof MinecraftInventory) { -+ return ((MinecraftInventory) inventory).getType(); - } else if (inventory instanceof InventoryEnderChest) { - return InventoryType.ENDER_CHEST; - } else if (inventory instanceof InventoryMerchant) { -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -index 947c493..eed9afa 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -@@ -31,168 +31,4 @@ public class CraftInventoryCustom extends CraftInventory { - public CraftInventoryCustom(InventoryHolder owner, int size, String title) { - super(new MinecraftInventory(owner, size, title)); - } -- -- static class MinecraftInventory implements IInventory { -- private final ItemStack[] items; -- private int maxStack = MAX_STACK; -- private final List viewers; -- private final String title; -- private InventoryType type; -- private final InventoryHolder owner; -- -- public MinecraftInventory(InventoryHolder owner, InventoryType type) { -- this(owner, type.getDefaultSize(), type.getDefaultTitle()); -- this.type = type; -- } -- -- public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { -- this(owner, type.getDefaultSize(), title); -- this.type = type; -- } -- -- public MinecraftInventory(InventoryHolder owner, int size) { -- this(owner, size, "Chest"); -- } -- -- public MinecraftInventory(InventoryHolder owner, int size, String title) { -- Validate.notNull(title, "Title cannot be null"); -- Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); -- this.items = new ItemStack[size]; -- this.title = title; -- this.viewers = new ArrayList(); -- this.owner = owner; -- this.type = InventoryType.CHEST; -- } -- -- public int getSize() { -- return items.length; -- } -- -- public ItemStack getItem(int i) { -- return items[i]; -- } -- -- public ItemStack splitStack(int i, int j) { -- ItemStack stack = this.getItem(i); -- ItemStack result; -- if (stack == null) return null; -- if (stack.count <= j) { -- this.setItem(i, null); -- result = stack; -- } else { -- result = CraftItemStack.copyNMSStack(stack, j); -- stack.count -= j; -- } -- this.update(); -- return result; -- } -- -- public ItemStack splitWithoutUpdate(int i) { -- ItemStack stack = this.getItem(i); -- ItemStack result; -- if (stack == null) return null; -- if (stack.count <= 1) { -- this.setItem(i, null); -- result = stack; -- } else { -- result = CraftItemStack.copyNMSStack(stack, 1); -- stack.count -= 1; -- } -- return result; -- } -- -- public void setItem(int i, ItemStack itemstack) { -- items[i] = itemstack; -- if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { -- itemstack.count = this.getMaxStackSize(); -- } -- } -- -- public int getMaxStackSize() { -- return maxStack; -- } -- -- public void setMaxStackSize(int size) { -- maxStack = size; -- } -- -- public void update() {} -- -- public boolean a(EntityHuman entityhuman) { -- return true; -- } -- -- public ItemStack[] getContents() { -- return items; -- } -- -- public void onOpen(CraftHumanEntity who) { -- viewers.add(who); -- } -- -- public void onClose(CraftHumanEntity who) { -- viewers.remove(who); -- } -- -- public List getViewers() { -- return viewers; -- } -- -- public InventoryType getType() { -- return type; -- } -- -- public InventoryHolder getOwner() { -- return owner; -- } -- -- public boolean b(int i, ItemStack itemstack) { -- return true; -- } -- -- @Override -- public void startOpen(EntityHuman entityHuman) { -- -- } -- -- @Override -- public void closeContainer(EntityHuman entityHuman) { -- -- } -- -- @Override -- public int getProperty(int i) { -- return 0; -- } -- -- @Override -- public void b(int i, int i1) { -- -- } -- -- @Override -- public int g() { -- return 0; -- } -- -- @Override -- public void l() { -- -- } -- -- @Override -- public String getName() { -- return title; -- } -- -- @Override -- public boolean hasCustomName() { -- return title != null; -- } -- -- @Override -- public IChatBaseComponent getScoreboardDisplayName() { -- return new ChatComponentText(title); -- } -- } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index b49c2dc..fe23d4d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -22,7 +22,7 @@ import org.bukkit.inventory.meta.ItemMeta; - import com.google.common.collect.ImmutableMap; - - @DelegateDeserialization(ItemStack.class) --public final class CraftItemStack extends ItemStack { -+public class CraftItemStack extends ItemStack { - - public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) { - if (original instanceof CraftItemStack) { -@@ -91,22 +91,22 @@ public final class CraftItemStack extends ItemStack { - /** - * Mirror - */ -- private CraftItemStack(net.minecraft.server.ItemStack item) { -+ protected CraftItemStack(net.minecraft.server.ItemStack item) { - this.handle = item; - } - -- private CraftItemStack(ItemStack item) { -+ protected CraftItemStack(ItemStack item) { - this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null); - } - -- private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { -+ protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { - setType(type); - setAmount(amount); - setDurability(durability); - setItemMeta(itemMeta); - } - -- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { -+ protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { - this(Material.getMaterial(typeId), amount, durability, itemMeta); - - } -@@ -402,6 +402,11 @@ public final class CraftItemStack extends ItemStack { - return hasItemMeta() ? that.hasItemMeta() && handle.getTag().equals(that.handle.getTag()) : !that.hasItemMeta(); - } - -+ public net.minecraft.server.ItemStack getHandler() -+ { -+ return handle; -+ } -+ - @Override - public boolean hasItemMeta() { - return hasItemMeta(handle); -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java -new file mode 100644 -index 0000000..b990b6b ---- /dev/null -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java -@@ -0,0 +1,183 @@ -+package org.bukkit.craftbukkit.inventory; -+ -+import java.util.ArrayList; -+import java.util.List; -+ -+import org.bukkit.craftbukkit.entity.CraftHumanEntity; -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.entity.HumanEntity; -+import org.bukkit.event.inventory.InventoryType; -+import org.bukkit.inventory.InventoryHolder; -+ -+import net.minecraft.server.ChatComponentText; -+import net.minecraft.server.EntityHuman; -+import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.IInventory; -+import net.minecraft.server.ItemStack; -+ -+import org.apache.commons.lang.Validate; -+ -+public class MinecraftInventory implements IInventory -+{ -+ private final ItemStack[] items; -+ private int maxStack = MAX_STACK; -+ private final List viewers; -+ private final String title; -+ private InventoryType type; -+ private final InventoryHolder owner; -+ -+ public MinecraftInventory(InventoryHolder owner, InventoryType type) { -+ this(owner, type.getDefaultSize(), type.getDefaultTitle()); -+ this.type = type; -+ } -+ -+ public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { -+ this(owner, type.getDefaultSize(), title); -+ this.type = type; -+ } -+ -+ public MinecraftInventory(InventoryHolder owner, int size) { -+ this(owner, size, "Chest"); -+ } -+ -+ public MinecraftInventory(InventoryHolder owner, int size, String title) { -+ Validate.notNull(title, "Title cannot be null"); -+ Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); -+ this.items = new ItemStack[size]; -+ this.title = title; -+ this.viewers = new ArrayList(); -+ this.owner = owner; -+ this.type = InventoryType.CHEST; -+ } -+ -+ public int getSize() { -+ return items.length; -+ } -+ -+ public ItemStack getItem(int i) { -+ return items[i]; -+ } -+ -+ public ItemStack splitStack(int i, int j) { -+ ItemStack stack = this.getItem(i); -+ ItemStack result; -+ if (stack == null) return null; -+ if (stack.count <= j) { -+ this.setItem(i, null); -+ result = stack; -+ } else { -+ result = CraftItemStack.copyNMSStack(stack, j); -+ stack.count -= j; -+ } -+ this.update(); -+ return result; -+ } -+ -+ public ItemStack splitWithoutUpdate(int i) { -+ ItemStack stack = this.getItem(i); -+ ItemStack result; -+ if (stack == null) return null; -+ if (stack.count <= 1) { -+ this.setItem(i, null); -+ result = stack; -+ } else { -+ result = CraftItemStack.copyNMSStack(stack, 1); -+ stack.count -= 1; -+ } -+ return result; -+ } -+ -+ public void setItem(int i, ItemStack itemstack) { -+ items[i] = itemstack; -+ if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { -+ itemstack.count = this.getMaxStackSize(); -+ } -+ } -+ -+ public int getMaxStackSize() { -+ return maxStack; -+ } -+ -+ public void setMaxStackSize(int size) { -+ maxStack = size; -+ } -+ -+ public void update() {} -+ -+ public boolean a(EntityHuman entityhuman) { -+ return true; -+ } -+ -+ public ItemStack[] getContents() { -+ return items; -+ } -+ -+ public void onOpen(CraftHumanEntity who) { -+ viewers.add(who); -+ } -+ -+ public void onClose(CraftHumanEntity who) { -+ viewers.remove(who); -+ } -+ -+ public List getViewers() { -+ return viewers; -+ } -+ -+ public InventoryType getType() { -+ return type; -+ } -+ -+ public InventoryHolder getOwner() { -+ return owner; -+ } -+ -+ public boolean b(int i, ItemStack itemstack) { -+ return true; -+ } -+ -+ @Override -+ public void startOpen(EntityHuman entityHuman) { -+ -+ } -+ -+ @Override -+ public void closeContainer(EntityHuman entityHuman) { -+ -+ } -+ -+ @Override -+ public int getProperty(int i) { -+ return 0; -+ } -+ -+ @Override -+ public void b(int i, int i1) { -+ -+ } -+ -+ @Override -+ public int g() { -+ return 0; -+ } -+ -+ @Override -+ public void l() { -+ -+ } -+ -+ @Override -+ public String getName() { -+ return title; -+ } -+ -+ @Override -+ public boolean hasCustomName() { -+ return title != null; -+ } -+ -+ @Override -+ public IChatBaseComponent getScoreboardDisplayName() { -+ return new ChatComponentText(title); -+ } -+} -\ No newline at end of file --- -1.9.4.msysgit.0 - diff --git a/Patches/CraftBukkit-Patches/0161-Mineplex-Packet-Changes.patch b/Patches/CraftBukkit-Patches/0161-Mineplex-Packet-Changes.patch new file mode 100644 index 000000000..fe646fb5a --- /dev/null +++ b/Patches/CraftBukkit-Patches/0161-Mineplex-Packet-Changes.patch @@ -0,0 +1,1176 @@ +From e218bdb001b6480be6e7aa4118a8b5c2a88aa598 Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Tue, 21 Apr 2015 19:48:02 -0400 +Subject: [PATCH] Mineplex - Packet Changes + + +diff --git a/src/main/java/com/mineplex/spigot/IPacketVerifier.java b/src/main/java/com/mineplex/spigot/IPacketVerifier.java +new file mode 100644 +index 0000000..4ada0b2 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/IPacketVerifier.java +@@ -0,0 +1,8 @@ ++package com.mineplex.spigot; ++ ++import net.minecraft.server.Packet; ++ ++public interface IPacketVerifier ++{ ++ public boolean verify(Packet packet); ++} +diff --git a/src/main/java/com/mineplex/spigot/PacketProcessor.java b/src/main/java/com/mineplex/spigot/PacketProcessor.java +new file mode 100644 +index 0000000..e372c4f +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/PacketProcessor.java +@@ -0,0 +1,42 @@ ++package com.mineplex.spigot; ++ ++import net.minecraft.server.NetworkManager; ++import net.minecraft.server.Packet; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++public class PacketProcessor ++{ ++ private List _packetVerifiers; ++ ++ public PacketProcessor() ++ { ++ _packetVerifiers = new ArrayList(); ++ } ++ ++ public void addPacketVerifier(IPacketVerifier verifier) ++ { ++ _packetVerifiers.add(verifier); ++ } ++ ++ public void processPacket(Packet packet, NetworkManager networkManager) ++ { ++ boolean addDefaultPacket = true; ++ ++ for (IPacketVerifier verifier : _packetVerifiers) ++ { ++ if (!verifier.verify(packet)) ++ addDefaultPacket = false; ++ } ++ ++ if (addDefaultPacket) ++ networkManager.handle(packet); ++ } ++ ++ public void clearVerifiers() ++ { ++ _packetVerifiers.clear(); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index 01c09b1..5d36e16 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -325,7 +325,7 @@ public class NetworkManager extends SimpleChannelInboundHandler { + this.a(channelhandlercontext, (Packet) object); + } + +- static class QueuedPacket { ++ public static class QueuedPacket { + + private final Packet a; + private final GenericFutureListener>[] b; +diff --git a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java +index 4dfb6c0..05c88a6 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java +@@ -4,7 +4,7 @@ import java.io.IOException; + + public class PacketPlayInCloseWindow implements Packet { + +- private int id; ++ public int id; + + public PacketPlayInCloseWindow() {} + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java +new file mode 100644 +index 0000000..b5fdd87 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java +@@ -0,0 +1,30 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutAnimation implements Packet { ++ ++ public int a; ++ public int b; ++ ++ public PacketPlayOutAnimation() {} ++ ++ public PacketPlayOutAnimation(Entity entity, int i) { ++ this.a = entity.getId(); ++ this.b = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java +new file mode 100644 +index 0000000..6e17e4b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java +@@ -0,0 +1,41 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutAttachEntity implements Packet ++{ ++ ++ public int a; ++ public int b; ++ public int c; ++ ++ public PacketPlayOutAttachEntity() ++ { ++ } ++ ++ public PacketPlayOutAttachEntity(int i, Entity entity, Entity entity1) ++ { ++ this.a = i; ++ this.b = entity.getId(); ++ this.c = entity1 != null ? entity1.getId() : -1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.a = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte(this.a); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +new file mode 100644 +index 0000000..702d33d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +@@ -0,0 +1,134 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntity implements Packet { ++ ++ public int a; ++ public byte b; ++ public byte c; ++ public byte d; ++ public byte e; ++ public byte f; ++ public boolean g; ++ public boolean h; ++ ++ public PacketPlayOutEntity() {} ++ ++ public PacketPlayOutEntity(int i) { ++ this.a = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public String toString() { ++ return "Entity_" + super.toString(); ++ } ++ ++ public static class PacketPlayOutEntityLook extends PacketPlayOutEntity { ++ ++ public PacketPlayOutEntityLook() { ++ this.h = true; ++ } ++ ++ public PacketPlayOutEntityLook(int i, byte b0, byte b1, boolean flag) { ++ super(i); ++ this.e = b0; ++ this.f = b1; ++ this.h = true; ++ this.g = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ super.a(packetdataserializer); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ ++ } ++ ++ public static class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { ++ ++ public PacketPlayOutRelEntityMove() {} ++ ++ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2, boolean flag) { ++ super(i); ++ this.b = b0; ++ this.c = b1; ++ this.d = b2; ++ this.g = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ super.a(packetdataserializer); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ } ++ ++ public static class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { ++ ++ public PacketPlayOutRelEntityMoveLook() { ++ this.h = true; ++ } ++ ++ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4, boolean flag) { ++ super(i); ++ this.b = b0; ++ this.c = b1; ++ this.d = b2; ++ this.e = b3; ++ this.f = b4; ++ this.g = flag; ++ this.h = true; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ super.a(packetdataserializer); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readByte(); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +new file mode 100644 +index 0000000..ecc2e78 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +@@ -0,0 +1,35 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntityEquipment implements Packet { ++ ++ public int a; ++ public int b; ++ public ItemStack c; ++ ++ public PacketPlayOutEntityEquipment() {} ++ ++ public PacketPlayOutEntityEquipment(int i, int j, ItemStack itemstack) { ++ this.a = i; ++ this.b = j; ++ this.c = itemstack == null ? null : itemstack.cloneItemStack(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.i(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.a(this.c); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +new file mode 100644 +index 0000000..dbfcc3c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +@@ -0,0 +1,37 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++ ++public class PacketPlayOutEntityMetadata implements Packet { ++ ++ public int a; ++ public List b; ++ ++ public PacketPlayOutEntityMetadata() {} ++ ++ public PacketPlayOutEntityMetadata(int i, DataWatcher datawatcher, boolean flag) { ++ this.a = i; ++ if (flag) { ++ this.b = datawatcher.c(); ++ } else { ++ this.b = datawatcher.b(); ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ DataWatcher.a(this.b, packetdataserializer); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +new file mode 100644 +index 0000000..786047c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +@@ -0,0 +1,58 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityTeleport implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public byte e; ++ public byte f; ++ public boolean g; ++ ++ public PacketPlayOutEntityTeleport() {} ++ ++ public PacketPlayOutEntityTeleport(Entity entity) { ++ this.a = entity.getId(); ++ this.b = MathHelper.floor(entity.locX * 32.0D); ++ this.c = MathHelper.floor(entity.locY * 32.0D); ++ this.d = MathHelper.floor(entity.locZ * 32.0D); ++ this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F)); ++ this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); ++ this.g = entity.onGround; ++ } ++ ++ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean flag) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ this.d = l; ++ this.e = b0; ++ this.f = b1; ++ this.g = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +new file mode 100644 +index 0000000..6c8dbbc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +@@ -0,0 +1,69 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntityVelocity implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ ++ public PacketPlayOutEntityVelocity() {} ++ ++ public PacketPlayOutEntityVelocity(Entity entity) { ++ this(entity.getId(), entity.motX, entity.motY, entity.motZ); ++ } ++ ++ public PacketPlayOutEntityVelocity(int i, double d0, double d1, double d2) { ++ this.a = i; ++ double d3 = 3.9D; ++ ++ if (d0 < -d3) { ++ d0 = -d3; ++ } ++ ++ if (d1 < -d3) { ++ d1 = -d3; ++ } ++ ++ if (d2 < -d3) { ++ d2 = -d3; ++ } ++ ++ if (d0 > d3) { ++ d0 = d3; ++ } ++ ++ if (d1 > d3) { ++ d1 = d3; ++ } ++ ++ if (d2 > d3) { ++ d2 = d3; ++ } ++ ++ this.b = (int) (d0 * 8000.0D); ++ this.c = (int) (d1 * 8000.0D); ++ this.d = (int) (d2 * 8000.0D); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readShort(); ++ this.d = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeShort(this.c); ++ packetdataserializer.writeShort(this.d); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +new file mode 100644 +index 0000000..23fa49d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +@@ -0,0 +1,64 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++import java.util.UUID; ++ ++public class PacketPlayOutNamedEntitySpawn implements Packet { ++ ++ public int a; ++ public UUID b; ++ public int c; ++ public int d; ++ public int e; ++ public byte f; ++ public byte g; ++ public int h; ++ public DataWatcher i; ++ public List j; ++ ++ public PacketPlayOutNamedEntitySpawn() {} ++ ++ public PacketPlayOutNamedEntitySpawn(EntityHuman entityhuman) { ++ this.a = entityhuman.getId(); ++ this.b = entityhuman.getProfile().getId(); ++ this.c = MathHelper.floor(entityhuman.locX * 32.0D); ++ this.d = MathHelper.floor(entityhuman.locY * 32.0D); ++ this.e = MathHelper.floor(entityhuman.locZ * 32.0D); ++ this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F)); ++ this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F)); ++ ItemStack itemstack = entityhuman.inventory.getItemInHand(); ++ ++ this.h = itemstack == null ? 0 : Item.getId(itemstack.getItem()); ++ this.i = entityhuman.getDataWatcher(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.g(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readByte(); ++ this.h = packetdataserializer.readShort(); ++ this.j = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.a(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeByte(this.g); ++ packetdataserializer.writeShort(this.h); ++ this.i.a(packetdataserializer); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +new file mode 100644 +index 0000000..99809cd +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +@@ -0,0 +1,254 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Objects; ++import com.google.common.collect.Lists; ++import com.mojang.authlib.GameProfile; ++import com.mojang.authlib.properties.Property; ++import java.io.IOException; ++import java.util.Iterator; ++import java.util.List; ++ ++public class PacketPlayOutPlayerInfo implements Packet { ++ ++ public PacketPlayOutPlayerInfo.EnumPlayerInfoAction a; ++ public final List b = Lists.newArrayList(); ++ ++ public PacketPlayOutPlayerInfo() {} ++ ++ public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction packetplayoutplayerinfo_enumplayerinfoaction, EntityPlayer... aentityplayer) { ++ this.a = packetplayoutplayerinfo_enumplayerinfoaction; ++ EntityPlayer[] aentityplayer1 = aentityplayer; ++ int i = aentityplayer.length; ++ ++ for (int j = 0; j < i; ++j) { ++ EntityPlayer entityplayer = aentityplayer1[j]; ++ ++ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(entityplayer.getProfile(), entityplayer.ping, entityplayer.playerInteractManager.getGameMode(), entityplayer.getPlayerListName())); ++ } ++ ++ } ++ ++ public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction packetplayoutplayerinfo_enumplayerinfoaction, Iterable iterable) { ++ this.a = packetplayoutplayerinfo_enumplayerinfoaction; ++ Iterator iterator = iterable.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityPlayer entityplayer = (EntityPlayer) iterator.next(); ++ ++ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(entityplayer.getProfile(), entityplayer.ping, entityplayer.playerInteractManager.getGameMode(), entityplayer.getPlayerListName())); ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = (PacketPlayOutPlayerInfo.EnumPlayerInfoAction) packetdataserializer.a(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.class); ++ int i = packetdataserializer.e(); ++ ++ for (int j = 0; j < i; ++j) { ++ GameProfile gameprofile = null; ++ int k = 0; ++ WorldSettings.EnumGamemode worldsettings_enumgamemode = null; ++ IChatBaseComponent ichatbasecomponent = null; ++ ++ switch (PacketPlayOutPlayerInfo.SyntheticClass_1.a[this.a.ordinal()]) { ++ case 1: ++ gameprofile = new GameProfile(packetdataserializer.g(), packetdataserializer.c(16)); ++ int l = packetdataserializer.e(); ++ ++ for (int i1 = 0; i1 < l; ++i1) { ++ String s = packetdataserializer.c(32767); ++ String s1 = packetdataserializer.c(32767); ++ ++ if (packetdataserializer.readBoolean()) { ++ gameprofile.getProperties().put(s, new Property(s, s1, packetdataserializer.c(32767))); ++ } else { ++ gameprofile.getProperties().put(s, new Property(s, s1)); ++ } ++ } ++ ++ worldsettings_enumgamemode = WorldSettings.EnumGamemode.getById(packetdataserializer.e()); ++ k = packetdataserializer.e(); ++ if (packetdataserializer.readBoolean()) { ++ ichatbasecomponent = packetdataserializer.d(); ++ } ++ break; ++ ++ case 2: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ worldsettings_enumgamemode = WorldSettings.EnumGamemode.getById(packetdataserializer.e()); ++ break; ++ ++ case 3: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ k = packetdataserializer.e(); ++ break; ++ ++ case 4: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ if (packetdataserializer.readBoolean()) { ++ ichatbasecomponent = packetdataserializer.d(); ++ } ++ break; ++ ++ case 5: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ } ++ ++ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(gameprofile, k, worldsettings_enumgamemode, ichatbasecomponent)); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a((Enum) this.a); ++ packetdataserializer.b(this.b.size()); ++ Iterator iterator = this.b.iterator(); ++ ++ while (iterator.hasNext()) { ++ PacketPlayOutPlayerInfo.PlayerInfoData packetplayoutplayerinfo_playerinfodata = (PacketPlayOutPlayerInfo.PlayerInfoData) iterator.next(); ++ ++ switch (PacketPlayOutPlayerInfo.SyntheticClass_1.a[this.a.ordinal()]) { ++ case 1: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getName()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.a().getProperties().size()); ++ Iterator iterator1 = packetplayoutplayerinfo_playerinfodata.a().getProperties().values().iterator(); ++ ++ while (iterator1.hasNext()) { ++ Property property = (Property) iterator1.next(); ++ ++ packetdataserializer.a(property.getName()); ++ packetdataserializer.a(property.getValue()); ++ if (property.hasSignature()) { ++ packetdataserializer.writeBoolean(true); ++ packetdataserializer.a(property.getSignature()); ++ } else { ++ packetdataserializer.writeBoolean(false); ++ } ++ } ++ ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.c().getId()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.b()); ++ if (packetplayoutplayerinfo_playerinfodata.d() == null) { ++ packetdataserializer.writeBoolean(false); ++ } else { ++ packetdataserializer.writeBoolean(true); ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.d()); ++ } ++ break; ++ ++ case 2: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.c().getId()); ++ break; ++ ++ case 3: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.b()); ++ break; ++ ++ case 4: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ if (packetplayoutplayerinfo_playerinfodata.d() == null) { ++ packetdataserializer.writeBoolean(false); ++ } else { ++ packetdataserializer.writeBoolean(true); ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.d()); ++ } ++ break; ++ ++ case 5: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ } ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public String toString() { ++ return Objects.toStringHelper(this).add("action", this.a).add("entries", this.b).toString(); ++ } ++ ++ static class SyntheticClass_1 { ++ ++ static final int[] a = new int[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.values().length]; ++ ++ static { ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror1) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror2) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror3) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror4) { ++ ; ++ } ++ ++ } ++ } ++ ++ public class PlayerInfoData { ++ ++ public final int b; ++ public final WorldSettings.EnumGamemode c; ++ public final GameProfile d; ++ public final IChatBaseComponent e; ++ ++ public PlayerInfoData(GameProfile gameprofile, int i, WorldSettings.EnumGamemode worldsettings_enumgamemode, IChatBaseComponent ichatbasecomponent) { ++ this.d = gameprofile; ++ this.b = i; ++ this.c = worldsettings_enumgamemode; ++ this.e = ichatbasecomponent; ++ } ++ ++ public GameProfile a() { ++ return this.d; ++ } ++ ++ public int b() { ++ return this.b; ++ } ++ ++ public WorldSettings.EnumGamemode c() { ++ return this.c; ++ } ++ ++ public IChatBaseComponent d() { ++ return this.e; ++ } ++ ++ public String toString() { ++ return Objects.toStringHelper(this).add("latency", this.b).add("gameMode", this.c).add("profile", this.d).add("displayName", this.e == null ? null : IChatBaseComponent.ChatSerializer.a(this.e)).toString(); ++ } ++ } ++ ++ public static enum EnumPlayerInfoAction { ++ ++ ADD_PLAYER, UPDATE_GAME_MODE, UPDATE_LATENCY, UPDATE_DISPLAY_NAME, REMOVE_PLAYER; ++ ++ private EnumPlayerInfoAction() {} ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +new file mode 100644 +index 0000000..d34f59b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +@@ -0,0 +1,133 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutSpawnEntity implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public int e; ++ public int f; ++ public int g; ++ public int h; ++ public int i; ++ public int j; ++ public int k; ++ ++ public PacketPlayOutSpawnEntity() {} ++ ++ public PacketPlayOutSpawnEntity(Entity entity, int i) { ++ this(entity, i, 0); ++ } ++ ++ public PacketPlayOutSpawnEntity(Entity entity, int i, int j) { ++ this.a = entity.getId(); ++ this.b = MathHelper.floor(entity.locX * 32.0D); ++ this.c = MathHelper.floor(entity.locY * 32.0D); ++ this.d = MathHelper.floor(entity.locZ * 32.0D); ++ this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); ++ this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F); ++ this.j = i; ++ this.k = j; ++ if (j > 0) { ++ double d0 = entity.motX; ++ double d1 = entity.motY; ++ double d2 = entity.motZ; ++ double d3 = 3.9D; ++ ++ if (d0 < -d3) { ++ d0 = -d3; ++ } ++ ++ if (d1 < -d3) { ++ d1 = -d3; ++ } ++ ++ if (d2 < -d3) { ++ d2 = -d3; ++ } ++ ++ if (d0 > d3) { ++ d0 = d3; ++ } ++ ++ if (d1 > d3) { ++ d1 = d3; ++ } ++ ++ if (d2 > d3) { ++ d2 = d3; ++ } ++ ++ this.e = (int) (d0 * 8000.0D); ++ this.f = (int) (d1 * 8000.0D); ++ this.g = (int) (d2 * 8000.0D); ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.j = packetdataserializer.readByte(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.h = packetdataserializer.readByte(); ++ this.i = packetdataserializer.readByte(); ++ this.k = packetdataserializer.readInt(); ++ if (this.k > 0) { ++ this.e = packetdataserializer.readShort(); ++ this.f = packetdataserializer.readShort(); ++ this.g = packetdataserializer.readShort(); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.j); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.h); ++ packetdataserializer.writeByte(this.i); ++ packetdataserializer.writeInt(this.k); ++ if (this.k > 0) { ++ packetdataserializer.writeShort(this.e); ++ packetdataserializer.writeShort(this.f); ++ packetdataserializer.writeShort(this.g); ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(int i) { ++ this.b = i; ++ } ++ ++ public void b(int i) { ++ this.c = i; ++ } ++ ++ public void c(int i) { ++ this.d = i; ++ } ++ ++ public void d(int i) { ++ this.e = i; ++ } ++ ++ public void e(int i) { ++ this.f = i; ++ } ++ ++ public void f(int i) { ++ this.g = i; ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +new file mode 100644 +index 0000000..61aa281 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +@@ -0,0 +1,102 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++ ++public class PacketPlayOutSpawnEntityLiving implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public int e; ++ public int f; ++ public int g; ++ public int h; ++ public byte i; ++ public byte j; ++ public byte k; ++ public DataWatcher l; ++ public List m; ++ ++ public PacketPlayOutSpawnEntityLiving() {} ++ ++ public PacketPlayOutSpawnEntityLiving(EntityLiving entityliving) { ++ this.a = entityliving.getId(); ++ this.b = (byte) EntityTypes.a(entityliving); ++ this.c = MathHelper.floor(entityliving.locX * 32.0D); ++ this.d = MathHelper.floor(entityliving.locY * 32.0D); ++ this.e = MathHelper.floor(entityliving.locZ * 32.0D); ++ this.i = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F)); ++ this.j = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F)); ++ this.k = (byte) ((int) (entityliving.aK * 256.0F / 360.0F)); ++ double d0 = 3.9D; ++ double d1 = entityliving.motX; ++ double d2 = entityliving.motY; ++ double d3 = entityliving.motZ; ++ ++ if (d1 < -d0) { ++ d1 = -d0; ++ } ++ ++ if (d2 < -d0) { ++ d2 = -d0; ++ } ++ ++ if (d3 < -d0) { ++ d3 = -d0; ++ } ++ ++ if (d1 > d0) { ++ d1 = d0; ++ } ++ ++ if (d2 > d0) { ++ d2 = d0; ++ } ++ ++ if (d3 > d0) { ++ d3 = d0; ++ } ++ ++ this.f = (int) (d1 * 8000.0D); ++ this.g = (int) (d2 * 8000.0D); ++ this.h = (int) (d3 * 8000.0D); ++ this.l = entityliving.getDataWatcher(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readByte() & 255; ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); ++ this.i = packetdataserializer.readByte(); ++ this.j = packetdataserializer.readByte(); ++ this.k = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readShort(); ++ this.g = packetdataserializer.readShort(); ++ this.h = packetdataserializer.readShort(); ++ this.m = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.b & 255); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ packetdataserializer.writeByte(this.i); ++ packetdataserializer.writeByte(this.j); ++ packetdataserializer.writeByte(this.k); ++ packetdataserializer.writeShort(this.f); ++ packetdataserializer.writeShort(this.g); ++ packetdataserializer.writeShort(this.h); ++ this.l.a(packetdataserializer); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 3108938..69f4762 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -2,6 +2,7 @@ package net.minecraft.server; + + import com.google.common.collect.Lists; + import com.google.common.util.concurrent.Futures; ++import com.mineplex.spigot.PacketProcessor; + import io.netty.buffer.Unpooled; + import io.netty.util.concurrent.Future; + import io.netty.util.concurrent.GenericFutureListener; +@@ -84,6 +85,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + private boolean checkMovement = true; + private boolean processedDisconnect; // CraftBukkit - added + ++ public PacketProcessor PacketVerifier; ++ + public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { + this.minecraftServer = minecraftserver; + this.networkManager = networkmanager; +@@ -91,6 +94,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + this.player = entityplayer; + entityplayer.playerConnection = this; + ++ PacketVerifier = new PacketProcessor(); ++ + // CraftBukkit start - add fields and methods + this.server = minecraftserver.server; + } +@@ -881,7 +886,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + // CraftBukkit end + + try { +- this.networkManager.handle(packet); ++ PacketVerifier.processPacket(packet, networkManager); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); +@@ -1398,9 +1403,13 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + if (this.player.dead) return; // CraftBukkit + PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u()); + +- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit ++ if (packetplayinclosewindow.id == player.activeContainer.windowId) ++ { ++ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit ++ ++ this.player.p(); ++ } + +- this.player.p(); + } + + public void a(PacketPlayInWindowClick packetplayinwindowclick) { +-- +2.3.5 + diff --git a/Patches/CraftBukkit-Patches/0162-Mineplex-Item-Inventory-Changes.patch b/Patches/CraftBukkit-Patches/0162-Mineplex-Item-Inventory-Changes.patch new file mode 100644 index 000000000..21c51d947 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0162-Mineplex-Item-Inventory-Changes.patch @@ -0,0 +1,429 @@ +From f41348c5d0e7540905fca648b076234fabb63db1 Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Tue, 21 Apr 2015 19:56:41 -0400 +Subject: [PATCH] Mineplex - Item/Inventory Changes + + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +index a8028e3..5f62731 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +@@ -437,8 +437,8 @@ public class CraftInventory implements Inventory { + return InventoryType.ENCHANTING; + } else if (inventory instanceof TileEntityBrewingStand) { + return InventoryType.BREWING; +- } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) { +- return ((CraftInventoryCustom.MinecraftInventory) inventory).getType(); ++ } else if (inventory instanceof MinecraftInventory) { ++ return ((MinecraftInventory) inventory).getType(); + } else if (inventory instanceof InventoryEnderChest) { + return InventoryType.ENDER_CHEST; + } else if (inventory instanceof InventoryMerchant) { +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +index 947c493..eed9afa 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +@@ -31,168 +31,4 @@ public class CraftInventoryCustom extends CraftInventory { + public CraftInventoryCustom(InventoryHolder owner, int size, String title) { + super(new MinecraftInventory(owner, size, title)); + } +- +- static class MinecraftInventory implements IInventory { +- private final ItemStack[] items; +- private int maxStack = MAX_STACK; +- private final List viewers; +- private final String title; +- private InventoryType type; +- private final InventoryHolder owner; +- +- public MinecraftInventory(InventoryHolder owner, InventoryType type) { +- this(owner, type.getDefaultSize(), type.getDefaultTitle()); +- this.type = type; +- } +- +- public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { +- this(owner, type.getDefaultSize(), title); +- this.type = type; +- } +- +- public MinecraftInventory(InventoryHolder owner, int size) { +- this(owner, size, "Chest"); +- } +- +- public MinecraftInventory(InventoryHolder owner, int size, String title) { +- Validate.notNull(title, "Title cannot be null"); +- Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); +- this.items = new ItemStack[size]; +- this.title = title; +- this.viewers = new ArrayList(); +- this.owner = owner; +- this.type = InventoryType.CHEST; +- } +- +- public int getSize() { +- return items.length; +- } +- +- public ItemStack getItem(int i) { +- return items[i]; +- } +- +- public ItemStack splitStack(int i, int j) { +- ItemStack stack = this.getItem(i); +- ItemStack result; +- if (stack == null) return null; +- if (stack.count <= j) { +- this.setItem(i, null); +- result = stack; +- } else { +- result = CraftItemStack.copyNMSStack(stack, j); +- stack.count -= j; +- } +- this.update(); +- return result; +- } +- +- public ItemStack splitWithoutUpdate(int i) { +- ItemStack stack = this.getItem(i); +- ItemStack result; +- if (stack == null) return null; +- if (stack.count <= 1) { +- this.setItem(i, null); +- result = stack; +- } else { +- result = CraftItemStack.copyNMSStack(stack, 1); +- stack.count -= 1; +- } +- return result; +- } +- +- public void setItem(int i, ItemStack itemstack) { +- items[i] = itemstack; +- if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { +- itemstack.count = this.getMaxStackSize(); +- } +- } +- +- public int getMaxStackSize() { +- return maxStack; +- } +- +- public void setMaxStackSize(int size) { +- maxStack = size; +- } +- +- public void update() {} +- +- public boolean a(EntityHuman entityhuman) { +- return true; +- } +- +- public ItemStack[] getContents() { +- return items; +- } +- +- public void onOpen(CraftHumanEntity who) { +- viewers.add(who); +- } +- +- public void onClose(CraftHumanEntity who) { +- viewers.remove(who); +- } +- +- public List getViewers() { +- return viewers; +- } +- +- public InventoryType getType() { +- return type; +- } +- +- public InventoryHolder getOwner() { +- return owner; +- } +- +- public boolean b(int i, ItemStack itemstack) { +- return true; +- } +- +- @Override +- public void startOpen(EntityHuman entityHuman) { +- +- } +- +- @Override +- public void closeContainer(EntityHuman entityHuman) { +- +- } +- +- @Override +- public int getProperty(int i) { +- return 0; +- } +- +- @Override +- public void b(int i, int i1) { +- +- } +- +- @Override +- public int g() { +- return 0; +- } +- +- @Override +- public void l() { +- +- } +- +- @Override +- public String getName() { +- return title; +- } +- +- @Override +- public boolean hasCustomName() { +- return title != null; +- } +- +- @Override +- public IChatBaseComponent getScoreboardDisplayName() { +- return new ChatComponentText(title); +- } +- } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +index 23f05f4..fdaf026 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +@@ -26,7 +26,7 @@ import net.minecraft.server.NBTTagString; + import org.bukkit.craftbukkit.util.CraftChatMessage; + + @DelegateDeserialization(ItemStack.class) +-public final class CraftItemStack extends ItemStack { ++public class CraftItemStack extends ItemStack { + + public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) { + if (original instanceof CraftItemStack) { +@@ -95,26 +95,30 @@ public final class CraftItemStack extends ItemStack { + /** + * Mirror + */ +- private CraftItemStack(net.minecraft.server.ItemStack item) { ++ protected CraftItemStack(net.minecraft.server.ItemStack item) { + this.handle = item; + } + +- private CraftItemStack(ItemStack item) { ++ protected CraftItemStack(ItemStack item) { + this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null); + } + +- private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { ++ protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { + setType(type); + setAmount(amount); + setDurability(durability); + setItemMeta(itemMeta); + } + +- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { ++ protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { + this(Material.getMaterial(typeId), amount, durability, itemMeta); + + } + ++ public net.minecraft.server.ItemStack getHandle() { ++ return handle; ++ } ++ + @Override + public int getTypeId() { + return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java +new file mode 100644 +index 0000000..d90d218 +--- /dev/null ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java +@@ -0,0 +1,177 @@ ++package org.bukkit.craftbukkit.inventory; ++ ++import net.minecraft.server.*; ++import org.apache.commons.lang.Validate; ++import org.bukkit.craftbukkit.entity.CraftHumanEntity; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.entity.HumanEntity; ++import org.bukkit.event.inventory.InventoryType; ++import org.bukkit.inventory.InventoryHolder; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++public class MinecraftInventory implements IInventory ++{ ++ private final ItemStack[] items; ++ private int maxStack = MAX_STACK; ++ private final List viewers; ++ private final String title; ++ private InventoryType type; ++ private final InventoryHolder owner; ++ ++ public MinecraftInventory(InventoryHolder owner, InventoryType type) { ++ this(owner, type.getDefaultSize(), type.getDefaultTitle()); ++ this.type = type; ++ } ++ ++ public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { ++ this(owner, type.getDefaultSize(), title); ++ this.type = type; ++ } ++ ++ public MinecraftInventory(InventoryHolder owner, int size) { ++ this(owner, size, "Chest"); ++ } ++ ++ public MinecraftInventory(InventoryHolder owner, int size, String title) { ++ Validate.notNull(title, "Title cannot be null"); ++ Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); ++ this.items = new ItemStack[size]; ++ this.title = title; ++ this.viewers = new ArrayList(); ++ this.owner = owner; ++ this.type = InventoryType.CHEST; ++ } ++ ++ public int getSize() { ++ return items.length; ++ } ++ ++ public ItemStack getItem(int i) { ++ return items[i]; ++ } ++ ++ public ItemStack splitStack(int i, int j) { ++ ItemStack stack = this.getItem(i); ++ ItemStack result; ++ if (stack == null) return null; ++ if (stack.count <= j) { ++ this.setItem(i, null); ++ result = stack; ++ } else { ++ result = CraftItemStack.copyNMSStack(stack, j); ++ stack.count -= j; ++ } ++ this.update(); ++ return result; ++ } ++ ++ public ItemStack splitWithoutUpdate(int i) { ++ ItemStack stack = this.getItem(i); ++ ItemStack result; ++ if (stack == null) return null; ++ if (stack.count <= 1) { ++ this.setItem(i, null); ++ result = stack; ++ } else { ++ result = CraftItemStack.copyNMSStack(stack, 1); ++ stack.count -= 1; ++ } ++ return result; ++ } ++ ++ public void setItem(int i, ItemStack itemstack) { ++ items[i] = itemstack; ++ if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { ++ itemstack.count = this.getMaxStackSize(); ++ } ++ } ++ ++ public int getMaxStackSize() { ++ return maxStack; ++ } ++ ++ public void setMaxStackSize(int size) { ++ maxStack = size; ++ } ++ ++ public void update() {} ++ ++ public boolean a(EntityHuman entityhuman) { ++ return true; ++ } ++ ++ public ItemStack[] getContents() { ++ return items; ++ } ++ ++ public void onOpen(CraftHumanEntity who) { ++ viewers.add(who); ++ } ++ ++ public void onClose(CraftHumanEntity who) { ++ viewers.remove(who); ++ } ++ ++ public List getViewers() { ++ return viewers; ++ } ++ ++ public InventoryType getType() { ++ return type; ++ } ++ ++ public InventoryHolder getOwner() { ++ return owner; ++ } ++ ++ public boolean b(int i, ItemStack itemstack) { ++ return true; ++ } ++ ++ @Override ++ public void startOpen(EntityHuman entityHuman) { ++ ++ } ++ ++ @Override ++ public void closeContainer(EntityHuman entityHuman) { ++ ++ } ++ ++ @Override ++ public int getProperty(int i) { ++ return 0; ++ } ++ ++ @Override ++ public void b(int i, int i1) { ++ ++ } ++ ++ @Override ++ public int g() { ++ return 0; ++ } ++ ++ @Override ++ public void l() { ++ ++ } ++ ++ @Override ++ public String getName() { ++ return title; ++ } ++ ++ @Override ++ public boolean hasCustomName() { ++ return title != null; ++ } ++ ++ @Override ++ public IChatBaseComponent getScoreboardDisplayName() { ++ return new ChatComponentText(title); ++ } ++} +\ No newline at end of file +-- +2.3.5 + diff --git a/Patches/CraftBukkit-Patches/0163-Mineplex-World-Changes.patch b/Patches/CraftBukkit-Patches/0163-Mineplex-World-Changes.patch new file mode 100644 index 000000000..c8e1e170c --- /dev/null +++ b/Patches/CraftBukkit-Patches/0163-Mineplex-World-Changes.patch @@ -0,0 +1,26 @@ +From 3a9421a5ab5ebab8ec294d8c32e321080b07d56e Mon Sep 17 00:00:00 2001 +From: Shaun Bennett +Date: Tue, 21 Apr 2015 19:58:54 -0400 +Subject: [PATCH] Mineplex - World Changes + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index db0697b..35b216b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -1114,9 +1114,9 @@ public class CraftWorld implements World { + ( (EntityOcelot) entity ).spawnBonus = false; + } + // Spigot end +- if (entity instanceof EntityInsentient) { +- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); +- } ++// if (entity instanceof EntityInsentient) { ++// ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); ++// } + + world.addEntity(entity, reason); + return (T) entity.getBukkitEntity(); +-- +2.3.5 +