Update to Minecraft 1.8.3

This commit is contained in:
Thinkofdeath 2015-02-28 11:36:22 +00:00
parent 0d6db011bc
commit c0638b6ffb
107 changed files with 1670 additions and 2431 deletions

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <artifactId>bukkit</artifactId>
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-api</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<version>1.8.3-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Bukkit</name>

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot</artifactId>
<packaging>jar</packaging>
<version>1.8-R0.1-SNAPSHOT</version>
<version>1.8.3-R0.1-SNAPSHOT</version>
- <name>CraftBukkit</name>
- <url>http://www.bukkit.org</url>
+ <name>Spigot</name>
@ -41,6 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<dependency>
- <groupId>org.bukkit</groupId>
- <artifactId>bukkit</artifactId>
+ <groupId>net.sf.trove4j</groupId>
+ <artifactId>trove4j</artifactId>
+ <version>3.0.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.spigotmc</groupId>
+ <artifactId>spigot-api</artifactId>
<version>${project.version}</version>

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.q;
+ }
+ // Spigot End
public ServerConnection ao() {
public ServerConnection ap() {
return this.q;
}
--

View file

@ -10,14 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public Scoreboard scoreboard = new Scoreboard();
public final boolean isStatic;
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - public
public final boolean isClientSide;
// CraftBukkit - longhashset
- protected LongHashSet chunkTickList = new LongHashSet();
+ // protected LongHashSet chunkTickList = new LongHashSet(); // Spigot
private int K;
public boolean allowMonsters;
public boolean allowAnimals;
private int L;
public boolean allowMonsters; // CraftBukkit - public
public boolean allowAnimals; // CraftBukkit - public
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
public long ticksPerMonsterSpawns;
public boolean populating;
@ -59,9 +59,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
+ this.chunkTickList.setAutoCompactionFactor( 0 );
+ // Spigot end
this.K = this.random.nextInt(12000);
+
this.L = this.random.nextInt(12000);
this.allowMonsters = true;
this.allowAnimals = true;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
int k;
int l;
@ -157,7 +158,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
int k = chunkX * 16;
int l = chunkZ * 16;
@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
}

View file

