diff --git a/paper-server/pom.xml b/paper-server/pom.xml index fbb3478af8..e061ce6a64 100644 --- a/paper-server/pom.xml +++ b/paper-server/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.2.5-R5.1-SNAPSHOT + 1.3.1-R0.1-SNAPSHOT CraftBukkit http://www.bukkit.org @@ -51,14 +51,14 @@ org.bukkit bukkit - 1.2.5-R5.1-SNAPSHOT + 1.3.1-R0.1-SNAPSHOT jar compile org.bukkit minecraft-server - 1.2.5 + 1.3.1 jar compile diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java b/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java index 4303c60b38..cfd9715fcb 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java @@ -8,6 +8,7 @@ import java.util.zip.Deflater; import net.minecraft.server.EntityPlayer; import net.minecraft.server.Packet; import net.minecraft.server.Packet51MapChunk; +import net.minecraft.server.Packet56MapChunkBulk; public final class ChunkCompressionThread implements Runnable { @@ -46,29 +47,56 @@ public final class ChunkCompressionThread implements Runnable { private void handleQueuedPacket(QueuedPacket queuedPacket) { addToPlayerQueueSize(queuedPacket.player, -1); - // Compress the packet if necessary. - if (queuedPacket.compress) { - handleMapChunk(queuedPacket); + + // Compress the packet if necessary + if (queuedPacket.compress == 1) { + handleMapChunk((Packet51MapChunk) queuedPacket.packet); + } else if (queuedPacket.compress == 2) { + handleMapChunkBulk((Packet56MapChunkBulk) queuedPacket.packet); } + sendToNetworkQueue(queuedPacket); } - private void handleMapChunk(QueuedPacket queuedPacket) { - Packet51MapChunk packet = (Packet51MapChunk) queuedPacket.packet; - - // If 'packet.g' is set then this packet has already been compressed. + private void handleMapChunkBulk(Packet56MapChunkBulk packet) { if (packet.buffer != null) { return; } - int dataSize = packet.rawData.length; + int dataSize = packet.buildBuffer.length; if (deflateBuffer.length < dataSize + 100) { deflateBuffer = new byte[dataSize + 100]; } deflater.reset(); deflater.setLevel(dataSize < REDUCED_DEFLATE_THRESHOLD ? DEFLATE_LEVEL_PARTS : DEFLATE_LEVEL_CHUNKS); - deflater.setInput(packet.rawData); + deflater.setInput(packet.buildBuffer); + deflater.finish(); + int size = deflater.deflate(deflateBuffer); + if (size == 0) { + size = deflater.deflate(deflateBuffer); + } + + // copy compressed data to packet + packet.buffer = new byte[size]; + packet.size = size; + System.arraycopy(deflateBuffer, 0, packet.buffer, 0, size); + } + + private void handleMapChunk(Packet51MapChunk packet) { + // If 'packet.buffer' is set then this packet has already been compressed. + if (packet.buffer != null) { + return; + } + + int dataSize = packet.inflatedBuffer.length; + if (deflateBuffer.length < dataSize + 100) { + deflateBuffer = new byte[dataSize + 100]; + } + + deflater.reset(); + deflater.setLevel(dataSize < REDUCED_DEFLATE_THRESHOLD ? DEFLATE_LEVEL_PARTS : DEFLATE_LEVEL_CHUNKS); + deflater.setInput(packet.inflatedBuffer); deflater.finish(); int size = deflater.deflate(deflateBuffer); if (size == 0) { @@ -86,13 +114,15 @@ public final class ChunkCompressionThread implements Runnable { } public static void sendPacket(EntityPlayer player, Packet packet) { + int compressType = 0; + if (packet instanceof Packet51MapChunk) { - // MapChunk Packets need compressing. - instance.addQueuedPacket(new QueuedPacket(player, packet, true)); - } else { - // Other Packets don't. - instance.addQueuedPacket(new QueuedPacket(player, packet, false)); + compressType = 1; + } else if (packet instanceof Packet56MapChunkBulk) { + compressType = 2; } + + instance.addQueuedPacket(new QueuedPacket(player, packet, compressType)); } private void addToPlayerQueueSize(EntityPlayer player, int amount) { @@ -129,9 +159,9 @@ public final class ChunkCompressionThread implements Runnable { private static class QueuedPacket { final EntityPlayer player; final Packet packet; - final boolean compress; + final int compress; - QueuedPacket(EntityPlayer player, Packet packet, boolean compress) { + QueuedPacket(EntityPlayer player, Packet packet, int compress) { this.player = player; this.packet = packet; this.compress = compress; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 61af6ddea9..4f9ac887ff 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -150,7 +150,7 @@ public class CraftChunk implements Chunk { public ChunkSnapshot getChunkSnapshot(boolean includeMaxBlockY, boolean includeBiome, boolean includeBiomeTempRain) { net.minecraft.server.Chunk chunk = getHandle(); - ChunkSection[] cs = chunk.h(); /* Get sections */ + ChunkSection[] cs = chunk.i(); /* Get sections */ short[][] sectionBlockIDs = new short[cs.length][]; byte[][] sectionBlockData = new byte[cs.length][]; byte[][] sectionSkyLights = new byte[cs.length][]; @@ -173,8 +173,8 @@ public class CraftChunk implements Chunk { blockids[j] = (short) (baseids[j] & 0xFF); } - if (cs[i].h() != null) { /* If we've got extended IDs */ - byte[] extids = cs[i].h().a; + if (cs[i].i() != null) { /* If we've got extended IDs */ + byte[] extids = cs[i].i().a; for (int j = 0; j < 2048; j++) { short b = (short) (extids[j] & 0xFF); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index 349d8d2a92..4a0d8dcb4d 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -4,9 +4,12 @@ import java.io.File; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; + +import net.minecraft.server.BanEntry; import net.minecraft.server.EntityPlayer; import net.minecraft.server.NBTTagCompound; import net.minecraft.server.WorldNBTStorage; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.OfflinePlayer; @@ -56,15 +59,18 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa } public boolean isBanned() { - return server.getHandle().banByName.contains(name.toLowerCase()); + return server.getHandle().getNameBans().isBanned(name.toLowerCase()); } public void setBanned(boolean value) { if (value) { - server.getHandle().addUserBan(name.toLowerCase()); + BanEntry entry = new BanEntry(name.toLowerCase()); + server.getHandle().getNameBans().add(entry); } else { - server.getHandle().removeUserBan(name.toLowerCase()); + server.getHandle().getNameBans().remove(name.toLowerCase()); } + + server.getHandle().getNameBans().save(); } public boolean isWhitelisted() { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 43f197de56..7b755418a0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -17,14 +17,18 @@ import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; +import net.minecraft.server.BanEntry; import net.minecraft.server.ChunkCoordinates; -import net.minecraft.server.ConvertProgressUpdater; import net.minecraft.server.Convertable; +import net.minecraft.server.ConvertProgressUpdater; import net.minecraft.server.CraftingManager; +import net.minecraft.server.DedicatedServer; import net.minecraft.server.Enchantment; import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityTracker; -import net.minecraft.server.FurnaceRecipes; +import net.minecraft.server.EnumGamemode; +import net.minecraft.server.ExceptionWorldConflict; +import net.minecraft.server.RecipesFurnace; import net.minecraft.server.IProgressUpdate; import net.minecraft.server.IWorldAccess; import net.minecraft.server.Item; @@ -33,6 +37,7 @@ import net.minecraft.server.MobEffectList; import net.minecraft.server.PropertyManager; import net.minecraft.server.ServerCommand; import net.minecraft.server.ServerConfigurationManager; +import net.minecraft.server.ServerConfigurationManagerAbstract; import net.minecraft.server.ServerNBTManager; import net.minecraft.server.WorldLoaderServer; import net.minecraft.server.WorldManager; @@ -128,7 +133,7 @@ public final class CraftServer implements Server { private final String serverVersion; private final String bukkitVersion = Versioning.getBukkitVersion(); private final ServicesManager servicesManager = new SimpleServicesManager(); - private final BukkitScheduler scheduler = new CraftScheduler(); + private final CraftScheduler scheduler = new CraftScheduler(); private final SimpleCommandMap commandMap = new SimpleCommandMap(this); private final SimpleHelpMap helpMap = new SimpleHelpMap(this); private final StandardMessenger messenger = new StandardMessenger(); @@ -146,14 +151,15 @@ public final class CraftServer implements Server { private int monsterSpawn = -1; private int animalSpawn = -1; private int waterAnimalSpawn = -1; + private File container; static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); } - public CraftServer(MinecraftServer console, ServerConfigurationManager server) { + public CraftServer(MinecraftServer console, ServerConfigurationManagerAbstract server) { this.console = console; - this.server = server; + this.server = (ServerConfigurationManager) server; this.serverVersion = CraftServer.class.getPackage().getImplementationVersion(); Bukkit.setServer(this); @@ -355,7 +361,7 @@ public final class CraftServer implements Server { } public int getMaxPlayers() { - return server.maxPlayers; + return server.getMaxPlayers(); } // NOTE: These are dependent on the corrisponding call in MinecraftServer @@ -410,15 +416,15 @@ public final class CraftServer implements Server { // NOTE: Temporary calls through to server.properies until its replaced private String getConfigString(String variable, String defaultValue) { - return this.console.propertyManager.getString(variable, defaultValue); + return this.console.getPropertyManager().getString(variable, defaultValue); } private int getConfigInt(String variable, int defaultValue) { - return this.console.propertyManager.getInt(variable, defaultValue); + return this.console.getPropertyManager().getInt(variable, defaultValue); } private boolean getConfigBoolean(String variable, boolean defaultValue) { - return this.console.propertyManager.getBoolean(variable, defaultValue); + return this.console.getPropertyManager().getBoolean(variable, defaultValue); } // End Temporary calls @@ -451,7 +457,7 @@ public final class CraftServer implements Server { return pluginManager; } - public BukkitScheduler getScheduler() { + public CraftScheduler getScheduler() { return scheduler; } @@ -467,7 +473,7 @@ public final class CraftServer implements Server { return server; } - // NOTE: Should only be called from MinecraftServer.b() + // NOTE: Should only be called from DedicatedServer.ah() public boolean dispatchServerCommand(CommandSender sender, ServerCommand serverCommand) { if (sender instanceof Conversable) { Conversable conversable = (Conversable)sender; @@ -494,17 +500,17 @@ public final class CraftServer implements Server { configuration = YamlConfiguration.loadConfiguration(getConfigFile()); PropertyManager config = new PropertyManager(console.options); - console.propertyManager = config; + ((DedicatedServer) console).propertyManager = config; - boolean animals = config.getBoolean("spawn-animals", console.spawnAnimals); + boolean animals = config.getBoolean("spawn-animals", console.getSpawnAnimals()); boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).difficulty > 0); int difficulty = config.getInt("difficulty", console.worlds.get(0).difficulty); - console.onlineMode = config.getBoolean("online-mode", console.onlineMode); - console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals); - console.pvpMode = config.getBoolean("pvp", console.pvpMode); - console.allowFlight = config.getBoolean("allow-flight", console.allowFlight); - console.motd = config.getString("motd", console.motd); + console.setOnlineMode(config.getBoolean("online-mode", console.getOnlineMode())); + console.setSpawnAnimals(config.getBoolean("spawn-animals", console.getSpawnAnimals())); + console.setPvP(config.getBoolean("pvp", console.getPvP())); + console.setAllowFlight(config.getBoolean("allow-flight", console.getAllowFlight())); + console.setMotd(config.getString("motd", console.getMotd())); monsterSpawn = configuration.getInt("spawn-limits.monsters"); animalSpawn = configuration.getInt("spawn-limits.animals"); waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); @@ -669,7 +675,7 @@ public final class CraftServer implements Server { } while(used); boolean hardcore = false; - WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), generateStructures, hardcore, type), creator.environment(), generator); + WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(getDefaultGameMode().getValue()), generateStructures, hardcore, type), console.methodProfiler, creator.environment(), generator); if (!(worlds.containsKey(name.toLowerCase()))) { return null; @@ -677,7 +683,7 @@ public final class CraftServer implements Server { internal.worldMaps = console.worlds.get(0).worldMaps; - internal.tracker = new EntityTracker(console, internal); // CraftBukkit + internal.tracker = new EntityTracker(internal); // CraftBukkit internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal)); internal.difficulty = 1; internal.setSpawnFlags(true, true); @@ -753,10 +759,14 @@ public final class CraftServer implements Server { } if (save) { - handle.save(true, (IProgressUpdate) null); - handle.saveLevel(); - WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); - getPluginManager().callEvent(event); + try { + handle.save(true, (IProgressUpdate) null); + handle.saveLevel(); + WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); + getPluginManager().callEvent(event); + } catch (ExceptionWorldConflict ex) { + getLogger().log(Level.SEVERE, null, ex); + } } worlds.remove(world.getName().toLowerCase()); @@ -870,13 +880,13 @@ public final class CraftServer implements Server { } public void clearRecipes() { - CraftingManager.getInstance().recipies.clear(); - FurnaceRecipes.getInstance().recipies.clear(); + CraftingManager.getInstance().recipes.clear(); + RecipesFurnace.getInstance().recipes.clear(); } public void resetRecipes() { - CraftingManager.getInstance().recipies = new CraftingManager().recipies; - FurnaceRecipes.getInstance().recipies = new FurnaceRecipes().recipies; + CraftingManager.getInstance().recipes = new CraftingManager().recipes; + RecipesFurnace.getInstance().recipes = new RecipesFurnace().recipes; } public Map getCommandAliases() { @@ -910,11 +920,11 @@ public final class CraftServer implements Server { } public boolean getOnlineMode() { - return this.console.onlineMode; + return console.getOnlineMode(); } public boolean getAllowFlight() { - return this.console.allowFlight; + return console.getAllowFlight(); } public boolean useExactLoginLocation() { @@ -1004,21 +1014,24 @@ public final class CraftServer implements Server { @SuppressWarnings("unchecked") public Set getIPBans() { - return new HashSet(server.banByIP); + return server.getIPBans().getEntries().keySet(); } public void banIP(String address) { - server.addIpBan(address); + BanEntry entry = new BanEntry(address); + server.getIPBans().add(entry); + server.getIPBans().save(); } public void unbanIP(String address) { - server.removeIpBan(address); + server.getIPBans().remove(address); + server.getIPBans().save(); } public Set getBannedPlayers() { Set result = new HashSet(); - for (Object name : server.banByName) { + for (Object name : server.getNameBans().getEntries().keySet()) { result.add(getOfflinePlayer((String) name)); } @@ -1027,7 +1040,7 @@ public final class CraftServer implements Server { public void setWhitelist(boolean value) { server.hasWhitelist = value; - console.propertyManager.setBoolean("white-list", value); + console.getPropertyManager().a("white-list", value); } public Set getWhitelistedPlayers() { @@ -1046,7 +1059,7 @@ public final class CraftServer implements Server { public Set getOperators() { Set result = new HashSet(); - for (Object name : server.operators) { + for (Object name : server.getOPs()) { result.add(getOfflinePlayer((String) name)); } @@ -1058,7 +1071,7 @@ public final class CraftServer implements Server { } public GameMode getDefaultGameMode() { - return GameMode.getByValue(console.worlds.get(0).worldData.getGameType()); + return GameMode.getByValue(console.worlds.get(0).getWorldData().getGameType().a()); } public void setDefaultGameMode(GameMode mode) { @@ -1067,7 +1080,7 @@ public final class CraftServer implements Server { } for (World world : getWorlds()) { - ((CraftWorld) world).getHandle().worldData.setGameType(mode.getValue()); + ((CraftWorld) world).getHandle().worldData.setGameType(EnumGamemode.a(mode.getValue())); } } @@ -1109,7 +1122,15 @@ public final class CraftServer implements Server { } public File getWorldContainer() { - return new File(configuration.getString("settings.world-container", ".")); + if (this.getServer().universe != null) { + return this.getServer().universe; + } + + if (container == null) { + container = new File(configuration.getString("settings.world-container", ".")); + } + + return container; } public OfflinePlayer[] getOfflinePlayers() { @@ -1197,6 +1218,6 @@ public final class CraftServer implements Server { } public String getMotd() { - return console.motd; + return console.getMotd(); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index c153911df7..c68767f58e 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -257,7 +257,6 @@ public class CraftWorld implements World { world.chunkProviderServer.chunks.put(x, z, chunk); world.chunkProviderServer.chunkList.add(chunk); - chunk.loadNOP(); chunk.addEntities(); if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) { @@ -338,13 +337,13 @@ public class CraftWorld implements World { } public LightningStrike strikeLightning(Location loc) { - EntityWeatherLighting lightning = new EntityWeatherLighting(world, loc.getX(), loc.getY(), loc.getZ()); + EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ()); world.strikeLightning(lightning); return new CraftLightningStrike(server, lightning); } public LightningStrike strikeLightningEffect(Location loc) { - EntityWeatherLighting lightning = new EntityWeatherLighting(world, loc.getX(), loc.getY(), loc.getZ(), true); + EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true); world.strikeLightning(lightning); return new CraftLightningStrike(server, lightning); } @@ -400,7 +399,7 @@ public class CraftWorld implements World { } public String getName() { - return world.worldData.name; + return world.worldData.getName(); } @Deprecated @@ -409,7 +408,7 @@ public class CraftWorld implements World { } public UUID getUID() { - return world.getUUID(); + return world.getDataManager().getUUID(); } @Override @@ -514,18 +513,18 @@ public class CraftWorld implements World { net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(x, z); if (chunk != null) { - byte[] biomevals = chunk.l(); + byte[] biomevals = chunk.m(); biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id; } } } public double getTemperature(int x, int z) { - return this.world.getBiome(x, z).F; + return this.world.getBiome(x, z).temperature; } public double getHumidity(int x, int z) { - return this.world.getBiome(x, z).G; + return this.world.getBiome(x, z).humidity; } public List getEntities() { @@ -636,12 +635,16 @@ public class CraftWorld implements World { } public void save() { - boolean oldSave = world.savingDisabled; + try { + boolean oldSave = world.savingDisabled; - world.savingDisabled = false; - world.save(true, null); + world.savingDisabled = false; + world.save(true, null); - world.savingDisabled = oldSave; + world.savingDisabled = oldSave; + } catch (ExceptionWorldConflict ex) { + ex.printStackTrace(); + } } public boolean isAutoSave() { @@ -806,8 +809,6 @@ public class CraftWorld implements World { entity = new EntitySnowball(world, x, y, z); } else if (Egg.class.isAssignableFrom(clazz)) { entity = new EntityEgg(world, x, y, z); - } else if (EnderPearl.class.isAssignableFrom(clazz)) { - entity = new EntityEnderPearl(world, x, y, z); } else if (Arrow.class.isAssignableFrom(clazz)) { entity = new EntityArrow(world); entity.setPositionRotation(x, y, z, 0, 0); @@ -946,7 +947,7 @@ public class CraftWorld implements World { entity = new EntityExperienceOrb(world, x, y, z, 0); } else if (Weather.class.isAssignableFrom(clazz)) { // not sure what this can do - entity = new EntityWeatherLighting(world, x, y, z); + entity = new EntityLightning(world, x, y, z); } else if (LightningStrike.class.isAssignableFrom(clazz)) { // what is this, I don't even } else if (Fish.class.isAssignableFrom(clazz)) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java index a30daaf29d..c6fa9ab86c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java @@ -38,10 +38,15 @@ public class Main { .ofType(String.class) .describedAs("Hostname or IP"); - acceptsAll(asList("w", "world", "level-name"), "World directory") + acceptsAll(asList("W", "world-dir", "universe", "world-container"), "World container") + .withRequiredArg() + .ofType(File.class) + .describedAs("Directory containing worlds"); + + acceptsAll(asList("w", "world", "level-name"), "World name") .withRequiredArg() .ofType(String.class) - .describedAs("World dir"); + .describedAs("World name"); acceptsAll(asList("p", "port", "server-port"), "Port to listen on") .withRequiredArg() @@ -100,6 +105,8 @@ public class Main { acceptsAll(asList("noconsole"), "Disables the console"); acceptsAll(asList("v", "version"), "Show the CraftBukkit Version"); + + acceptsAll(asList("demo"), "Demo mode"); } }; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java b/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java index 495c586a08..f1d2cd3ac9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java @@ -87,7 +87,7 @@ public class PortalTravelAgent implements TravelAgent { for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) { double d3 = (double) k1 + 0.5D - location.getZ(); - for (int l1 = 127; l1 >= 0; --l1) { + for (int l1 = world.L() - 1; l1 >= 0; --l1) { if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) { while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) { --l1; @@ -194,7 +194,7 @@ public class PortalTravelAgent implements TravelAgent { d2 = (double) j2 + 0.5D - location.getZ(); label271: - for (l2 = 127; l2 >= 0; --l2) { + for (l2 = world.L() - 1; l2 >= 0; --l2) { if (world.isEmpty(i2, l2, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { --l2; @@ -245,7 +245,7 @@ public class PortalTravelAgent implements TravelAgent { d2 = (double) j2 + 0.5D - location.getZ(); label219: - for (l2 = 127; l2 >= 0; --l2) { + for (l2 = world.L() - 1; l2 >= 0; --l2) { if (world.isEmpty(i2, l2, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { --l2; @@ -306,8 +306,8 @@ public class PortalTravelAgent implements TravelAgent { i1 = 70; } - if (i1 > 118) { - i1 = 118; + if (i1 > world.L() - 10) { + i1 = world.L() - 10; } j5 = i1; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java index 0851ad31ba..6beaa23b31 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java @@ -54,7 +54,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { synchronized (block) { if (block.getType() == Material.NOTE_BLOCK) { - world.getHandle().playNote(getX(), getY(), getZ(), instrument, note); + world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note); return true; } else { return false; @@ -67,7 +67,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { synchronized (block) { if (block.getType() == Material.NOTE_BLOCK) { - world.getHandle().playNote(getX(), getY(), getZ(), instrument.getType(), note.getId()); + world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId()); return true; } else { return false; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java b/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java index 0422cee9b8..c42d96876c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.command; import java.lang.reflect.Method; import net.minecraft.server.ICommandListener; +import net.minecraft.server.LocaleLanguage; import org.bukkit.command.CommandSender; @@ -33,4 +34,12 @@ public class ServerCommandListener implements ICommandListener { return this.prefix; } + + public String a(String s, Object... aobject) { + return LocaleLanguage.a().a(s, aobject); + } + + public boolean b(String s) { + return true; + } } \ No newline at end of file diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 9ab1e66909..6730436600 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -124,7 +124,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { else if (entity instanceof EntityFishingHook) { return new CraftFish(server, (EntityFishingHook) entity); } else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); } else if (entity instanceof EntityWeather) { - if (entity instanceof EntityWeatherLighting) { return new CraftLightningStrike(server, (EntityWeatherLighting) entity); } + if (entity instanceof EntityLightning) { return new CraftLightningStrike(server, (EntityLightning) entity); } else { return new CraftWeather(server, (EntityWeather) entity); } } else if (entity instanceof EntityMinecart) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 18da3121cd..67ad8a8347 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -301,7 +301,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } public boolean isBlocking() { - return getHandle().P(); + return getHandle().aY(); } public boolean setWindowProperty(InventoryView.Property prop, int value) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java index e8a8a6ba08..684a38a925 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java @@ -21,11 +21,11 @@ public class CraftIronGolem extends CraftGolem implements IronGolem { } public boolean isPlayerCreated() { - return getHandle().n_(); + return getHandle().q(); } public void setPlayerCreated(boolean playerCreated) { - getHandle().b(playerCreated); + getHandle().f(playerCreated); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index 6142b4703a..64e346d84c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -1,22 +1,22 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityWeatherLighting; +import net.minecraft.server.EntityLightning; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LightningStrike; public class CraftLightningStrike extends CraftEntity implements LightningStrike { - public CraftLightningStrike(final CraftServer server, final EntityWeatherLighting entity) { + public CraftLightningStrike(final CraftServer server, final EntityLightning entity) { super(server, entity); } public boolean isEffect() { - return ((EntityWeatherLighting) super.getHandle()).isEffect; + return ((EntityLightning) super.getHandle()).isEffect; } @Override - public EntityWeatherLighting getHandle() { - return (EntityWeatherLighting) entity; + public EntityLightning getHandle() { + return (EntityLightning) entity; } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index e500b230d5..8f9b565c40 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -244,7 +244,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void removePotionEffect(PotionEffectType type) { getHandle().effects.remove(type.getId()); - getHandle().e = true; // Should be called updateEffects + getHandle().updateEffects = true; if (getHandle() instanceof EntityPlayer) { if (((EntityPlayer) getHandle()).netServerHandler == null) return; ((EntityPlayer) getHandle()).netServerHandler.sendPacket(new Packet42RemoveMobEffect(getHandle().id, new MobEffect(type.getId(), 0, 0))); @@ -300,6 +300,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public boolean hasLineOfSight(Entity other) { - return getHandle().am().canSee(((CraftEntity) other).getHandle()); // am should be getEntitySenses + return getHandle().at().canSee(((CraftEntity) other).getHandle()); // am should be getEntitySenses } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index c2f38d0a06..dd82cb32ba 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -239,13 +239,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void playNote(Location loc, byte instrument, byte note) { if (getHandle().netServerHandler == null) return; - getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), instrument, note)); + int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument, note)); } public void playNote(Location loc, Instrument instrument, Note note) { if (getHandle().netServerHandler == null) return; - getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), instrument.getType(), note.getId())); + int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument.getType(), note.getId())); } public void playEffect(Location loc, Effect effect, int data) { @@ -368,7 +370,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setSneaking(boolean sneak) { - getHandle().setSneak(sneak); + getHandle().setSneaking(sneak); } public boolean isSneaking() { @@ -470,15 +472,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public boolean isBanned() { - return server.getHandle().banByName.contains(getName().toLowerCase()); + return server.getHandle().getNameBans().isBanned(getName().toLowerCase()); } public void setBanned(boolean value) { if (value) { - server.getHandle().addUserBan(getName().toLowerCase()); + BanEntry entry = new BanEntry(getName().toLowerCase()); + server.getHandle().getNameBans().add(entry); } else { - server.getHandle().removeUserBan(getName().toLowerCase()); + server.getHandle().getNameBans().remove(getName().toLowerCase()); } + + server.getHandle().getNameBans().save(); } public boolean isWhitelisted() { @@ -508,14 +513,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return; } - getHandle().itemInWorldManager.setGameMode(mode.getValue()); + getHandle().itemInWorldManager.setGameMode(EnumGamemode.a(mode.getValue())); getHandle().netServerHandler.sendPacket(new Packet70Bed(3, mode.getValue())); } } @Override public GameMode getGameMode() { - return GameMode.getByValue(getHandle().itemInWorldManager.getGameMode()); + return GameMode.getByValue(getHandle().itemInWorldManager.getGameMode().a()); } public void giveExp(int exp) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index f0652c6f96..23f330439a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -63,7 +63,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { if (xbtypes != null) { chunk = new Chunk(this.world, x, z); - ChunkSection[] csect = chunk.h(); + ChunkSection[] csect = chunk.i(); int scnt = Math.min(csect.length, xbtypes.length); // Loop through returned sections @@ -100,7 +100,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { if (btypes != null) { chunk = new Chunk(this.world, x, z); - ChunkSection[] csect = chunk.h(); + ChunkSection[] csect = chunk.i(); int scnt = Math.min(csect.length, btypes.length); for (int sec = 0; sec < scnt; sec++) { @@ -118,7 +118,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { chunk = new Chunk(this.world, x, z); // Create empty chunk - ChunkSection[] csect = chunk.h(); + ChunkSection[] csect = chunk.i(); scnt = Math.min(scnt, csect.length); // Loop through sections @@ -153,7 +153,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { } } // Set biome grid - byte[] biomeIndex = chunk.l(); + byte[] biomeIndex = chunk.m(); for (int i = 0; i < biomeIndex.length; i++) { biomeIndex[i] = (byte) (biomegrid.biome[i].id & 0xFF); } @@ -215,4 +215,12 @@ public class CustomChunkGenerator extends InternalChunkGenerator { public ChunkPosition findNearestMapFeature(World world, String type, int x, int y, int z) { return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, x, y, z) : null; } + + public int getLoadedChunks() { + return 0; + } + + public String getName() { + return "CustomChunkGenerator"; + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java index 202b3ab242..c5c3346d7f 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java @@ -68,4 +68,12 @@ public class NormalChunkGenerator extends InternalChunkGenerator { public ChunkPosition findNearestMapFeature(World world, String string, int i, int i1, int i2) { return provider.findNearestMapFeature(world, string, i, i1, i2); } + + public int getLoadedChunks() { + return 0; + } + + public String getName() { + return "NormalWorldGenerator"; + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java index 52696e328c..dfc15a4aa5 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -79,8 +79,8 @@ public class CraftContainer extends Container { int type = getNotchInventoryType(cachedType); IInventory top = ((CraftInventory)view.getTopInventory()).getInventory(); IInventory bottom = ((CraftInventory)view.getBottomInventory()).getInventory(); - this.d.clear(); - this.e.clear(); + this.a.clear(); + this.b.clear(); if (typeChanged) { setupSlots(top, bottom); } @@ -275,4 +275,7 @@ public class CraftContainer extends Container { // End copy from ContainerBrewingStand } + public boolean c(EntityHuman entity) { + return true; + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java index 8f67b6f170..0df3989165 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java @@ -1,6 +1,6 @@ package org.bukkit.craftbukkit.inventory; -import net.minecraft.server.FurnaceRecipes; +import net.minecraft.server.RecipesFurnace; import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.ItemStack; @@ -20,6 +20,6 @@ public class CraftFurnaceRecipe extends FurnaceRecipe implements CraftRecipe { public void addToCraftingManager() { ItemStack result = this.getResult(); ItemStack input = this.getInput(); - FurnaceRecipes.getInstance().registerRecipe(input.getTypeId(), CraftItemStack.createNMSItemStack(result)); + RecipesFurnace.getInstance().registerRecipe(input.getTypeId(), CraftItemStack.createNMSItemStack(result), 0.1f); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 0216f9dd1f..c8f25b0264 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -1,6 +1,5 @@ package org.bukkit.craftbukkit.inventory; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.ListIterator; @@ -8,6 +7,8 @@ import java.util.ListIterator; import net.minecraft.server.ContainerEnchantTableInventory; import net.minecraft.server.IInventory; import net.minecraft.server.InventoryCrafting; +import net.minecraft.server.InventoryEnderChest; +import net.minecraft.server.InventoryMerchant; import net.minecraft.server.PlayerInventory; import net.minecraft.server.TileEntityBrewingStand; import net.minecraft.server.TileEntityDispenser; @@ -411,6 +412,10 @@ public class CraftInventory implements Inventory { return InventoryType.BREWING; } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) { return ((CraftInventoryCustom.MinecraftInventory) inventory).getType(); + } else if (inventory instanceof InventoryEnderChest) { + return InventoryType.ENDER_CHEST; + } else if (inventory instanceof InventoryMerchant) { + return InventoryType.MERCHANT; } else { return InventoryType.CHEST; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java index 0a64d772c3..92e1ae9f49 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java @@ -1,6 +1,6 @@ package org.bukkit.craftbukkit.inventory; -import net.minecraft.server.CraftingRecipe; +import net.minecraft.server.IRecipe; import net.minecraft.server.IInventory; import net.minecraft.server.InventoryCrafting; @@ -132,7 +132,7 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn } public Recipe getRecipe() { - CraftingRecipe recipe = ((InventoryCrafting)getInventory()).currentRecipe; + IRecipe recipe = ((InventoryCrafting)getInventory()).currentRecipe; return recipe == null ? null : recipe.toBukkitRecipe(); } } \ No newline at end of file diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java index a53a5c2ddf..7299a16848 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -139,5 +139,7 @@ public class CraftInventoryCustom extends CraftInventory { public InventoryHolder getOwner() { return owner; } + + public void startOpen() {} } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java new file mode 100644 index 0000000000..7f89c2ad11 --- /dev/null +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java @@ -0,0 +1,10 @@ +package org.bukkit.craftbukkit.inventory; + +import net.minecraft.server.InventoryMerchant; +import org.bukkit.inventory.MerchantInventory; + +public class CraftInventoryMerchant extends CraftInventory implements MerchantInventory { + public CraftInventoryMerchant(InventoryMerchant merchant) { + super(merchant); + } +} diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index c26cc41242..9f7f004535 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -228,6 +228,8 @@ public class CraftItemStack extends ItemStack { public static net.minecraft.server.ItemStack createNMSItemStack(ItemStack original) { if (original == null || original.getTypeId() <= 0) { return null; + } else if (original instanceof CraftItemStack) { + return ((CraftItemStack) original).getHandle(); } return new CraftItemStack(original).getHandle(); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java index 85e9c8c699..c1f219362d 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java @@ -6,17 +6,17 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import net.minecraft.server.CraftingManager; -import net.minecraft.server.CraftingRecipe; -import net.minecraft.server.FurnaceRecipes; +import net.minecraft.server.IRecipe; +import net.minecraft.server.RecipesFurnace; public class RecipeIterator implements Iterator { - private Iterator recipes; + private Iterator recipes; private Iterator smelting; private Iterator removeFrom = null; public RecipeIterator() { - this.recipes = CraftingManager.getInstance().getRecipies().iterator(); - this.smelting = FurnaceRecipes.getInstance().getRecipies().keySet().iterator(); + this.recipes = CraftingManager.getInstance().getRecipes().iterator(); + this.smelting = RecipesFurnace.getInstance().getRecipes().keySet().iterator(); } public boolean hasNext() { @@ -34,7 +34,7 @@ public class RecipeIterator implements Iterator { } else { removeFrom = smelting; int id = smelting.next(); - CraftItemStack stack = new CraftItemStack(FurnaceRecipes.getInstance().getResult(id)); + CraftItemStack stack = new CraftItemStack(RecipesFurnace.getInstance().getResult(id)); CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1)); return recipe; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java index ab6d992f86..ae3481ba88 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.util; +import net.minecraft.server.ExceptionWorldConflict; import net.minecraft.server.MinecraftServer; public class ServerShutdownThread extends Thread { @@ -11,6 +12,15 @@ public class ServerShutdownThread extends Thread { @Override public void run() { - server.stop(); + try { + server.stop(); + } catch (ExceptionWorldConflict ex) { + ex.printStackTrace(); + } finally { + try { + server.reader.getTerminal().restore(); + } catch (Exception e) { + } + } } }