diff --git a/WindSpigot-API/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/WindSpigot-API/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 96bda4ca..7ddae3af 100644 --- a/WindSpigot-API/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/WindSpigot-API/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -37,7 +37,6 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginLoader; import org.bukkit.plugin.RegisteredListener; -import org.bukkit.plugin.TimedRegisteredListener; import org.bukkit.plugin.UnknownDependencyException; import org.yaml.snakeyaml.error.YAMLException; diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/WindSpigot.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/WindSpigot.java index b4712996..e0891ca5 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/WindSpigot.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/WindSpigot.java @@ -13,7 +13,6 @@ import com.google.common.collect.Sets; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import co.aikar.timings.Timings; import ga.windpvp.windspigot.async.AsyncUtil; import ga.windpvp.windspigot.async.pathsearch.SearchHandler; import ga.windpvp.windspigot.async.thread.CombatThread; @@ -27,7 +26,6 @@ import ga.windpvp.windspigot.protocol.MovementListener; import ga.windpvp.windspigot.protocol.PacketListener; import ga.windpvp.windspigot.statistics.StatisticsClient; -import net.md_5.bungee.api.ChatColor; import net.minecraft.server.MinecraftServer; import xyz.sculas.nacho.anticrash.AntiCrash; import xyz.sculas.nacho.async.AsyncExplosions; diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/netty/Spigot404Write.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/netty/Spigot404Write.java index 300b7179..3c1b38a8 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/netty/Spigot404Write.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/netty/Spigot404Write.java @@ -22,14 +22,16 @@ public Spigot404Write(Channel channel) { } public static void writeThenFlush(Channel channel, Packet value, GenericFutureListener>[] listener) { - - Spigot404Write writer = new Spigot404Write(channel); packetsQueue.add(new PacketQueue(value, listener)); - if (tasks.addTask()) { - try { - channel.pipeline().lastContext().executor().execute(writer::writeQueueAndFlush); - } catch (NullPointerException ignored) {} // The player might leave right before the packet is sent - } + if (!tasks.addTask()) + return; + + try { + Spigot404Write writer = new Spigot404Write(channel); + channel.pipeline().lastContext().executor().execute(writer::writeQueueAndFlush); + } catch (NullPointerException ignored) { + + } // The player might leave right before the packet is sent } public void writeQueueAndFlush() { @@ -37,10 +39,12 @@ public void writeQueueAndFlush() { while (packetsQueue.size() > 0) { PacketQueue messages = packetsQueue.poll(); if (messages == null) continue; + ChannelFuture future = this.channel.write(messages.getPacket()); if (messages.getListener() != null) { future.addListeners(messages.getListener()); } + future.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); } } diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/thread/AsyncPacketThread.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/thread/AsyncPacketThread.java index 1a0fabe7..87764154 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/thread/AsyncPacketThread.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/async/thread/AsyncPacketThread.java @@ -48,11 +48,11 @@ public void loop() { if (catchupTime < 2E6) { wait += Math.abs(catchupTime); } else if (wait < catchupTime) { - catchupTime -= wait; + //catchupTime -= wait; wait = 0; } else { wait -= catchupTime; - catchupTime = 0; + //catchupTime = 0; } try { @@ -61,7 +61,7 @@ public void loop() { } catch (InterruptedException e) { e.printStackTrace(); } - curTime = System.nanoTime(); + //curTime = System.nanoTime(); catchupTime = 0L; continue; } diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/random/FastRandom.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/random/FastRandom.java index f1d1a856..d59aeb0b 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/random/FastRandom.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/random/FastRandom.java @@ -49,7 +49,7 @@ public synchronized long getSeed() { * two instances of the same random class, starting with the same seed, produce * the same results, if the same methods are called. * - * @param s the new seed + * @param seed the new seed */ public synchronized void setSeed(long seed) { this.seed = seed; diff --git a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/statistics/StatisticsClient.java b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/statistics/StatisticsClient.java index cb54fa3a..b1d41e8c 100644 --- a/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/statistics/StatisticsClient.java +++ b/WindSpigot-Server/src/main/java/ga/windpvp/windspigot/statistics/StatisticsClient.java @@ -17,7 +17,7 @@ public class StatisticsClient { public boolean isConnected; // Connects to the statistics server - public void start(String ip, int port) throws UnknownHostException, IOException { + public void start(String ip, int port) throws IOException { this.socket = new Socket(ip, port); this.out = new PrintWriter(socket.getOutputStream(), true); this.in = new BufferedReader(new InputStreamReader(socket.getInputStream())); diff --git a/WindSpigot-Server/src/main/java/me/elier/nachospigot/config/NachoConfig.java b/WindSpigot-Server/src/main/java/me/elier/nachospigot/config/NachoConfig.java index deb98c1b..75c2d1c1 100644 --- a/WindSpigot-Server/src/main/java/me/elier/nachospigot/config/NachoConfig.java +++ b/WindSpigot-Server/src/main/java/me/elier/nachospigot/config/NachoConfig.java @@ -18,8 +18,6 @@ import com.google.common.base.Throwables; import ga.windpvp.windspigot.WindSpigot; -import ga.windpvp.windspigot.commons.FileUtils; -import ga.windpvp.windspigot.config.WindSpigotConfig; public class NachoConfig { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeBase.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeBase.java index 0880b091..db47eded 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeBase.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeBase.java @@ -6,6 +6,7 @@ import java.util.Random; import java.util.Set; +import ga.windpvp.windspigot.random.FastRandom; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -457,8 +458,8 @@ public static BiomeBase getBiome(int i, BiomeBase biomebase) { BiomeBase.n.remove(BiomeBase.SKY); BiomeBase.n.remove(BiomeBase.FROZEN_OCEAN); BiomeBase.n.remove(BiomeBase.SMALL_MOUNTAINS); - ae = new NoiseGenerator3(new Random(1234L), 1); - af = new NoiseGenerator3(new Random(2345L), 1); + ae = new NoiseGenerator3(new FastRandom(1234L), 1); + af = new NoiseGenerator3(new FastRandom(2345L), 1); ag = new WorldGenTallPlant(); } diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeMesa.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeMesa.java index ce437b67..90e816c0 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeMesa.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BiomeMesa.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import ga.windpvp.windspigot.random.FastRandom; + import java.util.Arrays; import java.util.Random; @@ -51,7 +53,7 @@ public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, in } if (this.aF == null || this.aG == null || this.aE != world.getSeed()) { - Random random1 = new Random(this.aE); + Random random1 = new FastRandom(this.aE); this.aF = new NoiseGenerator3(random1, 4); this.aG = new NoiseGenerator3(random1, 1); @@ -175,7 +177,7 @@ public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, in private void a(long i) { this.aD = new IBlockData[64]; Arrays.fill(this.aD, Blocks.HARDENED_CLAY.getBlockData()); - Random random = new Random(i); + Random random = new FastRandom(i); this.aH = new NoiseGenerator3(random, 1); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockDispenser.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockDispenser.java index f13112c5..8f13bf4d 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockDispenser.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockDispenser.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import ga.windpvp.windspigot.random.FastRandom; + import java.util.Random; public class BlockDispenser extends BlockContainer { @@ -8,7 +10,7 @@ public class BlockDispenser extends BlockContainer { public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered"); public static final RegistryDefault REGISTRY = new RegistryDefault( new DispenseBehaviorItem()); - protected Random O = new Random(); + protected Random O = new FastRandom(); public static boolean eventFired = false; // CraftBukkit protected BlockDispenser() { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFalling.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFalling.java index ddaa0cbb..bc3b0f8f 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFalling.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFalling.java @@ -6,7 +6,6 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers; import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; public class BlockFalling extends Block { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFlowerPot.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFlowerPot.java index 2cd5c1da..34d3e178 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFlowerPot.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockFlowerPot.java @@ -145,7 +145,7 @@ private TileEntityFlowerPot f(World world, BlockPosition blockposition) { @Override public TileEntity a(World world, int i) { - Object object = null; + Block object = null; int j = 0; switch (i) { @@ -209,7 +209,7 @@ public TileEntity a(World world, int i) { j = BlockWood.EnumLogVariant.DARK_OAK.a(); } - return new TileEntityFlowerPot(Item.getItemOf((Block) object), j); + return new TileEntityFlowerPot(Item.getItemOf(object), j); } @Override diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockLeaves.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockLeaves.java index cabd79e7..7a0bee56 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockLeaves.java @@ -5,7 +5,6 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; public abstract class BlockLeaves extends BlockTransparent { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockSapling.java b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockSapling.java index 48a492a6..b737f354 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/BlockSapling.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/BlockSapling.java @@ -82,7 +82,7 @@ public void e(World world, BlockPosition blockposition, IBlockData iblockdata, R // CraftBukkit start - Turn ternary operator into if statement to set treeType // Object object = random.nextInt(10) == 0 ? new WorldGenBigTree(true) : new // WorldGenTrees(true); - Object object; + WorldGenerator object; if (random.nextInt(10) == 0) { treeType = TreeType.BIG_TREE; object = new WorldGenBigTree(true); @@ -181,7 +181,7 @@ public void e(World world, BlockPosition blockposition, IBlockData iblockdata, R world.setTypeAndData(blockposition, iblockdata1, 4); } - if (!((WorldGenerator) object).generate(world, random, blockposition.a(i, 0, j))) { + if (!object.generate(world, random, blockposition.a(i, 0, j))) { if (flag) { world.setTypeAndData(blockposition.a(i, 0, j), iblockdata, 4); world.setTypeAndData(blockposition.a(i + 1, 0, j), iblockdata, 4); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Chunk.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Chunk.java index ec0f5436..1761db98 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Chunk.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Chunk.java @@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; // PaperSpigot +import ga.windpvp.windspigot.random.FastRandom; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; // CraftBukkit @@ -1218,7 +1219,7 @@ public boolean a(boolean flag) { } public Random a(long i) { - return new Random(this.world.getSeed() + this.locX * this.locX * 4987142 + this.locX * 5947611 + return new FastRandom(this.world.getSeed() + this.locX * this.locX * 4987142 + this.locX * 5947611 + this.locZ * this.locZ * 4392871L + this.locZ * 389711 ^ i); } diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderFlat.java index 8f0faf52..b84454ec 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderFlat.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderFlat.java @@ -6,6 +6,7 @@ import java.util.Random; import com.google.common.collect.Lists; +import ga.windpvp.windspigot.random.FastRandom; public class ChunkProviderFlat implements IChunkProvider { @@ -21,7 +22,7 @@ public class ChunkProviderFlat implements IChunkProvider { public ChunkProviderFlat(World world, long i, boolean flag, String s) { this.a = world; - this.b = new Random(i); + this.b = new FastRandom(i); this.d = WorldGenFlatInfo.a(s); if (flag) { Map map = this.d.b(); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderGenerate.java index f82a09b4..7ccfc810 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderGenerate.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderGenerate.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import ga.windpvp.windspigot.random.FastRandom; + import java.util.List; import java.util.Random; @@ -47,7 +49,7 @@ public ChunkProviderGenerate(World world, long i, boolean flag, String s) { this.m = world; this.n = flag; this.o = world.getWorldData().getType(); - this.h = new Random(i); + this.h = new FastRandom(i); this.i = new NoiseGeneratorOctaves(this.h, 16); this.j = new NoiseGeneratorOctaves(this.h, 16); this.k = new NoiseGeneratorOctaves(this.h, 8); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderHell.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderHell.java index ebff1b27..9abfffde 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderHell.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderHell.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import ga.windpvp.windspigot.random.FastRandom; + import java.util.List; import java.util.Random; @@ -45,7 +47,7 @@ public ChunkProviderHell(World world, boolean flag, long i) { this.C = new WorldGenCavesHell(); this.h = world; this.i = flag; - this.j = new Random(i); + this.j = new FastRandom(i); this.o = new NoiseGeneratorOctaves(this.j, 16); this.p = new NoiseGeneratorOctaves(this.j, 16); this.q = new NoiseGeneratorOctaves(this.j, 8); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderServer.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderServer.java index c29ed268..08bdf2fc 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -6,6 +6,7 @@ // CraftBukkit start import java.util.Random; +import ga.windpvp.windspigot.random.FastRandom; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.Server; @@ -342,7 +343,7 @@ public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) { // CraftBukkit start BlockFalling.instaFall = true; - Random random = new Random(); + Random random = new FastRandom(); random.setSeed(world.getSeed()); long xRand = random.nextLong() / 2L * 2L + 1L; long zRand = random.nextLong() / 2L * 2L + 1L; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 90886ed8..4e992901 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -5,7 +5,6 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/WindSpigot-Server/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java index 5a9a429f..0b46c15a 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java @@ -238,7 +238,7 @@ public static int executeCommand(ICommandListener sender, org.bukkit.command.Com exception); } else { MinecraftServer.getServer().server.getLogger().log(Level.WARNING, - String.format("Unknown CommandBlock failed to handle command"), exception); + "Unknown CommandBlock failed to handle command", exception); } } } diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/CommandSpreadPlayers.java b/WindSpigot-Server/src/main/java/net/minecraft/server/CommandSpreadPlayers.java index 18455a71..206a260e 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/CommandSpreadPlayers.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/CommandSpreadPlayers.java @@ -10,6 +10,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import ga.windpvp.windspigot.random.FastRandom; public class CommandSpreadPlayers extends CommandAbstract { @@ -86,7 +87,7 @@ public void execute(ICommandListener icommandlistener, String[] astring) throws private void a(ICommandListener icommandlistener, List list, CommandSpreadPlayers.Location2D commandspreadplayers_location2d, double d0, double d1, World world, boolean flag) throws CommandException { - Random random = new Random(); + Random random = new FastRandom(); double d2 = commandspreadplayers_location2d.a - d1; double d3 = commandspreadplayers_location2d.b - d1; double d4 = commandspreadplayers_location2d.a + d1; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/CommandTp.java b/WindSpigot-Server/src/main/java/net/minecraft/server/CommandTp.java index c243c740..c5f014fc 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/CommandTp.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/CommandTp.java @@ -29,7 +29,7 @@ public void execute(ICommandListener icommandlistener, String[] astring) throws throw new ExceptionUsage("commands.tp.usage", new Object[0]); } else { byte b0 = 0; - Object object; + Entity object; if (astring.length != 2 && astring.length != 4 && astring.length != 6) { object = b(icommandlistener); @@ -41,17 +41,17 @@ public void execute(ICommandListener icommandlistener, String[] astring) throws if (astring.length != 1 && astring.length != 2) { if (astring.length < b0 + 3) { throw new ExceptionUsage("commands.tp.usage", new Object[0]); - } else if (((Entity) object).world != null) { + } else if (object.world != null) { int i = b0 + 1; - CommandAbstract.CommandNumber commandabstract_commandnumber = a(((Entity) object).locX, astring[b0], + CommandAbstract.CommandNumber commandabstract_commandnumber = a(object.locX, astring[b0], true); - CommandAbstract.CommandNumber commandabstract_commandnumber1 = a(((Entity) object).locY, + CommandAbstract.CommandNumber commandabstract_commandnumber1 = a(object.locY, astring[i++], 0, 0, false); - CommandAbstract.CommandNumber commandabstract_commandnumber2 = a(((Entity) object).locZ, + CommandAbstract.CommandNumber commandabstract_commandnumber2 = a(object.locZ, astring[i++], true); - CommandAbstract.CommandNumber commandabstract_commandnumber3 = a(((Entity) object).yaw, + CommandAbstract.CommandNumber commandabstract_commandnumber3 = a(object.yaw, astring.length > i ? astring[i++] : "~", false); - CommandAbstract.CommandNumber commandabstract_commandnumber4 = a(((Entity) object).pitch, + CommandAbstract.CommandNumber commandabstract_commandnumber4 = a(object.pitch, astring.length > i ? astring[i] : "~", false); float f; @@ -94,10 +94,10 @@ public void execute(ICommandListener icommandlistener, String[] astring) throws f = MathHelper.g(f + 180.0F); } - ((Entity) object).mount((Entity) null); + object.mount((Entity) null); ((EntityPlayer) object).playerConnection.a(commandabstract_commandnumber.b(), commandabstract_commandnumber1.b(), commandabstract_commandnumber2.b(), f, f1, enumset); - ((Entity) object).f(f); + object.f(f); } else { float f2 = (float) MathHelper.g(commandabstract_commandnumber3.a()); @@ -107,13 +107,13 @@ public void execute(ICommandListener icommandlistener, String[] astring) throws f2 = MathHelper.g(f2 + 180.0F); } - ((Entity) object).setPositionRotation(commandabstract_commandnumber.a(), + object.setPositionRotation(commandabstract_commandnumber.a(), commandabstract_commandnumber1.a(), commandabstract_commandnumber2.a(), f2, f); - ((Entity) object).f(f2); + object.f(f2); } a(icommandlistener, this, "commands.tp.success.coordinates", - new Object[] { ((Entity) object).getName(), + new Object[] { object.getName(), Double.valueOf(commandabstract_commandnumber.a()), Double.valueOf(commandabstract_commandnumber1.a()), Double.valueOf(commandabstract_commandnumber2.a()) }); @@ -124,10 +124,10 @@ public void execute(ICommandListener icommandlistener, String[] astring) throws // CraftBukkit Start // Use Bukkit teleport method in all cases. It has cross dimensional handling, // events - if (((Entity) object).getBukkitEntity().teleport(entity.getBukkitEntity(), + if (object.getBukkitEntity().teleport(entity.getBukkitEntity(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND)) { a(icommandlistener, this, "commands.tp.success", - new Object[] { ((Entity) object).getName(), entity.getName() }); + new Object[] { object.getName(), entity.getName() }); // CraftBukkit End } } diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Container.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Container.java index a29297a4..d332d6a2 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Container.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Container.java @@ -20,7 +20,6 @@ import com.google.common.collect.Sets; import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; public abstract class Container { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerEnchantTable.java index 66fa96ac..0e9a433f 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerEnchantTable.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerEnchantTable.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Random; +import ga.windpvp.windspigot.random.FastRandom; import org.bukkit.craftbukkit.inventory.CraftInventoryEnchanting; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.craftbukkit.inventory.CraftItemStack; @@ -30,7 +31,7 @@ public void update() { }; private World world; private BlockPosition position; - private Random k = new Random(); + private Random k = new FastRandom(); public int f; public int[] costs = new int[3]; public int[] h = new int[] { -1, -1, -1 }; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerHopper.java b/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerHopper.java index 67be2d51..0f18f8e8 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerHopper.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/ContainerHopper.java @@ -75,7 +75,7 @@ public ItemStack b(EntityHuman entityhuman, int i) { } if (itemstack1.count == 0) { - slot.set((ItemStack) null); + slot.set(null); } else { slot.f(); } diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/DedicatedServer.java b/WindSpigot-Server/src/main/java/net/minecraft/server/DedicatedServer.java index dd1fa498..fc5bc843 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/DedicatedServer.java @@ -6,10 +6,10 @@ import java.io.PrintStream; import java.net.InetAddress; import java.net.Proxy; -import java.util.Random; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; +import ga.windpvp.windspigot.random.FastRandom; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -20,7 +20,6 @@ import org.bukkit.event.server.ServerCommandEvent; import co.aikar.timings.SpigotTimings; // Spigot -import dev.cobblesword.nachospigot.Nacho; import ga.windpvp.windspigot.WindSpigot; import ga.windpvp.windspigot.commons.IPUtils; import ga.windpvp.windspigot.config.WindSpigotConfig; @@ -291,7 +290,7 @@ public void run() { String s = this.propertyManager.getString("level-seed", ""); String s1 = this.propertyManager.getString("level-type", "DEFAULT"); String s2 = this.propertyManager.getString("generator-settings", ""); - long k = (new Random()).nextLong(); + long k = (new FastRandom()).nextLong(); if (s.length() > 0) { try { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EnchantmentManager.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EnchantmentManager.java index 3e3b74a9..e9a1346a 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EnchantmentManager.java @@ -10,10 +10,11 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import ga.windpvp.windspigot.random.FastRandom; public class EnchantmentManager { - private static final Random a = new Random(); + private static final Random a = new FastRandom(); private static final EnchantmentManager.EnchantmentModifierProtection b = new EnchantmentManager.EnchantmentModifierProtection( null); private static final EnchantmentManager.EnchantmentModifierDamage c = new EnchantmentManager.EnchantmentModifierDamage( diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java index 4d232770..de5ba4f5 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Entity.java @@ -41,7 +41,6 @@ import co.aikar.timings.Timing; // Spigot import dev.cobblesword.nachospigot.knockback.KnockbackProfile; import ga.windpvp.windspigot.WindSpigot; -import ga.windpvp.windspigot.async.AsyncUtil; import ga.windpvp.windspigot.cache.Constants; import ga.windpvp.windspigot.config.WindSpigotConfig; import ga.windpvp.windspigot.random.FastRandom; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityEnderPearl.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityEnderPearl.java index db67c366..7f75bb83 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityEnderPearl.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityEnderPearl.java @@ -7,7 +7,6 @@ import ga.windpvp.windspigot.WindSpigot; import ga.windpvp.windspigot.cache.Constants; import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; // CraftBukkit end diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityHorse.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityHorse.java index 804b5593..f53efb5b 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityHorse.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityHorse.java @@ -1217,7 +1217,7 @@ public EntityAgeable createChild(EntityAgeable entityageable) { @Override public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) { - Object object = super.prepare(difficultydamagescaler, groupdataentity); + GroupDataEntity object = super.prepare(difficultydamagescaler, groupdataentity); boolean flag = false; int i = 0; int j; @@ -1264,7 +1264,7 @@ public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, Gr } this.setHealth(this.getMaxHealth()); - return (GroupDataEntity) object; + return object; } public void v(int i) { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityPotion.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityPotion.java index a1437087..7987ce32 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityPotion.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityPotion.java @@ -10,7 +10,6 @@ // CraftBukkit end import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; public class EntityPotion extends EntityProjectile { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityProjectile.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityProjectile.java index f9566c9f..13e7b760 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityProjectile.java @@ -6,7 +6,6 @@ import ga.windpvp.windspigot.cache.Constants; import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; public abstract class EntityProjectile extends Entity implements IProjectile { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntitySpider.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntitySpider.java index 0fd68bac..f8a33d27 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntitySpider.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntitySpider.java @@ -123,7 +123,7 @@ public void a(boolean flag) { @Override public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, GroupDataEntity groupdataentity) { - Object object = super.prepare(difficultydamagescaler, groupdataentity); + GroupDataEntity object = super.prepare(difficultydamagescaler, groupdataentity); if (this.world.random.nextInt(100) == 0) { EntitySkeleton entityskeleton = new EntitySkeleton(this.world); @@ -153,7 +153,7 @@ public GroupDataEntity prepare(DifficultyDamageScaler difficultydamagescaler, Gr } } - return (GroupDataEntity) object; + return object; } @Override diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTrackerEntry.java index f94f0619..66384e1b 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -16,10 +16,7 @@ import org.bukkit.event.player.PlayerVelocityEvent; // CraftBukkit end -import com.google.common.collect.Maps; - import ga.windpvp.windspigot.config.WindSpigotConfig; -import it.unimi.dsi.fastutil.objects.Reference2BooleanArrayMap; import it.unimi.dsi.fastutil.objects.Reference2BooleanOpenHashMap; // WindSpigot - sendPacket methods have been replaced with the queuePacket method @@ -191,7 +188,7 @@ private void removeFarPlayers() { return; } - for (EntityPlayer entityplayer : (Collection) trackedPlayers) { + for (EntityPlayer entityplayer : trackedPlayers) { double d0 = entityplayer.locX - this.tracker.locX; double d1 = entityplayer.locZ - this.tracker.locZ; int range = this.getRange(); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/Explosion.java b/WindSpigot-Server/src/main/java/net/minecraft/server/Explosion.java index d453771e..0188cb42 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/Explosion.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/Explosion.java @@ -20,7 +20,6 @@ import ga.windpvp.windspigot.cache.Constants; import ga.windpvp.windspigot.config.WindSpigotConfig; import ga.windpvp.windspigot.random.FastRandom; -import me.elier.nachospigot.config.NachoConfig; import xyz.sculas.nacho.async.AsyncExplosions; public class Explosion { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/IChatBaseComponent.java b/WindSpigot-Server/src/main/java/net/minecraft/server/IChatBaseComponent.java index f9cd7820..4280e650 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/IChatBaseComponent.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/IChatBaseComponent.java @@ -1,7 +1,6 @@ package net.minecraft.server; import java.lang.reflect.Type; -import java.util.Iterator; import java.util.List; import java.util.Map.Entry; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/LoginListener.java b/WindSpigot-Server/src/main/java/net/minecraft/server/LoginListener.java index 268849a6..d4b6ae6d 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/LoginListener.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/LoginListener.java @@ -10,6 +10,7 @@ import javax.crypto.SecretKey; +import ga.windpvp.windspigot.random.FastRandom; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -42,7 +43,7 @@ public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBo private static final AtomicInteger b = new AtomicInteger(0); private static final Logger c = LogManager.getLogger(); - private static final Random random = new Random(); + private static final Random random = new FastRandom(); private final byte[] e = new byte[4]; private final MinecraftServer server; public final NetworkManager networkManager; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/MathHelper.java b/WindSpigot-Server/src/main/java/net/minecraft/server/MathHelper.java index 4b9ea3e7..10a94019 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/MathHelper.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/MathHelper.java @@ -3,9 +3,6 @@ import java.util.Random; import java.util.UUID; -import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; - public class MathHelper { public static final float a = c(2.0F); private static final float[] b = new float[65536]; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java b/WindSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java index 728e9e3b..0d2fd9ea 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java @@ -7,7 +7,6 @@ import java.net.Proxy; import java.security.KeyPair; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; @@ -25,6 +24,7 @@ import javax.imageio.ImageIO; +import ga.windpvp.windspigot.random.FastRandom; import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -53,7 +53,6 @@ // CraftBukkit end // NachoSpigot start -import me.elier.nachospigot.config.NachoConfig; import xyz.sculas.nacho.async.AsyncExplosions; // NachoSpigot end @@ -80,7 +79,7 @@ public abstract class MinecraftServer extends ReentrantIAsyncHandler { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/WindSpigot-Server/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java index 33804e62..647e28a8 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java @@ -3,7 +3,6 @@ import java.io.IOException; import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; public class PacketPlayInUseEntity implements Packet { private int a; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/PersistentScoreboard.java b/WindSpigot-Server/src/main/java/net/minecraft/server/PersistentScoreboard.java index 7cbe2f92..d86eaff0 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/PersistentScoreboard.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/PersistentScoreboard.java @@ -7,7 +7,6 @@ import org.apache.logging.log4j.Logger; import ga.windpvp.windspigot.config.WindSpigotConfig; -import me.elier.nachospigot.config.NachoConfig; import net.minecraft.server.IScoreboardCriteria.EnumScoreboardHealthDisplay; import net.minecraft.server.ScoreboardTeamBase.EnumNameTagVisibility; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerConnection.java b/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerConnection.java index 8ee47934..ad8a387c 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerConnection.java @@ -1424,8 +1424,8 @@ protected Object evaluate() { queueEvent.getMessage()); PlayerConnection.this.minecraftServer.console.sendMessage(message); if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) { - for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) { - ((EntityPlayer) player).sendMessage(CraftChatMessage.fromString(message)); + for (EntityPlayer player : PlayerConnection.this.minecraftServer.getPlayerList().players) { + player.sendMessage(CraftChatMessage.fromString(message)); } } else { for (Player player : queueEvent.getRecipients()) { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerList.java b/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerList.java index a1e8daa2..4d8bb387 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerList.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/PlayerList.java @@ -47,7 +47,6 @@ import ga.windpvp.windspigot.config.WindSpigotConfig; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import me.elier.nachospigot.config.NachoConfig; public abstract class PlayerList { @@ -820,8 +819,8 @@ public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, // Added from changeDimension updateClient(entityplayer); // Update health, etc... entityplayer.updateAbilities(); - for (Object o1 : entityplayer.getEffects()) { - MobEffect mobEffect = (MobEffect) o1; + for (MobEffect o1 : entityplayer.getEffects()) { + MobEffect mobEffect = o1; entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect)); } // entityplayer1.syncInventory(); diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/PortalTravelAgent.java b/WindSpigot-Server/src/main/java/net/minecraft/server/PortalTravelAgent.java index 6a438196..a876dc4d 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -4,6 +4,7 @@ import java.util.Random; import java.util.concurrent.ConcurrentLinkedQueue; +import ga.windpvp.windspigot.random.FastRandom; import org.bukkit.Location; import org.bukkit.event.entity.EntityPortalExitEvent; import org.bukkit.util.Vector; @@ -19,7 +20,7 @@ public class PortalTravelAgent { public PortalTravelAgent(WorldServer worldserver) { this.a = worldserver; - this.b = new Random(worldserver.getSeed()); + this.b = new FastRandom(worldserver.getSeed()); } public void a(Entity entity, float f) { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityDispenser.java b/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityDispenser.java index 7cbe169b..bd0270ac 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityDispenser.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityDispenser.java @@ -4,13 +4,14 @@ import java.util.List; import java.util.Random; +import ga.windpvp.windspigot.random.FastRandom; import org.bukkit.craftbukkit.entity.CraftHumanEntity; import org.bukkit.entity.HumanEntity; // CraftBukkit end public class TileEntityDispenser extends TileEntityContainer implements IInventory { - private static final Random f = new Random(); + private static final Random f = new FastRandom(); private ItemStack[] items = new ItemStack[9]; protected String a; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityEnchantTable.java b/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityEnchantTable.java index f9f433f8..13e8090c 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityEnchantTable.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/TileEntityEnchantTable.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import ga.windpvp.windspigot.random.FastRandom; + import java.util.Random; public class TileEntityEnchantTable extends TileEntity implements IUpdatePlayerListBox, ITileEntityContainer { @@ -13,7 +15,7 @@ public class TileEntityEnchantTable extends TileEntity implements IUpdatePlayerL public float l; public float m; public float n; - private static Random o = new Random(); + private static Random o = new FastRandom(); private String p; public TileEntityEnchantTable() { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/World.java b/WindSpigot-Server/src/main/java/net/minecraft/server/World.java index 9ddc8cd8..03d21808 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/World.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/World.java @@ -24,7 +24,6 @@ import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.generator.ChunkGenerator; -import org.bukkit.util.Vector; import com.google.common.base.Predicate; import com.google.common.collect.Lists; @@ -38,7 +37,6 @@ import ga.windpvp.windspigot.entity.EntityTickLimiter; import ga.windpvp.windspigot.random.FastRandom; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import me.elier.nachospigot.config.NachoConfig; import me.elier.nachospigot.config.NachoWorldConfig; import me.rastrian.dev.OptimizedWorldTileEntitySet; import me.rastrian.dev.PlayerMap; @@ -86,7 +84,7 @@ public Set getTileEntityListUnload() { protected final IntHashMap entitiesById = new IntHashMap(); private long d = 16777215L; private int I; - protected int m = (new Random()).nextInt(); + protected int m = (new FastRandom()).nextInt(); protected final int n = 1013904223; protected float o; protected float p; diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldGenVillagePieces.java b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldGenVillagePieces.java index 71cf9621..eca4e598 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldGenVillagePieces.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldGenVillagePieces.java @@ -81,7 +81,7 @@ private static WorldGenVillagePieces.WorldGenVillagePiece a( WorldGenVillagePieces.WorldGenVillagePieceWeight worldgenvillagepieces_worldgenvillagepieceweight, List list, Random random, int i, int j, int k, EnumDirection enumdirection, int l) { Class oclass = worldgenvillagepieces_worldgenvillagepieceweight.a; - Object object = null; + WorldGenVillagePiece object = null; if (oclass == WorldGenVillagePieces.WorldGenVillageHouse.class) { object = WorldGenVillagePieces.WorldGenVillageHouse.a(worldgenvillagepieces_worldgenvillagestartpiece, list, @@ -112,7 +112,7 @@ private static WorldGenVillagePieces.WorldGenVillagePiece a( list, random, i, j, k, enumdirection, l); } - return (WorldGenVillagePieces.WorldGenVillagePiece) object; + return object; } private static WorldGenVillagePieces.WorldGenVillagePiece c( @@ -793,7 +793,7 @@ public boolean a(World world, Random random, StructureBoundingBox structurebound for (k = -1; k <= 2; ++k) { for (l = 0; l <= 8; ++l) { this.a(world, Blocks.OAK_STAIRS.fromLegacyData(i), l, 4 + k, k, structureboundingbox); - if ((k > -1 || l <= 1) && (k > 0 || l <= 3) && (k > 1 || l <= 4 || l >= 6)) { + if ((k > -1 || l <= 1) && (k > 0 || l <= 3) && (k > 1 || l != 5)) { this.a(world, Blocks.OAK_STAIRS.fromLegacyData(j), l, 4 + k, 5 - k, structureboundingbox); } } diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldMap.java b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldMap.java index afc3f41a..543466a5 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldMap.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldMap.java @@ -344,12 +344,12 @@ public Packet a(ItemStack itemstack) { private void addSeenPlayers(Collection icons) { Player player = (Player) this.trackee.getBukkitEntity(); - WorldMap.this.decorations.forEach((uuid, mapIcon) -> { - Player other = Bukkit.getPlayer(uuid); + for (Map.Entry entry : WorldMap.this.decorations.entrySet()) { + Player other = Bukkit.getPlayer(entry.getKey()); if (other == null || player.canSee(other)) { - icons.add(mapIcon); + icons.add(entry.getValue()); } - }); + } } private boolean shouldUseVanillaMap() { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldNBTStorage.java b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldNBTStorage.java index 904c7024..80b15c69 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -333,7 +333,7 @@ public UUID getUUID() { dis = new DataInputStream(new FileInputStream(file1)); return uuid = new UUID(dis.readLong(), dis.readLong()); } catch (IOException ex) { - a.warn("Failed to read " + file1 + ", generating new random UUID", ex); + a.warn("Failed to read " + file1 + ", generating new FastRandom UUID", ex); } finally { if (dis != null) { try { diff --git a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java index 237b1956..1d15bfca 100644 --- a/WindSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java +++ b/WindSpigot-Server/src/main/java/net/minecraft/server/WorldServer.java @@ -10,6 +10,7 @@ import java.util.UUID; import java.util.logging.Level; +import ga.windpvp.windspigot.random.FastRandom; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.WeatherType; @@ -872,8 +873,8 @@ public List getTileEntities(int i, int j, int k, int l, int i1, int if (chunk == null) { continue; } - for (Object te : chunk.tileEntities.values()) { - TileEntity tileentity = (TileEntity) te; + for (TileEntity te : chunk.tileEntities.values()) { + TileEntity tileentity = te; if ((tileentity.position.getX() >= i) && (tileentity.position.getY() >= j) && (tileentity.position.getZ() >= k) && (tileentity.position.getX() < l) && (tileentity.position.getY() < i1) && (tileentity.position.getZ() < j1)) { @@ -951,7 +952,7 @@ private void b(WorldSettings worldsettings) { this.isLoading = true; WorldChunkManager worldchunkmanager = this.worldProvider.m(); List list = worldchunkmanager.a(); - Random random = new Random(this.getSeed()); + Random random = new FastRandom(this.getSeed()); BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random); int i = 0; int j = this.worldProvider.getSeaLevel(); @@ -959,7 +960,7 @@ private void b(WorldSettings worldsettings) { // CraftBukkit start if (this.generator != null) { - Random rand = new Random(this.getSeed()); + Random rand = new FastRandom(this.getSeed()); org.bukkit.Location spawn = this.generator.getFixedSpawnLocation(this.getWorld(), rand); if (spawn != null) { diff --git a/WindSpigot-Server/src/main/java/net/techcable/tacospigot/HopperPusher.java b/WindSpigot-Server/src/main/java/net/techcable/tacospigot/HopperPusher.java index 003b5765..a59596b8 100644 --- a/WindSpigot-Server/src/main/java/net/techcable/tacospigot/HopperPusher.java +++ b/WindSpigot-Server/src/main/java/net/techcable/tacospigot/HopperPusher.java @@ -9,7 +9,7 @@ public interface HopperPusher { - public default TileEntityHopper findHopper() { + default TileEntityHopper findHopper() { int y1 = MathHelper.floor(getY()); for (int y = y1; y > y1 - 2; y--) { TileEntityHopper hopper = HopperHelper.getHopper(getWorld(), new BlockPosition(getX(), y, getZ())); @@ -20,9 +20,9 @@ public default TileEntityHopper findHopper() { return null; } - public boolean acceptItem(TileEntityHopper hopper); + boolean acceptItem(TileEntityHopper hopper); - public default boolean tryPutInHopper() { + default boolean tryPutInHopper() { if (!getWorld().tacoSpigotConfig.isHopperPushBased) { return false; } @@ -30,22 +30,20 @@ public default boolean tryPutInHopper() { return hopper != null && hopper.canAcceptItems() && acceptItem(hopper); } - public AxisAlignedBB getBoundingBox(); + AxisAlignedBB getBoundingBox(); - public World getWorld(); + World getWorld(); // Default implementations for entities - public default double getX() { + default double getX() { return ((Entity) this).locX; } - public default double getY() { + default double getY() { return ((Entity) this).locY; } - public default double getZ() { - return ((Entity) this).locZ; - } + default double getZ() { return ((Entity) this).locZ; } } diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 58ddc5b7..dd06ca96 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -102,11 +102,11 @@ public Entity[] getEntities() { for (int i = 0; i < 16; i++) { // Paper start - speed up (was with chunk.entitySlices[i].toArray() and cast // checks which costs a lot of performance if called often) - for (Object entity : chunk.entitySlices[i]) { + for (net.minecraft.server.Entity entity : chunk.entitySlices[i]) { if (entity == null) { continue; } - entities[index++] = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + entities[index++] = entity.getBukkitEntity(); } // Paper end } diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 350e9d4c..239e3533 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -117,7 +117,6 @@ import com.google.common.collect.MapMaker; import com.mojang.authlib.GameProfile; -import dev.cobblesword.nachospigot.Nacho; import ga.windpvp.windspigot.async.entitytracker.AsyncEntityTracker; import ga.windpvp.windspigot.commons.PluginUtils; import ga.windpvp.windspigot.config.WindSpigotConfig; diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 5e5bfc57..084dbd1c 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -121,9 +121,7 @@ import com.google.common.base.Preconditions; import ga.windpvp.windspigot.cache.Constants; -import ga.windpvp.windspigot.config.WindSpigotConfig; import ga.windpvp.windspigot.random.FastRandom; -import me.elier.nachospigot.config.NachoConfig; import net.minecraft.server.*; public class CraftWorld implements World { @@ -821,16 +819,16 @@ public List getEntities() { public List getLivingEntities() { List list = new ArrayList(); - for (Object o : world.entityList) { - if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; + for (net.minecraft.server.Entity o : world.entityList) { + //if (o instanceof net.minecraft.server.Entity) { + net.minecraft.server.Entity mcEnt = o; Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) { list.add((LivingEntity) bukkitEntity); } - } + //} } return list; @@ -848,9 +846,9 @@ public Collection getEntitiesByClass(Class... classes) public Collection getEntitiesByClass(Class clazz) { Collection list = new ArrayList(); - for (Object entity : world.entityList) { + for (net.minecraft.server.Entity entity : world.entityList) { if (entity instanceof net.minecraft.server.Entity) { - Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + Entity bukkitEntity = entity.getBukkitEntity(); if (bukkitEntity == null) { continue; @@ -871,9 +869,9 @@ public Collection getEntitiesByClass(Class clazz) { public Collection getEntitiesByClasses(Class... classes) { Collection list = new ArrayList(); - for (Object entity : world.entityList) { - if (entity instanceof net.minecraft.server.Entity) { - Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + for (net.minecraft.server.Entity entity : world.entityList) { + //if (entity instanceof net.minecraft.server.Entity) { + Entity bukkitEntity = entity.getBukkitEntity(); if (bukkitEntity == null) { continue; @@ -887,7 +885,7 @@ public Collection getEntitiesByClasses(Class... classes) { break; } } - } + //} } return list; @@ -905,8 +903,8 @@ public Collection getNearbyEntities(Location location, double x, double // : // rename List bukkitEntityList = new ArrayList(entityList.size()); - for (Object entity : entityList) { - bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity()); + for (net.minecraft.server.Entity entity : entityList) { + bukkitEntityList.add(entity.getBukkitEntity()); } return bukkitEntityList; } diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java index 192ff9d6..cf510153 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -178,7 +178,7 @@ public final int dispatchVanillaCommand(CommandSender bSender, ICommandListener listener.getChunkCoordinates().getZ()), throwable); } else { - MinecraftServer.LOGGER.log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), + MinecraftServer.LOGGER.log(Level.WARN, "Unknown CommandBlock failed to handle command", throwable); } } finally { diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index f6433b18..9ca684cb 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -358,11 +358,8 @@ public void removePotionEffect(PotionEffectType type) { @Override public Collection getActivePotionEffects() { List effects = new ArrayList(); - for (Object raw : getHandle().effects.values()) { - if (!(raw instanceof MobEffect)) { - continue; - } - MobEffect handle = (MobEffect) raw; + for (MobEffect raw : getHandle().effects.values()) { + MobEffect handle = raw; effects.add(new PotionEffect(PotionEffectType.getById(handle.getEffectId()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles())); } diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index e72b45f4..c7a41849 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -74,7 +74,6 @@ import ga.windpvp.windspigot.cache.Constants; import ga.windpvp.windspigot.config.WindSpigotConfig; import io.netty.buffer.Unpooled; -import me.elier.nachospigot.config.NachoConfig; import net.md_5.bungee.api.chat.BaseComponent; import net.minecraft.server.AttributeInstance; import net.minecraft.server.AttributeMapServer; diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 872d3b38..75b0bbc7 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -625,28 +625,42 @@ private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSo } DamageCause cause = null; - if (source == DamageSource.FIRE) { - cause = DamageCause.FIRE; - } else if (source == DamageSource.STARVE) { - cause = DamageCause.STARVATION; - } else if (source == DamageSource.WITHER) { - cause = DamageCause.WITHER; - } else if (source == DamageSource.STUCK) { - cause = DamageCause.SUFFOCATION; - } else if (source == DamageSource.DROWN) { - cause = DamageCause.DROWNING; - } else if (source == DamageSource.BURN) { - cause = DamageCause.FIRE_TICK; - } else if (source == MELTING) { - cause = DamageCause.MELTING; - } else if (source == POISON) { - cause = DamageCause.POISON; - } else if (source == DamageSource.MAGIC) { - cause = DamageCause.MAGIC; - } else if (source == DamageSource.FALL) { - cause = DamageCause.FALL; - } else if (source == DamageSource.GENERIC) { - return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions); + final CraftDamageSource.DAMAGE_SOURCE damageSource = CraftDamageSource.getSource(source.p()); + switch (damageSource) { + case FIRE: + cause = DamageCause.FIRE; + break; + case STARVE: + cause = DamageCause.STARVATION; + break; + case WITHER: + cause = DamageCause.WITHER; + break; + case STUCK: + cause = DamageCause.SUFFOCATION; + break; + case DROWN: + cause = DamageCause.DROWNING; + break; + case BURN: + cause = DamageCause.FIRE_TICK; + break; + case MELTING: + cause = DamageCause.MELTING; + break; + case POISON: + cause = DamageCause.POISON; + break; + case MAGIC: + cause = DamageCause.MAGIC; + break; + case FALL: + cause = DamageCause.FALL; + break; + case GENERIC: + return new EntityDamageEvent(entity.getBukkitEntity(), null, modifiers, modifierFunctions); + default: + throw new IllegalStateException("Unexpected value: " + damageSource); } if (cause != null) { diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java index d6e22a67..0a2e3041 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap.Builder; -import ga.windpvp.windspigot.config.WindSpigotConfig; import net.minecraft.server.IChatBaseComponent; import net.minecraft.server.IChatBaseComponent.ChatSerializer; import net.minecraft.server.NBTTagCompound; diff --git a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/util/CraftDamageSource.java b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/util/CraftDamageSource.java index 4024d06d..bd5efef2 100644 --- a/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/util/CraftDamageSource.java +++ b/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/util/CraftDamageSource.java @@ -4,6 +4,7 @@ // Util class to create custom DamageSources. public final class CraftDamageSource extends DamageSource { + public static DamageSource copyOf(final DamageSource original) { CraftDamageSource newSource = new CraftDamageSource(original.translationIndex); @@ -25,7 +26,45 @@ public static DamageSource copyOf(final DamageSource original) { return newSource; } + public static DAMAGE_SOURCE getSource(String value) { + return DAMAGE_SOURCE.getSource(value); + } + private CraftDamageSource(String identifier) { super(identifier); } + + public enum DAMAGE_SOURCE { + FIRE("inFire"), + LIGHTNING("lightningBolt"), + BURN("onFire"), + LAVA("lava"), + STUCK("inWall"), + DROWN("drown"), + STARVE("starve"), + MELTING("MELTING"), + POISON("POISON"), + CACTUS("cactus"), + OUT_OF_WORLD("outOfWorld"), + GENERIC("generic"), + MAGIC("magic"), + WITHER("wither"), + ANVIL("anvil"), + FALLING_BLOCK("fallingBlock"), + FALL("fall"); + + private String code; + DAMAGE_SOURCE(String code) { + this.code = code; + } + + public static DAMAGE_SOURCE getSource(String value) { + for (DAMAGE_SOURCE l : DAMAGE_SOURCE.values()) { + if (l.code.equalsIgnoreCase(value)) return l; + } + + throw new IllegalArgumentException("Leg not found. Amputated?"); + } + + } } diff --git a/WindSpigot-Server/src/main/java/org/spigotmc/ActivationRange.java b/WindSpigot-Server/src/main/java/org/spigotmc/ActivationRange.java index 987d7211..fa7b0beb 100644 --- a/WindSpigot-Server/src/main/java/org/spigotmc/ActivationRange.java +++ b/WindSpigot-Server/src/main/java/org/spigotmc/ActivationRange.java @@ -59,7 +59,7 @@ public static byte initializeEntityActivationType(Entity entity) { * These entities are excluded from Activation range checks. * * @param entity - * @param world + * @param config * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { diff --git a/WindSpigot-Server/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/WindSpigot-Server/src/main/java/org/spigotmc/TicksPerSecondCommand.java index d1e3dc57..18dfc22a 100644 --- a/WindSpigot-Server/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/WindSpigot-Server/src/main/java/org/spigotmc/TicksPerSecondCommand.java @@ -5,7 +5,6 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import ga.windpvp.windspigot.config.WindSpigotConfig; import net.minecraft.server.MinecraftServer; import net.minecraft.server.WorldServer; diff --git a/WindSpigot-Server/src/main/java/org/sugarcanemc/sugarcane/util/yaml/YamlUtils.java b/WindSpigot-Server/src/main/java/org/sugarcanemc/sugarcane/util/yaml/YamlUtils.java index dd5c0086..d97131a1 100644 --- a/WindSpigot-Server/src/main/java/org/sugarcanemc/sugarcane/util/yaml/YamlUtils.java +++ b/WindSpigot-Server/src/main/java/org/sugarcanemc/sugarcane/util/yaml/YamlUtils.java @@ -7,7 +7,6 @@ public class YamlUtils { public static int findKey(List lines, String key) { String[] parts = key.split("\\."); int _line = 0; - int indent = 0; List _cpath = new ArrayList<>(); for (String part : parts) { _cpath.add(part);