@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // CraftBukkit start
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot // CraftBukkit start
IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1));
CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data));
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -0,0 +0,0 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isStatic) {
if (!world.isClientSide) {
super.b(world, blockposition, iblockdata, random);
- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) {
+ if (world.getLightLevel(blockposition.up()) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot) {

View file

@ -13,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
private static final Logger a = LogManager.getLogger();
- private List b = Lists.newArrayList();
- private Set c = Sets.newHashSet();
- private List<ChunkRegionLoader.PendingChunkToSave> b = Lists.newArrayList();
- private Set<ChunkCoordIntPair> c = Sets.newHashSet();
+ // Spigot start
+ private java.util.LinkedHashMap<ChunkCoordIntPair, PendingChunkToSave> pendingSaves = new java.util.LinkedHashMap<ChunkCoordIntPair, PendingChunkToSave>();
+ // private List b = Lists.newArrayList();
+ // private Set c = Sets.newHashSet();
+ // private List<ChunkRegionLoader.PendingChunkToSave> b = Lists.newArrayList();
+ // private Set<ChunkCoordIntPair> c = Sets.newHashSet();
+ // Spigot end
private Object d = new Object();
private final File e;
@ -48,8 +48,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
synchronized (this.d) {
- if (this.c.contains(chunkcoordintpair)) {
- for (int k = 0; k < this.b.size(); ++k) {
- if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
- nbttagcompound = ((PendingChunkToSave) this.b.get(k)).b;
- if (((ChunkRegionLoader.PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
- nbttagcompound = ((ChunkRegionLoader.PendingChunkToSave) this.b.get(k)).b;
- break;
- }
- }
@ -68,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
synchronized (this.d) {
- if (this.c.contains(chunkcoordintpair)) {
- for (int i = 0; i < this.b.size(); ++i) {
- if (((PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) {
- this.b.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- if (((ChunkRegionLoader.PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) {
- this.b.set(i, new ChunkRegionLoader.PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- return;
- }
- }
@ -78,9 +78,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return;
}
- this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- this.b.add(new ChunkRegionLoader.PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- this.c.add(chunkcoordintpair);
+ // this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
+ // this.b.add(new ChunkRegionLoader.PendingChunkToSave(chunkcoordintpair, nbttagcompound));
+ // this.c.add(chunkcoordintpair);
+ // Spigot end
FileIOThread.a().a(this);
@ -96,12 +96,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
}
- pendingchunktosave = (PendingChunkToSave) this.b.remove(0);
- this.c.remove(pendingchunktosave.a);
+ pendingchunktosave = this.pendingSaves.values().iterator().next();
+ this.pendingSaves.remove(pendingchunktosave.a);
- chunkregionloader_pendingchunktosave = (ChunkRegionLoader.PendingChunkToSave) this.b.remove(0);
- this.c.remove(chunkregionloader_pendingchunktosave.a);
+ chunkregionloader_pendingchunktosave = this.pendingSaves.values().iterator().next();
+ this.pendingSaves.remove(chunkregionloader_pendingchunktosave.a);
+ // Spigot end
}
if (pendingchunktosave != null) {
if (chunkregionloader_pendingchunktosave != null) {
--

View file

@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityTracker {
}
public void addEntity(Entity entity, int i, int j, boolean flag) {
public void addEntity(Entity entity, int i, final int j, boolean flag) {
+ org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
if (i > this.e) {
i = this.e;
@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot
if (entityplayer != this.tracker) {
if (this.c(entityplayer)) {
if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) {
if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) {
@@ -0,0 +0,0 @@ public class EntityTrackerEntry {
}
@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
public void b(Collection collection) {
public void b(Collection<Entity> collection) {
+ org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot
// CraftBukkit start
// this.entityList.addAll(collection);

View file

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public PlayerChunkMap(WorldServer worldserver) {
+ public PlayerChunkMap(WorldServer worldserver, int viewDistance /* Spigot */) {
this.world = worldserver;
- this.a(worldserver.getMinecraftServer().getPlayerList().t());
- this.a(worldserver.getMinecraftServer().getPlayerList().s());
+ this.a(viewDistance); // Spigot
}

View file

@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (chunk == null) {
if (this.chunkProvider == null) {
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
}
// CraftBukkit end
chunk.loadNearby(this, this, i, j);
+ world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
}
@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
// CraftBukkit start - Add async variant, provide compatibility
public Chunk a(World world, int i, int j) {
public Chunk a(World world, int i, int j) throws IOException {
+ world.timings.syncChunkLoadDataTimer.startTiming(); // Spigot
Object[] data = loadChunk(world, i, j);
+ world.timings.syncChunkLoadDataTimer.stopTiming(); // Spigot
@ -73,6 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) {
// CraftBukkit end
-
+ world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
@ -102,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot
// return chunk; // CraftBukkit
// return chunk; // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -114,15 +115,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.craftbukkit.LoggerOutputStream;
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
import org.bukkit.event.server.ServerCommandEvent;
// CraftBukkit end
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent;
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void aM() {
public void aN() {
+ SpigotTimings.serverCommandTimer.startTiming(); // Spigot
while (!this.k.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.k.remove(0);
while (!this.l.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
// CraftBukkit end
@ -158,8 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void move(double d0, double d1, double d2) {
+ org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
+
if (this.T) {
if (this.noclip) {
this.a(this.getBoundingBox().c(d0, d1, d2));
this.recalcPosition();
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
@ -186,11 +186,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
public void s_() {
public void t_() {
+ SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
super.s_();
if (!this.world.isStatic) {
int i = this.bu();
super.t_();
if (!this.world.isClientSide) {
int i = this.bv();
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
}
@ -204,7 +204,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
this.aR += f2;
this.aT += f2;
+ SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
}
@ -214,9 +214,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.world.methodProfiler.a("ai");
+ SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.bC()) {
this.aW = false;
this.aX = 0.0F;
if (this.bD()) {
this.aY = false;
this.aZ = 0.0F;
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.doTick();
this.world.methodProfiler.b();
@ -226,17 +226,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
this.aX *= 0.98F;
this.aY *= 0.98F;
this.aZ *= 0.9F;
this.aZ *= 0.98F;
this.ba *= 0.98F;
this.bb *= 0.9F;
+ SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
this.g(this.aX, this.aY);
this.g(this.aZ, this.ba);
+ SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic) {
if (!this.world.isClientSide) {
+ SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.bK();
this.bL();
+ SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
}
@ -253,15 +253,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldSaveEvent;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
protected void x() {}
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
protected void y() {}
protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws
protected void z() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ SpigotTimings.serverTickTimer.startTiming(); // Spigot
long i = System.nanoTime();
++this.ticks;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
@ -274,7 +274,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
this.methodProfiler.a("tallying");
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.methodProfiler.b();
this.methodProfiler.b();
@ -282,8 +282,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.spigotmc.CustomTimingsHandler.tick(); // Spigot
}
public void z() {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
public void A() {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.methodProfiler.c("levels");
@ -307,7 +307,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
}
}
@ -315,27 +315,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
CrashReport crashreport;
try {
+ worldserver.timings.doTick.startTiming(); // Spigot
worldserver.doTick();
+ worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Exception ticking world");
} catch (Throwable throwable) {
crashreport = CrashReport.a(throwable, "Exception ticking world");
worldserver.a(crashreport);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
try {
+ worldserver.timings.tickEntities.startTiming(); // Spigot
worldserver.tickEntities();
+ worldserver.timings.tickEntities.stopTiming(); // Spigot
} catch (Throwable throwable2) {
crashreport = CrashReport.a(throwable2, "Exception ticking world entities");
} catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Exception ticking world entities");
worldserver.a(crashreport);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.methodProfiler.b();
this.methodProfiler.a("tracker");
@ -345,12 +345,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.b();
this.methodProfiler.b();
// } // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
this.methodProfiler.c("connection");
+ SpigotTimings.connectionTimer.startTiming(); // Spigot
this.ao().c();
this.ap().c();
+ SpigotTimings.connectionTimer.stopTiming(); // Spigot
this.methodProfiler.c("players");
+ SpigotTimings.playerListTimer.startTiming(); // Spigot
@ -359,8 +359,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.c("tickables");
+ SpigotTimings.tickablesTimer.startTiming(); // Spigot
for (i = 0; i < this.o.size(); ++i) {
((IUpdatePlayerListBox) this.o.get(i)).c();
for (i = 0; i < this.p.size(); ++i) {
((IUpdatePlayerListBox) this.p.get(i)).c();
}
+ SpigotTimings.tickablesTimer.stopTiming(); // Spigot
@ -373,9 +373,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
// CraftBukkit end
private void handleCommand(String s) {
private void handleCommand(String s) {
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
+
// CraftBukkit start - whole method
this.c.info(this.player.getName() + " issued server command: " + s);
@ -417,8 +416,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
private static final Logger a = LogManager.getLogger();
private static Map f = Maps.newHashMap();
private static Map g = Maps.newHashMap();
private static Map<String, Class<? extends TileEntity>> f = Maps.newHashMap();
private static Map<Class<? extends TileEntity>, String> g = Maps.newHashMap();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
@ -441,10 +440,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.world;
}
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.M.a(new WorldBorderListener(((WorldServer) this).getServer().getHandle())); // CraftBukkit
this.getServer().addWorld(this.world); // CraftBukkit
+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
});
this.getServer().addWorld(this.world);
// CraftBukkit end
+ timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
}
public World b() {
@ -473,12 +472,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.entityTick.stopTiming(); // Spigot
this.methodProfiler.c("blockEntities");
+ timings.tileEntityTick.startTiming(); // Spigot
this.L = true;
this.M = true;
// CraftBukkit start - From below, clean up tile entities before ticking them
if (!this.b.isEmpty()) {
if (!this.c.isEmpty()) {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
if (this.isLoaded(blockposition) && this.M.a(blockposition)) {
if (this.isLoaded(blockposition) && this.N.a(blockposition)) {
try {
+ tileentity.tickTimer.startTiming(); // Spigot
((IUpdatePlayerListBox) tileentity).c();
@ -502,11 +501,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ timings.tileEntityTick.stopTiming(); // Spigot
+ timings.tileEntityPending.startTiming(); // Spigot
this.L = false;
this.M = false;
/* CraftBukkit start - Moved up
if (!this.b.isEmpty()) {
if (!this.c.isEmpty()) {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
this.a.clear();
this.b.clear();
}
+ timings.tileEntityPending.stopTiming(); // Spigot
@ -577,12 +576,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.b();
+ timings.doSounds.startTiming(); // Spigot
this.ak();
this.getWorld().processChunkGC(); // CraftBukkit
+ timings.doChunkGC.stopTiming(); // Spigot
}
public BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class Chunk {
private long u;
private int v;
private ConcurrentLinkedQueue w;
private ConcurrentLinkedQueue<BlockPosition> w;
+ protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ continue label115;
+ }
+ // Spigot end
if (l2 >= entityinsentient.bU()) {
if (l2 >= entityinsentient.bV()) {
continue label115;
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -15,17 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
public int ticksLived;
public int maxFireTicks;
public int fireTicks;
public int fireTicks; // CraftBukkit - public
- protected boolean inWater;
+ public boolean inWater; // Spigot - protected -> public
public int noDamageTicks;
protected boolean justCreated;
protected boolean fireProof;
protected DataWatcher datawatcher;
private double ap;
private double aq;
private double ar;
private double as;
- public boolean ad;
+ public boolean ad;public boolean isAddedToChunk() { return ad; } // Spigot
+ public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot
public int ae;
public int af;
public int ag;
@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature {
private float bl;
private float bn;
public boolean ageLocked = false; // CraftBukkit
+ // Spigot start
@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void inactiveTick()
+ {
+ super.inactiveTick();
+ if ( this.world.isStatic || this.ageLocked )
+ if ( this.world.isClientSide || this.ageLocked )
+ { // CraftBukkit
+ this.a( this.isBaby() );
+ } else
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Entity shooter;
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
private double damage = 2.0D;
public int knockbackStrength;
public int knockbackStrength; // CraftBukkit - public
+ // Spigot Start
+ @Override
@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ if ( this.inGround )
+ {
+ this.ap += 1; // Despawn counter. First int after shooter
+ this.ar += 1; // Despawn counter. First int after shooter
+ }
+ super.inactiveTick();
+ }
@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -0,0 +0,0 @@ public class EntityFireworks extends Entity {
private int ticksFlown;
public int expectedLifespan;
public int expectedLifespan; // CraftBukkit - public
+ // Spigot Start
+ @Override
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
public EntityFireworks(World world) {
super(world);
this.a(0.25F, 0.25F);
this.setSize(0.25F, 0.25F);
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
@ -162,7 +162,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.lastTick = MinecraftServer.currentTick;
+ // CraftBukkit end
+
+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
+ // CraftBukkit start - fire ItemDespawnEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0;
@ -189,7 +189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void inactiveTick()
+ {
+ super.inactiveTick();
+ ++this.aO; // Above all the floats
+ ++this.ticksFarFromPlayer; // Above all the floats
+ }
+ // Spigot end

View file

@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.e()) {
- if (this.isDamaged(i, entityliving.bb())) {
+ if (this.isDamaged(i, entityliving.bb(), entityliving)) { // Spigot
- if (this.isDamaged(i, entityliving.bc())) {
+ if (this.isDamaged(i, entityliving.bc(), entityliving)) { // Spigot
entityliving.b(this);
--this.count;
if (entityliving instanceof EntityHuman) {

View file

@ -17,12 +17,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -0,0 +0,0 @@ public class EntityTracker {
public void addEntity(Entity entity, int i, int j, boolean flag) {
public void addEntity(Entity entity, int i, final int j, boolean flag) {
org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
if (i > this.e) {
i = this.e;
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ public class ActivationRange
maxRange = Math.max( maxRange, miscActivationRange );
maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );
- for ( Entity player : (List<Entity>) world.players )
+ for ( Entity player : (List<Entity>) (List) world.players )
{
player.activatedTick = MinecraftServer.currentTick;
@@ -0,0 +0,0 @@ public class ActivationRange
public static boolean checkEntityImmunities(Entity entity)
{
// quick checks.
- if ( entity.inWater /* isInWater */ || entity.fireTicks > 0 )
+ if ( entity.inWater || entity.fireTicks > 0 )
{
return true;
}
@@ -0,0 +0,0 @@ public class ActivationRange
{
return true;
}
- if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).ck() /* Getter for first boolean */ )
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).cm() /* Getter for first boolean */ )
{
return true;
}
if ( entity instanceof EntityAnimal )
{
EntityAnimal animal = (EntityAnimal) entity;
- if ( animal.isBaby() || animal.cp() /*love*/ )
+ if ( animal.isBaby() || animal.isInLove() )
{
return true;
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class RegionFileCache {
- private static final Map a = Maps.newHashMap();
+ public static final Map a = Maps.newHashMap(); // Spigot - private -> public
- private static final Map<File, RegionFile> a = Maps.newHashMap();
+ public static final Map<File, RegionFile> a = Maps.newHashMap(); // Spigot - private -> public
public static synchronized RegionFile a(File file, int i, int j) {
File file1 = new File(file, "region");

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/IRecipe.java
@@ -0,0 +0,0 @@ public interface IRecipe {
ItemStack[] b(InventoryCrafting inventorycrafting);
org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
+
+ java.util.List<ItemStack> getIngredients(); // Spigot
@ -30,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
@@ -0,0 +0,0 @@ public class ShapedRecipes implements IRecipe {
this.e = true;
return this;
public int a() {
return this.width * this.height;
}
+
+ // Spigot start
@ -51,9 +51,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private final ItemStack result;
+ public final ItemStack result; // Spigot
private final List ingredients;
private final List<ItemStack> ingredients;
public ShapelessRecipes(ItemStack itemstack, List list) {
public ShapelessRecipes(ItemStack itemstack, List<ItemStack> list) {
@@ -0,0 +0,0 @@ public class ShapelessRecipes implements IRecipe {
public int a() {
return this.ingredients.size();

View file

@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
// ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection);
// CraftBukkit start - Call event when pushing items into other inventories
- CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1));
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, world.spigotConfig.hopperAmount)); // Spigot
@ -75,10 +75,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- ((TileEntityHopper) ihopper).d(8); // Delay hopper checks
+ ((TileEntityHopper) ihopper).d(ihopper.getWorld().spigotConfig.hopperTransfer); // Spigot
} else if (ihopper instanceof EntityMinecartHopper) {
- ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks
+ ((EntityMinecartHopper) ihopper).l(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot
- ((EntityMinecartHopper) ihopper).m(4); // Delay hopper minecart checks
+ ((EntityMinecartHopper) ihopper).m(ihopper.getWorld().spigotConfig.hopperTransfer / 2); // Spigot
}
-
return false;
}
+ int origCount = event.getItem().getAmount(); // Spigot

View file

@ -49,9 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
}
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
if (entity instanceof EntityInsentient) {
((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null);
}
} else if (entity instanceof EntityInsentient && entity.world != null && flag) { // CraftBukkit - EntityLiving -> EntityInsentient
((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null);
-
- entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // Spigot start - call SpawnerSpawnEvent, abort if cancelled
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());

View file

@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
private void handleCommand(String s) {
org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
// CraftBukkit start - whole method
+ if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.c.info(this.player.getName() + " issued server command: " + s);

View file

@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end
if (packethandshakinginsetprotocol.b() > 47) {
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8");
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8" ) ); // Spigot
- chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.3");
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage, "1.8.3" ) ); // Spigot
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext);
} else if (packethandshakinginsetprotocol.b() < 47) {
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8");
+ chatcomponenttext = new ChatComponentText(java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8" ) ); // Spigot
- chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.8.3");
+ chatcomponenttext = new ChatComponentText( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage, "1.8.3" ) ); // Spigot
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext));
this.b.close(chatcomponenttext);
} else {

View file

@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class BlockRedstoneTorch extends BlockTorch {
- private static Map b = Maps.newHashMap();
+ private static Map b = new java.util.WeakHashMap(); // Spigot
- private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = Maps.newHashMap();
+ private static Map<World, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new java.util.WeakHashMap(); // Spigot
private final boolean isOn;
private boolean a(World world, BlockPosition blockposition, boolean flag) {

View file

@ -29,14 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
protected void bK() {
List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
}
}));
- if (list != null && !list.isEmpty()) {
+ if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition
- if (!list.isEmpty()) {
+ if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java

View file

@ -8,18 +8,18 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.g[this.ticks % 100] = System.nanoTime() - i;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.h[this.ticks % 100] = System.nanoTime() - i;
this.methodProfiler.b();
this.methodProfiler.a("snooper");
- if (!this.m.d() && this.ticks > 100) {
+ if (getSnooperEnabled() && !this.m.d() && this.ticks > 100) { // Spigot
this.m.a();
- if (!this.n.d() && this.ticks > 100) {
+ if (getSnooperEnabled() && !this.n.d() && this.ticks > 100) { // Spigot
this.n.a();
}
- if (this.ticks % 6000 == 0) {
+ if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot
this.m.b();
this.n.b();
}
--

View file

@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
// Craftbukkit end */
this.W();
- if (!this.world.isStatic && this.age >= 6000) {
+ if (!this.world.isStatic && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
- if (!this.world.isClientSide && this.age >= 6000) {
+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;

View file

@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile {
if (block == this.g && i == this.h) {
++this.ap;
- if (this.ap >= 1200) {
+ if (this.ap >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
++this.ar;
- if (this.ar >= 1200) {
+ if (this.ar >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter
this.die();
}
} else {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View file

@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Block block = world.getType(blockposition.a(i1, k, j1)).getBlock();
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) {
- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE);
- this.a(world, blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData());
+ world.setTypeUpdate(blockposition.a(i1, k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot
}
if (k != 0 && l > 1) {
block = world.getType(blockposition.a(i1, -k, j1)).getBlock();
if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW || block == Blocks.ICE) {
- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE);
- this.a(world, blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData());
+ world.setTypeUpdate(blockposition.a(i1, -k, j1), Blocks.PACKED_ICE.getBlockData()); // Spigot
}
}
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Block block1 = world.getType(blockposition1).getBlock();
if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) {
- this.a(world, blockposition1, Blocks.PACKED_ICE);
- this.a(world, blockposition1, Blocks.PACKED_ICE.getBlockData());
+ world.setTypeUpdate(blockposition1, Blocks.PACKED_ICE.getBlockData()); // Spigot
blockposition1 = blockposition1.down();
--l1;

View file

@ -12,24 +12,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
- if (this.aQ() > 0L) {
+ if (false && this.aQ() > 0L) { // Spigot - disable
Thread thread = new Thread(new ThreadWatchdog(this));
- if (this.aR() > 0L) {
+ if (false && this.aR() > 0L) { // Spigot - disable
Thread thread1 = new Thread(new ThreadWatchdog(this));
thread.setName("Server Watchdog");
thread1.setName("Server Watchdog");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.a(crashreport);
} finally {
try {
+ org.spigotmc.WatchdogThread.doStop();
this.stop();
this.isStopped = true;
this.stop();
} catch (Throwable throwable1) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.methodProfiler.b();
this.methodProfiler.b();
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
index 0000000000000000000000000000000000000000..00000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/spigotmc/RestartCommand.java
@@ -0,0 +0,0 @@

View file

@ -8,17 +8,15 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java
@@ -0,0 +0,0 @@ public class PacketPlayInChat implements Packet {
return this.a;
@@ -0,0 +0,0 @@ public class PacketPlayInChat implements Packet<PacketListenerPlayIn> {
packetdataserializer.a(this.a);
}
- public void a(PacketListener packetlistener) {
- public void a(PacketListenerPlayIn packetlistenerplayin) {
+ // Spigot Start
+ private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool(
+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() );
+ @Override
+ public void a(final PacketListener packetlistener)
+ {
+ public void a(final PacketListenerPlayIn packetlistenerplayin) {
+ if ( !a.startsWith("/") )
+ {
+ executors.submit( new Runnable()
@ -27,13 +25,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public void run()
+ {
+ PacketPlayInChat.this.a( (PacketListenerPlayIn) packetlistener );
+ packetlistenerplayin.a( PacketPlayInChat.this );
+ }
+ } );
+ return;
+ }
+ // Spigot End
this.a((PacketListenerPlayIn) packetlistener);
packetlistenerplayin.a(this);
}
}
--

View file

@ -13,17 +13,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
this.world.setAir(blockposition);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
} else if (!this.world.isStatic) {
} else if (!this.world.isClientSide) {
this.die();
return;
@@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity {
return;
}
this.world.setTypeAndData(blockposition, this.block, 3);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
// CraftBukkit end
if (block instanceof BlockFalling) {
((BlockFalling) block).a_(this.world, blockposition);
return;
}
this.world.setTypeAndData(blockposition, this.block, 3);
+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot
// CraftBukkit end
if (block instanceof BlockFalling) {
((BlockFalling) block).a_(this.world, blockposition);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
@ -40,37 +40,37 @@ diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
this.b = chunk.locZ;
this.d = flag;
this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i);
+ chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world);
}
public void a(PacketDataSerializer packetdataserializer) {
public void a(PacketDataSerializer packetdataserializer) throws IOException {
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
private int[] b;
private ChunkMap[] c;
private PacketPlayOutMapChunk.ChunkMap[] c;
private boolean d;
+ private World world; // Spigot
public PacketPlayOutMapChunkBulk() {}
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
this.b[j] = chunk.locZ;
this.c[j] = chunkmap;
this.c[j] = packetplayoutmapchunk_chunkmap;
}
-
+
+ world = ((Chunk) list.get(0)).getWorld(); // Spigot
}
public void a(PacketDataSerializer packetdataserializer) {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet {
public void a(PacketDataSerializer packetdataserializer) throws IOException {
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
}
for (i = 0; i < this.a.length; ++i) {

View file

@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Entity a;
private boolean b = true;
- private static final Map c = Maps.newHashMap();
- private final Map d = Maps.newHashMap();
- private static final Map<Class<?>, Integer> c = Maps.newHashMap();
- private final Map<Integer, DataWatcher.WatchableObject> d = Maps.newHashMap();
+ // Spigot Start
+ private static final gnu.trove.map.TObjectIntMap classToId = new gnu.trove.map.hash.TObjectIntHashMap( 10, 0.5f, -1 );
+ private final gnu.trove.map.TIntObjectMap dataValues = new gnu.trove.map.hash.TIntObjectHashMap( 10, 0.5f, -1 );
+ // These exist as an attempt at backwards compatability for (broken) NMS plugins
+ private static final Map c = gnu.trove.TDecorators.wrap( classToId );
+ private final Map d = gnu.trove.TDecorators.wrap( dataValues );
+ private static final Map<Class<?>, Integer> c = gnu.trove.TDecorators.wrap( classToId );
+ private final Map<Integer, DataWatcher.WatchableObject> d = gnu.trove.TDecorators.wrap( dataValues );
+ // Spigot End
private boolean e;
private ReadWriteLock f = new ReentrantReadWriteLock();
@ -28,43 +28,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class DataWatcher {
}
public void a(int i, Object object) {
- Integer integer = (Integer) DataWatcher.c.get(object.getClass());
+ int integer = classToId.get(object.getClass()); // Spigot
public <T> void a(int i, T t0) {
- Integer integer = (Integer) DataWatcher.c.get(t0.getClass());
+ int integer = classToId.get(t0.getClass()); // Spigot
- if (integer == null) {
+ if (integer == -1) { // Spigot
throw new IllegalArgumentException("Unknown data type: " + object.getClass());
throw new IllegalArgumentException("Unknown data type: " + t0.getClass());
} else if (i > 31) {
throw new IllegalArgumentException("Data value id is too big with " + i + "! (Max is " + 31 + ")");
- } else if (this.d.containsKey(Integer.valueOf(i))) {
+ } else if (this.dataValues.containsKey(i)) { // Spigot
throw new IllegalArgumentException("Duplicate id value for " + i + "!");
} else {
- WatchableObject watchableobject = new WatchableObject(integer.intValue(), i, object);
+ WatchableObject watchableobject = new WatchableObject(integer, i, object); // Spigot
- DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer.intValue(), i, t0);
+ DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer, i, t0); // Spigot
this.f.writeLock().lock();
- this.d.put(Integer.valueOf(i), watchableobject);
+ this.dataValues.put(i, watchableobject); // Spigot
- this.d.put(Integer.valueOf(i), datawatcher_watchableobject);
+ this.dataValues.put(i, datawatcher_watchableobject); // Spigot
this.f.writeLock().unlock();
this.b = false;
}
@@ -0,0 +0,0 @@ public class DataWatcher {
WatchableObject watchableobject = new WatchableObject(j, i, (Object) null);
DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(j, i, (Object) null);
this.f.writeLock().lock();
- this.d.put(Integer.valueOf(i), watchableobject);
+ this.dataValues.put(i, watchableobject); // Spigot
- this.d.put(Integer.valueOf(i), datawatcher_watchableobject);
+ this.dataValues.put(i, datawatcher_watchableobject); // Spigot
this.f.writeLock().unlock();
this.b = false;
}
@@ -0,0 +0,0 @@ public class DataWatcher {
WatchableObject watchableobject;
DataWatcher.WatchableObject datawatcher_watchableobject;
try {
- watchableobject = (WatchableObject) this.d.get(Integer.valueOf(i));
+ watchableobject = (WatchableObject) this.dataValues.get(i); // Spigot
- datawatcher_watchableobject = (DataWatcher.WatchableObject) this.d.get(Integer.valueOf(i));
+ datawatcher_watchableobject = (DataWatcher.WatchableObject) this.dataValues.get(i); // Spigot
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Getting synched entity data");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Synched entity data");
@ -76,29 +76,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot
while (iterator.hasNext()) {
WatchableObject watchableobject = (WatchableObject) iterator.next();
DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next();
@@ -0,0 +0,0 @@ public class DataWatcher {
public void a(PacketDataSerializer packetdataserializer) {
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.f.readLock().lock();
- Iterator iterator = this.d.values().iterator();
+ Iterator iterator = this.dataValues.valueCollection().iterator(); // Spigot
while (iterator.hasNext()) {
WatchableObject watchableobject = (WatchableObject) iterator.next();
DataWatcher.WatchableObject datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next();
@@ -0,0 +0,0 @@ public class DataWatcher {
}
public List c() {
public List<DataWatcher.WatchableObject> c() {
- ArrayList arraylist = null;
+ ArrayList arraylist = Lists.newArrayList(); // Spigot
this.f.readLock().lock();
- WatchableObject watchableobject;
- DataWatcher.WatchableObject datawatcher_watchableobject;
-
- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(watchableobject)) {
- watchableobject = (WatchableObject) iterator.next();
- for (Iterator iterator = this.d.values().iterator(); iterator.hasNext(); arraylist.add(datawatcher_watchableobject)) {
- datawatcher_watchableobject = (DataWatcher.WatchableObject) iterator.next();
- if (arraylist == null) {
- arraylist = Lists.newArrayList();
- }
@ -130,5 +130,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ classToId.put(Vector3f.class, 7);
+ // Spigot End
}
}
public static class WatchableObject {
--

View file

@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ import java.util.Arrays;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
import javax.crypto.SecretKey;
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
}
@ -33,125 +41,96 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - fire PlayerLoginEvent
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname);
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
this.g = EnumProtocolState.KEY;
this.g = LoginListener.EnumProtocolState.KEY;
this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.P().getPublic(), this.e));
} else {
- this.g = EnumProtocolState.READY_TO_ACCEPT;
+ (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start(); // Spigot
- this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
+ // Spigot start
+ try {
+ new LoginHandler().fireEvents();
+ } catch (Exception ex) {
+ disconnect("Failed to verify username!");
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
+ }
+ // Spigot end
}
}
diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
+++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread {
GameProfile gameprofile = LoginListener.b(this.a);
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
return;
}
try {
+ // Spigot Start
+ if ( !LoginListener.a( this.a ).getOnlineMode() )
+ {
+ a.initUUID();
+ fireLoginEvents();
+ return;
+ }
+ // Spigot End
String s = (new BigInteger(MinecraftEncryption.a(LoginListener.c(this.a), LoginListener.a(this.a).P().getPublic(), LoginListener.d(this.a)))).toString(16);
LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s));
if (LoginListener.b(this.a) != null) {
- // CraftBukkit start - fire PlayerPreLoginEvent
- if (!this.a.networkManager.g()) {
- return;
- }
-
- String playerName = LoginListener.b(this.a).getName();
- java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
- java.util.UUID uniqueId = LoginListener.b(this.a).getId();
- final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server;
-
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
- server.getPluginManager().callEvent(asyncEvent);
-
- if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
- final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
- if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
- event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
- }
- Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
- @Override
- protected PlayerPreLoginEvent.Result evaluate() {
- server.getPluginManager().callEvent(event);
- return event.getResult();
- }};
-
- LoginListener.a(this.a).processQueue.add(waitable);
- if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
- this.a.disconnect(event.getKickMessage());
- return;
- }
- } else {
- if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
- this.a.disconnect(asyncEvent.getKickMessage());
- return;
- }
- }
- // CraftBukkit end
-
- LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId());
- LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
+ fireLoginEvents(); // Spigot
} else if (LoginListener.a(this.a).S()) {
LoginListener.e().warn("Failed to verify username but will let them in anyway!");
LoginListener.a(this.a, this.a.a(gameprofile));
@@ -0,0 +0,0 @@ class ThreadPlayerLookupUUID extends Thread {
}
}
+ new LoginHandler().fireEvents();
+ } else if (LoginListener.this.server.S()) {
+ LoginListener.c.warn("Failed to verify username but will let them in anyway!");
+ LoginListener.this.i = LoginListener.this.a(gameprofile);
+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
+ } else {
+ LoginListener.this.disconnect("Failed to verify username!");
+ LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer
+ }
+ } catch (AuthenticationUnavailableException authenticationunavailableexception) {
+ if (LoginListener.this.server.S()) {
+ LoginListener.c.warn("Authentication servers are down but will let them in anyway!");
+ LoginListener.this.i = LoginListener.this.a(gameprofile);
+ LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
+ } else {
+ LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!");
+ LoginListener.c.error("Couldn\'t verify username because servers are unavailable");
+ }
+ // CraftBukkit start - catch all exceptions
+ } catch (Exception exception) {
+ disconnect("Failed to verify username!");
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception);
+ // CraftBukkit end
+ }
+
+ private void fireLoginEvents() throws Exception
+ {
+ // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!this.a.networkManager.g()) {
+ return;
+ }
+ }).start();
+ }
+
+ String playerName = LoginListener.b(this.a).getName();
+ java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
+ java.util.UUID uniqueId = LoginListener.b(this.a).getId();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server;
+
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
+ server.getPluginManager().callEvent(asyncEvent);
+
+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
+ }
+ Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
+ @Override
+ protected PlayerPreLoginEvent.Result evaluate() {
+ server.getPluginManager().callEvent(event);
+ return event.getResult();
+ }};
+
+ LoginListener.a(this.a).processQueue.add(waitable);
+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
+ this.a.disconnect(event.getKickMessage());
+ return;
+ }
+ } else {
+ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
+ this.a.disconnect(asyncEvent.getKickMessage());
+ return;
+ }
+ }
+ // CraftBukkit end
+
+ LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId());
+ LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
+ }
}
+
+ // Spigot start
+ public class LoginHandler {
+
+ public void fireEvents() throws Exception {
String playerName = i.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
java.util.UUID uniqueId = i.getId();
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo
// CraftBukkit end
LoginListener.c.info("UUID of player " + LoginListener.this.i.getName() + " is " + LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
- } else if (LoginListener.this.server.S()) {
- LoginListener.c.warn("Failed to verify username but will let them in anyway!");
- LoginListener.this.i = LoginListener.this.a(gameprofile);
- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
- } else {
- LoginListener.this.disconnect("Failed to verify username!");
- LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer
- }
- } catch (AuthenticationUnavailableException authenticationunavailableexception) {
- if (LoginListener.this.server.S()) {
- LoginListener.c.warn("Authentication servers are down but will let them in anyway!");
- LoginListener.this.i = LoginListener.this.a(gameprofile);
- LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
- } else {
- LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!");
- LoginListener.c.error("Couldn\'t verify username because servers are unavailable");
- }
- // CraftBukkit start - catch all exceptions
- } catch (Exception exception) {
- disconnect("Failed to verify username!");
- server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception);
- // CraftBukkit end
- }
-
- }
- }).start();
}
}
+ // Spigot end
protected GameProfile a(GameProfile gameprofile) {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8));
--

View file

@ -10,11 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +0,0 @@ import java.util.HashMap;
// CraftBukkit end
public class HandshakeListener implements PacketHandshakingInListener {
-
+
+ private static final com.google.gson.Gson gson = new com.google.gson.Gson(); // Spigot
// CraftBukkit start - add fields
private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
@ -28,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ String[] split = packethandshakinginsetprotocol.b.split("\00");
+ if ( split.length == 3 || split.length == 4 ) {
+ packethandshakinginsetprotocol.b = split[0];
+ b.j = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ b.l = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ b.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] );
+ } else
+ {
@ -80,28 +78,28 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
private final EnumProtocolDirection g;
private final Queue h = Queues.newConcurrentLinkedQueue();
private Channel i;
- private SocketAddress j;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
private final Queue<NetworkManager.QueuedPacket> i = Queues.newConcurrentLinkedQueue();
private final ReentrantReadWriteLock j = new ReentrantReadWriteLock();
public Channel k; // CraftBukkit - public, PAIL: rename
- private SocketAddress l;
+ // Spigot Start
+ public SocketAddress j;
+ public SocketAddress l;
+ public java.util.UUID spoofedUUID;
+ public com.mojang.authlib.properties.Property[] spoofedProfile;
+ // Spigot End
private PacketListener k;
private IChatBaseComponent l;
private boolean m;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
static Channel a(NetworkManager networkmanager) {
return networkmanager.i;
private PacketListener m;
private IChatBaseComponent n;
private boolean o;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
this.b = agenericfuturelistener;
}
}
+
+ // Spigot Start
+ public SocketAddress getRawAddress()
+ {
+ return this.i.remoteAddress();
+ return this.k.remoteAddress();
+ }
+ // Spigot End
}
@ -109,9 +107,9 @@ diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet {
@@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingI
public void a(PacketDataSerializer packetdataserializer) {
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.e();
- this.b = packetdataserializer.c(255);
+ this.b = packetdataserializer.c(Short.MAX_VALUE); // Spigot

View file

@ -9,33 +9,33 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
private final List o = Lists.newArrayList();
private final ICommandHandler p;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
private final List<IUpdatePlayerListBox> p = Lists.newArrayList();
protected final ICommandHandler b;
public final MethodProfiler methodProfiler = new MethodProfiler();
- private final ServerConnection q;
+ private ServerConnection q; // Spigot
private final ServerPing r = new ServerPing();
private final Random s = new Random();
private String serverIp;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.d = proxy;
MinecraftServer.k = this;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.e = proxy;
MinecraftServer.l = this;
// this.universe = file; // CraftBukkit
- this.q = new ServerConnection(this);
+ // this.q = new ServerConnection(this); // Spigot
this.Z = new UserCache(this, file1);
this.p = this.h();
this.b = this.h();
// this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
// Spigot End
public ServerConnection ao() {
public ServerConnection ap() {
- return this.q;
+ return this.q == null ? this.q = new ServerConnection(this) : this.q; // Spigot
}
public boolean aq() {
public boolean ar() {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
} catch (Throwable throwable) {
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);

View file

@ -9,22 +9,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
IBlockData iblockdata = Blocks.STONE.getBlockData();
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
- for (int k1 = i; k1 < j; ++k1) {
- for (int l1 = i1; l1 < j1; ++l1) {
- if (this.isLoaded(new BlockPosition(k1, 64, l1))) {
- if (this.isLoaded(blockposition_mutableblockposition.c(k1, 64, l1))) {
- for (int i2 = k - 1; i2 < l; ++i2) {
- BlockPosition blockposition = new BlockPosition(k1, i2, l1);
- boolean flag = entity.aS();
- boolean flag1 = this.a(this.af(), entity);
-
- blockposition_mutableblockposition.c(k1, i2, l1);
- if (flag && flag1) {
- entity.h(false);
- } else if (!flag && !flag1) {
- entity.h(true);
- }
-
- IBlockData iblockdata1 = iblockdata;
+ // Spigot start
+ int ystart = ( ( k - 1 ) < 0 ) ? 0 : ( k - 1 );
+ for ( int chunkx = ( i >> 4 ); chunkx <= ( ( j - 1 ) >> 4 ); chunkx++ )
@ -51,8 +50,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ for ( int y = ystart; y < l; y++ )
+ {
+ BlockPosition blockposition = new BlockPosition( x, y, z );
+ boolean flag = entity.aS();
+ boolean flag1 = this.a(this.af(), entity);
+
+ if (flag && flag1) {
+ entity.h(false);
@ -60,15 +57,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entity.h(true);
+ }
- IBlockData iblockdata;
+ IBlockData iblockdata;
- if (!this.af().a(blockposition) && flag1) {
- iblockdata = Blocks.STONE.getBlockData();
- } else {
- iblockdata = this.getType(blockposition);
- if (worldborder.a((BlockPosition) blockposition_mutableblockposition) || !flag1) {
- iblockdata1 = this.getType(blockposition_mutableblockposition);
+ IBlockData block;
+ if (!this.af().a(blockposition) && flag1) {
+ if (!this.getWorldBorder().a(blockposition) && flag1) {
+ block = Blocks.STONE.getBlockData();
+ } else
+ {
@ -80,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
}
-
- iblockdata.getBlock().a(this, blockposition, iblockdata, axisalignedbb, arraylist, entity);
- iblockdata1.getBlock().a(this, blockposition_mutableblockposition, iblockdata1, axisalignedbb, arraylist, entity);
}
}
}

View file

@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Spigot End
this.world.methodProfiler.a("sensing");
this.bi.a();
this.bk.a();
this.world.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!org.spigotmc.SpigotConfig.lateBind) {
try {
this.ao().a(inetaddress, this.Q());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
this.ap().a(inetaddress, this.Q());
} catch (IOException ioexception) {
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
return false;
@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (org.spigotmc.SpigotConfig.lateBind) {
+ try {
+ this.ao().a(inetaddress, this.Q());
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
+ this.ap().a(inetaddress, this.Q());
+ } catch (IOException ioexception) {
+ DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
+ DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()});
+ DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
@ -40,8 +40,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+
if (false && this.aQ() > 0L) { // Spigot - disable
Thread thread = new Thread(new ThreadWatchdog(this));
if (false && this.aR() > 0L) { // Spigot - disable
Thread thread1 = new Thread(new ThreadWatchdog(this));
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -8,13 +8,13 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
worldserver.doTick();
worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable1) {
} catch (Throwable throwable) {
+ // Spigot Start
+ try {
crashreport = CrashReport.a(throwable1, "Exception ticking world");
crashreport = CrashReport.a(throwable, "Exception ticking world");
+ } catch (Throwable t){
+ throw new RuntimeException("Error generating crash report", t);
+ }
@ -22,13 +22,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
worldserver.a(crashreport);
throw new ReportedException(crashreport);
}
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
worldserver.tickEntities();
worldserver.timings.tickEntities.stopTiming(); // Spigot
} catch (Throwable throwable2) {
} catch (Throwable throwable1) {
+ // Spigot Start
+ try {
crashreport = CrashReport.a(throwable2, "Exception ticking world entities");
crashreport = CrashReport.a(throwable1, "Exception ticking world entities");
+ } catch (Throwable t){
+ throw new RuntimeException("Error generating crash report", t);
+ }

View file

@ -27,7 +27,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
SpigotTimings.worldSaveTimer.startTiming(); // Spigot
this.methodProfiler.a("save");
this.v.savePlayers();

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java
@@ -0,0 +0,0 @@ public class NBTTagByteArray extends NBTBase {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
int j = datainput.readInt();
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24);
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
@@ -0,0 +0,0 @@ public class NBTTagIntArray extends NBTBase {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws java.io.IOException {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
int j = datainput.readInt();
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24);

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
// CraftBukkit end
@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot end
public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
this.d = proxy;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.e = proxy;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.isRunning = false;
}
@ -35,15 +35,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void run() {
try {
if (this.init()) {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.r.setServerInfo(new ServerPingServerData("1.8", 47));
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.r.setServerInfo(new ServerPing.ServerData("1.8.3", 47));
this.a(this.r);
+ // Spigot start
+ Arrays.fill( recentTps, 20 );
+ long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick;
while (this.isRunning) {
- long j = ax();
- long j = ay();
- long k = j - this.ab;
-
- if (k > 2000L && this.ab - this.R >= 15000L) {
@ -68,14 +68,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- i += k;
- this.ab = j;
- if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
- this.y();
- if (this.worlds.get(0).everyoneDeeplySleeping()) {
- this.z();
- i = 0L;
- } else {
- while (i > 50L) {
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- i -= 50L;
- this.y();
- this.z();
- }
+ if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 )
+ {
@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ lastTick = curTime;
- Thread.sleep(Math.max(1L, 50L - i));
+ this.y();
+ this.z();
this.Q = true;
}
+ // Spigot end

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener {
}
ServerPingPlayerSample playerSample = new ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
+ // Spigot Start
+ if ( !profiles.isEmpty() )
+ {

View file

@ -10,17 +10,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ServerConnection.java
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
@@ -0,0 +0,0 @@ public class ServerConnection {
List list = this.g;
List list = this.h;
synchronized (this.g) {
synchronized (this.h) {
+ // Spigot Start
+ // This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order
+ if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 )
+ {
+ Collections.shuffle( this.g );
+ Collections.shuffle( this.h );
+ }
+ // Spigot End
Iterator iterator = this.g.iterator();
Iterator iterator = this.h.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger bF = LogManager.getLogger();
private static final Logger bH = LogManager.getLogger();
- private String locale = "en_US";
+ public String locale = "en_US"; // Spigot
public PlayerConnection playerConnection;

View file

@ -17,29 +17,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int numCollisions = 0; // Spigot
public void collide(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) {
if (!entity.T && !this.T) {
if (!entity.noclip && !this.noclip) {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
}));
if (this.ad() && list != null && !list.isEmpty()) { // Spigot: Add this.ad() condition
if (this.ad() && !list.isEmpty()) { // Spigot: Add this.ad() condition
+ numCollisions -= world.spigotConfig.maxCollisionsPerEntity; // Spigot
for (int i = 0; i < list.size(); ++i) {
+ if (numCollisions > world.spigotConfig.maxCollisionsPerEntity) { break; } // Spigot
Entity entity = (Entity) list.get(i);
// TODO better check now?
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
if (entity.ae()) {
+ entity.numCollisions++; // Spigot
+ numCollisions++; // Spigot
this.s(entity);
}
+ entity.numCollisions++; // Spigot
+ numCollisions++; // Spigot
this.s(entity);
}
+ numCollisions = 0; // Spigot
}

View file

@ -4,17 +4,17 @@ Date: Thu, 6 Feb 2014 21:59:20 +0000
Subject: [PATCH] Fix dispensing bone meal not having the correct data value
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
@@ -0,0 +0,0 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
- CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
@@ -0,0 +0,0 @@ public class DispenserRegistry {
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
if (!BlockDispenser.eventFired) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
- CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); // Spigot
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
if (!BlockDispenser.eventFired) {
--

View file

@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem()));
+ boolean flag2 = itemstack == null || itemstack.getItem() != null && (!invalidItems.contains(Item.getId(itemstack.getItem())) || !org.spigotmc.SpigotConfig.filterCreativeItems); // Spigot
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
// CraftBukkit start - Call click event
if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.a()).getItem(), packetplayinsetcreativeslot.getItemStack()))) { // Insist on valid slot
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - Add "isDisconnected" method
- public final boolean isDisconnected() {
+ public boolean isDisconnected() {
return !this.player.joining && !NetworkManager.a(this.networkManager).config().isAutoRead();
+ public boolean isDisconnected() { // Spigot
return !this.player.joining && !this.networkManager.k.config().isAutoRead();
}
}
--

View file

@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Spigot end
public void s_() {
super.s_();
public void t_() {
super.t_();
- if (this.lifeTicks == 2) {
+ if (!isSilent && this.lifeTicks == 2) { // Spigot
// CraftBukkit start - Use relative location for far away sounds

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int k = MathHelper.floor(d2);
BlockPosition blockposition = new BlockPosition(i, j, k);
+ if ( !world.isLoaded( blockposition ) ) return null; // Spigot
TileEntity tileentity = world.getTileEntity(new BlockPosition(i, j, k));
Block block = world.getType(blockposition).getBlock();
if (tileentity instanceof IInventory) {
if (block.isTileEntity()) {
--

View file

@ -8,16 +8,16 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ import org.bukkit.event.weather.ThunderChangeEvent;
public abstract class World implements IBlockAccess {
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
private int a = 63;
protected boolean e;
- public final List entityList = Lists.newArrayList();
- public final List<Entity> entityList = Lists.newArrayList();
+ // Spigot start - guard entity list from removals
+ public List entityList = new java.util.ArrayList()
+ public final List<Entity> entityList = new java.util.ArrayList<Entity>()
+ {
+ @Override
+ public Object remove(int index)
+ public Entity remove(int index)
+ {
+ guard();
+ return super.remove( index );
@ -39,9 +39,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ };
+ // Spigot end
protected final List g = Lists.newArrayList();
public final List h = Lists.newArrayList();
public final List tileEntityList = Lists.newArrayList();
protected final List<Entity> g = Lists.newArrayList();
public final List<TileEntity> h = Lists.newArrayList();
public final List<TileEntity> tileEntityList = Lists.newArrayList();
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
private int tickPosition;

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java
@@ -0,0 +0,0 @@ public class EntityWitherSkull extends EntityFireball {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
if (!this.world.isClientSide) {
if (movingobjectposition.entity != null) {
+ // Spigot start
+ boolean didDamage = false;

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
public String getServerModName() {

View file

@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -0,0 +0,0 @@ public class NameReferencingFileConverter {
private static void a(MinecraftServer minecraftserver, Collection collection, ProfileLookupCallback profilelookupcallback) {
String[] astring = (String[]) Iterators.toArray(Iterators.filter(collection.iterator(), new PredicateEmptyList()), String.class);
}
}), String.class);
- if (minecraftserver.getOnlineMode()) {
+ if (minecraftserver.getOnlineMode() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
protected boolean aP() {
protected boolean aQ() {
+ server.getLogger().info( "**** Beginning UUID conversion, this may take A LONG time ****"); // Spigot, let the user know whats up!
boolean flag = false;

View file

@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
NetworkManager.f.debug("Disconnecting " + this.getSocketAddress(), throwable);
this.close(new ChatMessage("disconnect.genericReason", new Object[] { "Internal Exception: " + throwable}));
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
}
this.close(chatmessage);
+ if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot
}
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) {
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) throws Exception {
--

View file

@ -16,5 +16,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ gameprofile = a(this.f, s); // Spigot - use correct case for offline players
if (gameprofile != null) {
this.a(gameprofile);
usercacheentry = (UserCacheEntry) this.c.get(s1);
usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1);
--

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java
+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java
@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry {
@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry<GameProfile> {
}
private static GameProfile b(JsonObject jsonobject) {

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/GameProfileBanEntry.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/GameProfileBanEntry.java
+++ b/src/main/java/net/minecraft/server/GameProfileBanEntry.java
@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry {
@@ -0,0 +0,0 @@ public class GameProfileBanEntry extends ExpirableListEntry<GameProfile> {
}
public GameProfileBanEntry(GameProfile gameprofile, Date date, String s, Date date1, String s1) {

View file

@ -33,10 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return true;
} else {
return false;
}
}
-
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
@ -56,12 +52,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import com.mojang.authlib.Agent;
+import com.mojang.authlib.ProfileLookupCallback;
+// Spigot end
+
public class TileEntitySkull extends TileEntity {
private int a;
public int rotation;
private int rotation;
private GameProfile g = null;
+ // Spigot start
+ public static final Executor executor = Executors.newFixedThreadPool(3,
@ -77,8 +74,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public GameProfile load(String key) throws Exception
+ {
+ GameProfile[] profiles = new GameProfile[1];
+ GameProfileLookup gameProfileLookup = new GameProfileLookup(profiles);
+ final GameProfile[] profiles = new GameProfile[1];
+ ProfileLookupCallback gameProfileLookup = new ProfileLookupCallback() {
+
+ @Override
+ public void onProfileLookupSucceeded(GameProfile gp) {
+ profiles[0] = gp;
+ }
+
+ @Override
+ public void onProfileLookupFailed(GameProfile gp, Exception excptn) {
+ profiles[0] = gp;
+ }
+ };
+
+ MinecraftServer.getServer().getGameProfileRepository().findProfilesByNames(new String[] { key }, Agent.MINECRAFT, gameProfileLookup);
+
@ -95,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ if ( property == null )
+ {
+ profile = MinecraftServer.getServer().aB().fillProfileProperties( profile, true );
+ profile = MinecraftServer.getServer().aC().fillProfileProperties( profile, true );
+ }
+ }
+
@ -153,10 +161,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ callback.apply(profile);
} else {
- Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null);
-
+ Property property = (Property) Iterables.getFirst(profile.getProperties().get("textures"), (Object) null);
- if (property == null) {
- gameprofile1 = MinecraftServer.getServer().aB().fillProfileProperties(gameprofile1, true);
- }
- gameprofile1 = MinecraftServer.getServer().aC().fillProfileProperties(gameprofile1, true);
+ if (property != null) {
+ callback.apply(profile);
+ return;
}
-
- return gameprofile1;
+ executor.execute(new Runnable() {

View file

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ItemSkull extends Item {
return false;
} else {
if (!world.isStatic) {
if (!world.isClientSide) {
+ // Spigot Start
+ if ( !Blocks.SKULL.canPlace( world, blockposition ) )
+ {

View file

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Mon, 20 Jan 2014 20:42:28 +0000
Subject: [PATCH] Don't let trees replace any block.
diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldGenForestTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java
@@ -0,0 +0,0 @@ public class WorldGenForestTree extends WorldGenTreeAbstract {
int k2;
for (k2 = 0; k2 < j2; ++k2) {
- this.a(world, new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2), Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4);
+ // Spigot start
+ BlockPosition position = new BlockPosition(blockposition.getX() + l1, k1 - k2 - 1, blockposition.getZ() + i2);
+ Block bl = world.getType(position).getBlock();
+
+ if (bl.getMaterial() == Material.AIR || bl.getMaterial() == Material.LEAVES)
+ {
+ this.a(world, position, Blocks.LOG2, EnumLogVariant.DARK_OAK.a() - 4);
+ }
+ // Spigot end
}
int l2;
--

View file

@ -15,34 +15,34 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
public SocketAddress j;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
public SocketAddress l;
public java.util.UUID spoofedUUID;
public com.mojang.authlib.properties.Property[] spoofedProfile;
+ public boolean preparing = true;
// Spigot End
private PacketListener k;
private IChatBaseComponent l;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
private PacketListener m;
private IChatBaseComponent n;
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
super.channelActive(channelhandlercontext);
this.i = channelhandlercontext.channel();
this.j = this.i.remoteAddress();
this.k = channelhandlercontext.channel();
this.l = this.k.remoteAddress();
+ // Spigot Start
+ this.preparing = false;
+ // Spigot End
try {
this.a(EnumProtocol.HANDSHAKING);
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
}
public void close(IChatBaseComponent ichatbasecomponent) {
+ // Spigot Start
+ this.preparing = false;
+ // Spigot End
if (this.i.isOpen()) {
this.i.close(); // We can't wait as this may be called from an event loop.
this.l = ichatbasecomponent;
if (this.k.isOpen()) {
this.k.close(); // We can't wait as this may be called from an event loop.
this.n = ichatbasecomponent;
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ServerConnection.java

View file

@ -34,6 +34,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Spigot end
+
// CraftBukkit - Moved message to after join
// PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
// PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
--

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ } );
+ // Spigot end
} else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check
} else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
--

View file

@ -8,9 +8,9 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
if (this.m.d()) {
this.m.e();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
if (this.n.d()) {
this.n.e();
}
-
+ // Spigot start
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.c();
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.c(); // Spigot - skip saving if disabled
return usercacheentry == null ? null : usercacheentry.a();
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java

View file

@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u());
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
-
+ boolean throttled = false;
+ if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) {
+ throttled = true;
@ -28,14 +29,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ packets = 0;
+ }
+ // Spigot end
+
// CraftBukkit start
if (this.player.dead) return;
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
// CraftBukkit start
int itemstackAmount = itemstack.count;
-
-
+ // Spigot start - skip the event if throttled
+ if (!throttled) {
// Raytrace to look for 'rogue armswings'
@ -53,10 +55,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
}
if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) {
if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
- always = !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f());
+ always = throttled || !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f());
}
// CraftBukkit end
flag = true;
--

View file

@ -12,18 +12,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
arraylist = Lists.newArrayList();
}
+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
+ if ( watchableobject.b() instanceof ItemStack )
+ // Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
+ if ( datawatcher_watchableobject.b() instanceof ItemStack )
+ {
+ watchableobject = new WatchableObject(
+ watchableobject.c(),
+ watchableobject.a(),
+ ( (ItemStack) watchableobject.b() ).cloneItemStack()
+ datawatcher_watchableobject = new WatchableObject(
+ datawatcher_watchableobject.c(),
+ datawatcher_watchableobject.a(),
+ ( (ItemStack) datawatcher_watchableobject.b() ).cloneItemStack()
+ );
+ }
+ // Spigot end
+
arraylist.add(watchableobject);
arraylist.add(datawatcher_watchableobject);
}
}
@@ -0,0 +0,0 @@ public class DataWatcher {

View file

@ -9,12 +9,12 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
// Spigot end
public MinecraftServer(OptionSet options, Proxy proxy, File file1) {
+ io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable
this.d = proxy;
MinecraftServer.k = this;
this.e = proxy;
MinecraftServer.l = this;
// this.universe = file; // CraftBukkit
--

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/ne
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -0,0 +0,0 @@ public class JsonList {
@@ -0,0 +0,0 @@ public class JsonList<K, V extends JsonListEntry<K>> {
try {
bufferedreader = Files.newReader(this.c, Charsets.UTF_8);
collection = (Collection) this.b.fromJson(bufferedreader, JsonList.f);

View file

@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
DedicatedServer.LOGGER.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
this.o = new EULA(new File("eula.txt"));
- if (!this.o.a()) {
this.p = new EULA(new File("eula.txt"));
- if (!this.p.a()) {
+ // Spigot Start
+ boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
+ if ( eulaAgreed )
@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 (!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.o.b();
this.p.b();
return false;
--

View file

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal {
private PathfinderGoalAvoidTarget bm;
private PathfinderGoalTempt bn;
private PathfinderGoalAvoidTarget<EntityHuman> bo;
private PathfinderGoalTempt bp;
+ public boolean spawnBonus = true; // Spigot
public EntityOcelot(World world) {

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ tileentity.a(this); // Spigot - No null worlds
this.a.add(tileentity);
this.b.add(tileentity);
} else {
this.a(tileentity);
--

View file

@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -0,0 +0,0 @@ public class NBTCompressedStreamTools {
}
public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) {
try {
public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException {
+ // Spigot start
+ if ( datainput instanceof io.netty.buffer.ByteBufInputStream )
+ {

View file

@ -1,499 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Evan A. Haskell" <eah2119@gmail.com>
Date: Sat, 19 Apr 2014 16:58:26 -0400
Subject: [PATCH] Alternative Hopper Ticking
diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockHopper.java
+++ b/src/main/java/net/minecraft/server/BlockHopper.java
@@ -0,0 +0,0 @@ public class BlockHopper extends BlockContainer {
if (flag != ((Boolean) iblockdata.get(BlockHopper.ENABLED)).booleanValue()) {
world.setTypeAndData(blockposition, iblockdata.set(BlockHopper.ENABLED, Boolean.valueOf(flag)), 4);
+ // Spigot start - When this hopper becomes unpowered, make it active.
+ // Called when this block's power level changes. flag1 is the current
+ // isNotPowered from metadata. flag is the recalculated isNotPowered.
+ if (world.spigotConfig.altHopperTicking) {
+ // e returns the TileEntityHopper associated with this BlockHopper.
+ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition);
+ if (flag && hopper != null) {
+ hopper.makeTick();
+ }
+ }
+ // Spigot end
}
}
@@ -0,0 +0,0 @@ public class BlockHopper extends BlockContainer {
protected BlockStateList getStateList() {
return new BlockStateList(this, new IBlockState[] { BlockHopper.FACING, BlockHopper.ENABLED});
}
+
+ // Spigot start - Use random block updates to make hoppers active.
+ @Override
+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, java.util.Random random) {
+ if (world.spigotConfig.altHopperTicking) {
+ // e returns the TileEntityHopper associated with this BlockHopper.
+ TileEntityHopper hopper = (TileEntityHopper) world.getTileEntity(blockposition);
+ if (hopper != null) {
+ hopper.makeTick();
+ }
+ }
+ }
+ // Spigot end
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk {
tileentity.D();
this.tileEntities.put(blockposition, tileentity);
+ // Spigot start - The tile entity has a world, now hoppers can be born ticking.
+ if (this.world.spigotConfig.altHopperTicking) {
+ this.world.triggerHoppersList.add(tileentity);
+ }
+ // Spigot end
// CraftBukkit start
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
if (this.onGround) {
this.motY *= -0.5D;
}
+ // Spigot start - Make the hopper(s) below this item active.
+ // Called each tick on each item entity.
+ if (this.world.spigotConfig.altHopperTicking) {
+ int xi = MathHelper.floor(this.getBoundingBox().a);
+ int yi = MathHelper.floor(this.getBoundingBox().b) - 1;
+ int zi = MathHelper.floor(this.getBoundingBox().c);
+ int xf = MathHelper.floor(this.getBoundingBox().d);
+ int yf = MathHelper.floor(this.getBoundingBox().e) - 1;
+ int zf = MathHelper.floor(this.getBoundingBox().f);
+ for (int a = xi; a <= xf; a++) {
+ for (int c = zi; c <= zf; c++) {
+ for (int b = yi; b <= yf; b++) {
+ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c));
+ if (tileEntity instanceof TileEntityHopper) {
+ ((TileEntityHopper) tileEntity).makeTick();
+ }
+ }
+ }
+ }
+ }
+ // Spigot end
/* Craftbukkit start - moved up
if (this.age != -32768) {
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
this.passenger = null;
}
+ // Spigot start - Make hoppers around this container minecart active.
+ // Called each tick on each minecart.
+ if (this.world.spigotConfig.altHopperTicking && this instanceof EntityMinecartContainer) {
+ int xi = MathHelper.floor(this.getBoundingBox().a) - 1;
+ int yi = MathHelper.floor(this.getBoundingBox().b) - 1;
+ int zi = MathHelper.floor(this.getBoundingBox().c) - 1;
+ int xf = MathHelper.floor(this.getBoundingBox().d) + 1;
+ int yf = MathHelper.floor(this.getBoundingBox().e) + 1;
+ int zf = MathHelper.floor(this.getBoundingBox().f) + 1;
+ for (int a = xi; a <= xf; a++) {
+ for (int b = yi; b <= yf; b++) {
+ for (int c = zi; c <= zf; c++) {
+ TileEntity tileEntity = this.world.getTileEntity(new BlockPosition(a, b, c));
+ if (tileEntity instanceof TileEntityHopper) {
+ ((TileEntityHopper) tileEntity).makeTick();
+ }
+ }
+ }
+ }
+ }
+ // Spigot end
+
this.W();
}
}
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -0,0 +0,0 @@ public class EntityOcelot extends EntityTameableAnimal {
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
+ // Spigot start - When this ocelot begins standing, chests below this ocelot must be
+ // updated as if its contents have changed. We update chests if this ocelot is sitting
+ // knowing that it may be dead, gone, or standing after this method returns.
+ // Called each tick on each ocelot.
+ @Override
+ public void s_() {
+ if (this.world.spigotConfig.altHopperTicking && this.isSitting()) {
+ int xi = MathHelper.floor(this.getBoundingBox().a);
+ int yi = MathHelper.floor(this.getBoundingBox().b) - 1;
+ int zi = MathHelper.floor(this.getBoundingBox().c);
+ int xf = MathHelper.floor(this.getBoundingBox().d);
+ int yf = MathHelper.floor(this.getBoundingBox().e) - 1;
+ int zf = MathHelper.floor(this.getBoundingBox().f);
+ for (int a = xi; a <= xf; a++) {
+ for (int c = zi; c <= zf; c++) {
+ for (int b = yi; b <= yf; b++) {
+ this.world.updateChestAndHoppers(new BlockPosition(a, b, c));
+ }
+ }
+ }
+ }
+ super.s_();
+ }
+ // Spigot end
+
public void E() {
if (this.getControllerMove().a()) {
double d0 = this.getControllerMove().b();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -0,0 +0,0 @@ public abstract class TileEntity {
private int h;
protected Block e;
+ // Spigot start
+ // Helper method for scheduleTicks. If the hopper at x0, y0, z0 is pointed
+ // at this tile entity, then make it active.
+ private void scheduleTick(BlockPosition blockposition) {
+ TileEntity tileEntity = this.world.getTileEntity(blockposition);
+ if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) {
+ // i is the metadeta assoiated with the direction the hopper faces.
+ EnumDirection dir = BlockHopper.b(tileEntity.u());
+
+ // Facing class provides arrays for direction offset.
+ if (tileEntity.position.shift(dir).equals(position)) {
+ ((TileEntityHopper) tileEntity).makeTick();
+ }
+ }
+ }
+
+ // Called from update when the contents have changed, so hoppers need updates.
+ // Check all 6 faces.
+ public void scheduleTicks() {
+ if (this.world != null && this.world.spigotConfig.altHopperTicking) {
+ // Check the top
+ this.scheduleTick(position.up());
+ // Check the sides
+ for (int i = 2; i < 6; i++) {
+ this.scheduleTick(position.shift(EnumDirection.fromType1(i)));
+ }
+ // Check the bottom.
+ TileEntity tileEntity = this.world.getTileEntity(position.down());
+ if (tileEntity instanceof TileEntityHopper && tileEntity.world != null) {
+ ((TileEntityHopper) tileEntity).makeTick();
+ }
+ }
+ }
+ // Spigot end
+
public TileEntity() {
this.position = BlockPosition.ZERO;
this.h = -1;
@@ -0,0 +0,0 @@ public abstract class TileEntity {
if (this.w() != Blocks.AIR) {
this.world.updateAdjacentComparators(this.position, this.w());
}
+ // Spigot start - Called when the contents have changed, so hoppers around this
+ // tile need updating.
+ this.scheduleTicks();
+ // Spigot end
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
private ItemStack[] items = new ItemStack[5];
private String f;
private int g = -1;
+
+ // Spigot start
+ private long nextTick = -1; // Next tick this hopper will be ticked.
+ private long lastTick = -1; // Last tick this hopper was polled.
+
+ // If this hopper is not cooling down, assaign a visible tick for next time.
+ public void makeTick() {
+ if (!this.n()) {
+ this.d(0);
+ }
+ }
+
+ // Contents changed, so make this hopper active.
+ public void scheduleHopperTick() {
+ if (this.world != null && this.world.spigotConfig.altHopperTicking) {
+ this.makeTick();
+ }
+ }
+
+ // Called after this hopper is assaigned a world or when altHopperTicking is turned
+ // on from reload.
+ public void convertToScheduling() {
+ // j is the cooldown in ticks
+ this.d(this.g);
+ }
+
+ // Called when alt hopper ticking is turned off from the reload command
+ public void convertToPolling() {
+ long cooldownDiff;
+ if (this.lastTick == this.world.getTime()) {
+ cooldownDiff = this.nextTick - this.world.getTime();
+ } else {
+ cooldownDiff = this.nextTick - this.world.getTime() + 1;
+ }
+ this.d((int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE)));
+ }
+ // Spigot end
// CraftBukkit start - add fields and methods
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
}
nbttagcompound.set("Items", nbttaglist);
- nbttagcompound.setInt("TransferCooldown", this.g);
+ // Spigot start - Need to write the correct cooldown to disk. We convert from long to int on saving.
+ if (this.world != null && this.world.spigotConfig.altHopperTicking) {
+ long cooldownDiff;
+ if (this.lastTick == this.world.getTime()) {
+ cooldownDiff = this.nextTick - this.world.getTime();
+ } else {
+ cooldownDiff = this.nextTick - this.world.getTime() + 1;
+ }
+ nbttagcompound.setInt("TransferCooldown", (int) Math.max(0, Math.min(cooldownDiff, Integer.MAX_VALUE)));
+ } else {
+ // g is the cooldown in ticks.
+ nbttagcompound.setInt("TransferCooldown", this.g);
+ }
+ // Spigot end
if (this.hasCustomName()) {
nbttagcompound.setString("CustomName", this.f);
}
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
public void update() {
super.update();
+ // Spigot start - The contents have changed, so make this hopper active.
+ this.scheduleHopperTick();
+ // Spigot end
}
public int getSize() {
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
public void c() {
if (this.world != null && !this.world.isStatic) {
- --this.g;
- if (!this.n()) {
- this.d(0);
- this.m();
+ // Spigot start
+ if (this.world.spigotConfig.altHopperTicking) {
+ this.lastTick = this.world.getTime();
+ if (this.nextTick == this.world.getTime()) {
+ // Method that does the pushing and pulling.
+ this.m();
+ }
+ } else {
+ --this.g;
+ if (!this.n()) {
+ this.d(0);
+ this.m();
+ }
}
}
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
}
// Spigot start
- if ( !this.n() )
+ if ( !world.spigotConfig.altHopperTicking && !this.n() )
{
this.d( world.spigotConfig.hopperCheck );
}
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU
}
public void d(int i) {
- this.g = i;
+ // Spigot start - i is the delay for which this hopper will be ticked next.
+ // i of 1 or below implies a tick next tick.
+ if (this.world != null && this.world.spigotConfig.altHopperTicking) {
+ if (i <= 0) {
+ i = 1;
+ }
+ if (this.lastTick == this.world.getTime()) {
+ this.nextTick = this.world.getTime() + i;
+ } else {
+ this.nextTick = this.world.getTime() + i - 1;
+ }
+ } else {
+ this.g = i;
+ }
+ // Spigot end
}
public boolean n() {
- return this.g > 0;
+ // Spigot start - Return whether this hopper is cooling down.
+ if (this.world != null && this.world.spigotConfig.altHopperTicking) {
+ if (this.lastTick == this.world.getTime()) {
+ return this.nextTick > this.world.getTime();
+ } else {
+ return this.nextTick >= this.world.getTime();
+ }
+ } else {
+ return this.g > 0;
+ }
+ // Spigot end
}
public boolean o() {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
private final byte chunkTickRadius;
public static boolean haveWeSilencedAPhysicsCrash;
public static String blockLocation;
+ public List<TileEntity> triggerHoppersList = new ArrayList<TileEntity>(); // Spigot, When altHopperTicking, tile entities being added go through here.
public static long chunkToKey(int x, int z)
{
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
{
return (int) ( ( ( k >> 32 ) & 0xFFFF0000L ) | ( ( k >> 16 ) & 0x0000FFFF ) );
}
+
+ // Spigot Start - Hoppers need to be born ticking.
+ private void initializeHoppers() {
+ if (this.spigotConfig.altHopperTicking) {
+ for (TileEntity o : this.triggerHoppersList) {
+ o.scheduleTicks();
+ if (o instanceof TileEntityHopper) {
+ ((TileEntityHopper) o).convertToScheduling();
+ ((TileEntityHopper) o).scheduleHopperTick();
+ }
+ }
+ }
+ triggerHoppersList.clear();
+ }
+
+ // Helper method for altHopperTicking. Updates chests at the specified location,
+ // accounting for double chests. Updating the chest will update adjacent hoppers.
+ public void updateChestAndHoppers(BlockPosition blockposition) {
+ Block block = this.getType(blockposition).getBlock();
+ if (block instanceof BlockChest) {
+ TileEntity tile = this.getTileEntity(blockposition);
+ if (tile instanceof TileEntityChest) {
+ tile.scheduleTicks();
+ }
+ for (int i = 2; i < 6; i++) {
+ // Facing class provides arrays for direction offset.
+ BlockPosition pos = blockposition.shift(EnumDirection.fromType1(i));
+ if (this.getType(pos) == block) {
+ tile = this.getTileEntity(pos);
+ if (tile instanceof TileEntityChest) {
+ tile.scheduleTicks();
+ }
+ break;
+ }
+ }
+ }
+ }
// Spigot end
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
// Modularize client and physic updates
notifyAndUpdatePhysics(blockposition, chunk, block1, block, i);
}
+ // Spigot start - If this block is changing to that which a chest beneath it
+ // becomes able to be opened, then the chest must be updated.
+ // block1 is the old block. block is the new block. r returns true if the block type
+ // prevents access to a chest.
+ if (this.spigotConfig.altHopperTicking && block1 != null && block1.isOccluding()&& !block.isOccluding()) {
+ this.updateChestAndHoppers(blockposition.down());
+ }
+ // Spigot end
// CraftBukkit end
return true;
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit end
+ this.initializeHoppers(); // Spigot - Initializes hoppers which have been added recently.
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + otherTrackingRange );
}
+ public boolean altHopperTicking;
public int hopperTransfer;
public int hopperCheck;
public int hopperAmount;
private void hoppers()
{
+ // Alternate ticking method. Uses inventory changes, redstone updates etc.
+ // to update hoppers. Hopper-check is disabled when this is true.
+ boolean prev = altHopperTicking;
+ altHopperTicking = getBoolean( "hopper-alt-ticking", false );
+ // Necessary for the reload command
+ if (prev != altHopperTicking) {
+ net.minecraft.server.World world = (net.minecraft.server.World) Bukkit.getWorld(this.worldName);
+ if (world != null) {
+ if (altHopperTicking) {
+ for (Object o : world.tileEntityList) {
+ if (o instanceof net.minecraft.server.TileEntityHopper) {
+ ((net.minecraft.server.TileEntityHopper) o).convertToScheduling();
+ }
+ }
+ } else {
+ for (Object o : world.tileEntityList) {
+ if (o instanceof net.minecraft.server.TileEntityHopper) {
+ ((net.minecraft.server.TileEntityHopper) o).convertToPolling();
+ }
+ }
+ }
+ }
+ }
// Set the tick delay between hopper item movements
hopperTransfer = getInt( "ticks-per.hopper-transfer", 8 );
// Set the tick delay between checking for items after the associated
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
// hopper sorting machines from becoming out of sync.
hopperCheck = getInt( "ticks-per.hopper-check", hopperTransfer );
hopperAmount = getInt( "hopper-amount", 1 );
+ log( "Alternative Hopper Ticking: " + altHopperTicking );
log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount );
}
--

View file

@ -11,10 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PersistentCollection {
private IDataManager b;
protected Map a = Maps.newHashMap();
- private List c = Lists.newArrayList();
+ public List c = Lists.newArrayList(); // Spigot
private Map d = Maps.newHashMap();
protected Map<String, PersistentBase> a = Maps.newHashMap();
- private List<PersistentBase> c = Lists.newArrayList();
+ public List<PersistentBase> c = Lists.newArrayList(); // Spigot
private Map<String, Short> d = Maps.newHashMap();
public PersistentCollection(IDataManager idatamanager) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ {
+ WorldMap map = (WorldMap) o;
+ map.i.remove( entity );
+ for ( Iterator<WorldMapHumanTracker> iter = (Iterator<WorldMapHumanTracker>) map.g.iterator(); iter.hasNext(); )
+ for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.g.iterator(); iter.hasNext(); )
+ {
+ if ( iter.next().trackee == entity )
+ {
@ -52,10 +52,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
public byte scale;
public byte[] colors = new byte[16384];
public List g = Lists.newArrayList();
- private Map i = Maps.newHashMap();
+ public Map i = Maps.newHashMap(); // Spigot
public Map decorations = Maps.newLinkedHashMap();
public List<WorldMap.WorldMapHumanTracker> g = Lists.newArrayList();
- private Map<EntityHuman, WorldMap.WorldMapHumanTracker> i = Maps.newHashMap();
+ public Map<EntityHuman, WorldMap.WorldMapHumanTracker> i = Maps.newHashMap(); // Spigot
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
// CraftBukkit start
--

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity.extinguish();
}
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
super.bE();
super.bF();
this.b(StatisticList.u);
if (this.isSprinting()) {
- this.applyExhaustion(0.8F);

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
}
public void s_() {
public void t_() {
+ if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot
this.lastX = this.locX;
this.lastY = this.locY;

View file

@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
- if (this.c++ == 100 && !this.world.isStatic) {
+ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isStatic) { // Spigot - 100 -> this.world.spigotConfig.hangingTickFrequency
- if (this.c++ == 100 && !this.world.isClientSide) {
+ if (this.c++ == this.world.spigotConfig.hangingTickFrequency && !this.world.isClientSide) {
this.c = 0;
if (!this.dead && !this.survives()) {
// CraftBukkit start - fire break events

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
@@ -0,0 +0,0 @@ public class EnchantmentManager {
if (entity instanceof EntityHuman) {
a((EnchantmentModifier) EnchantmentManager.d, entityliving.bz());
a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.d, entityliving.bA());
}
-
+ // Spigot start
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static void b(EntityLiving entityliving, Entity entity) {
@@ -0,0 +0,0 @@ public class EnchantmentManager {
if (entityliving instanceof EntityHuman) {
a((EnchantmentModifier) EnchantmentManager.e, entityliving.bz());
a((EnchantmentManager.EnchantmentModifier) EnchantmentManager.e, entityliving.bA());
}
-
+ // Spigot start
@ -45,13 +45,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.UUID;
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
protected NavigationAbstract navigation;
public PathfinderGoalSelector goalSelector; // PAIL protected final to public
public PathfinderGoalSelector targetSelector; // PAIL protected final to public
public PathfinderGoalSelector goalSelector; // CraftBukkit - public
public PathfinderGoalSelector targetSelector; // CraftBukkit - public
- private EntityLiving goalTarget;
+ private WeakReference<EntityLiving> goalTarget = new WeakReference<EntityLiving>(null);
private EntitySenses bi;
private EntitySenses bk;
private ItemStack[] equipment = new ItemStack[5];
public float[] dropChances = new float[5];
public float[] dropChances = new float[5]; // CraftBukkit - public
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
}
@ -74,14 +74,14 @@ diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler {
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
public void close(IChatBaseComponent ichatbasecomponent) {
// Spigot Start
this.preparing = false;
+ this.h.clear();
+ this.i.clear();
// Spigot End
if (this.i.isOpen()) {
this.i.close(); // We can't wait as this may be called from an event loop.
if (this.k.isOpen()) {
this.k.close(); // We can't wait as this may be called from an event loop.
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java b/src/main/java/net/minecraft/server/PathfinderGoalSwell.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSwell.java

Some files were not shown because too many files have changed in this diff Show more