diff --git a/Art/Treasure/4Qq2m6x.png b/Art/Treasure/4Qq2m6x.png new file mode 100644 index 000000000..dffbceeb6 Binary files /dev/null and b/Art/Treasure/4Qq2m6x.png differ diff --git a/Art/Treasure/canc.jpg b/Art/Treasure/canc.jpg new file mode 100644 index 000000000..06fe47f9a Binary files /dev/null and b/Art/Treasure/canc.jpg differ diff --git a/Art/Treasure/xxiJkbb.png b/Art/Treasure/xxiJkbb.png new file mode 100644 index 000000000..599eabdaf Binary files /dev/null and b/Art/Treasure/xxiJkbb.png differ diff --git a/Patches/0181-Mineplex-Patches.patch b/Patches/0181-Mineplex-Patches.patch deleted file mode 100644 index c8af3d8c1..000000000 --- a/Patches/0181-Mineplex-Patches.patch +++ /dev/null @@ -1,2414 +0,0 @@ -From 52ffc1e292f4a6ead573bdfcd884c800b8c4b1a5 Mon Sep 17 00:00:00 2001 -From: Jonathan Williams -Date: Tue, 2 Sep 2014 21:54:15 -0700 -Subject: [PATCH] Mineplex Patches - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0423ee9..559693f 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -633,6 +633,10 @@ public class Chunk { - // CraftBukkit end - } - -+ ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity); -+ Bukkit.getServer().getPluginManager().callEvent(event); -+ -+ - int k = MathHelper.floor(entity.locY / 16.0D); - - if (k < 0) { -diff --git a/src/main/java/net/minecraft/server/ChunkAddEntityEvent.java b/src/main/java/net/minecraft/server/ChunkAddEntityEvent.java -new file mode 100644 -index 0000000..f3fd0e1 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ChunkAddEntityEvent.java -@@ -0,0 +1,31 @@ -+package net.minecraft.server; -+ -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ -+public class ChunkAddEntityEvent extends Event -+{ -+ private static final HandlerList handlers = new HandlerList(); -+ private org.bukkit.entity.Entity _entity; -+ -+ public ChunkAddEntityEvent(org.bukkit.entity.Entity entity) -+ { -+ _entity = entity; -+ } -+ -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+ -+ public org.bukkit.entity.Entity GetEntity() -+ { -+ return _entity; -+ } -+} -\ No newline at end of file -diff --git a/src/main/java/net/minecraft/server/ChunkPreLoadEvent.java b/src/main/java/net/minecraft/server/ChunkPreLoadEvent.java -new file mode 100644 -index 0000000..9d698f3 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ChunkPreLoadEvent.java -@@ -0,0 +1,58 @@ -+package net.minecraft.server; -+ -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ -+public class ChunkPreLoadEvent extends Event implements Cancellable -+{ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean _cancelled; -+ private org.bukkit.World _world; -+ private int _x; -+ private int _z; -+ -+ public ChunkPreLoadEvent(org.bukkit.World world, int x, int z) -+ { -+ _world = world; -+ _x = x; -+ _z = z; -+ } -+ -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+ -+ public org.bukkit.World GetWorld() -+ { -+ return _world; -+ } -+ -+ public int GetX() -+ { -+ return _x; -+ } -+ -+ public int GetZ() -+ { -+ return _z; -+ } -+ -+ @Override -+ public boolean isCancelled() -+ { -+ return _cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean arg0) -+ { -+ _cancelled = arg0; -+ } -+} -\ No newline at end of file -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 22330c3..6438052 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -114,10 +114,42 @@ public class ChunkProviderServer implements IChunkProvider { - // We can only use the queue for already generated chunks - if (chunk == null && loader != null && loader.chunkExists(this.world, i, j)) { - if (runnable != null) { -- ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); -+ Server server = this.world.getServer(); -+ -+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); -+ server.getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) -+ { -+ runnable.run(); -+ -+ chunk = new EmptyChunk(world, i, j); -+ chunk.done = true; -+ chunks.put(LongHash.toLong(i, j), chunk); -+ } -+ else -+ { -+ ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); -+ } -+ - return null; - } else { -- chunk = ChunkIOExecutor.syncChunkLoad(this.world, loader, this, i, j); -+ Server server = this.world.getServer(); -+ -+ if (server != null) -+ { -+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); -+ server.getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) -+ { -+ chunk = new EmptyChunk(world, i, j); -+ chunk.done = true; -+ chunks.put(LongHash.toLong(i, j), chunk); -+ } -+ else -+ chunk = ChunkIOExecutor.syncChunkLoad(this.world, loader, this, i, j); -+ } - } - } else if (chunk == null) { - chunk = this.originalGetChunkAt(i, j); -@@ -136,6 +168,23 @@ public class ChunkProviderServer implements IChunkProvider { - Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j)); - boolean newChunk = false; - -+ Server server = this.world.getServer(); -+ -+ if (chunk == null && server != null) -+ { -+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); -+ server.getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) -+ { -+ chunk = new EmptyChunk(world, i, j); -+ chunk.done = true; -+ chunks.put(LongHash.toLong(i, j), chunk); -+ -+ return chunk; -+ } -+ } -+ - if (chunk == null) { - world.timings.syncChunkLoadTimer.startTiming(); // Spigot - chunk = this.loadChunk(i, j); -@@ -162,7 +211,6 @@ public class ChunkProviderServer implements IChunkProvider { - chunk.addEntities(); - - // CraftBukkit start -- Server server = this.world.getServer(); - if (server != null) { - /* - * If it's a new world, the first few chunks are generated inside -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 9cc0526..337e962 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -78,63 +78,50 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support - this.n = new EULA(new File("eula.txt")); - // Spigot Start -- boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); -- if ( eulaAgreed ) -- { -- System.err.println( "You have used the Spigot command line EULA agreement flag." ); -- System.err.println( "By using this setting you are indicating your agreement to Mojang's EULA (https://account.mojang.com/documents/minecraft_eula)." ); -- System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); -- } -- // Spigot End -- if (!this.n.a() && !eulaAgreed) { -- i.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); -- this.n.b(); -- return false; -- } else { -- if (this.N()) { -- this.c("127.0.0.1"); -- } else { -- this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true)); -- this.c(this.propertyManager.getString("server-ip", "")); -- } -- -- this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true)); -- this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true)); -- this.setPvP(this.propertyManager.getBoolean("pvp", true)); -- this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false)); -- this.setTexturePack(this.propertyManager.getString("resource-pack", "")); -- this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server")); -- this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false)); -- this.setIdleTimeout(this.propertyManager.getInt("player-idle-timeout", 0)); -- if (this.propertyManager.getInt("difficulty", 1) < 0) { -- this.propertyManager.setProperty("difficulty", Integer.valueOf(0)); -- } else if (this.propertyManager.getInt("difficulty", 1) > 3) { -- this.propertyManager.setProperty("difficulty", Integer.valueOf(3)); -- } -- -- this.generateStructures = this.propertyManager.getBoolean("generate-structures", true); -- int gamemode = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.getId()); // CraftBukkit - Unique name to avoid stomping on logger -- -- this.p = WorldSettings.a(gamemode); // CraftBukkit - Use new name -- i.info("Default game type: " + this.p); -- InetAddress inetaddress = null; -- -- if (this.getServerIp().length() > 0) { -- inetaddress = InetAddress.getByName(this.getServerIp()); -- } -- -- if (this.L() < 0) { -- this.setPort(this.propertyManager.getInt("server-port", 25565)); -- } -- // Spigot start -- this.a((PlayerList) (new DedicatedPlayerList(this))); -- org.spigotmc.SpigotConfig.init(); -- org.spigotmc.SpigotConfig.registerCommands(); -- // Spigot end -- -- i.info("Generating keypair"); -- this.a(MinecraftEncryption.b()); -- i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L()); -+ if (this.N()) { -+ this.c("127.0.0.1"); -+ } else { -+ this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true)); -+ this.c(this.propertyManager.getString("server-ip", "")); -+ } -+ -+ this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true)); -+ this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true)); -+ this.setPvP(this.propertyManager.getBoolean("pvp", true)); -+ this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false)); -+ this.setTexturePack(this.propertyManager.getString("resource-pack", "")); -+ this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server")); -+ this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false)); -+ this.setIdleTimeout(this.propertyManager.getInt("player-idle-timeout", 0)); -+ if (this.propertyManager.getInt("difficulty", 1) < 0) { -+ this.propertyManager.setProperty("difficulty", Integer.valueOf(0)); -+ } else if (this.propertyManager.getInt("difficulty", 1) > 3) { -+ this.propertyManager.setProperty("difficulty", Integer.valueOf(3)); -+ } -+ -+ this.generateStructures = this.propertyManager.getBoolean("generate-structures", true); -+ int gamemode = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.getId()); // CraftBukkit - Unique name to avoid stomping on logger -+ -+ this.p = WorldSettings.a(gamemode); // CraftBukkit - Use new name -+ i.info("Default game type: " + this.p); -+ InetAddress inetaddress = null; -+ -+ if (this.getServerIp().length() > 0) { -+ inetaddress = InetAddress.getByName(this.getServerIp()); -+ } -+ -+ if (this.L() < 0) { -+ this.setPort(this.propertyManager.getInt("server-port", 25565)); -+ } -+ // Spigot start -+ this.a((PlayerList) (new DedicatedPlayerList(this))); -+ org.spigotmc.SpigotConfig.init(); -+ org.spigotmc.SpigotConfig.registerCommands(); -+ // Spigot end -+ -+ i.info("Generating keypair"); -+ this.a(MinecraftEncryption.b()); -+ i.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.L()); - - if (!org.spigotmc.SpigotConfig.lateBind) { - try { -@@ -147,93 +134,93 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - } - -- // Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here -- // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit -- server.loadPlugins(); -- server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP); -- // Spigot End -- -- if (!this.getOnlineMode()) { -- i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); -- i.warn("The server will make no attempt to authenticate usernames. Beware."); -- i.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); -- i.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); -- } -- -- if (this.aE()) { -- this.getUserCache().c(); -- } -- -- if (!NameReferencingFileConverter.a(this.propertyManager)) { -- return false; -- } else { -- // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up -- this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor -- long j = System.nanoTime(); -- -- if (this.O() == null) { -- this.k(this.propertyManager.getString("level-name", "world")); -- } -- -- 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(); -- -- if (s.length() > 0) { -- try { -- long l = Long.parseLong(s); -- -- if (l != 0L) { -- k = l; -- } -- } catch (NumberFormatException numberformatexception) { -- k = (long) s.hashCode(); -- } -- } -- -- WorldType worldtype = WorldType.getType(s1); -- -- if (worldtype == null) { -- worldtype = WorldType.NORMAL; -- } -- -- this.at(); -- this.getEnableCommandBlock(); -- this.l(); -- this.getSnooperEnabled(); -- this.c(this.propertyManager.getInt("max-build-height", 256)); -- this.c((this.getMaxBuildHeight() + 8) / 16 * 16); -- this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256)); -- this.propertyManager.setProperty("max-build-height", Integer.valueOf(this.getMaxBuildHeight())); -- i.info("Preparing level \"" + this.O() + "\""); -- this.a(this.O(), this.O(), k, worldtype, s2); -- long i1 = System.nanoTime() - j; -- String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)}); -- -- i.info("Done (" + s3 + ")! For help, type \"help\" or \"?\""); -- if (this.propertyManager.getBoolean("enable-query", false)) { -- i.info("Starting GS4 status listener"); -- this.k = new RemoteStatusListener(this); -- this.k.a(); -- } -- -- if (this.propertyManager.getBoolean("enable-rcon", false)) { -- i.info("Starting remote control listener"); -- this.l = new RemoteControlListener(this); -- this.l.a(); -- this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit -- } -- -- // CraftBukkit start -- if (this.server.getBukkitSpawnRadius() > -1) { -- i.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you."); -- this.propertyManager.properties.remove("spawn-protection"); -- this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius()); -- this.server.removeBukkitSpawnRadius(); -- this.propertyManager.savePropertiesFile(); -- } -- // CraftBukkit end -+ // Spigot Start - Move DedicatedPlayerList up and bring plugin loading from CraftServer to here -+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit -+ server.loadPlugins(); -+ server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP); -+ // Spigot End -+ -+ if (!this.getOnlineMode()) { -+ i.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); -+ i.warn("The server will make no attempt to authenticate usernames. Beware."); -+ i.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); -+ i.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); -+ } -+ -+ if (this.aE()) { -+ this.getUserCache().c(); -+ } -+ -+ if (!NameReferencingFileConverter.a(this.propertyManager)) { -+ return false; -+ } else { -+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up -+ this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor -+ long j = System.nanoTime(); -+ -+ if (this.O() == null) { -+ this.k(this.propertyManager.getString("level-name", "world")); -+ } -+ -+ 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(); -+ -+ if (s.length() > 0) { -+ try { -+ long l = Long.parseLong(s); -+ -+ if (l != 0L) { -+ k = l; -+ } -+ } catch (NumberFormatException numberformatexception) { -+ k = (long) s.hashCode(); -+ } -+ } -+ -+ WorldType worldtype = WorldType.getType(s1); -+ -+ if (worldtype == null) { -+ worldtype = WorldType.NORMAL; -+ } -+ -+ this.at(); -+ this.getEnableCommandBlock(); -+ this.l(); -+ this.getSnooperEnabled(); -+ this.c(this.propertyManager.getInt("max-build-height", 256)); -+ this.c((this.getMaxBuildHeight() + 8) / 16 * 16); -+ this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256)); -+ this.propertyManager.setProperty("max-build-height", Integer.valueOf(this.getMaxBuildHeight())); -+ i.info("Preparing level \"" + this.O() + "\""); -+ this.a(this.O(), this.O(), k, worldtype, s2); -+ long i1 = System.nanoTime() - j; -+ String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)}); -+ -+ i.info("Done (" + s3 + ")! For help, type \"help\" or \"?\""); -+ if (this.propertyManager.getBoolean("enable-query", false)) { -+ i.info("Starting GS4 status listener"); -+ this.k = new RemoteStatusListener(this); -+ this.k.a(); -+ } -+ -+ if (this.propertyManager.getBoolean("enable-rcon", false)) { -+ i.info("Starting remote control listener"); -+ this.l = new RemoteControlListener(this); -+ this.l.a(); -+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit -+ } -+ -+ // CraftBukkit start -+ if (this.server.getBukkitSpawnRadius() > -1) { -+ i.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you."); -+ this.propertyManager.properties.remove("spawn-protection"); -+ this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius()); -+ this.server.removeBukkitSpawnRadius(); -+ this.propertyManager.savePropertiesFile(); -+ } -+ // CraftBukkit end - - if (org.spigotmc.SpigotConfig.lateBind) { - try { -@@ -246,7 +233,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - } - return true; -- } - } - } - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index dea5e19..9253cd4 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -123,6 +123,9 @@ public abstract class Entity { - public void inactiveTick() { } - // Spigot end - -+ public boolean Silent; -+ public boolean Invisible; -+ - public int getId() { - return this.id; - } -@@ -692,7 +695,9 @@ public abstract class Entity { - this.makeSound(this.H(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); - } - -- this.a(l, k, i1, block); -+ if (!Silent) -+ this.a(l, k, i1, block); -+ - block.b(this.world, l, k, i1, this); - } - } -@@ -788,7 +793,8 @@ public abstract class Entity { - } - - public void makeSound(String s, float f, float f1) { -- this.world.makeSound(this, s, f, f1); -+ if (!Silent) -+ this.world.makeSound(this, s, f, f1); - } - - protected boolean g_() { -@@ -1446,8 +1452,8 @@ public abstract class Entity { - if (entity == null) { - if (this.vehicle != null) { - // CraftBukkit start -- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) { -- VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); -+ if ((this.bukkitEntity instanceof LivingEntity)) { -+ VehicleExitEvent event = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); - pluginManager.callEvent(event); - - if (event.isCancelled() || this.vehicle != originalVehicle) { -@@ -1464,11 +1470,11 @@ public abstract class Entity { - this.vehicle = null; - } else { - // CraftBukkit start -- if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4)) { -+ if ((this.bukkitEntity instanceof LivingEntity) && (entity instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4)) { - // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. - VehicleExitEvent exitEvent = null; - if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) { -- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); -+ exitEvent = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); - pluginManager.callEvent(exitEvent); - - if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) { -@@ -1584,6 +1590,9 @@ public abstract class Entity { - } - - public void setInvisible(boolean flag) { -+ if (Invisible && !flag) -+ return; -+ - this.a(5, flag); - } - -diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java -new file mode 100644 -index 0000000..dcf0a2e ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityBat.java -@@ -0,0 +1,260 @@ -+package net.minecraft.server; -+ -+import java.util.Calendar; -+import java.util.Random; -+ -+import net.minecraft.server.ChunkCoordinates; -+import net.minecraft.server.DamageSource; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityAmbient; -+import net.minecraft.server.GenericAttributes; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.NBTTagCompound; -+import net.minecraft.server.World; -+ -+public class EntityBat extends EntityAmbient -+{ -+ private ChunkCoordinates h; -+ -+ public boolean Vegetated = false; -+ -+ public EntityBat(World paramWorld) -+ { -+ super(paramWorld); -+ -+ a(0.5F, 0.9F); -+ setAsleep(true); -+ } -+ -+ protected void c() -+ { -+ super.c(); -+ -+ this.datawatcher.a(16, new Byte((byte) 0)); -+ } -+ -+ protected float bf() -+ { -+ return 0.1F; -+ } -+ -+ protected float bg() -+ { -+ return super.bg() * 0.95F; -+ } -+ -+ protected String t() -+ { -+ if ((isAsleep()) && (this.random.nextInt(4) != 0)) -+ { -+ return null; -+ } -+ return "mob.bat.idle"; -+ } -+ -+ protected String aT() -+ { -+ return "mob.bat.hurt"; -+ } -+ -+ protected String aU() -+ { -+ return "mob.bat.death"; -+ } -+ -+ public boolean S() -+ { -+ return false; -+ } -+ -+ protected void o(Entity paramEntity) -+ { -+ } -+ -+ protected void bo() -+ { -+ } -+ -+ protected void aD() -+ { -+ super.aD(); -+ -+ getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D); -+ } -+ -+ public boolean isAsleep() -+ { -+ return (this.datawatcher.getByte(16) & 0x1) != 0; -+ } -+ -+ public void setAsleep(boolean paramBoolean) -+ { -+ int i = this.datawatcher.getByte(16); -+ if (paramBoolean) -+ { -+ this.datawatcher.watch(16, Byte.valueOf((byte) (i | 0x1))); -+ } -+ else -+ { -+ this.datawatcher.watch(16, Byte.valueOf((byte) (i & 0xFFFFFFFE))); -+ } -+ } -+ -+ protected boolean bk() -+ { -+ return true; -+ } -+ -+ public void h() -+ { -+ super.h(); -+ -+ if (Vegetated) -+ return; -+ -+ if (isAsleep()) -+ { -+ this.motX = (this.motY = this.motZ = 0.0D); -+ this.locY = (MathHelper.floor(this.locY) + 1.0D - this.length); -+ } -+ else -+ { -+ this.motY *= 0.6000000238418579D; -+ } -+ } -+ -+ protected void bn() -+ { -+ super.bn(); -+ -+ if (Vegetated) -+ return; -+ -+ if (isAsleep()) -+ { -+ if (!this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1, MathHelper.floor(this.locZ)).r()) -+ { -+ setAsleep(false); -+ this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0); -+ } -+ else -+ { -+ if (this.random.nextInt(200) == 0) -+ { -+ this.aO = this.random.nextInt(360); -+ } -+ if (this.world.findNearbyPlayer(this, 4.0D) != null) -+ { -+ setAsleep(false); -+ this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0); -+ } -+ } -+ } -+ else -+ { -+ if ((this.h != null) && ((!this.world.isEmpty(this.h.x, this.h.y, this.h.z)) || (this.h.y < 1))) -+ { -+ this.h = null; -+ } -+ if ((this.h == null) || (this.random.nextInt(30) == 0) -+ || (this.h.e((int) this.locX, (int) this.locY, (int) this.locZ) < 4.0F)) -+ { -+ this.h = new ChunkCoordinates((int) this.locX + this.random.nextInt(7) - this.random.nextInt(7), -+ (int) this.locY + this.random.nextInt(6) - 2, (int) this.locZ + this.random.nextInt(7) -+ - this.random.nextInt(7)); -+ } -+ double d1 = this.h.x + 0.5D - this.locX; -+ double d2 = this.h.y + 0.1D - this.locY; -+ double d3 = this.h.z + 0.5D - this.locZ; -+ -+ this.motX += (Math.signum(d1) * 0.5D - this.motX) * 0.1000000014901161D; -+ this.motY += (Math.signum(d2) * 0.699999988079071D - this.motY) * 0.1000000014901161D; -+ this.motZ += (Math.signum(d3) * 0.5D - this.motZ) * 0.1000000014901161D; -+ -+ float f1 = (float) (Math.atan2(this.motZ, this.motX) * 180.0D / 3.141592741012573D) - 90.0F; -+ float f2 = MathHelper.g(f1 - this.yaw); -+ this.be = 0.5F; -+ this.yaw += f2; -+ if ((this.random.nextInt(100) == 0) -+ && (this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1, -+ MathHelper.floor(this.locZ)).r())) -+ { -+ setAsleep(true); -+ } -+ } -+ } -+ -+ protected boolean g_() -+ { -+ return false; -+ } -+ -+ protected void b(float paramFloat) -+ { -+ } -+ -+ protected void a(double paramDouble, boolean paramBoolean) -+ { -+ } -+ -+ public boolean az() -+ { -+ return true; -+ } -+ -+ public boolean damageEntity(DamageSource paramDamageSource, float paramFloat) -+ { -+ if (isInvulnerable()) -+ { -+ return false; -+ } -+ if ((!this.world.isStatic) && (isAsleep()) && !Vegetated) -+ { -+ setAsleep(false); -+ } -+ return super.damageEntity(paramDamageSource, paramFloat); -+ } -+ -+ public void a(NBTTagCompound paramNBTTagCompound) -+ { -+ super.a(paramNBTTagCompound); -+ -+ this.datawatcher.watch(16, Byte.valueOf(paramNBTTagCompound.getByte("BatFlags"))); -+ } -+ -+ public void b(NBTTagCompound paramNBTTagCompound) -+ { -+ super.b(paramNBTTagCompound); -+ -+ paramNBTTagCompound.setByte("BatFlags", this.datawatcher.getByte(16)); -+ } -+ -+ public boolean canSpawn() -+ { -+ int i = MathHelper.floor(this.boundingBox.b); -+ if (i >= 63) -+ { -+ return false; -+ } -+ int j = MathHelper.floor(this.locX); -+ int k = MathHelper.floor(this.locZ); -+ -+ int m = this.world.getLightLevel(j, i, k); -+ int n = 4; -+ Calendar localCalendar = this.world.V(); -+ if (((localCalendar.get(2) + 1 == 10) && (localCalendar.get(5) >= 20)) -+ || ((localCalendar.get(2) + 1 == 11) && (localCalendar.get(5) <= 3))) -+ { -+ n = 7; -+ } -+ else if (this.random.nextBoolean()) -+ { -+ return false; -+ } -+ if (m > this.random.nextInt(n)) -+ { -+ return false; -+ } -+ return super.canSpawn(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java -new file mode 100644 -index 0000000..2868ffa ---- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityBlaze.java -@@ -0,0 +1,202 @@ -+package net.minecraft.server; -+ -+import java.util.Random; -+ -+import net.minecraft.server.DamageSource; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityMonster; -+import net.minecraft.server.EntitySmallFireball; -+import net.minecraft.server.GenericAttributes; -+import net.minecraft.server.Item; -+import net.minecraft.server.Items; -+import net.minecraft.server.MathHelper; -+import net.minecraft.server.World; -+ -+public class EntityBlaze extends EntityMonster -+{ -+ private float bp = 0.5F; -+ private int bq; -+ private int br; -+ -+ public EntityBlaze(World paramWorld) -+ { -+ super(paramWorld); -+ -+ this.fireProof = true; -+ this.b = 10; -+ } -+ -+ protected void aD() -+ { -+ super.aD(); -+ getAttributeInstance(GenericAttributes.e).setValue(6.0D); -+ } -+ -+ protected void c() -+ { -+ super.c(); -+ -+ this.datawatcher.a(16, new Byte((byte) 0)); -+ } -+ -+ protected String t() -+ { -+ return "mob.blaze.breathe"; -+ } -+ -+ protected String aT() -+ { -+ return "mob.blaze.hit"; -+ } -+ -+ protected String aU() -+ { -+ return "mob.blaze.death"; -+ } -+ -+ public float d(float paramFloat) -+ { -+ return 1.0F; -+ } -+ -+ public void e() -+ { -+ if (!this.world.isStatic) -+ { -+ if (L()) -+ { -+ damageEntity(DamageSource.DROWN, 1.0F); -+ } -+ this.bq -= 1; -+ if (this.bq <= 0) -+ { -+ this.bq = 100; -+ this.bp = (0.5F + (float) this.random.nextGaussian() * 3.0F); -+ } -+ if ((bT() != null) && (bT().locY + bT().getHeadHeight() > this.locY + getHeadHeight() + this.bp)) -+ { -+ this.motY += (0.300000011920929D - this.motY) * 0.300000011920929D; -+ } -+ } -+ if (this.random.nextInt(24) == 0) -+ { -+ this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", -+ 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F); -+ } -+ if (!Vegetated && (!this.onGround) && (this.motY < 0.0D)) -+ { -+ this.motY *= 0.6D; -+ } -+ for (int i = 0; i < 2; i++) -+ { -+ this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * this.width, this.locY -+ + this.random.nextDouble() * this.length, this.locZ + (this.random.nextDouble() - 0.5D) -+ * this.width, 0.0D, 0.0D, 0.0D); -+ } -+ super.e(); -+ } -+ -+ protected void a(Entity paramEntity, float paramFloat) -+ { -+ if (Vegetated) -+ return; -+ -+ if ((this.attackTicks <= 0) && (paramFloat < 2.0F) && (paramEntity.boundingBox.e > this.boundingBox.b) -+ && (paramEntity.boundingBox.b < this.boundingBox.e)) -+ { -+ this.attackTicks = 20; -+ n(paramEntity); -+ } -+ else if (paramFloat < 30.0F) -+ { -+ double d1 = paramEntity.locX - this.locX; -+ double d2 = paramEntity.boundingBox.b + paramEntity.length / 2.0F - (this.locY + this.length / 2.0F); -+ double d3 = paramEntity.locZ - this.locZ; -+ if (this.attackTicks == 0) -+ { -+ this.br += 1; -+ if (this.br == 1) -+ { -+ this.attackTicks = 60; -+ a(true); -+ } -+ else if (this.br <= 4) -+ { -+ this.attackTicks = 6; -+ } -+ else -+ { -+ this.attackTicks = 100; -+ this.br = 0; -+ a(false); -+ } -+ if (this.br > 1) -+ { -+ float f = MathHelper.c(paramFloat) * 0.5F; -+ -+ this.world.a(null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0); -+ for (int i = 0; i < 1; i++) -+ { -+ EntitySmallFireball localEntitySmallFireball = new EntitySmallFireball(this.world, this, d1 -+ + this.random.nextGaussian() * f, d2, d3 + this.random.nextGaussian() * f); -+ localEntitySmallFireball.locY = (this.locY + this.length / 2.0F + 0.5D); -+ this.world.addEntity(localEntitySmallFireball); -+ } -+ } -+ } -+ this.yaw = ((float) (Math.atan2(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F); -+ -+ this.bn = true; -+ } -+ } -+ -+ protected void b(float paramFloat) -+ { -+ } -+ -+ protected Item getLoot() -+ { -+ return Items.BLAZE_ROD; -+ } -+ -+ public boolean isBurning() -+ { -+ return bZ(); -+ } -+ -+ protected void dropDeathLoot(boolean paramBoolean, int paramInt) -+ { -+ if (paramBoolean) -+ { -+ int i = this.random.nextInt(2 + paramInt); -+ for (int j = 0; j < i; j++) -+ { -+ a(Items.BLAZE_ROD, 1); -+ } -+ } -+ } -+ -+ public boolean bZ() -+ { -+ return (this.datawatcher.getByte(16) & 0x1) != 0; -+ } -+ -+ public void a(boolean paramBoolean) -+ { -+ byte b = this.datawatcher.getByte(16); -+ if (paramBoolean) -+ { -+ b = (byte) (b | 0x1); -+ } -+ else -+ { -+ b = (byte) (b & 0xFFFFFFFE); -+ } -+ this.datawatcher.watch(16, Byte.valueOf(b)); -+ } -+ -+ protected boolean j_() -+ { -+ return true; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 5d761aa..f64a7e5 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -38,6 +38,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - public EntityEnderCrystal bC; - private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() - -+ public boolean Vegetated = false; -+ - public EntityEnderDragon(World world) { - super(world); - this.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = new EntityComplexPart(this, "wing", 4.0F, 4.0F)}; -@@ -163,7 +165,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - this.bm += this.random.nextGaussian() * 2.0D; - } - -- if (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.F) { -+ if (!Vegetated && this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.F) { - this.bQ(); - } - -@@ -251,7 +253,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - this.bv.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); - this.bw.h(); - this.bw.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); -- if (!this.world.isStatic && this.hurtTicks == 0) { -+ if (!this.world.isStatic && this.hurtTicks == 0 && !ghost) { - this.a(this.world.getEntities(this, this.bv.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); - this.a(this.world.getEntities(this, this.bw.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); - this.b(this.world.getEntities(this, this.bq.boundingBox.grow(1.0D, 1.0D, 1.0D))); -@@ -369,6 +371,19 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo - } - } - -+ public void setTargetBlock(int x, int y, int z) -+ { -+ this.h = x; -+ this.i = y; -+ this.bm = z; -+ this.bD = null; -+ } -+ -+ public void setTargetEntity(Entity entity) -+ { -+ this.bD = entity; -+ } -+ - private void bQ() { - this.bz = false; - if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 87afc9c..b9a2b3a 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -52,6 +52,9 @@ public class EntityEnderman extends EntityMonster { - } - - protected Entity findTarget() { -+ if (Vegetated) -+ return null; -+ - EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D); - - if (entityhuman != null) { -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index df602bd..a8ad2c4 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity { - private float fallHurtAmount; - public NBTTagCompound tileEntityData; - -+ public boolean spectating; -+ - public EntityFallingBlock(World world) { - super(world); - this.dropItem = true; -@@ -54,7 +56,15 @@ public class EntityFallingBlock extends Entity { - protected void c() {} - - public boolean R() { -- return !this.dead; -+ return !this.dead && !spectating; -+ } -+ -+ @Override -+ public boolean damageEntity(DamageSource damagesource, float f) -+ { -+ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f); -+ -+ return true; - } - - public void h() { -diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index e9f6236..8253ec9 100644 ---- a/src/main/java/net/minecraft/server/EntityHorse.java -+++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -115,6 +115,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { - private void b(int i, boolean flag) { - int j = this.datawatcher.getInt(16); - -+ if (Vegetated) -+ return; -+ - if (flag) { - this.datawatcher.watch(16, Integer.valueOf(j | i)); - } else { -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 5bb7295..595f15f 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -124,7 +124,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen - if (this.f != null) { - ItemStack itemstack = this.inventory.getItemInHand(); - -- if (itemstack == this.f) { -+ if (ItemStack.equals(itemstack, this.f)) { - if (this.g <= 25 && this.g % 4 == 0) { - this.c(itemstack, 5); - } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 617f7d4..8781438 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -34,6 +34,10 @@ public abstract class EntityInsentient extends EntityLiving { - private Entity bw; - private NBTTagCompound bx; - -+ public boolean Vegetated; -+ public boolean BreakLeash = true; -+ public boolean PullWhileLeashed = true; -+ - public EntityInsentient(World world) { - super(world); - this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null); -@@ -114,7 +118,7 @@ public abstract class EntityInsentient extends EntityLiving { - public void C() { - super.C(); - this.world.methodProfiler.a("mobBaseTick"); -- if (this.isAlive() && this.random.nextInt(1000) < this.a_++) { -+ if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) { - this.a_ = -this.q(); - this.r(); - } -@@ -774,7 +778,7 @@ public abstract class EntityInsentient extends EntityLiving { - } - - public final boolean c(EntityHuman entityhuman) { -- if (this.bN() && this.getLeashHolder() == entityhuman) { -+ if (this.bN() && this.getLeashHolder() == entityhuman && BreakLeash) { - // CraftBukkit start - fire PlayerUnleashEntityEvent - if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); -@@ -834,7 +838,7 @@ public abstract class EntityInsentient extends EntityLiving { - } - - public void unleash(boolean flag, boolean flag1) { -- if (this.bv) { -+ if (this.bv && BreakLeash) { - this.bv = false; - this.bw = null; - if (!this.world.isStatic && flag1) { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 546b952..881b87f 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -91,6 +91,7 @@ public abstract class EntityLiving extends Entity { - ++this.aU; // Above all the floats - } - // Spigot end -+ public boolean ghost; - - public EntityLiving(World world) { - super(world); -@@ -1699,7 +1700,7 @@ public abstract class EntityLiving extends Entity { - } - - public boolean S() { -- return !this.dead; -+ return !ghost && !this.dead; - } - - public float getHeadHeight() { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 6e80242..7eb8f94 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -71,7 +71,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - @Override - public boolean R() - { -- return this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving) -+ return !spectating && this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving) - } - - @Override -@@ -81,6 +81,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - // Spigot end - -+ public boolean spectating; // Mineplex -+ - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, gameprofile); - playerinteractmanager.player = this; -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index 65cd24d..60423f2 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -109,6 +109,10 @@ public class EntitySlime extends EntityInsentient implements IMonster { - - protected void bq() { - this.w(); -+ -+ if (Vegetated) -+ return; -+ - // CraftBukkit start - Entity entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // EntityHuman -> Entity - EntityTargetEvent event = null; -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 2214660..0905078 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -9,6 +9,8 @@ public class EntityTNTPrimed extends Entity { - public float yield = 4; // CraftBukkit - add field - public boolean isIncendiary = false; // CraftBukkit - add field - -+ public boolean spectating = false; -+ - public EntityTNTPrimed(World world) { - super(world); - this.k = true; -@@ -38,7 +40,7 @@ public class EntityTNTPrimed extends Entity { - } - - public boolean R() { -- return !this.dead; -+ return !this.dead && !spectating; - } - - public void h() { -diff --git a/src/main/java/net/minecraft/server/IPacketVerifier.java b/src/main/java/net/minecraft/server/IPacketVerifier.java -new file mode 100644 -index 0000000..4a61c32 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/IPacketVerifier.java -@@ -0,0 +1,6 @@ -+package net.minecraft.server; -+ -+public interface IPacketVerifier -+{ -+ boolean verify(Packet packet); -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java -index 43df03a..5e34263 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java -@@ -2,7 +2,7 @@ package net.minecraft.server; - - public class PacketPlayInCloseWindow extends Packet { - -- private int a; -+ public int a; - - public PacketPlayInCloseWindow() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java -new file mode 100644 -index 0000000..72eba15 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java -@@ -0,0 +1,42 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutAnimation extends Packet -+{ -+ public int a; -+ public int b; -+ -+ public PacketPlayOutAnimation() {} -+ -+ public PacketPlayOutAnimation(Entity paramEntity, int paramInt) -+ { -+ this.a = paramEntity.getId(); -+ this.b = paramInt; -+ } -+ -+ public void a(PacketDataSerializer paramPacketDataSerializer) -+ { -+ this.a = paramPacketDataSerializer.a(); -+ this.b = paramPacketDataSerializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer paramPacketDataSerializer) -+ { -+ paramPacketDataSerializer.b(this.a); -+ paramPacketDataSerializer.writeByte(this.b); -+ } -+ -+ public void a(PacketPlayOutListener paramPacketPlayOutListener) -+ { -+ paramPacketPlayOutListener.a(this); -+ } -+ -+ public String b() -+ { -+ return String.format("id=%d, type=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b) }); -+ } -+ -+@Override -+public void handle(PacketListener arg0) -+{ -+} -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java -new file mode 100644 -index 0000000..c182fae ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java -@@ -0,0 +1,41 @@ -+package net.minecraft.server; -+ -+public class PacketPlayOutAttachEntity extends Packet -+{ -+ public int a; -+ public int b; -+ public int c; -+ -+ public PacketPlayOutAttachEntity() {} -+ -+ public PacketPlayOutAttachEntity(int paramInt, Entity paramEntity1, Entity paramEntity2) -+ { -+ this.a = paramInt; -+ this.b = paramEntity1.getId(); -+ this.c = (paramEntity2 != null ? paramEntity2.getId() : -1); -+ } -+ -+ public void a(PacketDataSerializer paramPacketDataSerializer) -+ { -+ this.b = paramPacketDataSerializer.readInt(); -+ this.c = paramPacketDataSerializer.readInt(); -+ this.a = paramPacketDataSerializer.readUnsignedByte(); -+ } -+ -+ public void b(PacketDataSerializer paramPacketDataSerializer) -+ { -+ paramPacketDataSerializer.writeInt(this.b); -+ paramPacketDataSerializer.writeInt(this.c); -+ paramPacketDataSerializer.writeByte(this.a); -+ } -+ -+ public void a(PacketPlayOutListener paramPacketPlayOutListener) -+ { -+ paramPacketPlayOutListener.a(this); -+ } -+ -+@Override -+public void handle(PacketListener arg0) -+{ -+} -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -index 749b32d..be48529 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -2,13 +2,13 @@ package net.minecraft.server; - - public class PacketPlayOutEntity extends Packet { - -- protected int a; -- protected byte b; -- protected byte c; -- protected byte d; -- protected byte e; -- protected byte f; -- protected boolean g; -+ public int a; -+ public byte b; -+ public byte c; -+ public byte d; -+ public byte e; -+ public byte f; -+ public boolean g; - - public PacketPlayOutEntity() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -index 1ca4f08..d5376f4 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java -@@ -2,9 +2,9 @@ package net.minecraft.server; - - public class PacketPlayOutEntityEquipment extends Packet { - -- private int a; -- private int b; -- private ItemStack c; -+ public int a; -+ public int b; -+ public ItemStack c; - - public PacketPlayOutEntityEquipment() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -index c937f59..06e933f 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java -@@ -4,8 +4,8 @@ import java.util.List; - - public class PacketPlayOutEntityMetadata extends Packet { - -- private int a; -- private List b; -+ public int a; -+ public List b; - - public PacketPlayOutEntityMetadata() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -index 87260d5..a499083 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java -@@ -2,12 +2,12 @@ package net.minecraft.server; - - public class PacketPlayOutEntityTeleport extends Packet { - -- private int a; -- private int b; -- private int c; -- private int d; -- private byte e; -- private byte f; -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ public byte e; -+ public byte f; - private boolean onGround; // Spigot - protocol patch - - public PacketPlayOutEntityTeleport() {} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -index 170f27f..d43f5d8 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java -@@ -2,10 +2,10 @@ package net.minecraft.server; - - public class PacketPlayOutEntityVelocity extends Packet { - -- private int a; -- private int b; -- private int c; -- private int d; -+ public int a; -+ public int b; -+ public int c; -+ public int d; - - public PacketPlayOutEntityVelocity() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -index 80857c9..7e06d42 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -@@ -11,16 +11,16 @@ import java.io.IOException; // CraftBukkit - - public class PacketPlayOutNamedEntitySpawn extends Packet { - -- private int a; -- private GameProfile b; -- private int c; -- private int d; -- private int e; -- private byte f; -- private byte g; -- private int h; -- private DataWatcher i; -- private List j; -+ public int a; -+ public GameProfile b; -+ public int c; -+ public int d; -+ public int e; -+ public byte f; -+ public byte g; -+ public int h; -+ public DataWatcher i; -+ public List j; - - public PacketPlayOutNamedEntitySpawn() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -index adb8e8f..d324bd7 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java -@@ -9,19 +9,19 @@ import org.bukkit.craftbukkit.util.CraftChatMessage; - - public class PacketPlayOutPlayerInfo extends Packet { - -- private static final int ADD_PLAYER = 0; -- private static final int UPDATE_GAMEMODE = 1; -- private static final int UPDATE_LATENCY = 2; -- private static final int UPDATE_DISPLAY_NAME = 3; -- private static final int REMOVE_PLAYER = 4; -+ public static final int ADD_PLAYER = 0; -+ public static final int UPDATE_GAMEMODE = 1; -+ public static final int UPDATE_LATENCY = 2; -+ public static final int UPDATE_DISPLAY_NAME = 3; -+ public static final int REMOVE_PLAYER = 4; - -- private int action; -+ public int action; - // private int length; We don't batch (yet) -- private GameProfile player; -+ public GameProfile player; - -- private int gamemode; -- private int ping; -- private String username; -+ public int gamemode; -+ public int ping; -+ public String username; - - public PacketPlayOutPlayerInfo() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -index dcf1204..37b685c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java -@@ -2,17 +2,17 @@ package net.minecraft.server; - - public class PacketPlayOutSpawnEntity extends Packet { - -- private int a; -- private int b; -- private int c; -- private int d; -- private int e; -- private int f; -- private int g; -- private int h; -- private int i; -- private int j; -- private int k; -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ public int e; -+ public int f; -+ public int g; -+ public int h; -+ public int i; -+ public int j; -+ public int k; - - public PacketPlayOutSpawnEntity() {} - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -index 98b4d97..0edd03a 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java -@@ -4,19 +4,19 @@ import java.util.List; - - public class PacketPlayOutSpawnEntityLiving extends Packet { - -- private int a; -- private int b; -- private int c; -- private int d; -- private int e; -- private int f; -- private int g; -- private int h; -- private byte i; -- private byte j; -- private byte k; -- private DataWatcher l; -- private List m; -+ public int a; -+ public int b; -+ public int c; -+ public int d; -+ public int e; -+ public int f; -+ public int g; -+ public int h; -+ public byte i; -+ public byte j; -+ public byte k; -+ public DataWatcher l; -+ public List m; - - public PacketPlayOutSpawnEntityLiving() {} - -diff --git a/src/main/java/net/minecraft/server/PacketProcessor.java b/src/main/java/net/minecraft/server/PacketProcessor.java -new file mode 100644 -index 0000000..533ebfc ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketProcessor.java -@@ -0,0 +1,44 @@ -+package net.minecraft.server; -+ -+import java.util.ArrayList; -+import java.util.List; -+ -+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; -+ -+public class PacketProcessor -+{ -+ private List _packetVerifiers; -+ -+ public PacketProcessor() -+ { -+ _packetVerifiers = new ArrayList(); -+ } -+ -+ public void addPacketVerifier(IPacketVerifier verifier) -+ { -+ _packetVerifiers.add(verifier); -+ } -+ -+ public void processPacket(Packet packet, NetworkManager networkManager) -+ { -+ boolean addDefaultPacket = true; -+ -+ for (IPacketVerifier verifier : _packetVerifiers) -+ { -+ if (!verifier.verify(packet)) -+ { -+ addDefaultPacket = false; -+ } -+ } -+ -+ if (addDefaultPacket) -+ { -+ networkManager.handle(packet, new GenericFutureListener[0]); -+ } -+ } -+ -+ public void clearVerifiers() -+ { -+ _packetVerifiers.clear(); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 10faa8c..6aa0018 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -81,6 +81,8 @@ public class PlayerConnection implements PacketPlayInListener { - public boolean checkMovement = true; // CraftBukkit - private -> public - private boolean processedDisconnect; // CraftBukkit - added - -+ public PacketProcessor PacketVerifier; -+ - public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { - this.minecraftServer = minecraftserver; - this.networkManager = networkmanager; -@@ -88,6 +90,8 @@ public class PlayerConnection implements PacketPlayInListener { - this.player = entityplayer; - entityplayer.playerConnection = this; - -+ PacketVerifier = new PacketProcessor(); -+ - // CraftBukkit start - add fields and methods - this.server = minecraftserver.server; - } -@@ -800,7 +804,7 @@ public class PlayerConnection implements PacketPlayInListener { - // CraftBukkit end - - try { -- this.networkManager.handle(packet, new GenericFutureListener[0]); -+ PacketVerifier.processPacket(packet, this.networkManager); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); -@@ -1252,9 +1256,12 @@ public class PlayerConnection implements PacketPlayInListener { - public void a(PacketPlayInCloseWindow packetplayinclosewindow) { - if (this.player.dead) return; // CraftBukkit - -- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit -+ if (packetplayinclosewindow.a == player.activeContainer.windowId) -+ { -+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit - -- this.player.m(); -+ this.player.m(); -+ } - } - - public void a(PacketPlayInWindowClick packetplayinwindowclick) { -diff --git a/src/main/java/net/minecraft/server/QueuedPacket.java b/src/main/java/net/minecraft/server/QueuedPacket.java -index fdebf9d..f1c3730 100644 ---- a/src/main/java/net/minecraft/server/QueuedPacket.java -+++ b/src/main/java/net/minecraft/server/QueuedPacket.java -@@ -3,7 +3,7 @@ package net.minecraft.server; - import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; - - // CraftBukkit - imported class because the methods are package private --class QueuedPacket { -+public class QueuedPacket { - - private final Packet a; - private final GenericFutureListener[] b; -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7a547da..5a42240 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -145,7 +145,7 @@ public abstract class World implements IBlockAccess { - } - triggerHoppersList.clear(); - } -- -+ - // Helper method for altHopperTicking. Updates chests at the specified location, - // accounting for double chests. Updating the chest will update adjacent hoppers. - public void updateChestAndHoppers(int a, int b, int c) { -@@ -200,6 +200,8 @@ public abstract class World implements IBlockAccess { - - public final SpigotTimings.WorldTimingsHandler timings; // Spigot - -+ private Entity _startEntity; -+ - public CraftWorld getWorld() { - return this.world; - } -@@ -1661,13 +1663,32 @@ public abstract class World implements IBlockAccess { - - this.methodProfiler.b(); - if (flag && entity.ag && entity.passenger != null) { -- if (!entity.passenger.dead && entity.passenger.vehicle == entity) { -- this.playerJoinedWorld(entity.passenger); -- } else { -- entity.passenger.vehicle = null; -- entity.passenger = null; -- } -- } -+ if (!entity.passenger.dead && entity.passenger.vehicle == entity) { -+ if (_startEntity == null) -+ _startEntity = entity; -+ -+ this.playerJoinedWorld(entity.passenger); -+ } -+ else if (entity == _startEntity) { -+ for (StackTraceElement element : Thread.currentThread().getStackTrace()) -+ { -+ System.out.println(element); -+ } -+ -+ entity.passenger.vehicle = null; -+ entity.passenger = null; -+ _startEntity = null; -+ } -+ else { -+ entity.passenger.vehicle = null; -+ entity.passenger = null; -+ _startEntity = null; -+ } -+ } -+ else { -+ _startEntity = null; -+ } -+ - entity.tickTimer.stopTiming(); // Spigot - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ea786ae..20ab405 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1062,9 +1062,9 @@ public class CraftWorld implements World { - ( (EntityOcelot) entity ).spawnBonus = false; - } - // Spigot end -- if (entity instanceof EntityInsentient) { -- ((EntityInsentient) entity).prepare((GroupDataEntity) null); -- } -+ //if (entity instanceof EntityInsentient) { -+ // ((EntityInsentient) entity).prepare((GroupDataEntity) null); -+ //} - - world.addEntity(entity, reason); - return (T) entity.getBukkitEntity(); -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0c4976d..28ab76a 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -49,25 +49,6 @@ public class Main { - + "*** Any bug reports not running the very latest versions of these softwares will be ignored ***\n\n" ); - - Enumeration resources = Main.class.getClassLoader().getResources( "META-INF/MANIFEST.MF" ); -- while ( resources.hasMoreElements() ) -- { -- Manifest manifest = new Manifest( resources.nextElement().openStream() ); -- String ts = manifest.getMainAttributes().getValue( "Timestamp" ); -- if ( ts != null ) -- { -- Date buildDate = new SimpleDateFormat( "yyyyMMdd-hhmm" ).parse( ts ); -- -- Calendar cal = Calendar.getInstance(); -- cal.add( Calendar.DAY_OF_YEAR, -2 ); -- if ( buildDate.before(cal.getTime() ) ) -- { -- System.err.println( "WARNING: This build is more than 2 days old and there are likely updates available!" ); -- System.err.println( "You will get no support with this build unless you update from http://ci.md-5.net/job/Spigot/" ); -- System.err.println( "The server will start in 10 seconds!" ); -- Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) ); -- } -- } -- } - // Spigot End - // Todo: Installation script - OptionParser parser = new OptionParser() { -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 35f2bfa..8a6ca55 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -890,11 +890,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - } - -- public void hidePlayer(Player player) { -+ public void hidePlayer(Player player) { -+ hidePlayer(player, false, true); -+ } -+ -+ public void hidePlayer(Player player, boolean override, boolean hideList) { - Validate.notNull(player, "hidden player cannot be null"); - if (getHandle().playerConnection == null) return; - if (equals(player)) return; -- if (hiddenPlayers.contains(player.getUniqueId())) return; -+ if (!override && hiddenPlayers.contains(player.getUniqueId())) return; - hiddenPlayers.add(player.getUniqueId()); - - //remove this player from the hidden player's EntityTrackerEntry -@@ -906,6 +910,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - //remove the hidden player from this player user list -+ if (hideList) - getHandle().playerConnection.sendPacket(PacketPlayOutPlayerInfo.removePlayer( ( (CraftPlayer) player ).getHandle ())); // Spigot - protocol patch - } - -@@ -1321,17 +1326,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - - @Override -- public boolean getCollidesWithEntities() -- { -- return getHandle().collidesWithEntities; -- } -- -- @Override -- public void setCollidesWithEntities(boolean collides) -- { -- getHandle().collidesWithEntities = collides; -- getHandle().k = collides; // First boolean of Entity -- } -+ public boolean getCollidesWithEntities() -+ { -+ return !getHandle().spectating; -+ } -+ -+ @Override -+ public void setCollidesWithEntities(boolean collides) -+ { -+ getHandle().spectating = !collides; -+ getHandle().k = collides; // First boolean of Entity -+ } - - @Override - public void respawn() -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 6748465..24f5970 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -@@ -18,6 +18,7 @@ import net.minecraft.server.TileEntityDispenser; - import net.minecraft.server.TileEntityDropper; - import net.minecraft.server.TileEntityFurnace; - -+import org.bukkit.craftbukkit.inventory.MinecraftInventory; - import org.apache.commons.lang.Validate; - import org.bukkit.entity.HumanEntity; - import org.bukkit.event.inventory.InventoryType; -@@ -440,8 +441,8 @@ public class CraftInventory implements Inventory { - return InventoryType.ENCHANTING; - } else if (inventory instanceof TileEntityBrewingStand) { - return InventoryType.BREWING; -- } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) { -- return ((CraftInventoryCustom.MinecraftInventory) inventory).getType(); -+ } else if (inventory instanceof MinecraftInventory) { -+ return ((MinecraftInventory) inventory).getType(); - } else if (inventory instanceof InventoryEnderChest) { - return InventoryType.ENDER_CHEST; - } else if (inventory instanceof InventoryMerchant) { -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -index 8b8a317..6565b0f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -@@ -4,6 +4,7 @@ import java.util.ArrayList; - import java.util.List; - - import org.apache.commons.lang.Validate; -+import org.bukkit.craftbukkit.inventory.MinecraftInventory; - import org.bukkit.craftbukkit.entity.CraftHumanEntity; - import org.bukkit.entity.HumanEntity; - import org.bukkit.event.inventory.InventoryType; -@@ -29,135 +30,4 @@ public class CraftInventoryCustom extends CraftInventory { - public CraftInventoryCustom(InventoryHolder owner, int size, String title) { - super(new MinecraftInventory(owner, size, title)); - } -- -- static class MinecraftInventory implements IInventory { -- private final ItemStack[] items; -- private int maxStack = MAX_STACK; -- private final List viewers; -- private final String title; -- private InventoryType type; -- private final InventoryHolder owner; -- -- public MinecraftInventory(InventoryHolder owner, InventoryType type) { -- this(owner, type.getDefaultSize(), type.getDefaultTitle()); -- this.type = type; -- } -- -- public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { -- this(owner, type.getDefaultSize(), title); -- this.type = type; -- } -- -- public MinecraftInventory(InventoryHolder owner, int size) { -- this(owner, size, "Chest"); -- } -- -- public MinecraftInventory(InventoryHolder owner, int size, String title) { -- Validate.notNull(title, "Title cannot be null"); -- Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); -- this.items = new ItemStack[size]; -- this.title = title; -- this.viewers = new ArrayList(); -- this.owner = owner; -- this.type = InventoryType.CHEST; -- } -- -- public int getSize() { -- return items.length; -- } -- -- public ItemStack getItem(int i) { -- return items[i]; -- } -- -- public ItemStack splitStack(int i, int j) { -- ItemStack stack = this.getItem(i); -- ItemStack result; -- if (stack == null) return null; -- if (stack.count <= j) { -- this.setItem(i, null); -- result = stack; -- } else { -- result = CraftItemStack.copyNMSStack(stack, j); -- stack.count -= j; -- } -- this.update(); -- return result; -- } -- -- public ItemStack splitWithoutUpdate(int i) { -- ItemStack stack = this.getItem(i); -- ItemStack result; -- if (stack == null) return null; -- if (stack.count <= 1) { -- this.setItem(i, null); -- result = stack; -- } else { -- result = CraftItemStack.copyNMSStack(stack, 1); -- stack.count -= 1; -- } -- return result; -- } -- -- public void setItem(int i, ItemStack itemstack) { -- items[i] = itemstack; -- if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { -- itemstack.count = this.getMaxStackSize(); -- } -- } -- -- public String getInventoryName() { -- return title; -- } -- -- public int getMaxStackSize() { -- return maxStack; -- } -- -- public void setMaxStackSize(int size) { -- maxStack = size; -- } -- -- public void update() {} -- -- public boolean a(EntityHuman entityhuman) { -- return true; -- } -- -- public ItemStack[] getContents() { -- return items; -- } -- -- public void onOpen(CraftHumanEntity who) { -- viewers.add(who); -- } -- -- public void onClose(CraftHumanEntity who) { -- viewers.remove(who); -- } -- -- public List getViewers() { -- return viewers; -- } -- -- public InventoryType getType() { -- return type; -- } -- -- public void closeContainer() {} -- -- public InventoryHolder getOwner() { -- return owner; -- } -- -- public void startOpen() {} -- -- public boolean k_() { -- return false; -- } -- -- public boolean b(int i, ItemStack itemstack) { -- return true; -- } -- } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 704be69..848f748 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -22,7 +22,7 @@ import org.bukkit.inventory.meta.ItemMeta; - import com.google.common.collect.ImmutableMap; - - @DelegateDeserialization(ItemStack.class) --public final class CraftItemStack extends ItemStack { -+public class CraftItemStack extends ItemStack { - - public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) { - if (original instanceof CraftItemStack) { -@@ -95,18 +95,18 @@ public final class CraftItemStack extends ItemStack { - this.handle = item; - } - -- private CraftItemStack(ItemStack item) { -+ protected CraftItemStack(ItemStack item) { - this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null); - } - -- private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { -+ protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { - setType(type); - setAmount(amount); - setDurability(durability); - setItemMeta(itemMeta); - } - -- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { -+ protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { - this(Material.getMaterial(typeId), amount, durability, itemMeta); - - } -@@ -136,6 +136,11 @@ public final class CraftItemStack extends ItemStack { - setData(null); - } - -+ public net.minecraft.server.ItemStack getHandle() -+ { -+ return handle; -+ } -+ - @Override - public int getAmount() { - return handle != null ? handle.count : 0; -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java -new file mode 100644 -index 0000000..9102b06 ---- /dev/null -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java -@@ -0,0 +1,199 @@ -+package org.bukkit.craftbukkit.inventory; -+ -+import java.util.ArrayList; -+import java.util.List; -+ -+import org.bukkit.craftbukkit.entity.CraftHumanEntity; -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.entity.HumanEntity; -+import org.bukkit.event.inventory.InventoryType; -+import org.bukkit.inventory.InventoryHolder; -+ -+import net.minecraft.server.EntityHuman; -+import net.minecraft.server.IInventory; -+import net.minecraft.server.ItemStack; -+import net.minecraft.util.org.apache.commons.lang3.Validate; -+ -+public class MinecraftInventory implements IInventory -+{ -+ private final ItemStack[] items; -+ private int maxStack = MAX_STACK; -+ private final List viewers; -+ private String title; -+ private InventoryType type; -+ private final InventoryHolder owner; -+ -+ public MinecraftInventory(InventoryHolder owner, InventoryType type) -+ { -+ this(owner, type.getDefaultSize(), type.getDefaultTitle()); -+ this.type = type; -+ } -+ -+ public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { -+ this(owner, type.getDefaultSize(), title); -+ this.type = type; -+ } -+ -+ public MinecraftInventory(InventoryHolder owner, int size) -+ { -+ this(owner, size, "Chest"); -+ } -+ -+ public MinecraftInventory(InventoryHolder owner, int size, String title) -+ { -+ Validate.notNull(title, "Title cannot be null"); -+ Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); -+ this.items = new ItemStack[size]; -+ this.title = title; -+ this.viewers = new ArrayList(); -+ this.owner = owner; -+ this.type = InventoryType.CHEST; -+ } -+ -+ public int getSize() -+ { -+ return items.length; -+ } -+ -+ public ItemStack getItem(int i) -+ { -+ return items[i]; -+ } -+ -+ public ItemStack splitStack(int i, int j) -+ { -+ ItemStack stack = this.getItem(i); -+ ItemStack result; -+ if (stack == null) -+ return null; -+ if (stack.count <= j) -+ { -+ this.setItem(i, null); -+ result = stack; -+ } -+ else -+ { -+ result = CraftItemStack.copyNMSStack(stack, j); -+ stack.count -= j; -+ } -+ this.update(); -+ return result; -+ } -+ -+ public ItemStack splitWithoutUpdate(int i) -+ { -+ ItemStack stack = this.getItem(i); -+ ItemStack result; -+ if (stack == null) -+ return null; -+ if (stack.count <= 1) -+ { -+ this.setItem(i, null); -+ result = stack; -+ } -+ else -+ { -+ result = CraftItemStack.copyNMSStack(stack, 1); -+ stack.count -= 1; -+ } -+ return result; -+ } -+ -+ public void setItem(int i, ItemStack itemstack) -+ { -+ items[i] = itemstack; -+ if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) -+ { -+ itemstack.count = this.getMaxStackSize(); -+ } -+ } -+ -+ public void setInventoryName(String name) -+ { -+ title = name; -+ } -+ -+ public int getMaxStackSize() -+ { -+ return maxStack; -+ } -+ -+ public void setMaxStackSize(int size) -+ { -+ maxStack = size; -+ } -+ -+ public void update() -+ { -+ } -+ -+ public boolean a(EntityHuman entityhuman) -+ { -+ return true; -+ } -+ -+ public ItemStack[] getContents() -+ { -+ return items; -+ } -+ -+ public void onOpen(CraftHumanEntity who) -+ { -+ viewers.add(who); -+ } -+ -+ public void onClose(CraftHumanEntity who) -+ { -+ viewers.remove(who); -+ } -+ -+ public List getViewers() -+ { -+ return viewers; -+ } -+ -+ public InventoryType getType() -+ { -+ return type; -+ } -+ -+ public void g() -+ { -+ } -+ -+ public InventoryHolder getOwner() -+ { -+ return owner; -+ } -+ -+ public void startOpen() -+ { -+ } -+ -+ public boolean c() -+ { -+ return false; -+ } -+ -+ public boolean b(int i, ItemStack itemstack) -+ { -+ return true; -+ } -+ -+ @Override -+ public String getInventoryName() -+ { -+ return title; -+ } -+ -+ @Override -+ public boolean k_() -+ { -+ return false; -+ } -+ -+ @Override -+ public void closeContainer() -+ { -+ } -+} -\ No newline at end of file -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -new file mode 100644 -index 0000000..31fa335 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -@@ -0,0 +1,56 @@ -+package org.bukkit.event.vehicle; -+ -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ -+/** -+ * Raised when a living entity exits a vehicle. -+ */ -+public class VehicleExitEvent extends Event implements Cancellable { -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean cancelled; -+ private Entity vehicle; -+ private final LivingEntity exited; -+ -+ public VehicleExitEvent(final Entity vehicle, final LivingEntity exited) { -+ this.vehicle = vehicle; -+ this.exited = exited; -+ } -+ -+ /** -+ * Get the vehicle. -+ * -+ * @return the vehicle -+ */ -+ public final Entity getVehicle() { -+ return vehicle; -+ } -+ -+ /** -+ * Get the living entity that exited the vehicle. -+ * -+ * @return The entity. -+ */ -+ public LivingEntity getExited() { -+ return exited; -+ } -+ -+ public boolean isCancelled() { -+ return cancelled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} --- -1.8.4.msysgit.0 - diff --git a/Patches/Bukkit-Patches/0030-LivingEntity-changes.patch b/Patches/Bukkit-Patches/0030-LivingEntity-changes.patch new file mode 100644 index 000000000..88e53c48c --- /dev/null +++ b/Patches/Bukkit-Patches/0030-LivingEntity-changes.patch @@ -0,0 +1,34 @@ +From f037882f13b3ea9d0a0137260e365a4332a8e751 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:23:18 +1300 +Subject: [PATCH] LivingEntity changes + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 48e2508..fb623ae 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -392,4 +392,20 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource { + * @return whether the operation was successful + */ + public boolean setLeashHolder(Entity holder); ++ ++ public boolean shouldBreakLeash(); ++ ++ public void setShouldBreakLeash(boolean shouldBreakLeash); ++ ++ public boolean shouldPullWhileLeashed(); ++ ++ public void setPullWhileLeashed(boolean pullWhileLeashed); ++ ++ public boolean isVegetated(); ++ ++ public void setVegetated(boolean vegetated); ++ ++ public boolean isGhost(); ++ ++ public void setGhost(boolean ghost); + } +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0161-Modify-packets-to-public.patch b/Patches/CraftBukkit-Patches/0161-Modify-packets-to-public.patch new file mode 100644 index 000000000..dcf211601 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0161-Modify-packets-to-public.patch @@ -0,0 +1,2037 @@ +From b9014b76bbb262a39ce2d70cbe831ceb07acf68d Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:14:50 +1300 +Subject: [PATCH] Modify packets to public + + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java +index 02d8e07..ac5928d 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java +@@ -4,13 +4,13 @@ import java.io.IOException; + + public class PacketPlayInBlockPlace implements Packet { + +- private static final BlockPosition a = new BlockPosition(-1, -1, -1); +- private BlockPosition b; +- private int c; +- private ItemStack d; +- private float e; +- private float f; +- private float g; ++ public static final BlockPosition a = new BlockPosition(-1, -1, -1); ++ public BlockPosition b; ++ public int c; ++ public ItemStack d; ++ public float e; ++ public float f; ++ public float g; + + public long timestamp; // CraftBukkit + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java +index 4dfb6c0..05c88a6 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java +@@ -4,7 +4,7 @@ import java.io.IOException; + + public class PacketPlayInCloseWindow implements Packet { + +- private int id; ++ public int id; + + public PacketPlayInCloseWindow() {} + +diff --git a/src/main/java/net/minecraft/server/PacketPlayInResourcePackStatus.java b/src/main/java/net/minecraft/server/PacketPlayInResourcePackStatus.java +index 064374a..c96c2a3 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayInResourcePackStatus.java ++++ b/src/main/java/net/minecraft/server/PacketPlayInResourcePackStatus.java +@@ -4,7 +4,7 @@ import java.io.IOException; + + public class PacketPlayInResourcePackStatus implements Packet { + +- private String a; ++ public String a; + public PacketPlayInResourcePackStatus.EnumResourcePackStatus b; // PAIL: private -> public, rename: status + + public PacketPlayInResourcePackStatus() {} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +new file mode 100644 +index 0000000..40c4e2d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +@@ -0,0 +1,54 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInUseEntity ++ implements Packet ++{ ++ public int a; ++ public EnumEntityUseAction action; ++ public Vec3D c; ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.a = paramPacketDataSerializer.e(); ++ this.action = ((EnumEntityUseAction)paramPacketDataSerializer.a(EnumEntityUseAction.class)); ++ if (this.action == EnumEntityUseAction.INTERACT_AT) ++ this.c = new Vec3D(paramPacketDataSerializer.readFloat(), paramPacketDataSerializer.readFloat(), paramPacketDataSerializer.readFloat()); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ paramPacketDataSerializer.b(this.a); ++ paramPacketDataSerializer.a(this.action); ++ if (this.action == EnumEntityUseAction.INTERACT_AT) { ++ paramPacketDataSerializer.writeFloat((float)this.c.a); ++ paramPacketDataSerializer.writeFloat((float)this.c.b); ++ paramPacketDataSerializer.writeFloat((float)this.c.c); ++ } ++ } ++ ++ public void a(PacketListenerPlayIn paramPacketListenerPlayIn) ++ { ++ paramPacketListenerPlayIn.a(this); ++ } ++ ++ public Entity a(World paramWorld) { ++ return paramWorld.a(this.a); ++ } ++ ++ public EnumEntityUseAction a() { ++ return this.action; ++ } ++ ++ public Vec3D b() { ++ return this.c; ++ } ++ ++ public static enum EnumEntityUseAction ++ { ++ INTERACT, ATTACK, INTERACT_AT; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java +new file mode 100644 +index 0000000..b5fdd87 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutAnimation.java +@@ -0,0 +1,30 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutAnimation implements Packet { ++ ++ public int a; ++ public int b; ++ ++ public PacketPlayOutAnimation() {} ++ ++ public PacketPlayOutAnimation(Entity entity, int i) { ++ this.a = entity.getId(); ++ this.b = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java +new file mode 100644 +index 0000000..314a2de +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutAttachEntity.java +@@ -0,0 +1,41 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutAttachEntity implements Packet ++{ ++ ++ public int a; ++ public int b; ++ public int c; ++ ++ public PacketPlayOutAttachEntity() ++ { ++ } ++ ++ public PacketPlayOutAttachEntity(int i, Entity entity, Entity entity1) ++ { ++ this.a = i; ++ this.b = entity.getId(); ++ this.c = entity1 != null ? entity1.getId() : -1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.a = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException ++ { ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeByte(this.a); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBed.java b/src/main/java/net/minecraft/server/PacketPlayOutBed.java +new file mode 100644 +index 0000000..6d7f65e +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBed.java +@@ -0,0 +1,40 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutBed ++ implements Packet ++{ ++ public int a; ++ public BlockPosition b; ++ ++ public PacketPlayOutBed() ++ { ++ } ++ ++ public PacketPlayOutBed(EntityHuman entityhuman, BlockPosition blockposition) ++ { ++ a = entityhuman.getId(); ++ b = blockposition; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ { ++ a = packetdataserializer.e(); ++ b = packetdataserializer.c(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ { ++ packetdataserializer.b(a); ++ packetdataserializer.a(b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +index 6cd5df2..5acec91 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -4,9 +4,9 @@ import java.io.IOException; + + public class PacketPlayOutChat implements Packet { + +- private IChatBaseComponent a; ++ public IChatBaseComponent a; + public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot +- private byte b; ++ public byte b; + + public PacketPlayOutChat() {} + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +new file mode 100644 +index 0000000..702d33d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java +@@ -0,0 +1,134 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntity implements Packet { ++ ++ public int a; ++ public byte b; ++ public byte c; ++ public byte d; ++ public byte e; ++ public byte f; ++ public boolean g; ++ public boolean h; ++ ++ public PacketPlayOutEntity() {} ++ ++ public PacketPlayOutEntity(int i) { ++ this.a = i; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public String toString() { ++ return "Entity_" + super.toString(); ++ } ++ ++ public static class PacketPlayOutEntityLook extends PacketPlayOutEntity { ++ ++ public PacketPlayOutEntityLook() { ++ this.h = true; ++ } ++ ++ public PacketPlayOutEntityLook(int i, byte b0, byte b1, boolean flag) { ++ super(i); ++ this.e = b0; ++ this.f = b1; ++ this.h = true; ++ this.g = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ super.a(packetdataserializer); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ ++ } ++ ++ public static class PacketPlayOutRelEntityMove extends PacketPlayOutEntity { ++ ++ public PacketPlayOutRelEntityMove() {} ++ ++ public PacketPlayOutRelEntityMove(int i, byte b0, byte b1, byte b2, boolean flag) { ++ super(i); ++ this.b = b0; ++ this.c = b1; ++ this.d = b2; ++ this.g = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ super.a(packetdataserializer); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ } ++ ++ public static class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity { ++ ++ public PacketPlayOutRelEntityMoveLook() { ++ this.h = true; ++ } ++ ++ public PacketPlayOutRelEntityMoveLook(int i, byte b0, byte b1, byte b2, byte b3, byte b4, boolean flag) { ++ super(i); ++ this.b = b0; ++ this.c = b1; ++ this.d = b2; ++ this.e = b3; ++ this.f = b4; ++ this.g = flag; ++ this.h = true; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ super.a(packetdataserializer); ++ this.b = packetdataserializer.readByte(); ++ this.c = packetdataserializer.readByte(); ++ this.d = packetdataserializer.readByte(); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ super.b(packetdataserializer); ++ packetdataserializer.writeByte(this.b); ++ packetdataserializer.writeByte(this.c); ++ packetdataserializer.writeByte(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java +new file mode 100644 +index 0000000..2ed18fc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityDestroy.java +@@ -0,0 +1,40 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntityDestroy ++ implements Packet ++{ ++ public int[] a; ++ ++ public PacketPlayOutEntityDestroy() ++ { ++ } ++ ++ public PacketPlayOutEntityDestroy(int[] s) ++ { ++ this.a = s; ++ } ++ ++ public void a(PacketDataSerializer f) throws IOException ++ { ++ this.a = new int[f.e()]; ++ ++ for (int e = 0; e < this.a.length; e++) ++ this.a[e] = f.e(); ++ } ++ ++ public void b(PacketDataSerializer q) ++ throws IOException ++ { ++ q.b(this.a.length); ++ ++ for (int d = 0; d < this.a.length; d++) ++ q.b(this.a[d]); ++ } ++ ++ public void a(PacketListenerPlayOut w) ++ { ++ w.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +new file mode 100644 +index 0000000..ecc2e78 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityEquipment.java +@@ -0,0 +1,35 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntityEquipment implements Packet { ++ ++ public int a; ++ public int b; ++ public ItemStack c; ++ ++ public PacketPlayOutEntityEquipment() {} ++ ++ public PacketPlayOutEntityEquipment(int i, int j, ItemStack itemstack) { ++ this.a = i; ++ this.b = j; ++ this.c = itemstack == null ? null : itemstack.cloneItemStack(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.i(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.a(this.c); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +new file mode 100644 +index 0000000..dbfcc3c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityMetadata.java +@@ -0,0 +1,37 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++ ++public class PacketPlayOutEntityMetadata implements Packet { ++ ++ public int a; ++ public List b; ++ ++ public PacketPlayOutEntityMetadata() {} ++ ++ public PacketPlayOutEntityMetadata(int i, DataWatcher datawatcher, boolean flag) { ++ this.a = i; ++ if (flag) { ++ this.b = datawatcher.c(); ++ } else { ++ this.b = datawatcher.b(); ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ DataWatcher.a(this.b, packetdataserializer); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityStatus.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityStatus.java +new file mode 100644 +index 0000000..e05f2c8 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityStatus.java +@@ -0,0 +1,40 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityStatus ++ implements Packet ++{ ++ public int a; ++ public byte b; ++ ++ public PacketPlayOutEntityStatus() ++ { ++ } ++ ++ public PacketPlayOutEntityStatus(Entity entity, byte byte0) ++ { ++ a = entity.getId(); ++ b = byte0; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ { ++ a = packetdataserializer.readInt(); ++ b = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ { ++ packetdataserializer.writeInt(a); ++ packetdataserializer.writeByte(b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +new file mode 100644 +index 0000000..786047c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +@@ -0,0 +1,58 @@ ++package net.minecraft.server; ++ ++public class PacketPlayOutEntityTeleport implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public byte e; ++ public byte f; ++ public boolean g; ++ ++ public PacketPlayOutEntityTeleport() {} ++ ++ public PacketPlayOutEntityTeleport(Entity entity) { ++ this.a = entity.getId(); ++ this.b = MathHelper.floor(entity.locX * 32.0D); ++ this.c = MathHelper.floor(entity.locY * 32.0D); ++ this.d = MathHelper.floor(entity.locZ * 32.0D); ++ this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F)); ++ this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F)); ++ this.g = entity.onGround; ++ } ++ ++ public PacketPlayOutEntityTeleport(int i, int j, int k, int l, byte b0, byte b1, boolean flag) { ++ this.a = i; ++ this.b = j; ++ this.c = k; ++ this.d = l; ++ this.e = b0; ++ this.f = b1; ++ this.g = flag; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readBoolean(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeBoolean(this.g); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +new file mode 100644 +index 0000000..6c8dbbc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityVelocity.java +@@ -0,0 +1,69 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutEntityVelocity implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ ++ public PacketPlayOutEntityVelocity() {} ++ ++ public PacketPlayOutEntityVelocity(Entity entity) { ++ this(entity.getId(), entity.motX, entity.motY, entity.motZ); ++ } ++ ++ public PacketPlayOutEntityVelocity(int i, double d0, double d1, double d2) { ++ this.a = i; ++ double d3 = 3.9D; ++ ++ if (d0 < -d3) { ++ d0 = -d3; ++ } ++ ++ if (d1 < -d3) { ++ d1 = -d3; ++ } ++ ++ if (d2 < -d3) { ++ d2 = -d3; ++ } ++ ++ if (d0 > d3) { ++ d0 = d3; ++ } ++ ++ if (d1 > d3) { ++ d1 = d3; ++ } ++ ++ if (d2 > d3) { ++ d2 = d3; ++ } ++ ++ this.b = (int) (d0 * 8000.0D); ++ this.c = (int) (d1 * 8000.0D); ++ this.d = (int) (d2 * 8000.0D); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readShort(); ++ this.c = packetdataserializer.readShort(); ++ this.d = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeShort(this.b); ++ packetdataserializer.writeShort(this.c); ++ packetdataserializer.writeShort(this.d); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +index 58c0275..c72526a 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +@@ -7,10 +7,11 @@ import java.util.Iterator; + + public class PacketPlayOutMapChunk implements Packet { + +- private int a; +- private int b; +- private PacketPlayOutMapChunk.ChunkMap c; +- private boolean d; ++ public int a; ++ public int b; ++ public PacketPlayOutMapChunk.ChunkMap c; ++ public boolean d; ++ public Chunk mapChunk; + + public PacketPlayOutMapChunk() {} + +@@ -20,6 +21,7 @@ public class PacketPlayOutMapChunk implements Packet { + this.d = flag; + this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); + chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world); ++ mapChunk = chunk; + } + + public void a(PacketDataSerializer packetdataserializer) throws IOException { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +index 10c0e34..54c1ec9 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java +@@ -5,16 +5,18 @@ import java.util.List; + + public class PacketPlayOutMapChunkBulk implements Packet { + +- private int[] a; +- private int[] b; +- private PacketPlayOutMapChunk.ChunkMap[] c; +- private boolean d; +- private World world; // Spigot ++ public int[] a; ++ public int[] b; ++ public PacketPlayOutMapChunk.ChunkMap[] c; ++ public boolean d; ++ public World world; // Spigot ++ public List mapChunks; + + public PacketPlayOutMapChunkBulk() {} + + public PacketPlayOutMapChunkBulk(List list) { + int i = list.size(); ++ mapChunks = list; + + this.a = new int[i]; + this.b = new int[i]; +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +new file mode 100644 +index 0000000..23fa49d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +@@ -0,0 +1,64 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++import java.util.UUID; ++ ++public class PacketPlayOutNamedEntitySpawn implements Packet { ++ ++ public int a; ++ public UUID b; ++ public int c; ++ public int d; ++ public int e; ++ public byte f; ++ public byte g; ++ public int h; ++ public DataWatcher i; ++ public List j; ++ ++ public PacketPlayOutNamedEntitySpawn() {} ++ ++ public PacketPlayOutNamedEntitySpawn(EntityHuman entityhuman) { ++ this.a = entityhuman.getId(); ++ this.b = entityhuman.getProfile().getId(); ++ this.c = MathHelper.floor(entityhuman.locX * 32.0D); ++ this.d = MathHelper.floor(entityhuman.locY * 32.0D); ++ this.e = MathHelper.floor(entityhuman.locZ * 32.0D); ++ this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F)); ++ this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F)); ++ ItemStack itemstack = entityhuman.inventory.getItemInHand(); ++ ++ this.h = itemstack == null ? 0 : Item.getId(itemstack.getItem()); ++ this.i = entityhuman.getDataWatcher(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.g(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); ++ this.f = packetdataserializer.readByte(); ++ this.g = packetdataserializer.readByte(); ++ this.h = packetdataserializer.readShort(); ++ this.j = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.a(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ packetdataserializer.writeByte(this.f); ++ packetdataserializer.writeByte(this.g); ++ packetdataserializer.writeShort(this.h); ++ this.i.a(packetdataserializer); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java +new file mode 100644 +index 0000000..7b1a6f1 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java +@@ -0,0 +1,63 @@ ++package net.minecraft.server; ++ ++import org.apache.commons.lang3.Validate; ++ ++public class PacketPlayOutNamedSoundEffect ++ implements Packet ++{ ++ public String a; ++ public int b; ++ public int c; ++ public int d; ++ public float e; ++ public int f; ++ ++ public PacketPlayOutNamedSoundEffect() ++ { ++ c = 0x7fffffff; ++ } ++ ++ public PacketPlayOutNamedSoundEffect(String s, double d1, double d2, double d3, ++ float f1, float f2) ++ { ++ c = 0x7fffffff; ++ Validate.notNull(s, "name", new Object[0]); ++ a = s; ++ b = (int)(d1 * 8D); ++ c = (int)(d2 * 8D); ++ d = (int)(d3 * 8D); ++ e = f1; ++ f = (int)(f2 * 63F); ++ f2 = MathHelper.a(f2, 0.0F, 255F); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ { ++ a = packetdataserializer.c(256); ++ b = packetdataserializer.readInt(); ++ c = packetdataserializer.readInt(); ++ d = packetdataserializer.readInt(); ++ e = packetdataserializer.readFloat(); ++ f = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ { ++ packetdataserializer.a(a); ++ packetdataserializer.writeInt(b); ++ packetdataserializer.writeInt(c); ++ packetdataserializer.writeInt(d); ++ packetdataserializer.writeFloat(e); ++ packetdataserializer.writeByte(f); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +index c168194..4c1e9cf 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutOpenWindow.java +@@ -4,11 +4,11 @@ import java.io.IOException; + + public class PacketPlayOutOpenWindow implements Packet { + +- private int a; +- private String b; +- private IChatBaseComponent c; +- private int d; +- private int e; ++ public int a; ++ public String b; ++ public IChatBaseComponent c; ++ public int d; ++ public int e; + + public PacketPlayOutOpenWindow() {} + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +new file mode 100644 +index 0000000..99809cd +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerInfo.java +@@ -0,0 +1,254 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Objects; ++import com.google.common.collect.Lists; ++import com.mojang.authlib.GameProfile; ++import com.mojang.authlib.properties.Property; ++import java.io.IOException; ++import java.util.Iterator; ++import java.util.List; ++ ++public class PacketPlayOutPlayerInfo implements Packet { ++ ++ public PacketPlayOutPlayerInfo.EnumPlayerInfoAction a; ++ public final List b = Lists.newArrayList(); ++ ++ public PacketPlayOutPlayerInfo() {} ++ ++ public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction packetplayoutplayerinfo_enumplayerinfoaction, EntityPlayer... aentityplayer) { ++ this.a = packetplayoutplayerinfo_enumplayerinfoaction; ++ EntityPlayer[] aentityplayer1 = aentityplayer; ++ int i = aentityplayer.length; ++ ++ for (int j = 0; j < i; ++j) { ++ EntityPlayer entityplayer = aentityplayer1[j]; ++ ++ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(entityplayer.getProfile(), entityplayer.ping, entityplayer.playerInteractManager.getGameMode(), entityplayer.getPlayerListName())); ++ } ++ ++ } ++ ++ public PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction packetplayoutplayerinfo_enumplayerinfoaction, Iterable iterable) { ++ this.a = packetplayoutplayerinfo_enumplayerinfoaction; ++ Iterator iterator = iterable.iterator(); ++ ++ while (iterator.hasNext()) { ++ EntityPlayer entityplayer = (EntityPlayer) iterator.next(); ++ ++ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(entityplayer.getProfile(), entityplayer.ping, entityplayer.playerInteractManager.getGameMode(), entityplayer.getPlayerListName())); ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = (PacketPlayOutPlayerInfo.EnumPlayerInfoAction) packetdataserializer.a(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.class); ++ int i = packetdataserializer.e(); ++ ++ for (int j = 0; j < i; ++j) { ++ GameProfile gameprofile = null; ++ int k = 0; ++ WorldSettings.EnumGamemode worldsettings_enumgamemode = null; ++ IChatBaseComponent ichatbasecomponent = null; ++ ++ switch (PacketPlayOutPlayerInfo.SyntheticClass_1.a[this.a.ordinal()]) { ++ case 1: ++ gameprofile = new GameProfile(packetdataserializer.g(), packetdataserializer.c(16)); ++ int l = packetdataserializer.e(); ++ ++ for (int i1 = 0; i1 < l; ++i1) { ++ String s = packetdataserializer.c(32767); ++ String s1 = packetdataserializer.c(32767); ++ ++ if (packetdataserializer.readBoolean()) { ++ gameprofile.getProperties().put(s, new Property(s, s1, packetdataserializer.c(32767))); ++ } else { ++ gameprofile.getProperties().put(s, new Property(s, s1)); ++ } ++ } ++ ++ worldsettings_enumgamemode = WorldSettings.EnumGamemode.getById(packetdataserializer.e()); ++ k = packetdataserializer.e(); ++ if (packetdataserializer.readBoolean()) { ++ ichatbasecomponent = packetdataserializer.d(); ++ } ++ break; ++ ++ case 2: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ worldsettings_enumgamemode = WorldSettings.EnumGamemode.getById(packetdataserializer.e()); ++ break; ++ ++ case 3: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ k = packetdataserializer.e(); ++ break; ++ ++ case 4: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ if (packetdataserializer.readBoolean()) { ++ ichatbasecomponent = packetdataserializer.d(); ++ } ++ break; ++ ++ case 5: ++ gameprofile = new GameProfile(packetdataserializer.g(), (String) null); ++ } ++ ++ this.b.add(new PacketPlayOutPlayerInfo.PlayerInfoData(gameprofile, k, worldsettings_enumgamemode, ichatbasecomponent)); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a((Enum) this.a); ++ packetdataserializer.b(this.b.size()); ++ Iterator iterator = this.b.iterator(); ++ ++ while (iterator.hasNext()) { ++ PacketPlayOutPlayerInfo.PlayerInfoData packetplayoutplayerinfo_playerinfodata = (PacketPlayOutPlayerInfo.PlayerInfoData) iterator.next(); ++ ++ switch (PacketPlayOutPlayerInfo.SyntheticClass_1.a[this.a.ordinal()]) { ++ case 1: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getName()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.a().getProperties().size()); ++ Iterator iterator1 = packetplayoutplayerinfo_playerinfodata.a().getProperties().values().iterator(); ++ ++ while (iterator1.hasNext()) { ++ Property property = (Property) iterator1.next(); ++ ++ packetdataserializer.a(property.getName()); ++ packetdataserializer.a(property.getValue()); ++ if (property.hasSignature()) { ++ packetdataserializer.writeBoolean(true); ++ packetdataserializer.a(property.getSignature()); ++ } else { ++ packetdataserializer.writeBoolean(false); ++ } ++ } ++ ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.c().getId()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.b()); ++ if (packetplayoutplayerinfo_playerinfodata.d() == null) { ++ packetdataserializer.writeBoolean(false); ++ } else { ++ packetdataserializer.writeBoolean(true); ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.d()); ++ } ++ break; ++ ++ case 2: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.c().getId()); ++ break; ++ ++ case 3: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ packetdataserializer.b(packetplayoutplayerinfo_playerinfodata.b()); ++ break; ++ ++ case 4: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ if (packetplayoutplayerinfo_playerinfodata.d() == null) { ++ packetdataserializer.writeBoolean(false); ++ } else { ++ packetdataserializer.writeBoolean(true); ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.d()); ++ } ++ break; ++ ++ case 5: ++ packetdataserializer.a(packetplayoutplayerinfo_playerinfodata.a().getId()); ++ } ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public String toString() { ++ return Objects.toStringHelper(this).add("action", this.a).add("entries", this.b).toString(); ++ } ++ ++ static class SyntheticClass_1 { ++ ++ static final int[] a = new int[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.values().length]; ++ ++ static { ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER.ordinal()] = 1; ++ } catch (NoSuchFieldError nosuchfielderror) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE.ordinal()] = 2; ++ } catch (NoSuchFieldError nosuchfielderror1) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY.ordinal()] = 3; ++ } catch (NoSuchFieldError nosuchfielderror2) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME.ordinal()] = 4; ++ } catch (NoSuchFieldError nosuchfielderror3) { ++ ; ++ } ++ ++ try { ++ PacketPlayOutPlayerInfo.SyntheticClass_1.a[PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER.ordinal()] = 5; ++ } catch (NoSuchFieldError nosuchfielderror4) { ++ ; ++ } ++ ++ } ++ } ++ ++ public class PlayerInfoData { ++ ++ public final int b; ++ public final WorldSettings.EnumGamemode c; ++ public final GameProfile d; ++ public final IChatBaseComponent e; ++ ++ public PlayerInfoData(GameProfile gameprofile, int i, WorldSettings.EnumGamemode worldsettings_enumgamemode, IChatBaseComponent ichatbasecomponent) { ++ this.d = gameprofile; ++ this.b = i; ++ this.c = worldsettings_enumgamemode; ++ this.e = ichatbasecomponent; ++ } ++ ++ public GameProfile a() { ++ return this.d; ++ } ++ ++ public int b() { ++ return this.b; ++ } ++ ++ public WorldSettings.EnumGamemode c() { ++ return this.c; ++ } ++ ++ public IChatBaseComponent d() { ++ return this.e; ++ } ++ ++ public String toString() { ++ return Objects.toStringHelper(this).add("latency", this.b).add("gameMode", this.c).add("profile", this.d).add("displayName", this.e == null ? null : IChatBaseComponent.ChatSerializer.a(this.e)).toString(); ++ } ++ } ++ ++ public static enum EnumPlayerInfoAction { ++ ++ ADD_PLAYER, UPDATE_GAME_MODE, UPDATE_LATENCY, UPDATE_DISPLAY_NAME, REMOVE_PLAYER; ++ ++ private EnumPlayerInfoAction() {} ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java +new file mode 100644 +index 0000000..9aebe07 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java +@@ -0,0 +1,30 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutPlayerListHeaderFooter implements Packet { ++ ++ public IChatBaseComponent a; ++ public IChatBaseComponent b; ++ ++ public PacketPlayOutPlayerListHeaderFooter() {} ++ ++ public PacketPlayOutPlayerListHeaderFooter(IChatBaseComponent ichatbasecomponent) { ++ this.a = ichatbasecomponent; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.d(); ++ this.b = packetdataserializer.d(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.a(this.b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardDisplayObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardDisplayObjective.java +new file mode 100644 +index 0000000..d133b87 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardDisplayObjective.java +@@ -0,0 +1,42 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutScoreboardDisplayObjective ++ implements Packet ++{ ++ public int a; ++ public String b; ++ ++ public PacketPlayOutScoreboardDisplayObjective() ++ { ++ } ++ ++ public PacketPlayOutScoreboardDisplayObjective(int paramInt, ScoreboardObjective paramScoreboardObjective) ++ { ++ this.a = paramInt; ++ ++ if (paramScoreboardObjective == null) ++ this.b = ""; ++ else ++ this.b = paramScoreboardObjective.getName(); ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.a = paramPacketDataSerializer.readByte(); ++ this.b = paramPacketDataSerializer.c(16); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.writeByte(this.a); ++ paramPacketDataSerializer.a(this.b); ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java +new file mode 100644 +index 0000000..1902839 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardObjective.java +@@ -0,0 +1,51 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutScoreboardObjective ++ implements Packet ++{ ++ public String a; ++ public String b; ++ public IScoreboardCriteria.EnumScoreboardHealthDisplay c; ++ public int d; ++ ++ public PacketPlayOutScoreboardObjective() ++ { ++ } ++ ++ public PacketPlayOutScoreboardObjective(ScoreboardObjective paramScoreboardObjective, int paramInt) ++ { ++ this.a = paramScoreboardObjective.getName(); ++ this.b = paramScoreboardObjective.getDisplayName(); ++ this.c = paramScoreboardObjective.getCriteria().c(); ++ this.d = paramInt; ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.a = paramPacketDataSerializer.c(16); ++ this.d = paramPacketDataSerializer.readByte(); ++ ++ if ((this.d == 0) || (this.d == 2)) { ++ this.b = paramPacketDataSerializer.c(32); ++ this.c = IScoreboardCriteria.EnumScoreboardHealthDisplay.a(paramPacketDataSerializer.c(16)); ++ } ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.a(this.a); ++ paramPacketDataSerializer.writeByte(this.d); ++ ++ if ((this.d == 0) || (this.d == 2)) { ++ paramPacketDataSerializer.a(this.b); ++ paramPacketDataSerializer.a(this.c.a()); ++ } ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java +new file mode 100644 +index 0000000..1c656d1 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardScore.java +@@ -0,0 +1,69 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutScoreboardScore ++ implements Packet ++{ ++ public String a = ""; ++ public String b = ""; ++ public int c; ++ public EnumScoreboardAction d; ++ ++ public PacketPlayOutScoreboardScore() ++ { ++ } ++ ++ public PacketPlayOutScoreboardScore(ScoreboardScore paramScoreboardScore) ++ { ++ this.a = paramScoreboardScore.getPlayerName(); ++ this.b = paramScoreboardScore.getObjective().getName(); ++ this.c = paramScoreboardScore.getScore(); ++ this.d = EnumScoreboardAction.CHANGE; ++ } ++ ++ public PacketPlayOutScoreboardScore(String paramString) { ++ this.a = paramString; ++ this.b = ""; ++ this.c = 0; ++ this.d = EnumScoreboardAction.REMOVE; ++ } ++ ++ public PacketPlayOutScoreboardScore(String paramString, ScoreboardObjective paramScoreboardObjective) { ++ this.a = paramString; ++ this.b = paramScoreboardObjective.getName(); ++ this.c = 0; ++ this.d = EnumScoreboardAction.REMOVE; ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.a = paramPacketDataSerializer.c(40); ++ this.d = ((EnumScoreboardAction)paramPacketDataSerializer.a(EnumScoreboardAction.class)); ++ this.b = paramPacketDataSerializer.c(16); ++ ++ if (this.d != EnumScoreboardAction.REMOVE) ++ this.c = paramPacketDataSerializer.e(); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ paramPacketDataSerializer.a(this.a); ++ paramPacketDataSerializer.a(this.d); ++ paramPacketDataSerializer.a(this.b); ++ ++ if (this.d != EnumScoreboardAction.REMOVE) ++ paramPacketDataSerializer.b(this.c); ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++ ++ public static enum EnumScoreboardAction ++ { ++ CHANGE, REMOVE; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +new file mode 100644 +index 0000000..f300bfc +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +@@ -0,0 +1,104 @@ ++package net.minecraft.server; ++ ++import com.google.common.collect.Lists; ++import java.io.IOException; ++import java.util.Collection; ++ ++public class PacketPlayOutScoreboardTeam ++ implements Packet ++{ ++ public String a = ""; ++ public String b = ""; ++ public String c = ""; ++ public String d = ""; ++ public String e = ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS.e; ++ public int f = -1; ++ public Collection g = Lists.newArrayList(); ++ public int h; ++ public int i; ++ ++ public PacketPlayOutScoreboardTeam() ++ { ++ } ++ ++ public PacketPlayOutScoreboardTeam(ScoreboardTeam paramScoreboardTeam, int paramInt) ++ { ++ this.a = paramScoreboardTeam.getName(); ++ this.h = paramInt; ++ ++ if ((paramInt == 0) || (paramInt == 2)) { ++ this.b = paramScoreboardTeam.getDisplayName(); ++ this.c = paramScoreboardTeam.getPrefix(); ++ this.d = paramScoreboardTeam.getSuffix(); ++ this.i = paramScoreboardTeam.packOptionData(); ++ this.e = paramScoreboardTeam.getNameTagVisibility().e; ++ this.f = paramScoreboardTeam.l().b(); ++ } ++ if (paramInt == 0) ++ this.g.addAll(paramScoreboardTeam.getPlayerNameSet()); ++ } ++ ++ public PacketPlayOutScoreboardTeam(ScoreboardTeam paramScoreboardTeam, Collection paramCollection, int paramInt) ++ { ++ if ((paramInt != 3) && (paramInt != 4)) { ++ throw new IllegalArgumentException("Method must be join or leave for player constructor"); ++ } ++ if ((paramCollection == null) || (paramCollection.isEmpty())) { ++ throw new IllegalArgumentException("Players cannot be null/empty"); ++ } ++ ++ this.h = paramInt; ++ this.a = paramScoreboardTeam.getName(); ++ this.g.addAll(paramCollection); ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.a = paramPacketDataSerializer.c(16); ++ this.h = paramPacketDataSerializer.readByte(); ++ ++ if ((this.h == 0) || (this.h == 2)) { ++ this.b = paramPacketDataSerializer.c(32); ++ this.c = paramPacketDataSerializer.c(16); ++ this.d = paramPacketDataSerializer.c(16); ++ this.i = paramPacketDataSerializer.readByte(); ++ this.e = paramPacketDataSerializer.c(32); ++ this.f = paramPacketDataSerializer.readByte(); ++ } ++ ++ if ((this.h == 0) || (this.h == 3) || (this.h == 4)) { ++ int j = paramPacketDataSerializer.e(); ++ ++ for (int k = 0; k < j; k++) ++ this.g.add(paramPacketDataSerializer.c(40)); ++ } ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ paramPacketDataSerializer.a(this.a); ++ paramPacketDataSerializer.writeByte(this.h); ++ ++ if ((this.h == 0) || (this.h == 2)) { ++ paramPacketDataSerializer.a(this.b); ++ paramPacketDataSerializer.a(this.c); ++ paramPacketDataSerializer.a(this.d); ++ paramPacketDataSerializer.writeByte(this.i); ++ paramPacketDataSerializer.a(this.e); ++ paramPacketDataSerializer.writeByte(this.f); ++ } ++ ++ if ((this.h == 0) || (this.h == 3) || (this.h == 4)) { ++ paramPacketDataSerializer.b(this.g.size()); ++ ++ for (String str : this.g) ++ paramPacketDataSerializer.a(str); ++ } ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java +new file mode 100644 +index 0000000..b87994c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSetSlot.java +@@ -0,0 +1,41 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutSetSlot ++ implements Packet ++{ ++ public int a; ++ public int b; ++ public ItemStack c; ++ ++ public PacketPlayOutSetSlot() ++ { ++ } ++ ++ public PacketPlayOutSetSlot(int paramInt1, int paramInt2, ItemStack paramItemStack) ++ { ++ this.a = paramInt1; ++ this.b = paramInt2; ++ this.c = (paramItemStack == null ? null : paramItemStack.cloneItemStack()); ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.a = paramPacketDataSerializer.readByte(); ++ this.b = paramPacketDataSerializer.readShort(); ++ this.c = paramPacketDataSerializer.i(); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.writeByte(this.a); ++ paramPacketDataSerializer.writeShort(this.b); ++ paramPacketDataSerializer.a(this.c); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +new file mode 100644 +index 0000000..d34f59b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java +@@ -0,0 +1,133 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutSpawnEntity implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public int e; ++ public int f; ++ public int g; ++ public int h; ++ public int i; ++ public int j; ++ public int k; ++ ++ public PacketPlayOutSpawnEntity() {} ++ ++ public PacketPlayOutSpawnEntity(Entity entity, int i) { ++ this(entity, i, 0); ++ } ++ ++ public PacketPlayOutSpawnEntity(Entity entity, int i, int j) { ++ this.a = entity.getId(); ++ this.b = MathHelper.floor(entity.locX * 32.0D); ++ this.c = MathHelper.floor(entity.locY * 32.0D); ++ this.d = MathHelper.floor(entity.locZ * 32.0D); ++ this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); ++ this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F); ++ this.j = i; ++ this.k = j; ++ if (j > 0) { ++ double d0 = entity.motX; ++ double d1 = entity.motY; ++ double d2 = entity.motZ; ++ double d3 = 3.9D; ++ ++ if (d0 < -d3) { ++ d0 = -d3; ++ } ++ ++ if (d1 < -d3) { ++ d1 = -d3; ++ } ++ ++ if (d2 < -d3) { ++ d2 = -d3; ++ } ++ ++ if (d0 > d3) { ++ d0 = d3; ++ } ++ ++ if (d1 > d3) { ++ d1 = d3; ++ } ++ ++ if (d2 > d3) { ++ d2 = d3; ++ } ++ ++ this.e = (int) (d0 * 8000.0D); ++ this.f = (int) (d1 * 8000.0D); ++ this.g = (int) (d2 * 8000.0D); ++ } ++ ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.j = packetdataserializer.readByte(); ++ this.b = packetdataserializer.readInt(); ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.h = packetdataserializer.readByte(); ++ this.i = packetdataserializer.readByte(); ++ this.k = packetdataserializer.readInt(); ++ if (this.k > 0) { ++ this.e = packetdataserializer.readShort(); ++ this.f = packetdataserializer.readShort(); ++ this.g = packetdataserializer.readShort(); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.j); ++ packetdataserializer.writeInt(this.b); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeByte(this.h); ++ packetdataserializer.writeByte(this.i); ++ packetdataserializer.writeInt(this.k); ++ if (this.k > 0) { ++ packetdataserializer.writeShort(this.e); ++ packetdataserializer.writeShort(this.f); ++ packetdataserializer.writeShort(this.g); ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(int i) { ++ this.b = i; ++ } ++ ++ public void b(int i) { ++ this.c = i; ++ } ++ ++ public void c(int i) { ++ this.d = i; ++ } ++ ++ public void d(int i) { ++ this.e = i; ++ } ++ ++ public void e(int i) { ++ this.f = i; ++ } ++ ++ public void f(int i) { ++ this.g = i; ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +new file mode 100644 +index 0000000..61aa281 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +@@ -0,0 +1,102 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++ ++public class PacketPlayOutSpawnEntityLiving implements Packet { ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public int e; ++ public int f; ++ public int g; ++ public int h; ++ public byte i; ++ public byte j; ++ public byte k; ++ public DataWatcher l; ++ public List m; ++ ++ public PacketPlayOutSpawnEntityLiving() {} ++ ++ public PacketPlayOutSpawnEntityLiving(EntityLiving entityliving) { ++ this.a = entityliving.getId(); ++ this.b = (byte) EntityTypes.a(entityliving); ++ this.c = MathHelper.floor(entityliving.locX * 32.0D); ++ this.d = MathHelper.floor(entityliving.locY * 32.0D); ++ this.e = MathHelper.floor(entityliving.locZ * 32.0D); ++ this.i = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F)); ++ this.j = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F)); ++ this.k = (byte) ((int) (entityliving.aK * 256.0F / 360.0F)); ++ double d0 = 3.9D; ++ double d1 = entityliving.motX; ++ double d2 = entityliving.motY; ++ double d3 = entityliving.motZ; ++ ++ if (d1 < -d0) { ++ d1 = -d0; ++ } ++ ++ if (d2 < -d0) { ++ d2 = -d0; ++ } ++ ++ if (d3 < -d0) { ++ d3 = -d0; ++ } ++ ++ if (d1 > d0) { ++ d1 = d0; ++ } ++ ++ if (d2 > d0) { ++ d2 = d0; ++ } ++ ++ if (d3 > d0) { ++ d3 = d0; ++ } ++ ++ this.f = (int) (d1 * 8000.0D); ++ this.g = (int) (d2 * 8000.0D); ++ this.h = (int) (d3 * 8000.0D); ++ this.l = entityliving.getDataWatcher(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.e(); ++ this.b = packetdataserializer.readByte() & 255; ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); ++ this.i = packetdataserializer.readByte(); ++ this.j = packetdataserializer.readByte(); ++ this.k = packetdataserializer.readByte(); ++ this.f = packetdataserializer.readShort(); ++ this.g = packetdataserializer.readShort(); ++ this.h = packetdataserializer.readShort(); ++ this.m = DataWatcher.b(packetdataserializer); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.b(this.a); ++ packetdataserializer.writeByte(this.b & 255); ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ packetdataserializer.writeByte(this.i); ++ packetdataserializer.writeByte(this.j); ++ packetdataserializer.writeByte(this.k); ++ packetdataserializer.writeShort(this.f); ++ packetdataserializer.writeShort(this.g); ++ packetdataserializer.writeShort(this.h); ++ this.l.a(packetdataserializer); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java +new file mode 100644 +index 0000000..9a40921 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateAttributes.java +@@ -0,0 +1,105 @@ ++package net.minecraft.server; ++ ++import com.google.common.collect.Lists; ++import java.util.*; ++ ++public class PacketPlayOutUpdateAttributes ++ implements Packet ++{ ++ public int a; ++ public final List b = new ArrayList(); ++ ++ public PacketPlayOutUpdateAttributes() ++ { ++ } ++ ++ public PacketPlayOutUpdateAttributes(int i, Collection collection) ++ { ++ a = i; ++ ++ for (AttributeInstance instance : collection) ++ this.b.add(new AttributeSnapshot(instance.getAttribute().getName(), instance.b(), instance.c())); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ { ++ a = packetdataserializer.e(); ++ int i = packetdataserializer.readInt(); ++ for(int j = 0; j < i; j++) ++ { ++ String s = packetdataserializer.c(64); ++ double d = packetdataserializer.readDouble(); ++ ArrayList arraylist = Lists.newArrayList(); ++ int k = packetdataserializer.e(); ++ for(int l = 0; l < k; l++) ++ { ++ java.util.UUID uuid = packetdataserializer.g(); ++ arraylist.add(new AttributeModifier(uuid, "Unknown synced attribute modifier", packetdataserializer.readDouble(), packetdataserializer.readByte())); ++ } ++ ++ b.add(new AttributeSnapshot(s, d, arraylist)); ++ } ++ ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ { ++ packetdataserializer.b(a); ++ packetdataserializer.writeInt(b.size()); ++ ++ for (AttributeSnapshot attributesnapshot : b) ++ { ++ packetdataserializer.a(attributesnapshot.a()); ++ packetdataserializer.writeDouble(attributesnapshot.b()); ++ packetdataserializer.b(attributesnapshot.c().size()); ++ Iterator iterator1 = attributesnapshot.c().iterator(); ++ while(iterator1.hasNext()) ++ { ++ AttributeModifier attributemodifier = (AttributeModifier)iterator1.next(); ++ packetdataserializer.a(attributemodifier.a()); ++ packetdataserializer.writeDouble(attributemodifier.d()); ++ packetdataserializer.writeByte(attributemodifier.c()); ++ } ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++ ++ public class AttributeSnapshot ++ { ++ private final String b; ++ private final double c; ++ private final Collection d; ++ ++ public AttributeSnapshot(String s, double d1, Collection collection) ++ { ++ b = s; ++ c = d1; ++ d = collection; ++ } ++ ++ public String a() ++ { ++ return b; ++ } ++ ++ public double b() ++ { ++ return c; ++ } ++ ++ public Collection c() ++ { ++ return d; ++ } ++} ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java +new file mode 100644 +index 0000000..c799c99 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java +@@ -0,0 +1,41 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutUpdateHealth ++ implements Packet ++{ ++ public float a; ++ public int b; ++ public float c; ++ ++ public PacketPlayOutUpdateHealth() ++ { ++ } ++ ++ public PacketPlayOutUpdateHealth(float f, int i, float f1) ++ { ++ a = f; ++ b = i; ++ c = f1; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ { ++ a = packetdataserializer.readFloat(); ++ b = packetdataserializer.e(); ++ c = packetdataserializer.readFloat(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ { ++ packetdataserializer.writeFloat(a); ++ packetdataserializer.b(b); ++ packetdataserializer.writeFloat(c); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +new file mode 100644 +index 0000000..4c2705b +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +@@ -0,0 +1,48 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++import java.util.List; ++ ++public class PacketPlayOutWindowItems ++ implements Packet ++{ ++ public int a; ++ public ItemStack[] b; ++ ++ public PacketPlayOutWindowItems() ++ { ++ } ++ ++ public PacketPlayOutWindowItems(int paramInt, List paramList) ++ { ++ this.a = paramInt; ++ this.b = new ItemStack[paramList.size()]; ++ for (int i = 0; i < this.b.length; i++) { ++ ItemStack localItemStack = (ItemStack)paramList.get(i); ++ this.b[i] = (localItemStack == null ? null : localItemStack.cloneItemStack()); ++ } ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.a = paramPacketDataSerializer.readUnsignedByte(); ++ int i = paramPacketDataSerializer.readShort(); ++ this.b = new ItemStack[i]; ++ for (int j = 0; j < i; j++) ++ this.b[j] = paramPacketDataSerializer.i(); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ paramPacketDataSerializer.writeByte(this.a); ++ paramPacketDataSerializer.writeShort(this.b.length); ++ for (ItemStack localItemStack : this.b) ++ paramPacketDataSerializer.a(localItemStack); ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++} +\ No newline at end of file +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0162-Modifiy-entity.patch b/Patches/CraftBukkit-Patches/0162-Modifiy-entity.patch new file mode 100644 index 000000000..dc07a0c75 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0162-Modifiy-entity.patch @@ -0,0 +1,804 @@ +From 9f12f0f7abe2a94fe4a724a7c17245b9c0f33a70 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:16:07 +1300 +Subject: [PATCH] Modifiy entity + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index e345dd7..cb9ba53 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -137,6 +137,31 @@ public abstract class Entity implements ICommandListener { + this.die(); + } + ++ private boolean _silent; ++ private boolean _invisible; ++ ++ public boolean isSilent() ++ { ++ return _silent; ++ } ++ ++ public void setSilent(boolean silent) ++ { ++ _silent = silent; ++ } ++ ++ public boolean isMineplexInvisible() ++ { ++ return _invisible; ++ } ++ ++ public void setMineplexInvisible(boolean invisible) ++ { ++ _invisible = invisible; ++ ++ setInvisible(isMineplexInvisible() || isInvisible()); ++ } ++ + public Entity(World world) { + this.id = Entity.entityCount++; + this.j = 1.0D; +@@ -684,7 +709,9 @@ public abstract class Entity implements ICommandListener { + this.makeSound(this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + } + +- this.a(blockposition, block); ++ if (!isSilent()) ++ this.a(blockposition, block); ++ + block.a(this.world, blockposition, this); // CraftBukkit moved from above + } + } +@@ -786,7 +813,7 @@ public abstract class Entity implements ICommandListener { + } + + public void makeSound(String s, float f, float f1) { +- if (!this.R()) { ++ if (!isSilent() && !this.R()) { + this.world.makeSound(this, s, f, f1); + } + +@@ -984,6 +1011,10 @@ public abstract class Entity implements ICommandListener { + this.lastZ = this.locZ = d2; + this.lastYaw = this.yaw = f; + this.lastPitch = this.pitch = f1; ++ ++ if (this instanceof EntityLiving) ++ ((EntityLiving) this).aK = f; ++ + double d3 = (double) (this.lastYaw - f); + + if (d3 < -180.0D) { +@@ -1537,7 +1568,7 @@ public abstract class Entity implements ICommandListener { + if (entity == null) { + if (this.vehicle != null) { + // CraftBukkit start +- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) { ++ if ((this.bukkitEntity instanceof LivingEntity) && vehicle.getBukkitEntity() instanceof Vehicle) { + VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); + pluginManager.callEvent(event); + +@@ -1557,7 +1588,7 @@ public abstract class Entity implements ICommandListener { + if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { + // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. + VehicleExitEvent exitEvent = null; +- if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) { ++ if (this.vehicle != null) { + exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); + pluginManager.callEvent(exitEvent); + +diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java +new file mode 100644 +index 0000000..c078fa6 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityBat.java +@@ -0,0 +1,206 @@ ++package net.minecraft.server; ++ ++import java.util.Calendar; ++ ++public class EntityBat extends EntityAmbient { ++ ++ private BlockPosition a; ++ private boolean _vegetated; ++ ++ public EntityBat(World world) { ++ super(world); ++ this.setSize(0.5F, 0.9F); ++ this.setAsleep(true); ++ ++ _vegetated = false; ++ } ++ ++ public void setVegetated(boolean flag) { ++ _vegetated = flag; ++ } ++ ++ public boolean isVegetated() { ++ return _vegetated; ++ } ++ ++ protected void h() { ++ super.h(); ++ this.datawatcher.a(16, new Byte((byte) 0)); ++ } ++ ++ protected float bB() { ++ return 0.1F; ++ } ++ ++ protected float bC() { ++ return super.bC() * 0.95F; ++ } ++ ++ protected String z() { ++ return this.isAsleep() && this.random.nextInt(4) != 0 ? null : "mob.bat.idle"; ++ } ++ ++ protected String bo() { ++ return "mob.bat.hurt"; ++ } ++ ++ protected String bp() { ++ return "mob.bat.death"; ++ } ++ ++ public boolean ae() { ++ return false; ++ } ++ ++ protected void s(Entity entity) {} ++ ++ protected void bL() {} ++ ++ protected void initAttributes() ++ { ++ super.initAttributes(); ++ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D); ++ } ++ ++ public boolean isAsleep() { ++ return (this.datawatcher.getByte(16) & 1) != 0; ++ } ++ ++ public void setAsleep(boolean flag) { ++ byte b0 = this.datawatcher.getByte(16); ++ ++ if (flag) { ++ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1))); ++ } else { ++ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2))); ++ } ++ ++ } ++ ++ public void t_() { ++ super.t_(); ++ ++ if (isVegetated()) ++ return; ++ ++ if (this.isAsleep()) { ++ this.motX = this.motY = this.motZ = 0.0D; ++ this.locY = (double) MathHelper.floor(this.locY) + 1.0D - (double) this.length; ++ } else { ++ this.motY *= 0.6000000238418579D; ++ } ++ ++ } ++ ++ protected void E() { ++ super.E(); ++ ++ if (isVegetated()) ++ return; ++ ++ BlockPosition blockposition = new BlockPosition(this); ++ BlockPosition blockposition1 = blockposition.up(); ++ ++ if (this.isAsleep()) { ++ if (!this.world.getType(blockposition1).getBlock().isOccluding()) { ++ this.setAsleep(false); ++ this.world.a((EntityHuman) null, 1015, blockposition, 0); ++ } else { ++ if (this.random.nextInt(200) == 0) { ++ this.aK = (float) this.random.nextInt(360); ++ } ++ ++ if (this.world.findNearbyPlayer(this, 4.0D) != null) { ++ this.setAsleep(false); ++ this.world.a((EntityHuman) null, 1015, blockposition, 0); ++ } ++ } ++ } else { ++ if (this.a != null && (!this.world.isEmpty(this.a) || this.a.getY() < 1)) { ++ this.a = null; ++ } ++ ++ if (this.a == null || this.random.nextInt(30) == 0 || this.a.c((double) ((int) this.locX), (double) ((int) this.locY), (double) ((int) this.locZ)) < 4.0D) { ++ this.a = new BlockPosition((int) this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int) this.locY + this.random.nextInt(6) - 2, (int) this.locZ + this.random.nextInt(7) - this.random.nextInt(7)); ++ } ++ ++ double d0 = (double) this.a.getX() + 0.5D - this.locX; ++ double d1 = (double) this.a.getY() + 0.1D - this.locY; ++ double d2 = (double) this.a.getZ() + 0.5D - this.locZ; ++ ++ this.motX += (Math.signum(d0) * 0.5D - this.motX) * 0.10000000149011612D; ++ this.motY += (Math.signum(d1) * 0.699999988079071D - this.motY) * 0.10000000149011612D; ++ this.motZ += (Math.signum(d2) * 0.5D - this.motZ) * 0.10000000149011612D; ++ float f = (float) (MathHelper.b(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) - 90.0F; ++ float f1 = MathHelper.g(f - this.yaw); ++ ++ this.ba = 0.5F; ++ this.yaw += f1; ++ if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).getBlock().isOccluding()) { ++ this.setAsleep(true); ++ } ++ } ++ ++ } ++ ++ protected boolean s_() { ++ return false; ++ } ++ ++ public void e(float f, float f1) {} ++ ++ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {} ++ ++ public boolean aI() { ++ return true; ++ } ++ ++ public boolean damageEntity(DamageSource damagesource, float f) { ++ if (this.isInvulnerable(damagesource)) { ++ return false; ++ } else { ++ if (!this.world.isClientSide && this.isAsleep()) { ++ this.setAsleep(false); ++ } ++ ++ return super.damageEntity(damagesource, f); ++ } ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) { ++ super.a(nbttagcompound); ++ this.datawatcher.watch(16, Byte.valueOf(nbttagcompound.getByte("BatFlags"))); ++ } ++ ++ public void b(NBTTagCompound nbttagcompound) { ++ super.b(nbttagcompound); ++ nbttagcompound.setByte("BatFlags", this.datawatcher.getByte(16)); ++ } ++ ++ public boolean bR() { ++ BlockPosition blockposition = new BlockPosition(this.locX, this.getBoundingBox().b, this.locZ); ++ ++ if (blockposition.getY() >= this.world.F()) { ++ return false; ++ } else { ++ int i = this.world.getLightLevel(blockposition); ++ byte b0 = 4; ++ ++ if (this.a(this.world.Y())) { ++ b0 = 7; ++ } else if (this.random.nextBoolean()) { ++ return false; ++ } ++ ++ return i > this.random.nextInt(b0) ? false : super.bR(); ++ } ++ } ++ ++ private boolean a(Calendar calendar) { ++ return calendar.get(2) + 1 == 10 && calendar.get(5) >= 20 || calendar.get(2) + 1 == 11 && calendar.get(5) <= 3; ++ } ++ ++ public float getHeadHeight() { ++ return this.length / 2.0F; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java +new file mode 100644 +index 0000000..a759e00 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityBlaze.java +@@ -0,0 +1,207 @@ ++package net.minecraft.server; ++ ++public class EntityBlaze extends EntityMonster { ++ ++ private float a = 0.5F; ++ private int b; ++ ++ public EntityBlaze(World world) { ++ super(world); ++ this.fireProof = true; ++ this.b_ = 10; ++ this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this)); ++ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); ++ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); ++ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); ++ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); ++ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0])); ++ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true)); ++ } ++ ++ protected void initAttributes() { ++ super.initAttributes(); ++ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6.0D); ++ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D); ++ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(48.0D); ++ } ++ ++ protected void h() { ++ super.h(); ++ this.datawatcher.a(16, new Byte((byte) 0)); ++ } ++ ++ protected String z() { ++ return "mob.blaze.breathe"; ++ } ++ ++ protected String bo() { ++ return "mob.blaze.hit"; ++ } ++ ++ protected String bp() { ++ return "mob.blaze.death"; ++ } ++ ++ public float c(float f) { ++ return 1.0F; ++ } ++ ++ public void m() { ++ if (!isVegetated() && !this.onGround && this.motY < 0.0D) { ++ this.motY *= 0.6D; ++ } ++ ++ if (this.world.isClientSide) { ++ if (this.random.nextInt(24) == 0 && !this.R()) { ++ this.world.a(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F, false); ++ } ++ ++ for (int i = 0; i < 2; ++i) { ++ this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); ++ } ++ } ++ ++ super.m(); ++ } ++ ++ protected void E() { ++ if (this.U()) { ++ this.damageEntity(DamageSource.DROWN, 1.0F); ++ } ++ ++ --this.b; ++ if (this.b <= 0) { ++ this.b = 100; ++ this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F; ++ } ++ ++ EntityLiving entityliving = this.getGoalTarget(); ++ ++ if (!isVegetated() && entityliving != null && entityliving.locY + (double) entityliving.getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) { ++ this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D; ++ this.ai = true; ++ } ++ ++ super.E(); ++ } ++ ++ public void e(float f, float f1) {} ++ ++ protected Item getLoot() { ++ return Items.BLAZE_ROD; ++ } ++ ++ public boolean isBurning() { ++ return this.n(); ++ } ++ ++ protected void dropDeathLoot(boolean flag, int i) { ++ if (flag) { ++ int j = this.random.nextInt(2 + i); ++ ++ for (int k = 0; k < j; ++k) { ++ this.a(Items.BLAZE_ROD, 1); ++ } ++ } ++ ++ } ++ ++ public boolean n() { ++ return (this.datawatcher.getByte(16) & 1) != 0; ++ } ++ ++ public void a(boolean flag) { ++ byte b0 = this.datawatcher.getByte(16); ++ ++ if (flag) { ++ b0 = (byte) (b0 | 1); ++ } else { ++ b0 &= -2; ++ } ++ ++ this.datawatcher.watch(16, Byte.valueOf(b0)); ++ } ++ ++ protected boolean n_() { ++ return true; ++ } ++ ++ static class PathfinderGoalBlazeFireball extends PathfinderGoal { ++ ++ private EntityBlaze a; ++ private int b; ++ private int c; ++ ++ public PathfinderGoalBlazeFireball(EntityBlaze entityblaze) { ++ this.a = entityblaze; ++ this.a(3); ++ } ++ ++ public boolean a() { ++ EntityLiving entityliving = this.a.getGoalTarget(); ++ ++ return entityliving != null && entityliving.isAlive(); ++ } ++ ++ public void c() { ++ this.b = 0; ++ } ++ ++ public void d() { ++ this.a.a(false); ++ } ++ ++ public void e() { ++ --this.c; ++ EntityLiving entityliving = this.a.getGoalTarget(); ++ double d0 = this.a.h(entityliving); ++ ++ if (d0 < 4.0D) { ++ if (this.c <= 0) { ++ this.c = 20; ++ this.a.r(entityliving); ++ } ++ ++ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D); ++ } else if (d0 < 256.0D) { ++ double d1 = entityliving.locX - this.a.locX; ++ double d2 = entityliving.getBoundingBox().b + (double) (entityliving.length / 2.0F) - (this.a.locY + (double) (this.a.length / 2.0F)); ++ double d3 = entityliving.locZ - this.a.locZ; ++ ++ if (this.c <= 0) { ++ ++this.b; ++ if (this.b == 1) { ++ this.c = 60; ++ this.a.a(true); ++ } else if (this.b <= 4) { ++ this.c = 6; ++ } else { ++ this.c = 100; ++ this.b = 0; ++ this.a.a(false); ++ } ++ ++ if (this.b > 1) { ++ float f = MathHelper.c(MathHelper.sqrt(d0)) * 0.5F; ++ ++ this.a.world.a((EntityHuman) null, 1009, new BlockPosition((int) this.a.locX, (int) this.a.locY, (int) this.a.locZ), 0); ++ ++ for (int i = 0; i < 1; ++i) { ++ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.a.world, this.a, d1 + this.a.bc().nextGaussian() * (double) f, d2, d3 + this.a.bc().nextGaussian() * (double) f); ++ ++ entitysmallfireball.locY = this.a.locY + (double) (this.a.length / 2.0F) + 0.5D; ++ this.a.world.addEntity(entitysmallfireball); ++ } ++ } ++ } ++ ++ this.a.getControllerLook().a(entityliving, 10.0F, 10.0F); ++ } else { ++ this.a.getNavigation().n(); ++ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D); ++ } ++ ++ super.e(); ++ } ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +index d246ae7..ed7f549 100644 +--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +@@ -51,6 +51,18 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo + this.ah = true; + } + ++ public void setTargetBlock(int x, int y, int z) { ++ // Mineplex ++ this.a = x; ++ this.b = y; ++ this.c = z; ++ this.target = null; ++ } ++ ++ public void setTargetEntity(Entity e) { ++ this.target = e; ++ } ++ + protected void initAttributes() { + super.initAttributes(); + this.getAttributeInstance(GenericAttributes.maxHealth).setValue(200.0D); +@@ -170,7 +182,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo + this.c += this.random.nextGaussian() * 2.0D; + } + +- if (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) { ++ if (!isVegetated() && (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E)) { + this.cf(); + } + +@@ -253,7 +265,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo + this.bs.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); + this.bt.t_(); + this.bt.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); +- if (!this.world.isClientSide && this.hurtTicks == 0) { ++ if (!this.world.isClientSide && this.hurtTicks == 0 && !isGhost()) { + this.a(this.world.getEntities(this, this.bs.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); + this.a(this.world.getEntities(this, this.bt.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); + this.b(this.world.getEntities(this, this.bn.getBoundingBox().grow(1.0D, 1.0D, 1.0D))); +diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +index 7a42040..d3403a1 100644 +--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +@@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity { + private float fallHurtAmount = 2.0F; + public NBTTagCompound tileEntityData; + ++ public boolean spectating; ++ + public EntityFallingBlock(World world) { + super(world); + } +@@ -42,7 +44,15 @@ public class EntityFallingBlock extends Entity { + protected void h() {} + + public boolean ad() { +- return !this.dead; ++ return !this.dead && !spectating; ++ } ++ ++ @Override ++ public boolean damageEntity(DamageSource damagesource, float f) ++ { ++ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f); ++ ++ return true; + } + + public void t_() { +diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java +index f131419..f293118 100644 +--- a/src/main/java/net/minecraft/server/EntityHorse.java ++++ b/src/main/java/net/minecraft/server/EntityHorse.java +@@ -125,6 +125,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { + private void c(int i, boolean flag) { + int j = this.datawatcher.getInt(16); + ++ if (isVegetated()) ++ return; ++ + if (flag) { + this.datawatcher.watch(16, Integer.valueOf(j | i)); + } else { +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index a8a327d..b7647bc 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -34,6 +34,10 @@ public abstract class EntityInsentient extends EntityLiving { + private Entity bp; + private NBTTagCompound bq; + ++ private boolean _vegetated; ++ private boolean _shouldBreakLeash = true; ++ private boolean _pullWhileLeashed = true; ++ + public EntityInsentient(World world) { + super(world); + this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null); +@@ -53,6 +57,32 @@ public abstract class EntityInsentient extends EntityLiving { + this.persistent = !isTypeNotPersistent(); + // CraftBukkit end + } ++ ++ public void setVegetated(boolean flag) { ++ _vegetated = flag; ++ } ++ ++ public void setShouldBreakLeash(boolean shouldBreakLeash) ++ { ++ _shouldBreakLeash = shouldBreakLeash; ++ } ++ ++ public void setPullWhileLeashed(boolean pullWhileLeashed) ++ { ++ _pullWhileLeashed = pullWhileLeashed; ++ } ++ ++ public boolean isVegetated() { ++ return _vegetated; ++ } ++ ++ public boolean shouldBreakLeash() { ++ return shouldBreakLeash(); ++ } ++ ++ public boolean shouldPullWhileLeashed() { ++ return _pullWhileLeashed; ++ } + + protected void initAttributes() { + super.initAttributes(); +@@ -148,7 +178,7 @@ public abstract class EntityInsentient extends EntityLiving { + public void K() { + super.K(); + this.world.methodProfiler.a("mobBaseTick"); +- if (this.isAlive() && this.random.nextInt(1000) < this.a_++) { ++ if (!isSilent() && this.isAlive() && this.random.nextInt(1000) < this.a_++) { + this.a_ = -this.w(); + this.x(); + } +@@ -770,7 +800,7 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public final boolean e(EntityHuman entityhuman) { +- if (this.cc() && this.getLeashHolder() == entityhuman) { ++ if (this.cc() && this.getLeashHolder() == entityhuman && _shouldBreakLeash) { + // CraftBukkit start - fire PlayerUnleashEntityEvent + if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); +@@ -835,7 +865,7 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public void unleash(boolean flag, boolean flag1) { +- if (this.bo) { ++ if (this.bo && _shouldBreakLeash) { + this.bo = false; + this.bp = null; + if (!this.world.isClientSide && flag1) { +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 3c852fd..b861dbe 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -101,6 +101,18 @@ public abstract class EntityLiving extends Entity { + this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); + } + ++ private boolean _ghost; ++ ++ public boolean isGhost() ++ { ++ return _ghost; ++ } ++ ++ public void setGhost(boolean ghost) ++ { ++ _ghost = ghost; ++ } ++ + public EntityLiving(World world) { + super(world); + this.initAttributes(); +@@ -1783,7 +1795,7 @@ public abstract class EntityLiving extends Entity { + } + + public boolean ad() { +- return !this.dead; ++ return !isGhost() && !this.dead; + } + + public boolean ae() { +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 3810f86..44ac587 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -65,10 +65,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + // Spigot start + public boolean collidesWithEntities = true; + ++ public boolean spectating; ++ + @Override + public boolean ad() + { +- return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) ++ return !spectating && this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) + } + + @Override +diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +index 2d22327..83e71c1 100644 +--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +@@ -9,6 +9,8 @@ public class EntityTNTPrimed extends Entity { + public float yield = 4; // CraftBukkit - add field + public boolean isIncendiary = false; // CraftBukkit - add field + ++ public boolean spectating; ++ + public EntityTNTPrimed(World world) { + super(world); + this.k = true; +@@ -37,7 +39,7 @@ public class EntityTNTPrimed extends Entity { + } + + public boolean ad() { +- return !this.dead; ++ return !spectating && !this.dead; + } + + public void t_() { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 5317cff..60e8584 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -74,6 +74,46 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + } + } + ++ public boolean shouldBreakLeash() ++ { ++ return ((EntityInsentient) getHandle()).shouldBreakLeash(); ++ } ++ ++ public void setShouldBreakLeash(boolean shouldBreakLeash) ++ { ++ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash); ++ } ++ ++ public boolean shouldPullWhileLeashed() ++ { ++ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed(); ++ } ++ ++ public void setPullWhileLeashed(boolean pullWhileLeashed) ++ { ++ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed); ++ } ++ ++ public boolean isVegetated() ++ { ++ return ((EntityInsentient) getHandle()).isVegetated(); ++ } ++ ++ public void setVegetated(boolean vegetated) ++ { ++ ((EntityInsentient) getHandle()).setVegetated(vegetated); ++ } ++ ++ public boolean isGhost() ++ { ++ return getHandle().isGhost(); ++ } ++ ++ public void setGhost(boolean ghost) ++ { ++ getHandle().setGhost(ghost); ++ } ++ + public double getHealth() { + return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth()); + } +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0163-Chunk-changes.patch b/Patches/CraftBukkit-Patches/0163-Chunk-changes.patch new file mode 100644 index 000000000..7901d3dae --- /dev/null +++ b/Patches/CraftBukkit-Patches/0163-Chunk-changes.patch @@ -0,0 +1,235 @@ +From 71c20f9d0c8bfa388f6bf0ba1a7b765a83e9de2a Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:21:32 +1300 +Subject: [PATCH] Chunk changes + + +diff --git a/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java +new file mode 100644 +index 0000000..3f16935 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java +@@ -0,0 +1,31 @@ ++package com.mineplex.spigot; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++public class ChunkAddEntityEvent extends Event ++{ ++ private static final HandlerList handlers = new HandlerList(); ++ private Entity _entity; ++ ++ public ChunkAddEntityEvent(Entity _entity) ++ { ++ this._entity = _entity; ++ } ++ ++ public Entity getEntity() ++ { ++ return _entity; ++ } ++ ++ public HandlerList getHandlers() ++ { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() ++ { ++ return handlers; ++ } ++} +diff --git a/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java +new file mode 100644 +index 0000000..564efe6 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java +@@ -0,0 +1,60 @@ ++package com.mineplex.spigot; ++ ++import org.bukkit.World; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++public class ChunkPreLoadEvent extends Event implements Cancellable ++{ ++ private static final HandlerList handlers = new HandlerList(); ++ private boolean _cancelled; ++ private World _world; ++ private int _x; ++ private int _z; ++ ++ public ChunkPreLoadEvent(World world, int x, int z) ++ { ++ _world = world; ++ _x = x; ++ _z = z; ++ } ++ ++ public World getWorld() ++ { ++ return _world; ++ } ++ ++ public int getX() ++ { ++ return _x; ++ } ++ ++ public int getZ() ++ { ++ return _z; ++ } ++ ++ @Override ++ public boolean isCancelled() ++ { ++ return _cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) ++ { ++ _cancelled = cancel; ++ } ++ ++ @Override ++ public HandlerList getHandlers() ++ { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() ++ { ++ return handlers; ++ } ++} +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 022ba31..464d0c2 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -11,6 +11,8 @@ import java.util.Map; + import java.util.Random; + import java.util.concurrent.Callable; + import java.util.concurrent.ConcurrentLinkedQueue; ++ ++import com.mineplex.spigot.ChunkAddEntityEvent; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -660,6 +662,9 @@ public class Chunk { + entity.die(); + } + ++ ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity); ++ Bukkit.getServer().getPluginManager().callEvent(event); ++ + int k = MathHelper.floor(entity.locY / 16.0D); + + if (k < 0) { +@@ -1317,6 +1322,10 @@ public class Chunk { + return this.done; + } + ++ public void setDone(boolean done) { ++ this.done = done; ++ } ++ + public void d(boolean flag) { + this.done = flag; + } +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 975d666..a55bd6c 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -8,6 +8,8 @@ import java.util.Iterator; + import java.util.List; + import java.util.Set; + import java.util.concurrent.ConcurrentHashMap; ++ ++import com.mineplex.spigot.ChunkPreLoadEvent; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -88,6 +90,13 @@ public class ChunkProviderServer implements IChunkProvider { + + } + ++ private boolean callChunkPreLoad(int i, int j) ++ { ++ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j); ++ world.getServer().getPluginManager().callEvent(event); ++ return event.isCancelled(); ++ } ++ + // CraftBukkit start - Add async variant, provide compatibility + public Chunk getChunkIfLoaded(int x, int z) { + return chunks.get(LongHash.toLong(x, z)); +@@ -109,10 +118,30 @@ public class ChunkProviderServer implements IChunkProvider { + // We can only use the queue for already generated chunks + if (chunk == null && loader != null && loader.chunkExists(world, i, j)) { + if (runnable != null) { +- ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable); ++ if (callChunkPreLoad(i, j)) ++ { ++ runnable.run(); ++ chunk = new EmptyChunk(world, i, j); ++ chunk.setDone(true); ++ chunks.put(LongHash.toLong(i, j), chunk); ++ } ++ else ++ { ++ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable); ++ } ++ + return null; + } else { +- chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j); ++ if (callChunkPreLoad(i, j)) ++ { ++ chunk = new EmptyChunk(world, i, j); ++ chunk.setDone(true); ++ chunks.put(LongHash.toLong(i, j), chunk); ++ } ++ else ++ { ++ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j); ++ } + } + } else if (chunk == null) { + chunk = originalGetChunkAt(i, j); +@@ -131,6 +160,20 @@ public class ChunkProviderServer implements IChunkProvider { + boolean newChunk = false; + // CraftBukkit end + ++ Server server = world.getServer(); ++ ++ if (chunk == null && server != null) ++ { ++ if (callChunkPreLoad(i, j)) ++ { ++ chunk = new EmptyChunk(world, i, j); ++ chunk.setDone(true); ++ chunks.put(LongHash.toLong(i, j), chunk); ++ ++ return chunk; ++ } ++ } ++ + if (chunk == null) { + world.timings.syncChunkLoadTimer.startTiming(); // Spigot + chunk = this.loadChunk(i, j); +@@ -158,7 +201,6 @@ public class ChunkProviderServer implements IChunkProvider { + chunk.addEntities(); + + // CraftBukkit start +- Server server = world.getServer(); + if (server != null) { + /* + * If it's a new world, the first few chunks are generated inside +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0164-Packet-listener-changes.patch b/Patches/CraftBukkit-Patches/0164-Packet-listener-changes.patch new file mode 100644 index 000000000..cb217719b --- /dev/null +++ b/Patches/CraftBukkit-Patches/0164-Packet-listener-changes.patch @@ -0,0 +1,353 @@ +From 47c08a6099856faf0049c0b0cdde495a8ae4166e Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:22:05 +1300 +Subject: [PATCH] Packet listener changes + + +diff --git a/src/main/java/com/mineplex/spigot/IPacketVerifier.java b/src/main/java/com/mineplex/spigot/IPacketVerifier.java +new file mode 100644 +index 0000000..f86dfd1 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/IPacketVerifier.java +@@ -0,0 +1,8 @@ ++package com.mineplex.spigot; ++ ++import net.minecraft.server.Packet; ++ ++public interface IPacketVerifier ++{ ++ public boolean handlePacket(Packet packet); ++} +\ No newline at end of file +diff --git a/src/main/java/com/mineplex/spigot/PacketProcessor.java b/src/main/java/com/mineplex/spigot/PacketProcessor.java +new file mode 100644 +index 0000000..5695899 +--- /dev/null ++++ b/src/main/java/com/mineplex/spigot/PacketProcessor.java +@@ -0,0 +1,250 @@ ++package com.mineplex.spigot; ++ ++import java.util.ArrayList; ++import java.util.List; ++import java.util.HashMap; ++import io.netty.util.concurrent.GenericFutureListener; ++ ++import net.minecraft.server.NetworkManager; ++import net.minecraft.server.IChatBaseComponent; ++ ++import net.minecraft.server.Packet; ++import net.minecraft.server.PacketListenerPlayIn; ++import net.minecraft.server.IUpdatePlayerListBox; ++import net.minecraft.server.PlayerConnection; ++import net.minecraft.server.PacketPlayInChat; ++import net.minecraft.server.PacketPlayInTabComplete; ++import net.minecraft.server.PacketPlayInClientCommand; ++import net.minecraft.server.PacketPlayInSettings; ++import net.minecraft.server.PacketPlayInTransaction; ++import net.minecraft.server.PacketPlayInEnchantItem; ++import net.minecraft.server.PacketPlayInWindowClick; ++import net.minecraft.server.PacketPlayInCloseWindow; ++import net.minecraft.server.PacketPlayInCustomPayload; ++import net.minecraft.server.PacketPlayInUseEntity; ++import net.minecraft.server.PacketPlayInKeepAlive; ++import net.minecraft.server.PacketPlayInFlying; ++import net.minecraft.server.PacketPlayInAbilities; ++import net.minecraft.server.PacketPlayInBlockDig; ++import net.minecraft.server.PacketPlayInEntityAction; ++import net.minecraft.server.PacketPlayInSteerVehicle; ++import net.minecraft.server.PacketPlayInHeldItemSlot; ++import net.minecraft.server.PacketPlayInSetCreativeSlot; ++import net.minecraft.server.PacketPlayInUpdateSign; ++import net.minecraft.server.PacketPlayInBlockPlace; ++import net.minecraft.server.PacketPlayInSpectate; ++import net.minecraft.server.PacketPlayInResourcePackStatus; ++import net.minecraft.server.PacketPlayInArmAnimation; ++ ++public class PacketProcessor implements PacketListenerPlayIn, IUpdatePlayerListBox ++{ ++ private IPacketVerifier _packetVerifier; ++ private PlayerConnection _packetListener; ++ private static volatile HashMap _listenedPackets = new HashMap(); ++ ++ public PacketProcessor(PlayerConnection packetListener) ++ { ++ _packetListener = packetListener; ++ } ++ ++ public void setPacketVerifier(IPacketVerifier verifier) ++ { ++ _packetVerifier = verifier; ++ } ++ ++ public void c() ++ { ++ _packetListener.c(); ++ } ++ ++ public static void addPacket(Class packetClass, boolean forceMainThread) ++ { ++ _listenedPackets.put(packetClass, forceMainThread); ++ } ++ ++ public static void removePacket(Class packetClass) ++ { ++ _listenedPackets.remove(packetClass); ++ } ++ ++ public void processOutgoingPacket(Packet packet, NetworkManager networkManager) ++ { ++ if (!_listenedPackets.containsKey(packet.getClass())) ++ { ++ networkManager.handle(packet); ++ return; ++ } ++ ++ boolean addDefaultPacket = true; ++ ++ if (_packetVerifier != null) ++ { ++ if (!_packetVerifier.handlePacket(packet)) ++ { ++ addDefaultPacket = false; ++ } ++ } ++ ++ if (addDefaultPacket) ++ { ++ networkManager.handle(packet); ++ } ++ } ++ ++ public void processIncomingPacket(final Packet packet) ++ { ++ if (!_listenedPackets.containsKey(packet.getClass())) ++ { ++ packet.a(_packetListener); ++ return; ++ } ++ ++ if (!_packetListener.player.u().isMainThread() && _listenedPackets.get(packet.getClass())) ++ { ++ _packetListener.player.u().postToMainThread(new Runnable() ++ { ++ public void run() ++ { ++ processIncomingPacket(packet); ++ } ++ }); ++ ++ return; ++ } ++ ++ boolean addDefaultPacket = true; ++ ++ if (_packetVerifier != null) ++ { ++ if (!_packetVerifier.handlePacket(packet)) ++ { ++ addDefaultPacket = false; ++ } ++ } ++ ++ if (addDefaultPacket) ++ { ++ packet.a(_packetListener); ++ } ++ } ++ ++ public void a(PacketPlayInChat packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInTabComplete packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInClientCommand packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInSettings packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInTransaction packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInEnchantItem packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInWindowClick packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInCloseWindow packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInCustomPayload packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInUseEntity packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInKeepAlive packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInFlying packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInAbilities packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInBlockDig packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInEntityAction packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInSteerVehicle packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInHeldItemSlot packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInSetCreativeSlot packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInUpdateSign packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInBlockPlace packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInSpectate packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInResourcePackStatus packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(PacketPlayInArmAnimation packet) ++ { ++ processIncomingPacket(packet); ++ } ++ ++ public void a(IChatBaseComponent packet) ++ { ++ _packetListener.a(packet); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +index 9d23c6c..83a600c 100644 +--- a/src/main/java/net/minecraft/server/NetworkManager.java ++++ b/src/main/java/net/minecraft/server/NetworkManager.java +@@ -27,6 +27,8 @@ import org.apache.logging.log4j.Logger; + import org.apache.logging.log4j.Marker; + import org.apache.logging.log4j.MarkerManager; + ++import com.mineplex.spigot.PacketProcessor; ++ + public class NetworkManager extends SimpleChannelInboundHandler { + + private static final Logger g = LogManager.getLogger(); +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 5740e49..5edef3e 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -62,6 +62,8 @@ import org.bukkit.inventory.InventoryView; + import org.bukkit.util.NumberConversions; + // CraftBukkit end + ++import com.mineplex.spigot.PacketProcessor; ++ + public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox { + + private static final Logger c = LogManager.getLogger(); +@@ -87,15 +89,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + private boolean checkMovement = true; + private boolean processedDisconnect; // CraftBukkit - added + ++ public PacketProcessor PacketVerifier; ++ + public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { + this.minecraftServer = minecraftserver; + this.networkManager = networkmanager; +- networkmanager.a((PacketListener) this); + this.player = entityplayer; + entityplayer.playerConnection = this; + + // CraftBukkit start - add fields and methods + this.server = minecraftserver.server; ++ ++ ++ PacketVerifier = new PacketProcessor(this); ++ networkmanager.a(PacketVerifier); + } + + private final org.bukkit.craftbukkit.CraftServer server; +@@ -904,7 +911,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + // CraftBukkit end + + try { +- this.networkManager.handle(packet); ++ PacketVerifier.processOutgoingPacket(packet, networkManager); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); +@@ -1408,9 +1415,12 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + if (this.player.dead) return; // CraftBukkit + PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u()); + +- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit ++ if (packetplayinclosewindow.id == player.activeContainer.windowId) ++ { ++ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit + +- this.player.p(); ++ this.player.p(); ++ } + } + + public void a(PacketPlayInWindowClick packetplayinwindowclick) { +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0165-Inventory-changes.patch b/Patches/CraftBukkit-Patches/0165-Inventory-changes.patch new file mode 100644 index 000000000..16d404512 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0165-Inventory-changes.patch @@ -0,0 +1,428 @@ +From 702360d29859ed580b44255ccb7f2f124e6aa24b Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:22:36 +1300 +Subject: [PATCH] Inventory changes + + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +index e9a3c50..9fd6359 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +@@ -441,8 +441,8 @@ public class CraftInventory implements Inventory { + return InventoryType.ENCHANTING; + } else if (inventory instanceof TileEntityBrewingStand) { + return InventoryType.BREWING; +- } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) { +- return ((CraftInventoryCustom.MinecraftInventory) inventory).getType(); ++ } else if (inventory instanceof MinecraftInventory) { ++ return ((MinecraftInventory) inventory).getType(); + } else if (inventory instanceof InventoryEnderChest) { + return InventoryType.ENDER_CHEST; + } else if (inventory instanceof InventoryMerchant) { +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +index 947c493..eed9afa 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +@@ -31,168 +31,4 @@ public class CraftInventoryCustom extends CraftInventory { + public CraftInventoryCustom(InventoryHolder owner, int size, String title) { + super(new MinecraftInventory(owner, size, title)); + } +- +- static class MinecraftInventory implements IInventory { +- private final ItemStack[] items; +- private int maxStack = MAX_STACK; +- private final List viewers; +- private final String title; +- private InventoryType type; +- private final InventoryHolder owner; +- +- public MinecraftInventory(InventoryHolder owner, InventoryType type) { +- this(owner, type.getDefaultSize(), type.getDefaultTitle()); +- this.type = type; +- } +- +- public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { +- this(owner, type.getDefaultSize(), title); +- this.type = type; +- } +- +- public MinecraftInventory(InventoryHolder owner, int size) { +- this(owner, size, "Chest"); +- } +- +- public MinecraftInventory(InventoryHolder owner, int size, String title) { +- Validate.notNull(title, "Title cannot be null"); +- Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); +- this.items = new ItemStack[size]; +- this.title = title; +- this.viewers = new ArrayList(); +- this.owner = owner; +- this.type = InventoryType.CHEST; +- } +- +- public int getSize() { +- return items.length; +- } +- +- public ItemStack getItem(int i) { +- return items[i]; +- } +- +- public ItemStack splitStack(int i, int j) { +- ItemStack stack = this.getItem(i); +- ItemStack result; +- if (stack == null) return null; +- if (stack.count <= j) { +- this.setItem(i, null); +- result = stack; +- } else { +- result = CraftItemStack.copyNMSStack(stack, j); +- stack.count -= j; +- } +- this.update(); +- return result; +- } +- +- public ItemStack splitWithoutUpdate(int i) { +- ItemStack stack = this.getItem(i); +- ItemStack result; +- if (stack == null) return null; +- if (stack.count <= 1) { +- this.setItem(i, null); +- result = stack; +- } else { +- result = CraftItemStack.copyNMSStack(stack, 1); +- stack.count -= 1; +- } +- return result; +- } +- +- public void setItem(int i, ItemStack itemstack) { +- items[i] = itemstack; +- if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { +- itemstack.count = this.getMaxStackSize(); +- } +- } +- +- public int getMaxStackSize() { +- return maxStack; +- } +- +- public void setMaxStackSize(int size) { +- maxStack = size; +- } +- +- public void update() {} +- +- public boolean a(EntityHuman entityhuman) { +- return true; +- } +- +- public ItemStack[] getContents() { +- return items; +- } +- +- public void onOpen(CraftHumanEntity who) { +- viewers.add(who); +- } +- +- public void onClose(CraftHumanEntity who) { +- viewers.remove(who); +- } +- +- public List getViewers() { +- return viewers; +- } +- +- public InventoryType getType() { +- return type; +- } +- +- public InventoryHolder getOwner() { +- return owner; +- } +- +- public boolean b(int i, ItemStack itemstack) { +- return true; +- } +- +- @Override +- public void startOpen(EntityHuman entityHuman) { +- +- } +- +- @Override +- public void closeContainer(EntityHuman entityHuman) { +- +- } +- +- @Override +- public int getProperty(int i) { +- return 0; +- } +- +- @Override +- public void b(int i, int i1) { +- +- } +- +- @Override +- public int g() { +- return 0; +- } +- +- @Override +- public void l() { +- +- } +- +- @Override +- public String getName() { +- return title; +- } +- +- @Override +- public boolean hasCustomName() { +- return title != null; +- } +- +- @Override +- public IChatBaseComponent getScoreboardDisplayName() { +- return new ChatComponentText(title); +- } +- } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +index 23f05f4..fdaf026 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +@@ -26,7 +26,7 @@ import net.minecraft.server.NBTTagString; + import org.bukkit.craftbukkit.util.CraftChatMessage; + + @DelegateDeserialization(ItemStack.class) +-public final class CraftItemStack extends ItemStack { ++public class CraftItemStack extends ItemStack { + + public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) { + if (original instanceof CraftItemStack) { +@@ -95,26 +95,30 @@ public final class CraftItemStack extends ItemStack { + /** + * Mirror + */ +- private CraftItemStack(net.minecraft.server.ItemStack item) { ++ protected CraftItemStack(net.minecraft.server.ItemStack item) { + this.handle = item; + } + +- private CraftItemStack(ItemStack item) { ++ protected CraftItemStack(ItemStack item) { + this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null); + } + +- private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { ++ protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { + setType(type); + setAmount(amount); + setDurability(durability); + setItemMeta(itemMeta); + } + +- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { ++ protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { + this(Material.getMaterial(typeId), amount, durability, itemMeta); + + } + ++ public net.minecraft.server.ItemStack getHandle() { ++ return handle; ++ } ++ + @Override + public int getTypeId() { + return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java +new file mode 100644 +index 0000000..f0d8f81 +--- /dev/null ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java +@@ -0,0 +1,177 @@ ++package org.bukkit.craftbukkit.inventory; ++ ++import net.minecraft.server.*; ++import org.apache.commons.lang.Validate; ++import org.bukkit.craftbukkit.entity.CraftHumanEntity; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.entity.HumanEntity; ++import org.bukkit.event.inventory.InventoryType; ++import org.bukkit.inventory.InventoryHolder; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++public class MinecraftInventory implements IInventory ++{ ++ private final ItemStack[] items; ++ private int maxStack = MAX_STACK; ++ private final List viewers; ++ private final String title; ++ private InventoryType type; ++ private final InventoryHolder owner; ++ ++ public MinecraftInventory(InventoryHolder owner, InventoryType type) { ++ this(owner, type.getDefaultSize(), type.getDefaultTitle()); ++ this.type = type; ++ } ++ ++ public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) { ++ this(owner, type.getDefaultSize(), title); ++ this.type = type; ++ } ++ ++ public MinecraftInventory(InventoryHolder owner, int size) { ++ this(owner, size, "Chest"); ++ } ++ ++ public MinecraftInventory(InventoryHolder owner, int size, String title) { ++ Validate.notNull(title, "Title cannot be null"); ++ Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); ++ this.items = new ItemStack[size]; ++ this.title = title; ++ this.viewers = new ArrayList(); ++ this.owner = owner; ++ this.type = InventoryType.CHEST; ++ } ++ ++ public int getSize() { ++ return items.length; ++ } ++ ++ public ItemStack getItem(int i) { ++ return items[i]; ++ } ++ ++ public ItemStack splitStack(int i, int j) { ++ ItemStack stack = this.getItem(i); ++ ItemStack result; ++ if (stack == null) return null; ++ if (stack.count <= j) { ++ this.setItem(i, null); ++ result = stack; ++ } else { ++ result = CraftItemStack.copyNMSStack(stack, j); ++ stack.count -= j; ++ } ++ this.update(); ++ return result; ++ } ++ ++ public ItemStack splitWithoutUpdate(int i) { ++ ItemStack stack = this.getItem(i); ++ ItemStack result; ++ if (stack == null) return null; ++ if (stack.count <= 1) { ++ this.setItem(i, null); ++ result = stack; ++ } else { ++ result = CraftItemStack.copyNMSStack(stack, 1); ++ stack.count -= 1; ++ } ++ return result; ++ } ++ ++ public void setItem(int i, ItemStack itemstack) { ++ items[i] = itemstack; ++ if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { ++ itemstack.count = this.getMaxStackSize(); ++ } ++ } ++ ++ public int getMaxStackSize() { ++ return maxStack; ++ } ++ ++ public void setMaxStackSize(int size) { ++ maxStack = size; ++ } ++ ++ public void update() {} ++ ++ public boolean a(EntityHuman entityhuman) { ++ return true; ++ } ++ ++ public ItemStack[] getContents() { ++ return items; ++ } ++ ++ public void onOpen(CraftHumanEntity who) { ++ viewers.add(who); ++ } ++ ++ public void onClose(CraftHumanEntity who) { ++ viewers.remove(who); ++ } ++ ++ public List getViewers() { ++ return viewers; ++ } ++ ++ public InventoryType getType() { ++ return type; ++ } ++ ++ public InventoryHolder getOwner() { ++ return owner; ++ } ++ ++ public boolean b(int i, ItemStack itemstack) { ++ return true; ++ } ++ ++ @Override ++ public void startOpen(EntityHuman entityHuman) { ++ ++ } ++ ++ @Override ++ public void closeContainer(EntityHuman entityHuman) { ++ ++ } ++ ++ @Override ++ public int getProperty(int i) { ++ return 0; ++ } ++ ++ @Override ++ public void b(int i, int i1) { ++ ++ } ++ ++ @Override ++ public int g() { ++ return 0; ++ } ++ ++ @Override ++ public void l() { ++ ++ } ++ ++ @Override ++ public String getName() { ++ return title; ++ } ++ ++ @Override ++ public boolean hasCustomName() { ++ return title != null; ++ } ++ ++ @Override ++ public IChatBaseComponent getScoreboardDisplayName() { ++ return new ChatComponentText(title); ++ } ++} +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0166-Misc-changes.patch b/Patches/CraftBukkit-Patches/0166-Misc-changes.patch new file mode 100644 index 000000000..4d2a01c93 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0166-Misc-changes.patch @@ -0,0 +1,277 @@ +From 088fc9372c061edac80ee5cce669382ebed0b1e3 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 23 Oct 2015 21:23:00 +1300 +Subject: [PATCH] Misc changes + + +diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java +new file mode 100644 +index 0000000..2263d5d +--- /dev/null ++++ b/src/main/java/net/minecraft/server/ControllerLook.java +@@ -0,0 +1,101 @@ ++package net.minecraft.server; ++ ++public class ControllerLook ++{ ++ private EntityInsentient a; ++ private float b; ++ private float c; ++ private boolean d; ++ private double e; ++ private double f; ++ private double g; ++ ++ public ControllerLook(EntityInsentient paramEntityInsentient) ++ { ++ this.a = paramEntityInsentient; ++ } ++ ++ public void a(Entity paramEntity, float paramFloat1, float paramFloat2) { ++ this.e = paramEntity.locX; ++ if ((paramEntity instanceof EntityLiving)) ++ this.f = (paramEntity.locY + paramEntity.getHeadHeight()); ++ else { ++ this.f = ((paramEntity.getBoundingBox().b + paramEntity.getBoundingBox().e) / 2.0D); ++ } ++ this.g = paramEntity.locZ; ++ this.b = paramFloat1; ++ this.c = paramFloat2; ++ this.d = true; ++ } ++ ++ public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) { ++ this.e = paramDouble1; ++ this.f = paramDouble2; ++ this.g = paramDouble3; ++ this.b = paramFloat1; ++ this.c = paramFloat2; ++ this.d = true; ++ } ++ ++ public void a() { ++ if (a.isVegetated()) ++ return; ++ this.a.pitch = 0.0F; ++ ++ if (this.d) { ++ this.d = false; ++ ++ double d1 = this.e - this.a.locX; ++ double d2 = this.f - (this.a.locY + this.a.getHeadHeight()); ++ double d3 = this.g - this.a.locZ; ++ double d4 = MathHelper.sqrt(d1 * d1 + d3 * d3); ++ ++ float f1 = (float)(MathHelper.b(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F; ++ float f2 = (float)-(MathHelper.b(d2, d4) * 180.0D / 3.141592741012573D); ++ this.a.pitch = a(this.a.pitch, f2, this.c); ++ this.a.aK = a(this.a.aK, f1, this.b); ++ } else { ++ this.a.aK = a(this.a.aK, this.a.aI, 10.0F); ++ } ++ ++ float f3 = MathHelper.g(this.a.aK - this.a.aI); ++ ++ if (!this.a.getNavigation().m()) ++ { ++ if (f3 < -75.0F) { ++ this.a.aK = (this.a.aI - 75.0F); ++ } ++ if (f3 > 75.0F) ++ this.a.aK = (this.a.aI + 75.0F); ++ } ++ } ++ ++ private float a(float paramFloat1, float paramFloat2, float paramFloat3) ++ { ++ float f1 = MathHelper.g(paramFloat2 - paramFloat1); ++ if (f1 > paramFloat3) { ++ f1 = paramFloat3; ++ } ++ if (f1 < -paramFloat3) { ++ f1 = -paramFloat3; ++ } ++ return paramFloat1 + f1; ++ } ++ ++ public boolean b() { ++ return this.d; ++ } ++ ++ public double e() ++ { ++ return this.e; ++ } ++ ++ public double f() { ++ return this.f; ++ } ++ ++ public double g() { ++ return this.g; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index c30867d..b86369b 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -132,7 +132,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." ); + } + // Spigot End +- if (!this.p.a() && !eulaAgreed) { // Spigot ++ if (false && !this.p.a() && !eulaAgreed) { // Spigot + DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + this.p.b(); + return false; +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index eb54e7f..66c3d0c 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -133,7 +133,7 @@ public abstract class EntityHuman extends EntityLiving { + if (this.g != null) { + ItemStack itemstack = this.inventory.getItemInHand(); + +- if (itemstack == this.g) { ++ if (ItemStack.equals(itemstack, this.g)) { + if (this.h <= 25 && this.h % 4 == 0) { + this.b(itemstack, 5); + } +diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java +index 4f280dd..73a288c 100644 +--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java ++++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java +@@ -59,7 +59,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay + this.A(); + } + +- private void A() { ++ public void A() { + if (this.i && this.j > 0 && !this.world.isClientSide && this.k > 0) { + double d0 = (double) (this.j * 10 + 10); + byte b0 = 0; +@@ -94,7 +94,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay + + } + +- private void B() { ++ public void B() { + int i = this.j; + int j = this.position.getX(); + int k = this.position.getY(); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 2759425..f57c785 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -412,7 +412,7 @@ public final class CraftServer implements Server { + int delta = Integer.MAX_VALUE; + for (Player player : getOnlinePlayers()) { + if (player.getName().toLowerCase().startsWith(lowerName)) { +- int curDelta = Math.abs(player.getName().length() - lowerName.length()); ++ int curDelta = player.getName().length() - lowerName.length(); + if (curDelta < delta) { + found = player; + delta = curDelta; +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 49c7fa6..0cd36e8 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -836,7 +836,7 @@ public class CraftWorld implements World { + + public void playEffect(Location loc, Effect effect, T data, int radius) { + if (data != null) { +- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!"); ++ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!"); + } else { + Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); + } +@@ -1122,10 +1122,6 @@ public class CraftWorld implements World { + public T addEntity(net.minecraft.server.Entity entity, SpawnReason reason) throws IllegalArgumentException { + Preconditions.checkArgument(entity != null, "Cannot spawn null entity"); + +- if (entity instanceof EntityInsentient) { +- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null); +- } +- + world.addEntity(entity, reason); + return (T) entity.getBukkitEntity(); + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 29082aa..e979f69 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -325,7 +325,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + @Override + public void playEffect(Location loc, Effect effect, T data) { + if (data != null) { +- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!"); ++ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!"); + } else { + Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); + } +@@ -870,10 +870,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + @Override + public void hidePlayer(Player player) { ++ hidePlayer(player, false, true); ++ } ++ ++ public void hidePlayer(Player player, boolean override, boolean hideList) ++ { + Validate.notNull(player, "hidden player cannot be null"); + if (getHandle().playerConnection == null) return; + if (equals(player)) return; +- if (hiddenPlayers.contains(player.getUniqueId())) return; ++ if (!override && hiddenPlayers.contains(player.getUniqueId())) return; + hiddenPlayers.add(player.getUniqueId()); + + //remove this player from the hidden player's EntityTrackerEntry +@@ -885,11 +890,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + //remove the hidden player from this player user list +- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other)); ++ if (hideList) ++ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other)); + } + + @Override + public void showPlayer(Player player) { ++ showPlayer(player, true); ++ } ++ ++ public void showPlayer(Player player, boolean showList) ++ { + Validate.notNull(player, "shown player cannot be null"); + if (getHandle().playerConnection == null) return; + if (equals(player)) return; +@@ -899,7 +910,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + EntityTracker tracker = ((WorldServer) entity.world).tracker; + EntityPlayer other = ((CraftPlayer) player).getHandle(); + +- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other)); ++ if (showList) ++ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other)); + + EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.getId()); + if (entry != null && !entry.trackedPlayers.contains(getHandle())) { +@@ -1363,13 +1375,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + @Override + public boolean getCollidesWithEntities() + { +- return getHandle().collidesWithEntities; ++ return !getHandle().spectating; + } + + @Override + public void setCollidesWithEntities(boolean collides) + { +- getHandle().collidesWithEntities = collides; ++ getHandle().spectating = collides; + getHandle().k = collides; // First boolean of Entity + } + +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0167-EntityGuardian-is-now-vegetateable.patch b/Patches/CraftBukkit-Patches/0167-EntityGuardian-is-now-vegetateable.patch new file mode 100644 index 000000000..49cf31e7d --- /dev/null +++ b/Patches/CraftBukkit-Patches/0167-EntityGuardian-is-now-vegetateable.patch @@ -0,0 +1,605 @@ +From 9aded83bc47bf6ba8076fc2ed03ebbe480df1296 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Wed, 28 Oct 2015 09:00:24 +1300 +Subject: [PATCH] EntityGuardian is now vegetateable + + +diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java +new file mode 100644 +index 0000000..c14caf2 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/EntityGuardian.java +@@ -0,0 +1,590 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Predicate; ++import java.util.*; ++ ++public class EntityGuardian extends EntityMonster ++{ ++ static class ControllerMoveGuardian extends ControllerMove ++ { ++ ++ public void c() ++ { ++ if(!this.f || g.getNavigation().m()) ++ { ++ g.k(0.0F); ++ EntityGuardian.a(g, false); ++ return; ++ } ++ double d = b - g.locX; ++ double d1 = c - g.locY; ++ double d2 = this.d - g.locZ; ++ double d3 = d * d + d1 * d1 + d2 * d2; ++ d3 = MathHelper.sqrt(d3); ++ d1 /= d3; ++ float f = (float)((MathHelper.b(d2, d) * 180D) / 3.1415927410125732D) - 90F; ++ g.yaw = a(g.yaw, f, 30F); ++ g.aI = g.yaw; ++ float f1 = (float)(e * g.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()); ++ g.k(g.bI() + (f1 - g.bI()) * 0.125F); ++ double d4 = Math.sin((double)(g.ticksLived + g.getId()) * 0.5D) * 0.050000000000000003D; ++ double d5 = Math.cos((g.yaw * 3.141593F) / 180F); ++ double d6 = Math.sin((g.yaw * 3.141593F) / 180F); ++ g.motX += d4 * d5; ++ g.motZ += d4 * d6; ++ d4 = Math.sin((double)(g.ticksLived + g.getId()) * 0.75D) * 0.050000000000000003D; ++ g.motY += d4 * (d6 + d5) * 0.25D; ++ g.motY += (double)g.bI() * d1 * 0.10000000000000001D; ++ ControllerLook controllerlook = g.getControllerLook(); ++ double d7 = g.locX + (d / d3) * 2D; ++ double d8 = (double)g.getHeadHeight() + g.locY + (d1 / d3) * 1.0D; ++ double d9 = g.locZ + (d2 / d3) * 2D; ++ double d10 = controllerlook.e(); ++ double d11 = controllerlook.f(); ++ double d12 = controllerlook.g(); ++ if(!controllerlook.b()) ++ { ++ d10 = d7; ++ d11 = d8; ++ d12 = d9; ++ } ++ g.getControllerLook().a(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10F, 40F); ++ EntityGuardian.a(g, true); ++ } ++ ++ private EntityGuardian g; ++ ++ public ControllerMoveGuardian(EntityGuardian entityguardian) ++ { ++ super(entityguardian); ++ g = entityguardian; ++ } ++ } ++ ++ static class PathfinderGoalGuardianAttack extends PathfinderGoal ++ { ++ ++ public boolean a() ++ { ++ EntityLiving entityliving = a.getGoalTarget(); ++ return entityliving != null && entityliving.isAlive(); ++ } ++ ++ public boolean b() ++ { ++ return super.b() && (a.isElder() || a.h(a.getGoalTarget()) > 9D); ++ } ++ ++ public void c() ++ { ++ b = -10; ++ a.getNavigation().n(); ++ a.getControllerLook().a(a.getGoalTarget(), 90F, 90F); ++ a.ai = true; ++ } ++ ++ public void d() ++ { ++ EntityGuardian.a(a, 0); ++ a.setGoalTarget(null); ++ EntityGuardian.a(a).f(); ++ } ++ ++ public void e() ++ { ++ EntityLiving entityliving = a.getGoalTarget(); ++ a.getNavigation().n(); ++ a.getControllerLook().a(entityliving, 90F, 90F); ++ if(!a.hasLineOfSight(entityliving)) ++ { ++ a.setGoalTarget(null); ++ return; ++ } ++ b++; ++ if(b == 0) ++ { ++ EntityGuardian.a(a, a.getGoalTarget().getId()); ++ a.world.broadcastEntityEffect(a, (byte)21); ++ } else ++ if(b >= a.cm()) ++ { ++ float f = 1.0F; ++ if(a.world.getDifficulty() == EnumDifficulty.HARD) ++ f += 2.0F; ++ if(a.isElder()) ++ f += 2.0F; ++ entityliving.damageEntity(DamageSource.b(a, a), f); ++ entityliving.damageEntity(DamageSource.mobAttack(a), (float)a.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).getValue()); ++ a.setGoalTarget(null); ++ } else ++ if(b >= 60) ++ if(b % 20 != 0); ++ super.e(); ++ } ++ ++ private EntityGuardian a; ++ private int b; ++ ++ public PathfinderGoalGuardianAttack(EntityGuardian entityguardian) ++ { ++ a = entityguardian; ++ a(3); ++ } ++ } ++ ++ static class EntitySelectorGuardianTargetHumanSquid ++ implements Predicate ++ { ++ ++ public boolean a(EntityLiving entityliving) ++ { ++ return ((entityliving instanceof EntityHuman) || (entityliving instanceof EntitySquid)) && entityliving.h(a) > 9D; ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((EntityLiving)obj); ++ } ++ ++ private EntityGuardian a; ++ ++ public EntitySelectorGuardianTargetHumanSquid(EntityGuardian entityguardian) ++ { ++ a = entityguardian; ++ } ++ } ++ ++ ++ public EntityGuardian(World world) ++ { ++ super(world); ++ b_ = 10; ++ setSize(0.85F, 0.85F); ++ goalSelector.a(4, new PathfinderGoalGuardianAttack(this)); ++ PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction; ++ goalSelector.a(5, pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); ++ goalSelector.a(7, goalRandomStroll = new PathfinderGoalRandomStroll(this, 1.0D, 80)); ++ goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8F)); ++ goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityGuardian.class, 12F, 0.01F)); ++ goalSelector.a(9, new PathfinderGoalRandomLookaround(this)); ++ goalRandomStroll.a(3); ++ pathfindergoalmovetowardsrestriction.a(3); ++ targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 10, true, false, new EntitySelectorGuardianTargetHumanSquid(this))); ++ moveController = new ControllerMoveGuardian(this); ++ b = a = random.nextFloat(); ++ } ++ ++ public void initAttributes() ++ { ++ super.initAttributes(); ++ getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6D); ++ getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D); ++ getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(16D); ++ getAttributeInstance(GenericAttributes.maxHealth).setValue(30D); ++ } ++ ++ public void a(NBTTagCompound nbttagcompound) ++ { ++ super.a(nbttagcompound); ++ setElder(nbttagcompound.getBoolean("Elder")); ++ } ++ ++ public void b(NBTTagCompound nbttagcompound) ++ { ++ super.b(nbttagcompound); ++ nbttagcompound.setBoolean("Elder", isElder()); ++ } ++ ++ protected NavigationAbstract b(World world) ++ { ++ return new NavigationGuardian(this, world); ++ } ++ ++ protected void h() ++ { ++ super.h(); ++ datawatcher.a(16, Integer.valueOf(0)); ++ datawatcher.a(17, Integer.valueOf(0)); ++ } ++ ++ private boolean a(int j) ++ { ++ return (datawatcher.getInt(16) & j) != 0; ++ } ++ ++ private void a(int j, boolean flag) ++ { ++ int k = datawatcher.getInt(16); ++ if(flag) ++ datawatcher.watch(16, Integer.valueOf(k | j)); ++ else ++ datawatcher.watch(16, Integer.valueOf(k & ~j)); ++ } ++ ++ public boolean n() ++ { ++ return a(2); ++ } ++ ++ private void l(boolean flag) ++ { ++ a(2, flag); ++ } ++ ++ public int cm() ++ { ++ return !isElder() ? 80 : 60; ++ } ++ ++ public boolean isElder() ++ { ++ return a(4); ++ } ++ ++ public void setElder(boolean flag) ++ { ++ a(4, flag); ++ if(flag) ++ { ++ setSize(1.9975F, 1.9975F); ++ getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.30000001192092896D); ++ getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(8D); ++ getAttributeInstance(GenericAttributes.maxHealth).setValue(80D); ++ bX(); ++ goalRandomStroll.setTimeBetweenMovement(400); ++ } ++ } ++ ++ private void b(int j) ++ { ++ datawatcher.watch(17, Integer.valueOf(j)); ++ } ++ ++ public boolean cp() ++ { ++ return datawatcher.getInt(17) != 0; ++ } ++ ++ public EntityLiving cq() ++ { ++ if(!cp()) ++ return null; ++ if(world.isClientSide) ++ { ++ if(bo != null) ++ return bo; ++ Entity entity = world.a(datawatcher.getInt(17)); ++ if(entity instanceof EntityLiving) ++ { ++ bo = (EntityLiving)entity; ++ return bo; ++ } else ++ { ++ return null; ++ } ++ } else ++ { ++ return getGoalTarget(); ++ } ++ } ++ ++ public void i(int j) ++ { ++ super.i(j); ++ if(j == 16) ++ { ++ if(isElder() && width < 1.0F) ++ setSize(1.9975F, 1.9975F); ++ } else ++ if(j == 17) ++ { ++ bp = 0; ++ bo = null; ++ } ++ } ++ ++ public int w() ++ { ++ return 160; ++ } ++ ++ protected String z() ++ { ++ if(!V()) ++ return "mob.guardian.land.idle"; ++ if(isElder()) ++ return "mob.guardian.elder.idle"; ++ else ++ return "mob.guardian.idle"; ++ } ++ ++ protected String bo() ++ { ++ if(!V()) ++ return "mob.guardian.land.hit"; ++ if(isElder()) ++ return "mob.guardian.elder.hit"; ++ else ++ return "mob.guardian.hit"; ++ } ++ ++ protected String bp() ++ { ++ if(!V()) ++ return "mob.guardian.land.death"; ++ if(isElder()) ++ return "mob.guardian.elder.death"; ++ else ++ return "mob.guardian.death"; ++ } ++ ++ protected boolean s_() ++ { ++ return false; ++ } ++ ++ public float getHeadHeight() ++ { ++ return length * 0.5F; ++ } ++ ++ public float a(BlockPosition blockposition) ++ { ++ if(world.getType(blockposition).getBlock().getMaterial() == Material.WATER) ++ return (10F + world.o(blockposition)) - 0.5F; ++ else ++ return super.a(blockposition); ++ } ++ ++ public void m() ++ { ++ if(world.isClientSide) ++ { ++ b = a; ++ if(!V()) ++ { ++ c = 2.0F; ++ if(motY > 0.0D && bq && !R()) ++ world.a(locX, locY, locZ, "mob.guardian.flop", 1.0F, 1.0F, false); ++ bq = motY < 0.0D && world.d((new BlockPosition(this)).down(), false); ++ } else ++ if(n()) ++ { ++ if(c < 0.5F) ++ c = 4F; ++ else ++ c = c + (0.5F - c) * 0.1F; ++ } else ++ { ++ c = c + (0.125F - c) * 0.2F; ++ } ++ a += c; ++ bn = bm; ++ if(!V()) ++ bm = random.nextFloat(); ++ else ++ if(n()) ++ bm = bm + (0.0F - bm) * 0.25F; ++ else ++ bm = bm + (1.0F - bm) * 0.06F; ++ if(n() && V()) ++ { ++ Vec3D vec3d = d(0.0F); ++ for(int j = 0; j < 2; j++) ++ world.addParticle(EnumParticle.WATER_BUBBLE, (locX + (random.nextDouble() - 0.5D) * (double)width) - vec3d.a * 1.5D, (locY + random.nextDouble() * (double)length) - vec3d.b * 1.5D, (locZ + (random.nextDouble() - 0.5D) * (double)width) - vec3d.c * 1.5D, 0.0D, 0.0D, 0.0D, new int[0]); ++ ++ } ++ if(cp()) ++ { ++ if(bp < cm()) ++ bp++; ++ EntityLiving entityliving = cq(); ++ if(entityliving != null) ++ { ++ getControllerLook().a(entityliving, 90F, 90F); ++ getControllerLook().a(); ++ double d = q(0.0F); ++ double d1 = entityliving.locX - locX; ++ double d2 = (entityliving.locY + (double)(entityliving.length * 0.5F)) - (locY + (double)getHeadHeight()); ++ double d3 = entityliving.locZ - locZ; ++ double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); ++ d1 /= d4; ++ d2 /= d4; ++ d3 /= d4; ++ for(double d5 = random.nextDouble(); d5 < d4;) ++ { ++ d5 += (1.8D - d) + random.nextDouble() * (1.7D - d); ++ world.addParticle(EnumParticle.WATER_BUBBLE, locX + d1 * d5, locY + d2 * d5 + (double)getHeadHeight(), locZ + d3 * d5, 0.0D, 0.0D, 0.0D, new int[0]); ++ } ++ ++ } ++ } ++ } ++ if(isVegetated() || inWater) ++ setAirTicks(300); ++ else ++ if(onGround) ++ { ++ motY += 0.5D; ++ motX += (random.nextFloat() * 2.0F - 1.0F) * 0.4F; ++ motZ += (random.nextFloat() * 2.0F - 1.0F) * 0.4F; ++ yaw = random.nextFloat() * 360F; ++ onGround = false; ++ ai = true; ++ } ++ if(cp()) ++ yaw = aK; ++ super.m(); ++ } ++ ++ public float q(float f) ++ { ++ return ((float)bp + f) / (float)cm(); ++ } ++ ++ protected void E() ++ { ++ super.E(); ++ if(isElder()) ++ { ++ int i = 1200; ++ int j = 1200; ++ int k = 6000; ++ int m = 2; ++ ++ if ((this.ticksLived + getId()) % 1200 == 0) { ++ MobEffectList mobeffectlist = MobEffectList.SLOWER_DIG; ++ List list = world.b(EntityPlayer.class, new Predicate() { ++ ++ public boolean a(EntityPlayer entityplayer1) ++ { ++ return h(entityplayer1) < 2500D && entityplayer1.playerInteractManager.c(); ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((EntityPlayer)obj); ++ } ++ } ++); ++ Iterator iterator = list.iterator(); ++ do ++ { ++ if(!iterator.hasNext()) ++ break; ++ EntityPlayer entityplayer = (EntityPlayer)iterator.next(); ++ if(!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) ++ { ++ entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(10, 0.0F)); ++ entityplayer.addEffect(new MobEffect(mobeffectlist.id, 6000, 2)); ++ } ++ } while(true); ++ } ++ if(!ck()) ++ a(new BlockPosition(this), 16); ++ } ++ } ++ ++ protected void dropDeathLoot(boolean flag, int j) ++ { ++ int k = random.nextInt(3) + random.nextInt(j + 1); ++ if(k > 0) ++ a(new ItemStack(Items.PRISMARINE_SHARD, k, 0), 1.0F); ++ if(random.nextInt(3 + j) > 1) ++ a(new ItemStack(Items.FISH, 1, ItemFish.EnumFish.COD.a()), 1.0F); ++ else ++ if(random.nextInt(3 + j) > 1) ++ a(new ItemStack(Items.PRISMARINE_CRYSTALS, 1, 0), 1.0F); ++ if(flag && isElder()) ++ a(new ItemStack(Blocks.SPONGE, 1, 1), 1.0F); ++ } ++ ++ protected void getRareDrop() ++ { ++ ItemStack itemstack = ((PossibleFishingResult)WeightedRandom.a(random, EntityFishingHook.j())).a(random); ++ a(itemstack, 1.0F); ++ } ++ ++ protected boolean n_() ++ { ++ return true; ++ } ++ ++ public boolean canSpawn() ++ { ++ return world.a(getBoundingBox(), this) && world.getCubes(this, getBoundingBox()).isEmpty(); ++ } ++ ++ public boolean bR() ++ { ++ return (random.nextInt(20) == 0 || !world.j(new BlockPosition(this))) && super.bR(); ++ } ++ ++ public boolean damageEntity(DamageSource damagesource, float f) ++ { ++ if(!n() && !damagesource.isMagic() && (damagesource.i() instanceof EntityLiving)) ++ { ++ EntityLiving entityliving = (EntityLiving)damagesource.i(); ++ if(!damagesource.isExplosion()) ++ { ++ entityliving.damageEntity(DamageSource.a(this), 2.0F); ++ entityliving.makeSound("damage.thorns", 0.5F, 1.0F); ++ } ++ } ++ goalRandomStroll.f(); ++ return super.damageEntity(damagesource, f); ++ } ++ ++ public int bQ() ++ { ++ return 180; ++ } ++ ++ public void g(float f, float f1) ++ { ++ if(bM()) ++ { ++ if(V()) ++ { ++ a(f, f1, 0.1F); ++ move(motX, motY, motZ); ++ motX *= 0.89999997615814209D; ++ motY *= 0.89999997615814209D; ++ motZ *= 0.89999997615814209D; ++ if(!n() && getGoalTarget() == null) ++ motY -= 0.0050000000000000001D; ++ } else ++ { ++ super.g(f, f1); ++ } ++ } else ++ { ++ super.g(f, f1); ++ } ++ } ++ ++ static void a(EntityGuardian entityguardian, int j) ++ { ++ entityguardian.b(j); ++ } ++ ++ static PathfinderGoalRandomStroll a(EntityGuardian entityguardian) ++ { ++ return entityguardian.goalRandomStroll; ++ } ++ ++ static void a(EntityGuardian entityguardian, boolean flag) ++ { ++ entityguardian.l(flag); ++ } ++ ++ private float a; ++ private float b; ++ private float c; ++ private float bm; ++ private float bn; ++ private EntityLiving bo; ++ private int bp; ++ private boolean bq; ++ public PathfinderGoalRandomStroll goalRandomStroll; ++} +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0168-Controller-look-vegetateHead-Entity-collide-changes.patch b/Patches/CraftBukkit-Patches/0168-Controller-look-vegetateHead-Entity-collide-changes.patch new file mode 100644 index 000000000..7b161eb37 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0168-Controller-look-vegetateHead-Entity-collide-changes.patch @@ -0,0 +1,43 @@ +From d3b44ea22080f4d15bf45b74b46b989b29f7b039 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Fri, 30 Oct 2015 20:02:58 +1300 +Subject: [PATCH] Controller look vegetateHead, Entity collide changes + + +diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java +index 2263d5d..f2d7b1e 100644 +--- a/src/main/java/net/minecraft/server/ControllerLook.java ++++ b/src/main/java/net/minecraft/server/ControllerLook.java +@@ -37,9 +37,15 @@ public class ControllerLook + this.d = true; + } + ++ public void vegetateHead(boolean vegetate) ++ { ++ _vegeHead = vegetate; ++ } ++ ++ private boolean _vegeHead; ++ + public void a() { +- if (a.isVegetated()) +- return; ++ if (_vegeHead)return; + this.a.pitch = 0.0F; + + if (this.d) { +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index cb9ba53..8660762 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1087,6 +1087,7 @@ public abstract class Entity implements ICommandListener { + int numCollisions = 0; // Spigot + public void collide(Entity entity) { + if (entity.passenger != this && entity.vehicle != this) { ++ if ((!(entity instanceof EntityLiving) || !((EntityLiving) entity).isGhost()) && (!(this instanceof EntityLiving) || !((EntityLiving) this).isGhost())) + if (!entity.noclip && !this.noclip) { + double d0 = entity.locX - this.locX; + double d1 = entity.locZ - this.locZ; +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0169-Vegetate-head-ai.patch b/Patches/CraftBukkit-Patches/0169-Vegetate-head-ai.patch new file mode 100644 index 000000000..a9b886dbb --- /dev/null +++ b/Patches/CraftBukkit-Patches/0169-Vegetate-head-ai.patch @@ -0,0 +1,139 @@ +From a793ae3653b54c211b2c40147e031449d3e1cf72 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Tue, 3 Nov 2015 21:21:02 +1300 +Subject: [PATCH] Vegetate head ai + + +diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java +index f2d7b1e..1538ca6 100644 +--- a/src/main/java/net/minecraft/server/ControllerLook.java ++++ b/src/main/java/net/minecraft/server/ControllerLook.java +@@ -9,6 +9,28 @@ public class ControllerLook + private double e; + private double f; + private double g; ++ private boolean _allowInput = true; ++ private boolean _resetPitch = true; ++ ++ public boolean isPitchReset() ++ { ++ return _resetPitch; ++ } ++ ++ public boolean setPitchReset(boolean resetPitch) ++ { ++ _resetPitch = resetPitch; ++ } ++ ++ public boolean isAllowInput() ++ { ++ return _allowInput; ++ } ++ ++ public void setAllowInput(boolean allowInput) ++ { ++ _allowInput = allowInput; ++ } + + public ControllerLook(EntityInsentient paramEntityInsentient) + { +@@ -16,6 +38,9 @@ public class ControllerLook + } + + public void a(Entity paramEntity, float paramFloat1, float paramFloat2) { ++ ++ if (!isAllowInput()) ++ return; + this.e = paramEntity.locX; + if ((paramEntity instanceof EntityLiving)) + this.f = (paramEntity.locY + paramEntity.getHeadHeight()); +@@ -29,6 +54,8 @@ public class ControllerLook + } + + public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) { ++ if (!isAllowInput()) ++ return; + this.e = paramDouble1; + this.f = paramDouble2; + this.g = paramDouble3; +@@ -37,15 +64,8 @@ public class ControllerLook + this.d = true; + } + +- public void vegetateHead(boolean vegetate) +- { +- _vegeHead = vegetate; +- } +- +- private boolean _vegeHead; +- + public void a() { +- if (_vegeHead)return; ++ if (isResetPitch()) + this.a.pitch = 0.0F; + + if (this.d) { +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index b7647bc..c2ef000 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -512,6 +512,7 @@ public abstract class EntityInsentient extends EntityLiving { + this.world.methodProfiler.a("move"); + this.moveController.c(); + this.world.methodProfiler.c("look"); ++ if (!isVegetatedHead()) + this.lookController.a(); + this.world.methodProfiler.c("jump"); + this.g.b(); +@@ -542,6 +543,8 @@ public abstract class EntityInsentient extends EntityLiving { + float f2 = (float) (MathHelper.b(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; + float f3 = (float) (-(MathHelper.b(d2, d3) * 180.0D / 3.1415927410125732D)); + ++ if (isVegetatedHead()) ++ return; + this.pitch = this.b(this.pitch, f3, f1); + this.yaw = this.b(this.yaw, f2, f); + } +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index b861dbe..4de7e4c 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -113,6 +113,18 @@ public abstract class EntityLiving extends Entity { + _ghost = ghost; + } + ++ private boolean _vegetateHead; ++ ++ public boolean isHeadVegetated() ++ { ++ return _vegetateHead; ++ } ++ ++ public void setHeadVegetated(boolean vegetateHead) ++ { ++ _vegetateHead = vegetateHead; ++ } ++ + public EntityLiving(World world) { + super(world); + this.initAttributes(); +@@ -1497,6 +1509,8 @@ public abstract class EntityLiving extends Entity { + + SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot + this.m(); ++ if (isVegetatedHead()) ++ return; + SpigotTimings.timerEntityTickRest.startTiming(); // Spigot + double d0 = this.locX - this.lastX; + double d1 = this.locZ - this.lastZ; +@@ -1607,6 +1621,7 @@ public abstract class EntityLiving extends Entity { + this.pitch = (float) ((double) this.pitch + (this.bh - (double) this.pitch) / (double) this.bc); + --this.bc; + this.setPosition(d0, d1, d2); ++ if (!isHeadVegetated()) + this.setYawPitch(this.yaw, this.pitch); + } else if (!this.bM()) { + this.motX *= 0.98D; +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0170-Modifications-to-cb.patch b/Patches/CraftBukkit-Patches/0170-Modifications-to-cb.patch new file mode 100644 index 000000000..dca7f1e11 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0170-Modifications-to-cb.patch @@ -0,0 +1,1618 @@ +From afb13529d05ad4adb0afa8cf8430e942d3e65e90 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Sun, 8 Nov 2015 17:57:05 +1300 +Subject: [PATCH] Modifications to cb + + +diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java +index 1538ca6..7b91286 100644 +--- a/src/main/java/net/minecraft/server/ControllerLook.java ++++ b/src/main/java/net/minecraft/server/ControllerLook.java +@@ -5,19 +5,19 @@ public class ControllerLook + private EntityInsentient a; + private float b; + private float c; +- private boolean d; ++ public boolean d; + private double e; + private double f; + private double g; + private boolean _allowInput = true; + private boolean _resetPitch = true; + +- public boolean isPitchReset() ++ public boolean isResetPitch() + { + return _resetPitch; + } + +- public boolean setPitchReset(boolean resetPitch) ++ public void setResetPitch(boolean resetPitch) + { + _resetPitch = resetPitch; + } +@@ -66,7 +66,7 @@ public class ControllerLook + + public void a() { + if (isResetPitch()) +- this.a.pitch = 0.0F; ++ this.a.pitch = 0.0F; + + if (this.d) { + this.d = false; +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 8660762..81ca499 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -61,6 +61,8 @@ public abstract class Entity implements ICommandListener { + public double motZ; + public float yaw; + public float pitch; ++ public float fakeYaw; ++ public float fakePitch; + public float lastYaw; + public float lastPitch; + private AxisAlignedBB boundingBox; +@@ -139,6 +141,17 @@ public abstract class Entity implements ICommandListener { + + private boolean _silent; + private boolean _invisible; ++ private boolean _fakeHead; ++ ++ public boolean isFakeHead() ++ { ++ return _fakeHead; ++ } ++ ++ public void setFakeHead(boolean fakeHead) ++ { ++ _fakeHead = fakeHead; ++ } + + public boolean isSilent() + { +@@ -1009,8 +1022,8 @@ public abstract class Entity implements ICommandListener { + this.lastX = this.locX = d0; + this.lastY = this.locY = d1; + this.lastZ = this.locZ = d2; +- this.lastYaw = this.yaw = f; +- this.lastPitch = this.pitch = f1; ++ this.lastYaw = this.yaw = fakeYaw = f; ++ this.lastPitch = this.pitch = fakePitch = f1; + + if (this instanceof EntityLiving) + ((EntityLiving) this).aK = f; +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index c2ef000..b7647bc 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -512,7 +512,6 @@ public abstract class EntityInsentient extends EntityLiving { + this.world.methodProfiler.a("move"); + this.moveController.c(); + this.world.methodProfiler.c("look"); +- if (!isVegetatedHead()) + this.lookController.a(); + this.world.methodProfiler.c("jump"); + this.g.b(); +@@ -543,8 +542,6 @@ public abstract class EntityInsentient extends EntityLiving { + float f2 = (float) (MathHelper.b(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; + float f3 = (float) (-(MathHelper.b(d2, d3) * 180.0D / 3.1415927410125732D)); + +- if (isVegetatedHead()) +- return; + this.pitch = this.b(this.pitch, f3, f1); + this.yaw = this.b(this.yaw, f2, f); + } +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 4de7e4c..b861dbe 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -113,18 +113,6 @@ public abstract class EntityLiving extends Entity { + _ghost = ghost; + } + +- private boolean _vegetateHead; +- +- public boolean isHeadVegetated() +- { +- return _vegetateHead; +- } +- +- public void setHeadVegetated(boolean vegetateHead) +- { +- _vegetateHead = vegetateHead; +- } +- + public EntityLiving(World world) { + super(world); + this.initAttributes(); +@@ -1509,8 +1497,6 @@ public abstract class EntityLiving extends Entity { + + SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot + this.m(); +- if (isVegetatedHead()) +- return; + SpigotTimings.timerEntityTickRest.startTiming(); // Spigot + double d0 = this.locX - this.lastX; + double d1 = this.locZ - this.lastZ; +@@ -1621,7 +1607,6 @@ public abstract class EntityLiving extends Entity { + this.pitch = (float) ((double) this.pitch + (this.bh - (double) this.pitch) / (double) this.bc); + --this.bc; + this.setPosition(d0, d1, d2); +- if (!isHeadVegetated()) + this.setYawPitch(this.yaw, this.pitch); + } else if (!this.bM()) { + this.motX *= 0.98D; +diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +index f0149bf..3fb3205 100644 +--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +@@ -49,9 +49,9 @@ public class EntityTrackerEntry { + this.xLoc = MathHelper.floor(entity.locX * 32.0D); + this.yLoc = MathHelper.floor(entity.locY * 32.0D); + this.zLoc = MathHelper.floor(entity.locZ * 32.0D); +- this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F); +- this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F); +- this.i = MathHelper.d(entity.getHeadRotation() * 256.0F / 360.0F); ++ this.yRot = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.yaw) * 256.0F / 360.0F); ++ this.xRot = MathHelper.d((tracker.isFakeHead() ? tracker.fakePitch : this.tracker.pitch) * 256.0F / 360.0F); ++ this.i = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.getHeadRotation()) * 256.0F / 360.0F); + this.y = entity.onGround; + } + +@@ -112,8 +112,8 @@ public class EntityTrackerEntry { + i = MathHelper.floor(this.tracker.locX * 32.0D); + j = MathHelper.floor(this.tracker.locY * 32.0D); + int k = MathHelper.floor(this.tracker.locZ * 32.0D); +- int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F); +- int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F); ++ int l = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.yaw) * 256.0F / 360.0F); ++ int i1 = MathHelper.d((tracker.isFakeHead() ? tracker.fakePitch : this.tracker.pitch) * 256.0F / 360.0F); + int j1 = i - this.xLoc; + int k1 = j - this.yLoc; + int l1 = k - this.zLoc; +@@ -192,8 +192,8 @@ public class EntityTrackerEntry { + + this.x = false; + } else { +- i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F); +- j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F); ++ i = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.yaw) * 256.0F / 360.0F); ++ j = MathHelper.d((tracker.isFakeHead() ? tracker.fakePitch : this.tracker.pitch) * 256.0F / 360.0F); + boolean flag2 = Math.abs(i - this.yRot) >= 4 || Math.abs(j - this.xRot) >= 4; + + if (flag2) { +@@ -209,7 +209,7 @@ public class EntityTrackerEntry { + this.x = true; + } + +- i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); ++ i = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.getHeadRotation()) * 256.0F / 360.0F); + if (Math.abs(i - this.i) >= 4) { + this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i)); + this.i = i; +@@ -387,7 +387,7 @@ public class EntityTrackerEntry { + } + + // CraftBukkit start - Fix for nonsensical head yaw +- this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); ++ this.i = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.getHeadRotation()) * 256.0F / 360.0F); + this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i)); + // CraftBukkit end + +@@ -449,7 +449,7 @@ public class EntityTrackerEntry { + } else if (this.tracker instanceof EntityBoat) { + return new PacketPlayOutSpawnEntity(this.tracker, 1); + } else if (this.tracker instanceof IAnimal) { +- this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); ++ this.i = MathHelper.d((tracker.isFakeHead() ? tracker.fakeYaw : this.tracker.getHeadRotation()) * 256.0F / 360.0F); + return new PacketPlayOutSpawnEntityLiving((EntityLiving) this.tracker); + } else if (this.tracker instanceof EntityFishingHook) { + EntityHuman entityhuman = ((EntityFishingHook) this.tracker).owner; +diff --git a/src/main/java/net/minecraft/server/PacketPlayInAbilities.java b/src/main/java/net/minecraft/server/PacketPlayInAbilities.java +new file mode 100644 +index 0000000..6ff5716 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInAbilities.java +@@ -0,0 +1,109 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInAbilities ++ implements Packet ++{ ++ private boolean a; ++ private boolean b; ++ private boolean c; ++ private boolean d; ++ private float e; ++ private float f; ++ ++ public PacketPlayInAbilities() ++ { ++ } ++ ++ public PacketPlayInAbilities(PlayerAbilities paramPlayerAbilities) ++ { ++ a(paramPlayerAbilities.isInvulnerable); ++ b(paramPlayerAbilities.isFlying); ++ c(paramPlayerAbilities.canFly); ++ d(paramPlayerAbilities.canInstantlyBuild); ++ a(paramPlayerAbilities.a()); ++ b(paramPlayerAbilities.b()); ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ int i = paramPacketDataSerializer.readByte(); ++ ++ a((i & 0x1) > 0); ++ b((i & 0x2) > 0); ++ c((i & 0x4) > 0); ++ d((i & 0x8) > 0); ++ a(paramPacketDataSerializer.readFloat()); ++ b(paramPacketDataSerializer.readFloat()); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ int i = 0; ++ ++ if (a()) { ++ i = (byte)(i | 0x1); ++ } ++ if (isFlying()) { ++ i = (byte)(i | 0x2); ++ } ++ if (c()) { ++ i = (byte)(i | 0x4); ++ } ++ if (d()) { ++ i = (byte)(i | 0x8); ++ } ++ ++ paramPacketDataSerializer.writeByte(i); ++ paramPacketDataSerializer.writeFloat(this.e); ++ paramPacketDataSerializer.writeFloat(this.f); ++ } ++ ++ public void a(PacketListenerPlayIn paramPacketListenerPlayIn) ++ { ++ paramPacketListenerPlayIn.a(this); ++ } ++ ++ public boolean a() { ++ return this.a; ++ } ++ ++ public void a(boolean paramBoolean) { ++ this.a = paramBoolean; ++ } ++ ++ public boolean isFlying() { ++ return this.b; ++ } ++ ++ public void b(boolean paramBoolean) { ++ this.b = paramBoolean; ++ } ++ ++ public boolean c() { ++ return this.c; ++ } ++ ++ public void c(boolean paramBoolean) { ++ this.c = paramBoolean; ++ } ++ ++ public boolean d() { ++ return this.d; ++ } ++ ++ public void d(boolean paramBoolean) { ++ this.d = paramBoolean; ++ } ++ ++ public void a(float paramFloat) ++ { ++ this.e = paramFloat; ++ } ++ ++ public void b(float paramFloat) ++ { ++ this.f = paramFloat; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java +new file mode 100644 +index 0000000..3032d20 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInBlockDig.java +@@ -0,0 +1,48 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInBlockDig ++ implements Packet ++{ ++ public BlockPosition a; ++ public EnumDirection b; ++ public EnumPlayerDigType c; ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.c = ((EnumPlayerDigType)paramPacketDataSerializer.a(EnumPlayerDigType.class)); ++ this.a = paramPacketDataSerializer.c(); ++ this.b = EnumDirection.fromType1(paramPacketDataSerializer.readUnsignedByte()); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.a(this.c); ++ paramPacketDataSerializer.a(this.a); ++ paramPacketDataSerializer.writeByte(this.b.a()); ++ } ++ ++ public void a(PacketListenerPlayIn paramPacketListenerPlayIn) ++ { ++ paramPacketListenerPlayIn.a(this); ++ } ++ ++ public BlockPosition a() { ++ return this.a; ++ } ++ ++ public EnumDirection b() { ++ return this.b; ++ } ++ ++ public EnumPlayerDigType c() { ++ return this.c; ++ } ++ ++ public static enum EnumPlayerDigType ++ { ++ START_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, STOP_DESTROY_BLOCK, DROP_ALL_ITEMS, DROP_ITEM, RELEASE_USE_ITEM; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java +new file mode 100644 +index 0000000..4c0acc9 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInEntityAction.java +@@ -0,0 +1,57 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInEntityAction ++ implements Packet ++{ ++ public enum EnumPlayerAction ++ { ++ ++ START_SNEAKING, STOP_SNEAKING, STOP_SLEEPING, START_SPRINTING, STOP_SPRINTING, RIDING_JUMP, OPEN_INVENTORY; ++ } ++ ++ public int a; ++ public EnumPlayerAction animation; ++ public int c; ++ ++ public PacketPlayInEntityAction() ++ { ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ a = packetdataserializer.e(); ++ animation = (EnumPlayerAction)packetdataserializer.a(EnumPlayerAction.class); ++ c = packetdataserializer.e(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ packetdataserializer.b(a); ++ packetdataserializer.a(animation); ++ packetdataserializer.b(c); ++ } ++ ++ public void a(PacketListenerPlayIn packetlistenerplayin) ++ { ++ packetlistenerplayin.a(this); ++ } ++ ++ public EnumPlayerAction b() ++ { ++ return animation; ++ } ++ ++ public int c() ++ { ++ return c; ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayIn)packetlistener); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayInFlying.java b/src/main/java/net/minecraft/server/PacketPlayInFlying.java +new file mode 100644 +index 0000000..7c2c930 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayInFlying.java +@@ -0,0 +1,145 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayInFlying ++ implements Packet ++{ ++ public double x; ++ public double y; ++ public double z; ++ public float yaw; ++ public float pitch; ++ public boolean f; ++ public boolean hasPos; ++ public boolean hasLook; ++ ++ public void a(PacketListenerPlayIn paramPacketListenerPlayIn) ++ { ++ paramPacketListenerPlayIn.a(this); ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.f = (paramPacketDataSerializer.readUnsignedByte() != 0); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.writeByte(this.f ? 1 : 0); ++ } ++ ++ public double a() { ++ return this.x; ++ } ++ ++ public double b() { ++ return this.y; ++ } ++ ++ public double c() { ++ return this.z; ++ } ++ ++ public float d() { ++ return this.yaw; ++ } ++ ++ public float e() { ++ return this.pitch; ++ } ++ ++ public boolean f() { ++ return this.f; ++ } ++ ++ public boolean g() { ++ return this.hasPos; ++ } ++ ++ public boolean h() { ++ return this.hasLook; ++ } ++ ++ public void a(boolean paramBoolean) { ++ this.hasPos = paramBoolean; ++ } ++ ++ public static class PacketPlayInLook extends PacketPlayInFlying ++ { ++ public PacketPlayInLook() ++ { ++ this.hasLook = true; ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.yaw = paramPacketDataSerializer.readFloat(); ++ this.pitch = paramPacketDataSerializer.readFloat(); ++ super.a(paramPacketDataSerializer); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.writeFloat(this.yaw); ++ paramPacketDataSerializer.writeFloat(this.pitch); ++ super.b(paramPacketDataSerializer); ++ } ++ } ++ ++ public static class PacketPlayInPosition extends PacketPlayInFlying ++ { ++ public PacketPlayInPosition() ++ { ++ this.hasPos = true; ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.x = paramPacketDataSerializer.readDouble(); ++ this.y = paramPacketDataSerializer.readDouble(); ++ this.z = paramPacketDataSerializer.readDouble(); ++ super.a(paramPacketDataSerializer); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.writeDouble(this.x); ++ paramPacketDataSerializer.writeDouble(this.y); ++ paramPacketDataSerializer.writeDouble(this.z); ++ super.b(paramPacketDataSerializer); ++ } ++ } ++ ++ public static class PacketPlayInPositionLook extends PacketPlayInFlying ++ { ++ public PacketPlayInPositionLook() ++ { ++ this.hasPos = true; ++ this.hasLook = true; ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.x = paramPacketDataSerializer.readDouble(); ++ this.y = paramPacketDataSerializer.readDouble(); ++ this.z = paramPacketDataSerializer.readDouble(); ++ this.yaw = paramPacketDataSerializer.readFloat(); ++ this.pitch = paramPacketDataSerializer.readFloat(); ++ super.a(paramPacketDataSerializer); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.writeDouble(this.x); ++ paramPacketDataSerializer.writeDouble(this.y); ++ paramPacketDataSerializer.writeDouble(this.z); ++ paramPacketDataSerializer.writeFloat(this.yaw); ++ paramPacketDataSerializer.writeFloat(this.pitch); ++ super.b(paramPacketDataSerializer); ++ } ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java +new file mode 100644 +index 0000000..ba98f41 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockAction.java +@@ -0,0 +1,45 @@ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutBlockAction ++ implements Packet ++{ ++ public BlockPosition a; ++ public int b; ++ public int c; ++ public Block d; ++ ++ public PacketPlayOutBlockAction() ++ { ++ } ++ ++ public PacketPlayOutBlockAction(BlockPosition paramBlockPosition, Block paramBlock, int paramInt1, int paramInt2) ++ { ++ this.a = paramBlockPosition; ++ this.b = paramInt1; ++ this.c = paramInt2; ++ this.d = paramBlock; ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ this.a = paramPacketDataSerializer.c(); ++ this.b = paramPacketDataSerializer.readUnsignedByte(); ++ this.c = paramPacketDataSerializer.readUnsignedByte(); ++ this.d = Block.getById(paramPacketDataSerializer.e() & 0xFFF); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) throws IOException ++ { ++ paramPacketDataSerializer.a(this.a); ++ paramPacketDataSerializer.writeByte(this.b); ++ paramPacketDataSerializer.writeByte(this.c); ++ paramPacketDataSerializer.b(Block.getId(this.d) & 0xFFF); ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java +new file mode 100644 +index 0000000..4330ad3 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockBreakAnimation.java +@@ -0,0 +1,58 @@ ++// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. ++// Jad home page: http://www.kpdus.com/jad.html ++// Decompiler options: packimports(3) ++// Source File Name: SourceFile ++ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++// Referenced classes of package net.minecraft.server.v1_8_R3: ++// Packet, PacketDataSerializer, PacketListenerPlayOut, BlockPosition, ++// PacketListener ++ ++public class PacketPlayOutBlockBreakAnimation ++ implements Packet ++{ ++ ++ public PacketPlayOutBlockBreakAnimation() ++ { ++ } ++ ++ public PacketPlayOutBlockBreakAnimation(int i, BlockPosition blockposition, int j) ++ { ++ a = i; ++ b = blockposition; ++ c = j; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ a = packetdataserializer.e(); ++ b = packetdataserializer.c(); ++ c = packetdataserializer.readUnsignedByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ packetdataserializer.b(a); ++ packetdataserializer.a(b); ++ packetdataserializer.writeByte(c); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++ ++ public int a; ++ public BlockPosition b; ++ public int c; ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java +new file mode 100644 +index 0000000..604a035 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java +@@ -0,0 +1,55 @@ ++// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. ++// Jad home page: http://www.kpdus.com/jad.html ++// Decompiler options: packimports(3) ++// Source File Name: SourceFile ++ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++// Referenced classes of package net.minecraft.server.v1_8_R3: ++// Packet, World, PacketDataSerializer, Block, ++// RegistryID, IBlockData, PacketListenerPlayOut, BlockPosition, ++// PacketListener ++ ++public class PacketPlayOutBlockChange ++ implements Packet ++{ ++ ++ public PacketPlayOutBlockChange() ++ { ++ } ++ ++ public PacketPlayOutBlockChange(World world, BlockPosition blockposition) ++ { ++ a = blockposition; ++ block = world.getType(blockposition); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ a = packetdataserializer.c(); ++ block = (IBlockData)Block.d.a(packetdataserializer.e()); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ packetdataserializer.a(a); ++ packetdataserializer.b(Block.d.b(block)); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++ ++ public BlockPosition a; ++ public IBlockData block; ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java +new file mode 100644 +index 0000000..631f66c +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityHeadRotation.java +@@ -0,0 +1,54 @@ ++// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. ++// Jad home page: http://www.kpdus.com/jad.html ++// Decompiler options: packimports(3) ++// Source File Name: SourceFile ++ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++// Referenced classes of package net.minecraft.server.v1_8_R3: ++// Packet, Entity, PacketDataSerializer, PacketListenerPlayOut, ++// PacketListener ++ ++public class PacketPlayOutEntityHeadRotation ++ implements Packet ++{ ++ ++ public PacketPlayOutEntityHeadRotation() ++ { ++ } ++ ++ public PacketPlayOutEntityHeadRotation(Entity entity, byte byte0) ++ { ++ a = entity.getId(); ++ b = byte0; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ a = packetdataserializer.e(); ++ b = packetdataserializer.readByte(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ packetdataserializer.b(a); ++ packetdataserializer.writeByte(b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++ ++ public int a; ++ public byte b; ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +index 786047c..4730b34 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java +@@ -17,8 +17,8 @@ public class PacketPlayOutEntityTeleport implements Packet ++{ ++ public ChunkCoordIntPair a; ++ public MultiBlockChangeInfo[] b; ++ ++ public PacketPlayOutMultiBlockChange() ++ { ++ } ++ ++ public PacketPlayOutMultiBlockChange(int paramInt, short[] paramArrayOfShort, Chunk paramChunk) ++ { ++ this.a = new ChunkCoordIntPair(paramChunk.locX, paramChunk.locZ); ++ ++ this.b = new MultiBlockChangeInfo[paramInt]; ++ for (int i = 0; i < this.b.length; i++) ++ this.b[i] = new MultiBlockChangeInfo(paramArrayOfShort[i], paramChunk); ++ } ++ ++ public void a(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ this.a = new ChunkCoordIntPair(paramPacketDataSerializer.readInt(), paramPacketDataSerializer.readInt()); ++ this.b = new MultiBlockChangeInfo[paramPacketDataSerializer.e()]; ++ ++ for (int i = 0; i < this.b.length; i++) ++ this.b[i] = new MultiBlockChangeInfo(paramPacketDataSerializer.readShort(), (IBlockData)Block.d.a(paramPacketDataSerializer.e())); ++ } ++ ++ public void b(PacketDataSerializer paramPacketDataSerializer) ++ throws IOException ++ { ++ paramPacketDataSerializer.writeInt(this.a.x); ++ paramPacketDataSerializer.writeInt(this.a.z); ++ paramPacketDataSerializer.b(this.b.length); ++ for (MultiBlockChangeInfo localMultiBlockChangeInfo : this.b) { ++ paramPacketDataSerializer.writeShort(localMultiBlockChangeInfo.b()); ++ paramPacketDataSerializer.b(Block.d.b(localMultiBlockChangeInfo.c())); ++ } ++ } ++ ++ public void a(PacketListenerPlayOut paramPacketListenerPlayOut) ++ { ++ paramPacketListenerPlayOut.a(this); ++ } ++ ++ public class MultiBlockChangeInfo ++ { ++ public final short b; ++ public final IBlockData c; ++ ++ public MultiBlockChangeInfo(short paramIBlockData, IBlockData arg3) ++ { ++ this.b = paramIBlockData; ++ this.c = arg3; ++ } ++ ++ public MultiBlockChangeInfo(short paramChunk, Chunk arg3) { ++ this.b = paramChunk; ++ this.c = arg3.getBlockData(a()); ++ } ++ ++ public BlockPosition a() { ++ return new BlockPosition(b >> 12 & 0xf, b & 0xff, b >> 8 & 0xf); ++ } ++ ++ public short b() { ++ return this.b; ++ } ++ ++ public IBlockData c() { ++ return this.c; ++ } ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +index 23fa49d..277d1f2 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +@@ -25,8 +25,8 @@ public class PacketPlayOutNamedEntitySpawn implements Packet { + this.b = MathHelper.floor(entity.locX * 32.0D); + this.c = MathHelper.floor(entity.locY * 32.0D); + this.d = MathHelper.floor(entity.locZ * 32.0D); +- this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); +- this.i = MathHelper.d(entity.yaw * 256.0F / 360.0F); ++ this.h = MathHelper.d((entity.isFakeHead() ? entity.fakePitch : entity.pitch) * 256.0F / 360.0F); ++ this.i = MathHelper.d((entity.isFakeHead() ? entity.fakeYaw : entity.yaw) * 256.0F / 360.0F); + this.j = i; + this.k = j; + if (j > 0) { +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java +new file mode 100644 +index 0000000..4f2b03e +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java +@@ -0,0 +1,66 @@ ++// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. ++// Jad home page: http://www.kpdus.com/jad.html ++// Decompiler options: packimports(3) ++// Source File Name: SourceFile ++ ++package net.minecraft.server; ++ ++import java.io.IOException; ++ ++// Referenced classes of package net.minecraft.server.v1_8_R3: ++// Packet, EntityExperienceOrb, MathHelper, PacketDataSerializer, ++// PacketListenerPlayOut, PacketListener ++ ++public class PacketPlayOutSpawnEntityExperienceOrb ++ implements Packet ++{ ++ ++ public PacketPlayOutSpawnEntityExperienceOrb() ++ { ++ } ++ ++ public PacketPlayOutSpawnEntityExperienceOrb(EntityExperienceOrb entityexperienceorb) ++ { ++ a = entityexperienceorb.getId(); ++ b = MathHelper.floor(entityexperienceorb.locX * 32D); ++ c = MathHelper.floor(entityexperienceorb.locY * 32D); ++ d = MathHelper.floor(entityexperienceorb.locZ * 32D); ++ e = entityexperienceorb.j(); ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ a = packetdataserializer.e(); ++ b = packetdataserializer.readInt(); ++ c = packetdataserializer.readInt(); ++ d = packetdataserializer.readInt(); ++ e = packetdataserializer.readShort(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) ++ throws IOException ++ { ++ packetdataserializer.b(a); ++ packetdataserializer.writeInt(b); ++ packetdataserializer.writeInt(c); ++ packetdataserializer.writeInt(d); ++ packetdataserializer.writeShort(e); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) ++ { ++ packetlistenerplayout.a(this); ++ } ++ ++ public void a(PacketListener packetlistener) ++ { ++ a((PacketListenerPlayOut)packetlistener); ++ } ++ ++ public int a; ++ public int b; ++ public int c; ++ public int d; ++ public int e; ++} +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +index 61aa281..286ad09 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java +@@ -27,9 +27,9 @@ public class PacketPlayOutSpawnEntityLiving implements Packet +Date: Mon, 9 Nov 2015 00:07:26 +1300 +Subject: [PATCH] Add IEntitySelector, have isGhost() return the same as + isSpectator() + + +diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +new file mode 100644 +index 0000000..1536600 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/IEntitySelector.java +@@ -0,0 +1,103 @@ ++package net.minecraft.server; ++ ++import com.google.common.base.Predicate; ++ ++public final class IEntitySelector ++{ ++ public static class EntitySelectorEquipable ++ implements Predicate ++ { ++ ++ public boolean a(Entity entity) ++ { ++ if(!entity.isAlive()) ++ return false; ++ if(!(entity instanceof EntityLiving)) ++ return false; ++ EntityLiving entityliving = (EntityLiving)entity; ++ if(entityliving.getEquipment(EntityInsentient.c(a)) != null) ++ return false; ++ if(entityliving instanceof EntityInsentient) ++ return ((EntityInsentient)entityliving).bY(); ++ if(entityliving instanceof EntityArmorStand) ++ return true; ++ return entityliving instanceof EntityHuman; ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((Entity)obj); ++ } ++ ++ private final ItemStack a; ++ ++ public EntitySelectorEquipable(ItemStack itemstack) ++ { ++ a = itemstack; ++ } ++ } ++ ++ ++ public static final Predicate a = new Predicate() { ++ ++ public boolean a(Entity entity) ++ { ++ return entity.isAlive(); ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((Entity)obj); ++ } ++ ++ } ++; ++ public static final Predicate b = new Predicate() { ++ ++ public boolean a(Entity entity) ++ { ++ return entity.isAlive() && entity.passenger == null && entity.vehicle == null; ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((Entity)obj); ++ } ++ ++ } ++; ++ public static final Predicate c = new Predicate() { ++ ++ public boolean a(Entity entity) ++ { ++ return (entity instanceof IInventory) && entity.isAlive(); ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((Entity)obj); ++ } ++ ++ } ++; ++ public static final Predicate d = new Predicate() { ++ ++ public boolean a(Entity entity) ++ { ++ if (entity instanceof EntityLiving && ((EntityLiving) entity).isGhost()) ++ { ++ return false; ++ } ++ ++ return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator(); ++ } ++ ++ public boolean apply(Object obj) ++ { ++ return a((Entity)obj); ++ } ++ ++ } ++; ++ ++} +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0172-Add-player-spectator.patch b/Patches/CraftBukkit-Patches/0172-Add-player-spectator.patch new file mode 100644 index 000000000..585ef7b7a --- /dev/null +++ b/Patches/CraftBukkit-Patches/0172-Add-player-spectator.patch @@ -0,0 +1,22 @@ +From e81762b9aa4f28474b2ccd06ae6ad5b7c840e1ba Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Mon, 9 Nov 2015 00:13:21 +1300 +Subject: [PATCH] Add player spectator + + +diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +index 1536600..f86cf48 100644 +--- a/src/main/java/net/minecraft/server/IEntitySelector.java ++++ b/src/main/java/net/minecraft/server/IEntitySelector.java +@@ -89,7 +89,7 @@ public final class IEntitySelector + return false; + } + +- return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator(); ++ return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() && !((EntityPlayer)entity).spectating); + } + + public boolean apply(Object obj) +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0173-Fixed-ai-typo.patch b/Patches/CraftBukkit-Patches/0173-Fixed-ai-typo.patch new file mode 100644 index 000000000..b6fd20b9d --- /dev/null +++ b/Patches/CraftBukkit-Patches/0173-Fixed-ai-typo.patch @@ -0,0 +1,22 @@ +From 5dac54f90504022449cbd5ea23e5306f17523fe2 Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Mon, 9 Nov 2015 02:41:31 +1300 +Subject: [PATCH] Fixed ai typo + + +diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +index f86cf48..b4d70ad 100644 +--- a/src/main/java/net/minecraft/server/IEntitySelector.java ++++ b/src/main/java/net/minecraft/server/IEntitySelector.java +@@ -89,7 +89,7 @@ public final class IEntitySelector + return false; + } + +- return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() && !((EntityPlayer)entity).spectating); ++ return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() || ((EntityPlayer)entity).spectating); + } + + public boolean apply(Object obj) +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0174-Fix-casting-bug.patch b/Patches/CraftBukkit-Patches/0174-Fix-casting-bug.patch new file mode 100644 index 000000000..a6436cd56 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0174-Fix-casting-bug.patch @@ -0,0 +1,64 @@ +From ea74383b4c0f5160f0d890d9377bd0d72e31db0c Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Wed, 11 Nov 2015 00:21:54 +1300 +Subject: [PATCH] Fix casting bug + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 60e8584..746961e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -76,32 +76,44 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + + public boolean shouldBreakLeash() + { +- return ((EntityInsentient) getHandle()).shouldBreakLeash(); ++ if (getHandle() instanceof EntityInsentient) ++ return ((EntityInsentient) getHandle()).shouldBreakLeash(); ++ ++ return false; + } + + public void setShouldBreakLeash(boolean shouldBreakLeash) + { +- ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash); ++ if (getHandle() instanceof EntityInsentient) ++ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash); + } + + public boolean shouldPullWhileLeashed() + { +- return ((EntityInsentient) getHandle()).shouldPullWhileLeashed(); ++ if (getHandle() instanceof EntityInsentient) ++ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed(); ++ ++ return false; + } + + public void setPullWhileLeashed(boolean pullWhileLeashed) + { +- ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed); ++ if (getHandle() instanceof EntityInsentient) ++ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed); + } + + public boolean isVegetated() + { +- return ((EntityInsentient) getHandle()).isVegetated(); ++ if (getHandle() instanceof EntityInsentient) ++ return ((EntityInsentient) getHandle()).isVegetated(); ++ ++ return false; + } + + public void setVegetated(boolean vegetated) + { +- ((EntityInsentient) getHandle()).setVegetated(vegetated); ++ if (getHandle() instanceof EntityInsentient) ++ ((EntityInsentient) getHandle()).setVegetated(vegetated); + } + + public boolean isGhost() +-- +1.9.5.msysgit.0 + diff --git a/Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch b/Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch new file mode 100644 index 000000000..e6e990d00 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch @@ -0,0 +1,37 @@ +From 896df3218cf190a29901619e762b5399517dbfbd Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Wed, 11 Nov 2015 11:43:17 +1300 +Subject: [PATCH] Fix schedulers + + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 1d29ae7..55e2afd 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -705,6 +705,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + } + + public void B() { ++ SpigotTimings.schedulerTimer.startTiming(); // Spigot ++ // CraftBukkit start ++ this.server.getScheduler().mainThreadHeartbeat(this.ticks); ++ SpigotTimings.schedulerTimer.stopTiming(); // Spigot ++ + this.methodProfiler.a("jobs"); + Queue queue = this.j; + +@@ -718,11 +723,6 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + + this.methodProfiler.c("levels"); + +- SpigotTimings.schedulerTimer.startTiming(); // Spigot +- // CraftBukkit start +- this.server.getScheduler().mainThreadHeartbeat(this.ticks); +- SpigotTimings.schedulerTimer.stopTiming(); // Spigot +- + // Run tasks that are waiting on processing + SpigotTimings.processQueueTimer.startTiming(); // Spigot + while (!processQueue.isEmpty()) { +-- +1.9.5.msysgit.0 + diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index 37717d4dc..56d0c48ed 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -6,6 +6,8 @@ + + @@ -24,7 +26,7 @@ - + diff --git a/Plugins/.idea/dataSources.xml b/Plugins/.idea/dataSources.xml index 16b134887..8c71c7a5f 100644 --- a/Plugins/.idea/dataSources.xml +++ b/Plugins/.idea/dataSources.xml @@ -1,6 +1,6 @@ - + mysql true @@ -13,7 +13,6 @@ - \ No newline at end of file diff --git a/Plugins/.idea/encodings.xml b/Plugins/.idea/encodings.xml index d82104827..f75895965 100644 --- a/Plugins/.idea/encodings.xml +++ b/Plugins/.idea/encodings.xml @@ -1,4 +1,6 @@ - + + + \ No newline at end of file diff --git a/Plugins/BuildFiles/EnjinTranslator.xml b/Plugins/BuildFiles/EnjinTranslator.xml index bf3c1fb4a..6cd7bf62d 100644 --- a/Plugins/BuildFiles/EnjinTranslator.xml +++ b/Plugins/BuildFiles/EnjinTranslator.xml @@ -11,6 +11,9 @@ + + + diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutChat.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutChat.java deleted file mode 100644 index 07537a12f..000000000 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutChat.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.minecraft.server.v1_7_R4; - -import java.io.IOException; - -public class PacketPlayOutChat - extends Packet -{ - private IChatBaseComponent a; - private boolean b; - private byte _chatType = 0; - - public PacketPlayOutChat() - { - this.b = true; - } - - public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent) - { - this(ichatbasecomponent, true); - } - - public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag) - { - this.b = true; - this.a = ichatbasecomponent; - this.b = flag; - } - - public PacketPlayOutChat(String text) - { - this(ChatSerializer.a(text)); - } - - public void a(PacketDataSerializer packetdataserializer) - throws IOException - { - this.a = ChatSerializer.a(packetdataserializer.c(32767)); - } - - public void b(PacketDataSerializer packetdataserializer) - throws IOException - { - packetdataserializer.a(ChatSerializer.a(this.a)); - if (packetdataserializer.version >= 16) { - packetdataserializer.writeByte(_chatType); - } - } - - public void setChatType(byte chatType) - { - _chatType = chatType; - } - - public void a(PacketPlayOutListener packetplayoutlistener) - { - packetplayoutlistener.a(this); - } - - public String b() - { - return String.format("message='%s'", new Object[] { this.a }); - } - - public boolean d() - { - return this.b; - } - - public void handle(PacketListener packetlistener) - { - a((PacketPlayOutListener)packetlistener); - } -} diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java deleted file mode 100644 index f1bcc4118..000000000 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java +++ /dev/null @@ -1,207 +0,0 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by Fernflower decompiler) -// - -package net.minecraft.server.v1_7_R4; - -import java.io.IOException; -import java.util.Calendar; -import java.util.Iterator; - -import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard; -import org.bukkit.craftbukkit.v1_7_R4.util.CraftChatMessage; -import org.bukkit.scoreboard.Team; -import net.minecraft.util.com.mojang.authlib.GameProfile; -import net.minecraft.util.com.mojang.authlib.properties.Property; -import net.minecraft.util.com.mojang.authlib.properties.PropertyMap; - -public class PacketPlayOutPlayerInfo extends Packet { - - public static final String NOTCH_SKIN = "eyJ0aW1lc3RhbXAiOjE0Mjc4MjgyMzMwNDUsInByb2ZpbGVJZCI6IjA2OWE3OWY0NDRlOTQ3MjZhNWJlZmNhOTBlMzhhYWY1IiwicHJvZmlsZU5hbWUiOiJOb3RjaCIsImlzUHVibGljIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTExNmU2OWE4NDVlMjI3ZjdjYTFmZGRlOGMzNTdjOGM4MjFlYmQ0YmE2MTkzODJlYTRhMWY4N2Q0YWU5NCJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2Y2ODhlMGU2OTliM2Q5ZmU0NDhiNWJiNTBhM2EyODhmOWM1ODk3NjJiM2RhZTgzMDg4NDIxMjJkY2I4MSJ9fX0="; - public static final String NOTCH_SIGNATURE = "WrBmNqkpkjh6VJY26jOOMNS6oSOPi0MTm9WWc0t4EMUHchUbTd6/1sT2O2zz2s7xwmCeUxuIhvRREa+1bIPzIIbXJLjhxiBWMdTJbQhv6zBb1U2SZb7eb5cYrFTD6rvxy0rOarScxCBdeOXpr1coxrvN8a6VkgLhc/dGhFx0ZmORxELBLFiCNi+4WE//MI+KioAq84Gdf0ltT9ZLWdlHNFV2ynBgcx2MfNTA2lrpdKEUVOYD7xhPoOdHa5d1hzdDxbYPGDgM0FzYjzNUlBx8SLvHEpyBB7XyOsIGnfqrS0ltIDTq82wgLrEwDRncuQN18w6IiQbNK06MZBDyNnIp79mmUYvRj+Zl0dPBrZok2q2uQ08hZ87ufU3jhjY39kr+iEaPYMvfWaBxt3ALjopsZRCGSlEukMzITjeYxhfVKuQ0fhWKRfwWn/Jv2de2h+i+t7nulvN3MV3rJVrS6OXsx87p/vm9biU7Hs07T8VSGONfkxXmsgYEtY6m2egU5pmqFnsKM0MwwnZJ7Sxz2EjiPikoGzJzpv4ncj3rhelIKJKjDk9jSAz7nPzc8/UdOiTrfy4ezr3jFVAVatiKr+kS/HNXHWiCFdufhpG4DVCrSkwkFBJw030pJ6ICVhpuYq5yOswQB5QOp0JDWc2Rdth7SVmvxthSCL9G2ksfm+v7sKw="; - - - public static final int ADD_PLAYER = 0; - public static final int UPDATE_GAMEMODE = 1; - public static final int UPDATE_LATENCY = 2; - public static final int UPDATE_DISPLAY_NAME = 3; - public static final int REMOVE_PLAYER = 4; - public int action; - public GameProfile player; - public int gamemode; - public int ping; - public String username; - public String _tabName; - - public PacketPlayOutPlayerInfo() { - } - - public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) { - PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); - packet.action = 0; - packet.username = player.listName; - packet.player = player.getProfile(); - packet.ping = player.ping; - packet.gamemode = player.playerInteractManager.getGameMode().getId(); - - packet._tabName = getFormattedName(player); - return packet; - } - - public static PacketPlayOutPlayerInfo updatePing(EntityPlayer player) { - PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); - packet.action = 2; - packet.username = player.listName; - packet.player = player.getProfile(); - packet.ping = player.ping; - return packet; - } - - public static PacketPlayOutPlayerInfo updateGamemode(EntityPlayer player) { - PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); - packet.action = 1; - packet.username = player.listName; - packet.player = player.getProfile(); - packet.gamemode = player.playerInteractManager.getGameMode().getId(); - return packet; - } - - public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) { - return updateDisplayName(player, getFormattedName(player)); - } - - public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player, String displayName) - { - PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); - packet.action = 3; - packet.username = player.listName; - packet.player = player.getProfile(); - packet._tabName = displayName; - return packet; - } - - public static PacketPlayOutPlayerInfo removePlayer(EntityPlayer player) { - PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(); - packet.action = 4; - packet.username = player.listName; - packet.player = player.getProfile(); - return packet; - } - - public void a(PacketDataSerializer packetdataserializer) throws IOException { - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { - if(packetdataserializer.version >= 20) { - - Calendar c = Calendar.getInstance(); - - packetdataserializer.b(this.action); - packetdataserializer.b(1); - packetdataserializer.writeUUID(this.player.getId()); - switch(this.action) { - case 0: - packetdataserializer.a(this.player.getName()); - PropertyMap properties = this.player.getProperties(); - - // April Fools - if (isAprilFools() && properties.size() == 0) - { - // add texture if no textures exist - properties.put("textures", new Property("textures", NOTCH_SKIN, NOTCH_SIGNATURE)); - - } - - packetdataserializer.b(properties.size()); - Iterator var3 = properties.values().iterator(); - - while(var3.hasNext()) { - Property property = (Property)var3.next(); - - // April Fools - if (isAprilFools() && property.getName().equalsIgnoreCase("textures")) - { - System.out.println("Applying notch texture for : " + property.getName()); - System.out.println("Skin: " + property.getValue()); - System.out.println("Signature: " + property.getSignature()); - packetdataserializer.a(property.getName()); - packetdataserializer.a(NOTCH_SKIN); - packetdataserializer.writeBoolean(true); - packetdataserializer.a(NOTCH_SIGNATURE); - } - else - { - packetdataserializer.a(property.getName()); - packetdataserializer.a(property.getValue()); - - packetdataserializer.writeBoolean(property.hasSignature()); - if(property.hasSignature()) { - packetdataserializer.a(property.getSignature()); - } - } - } - - packetdataserializer.b(this.gamemode); - packetdataserializer.b(this.ping); - packetdataserializer.writeBoolean(this.username != null); - if(this.username != null) { -// packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this.username)[0])); - packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this._tabName)[0])); - } - break; - case 1: - packetdataserializer.b(this.gamemode); - break; - case 2: - packetdataserializer.b(this.ping); - break; - case 3: - packetdataserializer.writeBoolean(this.username != null); - if(this.username != null) { -// packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this.username)[0])); - packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this._tabName)[0])); - } - case 4: - } - } else { - packetdataserializer.a(this.username); - packetdataserializer.writeBoolean(this.action != 4); - packetdataserializer.writeShort(this.ping); - } - - } - - public void a(PacketPlayOutListener packetplayoutlistener) { - packetplayoutlistener.a(this); - } - - public void handle(PacketListener packetlistener) { - this.a((PacketPlayOutListener)((PacketPlayOutListener)packetlistener)); - } - - private static String getFormattedName(EntityPlayer player) - { - String name = player.getName(); - - if (isAprilFools()) name = "Notch"; - - CraftScoreboard scoreboard = player.getBukkitEntity().getScoreboard(); - if (scoreboard != null) - { - Team team = scoreboard.getPlayerTeam(player.getBukkitEntity()); - if (team != null) - name = team.getPrefix() + name + team.getSuffix(); - } - - return name; - } - - public static boolean isAprilFools() - { - Calendar c = Calendar.getInstance(); - -// return true; - return c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1; - } -} diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutScoreboardTeam.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutScoreboardTeam.java deleted file mode 100644 index cd8b44aaf..000000000 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutScoreboardTeam.java +++ /dev/null @@ -1,121 +0,0 @@ -package net.minecraft.server.v1_7_R4; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -public class PacketPlayOutScoreboardTeam - extends Packet -{ - private String a = ""; - private String b = ""; - private String c = ""; - private String d = ""; - private String _nameTagVisibility; - private Collection e = new ArrayList(); - private int f; - private int g; - - public PacketPlayOutScoreboardTeam() {} - - public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, int i) - { - this.a = scoreboardteam.getName(); - this.f = i; - if ((i == 0) || (i == 2)) - { - this.b = scoreboardteam.getDisplayName(); - this.c = scoreboardteam.getPrefix(); - this.d = scoreboardteam.getSuffix(); - this.g = scoreboardteam.packOptionData(); - this._nameTagVisibility = scoreboardteam.getNametagVisibility(); - } - if (i == 0) { - this.e.addAll(scoreboardteam.getPlayerNameSet()); - } - } - - public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, Collection collection, int i) - { - if ((i != 3) && (i != 4)) { - throw new IllegalArgumentException("Method must be join or leave for player constructor"); - } - if ((collection != null) && (!collection.isEmpty())) - { - this.f = i; - this.a = scoreboardteam.getName(); - this.e.addAll(collection); - this._nameTagVisibility = _nameTagVisibility; - } - else - { - throw new IllegalArgumentException("Players cannot be null/empty"); - } - } - - public void a(PacketDataSerializer packetdataserializer) - throws IOException - { - this.a = packetdataserializer.c(16); - this.f = packetdataserializer.readByte(); - if ((this.f == 0) || (this.f == 2)) - { - this.b = packetdataserializer.c(32); - this.c = packetdataserializer.c(16); - this.d = packetdataserializer.c(16); - this.g = packetdataserializer.readByte(); - } - if ((this.f == 0) || (this.f == 3) || (this.f == 4)) - { - short short1 = packetdataserializer.readShort(); - for (int i = 0; i < short1; i++) { - this.e.add(packetdataserializer.c(40)); - } - } - } - - public void b(PacketDataSerializer packetdataserializer) - throws IOException - { - packetdataserializer.a(this.a); - packetdataserializer.writeByte(this.f); - if ((this.f == 0) || (this.f == 2)) - { - packetdataserializer.a(this.b); - packetdataserializer.a(this.c); - packetdataserializer.a(this.d); - packetdataserializer.writeByte(this.g); - if (packetdataserializer.version >= 16) - { - packetdataserializer.a(_nameTagVisibility); - packetdataserializer.writeByte(EnumChatFormat.WHITE.ordinal()); - } - } - if ((this.f == 0) || (this.f == 3) || (this.f == 4)) - { - if (packetdataserializer.version < 16) { - packetdataserializer.writeShort(this.e.size()); - } else { - packetdataserializer.b(this.e.size()); - } - Iterator iterator = this.e.iterator(); - while (iterator.hasNext()) - { - String s = (String)iterator.next(); - - packetdataserializer.a(s); - } - } - } - - public void a(PacketPlayOutListener packetplayoutlistener) - { - packetplayoutlistener.a(this); - } - - public void handle(PacketListener packetlistener) - { - a((PacketPlayOutListener)packetlistener); - } -} diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutSetSlot.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutSetSlot.java deleted file mode 100644 index fa2e68692..000000000 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutSetSlot.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.minecraft.server.v1_7_R4; - -import net.minecraft.server.v1_7_R4.ItemStack; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.server.v1_7_R4.PacketListener; -import net.minecraft.server.v1_7_R4.PacketPlayOutListener; - -public class PacketPlayOutSetSlot extends Packet { - public int a; - public int b; - public ItemStack c; - - public PacketPlayOutSetSlot() { - } - - public PacketPlayOutSetSlot(int i, int j, ItemStack itemstack) { - this.a = i; - this.b = j; - this.c = itemstack == null?null:itemstack.cloneItemStack(); - } - - public void a(PacketPlayOutListener packetplayoutlistener) { - packetplayoutlistener.a(this); - } - - public void a(PacketDataSerializer packetdataserializer) { - this.a = packetdataserializer.readByte(); - this.b = packetdataserializer.readShort(); - this.c = packetdataserializer.c(); - } - - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.writeByte(this.a); - packetdataserializer.writeShort(this.b); - packetdataserializer.a(this.c); - } - - public void handle(PacketListener packetlistener) { - this.a((PacketPlayOutListener)packetlistener); - } -} diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutWorldParticles.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutWorldParticles.java deleted file mode 100644 index c68e25f76..000000000 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutWorldParticles.java +++ /dev/null @@ -1,179 +0,0 @@ -package net.minecraft.server.v1_7_R4; - -import java.io.IOException; -import java.util.HashMap; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.server.v1_7_R4.PacketListener; -import net.minecraft.server.v1_7_R4.PacketPlayOutListener; - -public class PacketPlayOutWorldParticles extends Packet { - private String a; - private float b; - private float c; - private float d; - private float e; - private float f; - private float g; - private float h; - private int i; - private boolean _displayFar; - - public PacketPlayOutWorldParticles() { - } - - public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i) { - this(s, f, f1, f2, f3, f4, f5, f6, i, false); - } - - public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i, boolean displayFar) { - this.a = s; - this.b = f; - this.c = f1; - this.d = f2; - this.e = f3; - this.f = f4; - this.g = f5; - this.h = f6; - this.i = i; - - _displayFar = displayFar; - } - - public void a(PacketDataSerializer packetdataserializer) throws IOException { - this.a = packetdataserializer.c(64); - this.b = packetdataserializer.readFloat(); - this.c = packetdataserializer.readFloat(); - this.d = packetdataserializer.readFloat(); - this.e = packetdataserializer.readFloat(); - this.f = packetdataserializer.readFloat(); - this.g = packetdataserializer.readFloat(); - this.h = packetdataserializer.readFloat(); - this.i = packetdataserializer.readInt(); - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException { - String[] parts = this.a.split("_"); - PacketPlayOutWorldParticles.Particle particle = PacketPlayOutWorldParticles.Particle.find(parts[0]); - if(particle == null) { - particle = PacketPlayOutWorldParticles.Particle.CRIT; - } - - if(packetdataserializer.version < 17) { - packetdataserializer.a(this.a); - } else { - packetdataserializer.writeInt(particle.ordinal()); - packetdataserializer.writeBoolean(_displayFar); - } - - packetdataserializer.writeFloat(this.b); - packetdataserializer.writeFloat(this.c); - packetdataserializer.writeFloat(this.d); - packetdataserializer.writeFloat(this.e); - packetdataserializer.writeFloat(this.f); - packetdataserializer.writeFloat(this.g); - packetdataserializer.writeFloat(this.h); - packetdataserializer.writeInt(this.i); - if(packetdataserializer.version >= 17) { - for(int i = 0; i < particle.extra; ++i) { - int toWrite = 0; - if(parts.length - 1 > i) { - try { - toWrite = Integer.parseInt(parts[i + 1]); - if(particle.extra == 1 && parts.length == 3) { - ++i; - toWrite |= Integer.parseInt(parts[i + 1]) << 12; - } - } catch (NumberFormatException var7) { - ; - } - } - - packetdataserializer.b(toWrite); - } - } - - } - - public void a(PacketPlayOutListener packetplayoutlistener) { - packetplayoutlistener.a(this); - } - - public void handle(PacketListener packetlistener) { - this.a((PacketPlayOutListener)packetlistener); - } - - private static enum Particle { - EXPLOSION_NORMAL("explode"), - EXPLOSION_LARGE("largeexplode"), - EXPLOSION_HUGE("hugeexplosion"), - FIREWORKS_SPARK("fireworksSpark"), - WATER_BUBBLE("bubble"), - WATER_SPLASH("splash"), - WATER_WAKE("wake"), - SUSPENDED("suspended"), - SUSPENDED_DEPTH("depthsuspend"), - CRIT("crit"), - CRIT_MAGIC("magicCrit"), - SMOKE_NORMAL("smoke"), - SMOKE_LARGE("largesmoke"), - SPELL("spell"), - SPELL_INSTANT("instantSpell"), - SPELL_MOB("mobSpell"), - SPELL_MOB_AMBIENT("mobSpellAmbient"), - SPELL_WITCH("witchMagic"), - DRIP_WATER("dripWater"), - DRIP_LAVA("dripLava"), - VILLAGER_ANGRY("angryVillager"), - VILLAGER_HAPPY("happyVillager"), - TOWN_AURA("townaura"), - NOTE("note"), - PORTAL("portal"), - ENCHANTMENT_TABLE("enchantmenttable"), - FLAME("flame"), - LAVA("lava"), - FOOTSTEP("footstep"), - CLOUD("cloud"), - REDSTONE("reddust"), - SNOWBALL("snowballpoof"), - SNOW_SHOVEL("snowshovel"), - SLIME("slime"), - HEART("heart"), - BARRIER("barrier"), - ICON_CRACK("iconcrack", 2), - BLOCK_CRACK("blockcrack", 1), - BLOCK_DUST("blockdust", 1), - WATER_DROP("droplet"), - ITEM_TAKE("take"), - MOB_APPEARANCE("mobappearance"); - - public final String name; - public final int extra; - private static final HashMap particleMap; - - private Particle(String name) { - this(name, 0); - } - - private Particle(String name, int extra) { - this.name = name; - this.extra = extra; - } - - public static PacketPlayOutWorldParticles.Particle find(String part) { - return (PacketPlayOutWorldParticles.Particle)particleMap.get(part); - } - - static { - particleMap = new HashMap(); - PacketPlayOutWorldParticles.Particle[] var0 = values(); - int var1 = var0.length; - - for(int var2 = 0; var2 < var1; ++var2) { - PacketPlayOutWorldParticles.Particle particle = var0[var2]; - particleMap.put(particle.name, particle); - } - - } - } -} \ No newline at end of file diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/ScoreboardTeam.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/ScoreboardTeam.java deleted file mode 100644 index 07f687b66..000000000 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/ScoreboardTeam.java +++ /dev/null @@ -1,135 +0,0 @@ -package net.minecraft.server.v1_7_R4; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -public class ScoreboardTeam - extends ScoreboardTeamBase -{ - private final Scoreboard a; - private final String b; - private final Set c = new HashSet(); - private String d; - private String e = ""; - private String f = ""; - private String _nametagVisibility = "always"; - private boolean g = true; - private boolean h = true; - - public ScoreboardTeam(Scoreboard paramScoreboard, String paramString) - { - this.a = paramScoreboard; - this.b = paramString; - this.d = paramString; - } - - public String getName() - { - return this.b; - } - - public String getDisplayName() - { - return this.d; - } - - public void setDisplayName(String paramString) - { - if (paramString == null) { - throw new IllegalArgumentException("Name cannot be null"); - } - this.d = paramString; - this.a.handleTeamChanged(this); - } - - public Collection getPlayerNameSet() - { - return this.c; - } - - public String getPrefix() - { - return this.e; - } - - public void setPrefix(String paramString) - { - if (paramString == null) { - throw new IllegalArgumentException("Prefix cannot be null"); - } - this.e = paramString; - this.a.handleTeamChanged(this); - } - - public String getSuffix() - { - return this.f; - } - - public void setSuffix(String paramString) - { - if (paramString == null) { - throw new IllegalArgumentException("Suffix cannot be null"); - } - this.f = paramString; - this.a.handleTeamChanged(this); - } - - public String getFormattedName(String paramString) - { - return getPrefix() + paramString + getSuffix(); - } - - public static String getPlayerDisplayName(ScoreboardTeamBase paramScoreboardTeamBase, String paramString) - { - if (paramScoreboardTeamBase == null) { - return paramString; - } - return paramScoreboardTeamBase.getFormattedName(paramString); - } - - public boolean allowFriendlyFire() - { - return this.g; - } - - public void setAllowFriendlyFire(boolean paramBoolean) - { - this.g = paramBoolean; - this.a.handleTeamChanged(this); - } - - public boolean canSeeFriendlyInvisibles() - { - return this.h; - } - - public void setCanSeeFriendlyInvisibles(boolean paramBoolean) - { - this.h = paramBoolean; - this.a.handleTeamChanged(this); - } - - public String getNametagVisibility() - { - return _nametagVisibility; - } - - public void setNametagVisibility(String visibility) - { - _nametagVisibility = visibility; - } - - public int packOptionData() - { - int i = 0; - if (allowFriendlyFire()) { - i |= 0x1; - } - if (canSeeFriendlyInvisibles()) { - i |= 0x2; - } - return i; - } -} diff --git a/Plugins/Classpath.Dummy/src/org/bukkit/craftbukkit/v1_7_R4/scoreboard/CraftTeam.java b/Plugins/Classpath.Dummy/src/org/bukkit/craftbukkit/v1_7_R4/scoreboard/CraftTeam.java deleted file mode 100644 index 51ebe3d63..000000000 --- a/Plugins/Classpath.Dummy/src/org/bukkit/craftbukkit/v1_7_R4/scoreboard/CraftTeam.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.bukkit.craftbukkit.v1_7_R4.scoreboard; - -import java.util.Set; - -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.scoreboard.Team; -import org.bukkit.scoreboard.TeamNameTagVisibility; -import net.minecraft.server.v1_7_R4.ScoreboardTeam; - -import com.google.common.collect.ImmutableSet; -import org.apache.commons.lang.Validate; - -final class CraftTeam - extends CraftScoreboardComponent - implements Team -{ - private final ScoreboardTeam team; - - CraftTeam(CraftScoreboard scoreboard, ScoreboardTeam team) - { - super(scoreboard); - this.team = team; - scoreboard.teams.put(team.getName(), this); - } - - public String getName() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.getName(); - } - - public String getDisplayName() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.getDisplayName(); - } - - public void setDisplayName(String displayName) - throws IllegalStateException - { - Validate.notNull(displayName, "Display name cannot be null"); - Validate.isTrue(displayName.length() <= 32, "Display name '" + displayName + "' is longer than the limit of 32 characters"); - CraftScoreboard scoreboard = checkState(); - - this.team.setDisplayName(displayName); - } - - public String getPrefix() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.getPrefix(); - } - - public void setPrefix(String prefix) - throws IllegalStateException, IllegalArgumentException - { - Validate.notNull(prefix, "Prefix cannot be null"); - Validate.isTrue(prefix.length() <= 32, "Prefix '" + prefix + "' is longer than the limit of 32 characters"); - CraftScoreboard scoreboard = checkState(); - - this.team.setPrefix(prefix); - } - - public String getSuffix() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.getSuffix(); - } - - public void setSuffix(String suffix) - throws IllegalStateException, IllegalArgumentException - { - Validate.notNull(suffix, "Suffix cannot be null"); - Validate.isTrue(suffix.length() <= 32, "Suffix '" + suffix + "' is longer than the limit of 32 characters"); - CraftScoreboard scoreboard = checkState(); - - this.team.setSuffix(suffix); - } - - public boolean allowFriendlyFire() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.allowFriendlyFire(); - } - - // Mineplex - @Override - public void setNameTagVisibility(TeamNameTagVisibility visibility) throws IllegalStateException - { - this.team.setNametagVisibility(visibility.toString()); - } - - public void setAllowFriendlyFire(boolean enabled) - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - this.team.setAllowFriendlyFire(enabled); - } - - public boolean canSeeFriendlyInvisibles() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.canSeeFriendlyInvisibles(); - } - - public void setCanSeeFriendlyInvisibles(boolean enabled) - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - this.team.setCanSeeFriendlyInvisibles(enabled); - } - - public Set getPlayers() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - ImmutableSet.Builder players = ImmutableSet.builder(); - for (Object o : this.team.getPlayerNameSet()) { - players.add(Bukkit.getOfflinePlayer(o.toString())); - } - return players.build(); - } - - public Set getEntries() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - ImmutableSet.Builder entries = ImmutableSet.builder(); - for (Object o : this.team.getPlayerNameSet()) { - entries.add(o.toString()); - } - return entries.build(); - } - - public int getSize() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - return this.team.getPlayerNameSet().size(); - } - - public void addPlayer(OfflinePlayer player) - throws IllegalStateException, IllegalArgumentException - { - Validate.notNull(player, "OfflinePlayer cannot be null"); - - addEntry(player.getName()); - } - - public void addEntry(String entry) - throws IllegalStateException, IllegalArgumentException - { - Validate.notNull(entry, "Entry cannot be null"); - CraftScoreboard scoreboard = checkState(); - - scoreboard.board.addPlayerToTeam(entry, this.team.getName()); - } - - public boolean removePlayer(OfflinePlayer player) - throws IllegalStateException, IllegalArgumentException - { - Validate.notNull(player, "OfflinePlayer cannot be null"); - - return removeEntry(player.getName()); - } - - public boolean removeEntry(String entry) - throws IllegalStateException, IllegalArgumentException - { - Validate.notNull(entry, "Entry cannot be null"); - CraftScoreboard scoreboard = checkState(); - if (!this.team.getPlayerNameSet().contains(entry)) { - return false; - } - scoreboard.board.removePlayerFromTeam(entry, this.team); - - return true; - } - - public boolean hasPlayer(OfflinePlayer player) - throws IllegalArgumentException, IllegalStateException - { - Validate.notNull(player, "OfflinePlayer cannot be null"); - - return hasEntry(player.getName()); - } - - public boolean hasEntry(String entry) - throws IllegalArgumentException, IllegalStateException - { - Validate.notNull("Entry cannot be null"); - - CraftScoreboard scoreboard = checkState(); - - return this.team.getPlayerNameSet().contains(entry); - } - - public void unregister() - throws IllegalStateException - { - CraftScoreboard scoreboard = checkState(); - - scoreboard.board.removeTeam(this.team); - scoreboard.teams.remove(this.team.getName()); - setUnregistered(); - } -} diff --git a/Plugins/Libraries/BungeeCord.jar b/Plugins/Libraries/BungeeCord.jar index 45383e430..895238443 100644 Binary files a/Plugins/Libraries/BungeeCord.jar and b/Plugins/Libraries/BungeeCord.jar differ diff --git a/Plugins/Libraries/bukkit.jar b/Plugins/Libraries/bukkit.jar index a0bfc9342..460e80d24 100644 Binary files a/Plugins/Libraries/bukkit.jar and b/Plugins/Libraries/bukkit.jar differ diff --git a/Plugins/Libraries/craftbukkit.jar b/Plugins/Libraries/craftbukkit.jar index 74d42a85b..5bbef8dd0 100644 Binary files a/Plugins/Libraries/craftbukkit.jar and b/Plugins/Libraries/craftbukkit.jar differ diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java index 443dc104b..fadc89543 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java @@ -81,7 +81,7 @@ public class LobbyBalancer implements Listener, Runnable InetSocketAddress socketAddress = new InetSocketAddress(server.getPublicAddress(), server.getPort()); _plugin.getProxy().getServers().put(server.getName(), _plugin.getProxy().constructServerInfo(server.getName(), socketAddress, "LobbyBalancer", false)); - if (server.getName().toUpperCase().contains("LOBBY")) + if (server.getName().toUpperCase().startsWith("LOBBY")) { if (server.getMotd() == null || !server.getMotd().contains("Restarting")) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DummyEntity.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DummyEntity.java index 8d47c0a82..7c74e0cf4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DummyEntity.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DummyEntity.java @@ -1,8 +1,8 @@ package mineplex.core.common; -import net.minecraft.server.v1_7_R4.Entity; -import net.minecraft.server.v1_7_R4.NBTTagCompound; -import net.minecraft.server.v1_7_R4.World; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; public class DummyEntity extends Entity { @@ -12,17 +12,20 @@ public class DummyEntity extends Entity } @Override - protected void c() + protected void h() { + } @Override - protected void a(NBTTagCompound nbttagcompound) + protected void a(NBTTagCompound nbtTagCompound) { + } @Override - protected void b(NBTTagCompound nbttagcompound) + protected void b(NBTTagCompound nbtTagCompound) { + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java index 0d8f6fb01..f4ce9532e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/jsonchat/JsonMessage.java @@ -1,10 +1,10 @@ package mineplex.core.common.jsonchat; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.minecraft.server.v1_7_R4.ChatSerializer; -import net.minecraft.server.v1_7_R4.PacketPlayOutChat; +import net.minecraft.server.v1_8_R3.IChatBaseComponent; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -119,25 +119,12 @@ public class JsonMessage */ public void send(MessageType messageType, Player... players) { - send(messageType, false, players); - } - - /** - * Send a message to players using the new 1.8 message types - * - * @param messageType Message type to send - * @param defaultToChat Only applies to MessageType.ABOVE_HOTBAR. If true, it will send this to chat for 1.7 clients - * @param players Players to send to - */ - public void send(MessageType messageType, boolean defaultToChat, Player... players) - { - PacketPlayOutChat chatPacket = new PacketPlayOutChat(ChatSerializer.a(toString())); - chatPacket.setChatType(messageType.getId()); + PacketPlayOutChat chatPacket = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a(toString())); + chatPacket.b = messageType.getId(); for (Player player : players) { - if (defaultToChat || messageType != MessageType.ABOVE_HOTBAR || UtilPlayer.is1_8(player)) - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket); + UtilPlayer.sendPacket(player, chatPacket); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java index cf348a681..4b4678d28 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java @@ -2,7 +2,7 @@ package mineplex.core.common.util; import java.util.HashMap; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; import org.bukkit.inventory.ItemStack; public class InventoryUtil diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index 73ae33c86..9df45eeac 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -1,48 +1,41 @@ package mineplex.core.common.util; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import net.minecraft.server.v1_7_R4.Block; -import net.minecraft.server.v1_7_R4.BlockContainer; -import net.minecraft.server.v1_7_R4.Blocks; -import net.minecraft.server.v1_7_R4.ChunkCoordIntPair; -import net.minecraft.server.v1_7_R4.ChunkSection; -import net.minecraft.server.v1_7_R4.EnumSkyBlock; -import net.minecraft.server.v1_7_R4.ExceptionWorldConflict; -import net.minecraft.server.v1_7_R4.IContainer; -import net.minecraft.server.v1_7_R4.IProgressUpdate; -import net.minecraft.server.v1_7_R4.MinecraftServer; -import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk; -import net.minecraft.server.v1_7_R4.PacketPlayOutMultiBlockChange; -import net.minecraft.server.v1_7_R4.RegionFile; -import net.minecraft.server.v1_7_R4.RegionFileCache; -import net.minecraft.server.v1_7_R4.TileEntity; - import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.CraftChunk; -import org.bukkit.craftbukkit.v1_7_R4.CraftServer; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.util.Vector; + +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.ChunkCoordIntPair; +import net.minecraft.server.v1_8_R3.ExceptionWorldConflict; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.IProgressUpdate; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.PacketPlayOutMultiBlockChange; +import net.minecraft.server.v1_8_R3.RegionFile; +import net.minecraft.server.v1_8_R3.RegionFileCache; public class MapUtil { - public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer) + /*public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer) { - net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle(); + net.minecraft.server.v1_8_R3.Chunk c = ((CraftChunk) chunk).getHandle(); for (int x = 0; x < 16; x++) { @@ -54,7 +47,7 @@ public class MapUtil int bY = y & 0xFF; int bZ = c.locZ << 4 | z & 0xF; - if (c.getType(bX & 0xF, bY, bZ & 0xF).k() == replacee.getId()) + if (c.getTypeAbs(bX, bY, bZ).k() == replacee.getId()) { c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId()); } @@ -63,7 +56,7 @@ public class MapUtil } c.initLighting(); - } + }*/ public static void QuickChangeBlockAt(Location location, Material setTo) { @@ -94,10 +87,12 @@ public class MapUtil public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data) { Chunk chunk = world.getChunkAt(x >> 4, z >> 4); - net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle(); + net.minecraft.server.v1_8_R3.Chunk c = ((CraftChunk) chunk).getHandle(); - c.a(x & 0xF, y, z & 0xF, Block.getById(id), data); - ((CraftWorld) world).getHandle().notify(x, y, z); + //c.a(x & 0xF, y, z & 0xF, Block.getById(id), data); + IBlockData blockData = CraftMagicNumbers.getBlock(id).fromLegacyData(data); + c.a(getBlockPos(x, y, z), blockData); + ((CraftWorld) world).getHandle().notify(getBlockPos(x, y, z)); } public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius) @@ -152,7 +147,7 @@ public class MapUtil Block.getById(id), data)) { if (notifyPlayers) - ((CraftWorld) world).getHandle().notify(x, y, z); + ((CraftWorld) world).getHandle().notify(getBlockPos(x, y, z)); } } @@ -161,13 +156,15 @@ public class MapUtil world.getBlockAt(x, y, z).setTypeIdAndData(id, data, notifyPlayers); } - private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R4.Chunk chunk, Block block, + private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_8_R3.Chunk chunk, Block block, byte data) { - return chunk.a(x, y, z, block, data); + chunk.a(getBlockPos(x, y, z), block.fromLegacyData(data)); + return true; // todo? +// return chunk.a(x, y, z, block, data); } - public static void SendChunkForPlayer(net.minecraft.server.v1_7_R4.Chunk chunk, Player player) + public static void SendChunkForPlayer(net.minecraft.server.v1_8_R3.Chunk chunk, Player player) { SendChunkForPlayer(chunk.locX, chunk.locZ, player); } @@ -184,8 +181,8 @@ public class MapUtil Player player) { // System.out.println("Sending MultiBlockChunk " + x + ", " + z); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutMultiBlockChange(dirtyCount, - dirtyBlocks, ((CraftWorld) world).getHandle().getChunkAt(x, z))); + UtilPlayer.sendPacket(player, new PacketPlayOutMultiBlockChange(dirtyCount, dirtyBlocks, ((CraftWorld) world).getHandle() + .getChunkAt(x, z))); } public static void UnloadWorld(JavaPlugin plugin, World world) @@ -216,7 +213,7 @@ public class MapUtil Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld())); - Iterator chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks + Iterator chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks .values().iterator(); for (Entity entity : world.getEntities()) @@ -226,7 +223,7 @@ public class MapUtil while (chunkIterator.hasNext()) { - net.minecraft.server.v1_7_R4.Chunk chunk = chunkIterator.next(); + net.minecraft.server.v1_8_R3.Chunk chunk = chunkIterator.next(); chunk.removeEntities(); } @@ -251,23 +248,7 @@ public class MapUtil System.out.println("Error removing world from bukkit master list: " + ex.getMessage()); } - MinecraftServer ms = null; - - try - { - Field f = server.getClass().getDeclaredField("console"); - f.setAccessible(true); - ms = (MinecraftServer) f.get(server); - f.setAccessible(false); - } - catch (IllegalAccessException ex) - { - System.out.println("Error getting minecraftserver variable: " + ex.getMessage()); - } - catch (NoSuchFieldException ex) - { - System.out.println("Error getting minecraftserver variable: " + ex.getMessage()); - } + MinecraftServer ms = server.getServer(); ms.worlds.remove(ms.worlds.indexOf(craftWorld.getHandle())); } @@ -303,4 +284,9 @@ public class MapUtil return true; } + + public static BlockPosition getBlockPos(int x, int y, int z) + { + return new BlockPosition(x, y, z); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java index 5c105a203..bcc4ffb42 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java @@ -6,8 +6,8 @@ import java.util.Scanner; import java.util.UUID; import java.util.logging.Level; -import net.minecraft.util.com.mojang.authlib.GameProfile; -import net.minecraft.util.com.mojang.authlib.properties.Property; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index d0b624505..c3d16a857 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -428,4 +428,15 @@ public class UtilAlg { return a.getWorld() == b.getWorld() && a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ(); } + + public static int randomMidpoint(int min, int max) + { + int variance = max - min; + + int value = UtilMath.r(variance); + + value += min; + + return value; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 8299e9e88..c4152acb0 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -4,16 +4,17 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import net.minecraft.server.v1_7_R4.Blocks; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.WorldServer; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.inventory.ItemStack; public class UtilBlock @@ -52,7 +53,7 @@ public class UtilBlock */ public static HashSet fullSolid = new HashSet(); /** - * A list of blocks that are non-solid, but offer resistance. Eg lily, fence gate, portal + * A list of blocks that are non-solid, but can't be moved through. Eg lily, fence gate, portal */ public static HashSet blockPassSet = new HashSet(); /** @@ -61,188 +62,225 @@ public class UtilBlock public static HashSet blockAirFoliageSet = new HashSet(); static { - blockAirFoliageSet.add((byte)0); - blockAirFoliageSet.add((byte)6); - blockAirFoliageSet.add((byte)31); - blockAirFoliageSet.add((byte)32); - blockAirFoliageSet.add((byte)37); - blockAirFoliageSet.add((byte)38); - blockAirFoliageSet.add((byte)39); - blockAirFoliageSet.add((byte)40); - blockAirFoliageSet.add((byte)51); - blockAirFoliageSet.add((byte)59); - blockAirFoliageSet.add((byte)104); - blockAirFoliageSet.add((byte)105); - blockAirFoliageSet.add((byte)115); - blockAirFoliageSet.add((byte)141); - blockAirFoliageSet.add((byte)142); - - blockPassSet.add((byte)0); - blockPassSet.add((byte)6); - blockPassSet.add((byte)8); - blockPassSet.add((byte)9); - blockPassSet.add((byte)10); - blockPassSet.add((byte)11); - blockPassSet.add((byte)26); - blockPassSet.add((byte)27); - blockPassSet.add((byte)28); - blockPassSet.add((byte)30); - blockPassSet.add((byte)31); - blockPassSet.add((byte)32); - blockPassSet.add((byte)37); - blockPassSet.add((byte)38); - blockPassSet.add((byte)39); - blockPassSet.add((byte)40); - blockPassSet.add((byte)50); - blockPassSet.add((byte)51); - blockPassSet.add((byte)55); - blockPassSet.add((byte)59); - blockPassSet.add((byte)63); - blockPassSet.add((byte)64); - blockPassSet.add((byte)65); - blockPassSet.add((byte)66); - blockPassSet.add((byte)68); - blockPassSet.add((byte)69); - blockPassSet.add((byte)70); - blockPassSet.add((byte)71); - blockPassSet.add((byte)72); - blockPassSet.add((byte)75); - blockPassSet.add((byte)76); - blockPassSet.add((byte)77); - blockPassSet.add((byte)78); - blockPassSet.add((byte)83); - blockPassSet.add((byte)90); - blockPassSet.add((byte)92); - blockPassSet.add((byte)93); - blockPassSet.add((byte)94); - blockPassSet.add((byte)96); - blockPassSet.add((byte)101); - blockPassSet.add((byte)102); - blockPassSet.add((byte)104); - blockPassSet.add((byte)105); - blockPassSet.add((byte)106); - blockPassSet.add((byte)107); - blockPassSet.add((byte)111); - blockPassSet.add((byte)115); - blockPassSet.add((byte)116); - blockPassSet.add((byte)117); - blockPassSet.add((byte)118); - blockPassSet.add((byte)119); - blockPassSet.add((byte)120); - blockPassSet.add((byte)171); - - fullSolid.add((byte)1); // - fullSolid.add((byte)2); // - fullSolid.add((byte)3); // - fullSolid.add((byte)4); // - fullSolid.add((byte)5); // - fullSolid.add((byte)7); // - fullSolid.add((byte)12); // - fullSolid.add((byte)13); // - fullSolid.add((byte)14); // - fullSolid.add((byte)15); // - fullSolid.add((byte)16); // - fullSolid.add((byte)17); // - fullSolid.add((byte)19); // - fullSolid.add((byte)20); // - fullSolid.add((byte)21); // - fullSolid.add((byte)22); // - fullSolid.add((byte)23); // - fullSolid.add((byte)24); // - fullSolid.add((byte)25); // - fullSolid.add((byte)29); // - fullSolid.add((byte)33); // - fullSolid.add((byte)35); // - fullSolid.add((byte)41); // - fullSolid.add((byte)42); // - fullSolid.add((byte)43); // - fullSolid.add((byte)44); // - fullSolid.add((byte)45); // - fullSolid.add((byte)46); // - fullSolid.add((byte)47); // - fullSolid.add((byte)48); // - fullSolid.add((byte)49); // - fullSolid.add((byte)56); // - fullSolid.add((byte)57); // - fullSolid.add((byte)58); // - fullSolid.add((byte)60); // - fullSolid.add((byte)61); // - fullSolid.add((byte)62); // - fullSolid.add((byte)73); // - fullSolid.add((byte)74); // - fullSolid.add((byte)79); // - fullSolid.add((byte)80); // - fullSolid.add((byte)82); // - fullSolid.add((byte)84); // - fullSolid.add((byte)86); // - fullSolid.add((byte)87); // - fullSolid.add((byte)88); // - fullSolid.add((byte)89); // - fullSolid.add((byte)91); // - fullSolid.add((byte)95); // - fullSolid.add((byte)97); // - fullSolid.add((byte)98); // - fullSolid.add((byte)99); // - fullSolid.add((byte)100); // - fullSolid.add((byte)103); // - fullSolid.add((byte)110); // - fullSolid.add((byte)112); // - fullSolid.add((byte)121); // - fullSolid.add((byte)123); // - fullSolid.add((byte)124); // - fullSolid.add((byte)125); // - fullSolid.add((byte)126); // - fullSolid.add((byte)129); // - fullSolid.add((byte)133); // - fullSolid.add((byte)137); // - fullSolid.add((byte)138); // - fullSolid.add((byte)152); // - fullSolid.add((byte)153); // - fullSolid.add((byte)155); // - fullSolid.add((byte)158); // - - blockUseSet.add((byte)23); //Dispenser - blockUseSet.add((byte)26); //Bed - blockUseSet.add((byte)33); //Piston - blockUseSet.add((byte)47); //Bookcase - blockUseSet.add((byte)54); //Chest - blockUseSet.add((byte)58); //Workbench - blockUseSet.add((byte)61); //Furnace - blockUseSet.add((byte)62); //Furnace - blockUseSet.add((byte)64); //Wood Door - blockUseSet.add((byte)69); //Lever - blockUseSet.add((byte)71); //Iron Door - blockUseSet.add((byte)77); //Button - blockUseSet.add((byte)85); //Fence (stupid minecraft) - blockUseSet.add((byte)93); //Repeater - blockUseSet.add((byte)94); //Repeater - blockUseSet.add((byte)96); //Trapdoor - blockUseSet.add((byte)107); //Fence Gate - blockUseSet.add((byte)113); //Nether Fence (stupid minecraft) - blockUseSet.add((byte)116); //Enchantment Table - blockUseSet.add((byte)117); //Brewing Stand - blockUseSet.add((byte)130); //Ender Chest - blockUseSet.add((byte)145); //Anvil - blockUseSet.add((byte)146); //Trapped Chest - blockUseSet.add((byte)154); //Hopper - blockUseSet.add((byte)158); //Dropper - - blockUseSet.add((byte)184); //Fences/Gates - blockUseSet.add((byte)185); //Fences/Gates - blockUseSet.add((byte)186); //Fences/Gates - blockUseSet.add((byte)187); //Fences/Gates - blockUseSet.add((byte)188); //Fences/Gates - blockUseSet.add((byte)189); //Fences/Gates - blockUseSet.add((byte)190); //Fences/Gates - blockUseSet.add((byte)191); //Fences/Gates - blockUseSet.add((byte)192); //Fences/Gates - - blockUseSet.add((byte)193); //Wood Doors - blockUseSet.add((byte)194); //Wood Doors - blockUseSet.add((byte)195); //Wood Doors - blockUseSet.add((byte)196); //Wood Doors - blockUseSet.add((byte)197); //Wood Doors + blockAirFoliageSet.add((byte) Material.AIR.getId()); + blockAirFoliageSet.add((byte) Material.SAPLING.getId()); + blockAirFoliageSet.add((byte) Material.LONG_GRASS.getId()); + blockAirFoliageSet.add((byte) Material.DEAD_BUSH.getId()); + blockAirFoliageSet.add((byte) Material.YELLOW_FLOWER.getId()); + blockAirFoliageSet.add((byte) Material.RED_ROSE.getId()); + blockAirFoliageSet.add((byte) Material.BROWN_MUSHROOM.getId()); + blockAirFoliageSet.add((byte) Material.RED_MUSHROOM.getId()); + blockAirFoliageSet.add((byte) Material.FIRE.getId()); + blockAirFoliageSet.add((byte) Material.CROPS.getId()); + blockAirFoliageSet.add((byte) Material.PUMPKIN_STEM.getId()); + blockAirFoliageSet.add((byte) Material.MELON_STEM.getId()); + blockAirFoliageSet.add((byte) Material.NETHER_WARTS.getId()); + blockAirFoliageSet.add((byte) Material.TRIPWIRE_HOOK.getId()); + blockAirFoliageSet.add((byte) Material.TRIPWIRE.getId()); + blockAirFoliageSet.add((byte) Material.CARROT.getId()); + blockAirFoliageSet.add((byte) Material.POTATO.getId()); + blockAirFoliageSet.add((byte) Material.DOUBLE_PLANT.getId()); + blockAirFoliageSet.add((byte) Material.STANDING_BANNER.getId()); + blockAirFoliageSet.add((byte) Material.WALL_BANNER.getId()); + + blockPassSet.add((byte) Material.AIR.getId()); + blockPassSet.add((byte) Material.SAPLING.getId()); + blockPassSet.add((byte) Material.WATER.getId()); + blockPassSet.add((byte) Material.STATIONARY_WATER.getId()); + blockPassSet.add((byte) Material.LAVA.getId()); + blockPassSet.add((byte) Material.STATIONARY_LAVA.getId()); + blockPassSet.add((byte) Material.BED_BLOCK.getId()); + blockPassSet.add((byte) Material.POWERED_RAIL.getId()); + blockPassSet.add((byte) Material.DETECTOR_RAIL.getId()); + blockPassSet.add((byte) Material.WEB.getId()); + blockPassSet.add((byte) Material.LONG_GRASS.getId()); + blockPassSet.add((byte) Material.DEAD_BUSH.getId()); + blockPassSet.add((byte) Material.YELLOW_FLOWER.getId()); + blockPassSet.add((byte) Material.RED_ROSE.getId()); + blockPassSet.add((byte) Material.BROWN_MUSHROOM.getId()); + blockPassSet.add((byte) Material.RED_MUSHROOM.getId()); + blockPassSet.add((byte) Material.TORCH.getId()); + blockPassSet.add((byte) Material.FIRE.getId()); + blockPassSet.add((byte) Material.REDSTONE_WIRE.getId()); + blockPassSet.add((byte) Material.CROPS.getId()); + blockPassSet.add((byte) Material.SIGN_POST.getId()); + blockPassSet.add((byte) Material.WOODEN_DOOR.getId()); + blockPassSet.add((byte) Material.LADDER.getId()); + blockPassSet.add((byte) Material.RAILS.getId()); + blockPassSet.add((byte) Material.WALL_SIGN.getId()); + blockPassSet.add((byte) Material.LEVER.getId()); + blockPassSet.add((byte) Material.STONE_PLATE.getId()); + blockPassSet.add((byte) Material.IRON_DOOR_BLOCK.getId()); + blockPassSet.add((byte) Material.WOOD_PLATE.getId()); + blockPassSet.add((byte) Material.REDSTONE_TORCH_OFF.getId()); + blockPassSet.add((byte) Material.REDSTONE_TORCH_ON.getId()); + blockPassSet.add((byte) Material.STONE_BUTTON.getId()); + blockPassSet.add((byte) Material.SNOW.getId()); + blockPassSet.add((byte) Material.SUGAR_CANE_BLOCK.getId()); + blockPassSet.add((byte) Material.FENCE.getId()); + blockPassSet.add((byte) Material.PORTAL.getId()); + blockPassSet.add((byte) Material.CAKE_BLOCK.getId()); + blockPassSet.add((byte) Material.DIODE_BLOCK_OFF.getId()); + blockPassSet.add((byte) Material.DIODE_BLOCK_ON.getId()); + blockPassSet.add((byte) Material.TRAP_DOOR.getId()); + blockPassSet.add((byte) Material.IRON_FENCE.getId()); + blockPassSet.add((byte) Material.THIN_GLASS.getId()); + blockPassSet.add((byte) Material.PUMPKIN_STEM.getId()); + blockPassSet.add((byte) Material.MELON_STEM.getId()); + blockPassSet.add((byte) Material.VINE.getId()); + blockPassSet.add((byte) Material.FENCE_GATE.getId()); + blockPassSet.add((byte) Material.WATER_LILY.getId()); + blockPassSet.add((byte) Material.NETHER_WARTS.getId()); + blockPassSet.add((byte) Material.ENCHANTMENT_TABLE.getId()); + blockPassSet.add((byte) Material.BREWING_STAND.getId()); + blockPassSet.add((byte) Material.CAULDRON.getId()); + blockPassSet.add((byte) Material.ENDER_PORTAL.getId()); + blockPassSet.add((byte) Material.ENDER_PORTAL_FRAME.getId()); + blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR.getId()); + blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId()); + blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId()); + blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.getId()); + + blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId()); + blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId()); + blockPassSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId()); + blockPassSet.add((byte) Material.ACACIA_FENCE_GATE.getId()); + blockPassSet.add((byte) Material.SPRUCE_FENCE.getId()); + blockPassSet.add((byte) Material.BIRCH_FENCE.getId()); + blockPassSet.add((byte) Material.JUNGLE_FENCE.getId()); + blockPassSet.add((byte) Material.DARK_OAK_FENCE.getId()); + blockPassSet.add((byte) Material.ACACIA_FENCE.getId()); + + blockPassSet.add((byte) Material.SPRUCE_DOOR.getId()); + blockPassSet.add((byte) Material.BIRCH_DOOR.getId()); + blockPassSet.add((byte) Material.JUNGLE_DOOR.getId()); + blockPassSet.add((byte) Material.ACACIA_DOOR.getId()); + blockPassSet.add((byte) Material.DARK_OAK_DOOR.getId()); + + fullSolid.add((byte) Material.STONE.getId()); + fullSolid.add((byte) Material.GRASS.getId()); + fullSolid.add((byte) Material.DIRT.getId()); + fullSolid.add((byte) Material.COBBLESTONE.getId()); + fullSolid.add((byte) Material.WOOD.getId()); + fullSolid.add((byte) Material.BEDROCK.getId()); + fullSolid.add((byte) Material.SAND.getId()); + fullSolid.add((byte) Material.GRAVEL.getId()); + fullSolid.add((byte) Material.GOLD_ORE.getId()); + fullSolid.add((byte) Material.IRON_ORE.getId()); + fullSolid.add((byte) Material.COAL_ORE.getId()); + fullSolid.add((byte) Material.LOG.getId()); + fullSolid.add((byte) Material.LEAVES.getId()); + fullSolid.add((byte) Material.SPONGE.getId()); + fullSolid.add((byte) Material.GLASS.getId()); + fullSolid.add((byte) Material.LAPIS_ORE.getId()); + fullSolid.add((byte) Material.LAPIS_BLOCK.getId()); + fullSolid.add((byte) Material.DISPENSER.getId()); + fullSolid.add((byte) Material.SANDSTONE.getId()); + fullSolid.add((byte) Material.NOTE_BLOCK.getId()); + fullSolid.add((byte) Material.PISTON_STICKY_BASE.getId()); + fullSolid.add((byte) Material.PISTON_BASE.getId()); + fullSolid.add((byte) Material.WOOL.getId()); + fullSolid.add((byte) Material.GOLD_BLOCK.getId()); + fullSolid.add((byte) Material.IRON_BLOCK.getId()); + fullSolid.add((byte) Material.DOUBLE_STEP.getId()); + fullSolid.add((byte) Material.STEP.getId()); + fullSolid.add((byte) Material.BRICK.getId()); + fullSolid.add((byte) Material.TNT.getId()); + fullSolid.add((byte) Material.BOOKSHELF.getId()); + fullSolid.add((byte) Material.MOSSY_COBBLESTONE.getId()); + fullSolid.add((byte) Material.OBSIDIAN.getId()); + fullSolid.add((byte) Material.DIAMOND_ORE.getId()); + fullSolid.add((byte) Material.DIAMOND_BLOCK.getId()); + fullSolid.add((byte) Material.WORKBENCH.getId()); + fullSolid.add((byte) Material.SOIL.getId()); + fullSolid.add((byte) Material.FURNACE.getId()); + fullSolid.add((byte) Material.BURNING_FURNACE.getId()); + fullSolid.add((byte) Material.REDSTONE_ORE.getId()); + fullSolid.add((byte) Material.GLOWING_REDSTONE_ORE.getId()); + fullSolid.add((byte) Material.ICE.getId()); + fullSolid.add((byte) Material.SNOW_BLOCK.getId()); + fullSolid.add((byte) Material.CLAY.getId()); + fullSolid.add((byte) Material.JUKEBOX.getId()); + fullSolid.add((byte) Material.PUMPKIN.getId()); + fullSolid.add((byte) Material.NETHERRACK.getId()); + fullSolid.add((byte) Material.SOUL_SAND.getId()); + fullSolid.add((byte) Material.GLOWSTONE.getId()); + fullSolid.add((byte) Material.JACK_O_LANTERN.getId()); + fullSolid.add((byte) Material.STAINED_GLASS.getId()); + fullSolid.add((byte) Material.MONSTER_EGGS.getId()); + fullSolid.add((byte) Material.SMOOTH_BRICK.getId()); + fullSolid.add((byte) Material.HUGE_MUSHROOM_1.getId()); + fullSolid.add((byte) Material.HUGE_MUSHROOM_2.getId()); + fullSolid.add((byte) Material.MELON_BLOCK.getId()); + fullSolid.add((byte) Material.MYCEL.getId()); + fullSolid.add((byte) Material.NETHER_BRICK.getId()); + fullSolid.add((byte) Material.ENDER_STONE.getId()); + fullSolid.add((byte) Material.REDSTONE_LAMP_OFF.getId()); + fullSolid.add((byte) Material.REDSTONE_LAMP_ON.getId()); + fullSolid.add((byte) Material.WOOD_DOUBLE_STEP.getId()); + fullSolid.add((byte) Material.WOOD_STEP.getId()); + fullSolid.add((byte) Material.EMERALD_ORE.getId()); + fullSolid.add((byte) Material.EMERALD_BLOCK.getId()); + fullSolid.add((byte) Material.COMMAND.getId()); + fullSolid.add((byte) Material.BEACON.getId()); + fullSolid.add((byte) Material.REDSTONE_BLOCK.getId()); + fullSolid.add((byte) Material.QUARTZ_ORE.getId()); + fullSolid.add((byte) Material.QUARTZ_BLOCK.getId()); + fullSolid.add((byte) Material.DROPPER.getId()); + fullSolid.add((byte) Material.STAINED_CLAY.getId()); + fullSolid.add((byte) Material.LEAVES_2.getId()); + fullSolid.add((byte) Material.LOG_2.getId()); + fullSolid.add((byte) Material.PRISMARINE.getId()); + fullSolid.add((byte) Material.SEA_LANTERN.getId()); + fullSolid.add((byte) Material.HAY_BLOCK.getId()); + fullSolid.add((byte) Material.HARD_CLAY.getId()); + fullSolid.add((byte) Material.COAL_BLOCK.getId()); + fullSolid.add((byte) Material.PACKED_ICE.getId()); + fullSolid.add((byte) Material.RED_SANDSTONE.getId()); + fullSolid.add((byte) Material.DOUBLE_STONE_SLAB2.getId()); + + blockUseSet.add((byte) Material.DISPENSER.getId()); + blockUseSet.add((byte) Material.BED_BLOCK.getId()); + blockUseSet.add((byte) Material.PISTON_BASE.getId()); + blockUseSet.add((byte) Material.BOOKSHELF.getId()); + blockUseSet.add((byte) Material.CHEST.getId()); + blockUseSet.add((byte) Material.WORKBENCH.getId()); + blockUseSet.add((byte) Material.FURNACE.getId()); + blockUseSet.add((byte) Material.BURNING_FURNACE.getId()); + blockUseSet.add((byte) Material.WOODEN_DOOR.getId()); + blockUseSet.add((byte) Material.LEVER.getId()); + blockUseSet.add((byte) Material.IRON_DOOR_BLOCK.getId()); + blockUseSet.add((byte) Material.STONE_BUTTON.getId()); + blockUseSet.add((byte) Material.FENCE.getId()); + blockUseSet.add((byte) Material.DIODE_BLOCK_OFF.getId()); + blockUseSet.add((byte) Material.DIODE_BLOCK_ON.getId()); + blockUseSet.add((byte) Material.TRAP_DOOR.getId()); + blockUseSet.add((byte) Material.FENCE_GATE.getId()); + blockUseSet.add((byte) Material.NETHER_FENCE.getId()); + blockUseSet.add((byte) Material.ENCHANTMENT_TABLE.getId()); + blockUseSet.add((byte) Material.BREWING_STAND.getId()); + blockUseSet.add((byte) Material.ENDER_CHEST.getId()); + blockUseSet.add((byte) Material.ANVIL.getId()); + blockUseSet.add((byte) Material.TRAPPED_CHEST.getId()); + blockUseSet.add((byte) Material.HOPPER.getId()); + blockUseSet.add((byte) Material.DROPPER.getId()); + + blockUseSet.add((byte) Material.BIRCH_FENCE_GATE.getId()); + blockUseSet.add((byte) Material.JUNGLE_FENCE_GATE.getId()); + blockUseSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId()); + blockUseSet.add((byte) Material.ACACIA_FENCE_GATE.getId()); + blockUseSet.add((byte) Material.SPRUCE_FENCE.getId()); + blockUseSet.add((byte) Material.BIRCH_FENCE.getId()); + blockUseSet.add((byte) Material.JUNGLE_FENCE.getId()); + blockUseSet.add((byte) Material.DARK_OAK_FENCE.getId()); + blockUseSet.add((byte) Material.ACACIA_FENCE.getId()); + + blockUseSet.add((byte) Material.SPRUCE_DOOR.getId()); + blockUseSet.add((byte) Material.BIRCH_DOOR.getId()); + blockUseSet.add((byte) Material.JUNGLE_DOOR.getId()); + blockUseSet.add((byte) Material.ACACIA_DOOR.getId()); + blockUseSet.add((byte) Material.DARK_OAK_DOOR.getId()); } public static boolean solid(Block block) @@ -451,8 +489,9 @@ public class UtilBlock if (block.getType() != Material.AIR) { - float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(block.getX(), block.getY(), - block.getZ())).a((net.minecraft.server.v1_7_R4.Entity) null); + Blocks.DIRT.a((net.minecraft.server.v1_8_R3.Entity) null); + float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(new BlockPosition(block.getX(), block.getY(), + block.getZ())).getBlock()).a((net.minecraft.server.v1_8_R3.Entity) null); f1 -= (f3 + 0.3F) * f2; } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 1cc2d5416..8587871ee 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -5,22 +5,23 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import net.minecraft.server.v1_7_R4.AxisAlignedBB; -import net.minecraft.server.v1_7_R4.EntityBat; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.EntityEnderDragon; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.EntityInsentient; -import net.minecraft.server.v1_7_R4.EntityLiving; -import net.minecraft.server.v1_7_R4.EntityTrackerEntry; -import net.minecraft.server.v1_7_R4.Navigation; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_7_R4.PathfinderGoal; -import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer; -import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction; -import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround; -import net.minecraft.server.v1_7_R4.PathfinderGoalSelector; -import net.minecraft.server.v1_7_R4.WorldServer; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; +import net.minecraft.server.v1_8_R3.EntityBat; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityEnderDragon; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityLiving; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.NavigationAbstract; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_8_R3.PathfinderGoal; +import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction; +import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -28,10 +29,11 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -60,31 +62,29 @@ public class UtilEnt public static void silence(Entity entity, boolean silence) { - ((CraftEntity)entity).getHandle().Silent = silence; + ((CraftEntity)entity).getHandle().setSilent(silence); } public static void ghost(Entity entity, boolean ghost, boolean invisible) { if (entity instanceof LivingEntity) { - ((CraftLivingEntity)entity).getHandle().ghost = ghost; + ((CraftLivingEntity)entity).getHandle().setGhost(ghost); } - ((CraftEntity)entity).getHandle().Invisible = invisible; +// ((CraftEntity)entity).getHandle().Invisible = invisible; ((CraftEntity)entity).getHandle().setInvisible(invisible); } public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable) { - if (((CraftEntity)leashed).getHandle() instanceof EntityInsentient) - { - EntityInsentient creature = (EntityInsentient)((CraftEntity)leashed).getHandle(); - - creature.PullWhileLeashed = pull; - creature.BreakLeash = breakable; - } - leashed.setLeashHolder(holder); + + if (!(((CraftLivingEntity)leashed).getHandle() instanceof EntityInsentient)) + return; + + ((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setPullWhileLeashed(pull); + ((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setShouldBreakLeash(breakable); } public static void addLookAtPlayerAI(Entity entity, float dist) @@ -132,7 +132,7 @@ public class UtilEnt { Vegetate(entity, false); } - + public static void Vegetate(Entity entity, boolean mute) { try @@ -167,7 +167,7 @@ public class UtilEnt if (_bsRestrictionGoal == null) { - _bsRestrictionGoal = EntityCreature.class.getDeclaredField("bs"); + _bsRestrictionGoal = EntityCreature.class.getDeclaredField("c"); _bsRestrictionGoal.setAccessible(true); } @@ -178,10 +178,10 @@ public class UtilEnt { EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle(); - creature.Vegetated = true; - creature.Silent = mute; - - ((List)_pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear(); + creature.setVegetated(true); + creature.setSilent(mute); + + ((List) _pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear(); ((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear(); ((List)_pathfinderBList.get(((PathfinderGoalSelector)_targetSelector.get(creature)))).clear(); @@ -190,14 +190,14 @@ public class UtilEnt if (((CraftEntity)entity).getHandle() instanceof EntityBat) { - ((EntityBat)((CraftEntity)entity).getHandle()).Vegetated = true; + ((EntityBat)((CraftEntity)entity).getHandle()).setVegetated(true); } if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon) { EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle(); - creature.Vegetated = true; + creature.setVegetated(true); } } catch (IllegalArgumentException e) @@ -217,7 +217,7 @@ public class UtilEnt e.printStackTrace(); } } - + public static void removeGoalSelectors(Entity entity) { try @@ -435,10 +435,23 @@ public class UtilEnt LivingEntity ent = (LivingEntity)cur; + //Feet double offset = UtilMath.offset(loc, ent.getLocation()); if (offset < dR) + { ents.put(ent, 1 - (offset/dR)); + continue; + } + + //Eyes + offset = UtilMath.offset(loc, ent.getEyeLocation()); + + if (offset < dR) + { + ents.put(ent, 1 - (offset/dR)); + continue; + } } return ents; @@ -496,7 +509,7 @@ public class UtilEnt public static boolean isGrounded(Entity ent) { - AxisAlignedBB box = ((CraftEntity)ent).getHandle().boundingBox; + AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox(); Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c); Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f); @@ -603,24 +616,57 @@ public class UtilEnt return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec)); } + public static void setFakeHead(Entity ent, boolean fakeHead) + { + net.minecraft.server.v1_8_R3.Entity ec = ((CraftEntity) ent).getHandle(); + + ec.setFakeHead(fakeHead); + } + + public static void CreatureForceLook(Entity ent, float pitch, float yaw) + { + net.minecraft.server.v1_8_R3.Entity ec = ((CraftEntity) ent).getHandle(); + + ec.setFakeHead(true); + + ec.fakePitch = pitch; + ec.fakeYaw = yaw; + } + public static boolean CreatureLook(Entity ent, float pitch, float yaw) { if (!(ent instanceof LivingEntity)) return false; EntityLiving ec = ((CraftLivingEntity) ent).getHandle(); - Location loc = ent.getLocation(); - ec.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), yaw, pitch); - ec.al = true; + ec.yaw = yaw; + ec.pitch = pitch; + ec.aK = yaw; + ec.fakePitch = pitch; + ec.fakeYaw = yaw; - EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.world).tracker.trackedEntities.get(ec.getId()); + EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.getWorld()).tracker.trackedEntities.get(ec.getId()); - entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, (byte) (ec.yaw * 256.0F / 360.0F))); + byte ya = (byte) (yaw * 256.0F / 360.0F); + byte pi = (byte) (pitch * 256.0F / 360.0F); + + entry.yRot = ya; + entry.xRot = pi; + entry.i = ya; + + // Looks like both packets need to be sent. EntityLook packet for body yaw and head pitch. Head rotation for head yaw. + entry.broadcast(new PacketPlayOutEntity.PacketPlayOutEntityLook(ent.getEntityId(), ya, pi, ec.onGround)); + entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, ya)); return true; } + public static boolean CreatureLook(Entity ent, float yaw) + { + return CreatureLook(ent, 0, yaw); + } + public static void CreatureMove(Entity ent, Location target, float speed) { if (!(ent instanceof Creature)) @@ -628,9 +674,9 @@ public class UtilEnt if (UtilMath.offset(ent.getLocation(), target) < 0.1) return; - + EntityCreature ec = ((CraftCreature)ent).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); if (UtilMath.offset(ent.getLocation(), target) > 16) { @@ -682,7 +728,7 @@ public class UtilEnt { try { - Field field = net.minecraft.server.v1_7_R4.Entity.class.getDeclaredField("entityCount"); + Field field = net.minecraft.server.v1_8_R3.Entity.class.getDeclaredField("entityCount"); field.setAccessible(true); int entityId = field.getInt(null); if (modifynumber) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java index c07b7b3b4..c017bab66 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java @@ -1,14 +1,14 @@ package mineplex.core.common.util; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework; import org.bukkit.entity.Firework; import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; @@ -18,9 +18,9 @@ public class UtilFirework { public static void playFirework(Location loc, FireworkEffect fe) { - Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class); + Firework firework = loc.getWorld().spawn(loc, Firework.class); - FireworkMeta data = (FireworkMeta) firework.getFireworkMeta(); + FireworkMeta data = firework.getFireworkMeta(); data.clearEffects(); data.setPower(1); data.addEffect(fe); @@ -35,9 +35,9 @@ public class UtilFirework { try { - Firework fw = (Firework) loc.getWorld().spawn(loc, Firework.class); + Firework fw = loc.getWorld().spawn(loc, Firework.class); - FireworkMeta data = (FireworkMeta) fw.getFireworkMeta(); + FireworkMeta data = fw.getFireworkMeta(); data.clearEffects(); data.setPower(power); data.addEffect(fe); @@ -59,7 +59,6 @@ public class UtilFirework public void detonateFirework(Firework firework) { ((CraftWorld)firework.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17); - firework.remove(); } @@ -85,9 +84,12 @@ public class UtilFirework firework.setFireworkMeta(data); ((CraftFirework) firework).getHandle().expectedLifespan = 1; - - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId()); - + + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[] + { + firework.getEntityId() + }); + for (Player viewing : UtilServer.getPlayers()) { if (player == viewing) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index bc6443777..1b1b5b775 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -12,6 +12,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -70,13 +71,13 @@ public class UtilInv public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required) { - return contains(player, itemNameContains, item, data, required, true, true); + return contains(player, itemNameContains, item, data, required, true, true, true); } - public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required, boolean checkArmor, boolean checkCursor) + public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required, boolean checkArmor, boolean checkCursor, boolean checkCrafting) { - for (ItemStack stack : getItems(player, checkArmor, checkCursor)) + for (ItemStack stack : getItems(player, checkArmor, checkCursor, checkCrafting)) { if (required <= 0) { @@ -154,18 +155,25 @@ public class UtilInv PlayerInventory inv = player.getInventory(); inv.clear(); - inv.setArmorContents(new ItemStack[4]); - player.setItemOnCursor(new ItemStack(Material.AIR)); - + inv.setArmorContents(new ItemStack[4]); + player.setItemOnCursor(new ItemStack(Material.AIR)); + + Inventory openInventory = player.getOpenInventory().getTopInventory(); + + if (openInventory.getHolder() == player) + { + openInventory.clear(); + } + player.saveData(); } public static ArrayList getItems(Player player) { - return getItems(player, true, true); + return getItems(player, true, true, true); } - public static ArrayList getItems(Player player, boolean getArmor, boolean getCursor) + public static ArrayList getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting) { ArrayList items = new ArrayList(); PlayerInventory inv = player.getInventory(); @@ -197,6 +205,22 @@ public class UtilInv items.add(cursorItem.clone()); } + if (getCrafting) + { + Inventory openInventory = player.getOpenInventory().getTopInventory(); + + if (openInventory.getHolder() == player && openInventory.getType() == InventoryType.CRAFTING) + { + for (ItemStack item : openInventory.getContents()) + { + if (item != null && item.getType() != Material.AIR) + { + items.add(item.clone()); + } + } + } + } + return items; } @@ -357,11 +381,12 @@ public class UtilInv return getAmount(player, mat, true); } - public static int getAmount(Player player, Material mat, boolean includeArmorAndCursor) + public static int getAmount(Player player, Material mat, boolean includeArmorAndCursorAndCrafting) { int amount = 0; - - for (ItemStack item : getItems(player, true, true)) + + for (ItemStack item : getItems(player, includeArmorAndCursorAndCrafting, includeArmorAndCursorAndCrafting, + includeArmorAndCursorAndCrafting)) { if (item.getType() == mat) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index 33d33f950..ec6587bcf 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -3,7 +3,8 @@ package mineplex.core.common.util; import java.lang.reflect.Field; import mineplex.core.common.util.UtilParticle.ViewDist; -import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles; +import net.minecraft.server.v1_8_R3.EnumParticle; +import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles; import org.bukkit.Location; import org.bukkit.Material; @@ -13,30 +14,26 @@ public class UtilParticle { public enum ViewDist { - SHORT(8), - NORMAL(24), - LONG(48), - LONGER(96), - MAX(256); - + SHORT(8), NORMAL(24), LONG(48), LONGER(96), MAX(256); + private int _dist; - + ViewDist(int dist) { _dist = dist; } - + public int getDist() { return _dist; } } - + public enum ParticleType { - ANGRY_VILLAGER("angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11), + ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY, "angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11), - BLOCK_CRACK("blockcrack_1_0") + BLOCK_CRACK(EnumParticle.BLOCK_CRACK, "blockcrack") { @Override public String getParticle(Material type, int data) @@ -45,7 +42,7 @@ public class UtilParticle } }, - BLOCK_DUST("blockdust_1_0") + BLOCK_DUST(EnumParticle.BLOCK_DUST, "blockdust") { @Override public String getParticle(Material type, int data) @@ -54,37 +51,37 @@ public class UtilParticle } }, - BUBBLE("bubble"), + BUBBLE(EnumParticle.WATER_BUBBLE, "bubble"), - CLOUD("cloud", "White Smoke", Material.INK_SACK, (byte) 7), + CLOUD(EnumParticle.CLOUD, "cloud", "White Smoke", Material.INK_SACK, (byte) 7), - CRIT("crit", "Brown Magic", Material.INK_SACK, (byte) 14), + CRIT(EnumParticle.CRIT, "crit", "Brown Magic", Material.INK_SACK, (byte) 14), - DEPTH_SUSPEND("depthSuspend"), + DEPTH_SUSPEND(EnumParticle.SUSPENDED_DEPTH, "depthSuspend"), - DRIP_LAVA("dripLava", "Lava Drip", Material.LAVA_BUCKET, (byte) 0), + DRIP_LAVA(EnumParticle.DRIP_LAVA, "dripLava", "Lava Drip", Material.LAVA_BUCKET, (byte) 0), - DRIP_WATER("dripWater", "Water Drop", Material.WATER_BUCKET, (byte) 0), + DRIP_WATER(EnumParticle.DRIP_WATER, "dripWater", "Water Drop", Material.WATER_BUCKET, (byte) 0), - DROPLET("droplet", "Water Splash", Material.INK_SACK, (byte) 4), + DROPLET(EnumParticle.WATER_DROP, "droplet", "Water Splash", Material.INK_SACK, (byte) 4), - ENCHANTMENT_TABLE("enchantmenttable", "Enchantment Words", Material.BOOK, (byte) 0), + ENCHANTMENT_TABLE(EnumParticle.ENCHANTMENT_TABLE, "enchantmenttable", "Enchantment Words", Material.BOOK, (byte) 0), - EXPLODE("explode", "Big White Smoke", Material.INK_SACK, (byte) 15), + EXPLODE(EnumParticle.EXPLOSION_NORMAL, "explode", "Big White Smoke", Material.INK_SACK, (byte) 15), - FIREWORKS_SPARK("fireworksSpark", "White Sparkle", Material.GHAST_TEAR, (byte) 0), + FIREWORKS_SPARK(EnumParticle.FIREWORKS_SPARK, "fireworksSpark", "White Sparkle", Material.GHAST_TEAR, (byte) 0), - FLAME("flame", "Flame", Material.BLAZE_POWDER, (byte) 0), + FLAME(EnumParticle.FLAME, "flame", "Flame", Material.BLAZE_POWDER, (byte) 0), - FOOTSTEP("footstep", "Foot Step", Material.LEATHER_BOOTS, (byte) 0), + FOOTSTEP(EnumParticle.FOOTSTEP, "footstep", "Foot Step", Material.LEATHER_BOOTS, (byte) 0), - HAPPY_VILLAGER("happyVillager", "Emerald Sparkle", Material.EMERALD, (byte) 0), + HAPPY_VILLAGER(EnumParticle.VILLAGER_HAPPY, "happyVillager", "Emerald Sparkle", Material.EMERALD, (byte) 0), - HEART("heart", "Love Heart", Material.APPLE, (byte) 0), + HEART(EnumParticle.HEART, "heart", "Love Heart", Material.APPLE, (byte) 0), - HUGE_EXPLOSION("hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0), + HUGE_EXPLOSION(EnumParticle.EXPLOSION_HUGE, "hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0), - ICON_CRACK("iconcrack_1_0") + ICON_CRACK(EnumParticle.ITEM_CRACK, "iconcrack") { @Override public String getParticle(Material type, int data) @@ -93,66 +90,84 @@ public class UtilParticle } }, - INSTANT_SPELL("instantSpell"), + INSTANT_SPELL(EnumParticle.SPELL_INSTANT, "instantSpell"), - LARGE_EXPLODE("largeexplode", "Explosion", Material.FIREBALL, (byte) 0), + LARGE_EXPLODE(EnumParticle.EXPLOSION_LARGE, "largeexplode", "Explosion", Material.FIREBALL, (byte) 0), - LARGE_SMOKE("largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0), + LARGE_SMOKE(EnumParticle.SMOKE_LARGE, "largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0), - LAVA("lava", "Lava Debris", Material.LAVA, (byte) 0), + SMOKE(EnumParticle.SMOKE_NORMAL, "smoke", "Smoke", Material.INK_SACK, (byte) 0), - MAGIC_CRIT("magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6), + LAVA(EnumParticle.LAVA, "lava", "Lava Debris", Material.LAVA, (byte) 0), + + MAGIC_CRIT(EnumParticle.CRIT_MAGIC, "magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6), /** * Can be colored if count is 0, color is RGB and depends on the offset of xyz */ - MOB_SPELL("mobSpell", "Black Swirls", Material.getMaterial(2263), (byte) 0), + MOB_SPELL(EnumParticle.SPELL_MOB, "mobSpell", "Black Swirls", Material.getMaterial(2263), (byte) 0), /** * Can be colored if count is 0, color is RGB and depends on the offset of xyz */ - MOB_SPELL_AMBIENT("mobSpellAmbient", "Transparent Black Swirls", Material.getMaterial(2266), (byte) 0), - - NOTE("note", "Musical Note", Material.JUKEBOX, (byte) 0), - - PORTAL("portal", "Portal Effect", Material.INK_SACK, (byte) 5), + MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT, "mobSpellAmbient", "Transparent Black Swirls", Material + .getMaterial(2266), (byte) 0), /** - * Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter by making it 0.0001 + * To do certain colors, use "no / 24F" for the random X value, 1 for speed. 0 for count. + */ + NOTE(EnumParticle.NOTE, "note", "Musical Note", Material.JUKEBOX, (byte) 0), + + PORTAL(EnumParticle.PORTAL, "portal", "Portal Effect", Material.INK_SACK, (byte) 5), + + /** + * Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter + * by making it 0.0001 */ - RED_DUST("reddust", "Red Smoke", Material.INK_SACK, (byte) 1), + RED_DUST(EnumParticle.REDSTONE, "reddust", "Red Smoke", Material.INK_SACK, (byte) 1), - SLIME("slime", "Slime Particles", Material.SLIME_BALL, (byte) 0), + SLIME(EnumParticle.SLIME, "slime", "Slime Particles", Material.SLIME_BALL, (byte) 0), - SNOW_SHOVEL("snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0), + SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL, "snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0), - SNOWBALL_POOF("snowballpoof"), + SNOWBALL_POOF(EnumParticle.SNOWBALL, "snowballpoof"), - SPELL("spell", "White Swirls", Material.getMaterial(2264), (byte) 0), + SPELL(EnumParticle.SPELL, "spell", "White Swirls", Material.getMaterial(2264), (byte) 0), - SPLASH("splash"), + SPLASH(EnumParticle.WATER_SPLASH, "splash"), - SUSPEND("suspended"), + SUSPEND(EnumParticle.SUSPENDED, "suspended"), - TOWN_AURA("townaura", "Black Specks", Material.COAL, (byte) 0), + TOWN_AURA(EnumParticle.TOWN_AURA, "townaura", "Black Specks", Material.COAL, (byte) 0), - WITCH_MAGIC("witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13); + WITCH_MAGIC(EnumParticle.SPELL_WITCH, "witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13), + MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE, "mobappearance"), + + BARRIER(EnumParticle.BARRIER, "barrier"), + + ITEM_TAKE(EnumParticle.ITEM_TAKE, "take"), + + WATER_WAKE(EnumParticle.WATER_WAKE, "wake"); + + public EnumParticle particle; public String particleName; private boolean _friendlyData; private String _friendlyName; private Material _material; private byte _data; - ParticleType(String particleName) + ParticleType(EnumParticle particle, String particleName) { this.particleName = particleName; _friendlyData = false; + this.particle = particle; } - ParticleType(String particleName, String friendlyName, Material material, byte data) + ParticleType(EnumParticle particle, String particleName, String friendlyName, Material material, byte data) { this.particleName = particleName; + this.particle = particle; _friendlyData = true; _friendlyName = friendlyName; _material = material; @@ -173,9 +188,9 @@ public class UtilParticle { if (_friendlyName == null) { - return toString(); + return toString(); } - + return _friendlyName; } @@ -203,28 +218,48 @@ public class UtilParticle private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, boolean displayFar) { + String[] parts = particleName.split("_"); + int[] details = new int[parts.length - 1]; + + for (int i = 0; i < details.length; i++) + { + details[i] = Integer.parseInt(parts[i + 1]); + } + + ParticleType particleType = ParticleType.CRIT; + + for (ParticleType type : ParticleType.values()) + { + if (type.particleName.equalsIgnoreCase(parts[0])) + { + particleType = type; + } + } + + PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleType.particle, displayFar, + (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, + count, details); - PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleName, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, count, displayFar); return packet; } - public static void PlayParticle(ParticleType type,Location location, float offsetX, float offsetY, float offsetZ, - float speed, int count, ViewDist dist, Player... players) + public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, + float speed, int count, ViewDist dist, Player... players) { PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players); } - public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ, - float speed, int count, ViewDist dist, Player... players) + public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ, float speed, + int count, ViewDist dist, Player... players) { PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true); for (Player player : players) { - //Out of range for player + // Out of range for player if (UtilMath.offset(player.getLocation(), location) > dist.getDist()) continue; - + UtilPlayer.sendPacket(player, packet); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index f9c997146..7b1b49599 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -6,16 +6,16 @@ import java.util.LinkedList; import java.util.List; import java.util.UUID; -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PlayerConnection; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PlayerConnection; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -590,17 +590,15 @@ public class UtilPlayer return (((CraftEntity) player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0; } - public static boolean is1_8(Player player) - { - return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() >= 47; - } - public static void sendPacket(Player player, Packet... packets) { PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; for (Packet packet : packets) { + if (packet == null) + continue; + connection.sendPacket(packet); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java index cb565d42b..38f242ce1 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTabTitle.java @@ -1,192 +1,193 @@ package mineplex.core.common.util; -import net.minecraft.server.v1_7_R4.ChatSerializer; -import net.minecraft.server.v1_7_R4.IChatBaseComponent; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.spigotmc.ProtocolInjector; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R3.IChatBaseComponent; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; + public class UtilTabTitle { - private static final int PROTOCOL_VERSION = 47; - - public static void broadcastHeader(String header) - { - broadcastHeaderAndFooter(header, null); - } + public static void broadcastHeader(String header) + { + broadcastHeaderAndFooter(header, null); + } - public static void broadcastFooter(String footer) - { - broadcastHeaderAndFooter(null, footer); - } + public static void broadcastFooter(String footer) + { + broadcastHeaderAndFooter(null, footer); + } - public static void broadcastHeaderAndFooter(String header, String footer) - { - for (Player player : Bukkit.getOnlinePlayers()) - doHeaderAndFooter(player, header, footer); - } - - public static void setHeaderAndFooter(Player player, String header, String footer) - { - doHeaderAndFooter(player, header, footer); - } + public static void broadcastHeaderAndFooter(String header, String footer) + { + for (Player player : Bukkit.getOnlinePlayers()) + doHeaderAndFooter(player, header, footer); + } - public static void setHeader(Player p, String header) - { - doHeaderAndFooter(p, header, null); - } + public static void setHeaderAndFooter(Player player, String header, String footer) + { + doHeaderAndFooter(player, header, footer); + } + + public static void setHeader(Player p, String header) + { + doHeaderAndFooter(p, header, null); + } - public static void setFooter(Player p, String footer) - { - doHeaderAndFooter(p, null, footer); - } + public static void setFooter(Player p, String footer) + { + doHeaderAndFooter(p, null, footer); + } - public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter) - { - CraftPlayer player = (CraftPlayer) p; - if (player.getHandle().playerConnection.networkManager.getVersion() != PROTOCOL_VERSION) return; - IChatBaseComponent header = ChatSerializer.a(TextConverter.convert(rawHeader)); - IChatBaseComponent footer = ChatSerializer.a(TextConverter.convert(rawFooter)); - if (header == null || footer == null) - { - TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId()); - if (titleCache != null) - { - if (header == null) - { - String headerString = titleCache.getHeader(); - if (headerString != null) - { - rawHeader = headerString; - header = ChatSerializer.a(TextConverter.convert(headerString)); - } - } - if (footer == null) - { - String footerString = titleCache.getFooter(); - if (footerString != null) - { - rawHeader = footerString; - header = ChatSerializer.a(TextConverter.convert(footerString)); - } - } - } - } - TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter)); - ProtocolInjector.PacketTabHeader packet = new ProtocolInjector.PacketTabHeader(header, footer); - player.getHandle().playerConnection.sendPacket(packet); - } - - private static class TextConverter - { - public static String convert(String text) - { - if (text == null || text.length() == 0) - { - return "\"\""; - } - - char c; - int i; - int len = text.length(); - StringBuilder sb = new StringBuilder(len + 4); - String t; - sb.append('"'); - - for (i = 0; i < len; i += 1) - { - c = text.charAt(i); - switch (c) - { - case '\\': - case '"': - sb.append('\\'); - sb.append(c); - break; - case '/': - sb.append('\\'); - sb.append(c); - break; - case '\b': - sb.append("\\b"); - break; - case '\t': - sb.append("\\t"); - break; - case '\n': - sb.append("\\n"); - break; - case '\f': - sb.append("\\f"); - break; - case '\r': - sb.append("\\r"); - break; - default: - if (c < ' ') - { - t = "000" + Integer.toHexString(c); - sb.append("\\u").append(t.substring(t.length() - 4)); - } - else - { - sb.append(c); - } - } - } - sb.append('"'); - return sb.toString(); - } - - public static String setPlayerName(Player player, String text) - { - return text.replaceAll("(?i)\\{PLAYER\\}", player.getName()); - } - } - - private static class TabTitleCache - { - final private static Map playerTabTitles = new HashMap<>(); - private String header; - private String footer; - - public TabTitleCache(String header, String footer) - { - this.header = header; - this.footer = footer; - } - - public static TabTitleCache getTabTitle(UUID uuid) - { - return playerTabTitles.get(uuid); - } - - public static void addTabTitle(UUID uuid, TabTitleCache titleCache) - { - playerTabTitles.put(uuid, titleCache); - } - - public static void removeTabTitle(UUID uuid) - { - playerTabTitles.remove(uuid); - } - - public String getHeader() - { - return header; - } - - public String getFooter() - { - return footer; - } - } + public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter) + { + IChatBaseComponent header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawHeader)); + IChatBaseComponent footer = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawFooter)); + if (header == null || footer == null) + { + TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId()); + if (titleCache != null) + { + if (header == null) + { + String headerString = titleCache.getHeader(); + if (headerString != null) + { + rawHeader = headerString; + header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(headerString)); + } + } + if (footer == null) + { + String footerString = titleCache.getFooter(); + if (footerString != null) + { + rawHeader = footerString; + header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(footerString)); + } + } + } + } + + TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter)); + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + packet.a = header; + packet.b = footer; + UtilPlayer.sendPacket(p, packet); + } + + private static class TextConverter + { + public static String convert(String text) + { + if (text == null || text.length() == 0) + { + return "\"\""; + } + + char c; + int i; + int len = text.length(); + StringBuilder sb = new StringBuilder(len + 4); + String t; + sb.append('"'); + + for (i = 0; i < len; i += 1) + { + c = text.charAt(i); + switch (c) + { + case '\\': + case '"': + sb.append('\\'); + sb.append(c); + break; + case '/': + sb.append('\\'); + sb.append(c); + break; + case '\b': + sb.append("\\b"); + break; + case '\t': + sb.append("\\t"); + break; + case '\n': + sb.append("\\n"); + break; + case '\f': + sb.append("\\f"); + break; + case '\r': + sb.append("\\r"); + break; + default: + if (c < ' ') + { + t = "000" + Integer.toHexString(c); + sb.append("\\u").append(t.substring(t.length() - 4)); + } + else + { + sb.append(c); + } + } + } + sb.append('"'); + return sb.toString(); + } + + public static String setPlayerName(Player player, String text) + { + return text.replaceAll("(?i)\\{PLAYER\\}", player.getName()); + } + } + + private static class TabTitleCache + { + final private static Map playerTabTitles = new HashMap<>(); + private String header; + private String footer; + + public TabTitleCache(String header, String footer) + { + this.header = header; + this.footer = footer; + } + + public static TabTitleCache getTabTitle(UUID uuid) + { + return playerTabTitles.get(uuid); + } + + public static void addTabTitle(UUID uuid, TabTitleCache titleCache) + { + playerTabTitles.put(uuid, titleCache); + } + + public static void removeTabTitle(UUID uuid) + { + playerTabTitles.remove(uuid); + } + + public String getHeader() + { + return header; + } + + public String getFooter() + { + return footer; + } + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java index 56e4f6770..98ebb1805 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java @@ -14,15 +14,6 @@ public class UtilTextBottom //1.8 msg.send(MessageType.ABOVE_HOTBAR, players); - - //1.7 Players - for (Player player : players) - { - if (!UtilPlayer.is1_8(player)) - { - UtilTextTop.display(text, player); - } - } } public static void displayProgress(double amount, Player... players) @@ -59,21 +50,7 @@ public class UtilTextBottom progressBar += "▌"; } - - //Send to Player - for (Player player : players) - { - //1.7 - Add Color - if (!UtilPlayer.is1_8(player)) - { - UtilTextTop.displayProgress((prefix == null ? "" : C.cYellow + C.Bold + prefix) + (suffix == null ? "" : ChatColor.RESET + C.Bold + " - " + C.cGreen + C.Bold + suffix), - amount, player); - } - //1.8 - else - { - display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); - } - } + + display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java index 6962a970b..11b15bd21 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextMiddle.java @@ -1,12 +1,11 @@ package mineplex.core.common.util; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.minecraft.server.v1_7_R4.ChatMessage; - -import org.spigotmc.ProtocolInjector.PacketTitle; -import org.spigotmc.ProtocolInjector.PacketTitle.Action; +import net.minecraft.server.v1_8_R3.ChatMessage; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; /** * Created by Shaun on 9/5/2014. @@ -52,7 +51,7 @@ public class UtilTextMiddle text = ""; ChatMessage message = new ChatMessage(text); - PacketTitle packet = new PacketTitle(Action.TITLE, message); + PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, message); sendPacket(packet, players); } @@ -67,7 +66,7 @@ public class UtilTextMiddle text = ""; ChatMessage message = new ChatMessage(text); - PacketTitle packet = new PacketTitle(Action.SUBTITLE, message); + PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, message); sendPacket(packet, players); } @@ -78,7 +77,7 @@ public class UtilTextMiddle */ private static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players) { - PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks); + PacketPlayOutTitle packet = new PacketPlayOutTitle(fadeInTicks, stayTicks, fadeOutTicks); sendPacket(packet, players); } @@ -87,7 +86,7 @@ public class UtilTextMiddle */ public static void clear(Player... players) { - PacketTitle packet = new PacketTitle(Action.CLEAR); + PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, null); sendPacket(packet, players); } @@ -98,18 +97,15 @@ public class UtilTextMiddle */ public static void reset(Player... players) { - PacketTitle packet = new PacketTitle(Action.RESET); + PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, null); sendPacket(packet, players); } - private static void sendPacket(PacketTitle packet, Player... players) + private static void sendPacket(Packet packet, Player... players) { for (Player player : players) { - if (UtilPlayer.is1_8(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } + UtilPlayer.sendPacket(player, packet); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java index 3429468bb..93595a1c4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextTop.java @@ -1,16 +1,16 @@ package mineplex.core.common.util; import mineplex.core.common.DummyEntity; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -38,23 +38,19 @@ public class UtilTextTop deleteOld(player); healthPercent = Math.min(1, healthPercent); - boolean halfHealth = UtilPlayer.is1_8(player); //Display Dragon { Location loc = player.getLocation().subtract(0, 200, 0); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(getDragonPacket(text, healthPercent, halfHealth, loc)); + UtilPlayer.sendPacket(player, getDragonPacket(text, healthPercent, loc)); } //Display Wither (as well as Dragon) - if (UtilPlayer.is1_8(player)) - { - Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24)); - - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(getWitherPacket(text, healthPercent, halfHealth, loc)); - } + Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24)); + + UtilPlayer.sendPacket(player, getWitherPacket(text, healthPercent, loc)); //Remove Bukkit.getServer().getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugins()[0], new Runnable() @@ -68,19 +64,22 @@ public class UtilTextTop private static void deleteOld(Player player) { - //Delete Dragon (All Clients) - PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(EntityDragonId); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyDragonPacket); - - //Delete Wither (1.8+ Only) - if (UtilPlayer.is1_8(player)) - { - PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(EntityWitherId); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyWitherPacket); - } + // Delete Dragon (All Clients) + PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(new int[] + { + EntityDragonId + }); + UtilPlayer.sendPacket(player, destroyDragonPacket); + + // Delete Wither (1.8+ Only) + PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(new int[] + { + EntityWitherId + }); + UtilPlayer.sendPacket(player, destroyWitherPacket); } - public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, boolean halfHealth, Location loc) + public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, Location loc) { PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving(); @@ -108,7 +107,7 @@ public class UtilTextTop return mobPacket; } - public static PacketPlayOutSpawnEntityLiving getWitherPacket(String text, double healthPercent, boolean halfHealth, Location loc) + public static PacketPlayOutSpawnEntityLiving getWitherPacket(String text, double healthPercent, Location loc) { PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving(); @@ -143,13 +142,11 @@ public class UtilTextTop watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible watcher.a(6, (Float) (float) health); watcher.a(2, (String) text); //Entity name - watcher.a(10, (String) text); //Entity name watcher.a(3, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show - watcher.a(11, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show watcher.a(16, (Integer) (int) health); //Health watcher.a(20, (Integer) (int) 881); //Inv - int i1 = watcher.getInt(0); + int i1 = watcher.getByte(0); watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5))); return watcher; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java index 8df6595b3..a44812674 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java @@ -2,133 +2,148 @@ package mineplex.core.common.util; import java.io.File; -import net.minecraft.server.v1_7_R4.ConvertProgressUpdater; -import net.minecraft.server.v1_7_R4.Convertable; -import net.minecraft.server.v1_7_R4.EntityTracker; -import net.minecraft.server.v1_7_R4.EnumDifficulty; -import net.minecraft.server.v1_7_R4.EnumGamemode; -import net.minecraft.server.v1_7_R4.IWorldAccess; -import net.minecraft.server.v1_7_R4.ServerNBTManager; -import net.minecraft.server.v1_7_R4.WorldLoaderServer; -import net.minecraft.server.v1_7_R4.WorldManager; -import net.minecraft.server.v1_7_R4.WorldServer; -import net.minecraft.server.v1_7_R4.WorldSettings; -import net.minecraft.server.v1_7_R4.WorldType; - +import net.minecraft.server.v1_8_R3.Convertable; +import net.minecraft.server.v1_8_R3.EntityTracker; +import net.minecraft.server.v1_8_R3.EnumDifficulty; +import net.minecraft.server.v1_8_R3.IDataManager; +import net.minecraft.server.v1_8_R3.IProgressUpdate; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.ServerNBTManager; +import net.minecraft.server.v1_8_R3.WorldData; +import net.minecraft.server.v1_8_R3.WorldLoaderServer; +import net.minecraft.server.v1_8_R3.WorldManager; +import net.minecraft.server.v1_8_R3.WorldServer; +import net.minecraft.server.v1_8_R3.WorldSettings; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; -import org.bukkit.craftbukkit.v1_7_R4.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.generator.ChunkGenerator; -public class WorldUtil +public class WorldUtil { public static World LoadWorld(WorldCreator creator) { - CraftServer server = (CraftServer)Bukkit.getServer(); - if (creator == null) - { - throw new IllegalArgumentException("Creator may not be null"); - } + CraftServer server = (CraftServer) Bukkit.getServer(); + if (creator == null) + { + throw new IllegalArgumentException("Creator may not be null"); + } - String name = creator.name(); - System.out.println("Loading world '" + name + "'"); - ChunkGenerator generator = creator.generator(); - File folder = new File(server.getWorldContainer(), name); - World world = server.getWorld(name); - WorldType type = WorldType.getType(creator.type().getName()); - boolean generateStructures = creator.generateStructures(); + String name = creator.name(); + ChunkGenerator generator = creator.generator(); + File folder = new File(server.getWorldContainer(), name); + World world = server.getWorld(name); + net.minecraft.server.v1_8_R3.WorldType type = net.minecraft.server.v1_8_R3.WorldType.getType(creator.type().getName()); + boolean generateStructures = creator.generateStructures(); - if (world != null) - { - return world; - } + if (world != null) + { + return world; + } - if ((folder.exists()) && (!folder.isDirectory())) - { - throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); - } + if ((folder.exists()) && (!folder.isDirectory())) + { + throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); + } - if (generator == null) - { - generator = server.getGenerator(name); - } + if (generator == null) + { + generator = server.getGenerator(name); + } - Convertable converter = new WorldLoaderServer(server.getWorldContainer()); - if (converter.isConvertable(name)) - { - server.getLogger().info("Converting world '" + name + "'"); - converter.convert(name, new ConvertProgressUpdater(server.getServer())); - } + Convertable converter = new WorldLoaderServer(server.getWorldContainer()); + if (converter.isConvertable(name)) + { + server.getLogger().info("Converting world '" + name + "'"); + converter.convert(name, new IProgressUpdate() + { + private long b = System.currentTimeMillis(); - int dimension = server.getWorlds().size() + 1; - boolean used = false; - do - { - for (WorldServer worldServer : server.getServer().worlds) - { - used = worldServer.dimension == dimension; - if (used) - { - dimension++; - break; - } - } - } while(used); - boolean hardcore = false; + public void a(String s) + { + } - System.out.println("Loaded world with dimension : " + dimension); - - WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator); - - boolean containsWorld = false; - for (World otherWorld : server.getWorlds()) - { - if (otherWorld.getName().equalsIgnoreCase(name.toLowerCase())) - { - containsWorld = true; - break; - } - } - - if (!containsWorld) - return null; + public void a(int i) + { + if (System.currentTimeMillis() - this.b >= 1000L) + { + this.b = System.currentTimeMillis(); + MinecraftServer.LOGGER.info("Converting... " + i + "%"); + } + } - System.out.println("Created world with dimension : " + dimension); - - internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle(); - internal.worldMaps = server.getServer().worlds.get(0).worldMaps; - internal.tracker = new EntityTracker(internal); // CraftBukkit - internal.addIWorldAccess((IWorldAccess) new WorldManager(server.getServer(), internal)); - internal.difficulty = EnumDifficulty.HARD; - internal.setSpawnFlags(true, true); - internal.savingDisabled = true; - server.getServer().worlds.add(internal); + public void c(String s) + { + } + }); + } + int dimension = 10 + server.getServer().worlds.size(); + boolean used = false; + do + for (WorldServer s : server.getServer().worlds) + { + used = s.dimension == dimension; + if (used) + { + dimension++; + break; + } + } + while (used); + boolean hardcore = false; - /* - for (WorldServer worlder : server.getServer().worlds) - { - System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension); - } - */ - - if (generator != null) - { - internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld())); - } + Object sdm = new ServerNBTManager(server.getWorldContainer(), name, true); + WorldData worlddata = ((IDataManager) sdm).getWorldData(); + if (worlddata == null) + { + WorldSettings worldSettings = new WorldSettings(creator.seed(), + WorldSettings.EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type); + worldSettings.setGeneratorSettings(creator.generatorSettings()); + worlddata = new WorldData(worldSettings, name); + } + worlddata.checkName(name); + WorldServer internal = (WorldServer) new WorldServer(server.getServer(), (IDataManager) sdm, worlddata, dimension, + server.getServer().methodProfiler, creator.environment(), generator).b(); - server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld())); - server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld())); - - /* - for (WorldServer worlder : server.getServer().worlds) - { - System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension); - } - */ - - return internal.getWorld(); + boolean containsWorld = false; + for (World otherWorld : server.getWorlds()) + { + if (otherWorld.getName().equalsIgnoreCase(name.toLowerCase())) + { + containsWorld = true; + break; + } + } + + if (!containsWorld) + return null; + + internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle(); + + internal.tracker = new EntityTracker(internal); + internal.addIWorldAccess(new WorldManager(server.getServer(), internal)); + internal.worldData.setDifficulty(EnumDifficulty.EASY); + internal.setSpawnFlags(true, true); + server.getServer().worlds.add(internal); + + if (generator != null) + { + internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld())); + } + + server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld())); + server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld())); + + /* + for (WorldServer worlder : server.getServer().worlds) + { + System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension); + } + */ + + return internal.getWorld(); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ZipUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ZipUtil.java index 32c9c86c6..4e57455c3 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ZipUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ZipUtil.java @@ -174,7 +174,15 @@ public class ZipUtil int size; byte[] buffer = new byte[2048]; - fileOutputStream = new FileOutputStream(outputDirectory + File.separator + entry.getName()); + String fileName = outputDirectory + File.separator + entry.getName(); + + if (fileName.endsWith("/")) + { + new File(fileName).mkdirs(); + continue; + } + + fileOutputStream = new FileOutputStream(fileName); bufferedOutputStream = new BufferedOutputStream(fileOutputStream, buffer.length); while ((size = zipInputStream.read(buffer, 0, buffer.length)) != -1) diff --git a/Plugins/Mineplex.Core/.classpath b/Plugins/Mineplex.Core/.classpath index 7dba3b7ca..1b29691dd 100644 --- a/Plugins/Mineplex.Core/.classpath +++ b/Plugins/Mineplex.Core/.classpath @@ -12,8 +12,8 @@ - + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index eda40fc38..73138c191 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -1,6 +1,5 @@ package mineplex.core; -import java.lang.reflect.Field; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -9,28 +8,30 @@ import java.util.UUID; import mineplex.core.common.DummyEntity; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.event.CustomTagEvent; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.common.util.UtilEnt; import mineplex.core.packethandler.PacketHandler; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.packethandler.PacketVerifier; import mineplex.core.packethandler.PacketInfo; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.EnumEntitySize; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; -import net.minecraft.server.v1_7_R4.WatchableObject; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; @@ -49,234 +50,266 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { private NautHashMap> _entityMap = new NautHashMap>(); private NautHashMap> _entityNameMap = new NautHashMap>(); - private NautHashMap> _entityVehicleMap = new NautHashMap>(); private HashSet _loggedIn = new HashSet(); private HashSet _ignoreSkulls = new HashSet(); - + private NautHashMap _exemptTimeMap = new NautHashMap(); private NautHashMap> _doubleStrike = new NautHashMap>(); - - private Field _destroyId; - + private PacketHandler _packetHandler; + public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler) { super("Custom Tag Fix", plugin); - packetHandler.addPacketHandler(this); - - try - { - _destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a"); - _destroyId.setAccessible(true); - } - catch (Exception exception) - { - System.out.println("Field exception in CustomTagFix : "); - exception.printStackTrace(); - } - + _packetHandler = packetHandler; + + packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class, + PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, + PacketPlayInUseEntity.class); + NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this); NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this); NCPHookManager.addHook(CheckType.ALL, this); } - + @EventHandler public void playerQuit(PlayerQuitEvent event) { _entityMap.remove(event.getPlayer().getName()); _entityNameMap.remove(event.getPlayer().getName()); - _entityVehicleMap.remove(event.getPlayer().getName()); _loggedIn.remove(event.getPlayer()); } - + @EventHandler public void ncpExempt(final PlayerToggleFlightEvent event) { long ignoreTime = System.currentTimeMillis() + 1500; - + if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId())) { - _exemptTimeMap.put(event.getPlayer().getUniqueId(), Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId()))); + _exemptTimeMap.put(event.getPlayer().getUniqueId(), + Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId()))); return; } - + try { NCPExemptionManager.exemptPermanently(event.getPlayer()); } catch (Exception exception) { - + } - + _exemptTimeMap.put(event.getPlayer().getUniqueId(), ignoreTime); } - + @EventHandler public void ncpExemptVelocity(final PlayerVelocityEvent event) { - long ignoreTime = System.currentTimeMillis() + (long)(event.getVelocity().length() * 2000); + long ignoreTime = System.currentTimeMillis() + (long) (event.getVelocity().length() * 2000); if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId())) { - _exemptTimeMap.put(event.getPlayer().getUniqueId(), Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId()))); + _exemptTimeMap.put(event.getPlayer().getUniqueId(), + Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId()))); return; } - + _exemptTimeMap.put(event.getPlayer().getUniqueId(), ignoreTime); } - + @EventHandler public void unexempt(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + for (Iterator> iterator = _exemptTimeMap.entrySet().iterator(); iterator.hasNext();) { final Entry entry = iterator.next(); - + if (System.currentTimeMillis() > entry.getValue()) { iterator.remove(); } } - - for (Iterator>> iterator = _doubleStrike.entrySet().iterator(); iterator.hasNext();) + + for (Iterator>> iterator = _doubleStrike.entrySet().iterator(); iterator + .hasNext();) { Entry> entry = iterator.next(); for (Iterator> innerIterator = entry.getValue().entrySet().iterator(); innerIterator.hasNext();) { final Entry entry2 = innerIterator.next(); - + if (System.currentTimeMillis() > entry2.getValue()) { innerIterator.remove(); } } - + if (entry.getValue() == null || entry.getValue().size() == 0) iterator.remove(); } } - + @EventHandler public void cleanMap(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - + for (Iterator iterator = _loggedIn.iterator(); iterator.hasNext();) { String player = iterator.next(); - + if (Bukkit.getPlayerExact(player) == null) { iterator.remove(); _entityMap.remove(player); _entityNameMap.remove(player); - _entityVehicleMap.remove(player); } } - + if (Bukkit.getServer().getOnlinePlayers().size() < _loggedIn.size()) { System.out.println("PROBLEM - _loggedIn TOOOOOO BIIIIIGGGGG."); } } - + @SuppressWarnings("unchecked") public void handle(PacketInfo packetInfo) { if (packetInfo.isCancelled()) return; - + Packet packet = packetInfo.getPacket(); Player owner = packetInfo.getPlayer(); PacketVerifier verifier = packetInfo.getVerifier(); - if (owner.isOnline() && UtilPlayer.is1_8(owner)) + if (owner.isOnline()) { if (owner.isOnline() && !_entityMap.containsKey(owner.getName())) { _entityMap.put(owner.getName(), new NautHashMap()); _entityNameMap.put(owner.getName(), new NautHashMap()); - _entityVehicleMap.put(owner.getName(), new NautHashMap()); _loggedIn.add(owner.getName()); } - + if (packet instanceof PacketPlayOutSpawnEntityLiving) { - PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving)packet; + PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving) packet; // Ignore Armor stand packets - if (spawnPacket.b == 30 || spawnPacket.l == null || spawnPacket.l.c() == null || spawnPacket.a == 777777) + if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId() || spawnPacket.l == null || spawnPacket.l.c() == null + || spawnPacket.a == 777777) { - if (spawnPacket.b == 30) + if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId()) { - _ignoreSkulls.add(spawnPacket.a); + _ignoreSkulls.add(spawnPacket.a); } return; } - - for (WatchableObject watchable : (List)spawnPacket.l.c()) + + for (WatchableObject watchable : (List) spawnPacket.l.c()) { - if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1) + if (watchable.a() == 3 && watchable.b() instanceof Byte && ((Byte) watchable.b()) == 1) { - final String entityName = spawnPacket.l.getString(10); - - if (entityName.isEmpty()) - { - _entityNameMap.get(owner.getName()).remove(spawnPacket.a); - return; - } - if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a)) { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(spawnPacket.a))); + UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[] + { + _entityMap.get(owner.getName()).get(spawnPacket.a) + })); + + _entityNameMap.get(owner.getName()).remove(spawnPacket.a); + _entityMap.get(owner.getName()).remove(spawnPacket.a); } - + + final String entityName = spawnPacket.l.getString(2); + + if (entityName.isEmpty()) + { + return; + } + int newId = UtilEnt.getNewEntityId(); - sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier); - _entityMap.get(owner.getName()).put(spawnPacket.a, newId); + _entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName); - + _entityMap.get(owner.getName()).put(spawnPacket.a, newId); + + sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true); break; } } } else if (packet instanceof PacketPlayOutEntityMetadata) { - PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata)packet; - - if (!_entityMap.get(owner.getName()).containsKey(metaPacket.a) && metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a)) + PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata) packet; + + if (metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a)) { - String entityName = ""; - boolean nameShowing = false; - - for (WatchableObject watchable : (List)metaPacket.b) + boolean isDisplaying = _entityMap.get(owner.getName()).containsKey(metaPacket.a); + String currentName = _entityNameMap.get(owner.getName()).get(metaPacket.a); + + if (currentName == null) { - if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1) + currentName = ""; + } + + String newName = currentName; + boolean newDisplay = isDisplaying; + + for (WatchableObject watchable : (List) metaPacket.b) + { + if (watchable.a() == 3 && watchable.b() instanceof Byte) { - nameShowing = true; + newDisplay = ((Byte) watchable.b()) == 1; } - if ((watchable.a() == 10 || watchable.a() == 2) && watchable.b() instanceof String) + + if (watchable.a() == 2 && watchable.b() instanceof String) { - entityName = (String)watchable.b(); + newName = (String) watchable.b(); } } - - if (nameShowing && !entityName.isEmpty()) + + // If the name has changed and the name should be showing, or the name display status has changed. + if ((!newName.equals(currentName) && newDisplay) || newDisplay != isDisplaying) { - int newId = UtilEnt.getNewEntityId(); - sendProtocolPackets(owner, metaPacket.a, newId, entityName, verifier); - _entityMap.get(owner.getName()).put(metaPacket.a, newId); - _entityNameMap.get(owner.getName()).put(metaPacket.a, entityName); - } - else if (!entityName.isEmpty()) - { - _entityNameMap.get(owner.getName()).remove(metaPacket.a); + // If name is still being displayed + if (newDisplay) + { + int newId; + + if (isDisplaying) // Sending metadata + { + newId = _entityMap.get(owner.getName()).get(metaPacket.a); + } + else + // Spawning new entity + { + newId = UtilEnt.getNewEntityId(); + _entityMap.get(owner.getName()).put(metaPacket.a, newId); + } + + sendProtocolPackets(owner, metaPacket.a, newId, newName, verifier, !isDisplaying); + + _entityNameMap.get(owner.getName()).put(metaPacket.a, newName); + } + else + { // Lets delete it + int id = _entityMap.get(owner.getName()).get(metaPacket.a); + + UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[] + { + id + })); + + _entityMap.get(owner.getName()).remove(metaPacket.a); + _entityNameMap.get(owner.getName()).remove(metaPacket.a); + } } } } @@ -284,13 +317,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { try { - for (int id : (int[])_destroyId.get(packet)) + for (int id : ((PacketPlayOutEntityDestroy) packet).a) { if (_entityMap.get(owner.getName()).containsKey(id)) { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(id))); + UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[] + { + _entityMap.get(owner.getName()).get(id) + })); _entityMap.get(owner.getName()).remove(id); - _entityVehicleMap.get(owner.getName()).remove(id); _entityNameMap.get(owner.getName()).remove(id); } } @@ -299,155 +334,41 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { exception.printStackTrace(); } - } - else if (packet instanceof PacketPlayOutSpawnEntity) - { - PacketPlayOutSpawnEntity spawnPacket = (PacketPlayOutSpawnEntity) packet; - if (spawnPacket.j == 66 && spawnPacket.a != 777777) - { - _ignoreSkulls.add(spawnPacket.a); - } } - /* - else if (packet instanceof PacketPlayOutAttachEntity) + else if (packet instanceof PacketPlayOutSpawnEntity) { - PacketPlayOutAttachEntity attachPacket = (PacketPlayOutAttachEntity)packet; - - /* TODO dynamic attach handling? - if (attachPacket.c == -1) + PacketPlayOutSpawnEntity spawnPacket = (PacketPlayOutSpawnEntity) packet; + if (spawnPacket.j == 66 && spawnPacket.a != 777777) { - if (_entityVehicleMap.get(owner).containsKey(attachPacket.b) && _entityNameMap.get(owner).containsKey(_entityVehicleMap.get(owner).get(attachPacket.b))) - { - int newId = UtilEnt.getNewEntityId(); - sendProtocolPackets(owner, _entityVehicleMap.get(owner).get(attachPacket.b), newId, _entityNameMap.get(owner).get(_entityVehicleMap.get(owner).get(attachPacket.b)), verifier); - _entityMap.get(owner).put(attachPacket.b, newId); - _entityVehicleMap.get(owner).remove(attachPacket.b); - - packetInfo.setCancelled(true); - } - } - else - { - _entityVehicleMap.get(owner).put(attachPacket.b, attachPacket.c); - } - - if (_entityMap.get(owner).containsKey(attachPacket.c)) - { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(attachPacket.c))); - _entityMap.get(owner).remove(attachPacket.c); - } - else -*/ - /* - //System.out.println(owner.getName() + " id=" + owner.getEntityId() + " recieving AttachPacket b=" + attachPacket.b + " c=" + attachPacket.c); - if (attachPacket.c == -1 && _entityMap.get(owner).containsKey(attachPacket.b)) - { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(attachPacket.b))); - _entityMap.get(owner).remove(attachPacket.b); - } - else if (attachPacket.c == owner.getEntityId()) - { - if (_entityMap.get(owner).containsKey(attachPacket.b)) - { - verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(attachPacket.b))); - } - - PacketPlayOutSpawnEntityLiving armorPacket = new PacketPlayOutSpawnEntityLiving(); - armorPacket.a = UtilEnt.getNewEntityId(); - armorPacket.b = (byte) 30; - armorPacket.c = (int)EnumEntitySize.SIZE_2.a(100); - armorPacket.d = (int)MathHelper.floor(64 * 32.0D); - armorPacket.e = (int)EnumEntitySize.SIZE_2.a(100); - armorPacket.i = (byte) ((int) (0 * 256.0F / 360.0F)); - armorPacket.j = (byte) ((int) (0 * 256.0F / 360.0F)); - armorPacket.k = (byte) ((int) (0 * 256.0F / 360.0F)); - - double var2 = 3.9D; - double var4 = 0; - double var6 = 0; - double var8 = 0; - - if (var4 < -var2) - { - var4 = -var2; - } - - if (var6 < -var2) - { - var6 = -var2; - } - - if (var8 < -var2) - { - var8 = -var2; - } - - if (var4 > var2) - { - var4 = var2; - } - - if (var6 > var2) - { - var6 = var2; - } - - if (var8 > var2) - { - var8 = var2; - } - - armorPacket.f = (int)(var4 * 8000.0D); - armorPacket.g = (int)(var6 * 8000.0D); - armorPacket.h = (int)(var8 * 8000.0D); - - final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)owner.getWorld()).getHandle())); - - watcher.a(0, Byte.valueOf((byte)0)); - watcher.a(1, Short.valueOf((short)300)); - watcher.a(2, ""); - watcher.a(3, Byte.valueOf((byte) 0)); - watcher.a(4, Byte.valueOf((byte)0)); - watcher.a(7, Integer.valueOf(0)); - watcher.a(8, Byte.valueOf((byte)0)); - watcher.a(9, Byte.valueOf((byte)0)); - watcher.a(6, Float.valueOf(1.0F)); - watcher.a(10, Byte.valueOf((byte)0)); - - // Set invisible - int i1 = watcher.getInt(0); - watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5))); - - // Set small - byte b1 = watcher.getByte(10); - b1 = (byte)(b1 | 0x1); - - watcher.watch(10, Byte.valueOf(b1)); - - armorPacket.l = watcher; - - // Spawn armor packet - verifier.bypassProcess(armorPacket); - - PacketPlayOutAttachEntity attachPacket2 = new PacketPlayOutAttachEntity(); - attachPacket2.c = owner.getEntityId(); - attachPacket2.b = armorPacket.a; - attachPacket2.a = 0; - - // Send armor attach to player. - verifier.bypassProcess(attachPacket2); - - // Change original packet to attach to armor stand - attachPacket.c = armorPacket.a; - - _entityMap.get(owner).put(attachPacket.b, armorPacket.a); + _ignoreSkulls.add(spawnPacket.a); + } + } + else if (packet instanceof PacketPlayInUseEntity) + { + PacketPlayInUseEntity usePacket = (PacketPlayInUseEntity) packet; + + for (Entry entry : _entityMap.get(owner.getName()).entrySet()) + { + if (entry.getValue() == usePacket.a) + { + PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity(); + newPacket.a = entry.getKey(); + newPacket.action = usePacket.action; + newPacket.c = usePacket.c; + + if (_packetHandler.handlePacket(owner, newPacket)) + { + ((CraftPlayer) owner).getHandle().playerConnection.a(newPacket); + } + break; + } } } - */ } } - - private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName, final PacketVerifier packetList) + + private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName, + final PacketVerifier packetList, final boolean newPacket) { CustomTagEvent event = new CustomTagEvent(owner, entityId, entityName); _plugin.getServer().getPluginManager().callEvent(event); @@ -457,107 +378,102 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { public void run() { - final PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); - packet.a = newEntityId; - packet.b = (byte) 30; - packet.c = (int)EnumEntitySize.SIZE_2.a(100); - packet.d = (int)MathHelper.floor(64 * 32.0D); - packet.e = (int)EnumEntitySize.SIZE_2.a(100); - packet.i = (byte) ((int) (0 * 256.0F / 360.0F)); - packet.j = (byte) ((int) (0 * 256.0F / 360.0F)); - packet.k = (byte) ((int) (0 * 256.0F / 360.0F)); + final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle())); - double var2 = 3.9D; - double var4 = 0; - double var6 = 0; - double var8 = 0; - - if (var4 < -var2) - { - var4 = -var2; - } - - if (var6 < -var2) - { - var6 = -var2; - } - - if (var8 < -var2) - { - var8 = -var2; - } - - if (var4 > var2) - { - var4 = var2; - } - - if (var6 > var2) - { - var6 = var2; - } - - if (var8 > var2) - { - var8 = var2; - } - - packet.f = (int)(var4 * 8000.0D); - packet.g = (int)(var6 * 8000.0D); - packet.h = (int)(var8 * 8000.0D); - - final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)owner.getWorld()).getHandle())); - - watcher.a(0, Byte.valueOf((byte)0)); - watcher.a(1, Short.valueOf((short)300)); + watcher.a(0, Byte.valueOf((byte) 0)); + watcher.a(1, Short.valueOf((short) 300)); watcher.a(2, ""); watcher.a(3, Byte.valueOf((byte) 0)); - watcher.a(4, Byte.valueOf((byte)0)); + watcher.a(4, Byte.valueOf((byte) 0)); watcher.a(7, Integer.valueOf(0)); - watcher.a(8, Byte.valueOf((byte)0)); - watcher.a(9, Byte.valueOf((byte)0)); + watcher.a(8, Byte.valueOf((byte) 0)); + watcher.a(9, Byte.valueOf((byte) 0)); watcher.a(6, Float.valueOf(1.0F)); - watcher.a(10, Byte.valueOf((byte)0)); - - // Set invisible - int i1 = watcher.getInt(0); - watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5))); - - // Set small - byte b1 = watcher.getByte(10); - b1 = (byte)(b1 | 0x1); - - watcher.watch(10, Byte.valueOf(b1)); - - watcher.watch(2, finalEntityName); - watcher.watch(3, Byte.valueOf((byte)1)); - - packet.l = watcher; - - packetList.bypassProcess(packet); - - PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity(); - vehiclePacket.a = 0; - vehiclePacket.b = packet.a; - vehiclePacket.c = entityId; - - packetList.bypassProcess(vehiclePacket); - - /* TODO dynamic attach handling? - if (_entityVehicleMap.get(owner).containsValue(entityId)) - { - vehiclePacket = new PacketPlayOutAttachEntity(); - vehiclePacket.a = 0; - - for (Entry entry : _entityVehicleMap.get(owner).entrySet()) - { - if (entry.getValue() == entityId) - vehiclePacket.b = entry.getKey(); - } + watcher.a(10, Byte.valueOf((byte) 0)); - vehiclePacket.c = packet.a; + // Set invisible + int i1 = watcher.getByte(0); + watcher.watch(0, Byte.valueOf((byte) (i1 | 1 << 5))); + + // Set small + byte b1 = watcher.getByte(10); + b1 = (byte) (b1 | 0x1); + + watcher.watch(10, Byte.valueOf(b1)); + + watcher.watch(2, finalEntityName); + watcher.watch(3, Byte.valueOf((byte) 1)); + + if (newPacket) + { + final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving(); + spawnPacket.a = newEntityId; + spawnPacket.b = (byte) 30; + spawnPacket.c = (int) MathHelper.floor(100 * 32); + spawnPacket.d = (int) MathHelper.floor(64 * 32.0D); + spawnPacket.e = (int) MathHelper.floor(100 * 32); + spawnPacket.i = (byte) ((int) (0 * 256.0F / 360.0F)); + spawnPacket.j = (byte) ((int) (0 * 256.0F / 360.0F)); + spawnPacket.k = (byte) ((int) (0 * 256.0F / 360.0F)); + + double var2 = 3.9D; + double var4 = 0; + double var6 = 0; + double var8 = 0; + + if (var4 < -var2) + { + var4 = -var2; + } + + if (var6 < -var2) + { + var6 = -var2; + } + + if (var8 < -var2) + { + var8 = -var2; + } + + if (var4 > var2) + { + var4 = var2; + } + + if (var6 > var2) + { + var6 = var2; + } + + if (var8 > var2) + { + var8 = var2; + } + + spawnPacket.f = (int) (var4 * 8000.0D); + spawnPacket.g = (int) (var6 * 8000.0D); + spawnPacket.h = (int) (var8 * 8000.0D); + + spawnPacket.l = watcher; + + UtilPlayer.sendPacket(owner, spawnPacket); + + PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity(); + vehiclePacket.a = 0; + vehiclePacket.b = spawnPacket.a; + vehiclePacket.c = entityId; + + UtilPlayer.sendPacket(owner, vehiclePacket); + } + else + { + PacketPlayOutEntityMetadata entityMetadata = new PacketPlayOutEntityMetadata(); + entityMetadata.a = newEntityId; + entityMetadata.b = watcher.c(); + + packetList.bypassProcess(entityMetadata); } - */ } }); } @@ -578,28 +494,28 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo violationInfo) { boolean failure = false; - + if (checkType == CheckType.MOVING_SURVIVALFLY || checkType == CheckType.MOVING_PASSABLE) - { + { failure = _exemptTimeMap.containsKey(player.getUniqueId()); - + if (failure) MovingData.getData(player).clearFlyData(); } - + // This is the second strike system. if (!failure) { - if (!_doubleStrike.containsKey(player.getUniqueId()) || !_doubleStrike.get(player.getUniqueId()).containsKey(checkType.getParent())) + if (!_doubleStrike.containsKey(player.getUniqueId()) + || !_doubleStrike.get(player.getUniqueId()).containsKey(checkType.getParent())) failure = true; if (!_doubleStrike.containsKey(player.getUniqueId())) _doubleStrike.put(player.getUniqueId(), new NautHashMap()); - + _doubleStrike.get(player.getUniqueId()).put(checkType.getParent(), System.currentTimeMillis() + 5000); } - + return failure; } } - diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java index db1244267..732c13816 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java @@ -107,6 +107,11 @@ public abstract class MiniPlugin implements Listener { _plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable); } + + public void runAsync(Runnable runnable, long time) + { + _plugin.getServer().getScheduler().runTaskLaterAsynchronously(_plugin, runnable, time); + } public void runSync(Runnable runnable) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java b/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java new file mode 100644 index 000000000..a5f302e97 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java @@ -0,0 +1,183 @@ +package mineplex.core; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerAnimationEvent; +import org.bukkit.event.player.PlayerAnimationType; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler +{ + private HashMap> _armorStands = new HashMap>(); + private HashSet _leftClicked = new HashSet(); + private int _lastTick; + + public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler) + { + super("Packets Interaction Fix", plugin); + + packetHandler.addPacketHandler(this, true, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class, + PacketPlayInUseEntity.class); + } + + private void checkLeftClicks() + { + if (MinecraftServer.currentTick == _lastTick) + { + return; + } + + _lastTick = MinecraftServer.currentTick; + _leftClicked.clear(); + } + + //@EventHandler + public void onArmAnimation(PlayerAnimationEvent event) + { + if (event.getAnimationType() != PlayerAnimationType.ARM_SWING) + { + return; + } + + checkLeftClicks(); + + Player player = event.getPlayer(); + + if (_leftClicked.remove(player)) + { + return; + } + + CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.LEFT_CLICK_AIR, + ((CraftPlayer) player).getHandle().inventory.getItemInHand()); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _leftClicked.remove(event.getPlayer().getName()); + _armorStands.remove(event.getPlayer().getName()); + } + + @EventHandler + public void removeDeadNames(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + checkLeftClicks(); + + Iterator itel = _armorStands.keySet().iterator(); + + while (itel.hasNext()) + { + String name = itel.next(); + + Player player = Bukkit.getPlayerExact(name); + + if (player != null) + { + continue; + } + + itel.remove(); + } + } + + //@EventHandler + public void onPlayerInteract(PlayerInteractEvent event) + { + if (!event.getAction().name().contains("LEFT")) + { + return; + } + + checkLeftClicks(); + + _leftClicked.add(event.getPlayer()); + } + + @Override + public void handle(PacketInfo packetInfo) + { + Player player = packetInfo.getPlayer(); + + if (!player.isOnline()) + { + return; + } + + if (packetInfo.isCancelled()) + { + return; + } + + if (!_armorStands.containsKey(player.getName())) + { + _armorStands.put(player.getName(), new HashSet()); + } + + HashSet list = _armorStands.get(player.getName()); + + if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntityLiving) + { + PacketPlayOutSpawnEntityLiving packet = (PacketPlayOutSpawnEntityLiving) packetInfo.getPacket(); + + if (packet.b != EntityType.ARMOR_STAND.getTypeId()) + { + return; + } + + list.add(packet.a); + } + else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) + { + PacketPlayOutEntityDestroy packet = (PacketPlayOutEntityDestroy) packetInfo.getPacket(); + + list.removeAll(Arrays.asList(packet.a)); + } + else if (packetInfo.getPacket() instanceof PacketPlayInUseEntity) + { + PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket(); + + if (!list.contains(packet.a)) + { + return; + } + + if (packet.action == EnumEntityUseAction.ATTACK) + { + return; + } + + CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.RIGHT_CLICK_AIR, + ((CraftPlayer) player).getHandle().inventory.getItemInHand()); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java b/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java deleted file mode 100644 index d6b15a030..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java +++ /dev/null @@ -1,54 +0,0 @@ -package mineplex.core; - -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; - -import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; - -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; - -public class TablistFix extends MiniPlugin -{ - public TablistFix(JavaPlugin plugin) - { - super("Tablist Fix", plugin); - } - - // This is sort of experimental! - @EventHandler(priority = EventPriority.MONITOR) - public void onJoin(PlayerJoinEvent event) - {/* - final Player player = event.getPlayer(); - runSyncLater(new Runnable() - { - @Override - public void run() - { - if (!player.isOnline()) - return; - - PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle()); - - if (UtilPlayer.is1_8(player)) - { - UtilPlayer.sendPacket(player, packet); - } - - for (Player other : UtilServer.getPlayers()) - { - if (other.equals(player) || !other.canSee(player)) - continue; - - if (UtilPlayer.is1_8(other)) - UtilPlayer.sendPacket(other, packet); - } - } - }, 20L); - */ - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 31c2330ec..5c07e698c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -8,6 +8,7 @@ import java.util.Map.Entry; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; +import com.google.gson.Gson; import mineplex.core.MiniPlugin; import mineplex.core.account.command.TestRank; import mineplex.core.account.command.UpdateRank; @@ -28,7 +29,6 @@ import mineplex.playerCache.PlayerInfo; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -426,6 +426,25 @@ public class CoreClientManager extends MiniPlugin }, name, uuid, rank, perm); } + public void SaveRank(final Callback callback, final String name, final UUID uuid, Rank rank, boolean perm) + { + _repository.saveRank(new Callback() + { + public void run(Rank newRank) + { + if (_plugin.getServer().getPlayer(name) != null) + { + CoreClient client = Get(name); + + client.SetRank(newRank, false); + } + + if (callback != null) + callback.run(newRank); + } + }, name, uuid, rank, perm); + } + public void checkPlayerNameExact(final Callback callback, final String playerName) { _repository.matchPlayerName(new Callback>() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java index 888bd1e9b..d8bc4dcef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientWebRequestEvent.java @@ -1,6 +1,6 @@ package mineplex.core.account.event; -import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonWriter; +import com.google.gson.stream.JsonWriter; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index b151ba4e7..d8362e33b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; +import com.google.gson.reflect.TypeToken; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.ILoginProcessor; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index bf874c242..825b62026 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -755,9 +755,6 @@ public enum Achievement ; - private static String[] _colors = { C.cAqua, C.cGreen, C.cDGray, C.cPurple, C.cYellow, C.cGray }; - private static int _negativeCount = 0; - private String _name; private String[] _desc; private String[] _stats; @@ -823,10 +820,7 @@ public enum Achievement public static String getExperienceString(int level) { if (level < 0) - { - _negativeCount++; - return _colors[_negativeCount % _colors.length] + level; - } + return C.cPurple + level; if (level < 20) return C.cGray + level; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java index 8d21d1f13..1b7fb4b65 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java @@ -6,7 +6,7 @@ import java.sql.SQLException; import mineplex.core.database.DBPool; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; public class AntiHackRepository diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index c6188442c..922911a59 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -32,6 +32,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.database.DBPool; import mineplex.core.donation.DonationManager; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; @@ -61,7 +62,7 @@ import org.jooq.SQLDialect; import org.jooq.impl.DSL; import org.bukkit.Bukkit; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -71,8 +72,8 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; public class BonusManager extends MiniClientPlugin implements ILoginProcessor { @@ -165,7 +166,7 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager) + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, GiveawayManager giveawayManager) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -174,7 +175,7 @@ public class BonusManager extends MiniClientPlugin implements I _npcManager = npcManager; _hologramManager = hologramManager; - _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, 100, 250, 500, 1000, 4000, 6000, @@ -404,7 +405,7 @@ public class BonusManager extends MiniClientPlugin implements I if (!_enabled) return; - ((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, -1); + ((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1); } public void IncreaseSize(Entity player) @@ -412,7 +413,7 @@ public class BonusManager extends MiniClientPlugin implements I if (!_enabled) return; - ((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, 1); + ((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1); } // DAILY BONUS @@ -891,7 +892,7 @@ public class BonusManager extends MiniClientPlugin implements I if (client.getHologram() == null) { - double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3; + double yAdd = 2.18; hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), ""); hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); hologram.addPlayer(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java index c111054bf..3f7d56312 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java @@ -3,6 +3,7 @@ package mineplex.core.bonuses.gui; import java.util.ArrayList; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gui.DisplayItem; @@ -109,7 +110,14 @@ public class SpinGui extends SimpleGui } } - _rewardData = _reward.giveReward(RewardType.SpinnerReal, getPlayer()); + _reward.giveReward(RewardType.SpinnerReal, getPlayer(), new Callback() + { + @Override + public void run(RewardData data) + { + _rewardData = data; + } + }); } private void tick() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index 7847b0408..8954b07c0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -134,9 +134,10 @@ public class Chat extends MiniPlugin public void preventMe(PlayerCommandPreprocessEvent event) { if (event.getMessage().toLowerCase().startsWith("/me ") - || event.getMessage().toLowerCase().startsWith("/bukkit")) + || event.getMessage().toLowerCase().startsWith("/bukkit") + || event.getMessage().toLowerCase().startsWith("/minecraft")) { - event.getPlayer().sendMessage(F.main(getName(), "No, you!")); + event.getPlayer().sendMessage(F.main(getName(), "Nope, not allowed!")); event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java index 5290158c3..44a88d004 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/CommandCenter.java @@ -9,7 +9,6 @@ import mineplex.core.recharge.Recharge; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.TabCompleteEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 3262033c0..cd562f903 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -4,14 +4,17 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.Items; -import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow; -import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.ChatMessage; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.IChatBaseComponent; +import net.minecraft.server.v1_8_R3.Items; +import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -19,6 +22,7 @@ import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.PetSorter; @@ -166,11 +170,11 @@ public class PetPage extends ShopPageBase PetTagPage petTagPage = new PetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Repairing", getPlayer(), pet, petPurchase); EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle(); int containerCounter = entityPlayer.nextContainerCounter(); - entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 0, true)); + UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]))); entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory()); entityPlayer.activeContainer.windowId = containerCounter; entityPlayer.activeContainer.addSlotListener(entityPlayer); - entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R4.ItemStack(Items.NAME_TAG))); + UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG))); getShop().setCurrentPageForPlayer(getPlayer(), petTagPage); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 7477a2492..84da7d074 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -17,8 +17,8 @@ import mineplex.core.pet.repository.token.PetToken; import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ShopPageBase; import mineplex.playerCache.PlayerCache; -import net.minecraft.server.v1_7_R4.ItemStack; -import net.minecraft.server.v1_7_R4.Items; +import net.minecraft.server.v1_8_R3.ItemStack; +import net.minecraft.server.v1_8_R3.Items; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java index e98a0699d..d1371487f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java @@ -2,9 +2,11 @@ package mineplex.core.creature.command; import java.util.HashMap; import java.util.HashSet; +import java.util.Set; +import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -110,7 +112,7 @@ public class MobCommand extends MultiCommandBase HashSet entSet = new HashSet(); for (int i = 0 ; i < count ; i++) { - entSet.add(Plugin.SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type)); + entSet.add(Plugin.SpawnEntity(caller.getTargetBlock((Set) null, 0).getLocation().add(0.5, 1, 0.5), type)); } //Search Vars diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index bbc04051a..d2ed8e55b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -9,59 +9,43 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseArmorStand; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseBlock; -import mineplex.core.disguise.disguises.DisguiseInsentient; -import mineplex.core.disguise.disguises.DisguiseLiving; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.disguise.disguises.DisguiseRabbit; -import mineplex.core.packethandler.IPacketHandler; -import mineplex.core.packethandler.PacketHandler; -import mineplex.core.packethandler.PacketInfo; -import mineplex.core.packethandler.PacketVerifier; -import mineplex.core.timing.TimingManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.Block; -import net.minecraft.server.v1_7_R4.Chunk; -import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent; -import net.minecraft.server.v1_7_R4.ChunkSection; -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.EntityTrackerEntry; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; -import net.minecraft.server.v1_7_R4.PacketPlayOutBed; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity; -import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunk; -import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; -import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; -import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes; -import net.minecraft.server.v1_7_R4.WorldServer; +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.ChunkSection; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutBed; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; +import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -75,6 +59,26 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.plugin.java.JavaPlugin; +import com.mineplex.spigot.ChunkAddEntityEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseBlock; +import mineplex.core.disguise.disguises.DisguiseInsentient; +import mineplex.core.disguise.disguises.DisguiseLiving; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.disguise.disguises.DisguiseRabbit; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketVerifier; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.timing.TimingManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class DisguiseManager extends MiniPlugin implements IPacketHandler { private NautHashMap _spawnPacketMap = new NautHashMap(); @@ -89,18 +93,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler private boolean _handlingPacket = false; - private Field _attributesA; - private Field _attributesB; - private Field _soundB; - private Field _soundC; - private Field _soundD; - private Field _bedA; - private Field _bedB; - private Field _bedD; private Field _xChunk; private Field _zChunk; - private Field _eStatusId; - private Field _eStatusState; private Chunk _bedChunk; private boolean _bedPackets; @@ -109,37 +103,22 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { super("Disguise Manager", plugin); - packetHandler.addPacketHandler(this); + packetHandler.addPacketHandler(this, PacketPlayOutAnimation.class, PacketPlayOutBed.class, + PacketPlayOutEntityStatus.class, PacketPlayOutMapChunk.class, PacketPlayOutMapChunkBulk.class, + PacketPlayOutNamedEntitySpawn.class, PacketPlayOutPlayerInfo.class, + PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, + PacketPlayOutSpawnEntity.class, PacketPlayOutEntityVelocity.class, PacketPlayOutEntityDestroy.class, + PacketPlayOutEntityTeleport.class, PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntityLiving.class, + PacketPlayOutUpdateAttributes.class, PacketPlayOutEntityEquipment.class, PacketPlayOutNamedSoundEffect.class); try { - _attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a"); - _attributesA.setAccessible(true); - _attributesB = PacketPlayOutUpdateAttributes.class.getDeclaredField("b"); - _attributesB.setAccessible(true); - _soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b"); - _soundB.setAccessible(true); - _soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c"); - _soundC.setAccessible(true); - _soundD = PacketPlayOutNamedSoundEffect.class.getDeclaredField("d"); - _soundD.setAccessible(true); - _bedA = PacketPlayOutBed.class.getDeclaredField("a"); - _bedA.setAccessible(true); - _bedB = PacketPlayOutBed.class.getDeclaredField("b"); - _bedB.setAccessible(true); - _bedD = PacketPlayOutBed.class.getDeclaredField("d"); - _bedD.setAccessible(true); - _eStatusId = PacketPlayOutEntityStatus.class.getDeclaredField("a"); - _eStatusId.setAccessible(true); - _eStatusState = PacketPlayOutEntityStatus.class.getDeclaredField("b"); - _eStatusState.setAccessible(true); - - _bedChunk = new Chunk(null, 0, 0); + _bedChunk = new Chunk(((CraftWorld) Bukkit.getWorlds().get(0)).getHandle(), 0, 0); Field cSection = Chunk.class.getDeclaredField("sections"); cSection.setAccessible(true); - ChunkSection chunkSection = new ChunkSection(0, false); - Block block = Block.getById(Material.BED_BLOCK.getId()); + ChunkSection chunkSection = new ChunkSection(0, true); + Block block = Block.getById(Material.BED_BLOCK.getId()); // block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"),"byId") // .get(null))[Material.BED_BLOCK.getId()]; @@ -149,17 +128,20 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH }) { - chunkSection.setTypeId(1 + face.getModX(), 0, 1 + face.getModZ(), block); - chunkSection.setData(1 + face.getModX(), 0, 1 + face.getModZ(), face.ordinal()); - chunkSection.setSkyLight(1 + face.getModX(), 0, 1 + face.getModZ(), 0); - chunkSection.setEmittedLight(1 + face.getModX(), 0, 1 + face.getModZ(), 0); + int x = 1 + face.getModX(); + int z = 1 + face.getModZ(); + + chunkSection.setType(x, 0, z, block.fromLegacyData(face.ordinal())); + chunkSection.a(x, 0, z, 0); + chunkSection.b(x, 0, z, 0); } ChunkSection[] chunkSections = new ChunkSection[16]; chunkSections[0] = chunkSection; cSection.set(_bedChunk, chunkSections); - _bedChunk.world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle(); + // TODO +// _bedChunk.world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle(); _xChunk = Chunk.class.getField("locX"); _xChunk.setAccessible(true); @@ -226,13 +208,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler @EventHandler public void ChunkAddEntity(ChunkAddEntityEvent event) { - DisguiseBase disguise = _entityDisguiseMap.get(event.GetEntity().getUniqueId().toString()); + DisguiseBase disguise = _entityDisguiseMap.get(event.getEntity().getUniqueId().toString()); if (disguise != null) { - disguise.setEntity(event.GetEntity()); - _spawnPacketMap.put(event.GetEntity().getEntityId(), disguise); - _entityDisguiseMap.remove(event.GetEntity().getUniqueId().toString()); + disguise.setEntity(event.getEntity()); + _spawnPacketMap.put(event.getEntity().getEntityId(), disguise); + _entityDisguiseMap.remove(event.getEntity().getUniqueId().toString()); if (disguise instanceof DisguiseRabbit) { @@ -427,10 +409,10 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler Packet[] packets = new Packet[2]; // Make unload - packets[0] = new PacketPlayOutMapChunk(_bedChunk, true, 0, UtilPlayer.is1_8(player) ? 48 : 0); + packets[0] = new PacketPlayOutMapChunk(_bedChunk, true, 0); // Make load - packets[1] = new PacketPlayOutMapChunkBulk(Arrays.asList(_bedChunk), UtilPlayer.is1_8(player) ? 48 : 0); + packets[1] = new PacketPlayOutMapChunkBulk(Arrays.asList(_bedChunk)); return packets; } @@ -439,26 +421,26 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { prepareChunk(oldLoc); - return new PacketPlayOutMapChunk(_bedChunk, true, 0, UtilPlayer.is1_8(player) ? 48 : 0); + return new PacketPlayOutMapChunk(_bedChunk, true, 0); } - private Packet[] getBedPackets(Location recieving, DisguisePlayer playerDisguise, boolean is18) + private Packet[] getBedPackets(Location recieving, DisguisePlayer playerDisguise) { try { PacketPlayOutBed bedPacket = new PacketPlayOutBed(); - _bedA.set(bedPacket, playerDisguise.GetEntityId()); + bedPacket.a = playerDisguise.GetEntityId(); int chunkX = getChunk(recieving.getX()); int chunkZ = getChunk(recieving.getZ()); - _bedB.set(bedPacket, (chunkX * 16) + 1 + playerDisguise.getSleepingDirection().getModX()); - _bedD.set(bedPacket, (chunkZ * 16) + 1 + playerDisguise.getSleepingDirection().getModZ()); + bedPacket.b = new BlockPosition((chunkX * 16) + 1 + playerDisguise.getSleepingDirection().getModX(), 0, (chunkZ * 16) + + 1 + playerDisguise.getSleepingDirection().getModZ()); PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(playerDisguise.GetEntity()); - teleportPacket.c += (int) ((is18 ? 0.07D : 0.25D) * 32); + teleportPacket.c += (int) (0.35D * 32); return new Packet[] { @@ -502,7 +484,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler && ((DisguisePlayer) entry.getKey()).getSleepingDirection() != null) { - packets.addAll(Arrays.asList(getBedPackets(newLoc, (DisguisePlayer) entry.getKey(), UtilPlayer.is1_8(player)))); + packets.addAll(Arrays.asList(getBedPackets(newLoc, (DisguisePlayer) entry.getKey()))); } } } @@ -522,7 +504,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler return _spawnPacketMap.get(entity.getEntityId()); } - private EntityTrackerEntry getEntityTracker(net.minecraft.server.v1_7_R4.Entity entity) + private EntityTrackerEntry getEntityTracker(net.minecraft.server.v1_8_R3.Entity entity) { return (EntityTrackerEntry) ((WorldServer) entity.world).tracker.trackedEntities.get(entity.getId()); } @@ -536,8 +518,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler final Player owner = packetInfo.getPlayer(); final PacketVerifier packetVerifier = packetInfo.getVerifier(); - if (UtilPlayer.is1_8(owner) - && (packet instanceof PacketPlayOutRelEntityMoveLook || packet instanceof PacketPlayOutRelEntityMove)) + if (packet instanceof PacketPlayOutRelEntityMoveLook || packet instanceof PacketPlayOutRelEntityMove) { int entityId = -1; @@ -577,17 +558,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler rabbitHops.put(owner.getEntityId(), System.currentTimeMillis()); PacketPlayOutEntityStatus entityStatus = new PacketPlayOutEntityStatus(); - try - { - _eStatusId.set(entityStatus, entityId); - _eStatusState.set(entityStatus, (byte) 1); - handlePacket(entityStatus, packetVerifier); - } - catch (Exception ex) - { - ex.printStackTrace(); - } + entityStatus.a = entityId; + entityStatus.b = (byte) 1; + + handlePacket(entityStatus, packetVerifier); } } } @@ -595,9 +570,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (packet instanceof PacketPlayOutPlayerInfo) { - if (_blockedNames.contains(((PacketPlayOutPlayerInfo) packet).username)) + for (PlayerInfoData info : ((PacketPlayOutPlayerInfo) packet).b) { - packetInfo.setCancelled(true); + if (_blockedNames.contains(info.a().getName())) + { + packetInfo.setCancelled(true); + break; + } } } else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutSpawnEntityLiving @@ -643,20 +622,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler } else if (packet instanceof PacketPlayOutUpdateAttributes) { - int entityId = -1; - - try - { - entityId = (int) _attributesA.get((PacketPlayOutUpdateAttributes) packet); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } + int entityId = ((PacketPlayOutUpdateAttributes) packet).a; if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId @@ -831,11 +797,6 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { final Player player = packetInfo.getPlayer(); - if (!UtilPlayer.is1_8(player) && (disguise instanceof DisguiseRabbit || disguise instanceof DisguiseArmorStand)) - { - return; - } - final PacketVerifier packetVerifier = packetInfo.getVerifier(); if (disguise instanceof DisguisePlayer) @@ -853,7 +814,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (pDisguise.getSleepingDirection() != null) { - for (Packet packet : getBedPackets(player.getLocation(), pDisguise, UtilPlayer.is1_8(player))) + for (Packet packet : getBedPackets(player.getLocation(), pDisguise)) { handlePacket(packet, packetVerifier); } @@ -1067,7 +1028,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler continue; if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0) - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport( + UtilPlayer.sendPacket(player, new PacketPlayOutEntityTeleport( ((CraftPlayer) otherPlayer).getHandle())); } } @@ -1122,9 +1083,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (disguise.GetEntity() == ((CraftPlayer) player).getHandle()) continue; - EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); - - entityPlayer.playerConnection.sendPacket(disguise.GetMetaDataPacket()); + UtilPlayer.sendPacket(player, disguise.GetMetaDataPacket()); } } @@ -1143,20 +1102,18 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler EntityPlayer disguisedPlayer = (EntityPlayer) disguise.GetEntity(); - if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid) disguiseIterator.remove(); - - try{ + else + { for (Iterator playerIterator = _disguisePlayerMap.get(disguise).iterator(); playerIterator.hasNext();) { Player player = playerIterator.next(); - + if (!player.isOnline() || !player.isValid()) playerIterator.remove(); } } - catch (Exception exception) {} } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java index 83ffd1d83..0d52b1c38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAgeable.java @@ -1,7 +1,6 @@ package mineplex.core.disguise.disguises; import org.bukkit.entity.*; -import org.spigotmc.ProtocolData; public abstract class DisguiseAgeable extends DisguiseCreature { @@ -9,23 +8,23 @@ public abstract class DisguiseAgeable extends DisguiseCreature { super(disguiseType, entity); - DataWatcher.a(12, new ProtocolData.IntByte(0, (byte)0)); + DataWatcher.a(12, new Byte((byte)0)); } public void UpdateDataWatcher() { super.UpdateDataWatcher(); - DataWatcher.watch(12, DataWatcher.getIntByte(12)); + DataWatcher.watch(12, DataWatcher.getByte(12)); } public boolean isBaby() { - return DataWatcher.getIntByte(12).value < 0; + return DataWatcher.getByte(12) < 0; } public void setBaby() { - DataWatcher.watch(12, new ProtocolData.IntByte(-24000, (byte) ( -1 ))); + DataWatcher.watch(12, new Byte((byte) ( -1 ))); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java index 34e1cfa84..9d198e02b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseArmorStand.java @@ -2,32 +2,40 @@ package mineplex.core.disguise.disguises; import org.bukkit.util.Vector; -import net.minecraft.server.v1_7_R4.EnumEntitySize; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.Vector3f; public class DisguiseArmorStand extends DisguiseInsentient { - private Vector _headPosition = new Vector(); - public DisguiseArmorStand(org.bukkit.entity.Entity entity) { super(entity); DataWatcher.a(10, (byte) 0); - + for (int i = 11; i < 17; i++) { - DataWatcher.a(i, new Vector(0, 0, 0)); + DataWatcher.a(i, new Vector3f(0, 0, 0)); } // Rotations are from -360 to 360 } + private Vector3f convert(Vector vector) + { + return new Vector3f((float) vector.getX(), (float) vector.getY(), (float) vector.getZ()); + } + + private Vector convert(Vector3f vector) + { + return new Vector(vector.getX(), vector.getY(), vector.getZ()); + } + public Vector getHeadPosition() { - return _headPosition.clone(); + return convert(DataWatcher.h(11)); } protected String getHurtSound() @@ -41,9 +49,9 @@ public class DisguiseArmorStand extends DisguiseInsentient PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); packet.a = Entity.getId(); packet.b = (byte) 30; - packet.c = (int) EnumEntitySize.SIZE_2.a(Entity.locX); + packet.c = (int) MathHelper.floor(Entity.locX * 32.0D); packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.e = (int) MathHelper.floor(Entity.locZ * 32.0D); packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); @@ -95,7 +103,7 @@ public class DisguiseArmorStand extends DisguiseInsentient public void setBodyPosition(Vector vector) { - DataWatcher.watch(12, vector); + DataWatcher.watch(12, convert(vector)); } public void setHasArms() @@ -105,18 +113,17 @@ public class DisguiseArmorStand extends DisguiseInsentient public void setHeadPosition(Vector vector) { - _headPosition = vector; - DataWatcher.watch(11, vector); + DataWatcher.watch(11, convert(vector)); } public void setLeftArmPosition(Vector vector) { - DataWatcher.watch(13, vector); + DataWatcher.watch(13, convert(vector)); } public void setLeftLegPosition(Vector vector) { - DataWatcher.watch(15, vector); + DataWatcher.watch(15, convert(vector)); } public void setRemoveBase() @@ -126,12 +133,12 @@ public class DisguiseArmorStand extends DisguiseInsentient public void setRightArmPosition(Vector vector) { - DataWatcher.watch(14, vector); + DataWatcher.watch(14, convert(vector)); } public void setRightLegPosition(Vector vector) { - DataWatcher.watch(16, vector); + DataWatcher.watch(16, convert(vector)); } public void setSmall() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java index bfaba13d3..27e6fbd54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java @@ -1,14 +1,18 @@ package mineplex.core.disguise.disguises; import mineplex.core.common.*; +import mineplex.core.common.util.UtilPlayer; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; - -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.Entity; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.IntHashMap; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.WorldServer; public abstract class DisguiseBase { @@ -33,7 +37,7 @@ public abstract class DisguiseBase _soundDisguise = this; } - + public void setEntity(org.bukkit.entity.Entity entity) { Entity = ((CraftEntity) entity).getHandle(); @@ -53,6 +57,24 @@ public abstract class DisguiseBase return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true); } + public void resendMetadata() + { + if (Entity == null || !Entity.getBukkitEntity().isValid() || !(Entity.world instanceof WorldServer)) + return; + + IntHashMap tracker = ((WorldServer) Entity.world).tracker.trackedEntities; + + if (tracker.get(Entity.getId()) == null) + return; + + Packet packet = GetMetaDataPacket(); + + for (EntityPlayer player : tracker.get(Entity.getId()).trackedPlayers) + { + UtilPlayer.sendPacket(player.getBukkitEntity(), packet); + } + } + public void setSoundDisguise(DisguiseBase soundDisguise) { _soundDisguise = soundDisguise; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java index c0060c8df..9e90deaf4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java @@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises; import java.util.Random; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; public class DisguiseBlock extends DisguiseBase { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java index ba048dbca..93a693ec0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java @@ -1,9 +1,8 @@ package mineplex.core.disguise.disguises; -import net.minecraft.server.v1_7_R4.EnumEntitySize; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import org.bukkit.entity.*; public abstract class DisguiseCreature extends DisguiseInsentient @@ -28,9 +27,9 @@ public abstract class DisguiseCreature extends DisguiseInsentient PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); packet.a = Entity.getId(); packet.b = (byte) getDisguiseType().getTypeId(); - packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); - packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.c = (int) MathHelper.floor(Entity.locX*32D); + packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); + packet.e = (int) MathHelper.floor(Entity.locZ*32D); packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java index 1420fc58e..d752c1698 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java @@ -2,12 +2,11 @@ package mineplex.core.disguise.disguises; import java.util.Arrays; -import net.minecraft.server.v1_7_R4.MobEffect; -import net.minecraft.server.v1_7_R4.MobEffectList; -import net.minecraft.server.v1_7_R4.PotionBrewer; +import net.minecraft.server.v1_8_R3.MobEffect; +import net.minecraft.server.v1_8_R3.MobEffectList; +import net.minecraft.server.v1_8_R3.PotionBrewer; import org.bukkit.entity.*; -import org.spigotmc.ProtocolData; public class DisguiseEnderman extends DisguiseMonster { @@ -15,9 +14,9 @@ public class DisguiseEnderman extends DisguiseMonster { super(EntityType.ENDERMAN, entity); - DataWatcher.a(16, new ProtocolData.ByteShort( (short) 0 ) ); - DataWatcher.a(17, new Byte((byte)0)); - DataWatcher.a(18, new Byte((byte)0)); + DataWatcher.a(16, new Short( (short) 0)); + DataWatcher.a(17, new Byte( (byte) 0)); + DataWatcher.a(18, new Byte( (byte) 0)); int i = PotionBrewer.a(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id, 777))); DataWatcher.watch(8, Byte.valueOf((byte)(PotionBrewer.b(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id, 777))) ? 1 : 0))); @@ -29,12 +28,12 @@ public class DisguiseEnderman extends DisguiseMonster super.UpdateDataWatcher(); DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0)))); - DataWatcher.watch(16, new ProtocolData.ByteShort( DataWatcher.getShort(16) )); + DataWatcher.watch(16, DataWatcher.getShort(16)); } public void SetCarriedId(int i) { - DataWatcher.watch(16, new ProtocolData.ByteShort( (short)(i & 0xFF)) ); + DataWatcher.watch(16, new Short( (short)(i & 0xFF)) ); } public int GetCarriedId() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java index 46345018d..a5526300d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHorse.java @@ -1,7 +1,6 @@ package mineplex.core.disguise.disguises; import org.bukkit.entity.*; -import org.spigotmc.ProtocolData; public class DisguiseHorse extends DisguiseAnimal { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java index 1df5aedfd..e2faae19d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseHuman.java @@ -1,15 +1,13 @@ package mineplex.core.disguise.disguises; -import org.spigotmc.ProtocolData; - public abstract class DisguiseHuman extends DisguiseLiving { public DisguiseHuman(org.bukkit.entity.Entity entity) { super(entity); - DataWatcher.a(10, new ProtocolData.HiddenByte( (byte) 0 ) ); // Spigot - protocol patch, handle new metadata value - DataWatcher.a(16, new ProtocolData.DualByte( (byte) 0, (byte) 0 ) ); + DataWatcher.a(10, (byte) 0); // todo + DataWatcher.a(16, (byte) 0); DataWatcher.a(17, Float.valueOf(0.0F)); DataWatcher.a(18, Integer.valueOf(0)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java index 2fff7c2f0..3e068439a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java @@ -13,12 +13,6 @@ public abstract class DisguiseInsentient extends DisguiseLiving DataWatcher.a(3, Byte.valueOf((byte) 0)); DataWatcher.a(2, ""); - - if (!(this instanceof DisguiseArmorStand)) - { - DataWatcher.a(11, Byte.valueOf((byte) 0)); - DataWatcher.a(10, ""); - } } public void setName(String name) @@ -36,19 +30,17 @@ public abstract class DisguiseInsentient extends DisguiseLiving } } - DataWatcher.watch(10, name); DataWatcher.watch(2, name); } public boolean hasCustomName() { - return DataWatcher.getString(10).length() > 0; + return DataWatcher.getString(2).length() > 0; } public void setCustomNameVisible(boolean visible) { - DataWatcher.watch(11, Byte.valueOf((byte)(visible ? 1 : 0))); DataWatcher.watch(3, Byte.valueOf((byte)(visible ? 1 : 0))); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java index 855de31de..8c1136eac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseLiving.java @@ -4,12 +4,12 @@ import java.util.ArrayList; import java.util.Random; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; -import net.minecraft.server.v1_7_R4.EntityLiving; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R3.EntityLiving; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; public abstract class DisguiseLiving extends DisguiseBase { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java index 26e80e664..c5a50d924 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java @@ -1,9 +1,8 @@ package mineplex.core.disguise.disguises; -import net.minecraft.server.v1_7_R4.EnumEntitySize; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; public class DisguiseMagmaCube extends DisguiseInsentient { @@ -29,9 +28,9 @@ public class DisguiseMagmaCube extends DisguiseInsentient PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); packet.a = Entity.getId(); packet.b = (byte) 62; - packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); + packet.c = (int)MathHelper.floor(Entity.locX * 32D); packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.e = (int)MathHelper.floor(Entity.locZ * 32D); packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMooshroom.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMooshroom.java new file mode 100644 index 000000000..8b6d64485 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMooshroom.java @@ -0,0 +1,16 @@ +package mineplex.core.disguise.disguises; + +import org.bukkit.entity.*; + +public class DisguiseMooshroom extends DisguiseAnimal +{ + public DisguiseMooshroom(org.bukkit.entity.Entity entity) + { + super(EntityType.MUSHROOM_COW, entity); + } + + public String getHurtSound() + { + return "mob.cow.hurt"; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 5fcff15ba..d5f933f83 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -5,18 +5,20 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; -import org.spigotmc.ProtocolData; + +import com.mojang.authlib.GameProfile; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayInSettings; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayInSettings; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R3.WorldSettings; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; public class DisguisePlayer extends DisguiseHuman { @@ -67,37 +69,21 @@ public class DisguisePlayer extends DisguiseHuman public boolean getSneaking() { return _sneaking; - } - - public Packet getOldInfoPacket(boolean add) - { - PacketPlayOutPlayerInfo playerInfo = new PacketPlayOutPlayerInfo(); - - if(Entity instanceof Player) - { - playerInfo.username = Entity.getName(); - playerInfo.action = add ? 0 : 4; - playerInfo.ping = 90; - playerInfo.player = ((CraftPlayer) (Player) Entity).getProfile(); - playerInfo.gamemode = 0; } - return playerInfo; - } + public Packet getNewInfoPacket(boolean add) + { + PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo(); + newDisguiseInfo.a = add ? EnumPlayerInfoAction.ADD_PLAYER : EnumPlayerInfoAction.REMOVE_PLAYER; - public Packet getNewInfoPacket(boolean add) - { - PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo(); - newDisguiseInfo.username = _profile.getName(); - newDisguiseInfo.action = add ? 0 : 4; - newDisguiseInfo.ping = 90; - newDisguiseInfo.player = _profile; - newDisguiseInfo.gamemode = 0; + PacketPlayOutPlayerInfo.PlayerInfoData info = newDisguiseInfo.new PlayerInfoData(_profile, 90, + WorldSettings.EnumGamemode.SURVIVAL, null); - return newDisguiseInfo; - } + newDisguiseInfo.b.add(info); + + return newDisguiseInfo; + } - @SuppressWarnings("static-access") @Override public void UpdateDataWatcher() { @@ -119,7 +105,7 @@ public class DisguisePlayer extends DisguiseHuman PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(); packet.a = Entity.getId(); - packet.b = _profile; + packet.b = _profile.getId(); packet.c = MathHelper.floor(loc.getX() * 32.0D); packet.d = MathHelper.floor(loc.getY() * 32.0D); packet.e = MathHelper.floor(loc.getZ() * 32.0D); @@ -135,7 +121,7 @@ public class DisguisePlayer extends DisguiseHuman { PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(); packet.a = Entity.getId(); - packet.b = _profile; + packet.b = _profile.getId(); packet.c = MathHelper.floor(Entity.locX * 32.0D); packet.d = MathHelper.floor(Entity.locY * 32.0D); packet.e = MathHelper.floor(Entity.locZ * 32.0D); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java index cdde5fd6e..95b70ce50 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java @@ -1,9 +1,8 @@ package mineplex.core.disguise.disguises; -import net.minecraft.server.v1_7_R4.EnumEntitySize; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; public class DisguiseRabbit extends DisguiseInsentient { @@ -25,9 +24,9 @@ public class DisguiseRabbit extends DisguiseInsentient PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); packet.a = Entity.getId(); packet.b = (byte) 101; - packet.c = (int) EnumEntitySize.SIZE_2.a(Entity.locX); + packet.c = (int) MathHelper.floor(Entity.locX * 32D); packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int) EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.e = (int) MathHelper.floor(Entity.locZ * 32D); packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java index fd1b9e476..ddb8bab5c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java @@ -1,9 +1,8 @@ package mineplex.core.disguise.disguises; -import net.minecraft.server.v1_7_R4.EnumEntitySize; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; public class DisguiseSlime extends DisguiseInsentient { @@ -29,9 +28,9 @@ public class DisguiseSlime extends DisguiseInsentient PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); packet.a = Entity.getId(); packet.b = (byte) 55; - packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); + packet.c = (int) MathHelper.floor(Entity.locX * 32D); packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); - packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.e = (int)MathHelper.floor(Entity.locZ * 32D); packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWither.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWither.java index 7b290a681..45a6b13a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWither.java @@ -15,12 +15,12 @@ public class DisguiseWither extends DisguiseMonster DataWatcher.a(20, new Integer(0)); } - public int ca() + public int getInvulTime() { return DataWatcher.getInt(20); } - public void s(int i) + public void setInvulTime(int i) { DataWatcher.watch(20, Integer.valueOf(i)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java index e083e530e..90497a983 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java @@ -1,6 +1,5 @@ package mineplex.core.disguise.disguises; -import net.minecraft.server.v1_7_R4.BlockCloth; import org.bukkit.entity.*; public class DisguiseWolf extends DisguiseTameableAnimal @@ -11,7 +10,7 @@ public class DisguiseWolf extends DisguiseTameableAnimal DataWatcher.a(18, new Float(20F)); DataWatcher.a(19, new Byte((byte)0)); - DataWatcher.a(20, new Byte((byte)BlockCloth.b(1))); + DataWatcher.a(20, new Byte((byte)14)); } public boolean isAngry() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 31a02818b..acffc12b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -5,11 +5,11 @@ import java.sql.SQLException; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; +import com.google.gson.Gson; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.ClientWebResponseEvent; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java index c54875afc..31778c4f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/AddFriendPage.java @@ -3,23 +3,28 @@ package mineplex.core.friend.ui; import mineplex.core.command.CommandCenter; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.friend.FriendManager; import mineplex.core.itemstack.ItemBuilder; -import net.minecraft.server.v1_7_R4.ContainerAnvil; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.ChatMessage; +import net.minecraft.server.v1_8_R3.ContainerAnvil; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; public class AddFriendPage implements Listener @@ -30,7 +35,7 @@ public class AddFriendPage implements Listener public AnvilContainer(EntityHuman entity) { - super(entity.inventory, entity.world, 0, 0, 0, entity); + super(entity.inventory, entity.world, new BlockPosition(0, 0, 0), entity); } @Override @@ -47,10 +52,10 @@ public class AddFriendPage implements Listener if (getSlot(2).hasItem()) { - net.minecraft.server.v1_7_R4.ItemStack itemstack = getSlot(2).getItem(); + net.minecraft.server.v1_8_R3.ItemStack itemstack = getSlot(2).getItem(); if (StringUtils.isBlank(origString)) - itemstack.t(); + itemstack.r(); else { itemstack.c(this.n); @@ -91,6 +96,15 @@ public class AddFriendPage implements Listener _currentInventory.clear(); HandlerList.unregisterAll(this); } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + if (event.getPlayer() == _player) + { + unregisterListener(); + } + } @EventHandler public void onInventoryClick(InventoryClickEvent event) @@ -153,9 +167,9 @@ public class AddFriendPage implements Listener AnvilContainer container = new AnvilContainer(p); int c = p.nextContainerCounter(); - PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(c, 8, "Repairing", 0, true); + PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(c, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0])); - p.playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(_player, packet); // Set their active container to the container p.activeContainer = container; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java index a7e629744..88d7db15c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/FriendsGUI.java @@ -8,8 +8,8 @@ import java.util.Iterator; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; @@ -18,9 +18,10 @@ import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import net.minecraft.server.v1_7_R4.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityPlayer; import mineplex.core.command.CommandCenter; import mineplex.core.common.util.C; @@ -130,7 +131,7 @@ public class FriendsGUI implements Listener ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0)); builder.setTitle(C.cWhite + C.Bold + friend.Name); - builder.setPlayerHead(friend.Name); +// builder.setPlayerHead(friend.Name); builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline")); @@ -275,7 +276,7 @@ public class FriendsGUI implements Listener ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0)); builder.setTitle(C.cWhite + C.Bold + friend.Name); - builder.setPlayerHead(friend.Name); +// builder.setPlayerHead(friend.Name); builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline")); @@ -573,6 +574,15 @@ public class FriendsGUI implements Listener } } + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + if (event.getPlayer() == _player) + { + unregisterListener(); + } + } + @EventHandler public void OnInventoryClose(InventoryCloseEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/LineTracker.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/LineTracker.java deleted file mode 100644 index f7f7341f5..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/LineTracker.java +++ /dev/null @@ -1,85 +0,0 @@ -package mineplex.core.friend.ui; - -import java.util.UUID; - -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; -import net.minecraft.util.com.mojang.authlib.GameProfile; - -public class LineTracker -{ - private String _line = null; - private String _oldLine = null; - private PacketPlayOutPlayerInfo _clearOldPacket; - private PacketPlayOutPlayerInfo _addNewPacket; - private PacketPlayOutPlayerInfo _clearNewPacket; - - public LineTracker(String line) - { - setLine(line); - } - - public boolean setLine(String s) - { - if (s != null && s.length() > 16) - s = s.substring(0, 16); - - if (_line != null && _line.compareTo(s) == 0) - return false; - - _oldLine = _line; - _line = s; - - if (_oldLine != null) - { - _clearOldPacket = new PacketPlayOutPlayerInfo(); - _clearOldPacket.username = _oldLine; - _clearOldPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER; - _clearOldPacket.ping = 0; - _clearOldPacket.player = new GameProfile(UUID.randomUUID(), _oldLine); - } - - if (_line != null) - { - _addNewPacket = new PacketPlayOutPlayerInfo(); - _addNewPacket.username = _line; - _addNewPacket.action = PacketPlayOutPlayerInfo.ADD_PLAYER; - _addNewPacket.ping = 0; - _addNewPacket.player = new GameProfile(UUID.randomUUID(), _line); - - _clearNewPacket = new PacketPlayOutPlayerInfo(); - _clearNewPacket.username = _line; - _clearNewPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER; - _clearNewPacket.ping = 0; - _clearNewPacket.player = new GameProfile(UUID.randomUUID(), _line); - } - - return true; - } - - public void displayLineToPlayer(EntityPlayer entityPlayer) - { - if (_oldLine != null) - { - entityPlayer.playerConnection.sendPacket(_clearOldPacket); - } - - if (_line != null) - { - entityPlayer.playerConnection.sendPacket(_addNewPacket); - } - } - - public void removeLineForPlayer(EntityPlayer entityPlayer) - { - if (_line != null) - { - entityPlayer.playerConnection.sendPacket(_clearNewPacket); - } - } - - public void clearOldLine() - { - _oldLine = null; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/TabList.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/TabList.java deleted file mode 100644 index d3ecec626..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/ui/TabList.java +++ /dev/null @@ -1,116 +0,0 @@ -package mineplex.core.friend.ui; - -import java.util.HashSet; - -import net.minecraft.server.v1_7_R4.EntityPlayer; - -import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; - -import mineplex.core.common.util.NautHashMap; - -public class TabList implements Listener -{ - private static int MAX_SLOTS = 64; - private static int COLUMN_SLOTS = 16; - - private static NautHashMap _invisibleHolders = new NautHashMap(); - - private NautHashMap _tabSlots = new NautHashMap(); - private HashSet _updatedSlots = new HashSet(); - - private boolean _update; - - static { - String spaces = ""; - - for (int i=0; i < MAX_SLOTS; i++) - { - int markerSymbol = i / COLUMN_SLOTS; - String symbol = null; - - if (i % COLUMN_SLOTS == 0) - spaces = ""; - else - spaces += " "; - - if (markerSymbol == 0) - { - symbol = ChatColor.GREEN + ""; - } - else if (markerSymbol == 1) - { - symbol = ChatColor.RED + ""; - } - else if (markerSymbol == 2) - { - symbol = ChatColor.BLUE + ""; - } - else if (markerSymbol == 3) - { - symbol = ChatColor.BLACK + ""; - } - - _invisibleHolders.put(i, symbol + spaces); - } - } - - public TabList() - { - for (Integer i=0; i < MAX_SLOTS; i++) - { - _tabSlots.put(i, new LineTracker(_invisibleHolders.get(i))); - } - } - - public void set(int column, int row, String lineContent) - { - int index = row * 4 + column; - - if (index >= MAX_SLOTS) - return; - - if (lineContent == null || lineContent.isEmpty()) - lineContent = _invisibleHolders.get(index); - - if (_tabSlots.get(index).setLine(lineContent)) - { - _updatedSlots.add(index); - _update = true; - } - } - - public void refreshForPlayer(Player player) - { - EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - - int indexChanged = MAX_SLOTS; - - for (int i=0; i < MAX_SLOTS; i++) - { - if (indexChanged == MAX_SLOTS && _updatedSlots.contains(i)) - { - indexChanged = i; - } - else if (indexChanged != MAX_SLOTS && !_updatedSlots.contains(i)) - { - _tabSlots.get(i).removeLineForPlayer(entityPlayer); - } - } - - for (int i=indexChanged; i < MAX_SLOTS; i++) - { - _tabSlots.get(i).displayLineToPlayer(entityPlayer); - } - - _update = false; - _updatedSlots.clear(); - } - - public boolean shouldUpdate() - { - return _update; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java index c5d37b9c5..7fb434ae2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java @@ -21,8 +21,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java index 112f9e1a0..bb7ef9c8f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemEtherealPearl.java @@ -8,7 +8,7 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EnderPearl; import org.bukkit.entity.Item; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java index 44eb1ca17..a439aca63 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java @@ -45,7 +45,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false); - Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, + Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f); //Inform diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java index 3ffa7f9af..12537a599 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFootball.java @@ -4,7 +4,7 @@ import java.util.HashSet; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.entity.Bat; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Item; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java index 90c80cc1c..ea3a786ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java @@ -57,7 +57,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown UtilAction.velocity(item, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, + Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true, null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java index 894c1e4d1..28700ac7f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemPaintbrush.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import java.util.List; import org.bukkit.Location; @@ -111,7 +112,7 @@ public class ItemPaintbrush extends ItemGadget if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD)) return; - Block block = player.getTargetBlock(null, 100); + Block block = player.getTargetBlock((HashSet)null, 100); if (block == null || block.getType() != Material.STAINED_CLAY) return; @@ -158,7 +159,7 @@ public class ItemPaintbrush extends ItemGadget continue; } - Block block = player.getTargetBlock(null, 100); + Block block = player.getTargetBlock((HashSet)null, 100); if (block == null || block.getType() != Material.WOOL) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java index 0d6d18762..3b0bfe79d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java @@ -114,7 +114,7 @@ public class MorphBat extends MorphGadget implements IThrown UtilAction.velocity(item, player.getLocation().getDirection(), 0.01, true, -0.3, 0, 10, false); - Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, + Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true, null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java index 356f7fe7b..628531f40 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphGeno.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets; -import net.minecraft.util.com.mojang.authlib.GameProfile; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -9,6 +7,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.*; +import com.mojang.authlib.GameProfile; + import mineplex.core.common.util.C; import mineplex.core.common.util.ProfileLoader; import mineplex.core.common.util.UUIDFetcher; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java index e09f88086..a262c149e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphNotch.java @@ -1,12 +1,12 @@ package mineplex.core.gadget.gadgets; -import net.minecraft.util.com.mojang.authlib.GameProfile; - import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.*; +import com.mojang.authlib.GameProfile; + import mineplex.core.common.util.C; import mineplex.core.common.util.ProfileLoader; import mineplex.core.common.util.UUIDFetcher; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java index c2f0d04b1..e0a864177 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java @@ -97,7 +97,7 @@ public class MorphVillager extends MorphGadget implements IThrown UtilAction.velocity(gem, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); //Throw - Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, + Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true, null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f); Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java index ac5c3aaa8..981e9cf53 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java @@ -27,7 +27,7 @@ public class ParticleLegend extends ParticleGadget C.cGreen + "Unlocked with Legend Rank", }, -2, - Material.ENDER_PORTAL, (byte)0); + Material.ENDER_PORTAL_FRAME, (byte)0); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 652b7cfdb..08dd68421 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -22,7 +22,7 @@ public enum GameDisplay Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15), Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16), //FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17), - Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18), + Gravity("Gravity", Material.SEA_LANTERN, (byte)0, GameCategory.EXTRA, 18), Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19), HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/Giveaway.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/Giveaway.java new file mode 100644 index 000000000..2d6eeeca4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/Giveaway.java @@ -0,0 +1,58 @@ +package mineplex.core.giveaway; + +public class Giveaway +{ + private int _id; + private String _name; + private String _prettyName; + private String _header; + private String _message; + private boolean _notifyNetwork; + private int _notifyCooldown; + + public Giveaway(int id, String name, String prettyName, String header, String message, boolean notifyNetwork, int notifyCooldown) + { + _id = id; + _name = name; + _prettyName = prettyName; + _header = header; + _message = message; + _notifyNetwork = notifyNetwork; + _notifyCooldown = notifyCooldown; + } + + public int getId() + { + return _id; + } + + public String getName() + { + return _name; + } + + public String getPrettyName() + { + return _prettyName; + } + + public String getMessage() + { + return _message; + } + + public String getHeader() + { + return _header; + } + + public boolean isNotifyNetwork() + { + return _notifyNetwork; + } + + public int getNotifyCooldown() + { + return _notifyCooldown; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayCooldown.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayCooldown.java new file mode 100644 index 000000000..896a777e6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayCooldown.java @@ -0,0 +1,30 @@ +package mineplex.core.giveaway; + +public class GiveawayCooldown +{ + private int _id; + private String _name; + private int _cooldown; + + public GiveawayCooldown(int id, String name, int cooldown) + { + _id = id; + _name = name; + _cooldown = cooldown; + } + + public int getId() + { + return _id; + } + + public String getName() + { + return _name; + } + + public int getCooldown() + { + return _cooldown; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java new file mode 100644 index 000000000..bfcfa4981 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java @@ -0,0 +1,180 @@ +package mineplex.core.giveaway; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.giveaway.redis.GiveawayMessage; +import mineplex.core.giveaway.redis.GiveawayMessageHandler; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.Region; +import mineplex.serverdata.commands.ServerCommandManager; + +public class GiveawayManager extends MiniDbClientPlugin +{ + private CoreClientManager _clientManager; + private ServerStatusManager _statusManager; + private GiveawayRepository _repository; + private HashMap _giveawayMap; + private HashMap _cooldownMap; + + public GiveawayManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager) + { + super("Giveaway Manager", plugin, clientManager); + _clientManager = clientManager; + _statusManager = statusManager; + _repository = new GiveawayRepository(plugin); + _giveawayMap = _repository.loadGiveaways(); + _cooldownMap = _repository.loadCooldowns(); + + ServerCommandManager.getInstance().registerCommandType("GiveawayMessage", GiveawayMessage.class, new GiveawayMessageHandler()); + } + + public void attemptToGiveaway(final String giveawayName, final String cooldownName, final Player player, final Callback callback) + { + final int accountId = _clientManager.getAccountId(player); + + if (accountId == -1) + { + callback.run(new GiveawayResponse(GiveawayResponse.FailReason.INVALID_ACCOUNT_ID)); + return; + } + + if (!hasGiveaway(giveawayName)) + { + callback.run(new GiveawayResponse(GiveawayResponse.FailReason.INVALID_GIVEAWAY)); + return; + } + + if (!hasCooldown(cooldownName)) + { + callback.run(new GiveawayResponse(GiveawayResponse.FailReason.INVALID_COOLDOWN)); + return; + } + + final Giveaway giveaway = _giveawayMap.get(giveawayName); + final GiveawayCooldown cooldown = _cooldownMap.get(cooldownName); + runAsync(new Runnable() + { + @Override + public void run() + { + final GiveawayResponse response; + + if (_repository.canGiveaway(accountId, giveawayName, cooldownName)) + { + UUID uuid = UUID.randomUUID(); + if (_repository.addGiveaway(accountId, giveaway.getId(), cooldown.getId(), _statusManager.getRegion(), _statusManager.getCurrentServerName(), uuid)) + { + response = new GiveawayResponse(uuid); + } + else + { + response = new GiveawayResponse(GiveawayResponse.FailReason.QUERY_FAILED); + } + } + else + { + response = new GiveawayResponse(GiveawayResponse.FailReason.CANNOT_GIVEAWAY); + } + + runSync(new Runnable() + { + @Override + public void run() + { + try + { + if (response.isSuccess()) + { + Get(player).addGiveawayReward(new GiveawayReward(giveaway.getPrettyName(), response.getGiveawayId().toString().replace("-", ""))); + notifyPlayer(player); + + GiveawayMessage message = new GiveawayMessage(giveawayName, player.getName(), giveaway.getMessage(), giveaway.getHeader()); + message.publish(); + } + } + catch (Exception e) + { + + } + + if (callback != null) callback.run(response); + } + }); + } + }); + } + + public boolean hasGiveaway(String name) + { + return _giveawayMap.containsKey(name); + } + + public boolean hasCooldown(String name) + { + return _cooldownMap.containsKey(name); + } + + @EventHandler + public void notifyGiveaway(UpdateEvent event) + { + if (event.getType() == UpdateType.MIN_01) + { + for (Player player : UtilServer.getPlayers()) + notifyPlayer(player); + } + } + + @EventHandler + public void join(PlayerJoinEvent event) + { + notifyPlayer(event.getPlayer()); + } + + public void notifyPlayer(Player player) + { + PlayerGiveawayData data = Get(player); + if (!data.getGiveawayRewards().isEmpty()) + { + GiveawayReward reward = data.getGiveawayRewards().poll(); + UtilPlayer.message(player, F.main("Giveaway", "You have a prize to claim!")); + UtilPlayer.message(player, F.main("Giveaway", "You have won " + F.elem(reward.getName()))); + UtilPlayer.message(player, F.main("Giveaway", "To claim your reward please take a screenshot and contact support")); + UtilPlayer.message(player, F.main("Giveaway", "Reward Key: " + F.elem(reward.getUuid()))); + } + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + Set(playerName, _repository.loadPlayerGiveaway(resultSet)); + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT g.prettyName, ag.uuid FROM accountGiveaway AS ag INNER JOIN giveaway AS g ON ag.giveawayId = g.id WHERE ag.claimed = 0 AND ag.accountId = " + accountId + ";"; + } + + @Override + protected PlayerGiveawayData AddPlayer(String player) + { + return new PlayerGiveawayData(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java new file mode 100644 index 000000000..c8cac2179 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java @@ -0,0 +1,134 @@ +package mineplex.core.giveaway; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.HashMap; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnInt; +import mineplex.core.database.column.ColumnVarChar; +import mineplex.serverdata.Region; + +public class GiveawayRepository extends RepositoryBase +{ + private static final String INSERT_GIVEAWAY = "INSERT INTO Account.accountGiveaway (giveawayId, accountId, cooldownId, region, serverName, time, uuid) VALUES (?, ?, ?, ?, ?, now(), ?)"; + private static final String LOAD_GIVEAWAY = "SELECT id, name, prettyName, header, message, max, notifyNetwork, notifyCooldown, canWinTwice FROM Account.giveaway WHERE enabled = TRUE"; + private static final String LOAD_COOLDOWN = "SELECT id, name, cooldown FROM Account.giveawayCooldown"; + + public GiveawayRepository(JavaPlugin plugin) + { + super(plugin, DBPool.ACCOUNT); + } + + public boolean canGiveaway(int accountId, String giveawayName, String cooldownName) + { + try (Connection connection = getConnection(); + CallableStatement callableStatement = connection.prepareCall("{call check_giveaway(?, ?, ?, ?)}")) + { + callableStatement.setInt(1, accountId); + callableStatement.setString(2, giveawayName); + callableStatement.setString(3, cooldownName); + callableStatement.registerOutParameter(4, Types.BOOLEAN); + callableStatement.executeUpdate(); + + boolean pass = callableStatement.getBoolean(4); + return pass; + } + catch (Exception e) + { + } + return false; + } + + public boolean addGiveaway(int accountId, int giveawayId, int cooldownId, Region region, String serverName, UUID uuid) + { + return 1 == executeUpdate(INSERT_GIVEAWAY, new ColumnInt("giveawayId", giveawayId), new ColumnInt("accountId", accountId), + new ColumnInt("cooldownId", cooldownId), new ColumnVarChar("region", 10, region.name()), new ColumnVarChar("serverName", 64, serverName), + new ColumnVarChar("uuid", 32, uuid.toString().replaceAll("-", ""))); + } + + public HashMap loadGiveaways() + { + final HashMap map = new HashMap(); + executeQuery(LOAD_GIVEAWAY, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + int id = resultSet.getInt(1); + String name = resultSet.getString(2); + String prettyName = resultSet.getString(3); + String header = resultSet.getString(4); + String message = resultSet.getString(5); + int max = resultSet.getInt(6); + boolean notifyNetwork = resultSet.getBoolean(7); + int notifyCooldown = resultSet.getInt(8); + boolean canWinTwice = resultSet.getBoolean(9); + + Giveaway giveaway = new Giveaway(id, name, prettyName, header, message, notifyNetwork, notifyCooldown); + map.put(name, giveaway); + } + } + }); + return map; + } + + public HashMap loadCooldowns() + { + final HashMap map = new HashMap(); + executeQuery(LOAD_COOLDOWN, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + int id = resultSet.getInt(1); + String name = resultSet.getString(2); + int cooldown = resultSet.getInt(3); + GiveawayCooldown cd = new GiveawayCooldown(id, name, cooldown); + map.put(name, cd); + } + } + }); + return map; + } + + public PlayerGiveawayData loadPlayerGiveaway(ResultSet resultSet) throws SQLException + { + PlayerGiveawayData giveawayData = new PlayerGiveawayData(); + + while (resultSet.next()) + { + String name = resultSet.getString(1); + String uuid = resultSet.getString(2); + GiveawayReward reward = new GiveawayReward(name, uuid); + giveawayData.addGiveawayReward(reward); + } + + return giveawayData; + } + + @Override + protected void initialize() + { + + } + + @Override + protected void update() + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayResponse.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayResponse.java new file mode 100644 index 000000000..872cf87a2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayResponse.java @@ -0,0 +1,52 @@ +package mineplex.core.giveaway; + +import java.util.UUID; + +public class GiveawayResponse +{ + private boolean _success; + private FailReason _failReason; + private UUID _giveawayId; + + /** + * Success Constructor + * @param giveawayId + */ + protected GiveawayResponse(UUID giveawayId) + { + _success = true; + _failReason = null; + _giveawayId = giveawayId; + } + + /** + * Faulure constructor + * @param failReason + */ + protected GiveawayResponse(FailReason failReason) + { + _success = false; + _failReason = failReason; + _giveawayId = null; + } + + public boolean isSuccess() + { + return _success; + } + + public UUID getGiveawayId() + { + return _giveawayId; + } + + public FailReason getFailReason() + { + return _failReason; + } + + public static enum FailReason + { + INVALID_GIVEAWAY, INVALID_COOLDOWN, CANNOT_GIVEAWAY, INVALID_ACCOUNT_ID, QUERY_FAILED; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayReward.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayReward.java new file mode 100644 index 000000000..21be3cd75 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayReward.java @@ -0,0 +1,23 @@ +package mineplex.core.giveaway; + +public class GiveawayReward +{ + private String _name; + private String _uuid; + + public GiveawayReward(String name, String uuid) + { + _name = name; + _uuid = uuid; + } + + public String getName() + { + return _name; + } + + public String getUuid() + { + return _uuid; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/PlayerGiveawayData.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/PlayerGiveawayData.java new file mode 100644 index 000000000..01f984fcb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/PlayerGiveawayData.java @@ -0,0 +1,26 @@ +package mineplex.core.giveaway; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +public class PlayerGiveawayData +{ + private Queue _giveawayRewards; + + public PlayerGiveawayData() + { + _giveawayRewards = new LinkedList(); + } + + public void addGiveawayReward(GiveawayReward reward) + { + _giveawayRewards.add(reward); + } + + public Queue getGiveawayRewards() + { + return _giveawayRewards; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/redis/GiveawayMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/redis/GiveawayMessage.java new file mode 100644 index 000000000..619cd7a33 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/redis/GiveawayMessage.java @@ -0,0 +1,39 @@ +package mineplex.core.giveaway.redis; + +import mineplex.serverdata.commands.ServerCommand; + +public class GiveawayMessage extends ServerCommand +{ + private String _giveawayName; + private String _playerName; + private String _giveawayHeader; + private String _giveawayMessage; + + public GiveawayMessage(String giveawayName, String playerName, String giveawayMessage, String giveawayHeader) + { + _giveawayName = giveawayName; + _playerName = playerName; + _giveawayMessage = giveawayMessage; + _giveawayHeader = giveawayHeader; + } + + public String getPlayerName() + { + return _playerName; + } + + public String getGiveawayMessage() + { + return _giveawayMessage; + } + + public String getGiveawayHeader() + { + return _giveawayHeader; + } + + public String getGiveawayName() + { + return _giveawayName; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/redis/GiveawayMessageHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/redis/GiveawayMessageHandler.java new file mode 100644 index 000000000..d01e14858 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/redis/GiveawayMessageHandler.java @@ -0,0 +1,45 @@ +package mineplex.core.giveaway.redis; + +import java.util.HashMap; + +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; + +public class GiveawayMessageHandler implements CommandCallback +{ + private HashMap _cooldownMap; + + public GiveawayMessageHandler() + { + _cooldownMap = new HashMap(); + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof GiveawayMessage) + { + GiveawayMessage message = ((GiveawayMessage) command); + + // %p - player name + String headerText = message.getGiveawayHeader(); + String chatMessage = message.getGiveawayMessage().replaceAll("%p", message.getPlayerName()); + + // Chat Colors + headerText = ChatColor.translateAlternateColorCodes('&', headerText); + chatMessage = ChatColor.translateAlternateColorCodes('&', chatMessage); + + UtilTextMiddle.display(headerText, chatMessage, 20, 80, 20); + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index fd5311707..6be18e222 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -7,22 +7,18 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; - import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; @@ -34,7 +30,6 @@ public class Hologram BLACKLIST, WHITELIST; } - private Packet _destroy1_7; private Packet _destroy1_8; /** * 1.7 packets uses both EntityIDs while 1.8 uses only the first. @@ -50,7 +45,6 @@ public class Hologram private Location _location; private boolean _makeDestroyPackets = true; private boolean _makeSpawnPackets = true; - private Packet[] _packets1_7; private Packet[] _packets1_8; private HashSet _playersInList = new HashSet(); private ArrayList _playersTracking = new ArrayList(); @@ -58,6 +52,7 @@ public class Hologram private HologramTarget _target = HologramTarget.BLACKLIST; private int _viewDistance = 70; protected Vector relativeToEntity; + private boolean _hideBoundingBox; public Hologram(HologramManager hologramManager, Location location, String... text) { @@ -83,6 +78,17 @@ public class Hologram return this; } + /** + * Warning! Bounding box if hidden will hide holograms for 1.8 to 1.8.2 + * + * @return + */ + public Hologram setHideBoundingBox() + { + _hideBoundingBox = true; + return this; + } + /** * Is there a player entry in the hologram for Whitelist and Blacklist */ @@ -99,7 +105,7 @@ public class Hologram return _playersInList.contains(player); } - protected Packet getDestroyPacket(Player player) + protected Packet getDestroyPacket() { if (_makeDestroyPackets) { @@ -107,7 +113,7 @@ public class Hologram _makeDestroyPackets = false; } - return UtilPlayer.is1_8(player) ? _destroy1_8 : _destroy1_7; + return _destroy1_8; } public Entity getEntityFollowing() @@ -153,7 +159,7 @@ public class Hologram return _playersTracking; } - protected Packet[] getSpawnPackets(Player player) + protected Packet[] getSpawnPackets() { if (_makeSpawnPackets) { @@ -161,7 +167,7 @@ public class Hologram _makeSpawnPackets = false; } - return UtilPlayer.is1_8(player) ? _packets1_8 : _packets1_7; + return _packets1_8; } /** @@ -219,26 +225,20 @@ public class Hologram private void makeDestroyPacket() { - int[] entityIds1_7 = new int[_entityIds.size() * 2]; int[] entityIds1_8 = new int[_entityIds.size()]; for (int i = 0; i < _entityIds.size(); i++) { Entry entry = _entityIds.get(i); - entityIds1_7[i * 2] = entry.getKey(); - entityIds1_7[(i * 2) + 1] = entry.getValue(); - entityIds1_8[i] = entry.getKey(); } - _destroy1_7 = new PacketPlayOutEntityDestroy(entityIds1_7); _destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8); } private void makeSpawnPackets() { - _packets1_7 = new Packet[_hologramText.length * 3]; _packets1_8 = new Packet[_hologramText.length * 1]; if (_entityIds.size() < _hologramText.length) @@ -263,13 +263,6 @@ public class Hologram { Entry entityIds = this._entityIds.get(textRow); - Packet[] packets1_7 = makeSpawnPackets1_7(textRow, entityIds.getKey(), entityIds.getValue(), _hologramText[textRow]); - - for (int i = 0; i < packets1_7.length; i++) - { - _packets1_7[(textRow * 3) + i] = packets1_7[i]; - } - Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _hologramText[textRow]); for (int i = 0; i < packets1_8.length; i++) @@ -279,47 +272,6 @@ public class Hologram } } - private Packet[] makeSpawnPackets1_7(int height, int witherId, int horseId, String horseName) - { - // Spawn wither skull - PacketPlayOutSpawnEntity spawnWitherSkull = new PacketPlayOutSpawnEntity(); - - spawnWitherSkull.a = witherId; - spawnWitherSkull.b = (int) (getLocation().getX() * 32); - spawnWitherSkull.c = (int) ((getLocation().getY() + 54.6 + ((double) height * 0.285D)) * 32); - spawnWitherSkull.d = (int) (getLocation().getZ() * 32); - spawnWitherSkull.j = 66; - - // Spawn horse - PacketPlayOutSpawnEntityLiving spawnHorse = new PacketPlayOutSpawnEntityLiving(); - DataWatcher watcher = new DataWatcher(null); - - spawnHorse.a = horseId; - spawnHorse.b = 100; - spawnHorse.c = (int) (getLocation().getX() * 32); - spawnHorse.d = (int) ((getLocation().getY() + 54.83 + ((double) height * 0.285D) + 0.23D) * 32); - spawnHorse.e = (int) (getLocation().getZ() * 32); - spawnHorse.l = watcher; - - // Setup datawatcher - watcher.a(0, (byte) 0); - watcher.a(1, (short) 300); - watcher.a(10, horseName); - watcher.a(11, (byte) 1); - watcher.a(12, -1700000); - - // Make horse ride wither - PacketPlayOutAttachEntity attachEntity = new PacketPlayOutAttachEntity(); - - attachEntity.b = horseId; - attachEntity.c = witherId; - - return new Packet[] - { - spawnWitherSkull, spawnHorse, attachEntity - }; - } - private Packet[] makeSpawnPackets1_8(int textRow, int entityId, String lineOfText) { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); @@ -328,7 +280,7 @@ public class Hologram packet.a = entityId; packet.b = 30; packet.c = (int) (getLocation().getX() * 32); - packet.d = (int) ((getLocation().getY() + -2.1 + ((double) textRow * 0.285)) * 32); + packet.d = (int) ((getLocation().getY() + (_hideBoundingBox ? 0 : -2.1) + ((double) textRow * 0.285)) * 32); packet.e = (int) (getLocation().getZ() * 32); packet.l = watcher; @@ -336,7 +288,11 @@ public class Hologram watcher.a(0, (byte) 32); watcher.a(2, lineOfText); watcher.a(3, (byte) 1); - // watcher.a(10, (byte) 16); // TODO Uncomment after we can enforce 1.8.3 + + if (_hideBoundingBox) + { + watcher.a(10, (byte) 16); // TODO Uncomment after we can enforce 1.8.3 + } // Also correct hologram positioning return new Packet[] @@ -416,7 +372,7 @@ public class Hologram if (player.getWorld() == getLocation().getWorld()) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player)); + UtilPlayer.sendPacket(player, getDestroyPacket()); } } } @@ -430,10 +386,7 @@ public class Hologram _playersTracking.add(player); itel.remove(); - for (Packet packet : getSpawnPackets(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } + UtilPlayer.sendPacket(player, getSpawnPackets()); } } if (!canSee.isEmpty()) @@ -445,7 +398,6 @@ public class Hologram int y = (int) Math.floor(32 * _lastMovement.getY()); int z = (int) Math.floor(32 * _lastMovement.getZ()); - Packet[] packets1_7 = new Packet[_hologramText.length]; Packet[] packets1_8 = new Packet[_hologramText.length]; int i = 0; @@ -455,14 +407,13 @@ public class Hologram _lastMovement.subtract(new Vector(x / 32D, y / 32D, z / 32D)); for (Entry entityId : this._entityIds) { - PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove(); + PacketPlayOutEntity.PacketPlayOutRelEntityMove relMove = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(); relMove.a = entityId.getKey(); relMove.b = (byte) x; relMove.c = (byte) y; relMove.d = (byte) z; - packets1_7[i] = relMove; packets1_8[i] = relMove; i++; } @@ -476,24 +427,14 @@ public class Hologram for (Entry entityId : this._entityIds) { - for (int b = 0; b < 2; b++) - { - PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); - teleportPacket.a = entityId.getKey(); - teleportPacket.b = x; - teleportPacket.c = (int) Math - .floor((oldLocation.getY() + (b == 0 ? 54.6 : -2.1) + ((double) i * 0.285)) * 32); - teleportPacket.d = z; + PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); + teleportPacket.a = entityId.getKey(); + teleportPacket.b = x; + teleportPacket.c = (int) Math + .floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32); + teleportPacket.d = z; - if (b == 0) - { - packets1_7[i] = teleportPacket; - } - else - { - packets1_8[i] = teleportPacket; - } - } + packets1_8[i] = teleportPacket; i++; } @@ -501,9 +442,9 @@ public class Hologram for (Player player : canSee) { - for (Packet packet : UtilPlayer.is1_8(player) ? packets1_8 : packets1_7) + for (Packet packet : packets1_8) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } @@ -534,10 +475,8 @@ public class Hologram if (isInUse()) { - int[] destroy1_7 = new int[0]; int[] destroy1_8 = new int[0]; - ArrayList packets1_7 = new ArrayList(); ArrayList packets1_8 = new ArrayList(); if (_hologramText.length != newText.length) @@ -555,8 +494,6 @@ public class Hologram Entry entry = new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId()); _entityIds.add(entry); - packets1_7.addAll(Arrays.asList(makeSpawnPackets1_7(i, entry.getKey(), entry.getValue(), newText[i]))); - packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entry.getKey(), newText[i]))); } // If less lines than previously @@ -565,11 +502,6 @@ public class Hologram // Remove entity id and send destroy packets Entry entry = _entityIds.remove(newText.length); - destroy1_7 = Arrays.copyOf(destroy1_7, destroy1_7.length + 2); - - destroy1_7[destroy1_7.length - 2] = entry.getKey(); - destroy1_7[destroy1_7.length - 1] = entry.getValue(); - destroy1_8 = Arrays.copyOf(destroy1_8, destroy1_8.length + 1); destroy1_8[destroy1_8.length - 1] = entry.getKey(); } @@ -577,21 +509,6 @@ public class Hologram { // Send update metadata packets Entry entry = _entityIds.get(i); - PacketPlayOutEntityMetadata metadata1_7 = new PacketPlayOutEntityMetadata(); - - metadata1_7.a = entry.getValue(); - - DataWatcher watcher1_7 = new DataWatcher(null); - - watcher1_7.a(0, (byte) 0); - watcher1_7.a(1, (short) 300); - watcher1_7.a(10, newText[i]); - watcher1_7.a(11, (byte) 1); - watcher1_7.a(12, -1700000); - - metadata1_7.b = watcher1_7.c(); - - packets1_7.add(metadata1_7); PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata(); @@ -610,11 +527,6 @@ public class Hologram } } - if (destroy1_7.length > 0) - { - packets1_7.add(new PacketPlayOutEntityDestroy(destroy1_7)); - } - if (destroy1_8.length > 0) { packets1_8.add(new PacketPlayOutEntityDestroy(destroy1_8)); @@ -622,9 +534,9 @@ public class Hologram for (Player player : _playersTracking) { - for (Packet packet : UtilPlayer.is1_8(player) ? packets1_8 : packets1_7) + for (Packet packet : packets1_8) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } @@ -656,10 +568,7 @@ public class Hologram for (Player player : _playersTracking) { - for (Packet packet : getSpawnPackets(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } + UtilPlayer.sendPacket(player, getSpawnPackets()); } _lastMovement = new Vector(); @@ -678,7 +587,7 @@ public class Hologram for (Player player : _playersTracking) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player)); + UtilPlayer.sendPacket(player, getDestroyPacket()); } _playersTracking.clear(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java index 2b90cf710..8be93fc9a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java @@ -4,13 +4,14 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_8_R3.Packet; import org.bukkit.Bukkit; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -83,20 +84,18 @@ public class HologramManager implements Listener itel2.remove(); if (player.getWorld() == hologram.getLocation().getWorld()) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(hologram.getDestroyPacket(player)); + UtilPlayer.sendPacket(player, hologram.getDestroyPacket()); } } } for (Player player : canSee) - { - if (!hologram.getPlayersTracking().contains(player)) - { - hologram.getPlayersTracking().add(player); - for (Packet packet : hologram.getSpawnPackets(player)) - { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } - } + { + if (!hologram.getPlayersTracking().contains(player)) + { + hologram.getPlayersTracking().add(player); + + UtilPlayer.sendPacket(player, hologram.getSpawnPackets()); + } } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 2560f2891..82becc622 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -7,8 +7,19 @@ import java.util.Map; import java.util.UUID; import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.EnchantingInventory; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniDbClientPlugin; @@ -27,12 +38,12 @@ public class InventoryManager extends MiniDbClientPlugin private static Object _inventoryLock = new Object(); private InventoryRepository _repository; - + private NautHashMap _items = new NautHashMap(); private NautHashMap _itemIdNameMap = new NautHashMap(); - + private NautHashMap> _inventoryQueue = new NautHashMap>(); - + public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager) { super("Inventory Manager", plugin, clientManager); @@ -51,7 +62,7 @@ public class InventoryManager extends MiniDbClientPlugin private void updateItems() { List items = _repository.retrieveItems(); - + synchronized (_inventoryLock) { for (Item item : items) @@ -68,20 +79,20 @@ public class InventoryManager extends MiniDbClientPlugin { Get(player).addItem(new ClientItem(_items.get(item), count)); } - + if (!_inventoryQueue.containsKey(player)) _inventoryQueue.put(player, new NautHashMap()); - + int totalAmount = count; - + if (_inventoryQueue.get(player).containsKey(item)) totalAmount += _inventoryQueue.get(player).get(item); - + _inventoryQueue.get(player).put(item, totalAmount); } - + public void addItemToInventory(final Callback callback, final Player player, final String item, final int count) - { + { addItemToInventoryForOffline(new Callback() { public void run(Boolean success) @@ -90,13 +101,13 @@ public class InventoryManager extends MiniDbClientPlugin { System.out.println("Add item to Inventory FAILED for " + player.getName()); } - + if (callback != null) callback.run(success); } }, player.getUniqueId(), item, count); } - + public boolean validItem(String item) { synchronized (_inventoryLock) @@ -104,7 +115,7 @@ public class InventoryManager extends MiniDbClientPlugin return _items.containsKey(item); } } - + public Item getItem(String itemName) { Item item = null; @@ -121,6 +132,17 @@ public class InventoryManager extends MiniDbClientPlugin } public void addItemToInventoryForOffline(final Callback callback, final UUID uuid, final String item, final int count) + { + Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + public void run() + { + addItemToInventoryForOffline(callback, PlayerCache.getInstance().getPlayer(uuid).getAccountId(), item, count); + } + }); + } + + public void addItemToInventoryForOffline(final Callback callback, final int accountId, final String item, final int count) { Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { @@ -139,7 +161,7 @@ public class InventoryManager extends MiniDbClientPlugin synchronized (_inventoryLock) { - final boolean success = _repository.incrementClientInventoryItem(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), _items.get(item).Id, count); + final boolean success = _repository.incrementClientInventoryItem(accountId, _items.get(item).Id, count); if (callback != null) { @@ -155,19 +177,114 @@ public class InventoryManager extends MiniDbClientPlugin } }); } - + + @EventHandler + public void onOpenEnchantingTable(InventoryOpenEvent event) + { + if (event.getInventory().getType() != InventoryType.ENCHANTING) + { + return; + } + + int level = ((Player) event.getPlayer()).getLevel(); + + for (HumanEntity viewer : event.getViewers()) + { + level = Math.max(((Player) viewer).getLevel(), level); + } + + event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4)); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onBlockBreak(BlockBreakEvent event) + { + if (event.getBlock().getType() != Material.ENCHANTMENT_TABLE) + { + return; + } + + ((EnchantingInventory) event.getBlock().getState()).setSecondary(new ItemStack(Material.AIR)); + } + + @EventHandler + public void onInventoryClose(InventoryCloseEvent event) + { + if (event.getInventory().getType() != InventoryType.ENCHANTING) + { + return; + } + + if (event.getViewers().size() > 1) + { + int level = ((Player) event.getPlayer()).getLevel(); + + for (HumanEntity viewer : event.getViewers()) + { + level = Math.max(((Player) viewer).getLevel(), level); + } + + event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4)); + return; + } + + event.getInventory().setItem(1, new ItemStack(Material.AIR)); + } + + @EventHandler + public void onInventoryClick(final InventoryClickEvent event) + { + if (event.getView().getTopInventory().getType() != InventoryType.ENCHANTING) + { + return; + } + + if (event.getSlot() == 1) + { + event.setCancelled(true); + return; + } + + if (event.getSlot() != 2) + { + return; + } + + Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() + { + public void run() + { + Inventory inv = event.getInventory(); + + if (inv.getViewers().isEmpty()) + { + return; + } + + int level = 0; + + for (HumanEntity viewer : inv.getViewers()) + { + level = Math.max(((Player) viewer).getLevel(), level); + } + + event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4)); + } + }); + } + @EventHandler public void updateInventoryQueue(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - + for (final Player player : _inventoryQueue.keySet()) { for (final String item : _inventoryQueue.get(player).keySet()) { final int count = _inventoryQueue.get(player).get(item); - + addItemToInventoryForOffline(new Callback() { public void run(Boolean success) @@ -175,7 +292,7 @@ public class InventoryManager extends MiniDbClientPlugin if (!success) { System.out.println("Add item to Inventory FAILED for " + player); - + if (_items.containsKey(item)) { Get(player).addItem(new ClientItem(_items.get(item), -count)); @@ -184,16 +301,15 @@ public class InventoryManager extends MiniDbClientPlugin } }, player.getUniqueId(), item, count); } - - //Clean + + // Clean _inventoryQueue.get(player).clear(); } - - //Clean + + // Clean _inventoryQueue.clear(); } - @Override protected ClientInventory AddPlayer(String player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java index 3a1f090e0..c1d486795 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java @@ -9,9 +9,11 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; +import org.bukkit.FireworkEffect; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.FireworkEffectMeta; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.SkullMeta; @@ -20,349 +22,376 @@ import org.bukkit.potion.Potion; public class ItemBuilder { - private static ArrayList split(String string, int maxLength) - { - String[] split = string.split(" "); - string = ""; - ArrayList newString = new ArrayList(); - for (int i = 0; i < split.length; i++) - { - string += (string.length() == 0 ? "" : " ") + split[i]; - if (ChatColor.stripColor(string).length() > maxLength) - { - newString - .add((newString.size() > 0 ? ChatColor.getLastColors(newString.get(newString.size() - 1)) : "") + string); - string = ""; - } - } - if (string.length() > 0) - newString.add((newString.size() > 0 ? ChatColor.getLastColors(newString.get(newString.size() - 1)) : "") + string); - return newString; - } + private static ArrayList split(String string, int maxLength) + { + String[] split = string.split(" "); + string = ""; + ArrayList newString = new ArrayList(); + for (int i = 0; i < split.length; i++) + { + string += (string.length() == 0 ? "" : " ") + split[i]; + if (ChatColor.stripColor(string).length() > maxLength) + { + newString + .add((newString.size() > 0 ? ChatColor.getLastColors(newString.get(newString.size() - 1)) : "") + string); + string = ""; + } + } + if (string.length() > 0) + newString.add((newString.size() > 0 ? ChatColor.getLastColors(newString.get(newString.size() - 1)) : "") + string); + return newString; + } - private int _amount; - private Color _color; - private short _data; - private final HashMap _enchants = new HashMap(); - private final List _lore = new ArrayList(); - private Material _mat; - // private Potion potion; - private String _title = null; - private boolean _unbreakable; + private int _amount; + private Color _color; + private short _data; + private final HashMap _enchants = new HashMap(); + private final List _lore = new ArrayList(); + private Material _mat; + // private Potion potion; + private String _title = null; + private boolean _unbreakable; private String _playerHeadName = null; - public ItemBuilder(ItemStack item) - { - this(item.getType(), item.getDurability()); - this._amount = item.getAmount(); - this._enchants.putAll(item.getEnchantments()); - if (item.getType() == Material.POTION) - { - // setPotion(Potion.fromItemStack(item)); - } - if (item.hasItemMeta()) - { - ItemMeta meta = item.getItemMeta(); - if (meta.hasDisplayName()) - { - this._title = meta.getDisplayName(); - } - if (meta.hasLore()) - { - this._lore.addAll(meta.getLore()); - } - if (meta instanceof LeatherArmorMeta) - { - this.setColor(((LeatherArmorMeta) meta).getColor()); - } - this._unbreakable = meta.spigot().isUnbreakable(); - } - } + public ItemBuilder(ItemStack item) + { + this(item.getType(), item.getDurability()); + _amount = item.getAmount(); + _enchants.putAll(item.getEnchantments()); + if (item.getType() == Material.POTION) + { + // setPotion(Potion.fromItemStack(item)); + } + if (item.hasItemMeta()) + { + ItemMeta meta = item.getItemMeta(); - public ItemBuilder(Material mat) - { - this(mat, 1); - } + if (meta.hasDisplayName()) + { + _title = meta.getDisplayName(); + } - public ItemBuilder(Material mat, int amount) - { - this(mat, amount, (short) 0); - } + if (meta.hasLore()) + { + _lore.addAll(meta.getLore()); + } - public ItemBuilder(Material mat, int amount, short data) - { - this._mat = mat; - this._amount = amount; - this._data = data; - } + if (meta instanceof LeatherArmorMeta) + { + setColor(((LeatherArmorMeta) meta).getColor()); + } - public ItemBuilder(Material mat, short data) - { - this(mat, 1, data); - } + _unbreakable = meta.spigot().isUnbreakable(); + } + } - public ItemBuilder addEnchantment(Enchantment enchant, int level) - { - if (_enchants.containsKey(enchant)) - { - _enchants.remove(enchant); - } - _enchants.put(enchant, level); - return this; - } + public ItemBuilder(Material mat) + { + this(mat, 1); + } - public ItemBuilder addLore(String... lores) - { - for (String lore : lores) - { - this._lore.add(ChatColor.GRAY + lore); - } - return this; - } + public ItemBuilder(Material mat, int amount) + { + this(mat, amount, (short) 0); + } - public ItemBuilder addLore(String lore, int maxLength) - { - this._lore.addAll(split(lore, maxLength)); - return this; - } + public ItemBuilder(Material mat, int amount, short data) + { + _mat = mat; + _amount = amount; + _data = data; + } - public ItemBuilder addLores(List lores) - { - this._lore.addAll(lores); - return this; - } + public ItemBuilder(Material mat, short data) + { + this(mat, 1, data); + } - public ItemBuilder addLores(List lores, int maxLength) - { - for (String lore : lores) - { - addLore(lore, maxLength); - } - return this; - } + public ItemBuilder addEnchantment(Enchantment enchant, int level) + { + if (_enchants.containsKey(enchant)) + { + _enchants.remove(enchant); + } + _enchants.put(enchant, level); + return this; + } - public ItemBuilder addLores(String[] description, int maxLength) - { - return addLores(Arrays.asList(description), maxLength); - } + public ItemBuilder addLore(String... lores) + { + for (String lore : lores) + { + _lore.add(ChatColor.GRAY + lore); + } + return this; + } - public ItemStack build() - { - Material mat = this._mat; - if (mat == null) - { - mat = Material.AIR; - Bukkit.getLogger().warning("Null material!"); - } - else if (mat == Material.AIR) - { - Bukkit.getLogger().warning("Air material!"); - } - ItemStack item = new ItemStack(mat, this._amount, this._data); - ItemMeta meta = item.getItemMeta(); - if (meta != null) - { - if (this._title != null) - { - meta.setDisplayName(this._title); - } - if (!this._lore.isEmpty()) - { - meta.setLore(this._lore); - } - if (meta instanceof LeatherArmorMeta) - { - ((LeatherArmorMeta) meta).setColor(this._color); - } + public ItemBuilder addLore(String lore, int maxLength) + { + _lore.addAll(split(lore, maxLength)); + return this; + } + + public ItemBuilder addLores(List lores) + { + _lore.addAll(lores); + return this; + } + + public ItemBuilder addLores(List lores, int maxLength) + { + for (String lore : lores) + { + addLore(lore, maxLength); + } + return this; + } + + public ItemBuilder addLores(String[] description, int maxLength) + { + return addLores(Arrays.asList(description), maxLength); + } + + public ItemStack build() + { + Material mat = _mat; + if (mat == null) + { + mat = Material.AIR; + Bukkit.getLogger().warning("Null material!"); + } + else if (mat == Material.AIR) + { + Bukkit.getLogger().warning("Air material!"); + } + ItemStack item = new ItemStack(mat, _amount, _data); + ItemMeta meta = item.getItemMeta(); + if (meta != null) + { + if (_title != null) + { + meta.setDisplayName(_title); + } + if (!_lore.isEmpty()) + { + meta.setLore(_lore); + } + if (meta instanceof LeatherArmorMeta && _color != null) + { + ((LeatherArmorMeta) meta).setColor(_color); + } else if (meta instanceof SkullMeta && _playerHeadName != null) { ((SkullMeta) meta).setOwner(_playerHeadName); } - meta.spigot().setUnbreakable(isUnbreakable()); - item.setItemMeta(meta); - } - item.addUnsafeEnchantments(this._enchants); - // if (this.potion != null) { - // this.potion.apply(item); - // } - return item; - } + else if (meta instanceof FireworkEffectMeta && _color != null) + { + ((FireworkEffectMeta) meta).setEffect(FireworkEffect.builder().withColor(_color).build()); + } - @Override - public ItemBuilder clone() - { - ItemBuilder newBuilder = new ItemBuilder(this._mat); + meta.spigot().setUnbreakable(isUnbreakable()); + item.setItemMeta(meta); + } - newBuilder.setTitle(this._title); - for (String lore : this._lore) - { - newBuilder.addLore(lore); - } - for (Map.Entry entry : this._enchants.entrySet()) - { - newBuilder.addEnchantment(entry.getKey(), entry.getValue()); - } - newBuilder.setColor(this._color); - // newBuilder.potion = this.potion; + item.addUnsafeEnchantments(_enchants); + // if (potion != null) { + // potion.apply(item); + // } + return item; + } - return newBuilder; - } + @Override + public ItemBuilder clone() + { + ItemBuilder newBuilder = new ItemBuilder(_mat); - public HashMap getAllEnchantments() - { - return this._enchants; - } + newBuilder.setTitle(_title); - public Color getColor() - { - return this._color; - } + for (String lore : _lore) + { + newBuilder.addLore(lore); + } - public short getData() - { - return this._data; - } + for (Map.Entry entry : _enchants.entrySet()) + { + newBuilder.addEnchantment(entry.getKey(), entry.getValue()); + } - public int getEnchantmentLevel(Enchantment enchant) - { - return this._enchants.get(enchant); - } + newBuilder.setColor(_color); + // newBuilder.potion = potion; - public List getLore() - { - return this._lore; - } + return newBuilder; + } - public String getTitle() - { - return this._title; - } + public HashMap getAllEnchantments() + { + return _enchants; + } - public Material getType() - { - return this._mat; - } + public Color getColor() + { + return _color; + } - public boolean hasEnchantment(Enchantment enchant) - { - return this._enchants.containsKey(enchant); - } + public short getData() + { + return _data; + } - public boolean isItem(ItemStack item) - { - ItemMeta meta = item.getItemMeta(); - if (item.getType() != this.getType()) - { - return false; - } - if (!meta.hasDisplayName() && this.getTitle() != null) - { - return false; - } - if (!meta.getDisplayName().equals(this.getTitle())) - { - return false; - } - if (!meta.hasLore() && !this.getLore().isEmpty()) - { - return false; - } - if (meta.hasLore()) - { - for (String lore : meta.getLore()) - { - if (!this.getLore().contains(lore)) - { - return false; - } - } - } - for (Enchantment enchant : item.getEnchantments().keySet()) - { - if (!this.hasEnchantment(enchant)) - { - return false; - } - } - return true; - } + public int getEnchantmentLevel(Enchantment enchant) + { + return _enchants.get(enchant); + } - public boolean isUnbreakable() - { - return this._unbreakable; - } + public List getLore() + { + return _lore; + } - public ItemBuilder setAmount(int amount) - { - this._amount = amount; - return this; - } + public String getTitle() + { + return _title; + } - public ItemBuilder setColor(Color color) - { - if (!this._mat.name().contains("LEATHER_")) - { - throw new IllegalArgumentException("Can only dye leather armor!"); - } - this._color = color; - return this; - } + public Material getType() + { + return _mat; + } - public ItemBuilder setData(short newData) - { - this._data = newData; - return this; - } + public boolean hasEnchantment(Enchantment enchant) + { + return _enchants.containsKey(enchant); + } - public ItemBuilder setPotion(Potion potion) - { - if (this._mat != Material.POTION) - { - this._mat = Material.POTION; - } - // this.potion = potion; - return this; - } + public boolean isItem(ItemStack item) + { + ItemMeta meta = item.getItemMeta(); - public ItemBuilder setRawTitle(String title) - { - this._title = title; - return this; - } + if (item.getType() != getType()) + { + return false; + } - public ItemBuilder setTitle(String title) - { - this._title = (title == null ? null - : (title.length() > 2 && ChatColor.getLastColors(title.substring(0, 2)).length() == 0 ? ChatColor.WHITE : "")) - + title; - return this; - } + if (!meta.hasDisplayName() && getTitle() != null) + { + return false; + } - public ItemBuilder setTitle(String title, int maxLength) - { - if (title != null && ChatColor.stripColor(title).length() > maxLength) - { - ArrayList lores = split(title, maxLength); - for (int i = 1; i < lores.size(); i++) - { - this._lore.add(lores.get(i)); - } - title = lores.get(0); - } - setTitle(title); - return this; - } + if (!meta.getDisplayName().equals(getTitle())) + { + return false; + } - public ItemBuilder setType(Material mat) - { - this._mat = mat; - return this; - } + if (!meta.hasLore() && !getLore().isEmpty()) + { + return false; + } - public ItemBuilder setUnbreakable(boolean setUnbreakable) - { - this._unbreakable = setUnbreakable;return this; - } + if (meta.hasLore()) + { + for (String lore : meta.getLore()) + { + if (!getLore().contains(lore)) + { + return false; + } + } + } + + for (Enchantment enchant : item.getEnchantments().keySet()) + { + if (!hasEnchantment(enchant)) + { + return false; + } + } + + return true; + } + + public boolean isUnbreakable() + { + return _unbreakable; + } + + public ItemBuilder setAmount(int amount) + { + _amount = amount; + return this; + } + + public ItemBuilder setColor(Color color) + { + /* (!_mat.name().contains("LEATHER_")) + { + throw new IllegalArgumentException("Can only dye leather armor!"); + }*/ + + _color = color; + return this; + } + + public ItemBuilder setData(short newData) + { + _data = newData; + + return this; + } + + public ItemBuilder setPotion(Potion potion) + { + if (_mat != Material.POTION) + { + _mat = Material.POTION; + } + + return this; + } + + public ItemBuilder setRawTitle(String title) + { + _title = title; + return this; + } + + public ItemBuilder setTitle(String title) + { + _title = (title == null ? null + : (title.length() > 2 && ChatColor.getLastColors(title.substring(0, 2)).length() == 0 ? ChatColor.WHITE : "")) + + title; + + return this; + } + + public ItemBuilder setTitle(String title, int maxLength) + { + if (title != null && ChatColor.stripColor(title).length() > maxLength) + { + ArrayList lores = split(title, maxLength); + + for (int i = 1; i < lores.size(); i++) + { + _lore.add(lores.get(i)); + } + + title = lores.get(0); + } + + setTitle(title); + return this; + } + + public ItemBuilder setType(Material mat) + { + _mat = mat; + return this; + } + + public ItemBuilder setUnbreakable(boolean setUnbreakable) + { + _unbreakable = setUnbreakable; + return this; + } public ItemBuilder setPlayerHead(String playerName) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index 592ff1d30..856b7322a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilTime; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/map/BlockMap.java b/Plugins/Mineplex.Core/src/mineplex/core/map/BlockMap.java index b6a14996a..25f613f9d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/map/BlockMap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/map/BlockMap.java @@ -14,9 +14,12 @@ import javax.imageio.ImageIO; import mineplex.core.MiniPlugin; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilServer; -import net.minecraft.server.v1_7_R4.EntityItemFrame; -import net.minecraft.server.v1_7_R4.PersistentCollection; -import net.minecraft.server.v1_7_R4.WorldServer; + +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.EntityItemFrame; +import net.minecraft.server.v1_8_R3.EnumDirection; +import net.minecraft.server.v1_8_R3.PersistentCollection; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -24,7 +27,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Hanging; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; @@ -53,7 +56,7 @@ public class BlockMap implements Listener { // Make sure the world doesn't change the mapcount information PersistentCollection collection = ((CraftWorld) corner1.getWorld()).getHandle().worldMaps; - Field f = collection.getClass().getDeclaredField("a"); + Field f = collection.getClass().getDeclaredField("b"); f.setAccessible(true); f.set(collection, null); } @@ -338,27 +341,27 @@ public class BlockMap implements Listener private ItemFrame spawnItemFrame(Block block, BlockFace bf) { - int dir; + EnumDirection dir; switch (bf) { default: case SOUTH: - dir = 0; + dir = EnumDirection.SOUTH; break; case WEST: - dir = 1; + dir = EnumDirection.WEST; break; case NORTH: - dir = 2; + dir = EnumDirection.NORTH; break; case EAST: - dir = 3; + dir = EnumDirection.EAST; break; } WorldServer world = ((CraftWorld) block.getWorld()).getHandle(); - EntityItemFrame entity = new EntityItemFrame(world, block.getX(), block.getY(), block.getZ(), dir); + EntityItemFrame entity = new EntityItemFrame(world, new BlockPosition(block.getX(), block.getY(), block.getZ()), dir); entity.setDirection(dir); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMap.java b/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMap.java index f0c6c3e18..1fcd4d3e0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMap.java @@ -1,6 +1,6 @@ package mineplex.core.map; -import net.minecraft.server.v1_7_R4.WorldMap; +import net.minecraft.server.v1_8_R3.WorldMap; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMapRenderer.java b/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMapRenderer.java index ef6431a2b..ead7a97f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMapRenderer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/map/ChunkMapRenderer.java @@ -3,18 +3,20 @@ package mineplex.core.map; import java.util.HashMap; import java.util.Map.Entry; -import net.minecraft.server.v1_7_R4.Block; -import net.minecraft.server.v1_7_R4.Blocks; -import net.minecraft.server.v1_7_R4.Chunk; -import net.minecraft.server.v1_7_R4.MaterialMapColor; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.WorldMap; -import net.minecraft.util.com.google.common.collect.HashMultiset; -import net.minecraft.util.com.google.common.collect.Iterables; -import net.minecraft.util.com.google.common.collect.Multisets; +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.MaterialMapColor; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.WorldMap; + +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multisets; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Player; import org.bukkit.map.MapCanvas; import org.bukkit.map.MapRenderer; @@ -33,7 +35,7 @@ public class ChunkMapRenderer extends MapRenderer public void setupMap(World world) { - int i = 1 << worldmap.scale; + /*int i = 1 << worldmap.scale; int j = worldmap.centerX; int k = worldmap.centerZ; int l = MathHelper.floor(0) / i + 64; @@ -56,7 +58,7 @@ public class ChunkMapRenderer extends MapRenderer int i3 = (j / i + k1 - 64) * i; int j3 = (k / i + j2 - 64) * i; HashMultiset hashmultiset = HashMultiset.create(); - Chunk chunk = ((CraftWorld) world).getHandle().getChunkAtWorldCoords(i3, j3); + Chunk chunk = ((CraftWorld) world).getHandle().getChunkAtWorldCoords(new BlockPosition(i3, 0, j3)); if (!chunk.isEmpty()) { @@ -160,7 +162,7 @@ public class ChunkMapRenderer extends MapRenderer if (l1 <= i2) worldmap.flagDirty(k1, l1, i2); - } + }*/ } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java index 105351e12..b801e7759 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java @@ -6,13 +6,13 @@ import java.util.Iterator; import mineplex.core.MiniPlugin; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.CraftingManager; -import net.minecraft.server.v1_7_R4.IInventory; +import net.minecraft.server.v1_8_R3.CraftingManager; +import net.minecraft.server.v1_8_R3.IInventory; import org.bukkit.Bukkit; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.HumanEntity; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java index 9c8c52d8d..8335ef029 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonData.java @@ -6,7 +6,7 @@ import mineplex.core.common.util.UtilEnt; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon; import org.bukkit.entity.Chicken; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java index 5e075a080..d8ec72939 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java @@ -8,12 +8,12 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse; import org.bukkit.entity.Player; @@ -65,7 +65,7 @@ public class HorseMount extends Mount //Move EntityCreature ec = ((CraftCreature)horse).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); Location target = player.getLocation().add(UtilAlg.getTrajectory(player, horse).multiply(2)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index af5e1db39..e68074bb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -14,7 +14,7 @@ import mineplex.core.updater.event.UpdateEvent; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecart; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecart; import org.bukkit.entity.Minecart; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 704a588d1..3667a10d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -17,12 +17,12 @@ import mineplex.core.mount.MountManager; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.EntityLiving; +import net.minecraft.server.v1_8_R3.EntityLiving; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Style; @@ -204,7 +204,7 @@ public class MountSpider extends HorseMount try { - Field jump = EntityLiving.class.getDeclaredField("bc"); + Field jump = EntityLiving.class.getDeclaredField("aY"); final boolean accessable = jump.isAccessible(); jump.setAccessible(true); @@ -216,7 +216,7 @@ public class MountSpider extends HorseMount continue; //Not jumping anymore - ((CraftPlayer) player).getHandle().f(false); + ((CraftPlayer) player).getHandle().i(false); //Velocity UtilAction.velocity(horse, 1.4, 0.38, .8, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java index 867cb08ba..9f801a28c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java @@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/Npc.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/Npc.java index fb7b2e41c..982fe160f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/Npc.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/Npc.java @@ -4,9 +4,9 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.LivingEntity; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import mineplex.core.common.util.C; import mineplex.database.tables.records.NpcsRecord; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index d92a8690e..da8736f6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -19,8 +19,8 @@ import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -42,7 +42,7 @@ import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; -import net.minecraft.server.v1_7_R4.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityInsentient; import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; @@ -577,7 +577,7 @@ public class NpcManager extends MiniPlugin Npc npc = getNpcByEntity(entity); if (npc != null) { - UtilEnt.silence(entity, true); + UtilEnt.silence((LivingEntity) entity, true); UtilEnt.ghost(entity, true, false); if (npc.getDatabaseRecord().getRadius() == 0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index 7c5a218d5..5d6027624 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -1,19 +1,21 @@ package mineplex.core.packethandler; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashSet; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; -import net.minecraft.server.v1_7_R4.EnumProtocol; +import net.minecraft.server.v1_8_R3.Packet; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -import org.spigotmc.ProtocolInjector; + +import com.mineplex.spigot.PacketProcessor; import mineplex.core.MiniPlugin; import mineplex.core.common.util.NautHashMap; @@ -21,77 +23,62 @@ import mineplex.core.common.util.NautHashMap; public class PacketHandler extends MiniPlugin { private NautHashMap _playerVerifierMap = new NautHashMap(); - private HashSet _packetHandlers = new HashSet(); + private HashMap> _forceMainThread = new HashMap>(); + private HashMap> _packetHandlers = new HashMap>(); public PacketHandler(JavaPlugin plugin) { super("PacketHandler", plugin); - - try - { - // TODO Remove this when if incoming packets are ever listened to in the future. - - for (Class clss : new Class[] - { - PacketPlayResourcePackStatus.class, PacketPlayUseEntity.class - }) - { - Field field = clss.getDeclaredField("_packetHandler"); - - field.setAccessible(true); - field.set(null, this); - } - - EnumProtocol.PLAY.a().put(25, PacketPlayResourcePackStatus.class); - EnumProtocol.PLAY.a().put(PacketPlayResourcePackStatus.class, 25); - - EnumProtocol.PLAY.a().put(2, PacketPlayUseEntity.class); - EnumProtocol.PLAY.a().put(PacketPlayUseEntity.class, 2); - -// NBT Overflow Exploit Handlers - EnumProtocol.PLAY.a().put(8, PacketPlayInBlockPace.class); - EnumProtocol.PLAY.a().put(PacketPlayInBlockPace.class, 8); - - EnumProtocol.PLAY.a().put(14, PacketPlayInWindowClick.class); - EnumProtocol.PLAY.a().put(PacketPlayInWindowClick.class, 14); - - EnumProtocol.PLAY.a().put(16, PacketPlayInSetCreativeSlot.class); - EnumProtocol.PLAY.a().put(PacketPlayInSetCreativeSlot.class, 16); -// ---------------------------- - - Method method = ProtocolInjector.class.getDeclaredMethod("addPacket", EnumProtocol.class,boolean.class, int.class, Class.class); - method.setAccessible(true); - - method.invoke(null, EnumProtocol.PLAY, true, 67, PacketPlayOutCamera.class); - method.invoke(null, EnumProtocol.PLAY, true, 68, PacketPlayOutWorldBorder.class); - - // EnumProtocol.PLAY.b().put(68, PacketPlayOutWorldBorder.class); - // EnumProtocol.PLAY.b().put(PacketPlayOutWorldBorder.class, 68); - } - catch (Exception ex) - { - ex.printStackTrace(); - } } @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { - _playerVerifierMap.put(event.getPlayer(), new PacketVerifier(event.getPlayer())); - ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.addPacketVerifier(_playerVerifierMap - .get(event.getPlayer())); + _playerVerifierMap.put(event.getPlayer(), new PacketVerifier(event.getPlayer(), this)); - for (IPacketHandler packetHandler : _packetHandlers) + ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.setPacketVerifier(_playerVerifierMap + .get(event.getPlayer())); + } + + public boolean handlePacket(Player player, Packet packet) + { + if (!_playerVerifierMap.containsKey(player)) { - _playerVerifierMap.get(event.getPlayer()).addPacketHandler(packetHandler); + return true; } + + PacketVerifier verifier = _playerVerifierMap.get(player); + + return handlePacket(new PacketInfo(player, packet, verifier)); + } + + public boolean handlePacket(PacketInfo packetInfo) + { + if (!_packetHandlers.containsKey(packetInfo.getPacket().getClass())) + { + // aSystem.err.print("Received packet " + packetInfo.getPacket().getClass() + " but am not listening for it!"); + return true; + } + + for (IPacketHandler handler : _packetHandlers.get(packetInfo.getPacket().getClass())) + { + try + { + handler.handle(packetInfo); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + return !packetInfo.isCancelled(); } @EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuit(PlayerQuitEvent event) { - ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.clearVerifiers(); - _playerVerifierMap.remove(event.getPlayer()).clearHandlers(); + ((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.setPacketVerifier(null); } public PacketVerifier getPacketVerifier(Player player) @@ -99,28 +86,74 @@ public class PacketHandler extends MiniPlugin return _playerVerifierMap.get(player); } - public void addPacketHandler(IPacketHandler packetHandler) + public void addPacketHandler(IPacketHandler packetHandler, Class... packetsToListen) { - _packetHandlers.add(packetHandler); - - for (PacketVerifier verifier : _playerVerifierMap.values()) + if (packetsToListen.length == 0) { - verifier.addPacketHandler(packetHandler); + throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); } + + addPacketHandler(packetHandler, false, packetsToListen); } - public HashSet getPacketHandlers() + /** + * This should only be used for incoming packets + */ + public void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, + Class... packetsToListen) { - return _packetHandlers; + if (packetsToListen.length == 0) + { + throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); + } + + for (Class c : packetsToListen) + { + if (forceMainThread) + { + if (!_forceMainThread.containsKey(c)) + { + _forceMainThread.put(c, new ArrayList()); + } + + _forceMainThread.get(c).add(packetHandler); + } + + if (!_packetHandlers.containsKey(c)) + { + _packetHandlers.put(c, new ArrayList()); + } + + _packetHandlers.get(c).add(packetHandler); + PacketProcessor.addPacket(c, forceMainThread || _forceMainThread.containsKey(c)); + } } public void removePacketHandler(IPacketHandler packetHandler) { - _packetHandlers.remove(packetHandler); + Iterator>> itel = _packetHandlers.entrySet().iterator(); - for (PacketVerifier verifier : _playerVerifierMap.values()) + while (itel.hasNext()) { - verifier.removePacketHandler(packetHandler); + Entry> entry = itel.next(); + + if (entry.getValue().remove(packetHandler)) + { + if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler)) + { + if (_forceMainThread.get(entry.getKey()).isEmpty()) + { + _forceMainThread.remove(entry.getKey()); + PacketProcessor.addPacket(entry.getKey(), false); + } + } + + if (entry.getValue().isEmpty()) + { + PacketProcessor.removePacket(entry.getKey()); + itel.remove(); + } + } } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java index 06ededb58..73aaf1ddc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketInfo.java @@ -1,10 +1,8 @@ package mineplex.core.packethandler; -import net.minecraft.server.v1_7_R4.Packet; import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; +import net.minecraft.server.v1_8_R3.Packet; public class PacketInfo { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInBlockPace.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInBlockPace.java deleted file mode 100644 index 4e4eea5df..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInBlockPace.java +++ /dev/null @@ -1,15 +0,0 @@ -package mineplex.core.packethandler; - -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.server.v1_7_R4.PacketPlayInBlockPlace; - -public class PacketPlayInBlockPace extends PacketPlayInBlockPlace -{ - - @Override - public void a(PacketDataSerializer data) - { - super.a(WrappedPacketDataSerializer.wrapDataSerializer(data)); - } - -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInSetCreativeSlot.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInSetCreativeSlot.java deleted file mode 100644 index 23b7482c7..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInSetCreativeSlot.java +++ /dev/null @@ -1,15 +0,0 @@ -package mineplex.core.packethandler; - -import net.minecraft.server.v1_7_R4.PacketDataSerializer; - -public class PacketPlayInSetCreativeSlot extends net.minecraft.server.v1_7_R4.PacketPlayInSetCreativeSlot -{ - - @Override - public void a(PacketDataSerializer data) - { - super.a(WrappedPacketDataSerializer.wrapDataSerializer(data)); - } - - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInWindowClick.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInWindowClick.java deleted file mode 100644 index baee403be..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayInWindowClick.java +++ /dev/null @@ -1,14 +0,0 @@ -package mineplex.core.packethandler; - -import net.minecraft.server.v1_7_R4.PacketDataSerializer; - -public class PacketPlayInWindowClick extends net.minecraft.server.v1_7_R4.PacketPlayInWindowClick -{ - - @Override - public void a(PacketDataSerializer data) - { - super.a(WrappedPacketDataSerializer.wrapDataSerializer(data)); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java deleted file mode 100644 index 11dd54051..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java +++ /dev/null @@ -1,44 +0,0 @@ -package mineplex.core.packethandler; - -import org.bukkit.entity.Entity; - -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.server.v1_7_R4.PacketListener; - -public class PacketPlayOutCamera extends Packet -{ - public int a; - - public PacketPlayOutCamera() - { - } - - public PacketPlayOutCamera(int id) - { - a = id; - } - - public PacketPlayOutCamera(Entity paramEntity) - { - this.a = paramEntity.getEntityId(); - } - - public void a(PacketDataSerializer paramPacketDataSerializer) - { - } - - public void b(PacketDataSerializer paramPacketDataSerializer) - { - paramPacketDataSerializer.b(this.a); - } - - public void a(PacketListener paramPacketListenerPlayOut) - { - } - - @Override - public void handle(PacketListener arg0) - { - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutWorldBorder.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutWorldBorder.java deleted file mode 100644 index 62def3741..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutWorldBorder.java +++ /dev/null @@ -1,83 +0,0 @@ -package mineplex.core.packethandler; - -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.server.v1_7_R4.PacketListener; - -public class PacketPlayOutWorldBorder extends Packet -{ - /** - * @0 Set size - newRadius - * @1 Gradual Size - oldRadius, newRadius, speed - * @2 Set center - centerX, centerZ - * @3 Initialize - All feields - * @4 Set warning time - warningTime - * @5 Set warning blocks - warningBlocks - */ - public int worldBorderType; - // public int damageBoundry; - public double centerX; - public double centerZ; - public double newRadius; - public double oldRadius; - /** - * Time in millis until new border reached - */ - public long speed; - public int warningBlocks; - public int warningTime; - - public PacketPlayOutWorldBorder() - { - } - - @Override - public void a(PacketDataSerializer paramPacketDataSerializer) - { - } - - @Override - public void b(PacketDataSerializer paramPacketDataSerializer) - { - paramPacketDataSerializer.b(worldBorderType); - - switch (worldBorderType) - { - case 0: - paramPacketDataSerializer.writeDouble(newRadius * 2); - break; - case 1: - paramPacketDataSerializer.writeDouble(oldRadius * 2); - paramPacketDataSerializer.writeDouble(newRadius * 2); - paramPacketDataSerializer.b((int) speed); - break; - case 2: - paramPacketDataSerializer.writeDouble(centerX); - paramPacketDataSerializer.writeDouble(centerZ); - break; - case 3: - paramPacketDataSerializer.writeDouble(centerX); - paramPacketDataSerializer.writeDouble(centerZ); - paramPacketDataSerializer.writeDouble(oldRadius * 2); - paramPacketDataSerializer.writeDouble(newRadius * 2); - paramPacketDataSerializer.b((int) speed); - - // paramPacketDataSerializer.b(damageBoundry); - paramPacketDataSerializer.b(29999984); - paramPacketDataSerializer.b(warningTime); - paramPacketDataSerializer.b(warningBlocks); - break; - case 4: - paramPacketDataSerializer.b(warningTime); - break; - case 5: - paramPacketDataSerializer.b(warningBlocks); - break; - } - } - - @Override - public void handle(PacketListener arg0) - { - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayResourcePackStatus.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayResourcePackStatus.java deleted file mode 100644 index 23b7cf898..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayResourcePackStatus.java +++ /dev/null @@ -1,60 +0,0 @@ -package mineplex.core.packethandler; - -import java.io.IOException; - -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.server.v1_7_R4.PacketListener; -import net.minecraft.server.v1_7_R4.PlayerConnection; - -public class PacketPlayResourcePackStatus extends Packet -{ - public enum EnumResourcePackStatus - { - ACCEPTED, - - DECLINED, - - FAILED_DOWNLOAD, - - LOADED; - } - - private static PacketHandler _packetHandler; - - public String ResourcePackUrl; - private int _resourcePackStatus; - - public void a(PacketDataSerializer packetdataserializer) throws IOException - { - ResourcePackUrl = packetdataserializer.c(255); - _resourcePackStatus = packetdataserializer.a(); - } - - public void b(PacketDataSerializer packetdataserializer) throws IOException - { - } - - public EnumResourcePackStatus getResourcePackStatus() - { - return EnumResourcePackStatus.values()[_resourcePackStatus]; - } - - public void handle(PacketListener packetListener) - { - Player player = ((PlayerConnection) packetListener).getPlayer(); - PacketVerifier verifier = _packetHandler.getPacketVerifier(player); - - PacketInfo packetInfo = new PacketInfo(player, this, verifier); - - for (IPacketHandler handler : _packetHandler.getPacketHandlers()) - { - handler.handle(packetInfo); - } - // ((PlayerConnection) packetListener).PacketVerifier - // .processPacket(this, ((PlayerConnection) packetListener).networkManager); - - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayUseEntity.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayUseEntity.java deleted file mode 100644 index 7c050433f..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayUseEntity.java +++ /dev/null @@ -1,33 +0,0 @@ -package mineplex.core.packethandler; - -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_7_R4.PacketListener; -import net.minecraft.server.v1_7_R4.PacketPlayInListener; -import net.minecraft.server.v1_7_R4.PacketPlayInUseEntity; -import net.minecraft.server.v1_7_R4.PlayerConnection; - -public class PacketPlayUseEntity extends PacketPlayInUseEntity -{ - private static PacketHandler _packetHandler; - - @Override - public void handle(PacketListener packetlistener) - { - Player player = ((PlayerConnection) packetlistener).getPlayer(); - - PacketVerifier verifier = _packetHandler.getPacketVerifier(player); - - PacketInfo packetInfo = new PacketInfo(player, this, verifier); - - for (IPacketHandler handler : _packetHandler.getPacketHandlers()) - { - handler.handle(packetInfo); - } - - if (!packetInfo.isCancelled()) - { - a((PacketPlayInListener) packetlistener); - } - } -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java index 3985cb70d..0eb36e2d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java @@ -1,96 +1,42 @@ package mineplex.core.packethandler; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.server.v1_7_R4.IPacketVerifier; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; -import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; -import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes; -import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; +import com.mineplex.spigot.IPacketVerifier; + +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_8_R3.Packet; + public class PacketVerifier implements IPacketVerifier { - private static Field _destroyId; private Player _owner; - - private List _packetHandlers = new ArrayList(); + private PacketHandler _packetHandler; - public PacketVerifier(Player owner) - { - _owner = owner; - - if (_destroyId == null) - { - try - { - _destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a"); - _destroyId.setAccessible(true); - } - catch (Exception exception) - { - System.out.println("Field exception in CustomTagFix : "); - exception.printStackTrace(); - } - } - } - - @Override - public boolean verify(Packet o) - { - PacketInfo packetInfo = new PacketInfo(_owner, o, this); - - for (IPacketHandler handler : _packetHandlers) - { - handler.handle(packetInfo); - } - - return !packetInfo.isCancelled(); - } - - public void bypassProcess(Packet packet) - { - ((CraftPlayer)_owner).getHandle().playerConnection.networkManager.handle(packet, new GenericFutureListener[0]); - } - - public void Deactivate() - { + public PacketVerifier(Player player, PacketHandler packetHandler) + { + _owner = player; + _packetHandler = packetHandler; + } + + public void bypassProcess(Packet packet) + { + ((CraftPlayer) _owner).getHandle().playerConnection.networkManager.handle(packet); + } + + public void Deactivate() + { _owner = null; - } + } public void process(Packet packet) { - ((CraftPlayer)_owner).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(_owner, packet); } - public void clearHandlers() + @Override + public boolean handlePacket(Packet packet) { - _packetHandlers.clear(); + return _packetHandler.handlePacket(new PacketInfo(_owner, packet, this)); } - - public void addPacketHandler(IPacketHandler packetHandler) - { - _packetHandlers.add(packetHandler); - } - - public void removePacketHandler(IPacketHandler packetHandler) - { - _packetHandlers.remove(packetHandler); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/WrappedPacketDataSerializer.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/WrappedPacketDataSerializer.java deleted file mode 100644 index 0be73da27..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/WrappedPacketDataSerializer.java +++ /dev/null @@ -1,85 +0,0 @@ -package mineplex.core.packethandler; - -import java.io.DataInputStream; -import java.io.InputStream; -import java.lang.reflect.Field; - -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; -import org.spigotmc.LimitStream; - -import net.minecraft.server.v1_7_R4.Item; -import net.minecraft.server.v1_7_R4.ItemStack; -import net.minecraft.server.v1_7_R4.NBTCompressedStreamTools; -import net.minecraft.server.v1_7_R4.NBTReadLimiter; -import net.minecraft.server.v1_7_R4.NBTTagCompound; -import net.minecraft.server.v1_7_R4.PacketDataSerializer; -import net.minecraft.util.io.netty.buffer.ByteBuf; -import net.minecraft.util.io.netty.buffer.ByteBufInputStream; - -public class WrappedPacketDataSerializer extends PacketDataSerializer -{ - - public WrappedPacketDataSerializer(ByteBuf bytebuf) - { - super(bytebuf); - } - - public WrappedPacketDataSerializer(ByteBuf bytebuf, int version) - { - super(bytebuf, version); - } - - @Override - public ItemStack c() - { - try { - ItemStack itemstack = null; - short short0 = readShort(); - if (short0 >= 0) - { - byte b0 = readByte(); - short short1 = readShort(); - - itemstack = new ItemStack(Item.getById(short0), b0, short1); - itemstack.setTag(b()); - if (itemstack.getTag() != null) { - CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); - } - } - return itemstack; - } catch (Exception e) { - this.clear(); - return null; - } - } - - @Override - public NBTTagCompound b() - { - int i = readerIndex(); - byte b0 = readByte(); - if (b0 == 0) { - return null; - } - readerIndex(i); - ByteBufInputStream data = new ByteBufInputStream(this); - NBTReadLimiter nbtreadlimiter = new NBTReadLimiter(2097152L); - return NBTCompressedStreamTools.a(new DataInputStream(new LimitStream((InputStream)data, nbtreadlimiter)), nbtreadlimiter); - } - - public static WrappedPacketDataSerializer wrapDataSerializer(PacketDataSerializer data) { - try - { - Field a = data.getClass().getDeclaredField("a"); - a.setAccessible(true); - ByteBuf buff = (ByteBuf) a.get(data); - WrappedPacketDataSerializer w = new WrappedPacketDataSerializer(buff, data.version); - return w; - } - catch (Exception e) - { - e.printStackTrace(); - return null; - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index bd746ab78..9d631ff8d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -7,7 +7,6 @@ import java.util.Map.Entry; import mineplex.core.MiniClientPlugin; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; -import mineplex.core.pet.types.CustomWither; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.account.CoreClientManager; @@ -18,21 +17,23 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.donation.DonationManager; -import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.InventoryManager; -import mineplex.core.inventory.data.Item; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.EntityWither; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityWither; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; + +import com.google.gson.Gson; + +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Ageable; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; @@ -176,18 +177,24 @@ public class PetManager extends MiniClientPlugin if (entityType == EntityType.WITHER) { - _creatureModule.SetForce(true); - EntityWither wither = new CustomWither(((CraftWorld) location.getWorld()).getHandle()); - wither.Silent = true; - wither.setLocation(location.getX(), location.getY(), location.getZ(), 0, 0); - ((CraftWorld) location.getWorld()).getHandle().addEntity(wither, SpawnReason.CUSTOM); - pet = (Creature) wither.getBukkitEntity(); - _creatureModule.SetForce(false); - - Entity silverfish = _creatureModule.SpawnEntity(location, EntityType.SILVERFISH); + _creatureModule.SetForce(true); + + DisguiseWither witherDisguise = new DisguiseWither(null); + + witherDisguise.setInvulTime(530); + + _disguiseManager.addFutureDisguise(witherDisguise); + + pet = (Creature) location.getWorld().spawnEntity(location, EntityType.SILVERFISH); + UtilEnt.silence(pet, true); + + Creature silverfish = (Creature) _creatureModule.SpawnEntity(location, EntityType.SILVERFISH); UtilEnt.Vegetate(silverfish, true); - ((LivingEntity) silverfish).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0)); - pet.setPassenger(silverfish); + UtilEnt.silence(silverfish, true); + ((LivingEntity) silverfish).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0)); + pet.setPassenger(silverfish); + + _creatureModule.SetForce(false); } else { @@ -332,7 +339,7 @@ public class PetManager extends MiniClientPlugin if ((xDiff + yDiff + zDiff) > 4) { EntityCreature ec = ((CraftCreature) pet).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); int xIndex = -1; int zIndex = -1; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java index efb2331c0..a79065f4c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java @@ -2,9 +2,10 @@ package mineplex.core.pet.repository; import java.util.List; -import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; import org.bukkit.plugin.java.JavaPlugin; +import com.google.gson.reflect.TypeToken; + import mineplex.core.database.DBPool; import mineplex.core.database.RepositoryBase; import mineplex.core.database.column.ColumnInt; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/CustomWither.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/types/CustomWither.java deleted file mode 100644 index 8a3f39969..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/types/CustomWither.java +++ /dev/null @@ -1,196 +0,0 @@ -package mineplex.core.pet.types; - -import java.lang.reflect.Field; -import java.util.HashMap; - -import org.bukkit.craftbukkit.v1_7_R4.SpigotTimings; -import org.bukkit.entity.EntityType; - -import net.minecraft.server.v1_7_R4.EntityTypes; -import net.minecraft.server.v1_7_R4.EntityWither; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.World; - -public class CustomWither extends EntityWither -{ - static - { - try - { - Field f = EntityTypes.class.getDeclaredField("f"); - f.setAccessible(true); - HashMap map = (HashMap) f.get(null); - map.put(CustomWither.class, (int) EntityType.WITHER.getTypeId()); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - private int bq; - - public CustomWither(World world) - { - super(world); - s(530); - } - - @Override - protected void bn() - { - this.aU += 1; - this.world.methodProfiler.a("checkDespawn"); - w(); - this.world.methodProfiler.b(); - - if (this.fromMobSpawner) - { - return; - } - - this.world.methodProfiler.a("sensing"); - this.getEntitySenses().a(); - this.world.methodProfiler.b(); - this.world.methodProfiler.a("targetSelector"); - this.targetSelector.a(); - this.world.methodProfiler.b(); - this.world.methodProfiler.a("goalSelector"); - this.goalSelector.a(); - this.world.methodProfiler.b(); - this.world.methodProfiler.a("navigation"); - this.getNavigation().f(); - this.world.methodProfiler.b(); - this.world.methodProfiler.a("mob tick"); - bp(); - this.world.methodProfiler.b(); - this.world.methodProfiler.a("controls"); - this.world.methodProfiler.a("move"); - this.getControllerMove().c(); - this.world.methodProfiler.c("look"); - this.getControllerLook().a(); - this.world.methodProfiler.c("jump"); - this.getControllerJump().b(); - this.world.methodProfiler.b(); - this.world.methodProfiler.b(); - } - - @Override - public void e() - { - if (this.bq > 0) - { - this.bq -= 1; - } - - if (this.bg > 0) - { - double d0 = this.locX + (this.bh - this.locX) / this.bg; - double d1 = this.locY + (this.bi - this.locY) / this.bg; - double d2 = this.locZ + (this.bj - this.locZ) / this.bg; - double d3 = MathHelper.g(this.bk - this.yaw); - - this.yaw = ((float) (this.yaw + d3 / this.bg)); - this.pitch = ((float) (this.pitch + (this.bl - this.pitch) / this.bg)); - this.bg -= 1; - - if (!this.Vegetated) - { - setPosition(d0, d1, d2); - } - b(this.yaw, this.pitch); - } - else if (!br()) - { - this.motX *= 0.98D; - this.motY *= 0.98D; - this.motZ *= 0.98D; - } - - if (Math.abs(this.motX) < 0.005D) - { - this.motX = 0.0D; - } - - if (Math.abs(this.motY) < 0.005D) - { - this.motY = 0.0D; - } - - if (Math.abs(this.motZ) < 0.005D) - { - this.motZ = 0.0D; - } - - this.world.methodProfiler.a("ai"); - SpigotTimings.timerEntityAI.startTiming(); - if (bh()) - { - this.bc = false; - this.bd = 0.0F; - this.be = 0.0F; - this.bf = 0.0F; - } - else if (br()) - { - if (bk()) - { - this.world.methodProfiler.a("newAi"); - bn(); - this.world.methodProfiler.b(); - } - else - { - this.world.methodProfiler.a("oldAi"); - bq(); - this.world.methodProfiler.b(); - this.aO = this.yaw; - } - } - SpigotTimings.timerEntityAI.stopTiming(); - - this.world.methodProfiler.b(); - this.world.methodProfiler.a("jump"); - if (this.bc) - { - if ((!M()) && (!P())) - { - if ((this.onGround) && (this.bq == 0)) - { - bj(); - this.bq = 10; - } - } - else - this.motY += 0.03999999910593033D; - } - else - { - this.bq = 0; - } - - this.world.methodProfiler.b(); - this.world.methodProfiler.a("travel"); - this.bd *= 0.98F; - this.be *= 0.98F; - this.bf *= 0.9F; - SpigotTimings.timerEntityAIMove.startTiming(); - e(this.bd, this.be); - SpigotTimings.timerEntityAIMove.stopTiming(); - this.world.methodProfiler.b(); - this.world.methodProfiler.a("push"); - if (!this.world.isStatic) - { - SpigotTimings.timerEntityAICollision.startTiming(); - bo(); - SpigotTimings.timerEntityAICollision.stopTiming(); - } - - this.world.methodProfiler.b(); - } - - @Override - protected float bf() - { - return 0.4F; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java index 09f0e4ec3..a2d5298b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java @@ -6,15 +6,16 @@ import java.util.List; import java.util.UUID; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; -import net.minecraft.server.v1_7_R4.ChatSerializer; -import net.minecraft.server.v1_7_R4.PacketPlayOutChat; -import net.minecraft.util.com.google.gson.JsonObject; +import com.google.gson.JsonObject; + +import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; @@ -134,8 +135,8 @@ public class PollManager extends MiniDbClientPlugin textObject.add("clickEvent", clickObject); textObject.add("hoverEvent", hoverObject); - PacketPlayOutChat chatPacket = new PacketPlayOutChat(ChatSerializer.a(textObject.toString()), true); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket); + PacketPlayOutChat chatPacket = new PacketPlayOutChat(ChatSerializer.a(textObject.toString())); + UtilPlayer.sendPacket(player, chatPacket); } } player.sendMessage(""); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java index 2d4b29462..b051b051c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -293,6 +293,6 @@ public class PreferencesPage extends ShopPageBase canHit) + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, float hitboxGrow, List canHit) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, false, + expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false, null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List canHit) + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List canHit) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, pickup, + expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, pickup, null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow, List canHit) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, false, + expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false, sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow, List canHit) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, false, + expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false, sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List canHit) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, false, + expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false, sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult, List canHit) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, false, + expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false, sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult, canHit)); } @@ -148,6 +148,7 @@ public class ProjectileManager extends MiniPlugin if (cur.isDead() || !cur.isValid()) { + entry.getValue().getIThrown().Idle(entry.getValue()); iterator.remove(); continue; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 3d71c0831..1c64c938c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -10,19 +10,20 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_7_R4.AxisAlignedBB; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.MovingObjectPosition; -import net.minecraft.server.v1_7_R4.Vec3D; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MovingObjectPosition; +import net.minecraft.server.v1_8_R3.Vec3D; import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -36,7 +37,10 @@ public class ProjectileUser private IThrown _callback; private long _expireTime; + private long _startTime; + private boolean _hitPlayer = false; + private boolean _hitNonPlayerEntity = false; private boolean _hitBlock = false; private boolean _idle = false; private boolean _pickup = false; @@ -61,7 +65,7 @@ public class ProjectileUser private List _canHit; public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, ParticleType particle, float particleX, float particleY, @@ -74,7 +78,10 @@ public class ProjectileUser _callback = callback; _expireTime = expireTime; + _startTime = System.currentTimeMillis(); + _hitPlayer = hitPlayer; + _hitNonPlayerEntity = hitNonPlayerEntity; _hitBlock = hitBlock; _idle = idle; _pickup = pickup; @@ -97,7 +104,7 @@ public class ProjectileUser } public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, + long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, ParticleType particle, float particleX, float particleY, @@ -110,7 +117,10 @@ public class ProjectileUser _callback = callback; _expireTime = expireTime; + _startTime = System.currentTimeMillis(); + _hitPlayer = hitPlayer; + _hitNonPlayerEntity = hitNonPlayerEntity; _hitBlock = hitBlock; _idle = idle; _pickup = pickup; @@ -151,39 +161,45 @@ public class ProjectileUser public boolean Collision() { - if (_expireTime != -1 && System.currentTimeMillis() > _expireTime) + if (_expireTime != -1 && System.currentTimeMillis() > (_startTime + _expireTime)) { _callback.Expire(this); return true; } - if (_hitPlayer) + if (_hitPlayer || _hitNonPlayerEntity) { double distanceToEntity = 0.0D; LivingEntity victim = null; - net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity)_thrown).getHandle(); - Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); - Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); + net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity)_thrown).getHandle(); + Vec3D vec3d = new Vec3D(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); + Vec3D vec3d1 = new Vec3D(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); MovingObjectPosition finalObjectPosition = nmsEntity.world.rayTrace(vec3d, vec3d1, false, true, false); - vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); - vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); + vec3d = new Vec3D(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); + vec3d1 = new Vec3D(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); if (finalObjectPosition != null) { - vec3d1 = Vec3D.a(finalObjectPosition.pos.a, finalObjectPosition.pos.b, finalObjectPosition.pos.c); + vec3d1 = new Vec3D(finalObjectPosition.pos.a, finalObjectPosition.pos.b, finalObjectPosition.pos.c); } - for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().getEntities(((CraftEntity)_thrown).getHandle(), - ((CraftEntity)_thrown).getHandle().boundingBox.a( - ((CraftEntity)_thrown).getHandle().motX, - ((CraftEntity)_thrown).getHandle().motY, - ((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow))) + for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().getEntities(((CraftEntity) _thrown).getHandle(), + ((CraftEntity) _thrown).getHandle().getBoundingBox().a( + ((CraftEntity) _thrown).getHandle().motX, + ((CraftEntity) _thrown).getHandle().motY, + ((CraftEntity) _thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow))) { - if (entity instanceof net.minecraft.server.v1_7_R4.Entity) + if (!_hitNonPlayerEntity && !(entity instanceof EntityPlayer)) + continue; + + if (!_hitPlayer && entity instanceof EntityPlayer) + continue; + + if (entity instanceof net.minecraft.server.v1_8_R3.Entity) { - Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity(); + Entity bukkitEntity = ((net.minecraft.server.v1_8_R3.Entity) entity).getBukkitEntity(); if (bukkitEntity instanceof LivingEntity) { @@ -210,7 +226,7 @@ public class ProjectileUser } //float f1 = (float)(nmsEntity.boundingBox.a() * 0.6f); - AxisAlignedBB axisalignedbb1 = ((CraftEntity)ent).getHandle().boundingBox.grow(1F, 1F, 1F); + AxisAlignedBB axisalignedbb1 = ((CraftEntity)ent).getHandle().getBoundingBox().grow(1F, 1F, 1F); MovingObjectPosition entityCollisionPosition = axisalignedbb1.a(vec3d, vec3d1); if (entityCollisionPosition != null) @@ -241,7 +257,7 @@ public class ProjectileUser { if (_hitBlock) { - Block block = _thrown.getWorld().getBlockAt(finalObjectPosition.b, finalObjectPosition.c, finalObjectPosition.d); + Block block = _thrown.getWorld().getBlockAt(finalObjectPosition.a().getX(), finalObjectPosition.a().getY(), finalObjectPosition.a().getZ()); if (!UtilBlock.airFoliage(block) && !block.isLiquid()) { nmsEntity.motX = ((float) (finalObjectPosition.pos.a - nmsEntity.locX)); @@ -264,8 +280,8 @@ public class ProjectileUser //Idle if (_idle) { - if (_thrown.getVelocity().length() < 0.2 && - !UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN))) + if (_thrown.getVelocity().length() < 0.2 && (_thrown.isOnGround() || + !UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN)))) { _callback.Idle(this); return true; @@ -288,6 +304,11 @@ public class ProjectileUser return false; } + public IThrown getIThrown() + { + return _callback; + } + public LivingEntity GetThrower() { return _thrower; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 9336697f3..2a9851180 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -20,7 +20,7 @@ import mineplex.serverdata.commands.ServerCommandManager; import org.bukkit.Bukkit; import org.bukkit.Sound; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import com.google.gson.Gson; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java index ee4159867..3ed3d380d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/PunishRepository.java @@ -2,8 +2,7 @@ package mineplex.core.punish; import java.util.List; -import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; - +import com.google.gson.reflect.TypeToken; import mineplex.core.common.util.Callback; import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishToken; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java index 26f3a626c..d18f837a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -7,19 +7,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.inventory.ItemStack; - import mineplex.core.antihack.AntiHack; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -36,6 +23,19 @@ import mineplex.core.punish.PunishmentSorter; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.ItemStack; + public class PunishPage extends CraftInventoryCustom implements Listener { private Punish _plugin; @@ -233,12 +233,14 @@ public class PunishPage extends CraftInventoryCustom implements Listener examplePrefixEx + " Forcefield", examplePrefixEx + " Speed Hack", examplePrefixEx + " Reach Hack", + examplePrefixEx + " Speed Hack", examplePrefixEx + " Other Hack", " ", examplePrefix + "Hack Reports (SR & FR);", examplePrefixEx + " Forcefield", examplePrefixEx + " Speed Hack", examplePrefixEx + " Reach Hack", + examplePrefixEx + " Speed Hack", examplePrefixEx + " Other Hack", examplePrefixEx + " Fly Hack", } @@ -424,7 +426,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener @EventHandler public void OnInventoryClick(InventoryClickEvent event) { - if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player) + if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player) { if (_buttonMap.containsKey(event.getRawSlot())) { @@ -439,7 +441,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener @EventHandler public void OnInventoryClose(InventoryCloseEvent event) { - if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player) + if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player) { ClosePunish(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java index c5f4633de..8b9efbc51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java @@ -256,4 +256,25 @@ public class Recharge extends MiniPlugin _recharge.get(player.getName()).get(ability).debug(player); } + + public void displayExpBar(Player player, String ability) + { + if (!_recharge.containsKey(player.getName())) + { + player.setExp(1F); + return; + } + + RechargeData recharge = _recharge.get(player.getName()).get(ability); + + if (recharge == null) + { + player.setExp(1F); + return; + } + + float elasped = (float) (System.currentTimeMillis() - recharge.Time) / recharge.Recharge; + + player.setExp(Math.max(Math.min(1, elasped), 0)); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java index d15bce608..8e5ab89e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/Reward.java @@ -4,6 +4,8 @@ import java.util.Random; import org.bukkit.entity.Player; +import mineplex.core.common.util.Callback; + /** * Created by Shaun on 9/2/2014. */ @@ -13,16 +15,31 @@ public abstract class Reward private RewardRarity _rarity; private int _weight; + private boolean _requiresCallback; public Reward(RewardRarity rarity, int weight) { - _rarity = rarity; - _weight = weight; + this(rarity, weight, false); } - public final RewardData giveReward(RewardType rewardType, Player player) + public Reward(RewardRarity rarity, int weight, boolean requiresCallback) { - return giveRewardCustom(player, rewardType); + _rarity = rarity; + _weight = weight; + _requiresCallback = requiresCallback; + } + + public final void giveReward(RewardType rewardType, Player player, Callback rewardDataCallback) + { + if (_requiresCallback) + giveRewardCallback(rewardType, player, rewardDataCallback); + else + rewardDataCallback.run(giveRewardCustom(player, rewardType)); + } + + protected void giveRewardCallback(RewardType rewardType, Player player, Callback rewardDataCallback) + { + // do nothing } protected abstract RewardData giveRewardCustom(Player player, RewardType rewardType); @@ -40,4 +57,9 @@ public abstract class Reward { return _weight; } + + public boolean isRequiresCallback() + { + return _requiresCallback; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 5b89aa562..bd776c173 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -14,12 +14,15 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.pet.PetManager; import mineplex.core.reward.rewards.CoinReward; import mineplex.core.reward.rewards.ExperienceReward; import mineplex.core.reward.rewards.GemReward; +import mineplex.core.reward.rewards.GiveawayReward; import mineplex.core.reward.rewards.InventoryReward; import mineplex.core.reward.rewards.PetReward; import mineplex.core.reward.rewards.RankReward; @@ -27,6 +30,7 @@ import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.timing.TimingManager; +import mineplex.serverdata.Region; public class RewardManager { @@ -36,11 +40,13 @@ public class RewardManager private boolean _carlSpinner; private CoreClientManager _clientManager; + private DonationManager _donationManager; private ServerStatusManager _statusManager; + private GiveawayManager _giveawayManager; private boolean _doubleGadgetValue; - public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, + public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager, int commonValueMin, int commonValueMax, int uncommonValueMin, int uncommonValueMax, int rareValueMin, int rareValueMax, @@ -58,6 +64,8 @@ public class RewardManager _clientManager = clientManager; _statusManager = statusManager; + _donationManager = donationManager; + _giveawayManager = giveawayManager; _doubleGadgetValue = doubleGadgetValue; _carlSpinner = carlSpinner; @@ -393,6 +401,10 @@ public class RewardManager //Dont give Rank Upgrade if already has Titan if (rarity == RewardRarity.MYTHICAL) { + if (_statusManager.getRegion() == Region.US && canGiveMythical && type == RewardType.MythicalChest && Math.random() <= 0.1) + { + return getLogitechPrize(); + } if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { return new RankReward(_clientManager, _statusManager, 0, rarity); @@ -462,4 +474,37 @@ public class RewardManager return null; } + + private Reward getLogitechPrize() + { + double rand = Math.random(); + + String name; + String cooldown = "logitech"; + Material mat = Material.DIAMOND; + String displayName; + + if (rand < 0.2) + { + name = "logitechKeyboard"; + displayName = C.cRed + "Logitech G910 RGB Keyboard"; + } + else if (rand < 0.4) + { + name = "logitechMouse"; + displayName = C.cRed + "Logitech G303 Gaming Mouse"; + } + else if (rand < 0.6) + { + name = "logitechHeadset"; + displayName = C.cRed + "Logitech G430 Gaming Headset"; + } + else + { + name = "logitechMousePad"; + displayName = C.cRed + "Logitech G240 Gaming Mousepad"; + } + + return new GiveawayReward(_giveawayManager, _clientManager, _donationManager, _statusManager, name, cooldown, displayName , mat, (byte) 0, RewardRarity.MYTHICAL, 0); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java new file mode 100644 index 000000000..438124d54 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java @@ -0,0 +1,97 @@ +package mineplex.core.reward.rewards; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.donation.DonationManager; +import mineplex.core.giveaway.GiveawayManager; +import mineplex.core.giveaway.GiveawayResponse; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; +import mineplex.core.status.ServerStatusManager; + +public class GiveawayReward extends Reward +{ + private GiveawayManager _giveawayManager; + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private ServerStatusManager _serverStatusManager; + private String _giveawayName; + private String _cooldownName; + private String _displayName; + private Material _icon; + private byte _data; + + public GiveawayReward(GiveawayManager giveawayManager, CoreClientManager clientManager, DonationManager donationManager, ServerStatusManager serverStatusManager, String giveawayName, String cooldownName, String displayName, Material icon, byte data, RewardRarity rarity, int weight) + { + super(rarity, weight, true); + _giveawayManager = giveawayManager; + _clientManager = clientManager; + _donationManager = donationManager; + _serverStatusManager = serverStatusManager; + _giveawayName = giveawayName; + _cooldownName = cooldownName; + _displayName = displayName; + _icon = icon; + _data = data; + } + + @Override + protected void giveRewardCallback(final RewardType rewardType, final Player player, final Callback rewardDataCallback) + { + _giveawayManager.attemptToGiveaway(_giveawayName, _cooldownName, player, new Callback() + { + @Override + public void run(GiveawayResponse data) + { + if (data.isSuccess()) + { + RewardData rewardData = new RewardData(_displayName, new ItemStack(_icon, 1, (short) 0, _data), getRarity()); + if (rewardDataCallback != null) rewardDataCallback.run(rewardData); + } + else + { + System.out.println("GIVEAWAY FAILED: " + data.getFailReason().name()); + + // Dang, I guess we failed! + if (!_clientManager.hasRank(player, Rank.TITAN)) + { + Reward reward = new RankReward(_clientManager, _serverStatusManager, 0, getRarity()); + reward.giveReward(rewardType, player, rewardDataCallback); + } + else + { + Reward reward = new CoinReward(_donationManager, 20000, 30000, 0, getRarity()); + reward.giveReward(rewardType, player, rewardDataCallback); + } + } + } + }); + } + + @Override + protected RewardData giveRewardCustom(Player player, RewardType rewardType) + { + // This is a little hacky, this should never be called! + return null; + } + + @Override + public RewardData getFakeRewardData(Player player) + { + // Let's pretend we are coins! + return new RewardData(getRarity().getColor() + "Coins", new ItemStack(175), getRarity()); + } + + @Override + public boolean canGiveReward(Player player) + { + return true; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java index fb07a0d82..166c2eb42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/server/remotecall/JsonWebCall.java @@ -20,7 +20,7 @@ import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.message.BasicHeader; import org.apache.http.protocol.HTTP; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; +import com.google.gson.Gson; public class JsonWebCall { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java b/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java index f4f883083..efd8dfa97 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java @@ -2,9 +2,9 @@ package mineplex.core.serverConfig; import java.lang.reflect.Field; -import net.minecraft.server.v1_7_R4.PlayerList; +import net.minecraft.server.v1_8_R3.PlayerList; -import org.bukkit.craftbukkit.v1_7_R4.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; @@ -49,7 +49,7 @@ public class ServerConfiguration extends MiniPlugin } _plugin.getServer().setWhitelist(_serverGroup.getWhitelist()); - ((CraftServer)_plugin.getServer()).getServer().setPvP(_serverGroup.getPvp()); + ((CraftServer)_plugin.getServer()).getServer().setPVP(_serverGroup.getPvp()); //((CraftServer)_plugin.getServer()).getServer().setTexturePack(_serverGroup.getResourcePack()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java index 0452a13cb..05fca2996 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java @@ -5,11 +5,11 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; -import net.minecraft.server.v1_7_R4.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityPlayer; import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java index 0d7cdb3d5..e92312552 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java @@ -5,7 +5,7 @@ import java.util.List; import org.bukkit.entity.Player; import mineplex.core.account.CoreClient; -import net.minecraft.server.v1_7_R4.IInventory; +import net.minecraft.server.v1_8_R3.IInventory; public interface ISalesPackage { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java index 539bbe4fc..c8257bce2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java @@ -5,10 +5,10 @@ import java.util.List; import mineplex.core.account.CoreClient; import mineplex.core.common.util.InventoryUtil; -import net.minecraft.server.v1_7_R4.IInventory; +import net.minecraft.server.v1_8_R3.IInventory; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java index 89ee6e903..37622a13b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java @@ -3,7 +3,7 @@ package mineplex.core.shop.item; import java.util.ArrayList; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -35,7 +35,7 @@ public class ShopItem extends ItemStack UpdateVisual(true); } - public net.minecraft.server.v1_7_R4.ItemStack getHandle() { + public net.minecraft.server.v1_8_R3.ItemStack getHandle() { return CraftItemStack.asNMSCopy(this); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java index 04c17b00c..45df62bbe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java @@ -1,16 +1,16 @@ package mineplex.core.shop.page; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryDoubleChest; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryPlayer; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryView; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryDoubleChest; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryPlayer; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryView; -import net.minecraft.server.v1_7_R4.Container; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.IInventory; -import net.minecraft.server.v1_7_R4.InventoryLargeChest; -import net.minecraft.server.v1_7_R4.PlayerInventory; -import net.minecraft.server.v1_7_R4.Slot; +import net.minecraft.server.v1_8_R3.Container; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.IInventory; +import net.minecraft.server.v1_8_R3.InventoryLargeChest; +import net.minecraft.server.v1_8_R3.PlayerInventory; +import net.minecraft.server.v1_8_R3.Slot; public class AnvilContainer extends Container { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java index 67f346fd0..51450bfb9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java @@ -1,9 +1,9 @@ package mineplex.core.shop.page; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; @@ -89,7 +89,7 @@ public abstract class ShopPageBase inventory.getSize() - 1) @@ -140,7 +140,7 @@ public abstract class ShopPageBase= 0) { - if (event.getInventory().getTitle() == inventory.getInventoryName() && (inventory.getSize() <= event.getSlot() || inventory.getItem(event.getSlot()) != null)) + if (event.getInventory().getTitle() == inventory.getName() && (inventory.getSize() <= event.getSlot() || inventory.getItem(event.getSlot()) != null)) { playDenySound(_player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java index 83f495718..03ebb5a82 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java @@ -5,10 +5,6 @@ import java.sql.SQLException; import java.util.List; import java.util.UUID; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.Callback; @@ -16,6 +12,10 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.task.repository.TaskRepository; import mineplex.playerCache.PlayerCache; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + public class TaskManager extends MiniDbClientPlugin { private static Object _taskLock = new Object(); @@ -56,31 +56,32 @@ public class TaskManager extends MiniDbClientPlugin { public void run() { + boolean taskExists = false; + synchronized (_taskLock) { - if (!_tasks.containsKey(task)) - { - _repository.addTask(task); - System.out.println("TaskManager Adding Task : " + task); - } + taskExists = _tasks.containsKey(task); } - updateTasks(); - - synchronized (_taskLock) + if (!taskExists) { - final boolean success = _repository.addAccountTask(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), _tasks.get(task)); + _repository.addTask(task); + System.out.println("TaskManager Adding Task : " + task); - if (callback != null) + updateTasks(); + } + + final boolean success = _repository.addAccountTask(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), getTaskId(task)); + + if (callback != null) + { + Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() { - Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() + public void run() { - public void run() - { - callback.run(success); - } - }); - } + callback.run(success); + } + }); } } }); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 86806edb7..daafaea51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -5,20 +5,24 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Random; +import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Player; -import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.hologram.HologramManager; @@ -128,7 +132,7 @@ public class Treasure } } - Block block = _player.getTargetBlock(null, 3); + Block block = _player.getTargetBlock((Set) null, 3); if (block.getType() == _treasureType.getMaterial()) { ChestData data = getChestData(block); @@ -193,53 +197,59 @@ public class Treasure openChest(block, true); } - public void openChest(Block block, boolean swapList) + public void openChest(final Block block, final boolean swapList) { - ChestData data = getChestData(block); + // This is very experimental! Pray to god that this works + final ChestData data = getChestData(block); if (data != null && !data.isOpened() && _currentReward < _rewards.length) { - Reward reward = _rewards[_currentReward]; - RewardData rewardData = reward.giveReward(_rewardType, _player); - _currentReward++; - - if (swapList) - { - BlockInfo info = getBlockInfo(block); - _chestBlockInfo.remove(info); - _openedChestBlockInfo.add(info); - } - + final Reward reward = _rewards[_currentReward]; data.setOpened(true); - ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(this, data, rewardData, _hologramManager); - _animations.add(chestOpenTask); + _currentReward++; + reward.giveReward(_rewardType, _player, new Callback() + { + @Override + public void run(RewardData rewardData) + { + if (swapList) + { + BlockInfo info = getBlockInfo(block); + _chestBlockInfo.remove(info); + _openedChestBlockInfo.add(info); + } - // Extra effects based off the rarity of the treasure - if (reward.getRarity() == RewardRarity.UNCOMMON) - { - _animations.add(new LootUncommonAnimation(this, data.getBlock())); - } - else if (reward.getRarity() == RewardRarity.RARE) - { - _animations.add(new LootRareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5))); - Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName())); - } - else if (reward.getRarity() == RewardRarity.LEGENDARY) - { - _animations.add(new LootLegendaryAnimation(this, data.getBlock())); - Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName())); - } - else if (reward.getRarity() == RewardRarity.MYTHICAL) - { - _animations.add(new LootMythicalAnimation(this, data.getBlock())); - Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName())); - } + ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(Treasure.this, data, rewardData, _hologramManager); + _animations.add(chestOpenTask); - if (isFinished()) - { - TreasureRemoveAnimation animation = new TreasureRemoveAnimation(this, _openedChestBlockInfo, _chestBlockInfo); - _animations.add(animation); - _finished = true; - } + // Extra effects based off the rarity of the treasure + if (reward.getRarity() == RewardRarity.UNCOMMON) + { + _animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock())); + } + else if (reward.getRarity() == RewardRarity.RARE) + { + _animations.add(new LootRareAnimation(Treasure.this, data.getBlock().getLocation().add(0.5, 1.5, 0.5))); + Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName())); + } + else if (reward.getRarity() == RewardRarity.LEGENDARY) + { + _animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock())); + Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName())); + } + else if (reward.getRarity() == RewardRarity.MYTHICAL) + { + _animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock())); + Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName())); + } + + if (isFinished()) + { + TreasureRemoveAnimation animation = new TreasureRemoveAnimation(Treasure.this, _openedChestBlockInfo, _chestBlockInfo); + _animations.add(animation); + _finished = true; + } + } + }); } } @@ -260,11 +270,11 @@ public class Treasure if (data.isOpened()) { Block block = data.getBlock(); - PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(block.getX(), block.getY(), block.getZ(), CraftMagicNumbers.getBlock(block), 1, 1); + PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(new BlockPosition(block.getX(), block.getY(), block.getZ()), CraftMagicNumbers.getBlock(block), 1, 1); for (Player player : players) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } @@ -299,7 +309,14 @@ public class Treasure for (int i = _currentReward; i < _rewards.length; i++) { - _rewards[_currentReward].giveReward(_rewardType, _player); + _rewards[_currentReward].giveReward(_rewardType, _player, new Callback() + { + @Override + public void run(RewardData data) + { + // Do nothing + } + }); } _currentReward = _rewards.length; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 92ced2a3d..c5e6aacac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -14,6 +14,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.donation.DonationManager; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.pet.PetManager; @@ -35,7 +36,7 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _treasureLocations; - public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager) + public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, GiveawayManager giveawayManager) { super("Treasure", plugin); @@ -43,7 +44,7 @@ public class TreasureManager extends MiniPlugin _blockRestore = blockRestore; _hologramManager = hologramManager; _statsManager = statsManager; - _rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager, + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager, giveawayManager, 100, 250, 500, 1000, 4000, 6000, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java index a08f1c226..ca906d891 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java @@ -4,16 +4,18 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction; -import net.minecraft.server.v1_7_R4.TileEntity; -import net.minecraft.server.v1_7_R4.TileEntityEnderChest; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; +import net.minecraft.server.v1_8_R3.TileEntity; +import net.minecraft.server.v1_8_R3.TileEntityEnderChest; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; @@ -42,18 +44,18 @@ public class ChestOpenAnimation extends Animation // Send chest open packet Block block = chestData.getBlock(); - PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(block.getX(), block.getY(), block.getZ(), + PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(new BlockPosition(block.getX(), block.getY(), block.getZ()), CraftMagicNumbers.getBlock(block), 1, 1); for (Player other : UtilServer.getPlayers()) { - ((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(other, packet); if (block.getType() == Material.ENDER_CHEST) { // Fix for Ender Chests closing as soon as they are opened TileEntity tileEntity = ((CraftWorld) block.getWorld()).getTileEntityAt(block.getX(), block.getY(), block.getZ()); if (tileEntity instanceof TileEntityEnderChest) - ((TileEntityEnderChest)tileEntity).j = 1; + ((TileEntityEnderChest)tileEntity).g = 1; } other.playSound(block.getLocation(), Sound.CHEST_OPEN, 1, 1); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 545bc55e0..54fc12cee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -8,10 +8,11 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.util.Vector; -import net.minecraft.server.v1_7_R4.MathHelper; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.MathHelper; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; @@ -135,7 +136,7 @@ public class ChestSpawnAnimation extends Animation int i = MathHelper.floor(_centerLocation.getX()); int j = MathHelper.floor(_centerLocation.getY() - 0.20000000298023224D - 0.5); int k = MathHelper.floor(_centerLocation.getZ()); - ((CraftWorld) _centerLocation.getWorld()).getHandle().triggerEffect(2006, i, j, k, MathHelper.f(60 - 3.0F)); + ((CraftWorld) _centerLocation.getWorld()).getHandle().triggerEffect(2006, new BlockPosition(i, j, k), MathHelper.f(60 - 3.0F)); } finish(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java index b5f08c4dd..2c5f57637 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java @@ -6,7 +6,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.recharge.Recharge; import mineplex.core.timing.TimingManager; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; public class VisibilityData diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index d256a560a..e77a79480 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -2,10 +2,8 @@ package mineplex.enjinTranslator; import java.text.SimpleDateFormat; import java.util.AbstractMap; -import java.util.ArrayList; import java.util.Date; import java.util.Iterator; -import java.util.List; import java.util.Map.Entry; import java.util.UUID; @@ -25,30 +23,27 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; -import mineplex.core.punish.Category; import mineplex.core.punish.Punish; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.enjinTranslator.purchase.PurchaseManager; public class Enjin extends MiniPlugin implements CommandExecutor { private CoreClientManager _clientManager; private DonationManager _donationManager; private InventoryManager _inventoryManager; - private Punish _punish; - - private TempRepository _repository; + private PurchaseManager _purchaseManager; private NautHashMap> _cachedUUIDs = new NautHashMap>(); - private List _commandQueue = new ArrayList(); private static Object _commandLock = new Object(); public long _lastPoll = System.currentTimeMillis() - 120000; private SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); - public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, Punish punish) + public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) { super("Enjin", plugin); @@ -56,8 +51,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor _donationManager = donationManager; _inventoryManager = inventoryManager; - _punish = punish; - _repository = new TempRepository(plugin); + _purchaseManager = new PurchaseManager(plugin); plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); @@ -77,60 +71,6 @@ public class Enjin extends MiniPlugin implements CommandExecutor iterator.remove(); } } - - @EventHandler - public void processCommandQueue(UpdateEvent event) - { - if (event.getType() != UpdateType.MIN_01 || _commandQueue.size() == 0) - return; - - List commandCopyQueue = new ArrayList(); - - synchronized (_commandLock) - { - for (QueuedCommand command : _commandQueue) - commandCopyQueue.add(command); - - _commandQueue.clear(); - } - - System.out.println("=====] Processing queued commands [====="); - for (QueuedCommand command : commandCopyQueue) - { - try - { - onCommand(command.Sender, command.Command, command.Label, command.Args); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - } - System.out.println("========================================"); - } - - @EventHandler - public void pollLastPurchases(UpdateEvent event) - { - if (event.getType() != UpdateType.MIN_01) - return; - - /* - @SuppressWarnings("serial") - List purchases = new JsonWebCall("http://www.mineplex.com/api/m-shopping-purchases/m/14702725").Execute(new TypeToken>(){}.getType(), null); - _lastPoll = System.currentTimeMillis(); - - int i = 0; - for (EnjinPurchase purchase : purchases) - { - if (i > 10) - break; - - purchase.logInfoToConsole(); - i++; - } - */ - } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) @@ -180,240 +120,20 @@ public class Enjin extends MiniPlugin implements CommandExecutor final UUID playerUUID = uuid; _cachedUUIDs.put(name, new AbstractMap.SimpleEntry(playerUUID, System.currentTimeMillis() + 240000)); - - if (args.length == 3 && args[0].equalsIgnoreCase("gem")) - { - final int amount = Integer.parseInt(args[2]); - - _donationManager.RewardGems(new Callback() - { - public void run (Boolean response) - { - if (response) - { - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " gems."); - } - else - { - //_commandQueue.add(new QueuedCommand(sender, command, label, args)); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " gems. Queuing for run later."); - } - } - }, "purchase", name, playerUUID, amount); - } - else if (args.length == 3 && args[0].equalsIgnoreCase("coin")) - { - final int amount = Integer.parseInt(args[2]); - _donationManager.RewardCoins(new Callback() - { - public void run (Boolean response) + if (!checkForCoinPurchase(args, name, playerUUID, client)) + if (!checkForRankPurchase(args, name, playerUUID, client)) + if(!checkForPurchase(args, name, client)) { - if (response) + StringBuilder sb = new StringBuilder(); + + for (String arg : args) { - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " coins."); - } - else - { - //_commandQueue.add(new QueuedCommand(sender, command, label, args)); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " coins. Queuing for run later."); + sb.append(arg + " "); } + + System.out.println("Received Command : " + sb.toString()); } - }, "purchase", name, client.getAccountId(), amount); - } - else if (args.length == 3 && args[0].equalsIgnoreCase("booster")) - { - int amount = Integer.parseInt(args[2]); - - _donationManager.PurchaseUnknownSalesPackage(null, name, client.getAccountId(), "Gem Booster " + amount, false, 0, false); - _repository.addGemBooster(name, amount); - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Gem Boosters" + "."); - } - else if (args.length >= 3 && args[0].equalsIgnoreCase("key")) - { - final int amount = Integer.parseInt(args[2]); - - if (args.length == 4) - { - _inventoryManager.addItemToInventoryForOffline(new Callback() - { - public void run(Boolean success) - { - if (success) - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Treasure Keys" + "."); - else - { - // Add arg so we don't add back to windows api call - //_commandQueue.add(new QueuedCommand(sender, command, label, new String[] { args[0], args[1], args[2], "noaccountchange" })); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Keys. Queuing for run later."); - } - } - }, playerUUID, "Treasure", "Treasure Key", amount); - } - else - { - _donationManager.PurchaseUnknownSalesPackage(new Callback() - { - public void run(TransactionResponse data) - { - if (data == TransactionResponse.Success) - { - _inventoryManager.addItemToInventoryForOffline(new Callback() - { - public void run(Boolean success) - { - if (success) - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Treasure Keys" + "."); - else - { - // Add arg so we don't add back to windows api call - //_commandQueue.add(new QueuedCommand(sender, command, label, new String[] { args[0], args[1], args[2], "noaccountchange" })); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Keys. Queuing for run later."); - } - } - }, playerUUID, "Treasure", "Treasure Key", amount); - } - else - { - //_commandQueue.add(new QueuedCommand(sender, command, label, args)); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Keys. Queuing for run later."); - } - } - }, name, client.getAccountId(), "Treasure Key " + amount, false, 0, false); - } - } - else if (args.length >= 3 && args[0].equalsIgnoreCase("chest")) - { - final int amount = Integer.parseInt(args[2]); - - if (args.length == 4) - { - _inventoryManager.addItemToInventoryForOffline(new Callback() - { - public void run(Boolean success) - { - if (success) - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Treasure Chests" + "."); - else - { - // Add arg so we don't add back to windows api call - //_commandQueue.add(new QueuedCommand(sender, command, label, new String[] { args[0], args[1], args[2], "noaccountchange" })); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Chests. Queuing for run later."); - } - } - }, playerUUID, "Utility", "Treasure Chest", amount); - } - else - { - _donationManager.PurchaseUnknownSalesPackage(new Callback() - { - public void run(TransactionResponse data) - { - _inventoryManager.addItemToInventoryForOffline(new Callback() - { - public void run(Boolean success) - { - if (success) - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " Treasure Chests" + "."); - else - { - // Add arg so we don't add back to windows api call - //_commandQueue.add(new QueuedCommand(sender, command, label, new String[] { args[0], args[1], args[2], "noaccountchange" })); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Chests. Queuing for run later."); - } - } - }, playerUUID, "Utility", "Treasure Chest", amount); - } - }, name, client.getAccountId(), "Treasure Chest " + amount, false, 0, false); - } - } - else if (args.length == 4 && args[0].equalsIgnoreCase("rank")) - { - final Rank rank = mineplex.core.common.Rank.valueOf(args[2]); - final boolean perm = Boolean.parseBoolean(args[3]); - - _clientManager.loadClientByName(name, new Runnable() - { - public void run() - { - if (rank == Rank.ALL || _clientManager.Get(name).GetRank() == Rank.ALL || !_clientManager.Get(name).GetRank().has(rank) || _clientManager.Get(name).GetRank() == rank) - { - _clientManager.SaveRank(name, playerUUID, rank, perm); - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + rank + " " + (perm ? "permanently." : "for 1 month.")); - } - else - { - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " DENIED INFERIOR " + rank + " " + (perm ? "permanently." : "for 1 month.")); - } - } - }); - } - else if (args.length >= 3 && args[0].equalsIgnoreCase("purchase")) - { - final int amount = Integer.parseInt(args[2]); - final String category = args[3]; - String tempName = args[4]; - - for (int i = 5; i < args.length; i++) - { - tempName += " " + args[i]; - } - - final String packageName = tempName; - - _donationManager.PurchaseUnknownSalesPackage(new Callback() - { - public void run(TransactionResponse data) - { - if (data == TransactionResponse.Success) - { - _inventoryManager.addItemToInventoryForOffline(new Callback() - { - public void run(Boolean success) - { - if (success) - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " " + packageName + "."); - else - { - // Add arg so we don't add back to windows api call - //_commandQueue.add(new QueuedCommand(sender, command, label, new String[] { args[0], args[1], args[2], "noaccountchange" })); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + packageName + ". Queuing for run later."); - } - } - }, playerUUID, category, packageName, amount); - } - else - { - //_commandQueue.add(new QueuedCommand(sender, command, label, args)); - System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " Treasure Keys. Queuing for run later."); - } - } - }, name, client.getAccountId(), packageName, false, 0, false); - } - else if (args.length >= 3 && args[0].equalsIgnoreCase("unban")) - { - String reason = args[2]; - - for (int i = 3; i < args.length; i++) - { - reason += " " + args[i]; - } - - _punish.RemoveBan(name, reason); - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " unbanned for " + reason); - } - else if (args.length >= 3 && args[0].equalsIgnoreCase("ban")) - { - String reason = args[2]; - - for (int i = 3; i < args.length; i++) - { - reason += " " + args[i]; - } - - _punish.AddPunishment(name, Category.Other, reason, null, 3, true, -1); - System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " banned for " + reason); - } } } }); @@ -436,4 +156,111 @@ public class Enjin extends MiniPlugin implements CommandExecutor return true; } -} + + protected boolean checkForRankPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) + { + if (args.length != 4 || !args[0].equalsIgnoreCase("rank")) + return false;; + + final Rank rank = mineplex.core.common.Rank.valueOf(args[2]); + final boolean perm = Boolean.parseBoolean(args[3]); + + _clientManager.loadClientByName(name, new Runnable() + { + public void run() + { + if (rank == Rank.ALL || _clientManager.Get(name).GetRank() == Rank.ALL || !_clientManager.Get(name).GetRank().has(rank) || _clientManager.Get(name).GetRank() == rank) + { + _clientManager.SaveRank(new Callback() + { + public void run(Rank data) + { + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), rank.Name + (perm ? " Permanent" : " Monthly"), 1, data == rank); + } + }, name, playerUUID, rank, perm); + + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + rank + " " + (perm ? "permanently." : "for 1 month.")); + } + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " DENIED INFERIOR " + rank + " " + (perm ? "permanently." : "for 1 month.")); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), rank.Name + (perm ? " Permanent" : " Monthly"), 1, false); + } + } + }); + + return true; + } + + protected boolean checkForPurchase(String[] args, final String name, final CoreClient client) + { + if (args.length < 3 || !args[0].equalsIgnoreCase("purchase")) + return false; + + final int amount = Integer.parseInt(args[2]); + String tempName = args[4]; + + for (int i = 5; i < args.length; i++) + { + tempName += " " + args[i]; + } + + final String packageName = tempName; + + _donationManager.PurchaseUnknownSalesPackage(new Callback() + { + public void run(TransactionResponse data) + { + if (data == TransactionResponse.Success) + { + _inventoryManager.addItemToInventoryForOffline(new Callback() + { + public void run(Boolean success) + { + if (success) + { + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, true); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " " + packageName + "."); + } + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + packageName + ". Queuing for run later."); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, false); + } + } + }, client.getAccountId(), packageName, amount); + } + else + { + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + ". Queuing for run later."); + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, data == TransactionResponse.Success); + } + } + }, name, client.getAccountId(), amount == 1 ? packageName : packageName + " " + amount, false, 0, false); + + return true; + } + + protected boolean checkForCoinPurchase(String[] args, final String name, final UUID playerUUID, final CoreClient client) + { + if (args.length != 3 || !args[0].equalsIgnoreCase("coin")) + return false; + + final int amount = Integer.parseInt(args[2]); + + _donationManager.RewardCoins(new Callback() + { + public void run (Boolean response) + { + if (response) + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " coins."); + else + System.out.println("[" + _dateFormat.format(new Date()) + "] ERROR processing " + name + " " + amount + " coins. Queuing for run later."); + + _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), "Coins", amount, response); + } + }, "purchase", name, client.getAccountId(), amount); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java index d9222b689..1304f0a3e 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/EnjinTranslator.java @@ -28,11 +28,9 @@ public class EnjinTranslator extends JavaPlugin CommandCenter.Instance.setClientManager(clientManager); DonationManager donationManager = new DonationManager(this, clientManager, GetWebServerAddress()); - //Other Modules - Punish punish = new Punish(this, GetWebServerAddress(), clientManager); //Main Modules - new Enjin(this, clientManager, donationManager, new InventoryManager(this, clientManager), punish); + new Enjin(this, clientManager, donationManager, new InventoryManager(this, clientManager)); new Updater(this); } diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/PurchaseManager.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/PurchaseManager.java new file mode 100644 index 000000000..1897f407e --- /dev/null +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/PurchaseManager.java @@ -0,0 +1,75 @@ +package mineplex.enjinTranslator.purchase; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.database.ResultSetCallable; +import mineplex.enjinTranslator.purchase.data.PurchaseRepository; +import mineplex.enjinTranslator.purchase.data.Package; + +public class PurchaseManager extends MiniPlugin +{ + private static Object _purchaseLock = new Object(); + + private PurchaseRepository _repository; + private NautHashMap _purchases = new NautHashMap(); + + public PurchaseManager(JavaPlugin plugin) + { + super("Purchase Manager", plugin); + + _repository = new PurchaseRepository(plugin); + + Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(getPlugin(), new Runnable() + { + public void run() + { + updatePackages(); + } + }, 20L); + } + + private void updatePackages() + { + List packages = _repository.retrievePackages(); + + synchronized (_purchaseLock) + { + for (mineplex.enjinTranslator.purchase.data.Package purchasePackage : packages) + { + _purchases.put(purchasePackage.getName(), purchasePackage); + } + } + } + + public void addAccountPurchaseToQueue(int accountId, final String packageName, int count, boolean success) + { + synchronized (_purchaseLock) + { + if (!_purchases.containsKey(packageName)) + { + _repository.addPackage(packageName, new ResultSetCallable() + { + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + int packageId = resultSet.getInt(1); + + _purchases.put(packageName, new Package(packageId, packageName)); + System.out.println("Added new package : " + packageName); + } + } + }); + } + + _repository.addAccountPurchase(accountId, _purchases.get(packageName).getId(), count, success); + } + } +} diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/Package.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/Package.java new file mode 100644 index 000000000..9796b8a5d --- /dev/null +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/Package.java @@ -0,0 +1,23 @@ +package mineplex.enjinTranslator.purchase.data; + +public class Package +{ + private int _id; + private String _name; + + public Package(int id, String name) + { + _id = id; + _name = name; + } + + public int getId() + { + return _id; + } + + public String getName() + { + return _name; + } +} diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java new file mode 100644 index 000000000..d71d09552 --- /dev/null +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java @@ -0,0 +1,62 @@ +package mineplex.enjinTranslator.purchase.data; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnBoolean; +import mineplex.core.database.column.ColumnInt; +import mineplex.core.database.column.ColumnVarChar; + +public class PurchaseRepository extends RepositoryBase +{ + private static String INSERT_ACCOUNT_PURCHASE = "INSERT INTO accountPurchases (accountId, packageId, amount, date, success) VALUES (?, ?, ?, now(), ?);"; + + private static String INSERT_PACKAGE = "INSERT INTO packages (packageName) VALUES (?);"; + private static String RETRIEVE_PACKAGES = "SELECT id, packageName FROM packages;"; + + public PurchaseRepository(JavaPlugin plugin) + { + super(plugin, DBPool.ACCOUNT); + } + + @Override + protected void initialize() { } + + @Override + protected void update() { } + + public void addPackage(String name, ResultSetCallable callable) + { + executeInsert(INSERT_PACKAGE, callable, new ColumnVarChar("packageName", 100, name)); + } + + public List retrievePackages() + { + final List packages = new ArrayList(); + + executeQuery(RETRIEVE_PACKAGES, new ResultSetCallable() + { + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + packages.add(new Package(resultSet.getInt(1), resultSet.getString(2))); + } + } + }); + + return packages; + } + + public boolean addAccountPurchase(int accountId, int packageId, int count, boolean success) + { + return executeInsert(INSERT_ACCOUNT_PURCHASE, null, new ColumnInt("accountId", accountId), new ColumnInt("packageId", packageId), new ColumnInt("count", count), new ColumnBoolean("success", success)) > 0; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 979745883..8a46416d1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -1,10 +1,11 @@ package mineplex.hub; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.CustomTagFix; -import mineplex.core.TablistFix; +import mineplex.core.PacketsInteractionFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; @@ -19,6 +20,7 @@ import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.friend.FriendManager; import mineplex.core.give.Give; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; @@ -73,6 +75,7 @@ public class Hub extends JavaPlugin implements IRelation @Override public void onEnable() { + Bukkit.setSpawnRadius(0); getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); saveConfig(); @@ -111,6 +114,7 @@ public class Hub extends JavaPlugin implements IRelation //Main Modules ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); + GiveawayManager giveawayManager = new GiveawayManager(this, clientManager, serverStatusManager); new TitanGiveawayManager(this, clientManager, serverStatusManager); Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); @@ -127,7 +131,7 @@ public class Hub extends JavaPlugin implements IRelation PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); @@ -137,7 +141,7 @@ public class Hub extends JavaPlugin implements IRelation new MemoryFix(this); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new CustomTagFix(this, packetHandler); - new TablistFix(this); + new PacketsInteractionFix(this, packetHandler); new ResPackManager(new ResUnloadCheck() { public boolean canSendUnload(Player player) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index b8235a82c..bca594e85 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -30,6 +30,7 @@ import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetActivateEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.message.PrivateMessageEvent; @@ -66,6 +67,7 @@ import mineplex.hub.modules.NewsManager; import mineplex.hub.modules.ParkourManager; import mineplex.hub.modules.SoccerManager; import mineplex.hub.modules.TextManager; +import mineplex.hub.modules.TrickOrTreatManager; import mineplex.hub.modules.WorldManager; import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.tutorial.TutorialManager; @@ -75,13 +77,15 @@ import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityPlayer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -93,6 +97,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.InventoryClickEvent; @@ -115,7 +120,7 @@ import org.bukkit.scoreboard.Scoreboard; public class HubManager extends MiniClientPlugin { // ☃❅ Snowman! - public HubType Type = HubType.Halloween; + public HubType Type = HubType.Normal; private BlockRestore _blockRestore; private CoreClientManager _clientManager; @@ -142,6 +147,7 @@ public class HubManager extends MiniClientPlugin private PacketHandler _packetHandler; private PersonalServerManager _personalServerManager; // private HalloweenSpookinessManager _halloweenManager; +// private TrickOrTreatManager _trickOrTreatManager; private Location _spawn; private int _scoreboardTick = 0; @@ -159,7 +165,7 @@ public class HubManager extends MiniClientPlugin //Admin private boolean _gadgetsEnabled = true; - public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager) + public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager) { super("Hub Manager", plugin); @@ -192,11 +198,13 @@ public class HubManager extends MiniClientPlugin new BenefitManager(plugin, clientManager, _inventoryManager); _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager); - _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager); + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, giveawayManager); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); new SoccerManager(this, _gadgetManager); new KothManager(this, _gadgetManager); + + //new TrickOrTreatManager(_plugin, this, taskManager, donationManager, clientManager); _petManager = petManager; _partyManager = partyManager; @@ -218,7 +226,7 @@ public class HubManager extends MiniClientPlugin ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; - new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager); + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager); // _halloweenManager = new HalloweenSpookinessManager(this); @@ -972,6 +980,27 @@ public class HubManager extends MiniClientPlugin } } + @EventHandler + public void clearEntityTargets(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Entity entity : Bukkit.getWorlds().get(0).getEntities()) + { + if (entity instanceof EntityInsentient) + { + EntityInsentient entityMonster = (EntityInsentient)entity; + + if (entityMonster.getGoalTarget() != null && entityMonster.getGoalTarget() instanceof EntityPlayer) + { + if (((EntityPlayer)entityMonster.getGoalTarget()).playerConnection.isDisconnected()) + entityMonster.setGoalTarget(null, TargetReason.FORGOT_TARGET, false); + } + } + } + } + @EventHandler public void clearGameMode(PlayerQuitEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java index a7adf15a6..d76e0db30 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java @@ -23,14 +23,13 @@ import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -44,6 +43,7 @@ import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scoreboard.Team; +import com.mojang.authlib.GameProfile; import com.mysql.jdbc.BalanceStrategy; public class DisguiseCommand extends CommandBase implements Listener @@ -231,7 +231,7 @@ public class DisguiseCommand extends CommandBase implements Listener try { Field name = GameProfile.class.getDeclaredField("name"); - Field declaredProfile = EntityHuman.class.getDeclaredField("i"); + Field declaredProfile = EntityHuman.class.getDeclaredField("bH"); declaredProfile.setAccessible(true); GameProfile gameProfile = (GameProfile) declaredProfile.get(((CraftHumanEntity) ((CraftPlayer) player)).getHandle()); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java index 1369420a2..f0754c10f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HalloweenSpookinessManager.java @@ -215,9 +215,6 @@ public class HalloweenSpookinessManager extends MiniPlugin for (Player player : UtilServer.getPlayers()) { - if (!UtilPlayer.is1_8(player)) - continue; - if (_manager.getPreferences().Get(player).Invisibility) continue; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java index 7c43be8c9..db7624cd9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HubVisibilityManager.java @@ -4,13 +4,13 @@ import java.util.HashMap; import java.util.HashSet; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; @@ -65,14 +65,17 @@ public class HubVisibilityManager extends MiniPlugin { boolean hideMe = Manager.GetTutorial().InTutorial(player) || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || - Manager.getPreferences().Get(player).Invisibility || + Manager.getPreferences().Get(player).Invisibility || _hiddenPlayers.contains(player); for (Player other : UtilServer.getPlayers()) { if (player.equals(other)) continue; - + + if(Manager.GetClients().Get(other).GetRank().has(Rank.MODERATOR)) + hideMe = false; + if (hideMe || !Manager.getPreferences().Get(other).ShowPlayers || Manager.GetTutorial().InTutorial(other)) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java index 28573f0ba..e86d2e3c6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java @@ -6,6 +6,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; import mineplex.core.MiniPlugin; import mineplex.core.common.util.UtilAction; @@ -56,9 +57,12 @@ public class JumpManager extends MiniPlugin //Disable Flight player.setAllowFlight(false); - + + Vector vec = player.getLocation().getDirection(); + vec.setY(Math.abs(vec.getY())); + //Velocity - UtilAction.velocity(player, 1.4, 0.2, 1, true); + UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true); //Sound player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index b41043b9d..943acdd63 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -13,6 +13,8 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.gadgets.MorphWither; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -394,10 +396,13 @@ public class NewsManager extends MiniPlugin //Fix Entity Names for (Creature pet : Manager.getPetManager().getPets()) { - if (pet instanceof Wither) - { - pet.setCustomName(text); - } + DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + disguise.resendMetadata(); + } } for (Mount mount : Manager.GetMount().getMounts()) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 2f8a774d4..2ac87ef75 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -226,7 +226,7 @@ public class StackerManager extends MiniPlugin implements IThrown UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); - _projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 0.5f); + _projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f); //Portal Delay Manager.SetPortalDelay(thrower); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TrickOrTreatManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TrickOrTreatManager.java new file mode 100644 index 000000000..935d83754 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TrickOrTreatManager.java @@ -0,0 +1,194 @@ +package mineplex.hub.modules; + +import java.util.Calendar; +import java.util.HashSet; +import java.util.Iterator; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.donation.DonationManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.task.TaskManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.HubManager; +import mineplex.hub.HubType; +import mineplex.hub.modules.trickortreat.Blindness; +import mineplex.hub.modules.trickortreat.Nausea; +import mineplex.hub.modules.trickortreat.RandomTeleport; +import mineplex.hub.modules.trickortreat.ShockingStrikes; +import mineplex.hub.modules.trickortreat.Trick; +import mineplex.hub.modules.trickortreat.TrickDialogue; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +public class TrickOrTreatManager extends MiniPlugin +{ + private HubManager _manager; + private TaskManager _taskManager; + private DonationManager _donationManager; + private CoreClientManager _coreClientManager; + + private Calendar _cal = Calendar.getInstance(); + + private String _identifier = "villager"; + + private HashSet _interacting = new HashSet(); + + private HashSet _tricking = new HashSet(); + private HashSet _tricks = new HashSet(); + + private String[] _nextYear = new String[] + { + "Nosy kids...", + "I'm out of candy!", + "Come back next year.", + "No double dipping!", + "I've seen that costume before...", + "You already have enough candy!", + "Once is enough.", + "Isn't it past your bedtime?", + "I already gave you my candy, what more do you want!", + "You again...", + "I said no more!", + "No taking the whole bowl.", + "I have my eye on you...", + "You know what happens to children who want more candy...", + "This was a great year, wasn't it?", + "Aww, did you come back just to talk to me?", + "*heavy staring*", + "Run along, now!", + "The real horror will be your dentist's face...", + "I've heard good things about the house down the road.", + "I started out with 700 pieces!", + "I might call it a night soon.", + "Meow", + "Sure is a mystical night, isn't it?", + "Do you want to hear my song? I wrote it myself!", + }; + + public TrickOrTreatManager(JavaPlugin plugin, HubManager manager, TaskManager taskManager, DonationManager donationManager, CoreClientManager coreClientManager) + { + super("Trick or Treat", plugin); + + // Test commit + _manager = manager; + _taskManager = taskManager; + _donationManager = donationManager; + _coreClientManager = coreClientManager; + + _tricks.add(new Blindness(plugin)); + _tricks.add(new Nausea(plugin)); + //_tricks.add(new RandomTeleport(plugin)); + _tricks.add(new ShockingStrikes(plugin)); + } + + public void trick(Player player, String villager) + { + UtilPlayer.message(player, C.cGoldB + villager + ": " + C.cYellowB + UtilAlg.Random(_tricks).onTrick(player)); + } + + @EventHandler(priority = EventPriority.LOW) + public void onInteract(final PlayerInteractEntityEvent event) + { + if (_manager.Type != HubType.Halloween) + return; + + if (!(event.getRightClicked() instanceof LivingEntity)) + return; + + LivingEntity en = (LivingEntity) event.getRightClicked(); + + if (en.getCustomName() == null || !new String(ChatColor.stripColor(en.getCustomName())).toLowerCase().trim().startsWith(_identifier)) + return; + + System.out.println("Interact with Villager."); + + if (_interacting.contains(event.getPlayer().getName())) + return; + + System.out.println("Not interacting."); + + event.setCancelled(true); + + final String villagerName = ChatColor.stripColor(en.getCustomName()).substring(_identifier.length()).trim(); + + if (!Recharge.Instance.use(event.getPlayer(), "ToT with " + villagerName, 2000, false, false)) + return; + + System.out.println("Not Recharging."); + + _interacting.add(event.getPlayer().getName()); + + final String task = "ToT " + _cal.get(Calendar.YEAR) + " " + villagerName; + + if (_taskManager.hasCompletedTask(event.getPlayer(), task)) + { + UtilPlayer.message(event.getPlayer(), C.cGoldB + villagerName + ": " + C.cYellowB + UtilMath.randomElement(_nextYear)); + _interacting.remove(event.getPlayer().getName()); + System.out.println("Has completed Task."); + return; + } + + System.out.println("Hasn't completed Task."); + + UtilPlayer.message(event.getPlayer(), C.cDGreenB + "You: " + C.cGreenB + "Trick or Treat!"); + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.NOTE_PIANO, 1F, 1F); + + final boolean trick = UtilMath.r(10) > 5; + + _tricking.add(new TrickDialogue(this, task, event.getPlayer(), villagerName, trick)); + + System.out.println("Added ne TrickDialogue."); + } + + @EventHandler + public void updateDialogues(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Iterator dialogueIterator = _tricking.iterator(); dialogueIterator.hasNext();) + { + TrickDialogue dialogue = dialogueIterator.next(); + + if (dialogue.originalUpdateDialogue()) + { + _interacting.remove(dialogue.getPlayer().getName()); + dialogueIterator.remove(); + dialogue.shutdown(); + System.out.println("Removed trick dialogue."); + } + } + } + + public TaskManager getTaskManager() + { + return _taskManager; + } + + public DonationManager getDonationManager() + { + return _donationManager; + } + + public CoreClientManager getClientManager() + { + return _coreClientManager; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Blindness.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Blindness.java new file mode 100644 index 000000000..b42eab72e --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Blindness.java @@ -0,0 +1,40 @@ +package mineplex.hub.modules.trickortreat; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.UtilMath; + +public class Blindness extends Trick +{ + public Blindness(JavaPlugin plugin) + { + super(plugin); + } + + @Override + public String onTrick(Player player) + { + System.out.println("Tricking " + player.getName() + " with Blindness"); + player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.2F, 0F); + + for (int i = 0 ; i < UtilMath.r(5) ; i++) + player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F); + + player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ZOMBIE_REMEDY, 1.2F, 0F); + + player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 400, 0)); + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 400, 0)); + + return "See you around..."; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/HeadSpasms.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/HeadSpasms.java new file mode 100644 index 000000000..284a5c138 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/HeadSpasms.java @@ -0,0 +1,51 @@ +package mineplex.hub.modules.trickortreat; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook; + +public class HeadSpasms extends Trick +{ + public HeadSpasms(JavaPlugin plugin) + { + super(plugin); + } + + @Override + public String onTrick(final Player player) + { + System.out.println("Tricking " + player.getName() + " with HeadSpasms"); + + for (int i = 0 ; i < UtilMath.r(5) ; i++) + player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F); + + player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F); + + for (int i = 0 ; i < 5 ; i++) + player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F); + + for (int i = 0 ; i < 40 ; i++) + { + final int i2 = i; + Bukkit.getScheduler().runTaskLater(Plugin, new Runnable() + { + @Override + public void run() + { + if (player.isOnline()) + UtilPlayer.sendPacket(player, new PacketPlayOutEntityLook(player.getEntityId(), (byte) player.getLocation().getYaw(), (byte) ((i2 % 2 == 0 ? 1 : -1) * 80), true)); + } + }, i); + } + + return "What is wrong with your head, dear?"; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Nausea.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Nausea.java new file mode 100644 index 000000000..fa33c42f1 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Nausea.java @@ -0,0 +1,42 @@ +package mineplex.hub.modules.trickortreat; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.UtilMath; + +public class Nausea extends Trick +{ + public Nausea(JavaPlugin plugin) + { + super(plugin); + } + + @Override + public String onTrick(Player player) + { + System.out.println("Tricking " + player.getName() + " with Nausea"); + + player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.2F, 0F); + + for (int i = 0 ; i < UtilMath.r(5) ; i++) + player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F); + + player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.GHAST_MOAN, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.ZOMBIE_WOODBREAK, 1.2F, 0F); + + player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 3)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 400, 9)); + + return "Did someone eat too much candy?"; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/RandomTeleport.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/RandomTeleport.java new file mode 100644 index 000000000..6a9765cf4 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/RandomTeleport.java @@ -0,0 +1,35 @@ +package mineplex.hub.modules.trickortreat; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.UtilMath; + +public class RandomTeleport extends Trick +{ + public RandomTeleport(JavaPlugin plugin) + { + super(plugin); + } + + @Override + public String onTrick(Player player) + { + System.out.println("Tricking " + player.getName() + " with RandomTeleport"); + player.teleport(player.getWorld().getHighestBlockAt(Math.max(UtilMath.r(100), 25), Math.max(UtilMath.r(100), 25)).getLocation().add(0, UtilMath.r(30), 0).clone().add(.5, 1, .5)); + + for (int i = 0 ; i < UtilMath.r(5) ; i++) + player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F); + + player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.2F, 0F); + + return "Goodbye..."; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/ShockingStrikes.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/ShockingStrikes.java new file mode 100644 index 000000000..94d9761aa --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/ShockingStrikes.java @@ -0,0 +1,55 @@ +package mineplex.hub.modules.trickortreat; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import net.minecraft.server.v1_8_R3.EntityLightning; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityWeather; + +public class ShockingStrikes extends Trick +{ + public ShockingStrikes(JavaPlugin plugin) + { + super(plugin); + } + + @Override + public String onTrick(final Player player) + { + System.out.println("Tricking " + player.getName() + " with Shocking Strikes"); + for (int i = 0 ; i < UtilMath.r(5) ; i++) + player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F); + + player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F); + + player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F); + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F); + + for (int i = 0 ; i < 5 ; i++) + player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F); + + UtilPlayer.sendPacket(player, new PacketPlayOutSpawnEntityWeather(new EntityLightning(((CraftWorld) player.getWorld()).getHandle(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), true, false))); + + for (int i = 0 ; i < 20 ; i++) + { + Bukkit.getScheduler().runTaskLater(Plugin, new Runnable() + { + @Override + public void run() + { + if (player.isOnline()) + UtilPlayer.sendPacket(player, new PacketPlayOutEntityStatus(((CraftPlayer) player).getHandle(), (byte) 2)); + } + }, 2 * i); + } + + return "I hope you're not too shocked..."; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Trick.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Trick.java new file mode 100644 index 000000000..b923cf653 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/Trick.java @@ -0,0 +1,21 @@ +package mineplex.hub.modules.trickortreat; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class Trick +{ + protected JavaPlugin Plugin; + + protected Trick(JavaPlugin plugin) + { + Plugin = plugin; + } + + public abstract String onTrick(Player player); + + public String getName() + { + return null; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java new file mode 100644 index 000000000..3585b6579 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/trickortreat/TrickDialogue.java @@ -0,0 +1,196 @@ +package mineplex.hub.modules.trickortreat; + +import java.util.Random; + +import org.bukkit.Instrument; +import org.bukkit.Note; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.Note.Tone; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.task.TaskManager; +import mineplex.hub.modules.TrickOrTreatManager; + +public class TrickDialogue +{ + private TrickOrTreatManager _plugin; + private TaskManager _taskManager; + + private String _task; + private Player _player; + private long _time; + private String _villagerName; + private boolean _trick; + + private boolean _delayOne; + private boolean _delayTwo; + private boolean _delayThree; + + public TrickDialogue(TrickOrTreatManager plugin, String task, Player player, String villagerName, boolean trick) + { + _plugin = plugin; + _taskManager = plugin.getTaskManager(); + _task = task; + _player = player; + _villagerName = villagerName; + _time = System.currentTimeMillis(); + _trick = trick; + } + + public long getTime() + { + return _time; + } + + public boolean originalUpdateDialogue() + { + if (!_player.isOnline()) + return true; + + if (!_delayOne && System.currentTimeMillis() - _time > 250) + { + _delayOne = true; + + _player.playNote(_player.getLocation(), Instrument.PIANO, Note.natural(1, Tone.D)); + _player.playNote(_player.getLocation(), Instrument.PIANO, Note.natural(1, Tone.A)); + _time = System.currentTimeMillis(); + } + else if (_delayOne && !_delayTwo && System.currentTimeMillis() - _time > 1000) + { + _delayTwo = true; + + if (_trick) //Trick + UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "I choose... TRICK!"); + else + UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "I choose... TREAT!"); + + _time = System.currentTimeMillis(); + } + else if (_delayTwo && !_delayThree && System.currentTimeMillis() - _time > 750) + { + _delayThree = true; + + if (_trick) + { + _plugin.runAsync(new Runnable() + { + public void run() + { + _taskManager.completedTask(null, _player, _task); + + _plugin.runSync(new Runnable() + { + @Override + public void run() + { + _plugin.trick(_player, _villagerName); + } + }); + } + }); + } + else + { + UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "Have a Happy Halloween!"); + + _plugin.runAsync(new Runnable() + { + public void run() + { + _taskManager.completedTask(new Callback() + { + @Override + public void run(Boolean data) + { + if (!data) + return; + + if (UtilMath.r(10) > 5) //Coins + { + final int amount = Math.max(new Random().nextInt(100) + 100, (int) Math.floor(new Random().nextDouble() * 600)); + _plugin.getDonationManager().RewardCoins(new Callback() + { + public void run(final Boolean completed) + { + _plugin.runSync(new Runnable() + { + @Override + public void run() + { + if (completed) + { + UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cYellow + amount + " Coins") + " from " + F.name(_villagerName) + ".")); + + //Sound + _player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + } + else + { + UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cYellow + amount + " Coins") + " to you. Please visit that villager again.") + "."); + } + } + }); + } + }, "Treat " + _villagerName, _player.getName(), _plugin.getClientManager().getAccountId(_player), amount); + } + else //Gems + { + final int amount = Math.max(new Random().nextInt(100) + 100, (int) Math.floor(new Random().nextDouble() * 600)); + _plugin.getDonationManager().RewardGems(new Callback() + { + public void run(final Boolean completed) + { + _plugin.runSync(new Runnable() + { + @Override + public void run() + { + if (completed) + { + UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cGreen + amount + " Gems") + " from " + F.name(_villagerName) + ".")); + + //Sound + _player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + } + else + { + UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cGreen + amount + " Gems") + " to you. Please visit that villager again.") + "."); + } + } + }); + } + }, "Treat " + _villagerName, _player.getName(), _player.getUniqueId(), amount); + } + } + }, _player, _task); + } + }); + } + + _time = System.currentTimeMillis(); + } + else if (_delayOne && _delayTwo && _delayThree) + return true; + + return false; + } + + public Player getPlayer() + { + return _player; + } + + public void shutdown() + { + _plugin = null; + _taskManager = null; + _task = null; + _player = null; + _villagerName = null; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 5963ea411..f65dfb6d3 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -588,12 +588,10 @@ public class ServerManager extends MiniPlugin if (largestServer.getAvailableSlots() >= MIN_SLOTS_REQUIRED || largestServer.MaxPlayers > 40) { - System.out.println("Largest."); return largestServer; } else { - System.out.println("Random."); return servers.get(random.nextInt(count)); } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index c807b068f..a33e9f6d7 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -901,34 +901,84 @@ public class MapParser extends JavaPlugin implements Listener event.getPlayer().setVelocity(vel); } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void signChangeLog(SignChangeEvent event) { if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) { - try - { - File file = new File(event.getPlayer().getWorld().getName() + "/" + "sign_log.txt"); + ArrayList text = new ArrayList(); + + text.add("Date: " + UtilTime.now()); + text.add("Player: " + event.getPlayer().getName()); + text.add("Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation())); + for (int i=0 ; i text = new ArrayList(); + + text.add("Date: " + UtilTime.now()); + text.add("Player: " + event.getPlayer().getName()); + text.add("Location: " + UtilWorld.locToStrClean(event.getPlayer().getLocation())); + text.add("Message: " + event.getMessage()); + + writeSignCommandLog(text, event.getPlayer().getWorld()); + } + } + + public void writeSignCommandLog(ArrayList text, World world) + { + try + { + File file = new File(world.getName() + "/" + "command_sign_log.txt"); - if (!file.exists()) - file.createNewFile(); - - FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - BufferedWriter bw = new BufferedWriter(fw); - - bw.write("\n\n"); - bw.write("\n" + "Date: " + UtilTime.now()); - bw.write("\n" + "Player: " + event.getPlayer().getName()); - bw.write("\n" + "Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation())); - for (int i=0 ; i text, World world) + { + try + { + File file = new File(world.getName() + "/" + "sign_log.txt"); + + if (!file.exists()) + file.createNewFile(); + + FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); + BufferedWriter bw = new BufferedWriter(fw); + + bw.write("\n\n"); + for (String line : text) + bw.write("\n" + line); + + bw.close(); + } + catch (Exception e) + { + e.printStackTrace(); } } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java index d34d0cc9e..8658ae526 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java @@ -8,10 +8,10 @@ import java.util.ArrayList; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; -import net.minecraft.util.org.apache.commons.io.FileUtils; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.ZipUtil; +import org.apache.commons.io.FileUtils; public class WorldManager { diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java index dcee406b3..3448f8545 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopyCommand.java @@ -5,12 +5,12 @@ import java.io.IOException; import org.bukkit.World; import org.bukkit.entity.Player; -import net.minecraft.util.org.apache.commons.io.FileUtils; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.mapparser.GameType; import mineplex.mapparser.MapParser; +import org.apache.commons.io.FileUtils; /** * Created by Shaun on 8/16/2014. diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopySchematicsCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopySchematicsCommand.java index eb14b5d32..2b59d916c 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopySchematicsCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CopySchematicsCommand.java @@ -4,9 +4,9 @@ import java.io.File; import java.io.IOException; import org.bukkit.entity.Player; -import net.minecraft.util.org.apache.commons.io.FileUtils; import mineplex.mapparser.MapParser; +import org.apache.commons.io.FileUtils; /** * Created by Shaun on 8/16/2014. diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java index f5b8282a7..4128c38e8 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/DeleteCommand.java @@ -4,12 +4,12 @@ import java.io.File; import org.bukkit.World; import org.bukkit.entity.Player; -import net.minecraft.util.org.apache.commons.io.FileUtils; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.mapparser.GameType; import mineplex.mapparser.MapParser; +import org.apache.commons.io.FileUtils; /** * Created by Shaun on 8/16/2014. diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java index b1bf213e3..c983572ff 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -20,12 +20,13 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import org.bukkit.Material; -import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; +import com.google.gson.Gson; + public class ClassManager extends MiniClientPlugin implements IClassFactory { private CoreClientManager _clientManager; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java index 2a80b70ae..829315b8a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/repository/ClassRepository.java @@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.Class.repository; import java.util.List; -import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; +import com.google.gson.reflect.TypeToken; import mineplex.core.server.remotecall.AsyncJsonWebCall; import mineplex.core.server.remotecall.JsonWebCall; @@ -12,18 +12,20 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildTok public class ClassRepository { private String _webAddress; - + public ClassRepository(String webAddress) { _webAddress = webAddress; } - public List GetClasses(List pvpClasses) + public List GetClasses(List pvpClasses) { - return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken>(){}.getType(), pvpClasses); + return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken>() + { + }.getType(), pvpClasses); } - - public void SaveCustomBuild(CustomBuildToken token) + + public void SaveCustomBuild(CustomBuildToken token) { new AsyncJsonWebCall(_webAddress + "PlayerAccount/SaveCustomBuild").Execute(token); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index f8be1c8c7..4093a58d0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -2,13 +2,12 @@ package mineplex.minecraft.game.classcombat.Skill.Assassin; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Set; -import net.minecraft.util.com.mojang.authlib.GameProfile; - import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; @@ -167,7 +166,7 @@ public class Illusion extends SkillActive UtilAction.velocity(skel, 0.6, 0.4, 1, false); } - UtilEnt.CreatureMoveFast(skel, cur.getTargetBlock(null, 0).getLocation().add(0, 2, 0), 1.8f); + UtilEnt.CreatureMoveFast(skel, cur.getTargetBlock((HashSet)null, 30).getLocation().add(0, 2, 0), 1.8f); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index dd2c17dcc..23ff9525c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -204,7 +204,7 @@ public class BlockToss extends SkillCharge implements IThrown //Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true); - Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, + Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1.2f); //Event diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java index 2d10d7972..edcb302ae 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java @@ -107,7 +107,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown UtilAction.velocity(item, cur.getLocation().getDirection(), 1 + charge , false, 0, 0.2, 20, false); - Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, + Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, true, Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 0.6f); //Inform diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java index 5a60452db..b911be595 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java @@ -69,7 +69,7 @@ public class FreezingBlast extends SkillActive implements IThrown //Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); item.setVelocity(player.getLocation().getDirection()); - Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1f); //Inform diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java index aa7e359f0..9a8450374 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java @@ -72,7 +72,7 @@ public class GlacialBlade extends SkillActive implements IThrown //Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.2, 0), ItemStackFactory.Instance.CreateStack(370)); UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false); - Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true, null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 0.3f); //Effect diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java index 339669ce4..153c00eff 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java @@ -70,7 +70,7 @@ public class IcePrison extends SkillActive implements IThrown //Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); item.setVelocity(player.getLocation().getDirection()); - Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5f); //Inform diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java index 125bb24f6..693f06299 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java @@ -101,7 +101,7 @@ public class LightningOrb extends SkillActive implements IThrown //Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57)); item.setVelocity(player.getLocation().getDirection()); - Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, false, false, + Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, true, false, false, Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f); //Inform diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java index d8797a258..0dbd6161f 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java @@ -167,7 +167,7 @@ public class Rupture extends SkillActiveCharge public void MoveRupture(Player cur) { - Block targetBlock = cur.getTargetBlock(null, 0); + Block targetBlock = cur.getTargetBlock((HashSet)null, 0); if (targetBlock == null) return; //Aiming at sky diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java index 7765eb633..f3b1b406a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java @@ -36,7 +36,7 @@ public class StaticLazer extends SkillChargeSword { super(skills, name, classType, skillType, cost, maxLevel, 0.012f, 0.004f, - 12000, -1000, true, true, + 16000, -1000, true, true, false, true); SetDesc(new String[] @@ -48,24 +48,25 @@ public class StaticLazer extends SkillChargeSword "Taking damage cancels charge.", "", "Deals #6#1 damage and travels up to", - "#20#10 blocks.", + "#20#10 blocks, but loses 1 damage", + "per 20 blocks travelled.", }); _fireOnFull = false; - _energyPerCharge = 1.2f; + _energyPerCharge = 2.4f; setAchievementSkill(true); } @Override public String GetRechargeString() { - return "Recharge: " + "#12#-1 Seconds"; + return "Recharge: " + "#16#-1 Seconds"; } @Override public String GetEnergyString() { - return "Energy: " + "24 per Second"; + return "Energy: " + "48 per Second"; } @Override @@ -82,7 +83,7 @@ public class StaticLazer extends SkillChargeSword Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange)); //Hit Player - HashMap hits = UtilEnt.getInRadius(newTarget, 2); + HashMap hits = UtilEnt.getInRadius(newTarget, 1.25); hits.remove(player); if (!hits.isEmpty()) break; @@ -116,7 +117,7 @@ public class StaticLazer extends SkillChargeSword //Damage Event Factory.Damage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 6 + level * charge, true, true, false, + DamageCause.CUSTOM, 2 + ((4 + level) * charge) - (curRange * 0.05), true, true, false, player.getName(), GetName()); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java index cfbbbb258..60d50bb67 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java @@ -14,7 +14,6 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java index 5cfee0dca..1d923bfe9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/repository/SkillRepository.java @@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.Skill.repository; import java.util.List; -import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; +import com.google.gson.reflect.TypeToken; import mineplex.core.server.remotecall.JsonWebCall; import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java index 139692a0d..97ee02a87 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java @@ -53,7 +53,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory try { - _itemMaxDurability = net.minecraft.server.v1_7_R4.Item.class.getDeclaredField("durability"); + _itemMaxDurability = net.minecraft.server.v1_8_R3.Item.class.getDeclaredField("durability"); _itemMaxDurability.setAccessible(true); } catch (SecurityException e) @@ -189,7 +189,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory try { - _itemMaxDurability.setInt(net.minecraft.server.v1_7_R4.Item.getById(newItem.GetType().getId()), 56); + _itemMaxDurability.setInt(net.minecraft.server.v1_8_R3.Item.getById(newItem.GetType().getId()), 56); } catch (IllegalArgumentException e) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java index d781731bd..f312e0968 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java @@ -3,7 +3,7 @@ package mineplex.minecraft.game.classcombat.item; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java index 520e9597a..b56f0d51b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java @@ -8,7 +8,7 @@ import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java index 07d787b27..c76c35011 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java @@ -8,7 +8,7 @@ import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java index e5b114154..347755706 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java @@ -4,7 +4,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEvent; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java index 99af649a4..16ff6926d 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/repository/ItemRepository.java @@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.item.repository; import java.util.List; -import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; +import com.google.gson.reflect.TypeToken; import mineplex.core.server.remotecall.JsonWebCall; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java index a83181b39..f78e496e9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java @@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.shop; import org.bukkit.ChatColor; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index 46c925898..e9201d8a4 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -3,9 +3,9 @@ package mineplex.minecraft.game.core.combat; import java.util.HashSet; import java.util.Iterator; -import net.minecraft.server.v1_7_R4.ItemStack; +import net.minecraft.server.v1_8_R3.ItemStack; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Arrow; import org.bukkit.entity.Fireball; import org.bukkit.entity.LivingEntity; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java index b35f4b59e..c5fec0f14 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java @@ -141,43 +141,11 @@ public class Condition public void Remove() { - try + PotionEffectType type = PotionEffectType.getByName(_type.toString()); + + if (type != null) { - // TODO Remove once we update to 1.8, this fix fixes crashes for potioneffect's when acting on a potioneffect damage - // event. - boolean potionEffectCrash = false; - StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace(); - - for (StackTraceElement trace : stackTraces) - { - if (trace.getClassName().equals("net.minecraft.server.v1_7_R4.EntityLiving") - && trace.getMethodName().equals("aO")) - { - potionEffectCrash = true; - break; - } - } - - if (potionEffectCrash) - { - Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() - { - public void run() - { - PotionEffectType type = PotionEffectType.getByName(_type.toString()); - _ent.removePotionEffect(type); - } - }, 0); - } - else - { - PotionEffectType type = PotionEffectType.getByName(_type.toString()); - _ent.removePotionEffect(type); - } - } - catch (Exception e) - { - + _ent.removePotionEffect(type); } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java index 2d8bb799f..77fb38bb1 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java @@ -19,7 +19,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.potion.PotionEffectType; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; public class ConditionEffect implements Listener { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index e7b460fe3..a37aaa311 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -44,9 +44,9 @@ public class CustomDamageEvent extends Event implements Cancellable private boolean _damageeBrute = false; private boolean _damageToLevel = true; - public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, - DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, - String initialSource, String initialReason, boolean cancelled) + public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource, + String initialReason, boolean cancelled) { _eventCause = cause; @@ -73,6 +73,8 @@ public class CustomDamageEvent extends Event implements Cancellable if (cancelled) SetCancelled("Pre-Cancelled"); + + _knockbackOrigin = knockbackOrigin; } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index e58efe9b1..6ff2a3dec 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -19,9 +19,9 @@ import mineplex.core.npc.NpcManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; -import net.minecraft.server.v1_7_R4.DamageSource; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.EntityLiving; +import net.minecraft.server.v1_8_R3.DamageSource; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityLiving; import org.bukkit.Bukkit; import org.bukkit.EntityEffect; @@ -29,7 +29,7 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Arrow; import org.bukkit.entity.Fish; @@ -173,11 +173,24 @@ public class DamageManager extends MiniPlugin public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String source, String reason, boolean cancelled) + { + NewDamageEvent(damagee, damager, proj, null, cause, damage, knockback, ignoreRate, ignoreArmor, source, reason, cancelled); + } + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason, boolean cancelled) { - _plugin.getServer().getPluginManager().callEvent( - new CustomDamageEvent(damagee, damager, proj, cause, damage, - knockback, ignoreRate, ignoreArmor, - source, reason, cancelled)); + _plugin.getServer().getPluginManager().callEvent(new CustomDamageEvent(damagee, damager, proj, knockbackOrigin, cause, + damage, knockback, ignoreRate, ignoreArmor, source, reason, cancelled)); + } + + public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin, + DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, + String source, String reason) + { + NewDamageEvent(damagee, damager, proj, knockbackOrigin, cause, damage, knockback, ignoreRate, ignoreArmor, source, + reason, false); } @EventHandler(priority = EventPriority.LOW) @@ -294,7 +307,7 @@ public class DamageManager extends MiniPlugin if (e.equals(Enchantment.ARROW_KNOCKBACK) || e.equals(Enchantment.KNOCKBACK)) event.AddKnockback("Ench Knockback", 1 + (0.5 * (double)enchants.get(e))); - else if (e.equals(Enchantment.ARROW_DAMAGE)) + else if (e.equals(Enchantment.ARROW_DAMAGE) || e.equals(Enchantment.DAMAGE_ALL)) event.AddMod("Enchant", "Ench Damage", 0.5 * (double)enchants.get(e), true); else if (e.equals(Enchantment.ARROW_FIRE) || e.equals(Enchantment.FIRE_ASPECT)) @@ -367,10 +380,10 @@ public class DamageManager extends MiniPlugin //Sticky Arrow if (event.GetCause() == DamageCause.PROJECTILE) - ((CraftLivingEntity)event.GetDamageeEntity()).getHandle().p(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().aZ() + 1); + ((CraftLivingEntity)event.GetDamageeEntity()).getHandle().o(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().bv() + 1); //Knockback - if (event.IsKnockback() && event.GetDamagerEntity(true) != null) + if (event.IsKnockback() && (event.getKnockbackOrigin() != null || event.GetDamagerEntity(true) != null)) { //Base double knockback = event.GetDamage(); @@ -382,9 +395,14 @@ public class DamageManager extends MiniPlugin knockback = knockback * cur; //Origin - Location origin = event.GetDamagerEntity(true).getLocation(); + Location origin = null; + + if (event.GetDamagerEntity(true) != null) + origin = event.GetDamagerEntity(true).getLocation(); if (event.getKnockbackOrigin() != null) origin = event.getKnockbackOrigin(); + else if (event.GetProjectile() != null) + origin = event.GetProjectile().getLocation(); //Vec Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation()); @@ -450,7 +468,7 @@ public class DamageManager extends MiniPlugin if (damager != null) entityDamager= ((CraftLivingEntity)damager).getHandle(); - entityDamagee.aG = 1.5F; + entityDamagee.aC = 1.5F; if ((float) entityDamagee.noDamageTicks > (float) entityDamagee.maxNoDamageTicks / 2.0F) { @@ -465,7 +483,7 @@ public class DamageManager extends MiniPlugin else { entityDamagee.lastDamage = damage; - entityDamagee.aw = entityDamagee.getHealth(); + //entityDamagee.aw = entityDamagee.getHealth(); //entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks; ApplyDamage(entityDamagee, damage, ignoreArmor); //entityDamagee.hurtTicks = entityDamagee.aW = 10; @@ -576,7 +594,7 @@ public class DamageManager extends MiniPlugin { if (!ignoreArmor) { - int j = 25 - entityLiving.aV(); + int j = 25 - entityLiving.br(); float k = damage * (float)j; _k.invoke(entityLiving, damage); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java index 4cdf04c68..2472908f2 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/explosion/CustomExplosion.java @@ -6,39 +6,41 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Random; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.explosion.ExplosionEvent; import mineplex.minecraft.game.core.damage.DamageManager; -import net.minecraft.server.v1_7_R4.AxisAlignedBB; -import net.minecraft.server.v1_7_R4.Block; -import net.minecraft.server.v1_7_R4.Blocks; -import net.minecraft.server.v1_7_R4.ChunkPosition; -import net.minecraft.server.v1_7_R4.DamageSource; -import net.minecraft.server.v1_7_R4.EnchantmentProtection; -import net.minecraft.server.v1_7_R4.Entity; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.Explosion; -import net.minecraft.server.v1_7_R4.Material; -import net.minecraft.server.v1_7_R4.MathHelper; -import net.minecraft.server.v1_7_R4.PacketPlayOutExplosion; -import net.minecraft.server.v1_7_R4.Vec3D; -import net.minecraft.server.v1_7_R4.World; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.DamageSource; +import net.minecraft.server.v1_8_R3.EnchantmentProtection; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EnumParticle; +import net.minecraft.server.v1_8_R3.Explosion; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.Material; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.PacketPlayOutExplosion; +import net.minecraft.server.v1_8_R3.Vec3D; +import net.minecraft.server.v1_8_R3.World; public class CustomExplosion extends Explosion { private Player _owner; private boolean _damageOwner; - private int _i = 16; private World _world; private DamageManager _manager; private String _damageReason; @@ -53,17 +55,26 @@ public class CustomExplosion extends Explosion private boolean _useCustomDamage; private int _maxFallingBlocks = -1; private float _maxDamage = 1000; + private float _size; + private boolean _damageBlocks = true; + private double posX, posY, posZ; + private boolean _ignoreNonLiving; public CustomExplosion(DamageManager manager, mineplex.core.explosion.Explosion explosion, Location loc, float explosionSize, String deathCause) { - super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize); + super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize, false, false); + posX = loc.getX(); + posY = loc.getY(); + posZ = loc.getZ(); + _world = ((CraftWorld) loc.getWorld()).getHandle(); _manager = manager; _damageReason = deathCause; _blockExplosionSize = explosionSize; _explosion = explosion; + _size = explosionSize; } /** @@ -77,10 +88,17 @@ public class CustomExplosion extends Explosion return this; } + public CustomExplosion setIgnoreNonLiving(boolean ignoreNonLiving) + { + _ignoreNonLiving = ignoreNonLiving; + + return this; + } + public CustomExplosion setMaxDamage(float maxDamage) { _maxDamage = maxDamage; - + return this; } @@ -114,7 +132,7 @@ public class CustomExplosion extends Explosion public CustomExplosion setDamageBlocks(boolean damageBlocks) { - b = damageBlocks; + _damageBlocks = damageBlocks; return this; } @@ -153,77 +171,75 @@ public class CustomExplosion extends Explosion @Override public void a() { - if (Math.max(_blockExplosionSize, this.size) < 0.1F) + if (Math.max(_blockExplosionSize, this._size) < 0.1F) { return; } - float f = this.size; HashSet hashset = new HashSet(); - for (int i = 0; i < this._i; i++) + for (int k = 0; k < 16; k++) { - for (int j = 0; j < this._i; j++) + for (int i = 0; i < 16; i++) { - for (int k = 0; k < this._i; k++) + for (int j = 0; j < 16; j++) { - if ((i == 0) || (i == this._i - 1) || (j == 0) || (j == this._i - 1) || (k == 0) || (k == this._i - 1)) + if ((k == 0) || (k == 15) || (i == 0) || (i == 15) || (j == 0) || (j == 15)) { - double d3 = i / (this._i - 1.0F) * 2.0F - 1.0F; - double d4 = j / (this._i - 1.0F) * 2.0F - 1.0F; - double d5 = k / (this._i - 1.0F) * 2.0F - 1.0F; - double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5); + double d0 = k / 15.0F * 2.0F - 1.0F; + double d1 = i / 15.0F * 2.0F - 1.0F; + double d2 = j / 15.0F * 2.0F - 1.0F; + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); - d3 /= d6; - d4 /= d6; - d5 /= d6; + d0 /= d3; + d1 /= d3; + d2 /= d3; float f1 = this._blockExplosionSize * (0.7F + this._world.random.nextFloat() * 0.6F); + double d4 = this.posX; + double d5 = this.posY; + double d6 = this.posZ; - double d0 = this.posX; - double d1 = this.posY; - double d2 = this.posZ; - - for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F) + for (; f1 > 0.0F; f1 -= 0.225F) { - int l = MathHelper.floor(d0); - int i1 = MathHelper.floor(d1); - int j1 = MathHelper.floor(d2); - Block block = this._world.getType(l, i1, j1); + BlockPosition blockposition = new BlockPosition(d4, d5, d6); + IBlockData iblockdata = this._world.getType(blockposition); - if (block.getMaterial() != Material.AIR) + if (iblockdata.getBlock().getMaterial() != Material.AIR) { - float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block) - : (_damageBlocksEqually ? Blocks.DIRT : block).a(this.source); + float f2 = this.source != null ? this.source.a(this, this._world, blockposition, iblockdata) + : (_damageBlocksEqually ? Blocks.DIRT : iblockdata.getBlock()).a((Entity) null); - f1 -= (f3 + 0.3F) * f2; + f1 -= (f2 + 0.3F) * 0.3F; } if ((f1 > 0.0F) - && ((this.source == null) || (this.source.a(this, this._world, l, i1, j1, block, f1))) - && (i1 < 256) && (i1 >= 0)) + && ((this.source == null) || (this.source.a(this, this._world, blockposition, iblockdata, f1))) + && (blockposition.getY() < 256) && (blockposition.getY() >= 0)) { - hashset.add(new ChunkPosition(l, i1, j1)); + hashset.add(blockposition); } - d0 += d3 * f2; - d1 += d4 * f2; - d2 += d5 * f2; + d4 += d0 * 0.300000011920929D; + d5 += d1 * 0.300000011920929D; + d6 += d2 * 0.300000011920929D; } } } } } - this.blocks.addAll(hashset); - this.size *= 2.0F; - _i = MathHelper.floor(this.posX - this.size - 1.0D); - int j = MathHelper.floor(this.posX + this.size + 1.0D); - int k = MathHelper.floor(this.posY - this.size - 1.0D); - int k1 = MathHelper.floor(this.posY + this.size + 1.0D); - int l1 = MathHelper.floor(this.posZ - this.size - 1.0D); - int i2 = MathHelper.floor(this.posZ + this.size + 1.0D); - List list = this._world.getEntities(this.source, AxisAlignedBB.a(_i, k, l1, j, k1, i2)); - Vec3D vec3d = Vec3D.a(this.posX, this.posY, this.posZ); + this.getBlocks().addAll(hashset); + + float f3 = _size * 2F; + + int i = MathHelper.floor(this.posX - f3 - 1.0D); + int j = MathHelper.floor(this.posX + f3 + 1.0D); + int k = MathHelper.floor(this.posY - f3 - 1.0D); + int k1 = MathHelper.floor(this.posY + f3 + 1.0D); + int l1 = MathHelper.floor(this.posZ - f3 - 1.0D); + int i2 = MathHelper.floor(this.posZ + f3 + 1.0D); + List list = this._world.getEntities(this.source, new AxisAlignedBB(i, k, l1, j, k1, i2)); + Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ); for (int j2 = 0; j2 < list.size(); j2++) { @@ -232,7 +248,10 @@ public class CustomExplosion extends Explosion if (entity.getBukkitEntity() == _owner && !_damageOwner) continue; - double d7 = entity.f(this.posX, this.posY, this.posZ) / this.size; + if (!(entity.getBukkitEntity() instanceof LivingEntity) && _ignoreNonLiving) + continue; + + double d7 = entity.f(this.posX, this.posY, this.posZ) / this._size; // XXX if (d7 <= 1.0D) { @@ -248,47 +267,45 @@ public class CustomExplosion extends Explosion d2 /= d8; // Performs a raytrace that determines the percentage of solid blocks between the two - double d9 = this._world.a(vec3d, entity.boundingBox); + double d9 = this._world.a(vec3d, entity.getBoundingBox()); // XXX double d10 = (1.0D - d7) * d9; float damage; if (_useCustomDamage) { - damage = Math.max(0, (int) ((_damage * d9) * (d8 / size))); + damage = Math.max(0, (int) ((_damage * d9) * (d8 / _size))); } else { - damage = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * this.size + 1.0D); + damage = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * this._size + 1.0D); damage = Math.min(damage, _maxDamage); } if (entity.getBukkitEntity() instanceof LivingEntity) { - _manager.NewDamageEvent((LivingEntity) entity.getBukkitEntity(), _owner, null, - DamageCause.ENTITY_EXPLOSION, damage, true, _ignoreRate, false, _damageReason, _damageReason); + _manager.NewDamageEvent((LivingEntity) entity.getBukkitEntity(), _owner, null, new Location(_world.getWorld(), posX, posY, posZ), + DamageCause.ENTITY_EXPLOSION, damage, true, _ignoreRate, false, _damageReason, _damageReason, false); } else { CraftEventFactory.entityDamage = this.source; - if (!entity.damageEntity(DamageSource.explosion(this), damage)) - ; // Yeah I don't get this either. But its in the source. + entity.damageEntity(DamageSource.explosion(this), damage); CraftEventFactory.entityDamage = null; } - double d11 = EnchantmentProtection.a(entity, d10); + double d11 = EnchantmentProtection.a(entity, d10); // XXX - entity.motX += d0 * d11; + /*entity.motX += d0 * d11; entity.motY += d1 * d11; - entity.motZ += d2 * d11; - if ((entity instanceof EntityHuman)) + entity.motZ += d2 * d11;*/ + + if (((entity instanceof EntityHuman)) && (!((EntityHuman) entity).abilities.isInvulnerable)) { - this.b().put(entity, Vec3D.a(d0 * d10, d1 * d10, d2 * d10)); + this.b().put((EntityHuman) entity, new Vec3D(d0 * d10, d1 * d10, d2 * d10)); } } } } - - this.size = f; } @Override @@ -296,23 +313,24 @@ public class CustomExplosion extends Explosion { this._world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this._world.random.nextFloat() - this._world.random.nextFloat()) * 0.2F) * 0.7F); - if ((this._blockExplosionSize >= 2.0F) && (this.b)) - this._world.addParticle("hugeexplosion", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D); - else - { - this._world.addParticle("largeexplode", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D); - } + if ((this._blockExplosionSize >= 2.0F) && (this._damageBlocks)) + this._world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); + else { + this._world.addParticle(EnumParticle.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); + } - if (this.b) + if (_damageBlocks) { org.bukkit.World bworld = this._world.getWorld(); List blockList = new ArrayList(); - ChunkPosition cpos; - for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--) + + for (int i1 = this.getBlocks().size() - 1; i1 >= 0; i1--) { - cpos = (ChunkPosition) this.blocks.get(i1); - org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.x, cpos.y, cpos.z); + BlockPosition cpos = this.getBlocks().get(i1); + + org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ()); + if (bblock.getType() != org.bukkit.Material.AIR) { blockList.add(bblock); @@ -322,12 +340,12 @@ public class CustomExplosion extends Explosion ExplosionEvent event = _owner == null ? new ExplosionEvent(blockList) : new ExplosionEvent(blockList, _owner); this._world.getServer().getPluginManager().callEvent(event); - this.blocks.clear(); + this.getBlocks().clear(); for (org.bukkit.block.Block bblock : event.GetBlocks()) { - ChunkPosition coords = new ChunkPosition(bblock.getX(), bblock.getY(), bblock.getZ()); - this.blocks.add(coords); + BlockPosition coords = new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ()); + this.getBlocks().add(coords); } if (event.GetBlocks().isEmpty()) @@ -357,21 +375,19 @@ public class CustomExplosion extends Explosion _explosion.BlockExplosion(blocks, new Location(_world.getWorld(), posX, posY, posZ), false, false); } - Iterator iterator = this.blocks.iterator(); + Iterator iterator = this.getBlocks().iterator(); while (iterator.hasNext()) { - ChunkPosition chunkposition = (ChunkPosition) iterator.next(); - int i = chunkposition.x; - int j = chunkposition.y; - int k = chunkposition.z; - Block block = this._world.getType(i, j, k); - this._world.spigotConfig.antiXrayInstance.updateNearbyBlocks(this._world, i, j, k); + BlockPosition blockposition = (BlockPosition) iterator.next(); + Block block = this._world.getType(blockposition).getBlock(); + + this._world.spigotConfig.antiXrayInstance.updateNearbyBlocks(this._world, blockposition); if (flag) { - double d0 = i + this._world.random.nextFloat(); - double d1 = j + this._world.random.nextFloat(); - double d2 = k + this._world.random.nextFloat(); + double d0 = blockposition.getX() + this._world.random.nextFloat(); + double d1 = blockposition.getY() + this._world.random.nextFloat(); + double d2 = blockposition.getZ() + this._world.random.nextFloat(); double d3 = d0 - this.posX; double d4 = d1 - this.posY; double d5 = d2 - this.posZ; @@ -386,41 +402,38 @@ public class CustomExplosion extends Explosion d3 *= d7; d4 *= d7; d5 *= d7; - this._world.addParticle("explode", (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D, - (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5); - this._world.addParticle("smoke", d0, d1, d2, d3, d4, d5); + this._world.addParticle(EnumParticle.EXPLOSION_NORMAL, (d0 + this.posX * 1.0D) / 2.0D, + (d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5, new int[0]); + this._world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); } if (block.getMaterial() != Material.AIR) { if (block.a(this) && _dropItems) { - block.dropNaturally(this._world, i, j, k, this._world.getData(i, j, k), _blockExplosionSize, 0); + block.dropNaturally(this._world, blockposition, this._world.getType(blockposition), _blockExplosionSize, + 0); } - this._world.setTypeAndData(i, j, k, Blocks.AIR, 0, 3); - block.wasExploded(this._world, i, j, k, this); + this._world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); + block.wasExploded(this._world, blockposition, this); } } } if (this._createFire) { - Iterator iterator = this.blocks.iterator(); + Iterator iterator = this.getBlocks().iterator(); while (iterator.hasNext()) { - ChunkPosition chunkposition = (ChunkPosition) iterator.next(); - int i = chunkposition.x; - int j = chunkposition.y; - int k = chunkposition.z; - Block block = this._world.getType(i, j, k); - Block block1 = this._world.getType(i, j - 1, k); - - if ((block.getMaterial() == Material.AIR) && (block1.j()) && (new Random().nextInt(3) == 0)) + BlockPosition blockposition = (BlockPosition) iterator.next(); + if ((this._world.getType(blockposition).getBlock().getMaterial() == Material.AIR) + && (this._world.getType(blockposition.down()).getBlock().o()) && (UtilMath.r(3) == 0)) { - if (!CraftEventFactory.callBlockIgniteEvent(this._world, i, j, k, this).isCancelled()) - this._world.setTypeUpdate(i, j, k, Blocks.FIRE); + if (!CraftEventFactory.callBlockIgniteEvent(this._world, blockposition.getX(), blockposition.getY(), + blockposition.getZ(), this).isCancelled()) + this._world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); } } } @@ -428,7 +441,12 @@ public class CustomExplosion extends Explosion PacketPlayOutExplosion explosion = new PacketPlayOutExplosion(this.posX, this.posY, this.posZ, this._blockExplosionSize, new ArrayList(), null); for (Player p : Bukkit.getOnlinePlayers()) - ((CraftPlayer) p).getHandle().playerConnection.sendPacket(explosion); + UtilPlayer.sendPacket(p, explosion); + } + + public float getSize() + { + return _size; } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java index 1cc41f938..6a17ac09b 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java @@ -16,7 +16,7 @@ import mineplex.minecraft.game.core.damage.DamageManager; import org.bukkit.Effect; import org.bukkit.EntityEffect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -42,9 +42,9 @@ public class Fire extends MiniPlugin _damageManager = damageManager; } - public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double d, String skillName) + public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName) { - _fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, d, skillName)); + _fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName)); item.setPickupDelay(0); } diff --git a/Plugins/Mineplex.StaffServer/.classpath b/Plugins/Mineplex.StaffServer/.classpath index e03947a20..52e5e02bf 100644 --- a/Plugins/Mineplex.StaffServer/.classpath +++ b/Plugins/Mineplex.StaffServer/.classpath @@ -11,6 +11,6 @@ - + diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index f349df29e..c1c98cf3b 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -23,13 +23,14 @@ import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.staffServer.customerSupport.CustomerSupport; import mineplex.staffServer.salespackage.SalesPackageManager; -import net.minecraft.server.v1_7_R4.MinecraftServer; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.server.v1_8_R3.MinecraftServer; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_7_R4.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.plugin.java.JavaPlugin; +import com.mojang.authlib.GameProfile; + public class StaffServer extends JavaPlugin { private String WEB_CONFIG = "webServer"; @@ -79,16 +80,14 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("57791647-93b1-4980-8835-7fddadd20eb8"), "xTheOnlyOreOx")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("80f40f29-4d66-4355-a32f-01a65af2a14c"), "rl6")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); - ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index e732b3ca3..0c60a3745 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -2,16 +2,18 @@ package nautilus.game.arcade; import java.io.File; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.FoodDupeFix; +import mineplex.core.PacketsInteractionFix; +import mineplex.core.account.CoreClient; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; - -import net.minecraft.server.v1_7_R4.BiomeBase; -import net.minecraft.server.v1_7_R4.MinecraftServer; +import net.minecraft.server.v1_8_R3.BiomeBase; +import net.minecraft.server.v1_8_R3.MinecraftServer; import mineplex.core.CustomTagFix; -import mineplex.core.TablistFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; @@ -74,6 +76,7 @@ public class Arcade extends JavaPlugin @Override public void onEnable() { + Bukkit.setSpawnRadius(0); //Delete Old Games Folders DeleteFolders(); @@ -145,14 +148,16 @@ public class Arcade extends JavaPlugin cosmeticManager.disableTeamArmor(); new GlobalPacketManager(this, _clientManager, serverStatusManager); + + GiveawayManager giveawayManager = new GiveawayManager(this, _clientManager, serverStatusManager); //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, giveawayManager); new MemoryFix(this); new CustomTagFix(this, packetHandler); - new TablistFix(this); + new PacketsInteractionFix(this, packetHandler); new FoodDupeFix(this); //Updates @@ -260,4 +265,4 @@ public class Arcade extends JavaPlugin System.out.println("Deleted Old Game: " + file.getName()); } } -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 61e1dca19..c1ec78e4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -17,6 +17,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.jsonchat.ClickEvent; import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; @@ -33,6 +34,7 @@ import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; @@ -42,8 +44,6 @@ import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketInfo; -import mineplex.core.packethandler.PacketPlayResourcePackStatus; -import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus; import mineplex.core.party.PartyManager; import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; @@ -53,6 +53,7 @@ import mineplex.core.projectile.ProjectileManager; import mineplex.core.resourcepack.ResPackManager; import mineplex.core.resourcepack.ResUnloadCheck; import mineplex.core.resourcepack.redis.RedisUnloadResPack; +import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.rewards.PetReward; import mineplex.core.stats.StatsManager; @@ -107,15 +108,14 @@ import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.shop.ArcadeShop; - import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -133,6 +133,8 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; @@ -189,12 +191,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation private StatsManager _statsManager; private PartyManager _partyManager; private PreferencesManager _preferencesManager; + private GiveawayManager _giveawayManager; private TaskManager _taskManager; private PacketHandler _packetHandler; - - - private IPacketHandler _resourcePacketHandler; + private String _resourcePackUrl; private boolean _resourcePackRequired; private NautHashMap _resourcePackUsers = new NautHashMap(); @@ -219,7 +220,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, StatsManager statsManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, - CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, NpcManager npcManager) + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, NpcManager npcManager, GiveawayManager giveawayManager) { super("Game Manager", plugin); @@ -272,6 +273,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _portal = portal; _petManager = petManager; _eventManager = new EventModule(this, getPlugin()); + _giveawayManager = giveawayManager; // Shop _arcadeShop = new ArcadeShop(this, clientManager, donationManager); @@ -294,8 +296,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation new MiscManager(this); _hologramManager = hologramManager; _idleManager = new IdleManager(this); - TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); - new HolidayManager(this, titanGiveaway); + //TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); + //new HolidayManager(this, titanGiveaway); // Game Addons new CompassAddon(plugin, this); @@ -304,7 +306,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new NotificationManager(getPlugin(), clientManager); - new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager); + new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager); //Champions Modules _energy = new Energy(plugin); @@ -336,75 +338,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation }, 80L); } - _resourcePacketHandler = new IPacketHandler() - { - - @Override - public void handle(PacketInfo packetInfo) - { - if (_resourcePackUrl != null && packetInfo.getPacket() instanceof PacketPlayResourcePackStatus) - { - - final Player player = packetInfo.getPlayer(); - final EnumResourcePackStatus response = ((PacketPlayResourcePackStatus) packetInfo.getPacket()) - .getResourcePackStatus(); - - Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() - { - - @Override - public void run() - { - if (_resourcePackRequired) - { - if (response == EnumResourcePackStatus.ACCEPTED) - { - _resourcePackNoResponse.remove(player.getName()); - } - else if (response == EnumResourcePackStatus.DECLINED) - { - _resourcePackNoResponse.remove(player.getName()); - - UtilPlayer.message(player, " "); - JsonMessage message = new JsonMessage("") - .color("gold") - .bold() - .extra("You need to accept the resource pack!\n" - + "Click me for instructions on how to fix this!") - - .click(ClickEvent.OPEN_URL, - - "http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help"); - - message.sendToPlayer(player); - UtilPlayer.message(player, " "); - - returnHubNoResPack(player); - } - else if (response == EnumResourcePackStatus.FAILED_DOWNLOAD) - { - _resourcePackNoResponse.remove(player.getName()); - - returnHubNoResPack(player, "Failed to download resource pack!"); - - return; - } - } - - if (response == EnumResourcePackStatus.ACCEPTED || response == EnumResourcePackStatus.LOADED) - { - _resourcePackUsers.put(player.getName(), true); - } - else - { - _resourcePackUsers.remove(player.getName()); - } - } - }); - } - } - }; - new ResPackManager(new ResUnloadCheck() { public boolean canSendUnload(Player player) @@ -418,8 +351,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation } }); - getPacketHandler().addPacketHandler(_resourcePacketHandler); - loadRequiredRank(); } @@ -432,6 +363,63 @@ public class ArcadeManager extends MiniPlugin implements IRelation addCommand(new DisguiseCommand(this)); addCommand(new RequiredRankCommand(this)); } + + @EventHandler + public void onResourcePackStatus(PlayerResourcePackStatusEvent event) + { + if (_resourcePackUrl == null) + { + return; + } + + Player player = event.getPlayer(); + + if (_resourcePackRequired) + { + if (event.getStatus() == Status.ACCEPTED) + { + _resourcePackNoResponse.remove(player.getName()); + } + else if (event.getStatus() == Status.DECLINED) + { + _resourcePackNoResponse.remove(player.getName()); + + UtilPlayer.message(player, " "); + JsonMessage message = new JsonMessage("") + .color("gold") + .bold() + .extra("You need to accept the resource pack!\n" + + "Click me for instructions on how to fix this!") + + .click(ClickEvent.OPEN_URL, + + "http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help"); + + message.sendToPlayer(player); + UtilPlayer.message(player, " "); + + returnHubNoResPack(player); + } + else if (event.getStatus() == Status.FAILED_DOWNLOAD) + { + _resourcePackNoResponse.remove(player.getName()); + + returnHubNoResPack(player, "Failed to download resource pack!"); + + return; + } + } + + if (event.getStatus() == Status.ACCEPTED + || event.getStatus() == Status.SUCCESSFULLY_LOADED) + { + _resourcePackUsers.put(player.getName(), true); + } + else + { + _resourcePackUsers.remove(player.getName()); + } + } public GameServerConfig GetServerConfig() { @@ -518,6 +506,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _explosionManager; } + public GiveawayManager getGiveawayManager() + { + return _giveawayManager; + } + public Fire GetFire() { return _fire; @@ -942,14 +935,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setLevel(0); player.setExp(0f); - player.setPlayerTime(player.getWorld().getTime(), false); - + player.resetPlayerTime(); + player.resetPlayerWeather(); + ((CraftPlayer) player).getHandle().spectating = false; - ((CraftPlayer) player).getHandle().ghost = false; + ((CraftPlayer) player).getHandle().setGhost(false); ((CraftPlayer) player).getHandle().k = true; // Arrows go bye bye. - ((CraftPlayer) player).getHandle().p(0); + ((CraftPlayer) player).getHandle().o(0); //Remove all conditions GetCondition().EndCondition(player, null, null); @@ -1328,7 +1322,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet, pet, type, RewardRarity.OTHER, 0); if (reward.canGiveReward(player)) - reward.giveReward(null, player); + reward.giveReward(null, player, new Callback() + { + @Override + public void run(RewardData data) + { + + } + }); } public void toggleChampionsModules(GameType gameType) @@ -1391,7 +1392,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setFlying(true); player.setFlySpeed(0.1f); ((CraftPlayer) player).getHandle().spectating = true; - ((CraftPlayer) player).getHandle().ghost = true; + ((CraftPlayer) player).getHandle().setGhost(true); ((CraftPlayer) player).getHandle().k = false; GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); @@ -1447,19 +1448,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } - @EventHandler - public void outdatedVersion(GameStateChangeEvent event) - { - if (!_resourcePackRequired) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!UtilPlayer.is1_8(player)) - returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!"); - } - } - private void returnHubNoResPack(Player player) { player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); @@ -1480,13 +1468,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation { Player player = event.getPlayer(); - if (!UtilPlayer.is1_8(player) && _resourcePackRequired) - { - returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!"); - - return; - } - if (_resourcePackUrl != null) { if (_resourcePackRequired) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java index 488295caf..732df5661 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java @@ -120,32 +120,12 @@ public class CompassAddon extends MiniPlugin double heightDiff = target.getLocation().getY() - player.getLocation().getY(); //Action Bar - if (UtilPlayer.is1_8(player)) + if (UtilGear.isMat(player.getItemInHand(), Material.COMPASS)) { - if (UtilGear.isMat(player.getItemInHand(), Material.COMPASS)) - { - UtilTextBottom.display( - " " + C.cWhite + C.Bold + "Nearest Player: " + targetTeam.GetColor() + target.getName() + - " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) + - " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff), player); - } - } - //Name Compass - else - { - for (int i : player.getInventory().all(Material.COMPASS).keySet()) - { - ItemStack stack = player.getInventory().getItem(i); - - ItemMeta itemMeta = stack.getItemMeta(); - itemMeta.setDisplayName( - " " + C.cWhite + C.Bold + "Nearest Player: " + targetTeam.GetColor() + target.getName() + - " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) + - " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff)); - stack.setItemMeta(itemMeta); - - player.getInventory().setItem(i, stack); - } + UtilTextBottom.display( + " " + C.cWhite + C.Bold + "Nearest Player: " + targetTeam.GetColor() + target.getName() + + " " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) + + " " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff), player); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java index b8af19d2b..c35fc9ab5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java @@ -21,14 +21,13 @@ import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -42,6 +41,8 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.scoreboard.Team; +import com.mojang.authlib.GameProfile; + public class DisguiseCommand extends CommandBase implements Listener { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 31ee03060..23dc523e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -18,11 +18,11 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftItem; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Entity; import org.bukkit.entity.Hanging; import org.bukkit.entity.Item; @@ -40,11 +40,13 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Team; -import org.bukkit.scoreboard.TeamNameTagVisibility; import org.bukkit.util.Vector; +import com.mojang.authlib.GameProfile; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; @@ -77,12 +79,11 @@ import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.scoreboard.GameScoreboard; import nautilus.game.arcade.stats.*; import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_7_R4.EntityItem; -import net.minecraft.server.v1_7_R4.PacketPlayInUseEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutScoreboardTeam; -import net.minecraft.server.v1_7_R4.ScoreboardTeam; -import net.minecraft.server.v1_7_R4.WorldServer; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.server.v1_8_R3.EntityItem; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; +import net.minecraft.server.v1_8_R3.ScoreboardTeam; +import net.minecraft.server.v1_8_R3.WorldServer; public abstract class Game implements Listener { @@ -99,24 +100,19 @@ public abstract class Game implements Listener public enum GameState { - Loading, - Recruit, - Prepare, - Live, - End, - Dead + Loading, Recruit, Prepare, Live, End, Dead } public ArcadeManager Manager; - //Game + // Game private GameType _gameType; protected String[] _gameDesc; - //Map + // Map private HashMap> _files; - //State + // State private GameState _gameState = GameState.Loading; private long _gameLiveTime; private long _gameStateTime = System.currentTimeMillis(); @@ -128,36 +124,36 @@ public abstract class Game implements Listener private String _customWinLine = ""; - //Kits + // Kits private Kit[] _kits; - //Teams + // Teams protected ArrayList _teamList = new ArrayList(); - //Player Preferences + // Player Preferences protected NautHashMap _playerKit = new NautHashMap(); private NautHashMap> _teamPreference = new NautHashMap>(); - //Player Data + // Player Data private NautHashMap> _gemCount = new NautHashMap>(); private NautHashMap> _stats = new NautHashMap>(); - //Player Location Store + // Player Location Store private NautHashMap _playerLocationStore = new NautHashMap(); - //Scoreboard + // Scoreboard protected GameScoreboard Scoreboard; - //Loaded from Map Config + // Loaded from Map Config public WorldData WorldData = null; - //Game Help + // Game Help private long _helpTimer = 0; private int _helpIndex = 0; private ChatColor _helpColor = ChatColor.YELLOW; protected String[] _help; - //Gameplay Flags + // Gameplay Flags public long GameTimeout = 1200000; public boolean Damage = true; @@ -202,7 +198,7 @@ public abstract class Game implements Listener public boolean QuitOut = true; public boolean QuitDropItems = false; - + public boolean IdleKickz = true; public boolean CreatureAllow = false; @@ -234,40 +230,40 @@ public abstract class Game implements Listener public GameState KitRegisterState = GameState.Live; public boolean JoinInProgress = false; - + public int TickPerTeleport = 1; - + public int FillTeamsInOrderToCount = -1; - + public boolean SpawnNearAllies = false; public boolean SpawnNearEnemies = false; - + public boolean StrictAntiHack = false; - + public boolean DisableKillCommand = true; - + public boolean GadgetsDisabled = true; - + public boolean TeleportsDisqualify = true; - + public boolean DontAllowOverfill = false; - //Addons + // Addons public boolean CompassEnabled = false; public boolean CompassGiveItem = true; public boolean SoupEnabled = true; public boolean TeamArmor = false; - public boolean TeamArmorHotbar = false; + public boolean TeamArmorHotbar = false; + + public boolean GiveClock = true; + + public boolean AllowParticles = true; - public boolean GiveClock = true; - - public boolean AllowParticles = true; - public long PrepareTime = 9000; public boolean PlaySoundGameStart = true; - - //Gems + + // Gems public double GemMultiplier = 1; public boolean GemHunterEnabled = true; public boolean GemBoosterEnabled = true; @@ -275,11 +271,11 @@ public abstract class Game implements Listener public double GemKillDeathRespawn = .5; public double GemAssistDeathRespawn = .5; - + public double GemKillDeathOut = 4; public double GemAssistDeathOut = 1; - - //Gameplay Data + + // Gameplay Data public HashMap PrivateBlockMap = new HashMap(); public HashMap PrivateBlockCount = new HashMap(); @@ -295,20 +291,16 @@ public abstract class Game implements Listener public boolean CanAddStats = true; public boolean CanGiveLoot = true; - + public boolean HideTeamSheep = false; public boolean ReplaceTeamsWithKits = false; - - public boolean VersionRequire1_8 = false; - + public boolean DeadBodies = false; public boolean DeadBodiesQuit = true; public boolean DeadBodiesDeath = true; public int DeadBodiesExpire = -1; private IPacketHandler _useEntityPacketHandler; - protected Field NameTagVisibility; - protected Field PacketTeam; private int _deadBodyCount; private NautHashMap _deadBodies = new NautHashMap(); private NautHashMap _deadBodiesExpire = new NautHashMap(); @@ -320,38 +312,39 @@ public abstract class Game implements Listener { Manager = manager; - //Player List - UtilTabTitle.broadcastHeaderAndFooter(C.cGold + C.Bold + gameType.GetName(), "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop"); - - //Game + // Player List + UtilTabTitle.broadcastHeaderAndFooter(C.cGold + C.Bold + gameType.GetName(), "Visit " + C.cGreen + "www.mineplex.com" + + ChatColor.RESET + " for News, Forums and Shop"); + + // Game _gameType = gameType; _gameDesc = gameDesc; - //Kits + // Kits _kits = kits; - //Scoreboard + // Scoreboard Scoreboard = new GameScoreboard(this); - //Map Select + // Map Select _files = new HashMap>(); - for(GameType type : GetWorldHostNames()) + for (GameType type : GetWorldHostNames()) { _files.put(type, Manager.LoadFiles(type.GetName())); } if (Manager.GetGameCreationManager().MapPref != null) { System.out.println("Map Preference: " + Manager.GetGameCreationManager().MapPref); - + HashMap> matches = new HashMap>(); for (GameType game : _files.keySet()) { ArrayList list = new ArrayList(); - for(String cur : _files.get(game)) + for (String cur : _files.get(game)) { if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase())) { - if(game.GetName().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase())) + if (game.GetName().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase())) { list.add(cur); System.out.print("Map Preference: " + cur); @@ -373,37 +366,13 @@ public abstract class Game implements Listener } WorldData = new WorldData(this); - //Stat Trackers - registerStatTrackers( - new KillsStatTracker(this), - new DeathsStatTracker(this), - new AssistsStatTracker(this), - new ExperienceStatTracker(this), - new WinStatTracker(this), - new LoseStatTracker(this), - new DamageDealtStatTracker(this), - new DamageTakenStatTracker(this), - new GamesPlayedStatTracker(this) - ); - + // Stat Trackers + registerStatTrackers(new KillsStatTracker(this), new DeathsStatTracker(this), new AssistsStatTracker(this), + new ExperienceStatTracker(this), new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker( + this), new DamageTakenStatTracker(this), new GamesPlayedStatTracker(this)); + Manager.setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack()); - try - { - PacketTeam = Class.forName( - "org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftTeam") - .getDeclaredField("team"); - PacketTeam.setAccessible(true); - - NameTagVisibility = PacketPlayOutScoreboardTeam.class - .getDeclaredField("_nameTagVisibility"); - NameTagVisibility.setAccessible(true); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - _useEntityPacketHandler = new IPacketHandler() { @Override @@ -411,9 +380,8 @@ public abstract class Game implements Listener { if (packetInfo.getPacket() instanceof PacketPlayInUseEntity) { - net.minecraft.server.v1_7_R4.Entity entity = ((PacketPlayInUseEntity) packetInfo - .getPacket()).a(((CraftWorld) packetInfo - .getPlayer().getWorld()).getHandle()); + net.minecraft.server.v1_8_R3.Entity entity = ((PacketPlayInUseEntity) packetInfo.getPacket()) + .a(((CraftWorld) packetInfo.getPlayer().getWorld()).getHandle()); if (entity instanceof EntityItem) { @@ -440,23 +408,26 @@ public abstract class Game implements Listener { return _gameType.GetName(); } - + public GameType[] GetWorldHostNames() { - GameType[] mapSource = new GameType[]{GetType()}; - if(GetType().getMapSource() != null) + GameType[] mapSource = new GameType[] + { + GetType() + }; + if (GetType().getMapSource() != null) { - if(GetType().ownMaps()) + if (GetType().ownMaps()) { int i = 1; mapSource = new GameType[GetType().getMapSource().length + 1]; - for(GameType type : GetType().getMapSource()) + for (GameType type : GetType().getMapSource()) { mapSource[i] = type; i++; } mapSource[0] = GetType(); - } + } else { mapSource = GetType().getMapSource(); @@ -464,16 +435,16 @@ public abstract class Game implements Listener } return mapSource; } - + public String GetGameNamebyMap(String game, String map) { - for(GameType type : _files.keySet()) + for (GameType type : _files.keySet()) { - if(type.GetName().toLowerCase().contains(game.toLowerCase())) + if (type.GetName().toLowerCase().contains(game.toLowerCase())) { - for(String string : _files.get(type)) + for (String string : _files.get(type)) { - if(string.toLowerCase().contains(map.toLowerCase())) + if (string.toLowerCase().contains(map.toLowerCase())) { return type.GetName(); } @@ -482,12 +453,12 @@ public abstract class Game implements Listener } return null; } - - public GameType GetGameByMapList(ArrayList maps) + + public GameType GetGameByMapList(ArrayList maps) { - for(GameType game : _files.keySet()) + for (GameType game : _files.keySet()) { - if(maps.equals(_files.get(game))) + if (maps.equals(_files.get(game))) { return game; } @@ -586,7 +557,7 @@ public abstract class Game implements Listener for (Player player : UtilServer.getPlayers()) player.leaveVehicle(); - //Event + // Event GameStateChangeEvent stateEvent = new GameStateChangeEvent(this, state); UtilServer.getServer().getPluginManager().callEvent(stateEvent); @@ -615,7 +586,7 @@ public abstract class Game implements Listener public void AddTeam(GameTeam team) { - //Add + // Add GetTeamList().add(team); System.out.println("Created Team: " + team.GetName()); @@ -638,7 +609,7 @@ public abstract class Game implements Listener public void RestrictKits() { - //Null Default + // Null Default } public void RegisterKits() @@ -649,8 +620,7 @@ public abstract class Game implements Listener for (Perk perk : kit.GetPerks()) { - UtilServer.getServer().getPluginManager() - .registerEvents(perk, Manager.getPlugin()); + UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.getPlugin()); perk.registeredEvents(); } } @@ -663,19 +633,22 @@ public abstract class Game implements Listener HandlerList.unregisterAll(kit); for (Perk perk : kit.GetPerks()) + { HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } } } public void ParseData() { - //Nothing by default, - //Use this to parse in extra location data from maps + // Nothing by default, + // Use this to parse in extra location data from maps } public void SetPlayerTeam(Player player, GameTeam team, boolean in) { - //Clean Old Team + // Clean Old Team GameTeam pastTeam = this.GetTeam(player); if (pastTeam != null) { @@ -684,16 +657,16 @@ public abstract class Game implements Listener team.AddPlayer(player, in); - //Ensure Valid Kit + // Ensure Valid Kit ValidateKit(player, team); - //Game Scoreboard + // Game Scoreboard Scoreboard.SetPlayerTeam(player, team.GetName().toUpperCase()); - //Lobby Scoreboard + // Lobby Scoreboard Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase()); - //Save Tournament Team + // Save Tournament Team Manager.GetGameTournamentManager().setTournamentTeam(player, team); } @@ -709,10 +682,10 @@ public abstract class Game implements Listener } } } - + GameTeam team = null; - //Random Team + // Random Team for (int i = 0; i < _teamList.size(); i++) { if (team == null || _teamList.get(i).GetSize() < team.GetSize()) @@ -762,7 +735,7 @@ public abstract class Game implements Listener { if (!countAmount && gems < 1) gems = 1; - + if (GetGems(player).containsKey(reason) && multipleAllowed) { GetGems(player).get(reason).AddGems(gems); @@ -775,13 +748,12 @@ public abstract class Game implements Listener public void ValidateKit(Player player, GameTeam team) { - //Kit + // Kit if (GetKit(player) == null || !team.KitAllowed(GetKit(player))) { for (Kit kit : _kits) { - if (kit.GetAvailability() == KitAvailability.Hide || - kit.GetAvailability() == KitAvailability.Null) + if (kit.GetAvailability() == KitAvailability.Hide || kit.GetAvailability() == KitAvailability.Null) continue; if (team.KitAllowed(kit)) @@ -801,7 +773,10 @@ public abstract class Game implements Listener if (!team.KitAllowed(kit)) { player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); - UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + ".")); + UtilPlayer.message( + player, + F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + + ".")); return; } } @@ -866,7 +841,7 @@ public abstract class Game implements Listener team.SetPlayerState(player, state); - //Event + // Event PlayerStateChangeEvent playerStateEvent = new PlayerStateChangeEvent(this, player, PlayerState.OUT); UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); @@ -882,11 +857,11 @@ public abstract class Game implements Listener Manager.Clear(player); - //Event + // Event PlayerGameRespawnEvent event = new PlayerGameRespawnEvent(this, player); UtilServer.getServer().getPluginManager().callEvent(event); - //Re-Give Kit + // Re-Give Kit Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { public void run() @@ -905,8 +880,8 @@ public abstract class Game implements Listener { if (entity instanceof Player) { - Player player = (Player)entity; - + Player player = (Player) entity; + GameTeam team = GetTeam(player); if (team == null) @@ -914,7 +889,7 @@ public abstract class Game implements Listener return team.IsAlive(player); } - + return false; } @@ -983,15 +958,16 @@ public abstract class Game implements Listener SpectatorSpawn.setY(vec.getY()); SpectatorSpawn.setZ(vec.getZ()); - //Move Up - Out Of Blocks - while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + // Move Up - Out Of Blocks + while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) + || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) { SpectatorSpawn.add(0, 1, 0); } int Up = 0; - //Move Up - Through Air + // Move Up - Through Air for (int i = 0; i < 15; i++) { if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) @@ -1005,8 +981,9 @@ public abstract class Game implements Listener } } - //Move Down - Out Of Blocks - while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + // Move Down - Out Of Blocks + while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) + || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) { SpectatorSpawn.subtract(0, 1, 0); Up--; @@ -1048,13 +1025,15 @@ public abstract class Game implements Listener public boolean CanJoinTeam(GameTeam team) { - return Manager.IsTeamBalance() ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length / GetTeamList().size()) : true; + return Manager.IsTeamBalance() ? team.GetSize() < Math.max(1, UtilServer.getPlayers().length / GetTeamList().size()) + : true; } - + @EventHandler public final void onFoodLevelChangeEvent(FoodLevelChangeEvent event) { - ((Player) event.getEntity()).setSaturation(3.8F); // While not entirely accurate, this is a pretty good guess at original food level changes + ((Player) event.getEntity()).setSaturation(3.8F); // While not entirely accurate, this is a pretty good guess at original + // food level changes } public GameTeam GetTeamPreference(Player player) @@ -1094,7 +1073,11 @@ public abstract class Game implements Listener { for (Player player : _teamPreference.get(team)) { - UtilPlayer.message(player, F.main("Team", "You are " + F.elem(GetTeamQueuePosition(player)) + " in queue for " + F.elem(team.GetFormattedName() + " Team") + ".")); + UtilPlayer.message( + player, + F.main("Team", + "You are " + F.elem(GetTeamQueuePosition(player)) + " in queue for " + + F.elem(team.GetFormattedName() + " Team") + ".")); } } } @@ -1126,7 +1109,8 @@ public abstract class Game implements Listener } UtilPlayer.message(player, ""); - UtilPlayer.message(player, C.cGreen + "Map - " + C.cYellow + C.Bold + WorldData.MapName + ChatColor.RESET + C.cGray + " created by " + C.cYellow + C.Bold + WorldData.MapAuthor); + UtilPlayer.message(player, C.cGreen + "Map - " + C.cYellow + C.Bold + WorldData.MapName + ChatColor.RESET + C.cGray + + " created by " + C.cYellow + C.Bold + WorldData.MapAuthor); UtilPlayer.message(player, ArcadeFormat.Line); } @@ -1138,7 +1122,7 @@ public abstract class Game implements Listener String winnerText = ChatColor.WHITE + "Nobody"; ChatColor subColor = ChatColor.WHITE; - + for (Player player : UtilServer.getPlayers()) { player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f); @@ -1155,9 +1139,9 @@ public abstract class Game implements Listener WinnerTeam = team; Winner = team.GetName() + " Team"; - winnerText = team.GetColor() + team.GetName(); + winnerText = team.GetColor() + team.GetName(); subColor = team.GetColor(); - + UtilPlayer.message(player, team.GetColor() + C.Bold + team.GetName() + " won the game!"); } else @@ -1165,10 +1149,10 @@ public abstract class Game implements Listener UtilPlayer.message(player, "Nobody won the game!"); } - UtilPlayer.message(player, _customWinLine); UtilPlayer.message(player, ""); - UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); + UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + + WorldData.MapAuthor); UtilPlayer.message(player, ArcadeFormat.Line); } @@ -1212,13 +1196,11 @@ public abstract class Game implements Listener UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName()); } - if (places.size() >= 2) { UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName()); } - if (places.size() >= 3) { UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName()); @@ -1226,7 +1208,8 @@ public abstract class Game implements Listener } UtilPlayer.message(player, ""); - UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor); + UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + + WorldData.MapAuthor); UtilPlayer.message(player, ArcadeFormat.Line); } @@ -1237,12 +1220,11 @@ public abstract class Game implements Listener Manager.GetChat().Silence(5000, false); } - public void Announce(String message) { if (message == null) return; - + Announce(message, true); } @@ -1334,7 +1316,7 @@ public abstract class Game implements Listener UtilPlayer.message(player, F.main("Game", "You cannot use " + F.elem("Gem Boosters")) + " for this game."); return; } - + if (GemBoosters.size() >= 4) { UtilPlayer.message(player, F.main("Game", "Games cannot have more than " + F.elem("4 Gem Boosters")) + "."); @@ -1347,17 +1329,22 @@ public abstract class Game implements Listener return; } - Announce(F.elem(player.getName()) + " used a " + F.elem(C.cGreen + "Gem Booster") + " for " + F.elem("+" + (100 - (GemBoosters.size() * 25)) + "% Gems") + "!"); + Announce(F.elem(player.getName()) + " used a " + F.elem(C.cGreen + "Gem Booster") + " for " + + F.elem("+" + (100 - (GemBoosters.size() * 25)) + "% Gems") + "!"); GemBoosters.add(player.getName()); } public double GetGemBoostAmount() { - if (GemBoosters.size() == 1) return 1; - if (GemBoosters.size() == 2) return 1.75; - if (GemBoosters.size() == 3) return 2.25; - if (GemBoosters.size() == 4) return 2.5; + if (GemBoosters.size() == 1) + return 1; + if (GemBoosters.size() == 2) + return 1.75; + if (GemBoosters.size() == 3) + return 2.25; + if (GemBoosters.size() == 4) + return 2.5; return 0; } @@ -1403,8 +1390,6 @@ public abstract class Game implements Listener } } - - public Collection> getStatTrackers() { return _statTrackers; @@ -1443,7 +1428,7 @@ public abstract class Game implements Listener { return Manager; } - + @EventHandler public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event) { @@ -1457,13 +1442,8 @@ public abstract class Game implements Listener public boolean isInsideMap(Location loc) { - return !( - loc.getX() >= WorldData.MaxX + 1 || - loc.getX() <= WorldData.MinX || - loc.getZ() >= WorldData.MaxZ + 1 || - loc.getZ() <= WorldData.MinZ || - loc.getY() >= WorldData.MaxY + 1 || - loc.getY() <= WorldData.MinY); + return !(loc.getX() >= WorldData.MaxX + 1 || loc.getX() <= WorldData.MinX || loc.getZ() >= WorldData.MaxZ + 1 + || loc.getZ() <= WorldData.MinZ || loc.getY() >= WorldData.MaxY + 1 || loc.getY() <= WorldData.MinY); } public void setItemMerge(boolean itemMerge) @@ -1500,7 +1480,7 @@ public abstract class Game implements Listener { Manager.GetGameCreationManager().SetNextGameType(gameType); - //End Current + // End Current if (GetState() == GameState.Recruit) { SetState(GameState.Dead); @@ -1514,26 +1494,26 @@ public abstract class Game implements Listener Announce(C.cAqua + C.Bold + caller.getName() + " set next game to " + gameType.GetName() + "."); } } - - public void endGame(GameTeam winningTeam) + + public void endGame(GameTeam winningTeam) { - AnnounceEnd(winningTeam); + AnnounceEnd(winningTeam); - for (GameTeam team : GetTeamList()) - { - if (WinnerTeam != null && team.equals(WinnerTeam)) - { - for (Player player : team.GetPlayers(false)) - AddGems(player, 10, "Winning Team", false, false); - } + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false, false); + } - for (Player player : team.GetPlayers(false)) - if (player.isOnline()) - AddGems(player, 10, "Participation", false, false); - } + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + } - //End - SetState(GameState.End); + // End + SetState(GameState.End); } @EventHandler @@ -1541,46 +1521,11 @@ public abstract class Game implements Listener { if (event.GetState() == GameState.Live) { - getArcadeManager().getPacketHandler().addPacketHandler( - _useEntityPacketHandler); + getArcadeManager().getPacketHandler().addPacketHandler(_useEntityPacketHandler, PacketPlayInUseEntity.class); } else if (event.GetState() == GameState.Dead) { - getArcadeManager().getPacketHandler().removePacketHandler( - _useEntityPacketHandler); - } - } - - @EventHandler - public void onDeadBodyJoin(PlayerJoinEvent event) - { - for (int i = 0; i < _deadBodyCount; i++) - { - String name = ""; - - for (char c : ("" + i).toCharArray()) - { - name += "§" + c; - } - - try - { - Team team = Scoreboard.GetScoreboard().getTeam(name); - - if (team == null) - { - continue; - } - - PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam( - (ScoreboardTeam) PacketTeam.get(team), 2); - - UtilPlayer.sendPacket(event.getPlayer(), packet); - } - catch (Exception ex) - { - ex.printStackTrace(); - } + getArcadeManager().getPacketHandler().removePacketHandler(_useEntityPacketHandler); } } @@ -1631,38 +1576,21 @@ public abstract class Game implements Listener return; } - String name = ""; + String name = "Body #" + _deadBodyCount++; - for (char c : ("" + _deadBodyCount++).toCharArray()) + Team team = Scoreboard.GetScoreboard().getTeam(ChatColor.COLOR_CHAR + "DeadBodies"); + + if (team == null) { - name += "§" + c; + team = Scoreboard.GetScoreboard().registerNewTeam(ChatColor.COLOR_CHAR + "DeadBodies"); + team.setNameTagVisibility(NameTagVisibility.NEVER); } - try - { - Team team = Scoreboard.GetScoreboard().registerNewTeam(name); - - team.setNameTagVisibility(TeamNameTagVisibility.NEVER); - team.addEntry(name); - - PacketPlayOutScoreboardTeam packet = new PacketPlayOutScoreboardTeam( - (ScoreboardTeam) PacketTeam.get(team), 2); - - for (Player alive : GetPlayers(false)) - { - UtilPlayer.sendPacket(alive, packet); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } + team.addEntry(name); GameProfile newProfile = new GameProfile(UUID.randomUUID(), name); - newProfile.getProperties() - .putAll(((CraftPlayer) player).getHandle().getProfile() - .getProperties()); + newProfile.getProperties().putAll(((CraftPlayer) player).getHandle().getProfile().getProperties()); DisguisePlayer disguise = new DisguisePlayer(null, newProfile); @@ -1673,10 +1601,8 @@ public abstract class Game implements Listener Location loc = player.getLocation(); WorldServer world = ((CraftWorld) loc.getWorld()).getHandle(); - EntityItem nmsItem = new EntityItem(world, loc.getX(), - loc.getY() + 0.5, loc.getZ(), - CraftItemStack.asNMSCopy(new ItemBuilder(Material.STONE) - .setTitle(System.currentTimeMillis() + "").build())); + EntityItem nmsItem = new EntityItem(world, loc.getX(), loc.getY() + 0.5, loc.getZ(), + CraftItemStack.asNMSCopy(new ItemBuilder(Material.STONE).setTitle(System.currentTimeMillis() + "").build())); nmsItem.motX = 0; nmsItem.motY = 0; @@ -1693,8 +1619,7 @@ public abstract class Game implements Listener if (DeadBodiesExpire > 0) { - _deadBodiesExpire.put(player.getName(), System.currentTimeMillis() - + (DeadBodiesExpire * 1000)); + _deadBodiesExpire.put(player.getName(), System.currentTimeMillis() + (DeadBodiesExpire * 1000)); } } @@ -1730,37 +1655,36 @@ public abstract class Game implements Listener { Block block = loc.getBlock(); - while (block.getY() > 0 - && !UtilBlock.fullSolid(block.getRelative(BlockFace.DOWN)) + while (block.getY() > 0 && !UtilBlock.fullSolid(block.getRelative(BlockFace.DOWN)) && !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) { block = block.getRelative(BlockFace.DOWN); } - BlockFace proper = BlockFace.values()[Math.round(loc.getYaw() / 90F) & 0x3] - .getOppositeFace(); + BlockFace proper = BlockFace.values()[Math.round(loc.getYaw() / 90F) & 0x3].getOppositeFace(); // A complicated way to get the face the dead body should be towards. for (HashSet validBlocks : new HashSet[] - { - UtilBlock.blockAirFoliageSet, UtilBlock.blockPassSet - }) + { + UtilBlock.blockAirFoliageSet, + UtilBlock.blockPassSet + }) { - if (validBlocks.contains((byte) block.getRelative(proper) - .getTypeId())) + if (validBlocks.contains((byte) block.getRelative(proper).getTypeId())) { return proper; } for (BlockFace face : new BlockFace[] + { + BlockFace.EAST, + BlockFace.SOUTH, + BlockFace.NORTH, + BlockFace.WEST + }) { - BlockFace.EAST, BlockFace.SOUTH, BlockFace.NORTH, - BlockFace.WEST - }) - { - if (validBlocks.contains((byte) block.getRelative(face) - .getTypeId())) + if (validBlocks.contains((byte) block.getRelative(face).getTypeId())) { return face; } @@ -1778,8 +1702,7 @@ public abstract class Game implements Listener return; } - Iterator> itel = _deadBodiesExpire.entrySet() - .iterator(); + Iterator> itel = _deadBodiesExpire.entrySet().iterator(); while (itel.hasNext()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index cc3956390..6527ec0ea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -111,6 +111,18 @@ public class GameTeam return _spawns; } + private Location fixFacing(Location loc) + { + float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(loc, Host.GetSpectatorLocation())); + + yaw = (int) (yaw / 90) * 90; + + loc = loc.clone(); + loc.setYaw(yaw); + + return loc; + } + public Location GetSpawn() { //Keep allies together @@ -119,7 +131,7 @@ public class GameTeam //Find Location Nearest Ally Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true)); if (loc != null) - return loc; + return fixFacing(loc); //No allies existed spawned yet @@ -128,14 +140,14 @@ public class GameTeam { loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) - return loc; + return fixFacing(loc); } //Spawn away from enemies else { loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true)); if (loc != null) - return loc; + return fixFacing(loc); } } else @@ -145,18 +157,18 @@ public class GameTeam { Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) - return loc; + return fixFacing(loc); } //Spawn away from players else { Location loc = UtilAlg.getLocationAwayFromPlayers(_spawns, Host.GetPlayers(true)); if (loc != null) - return loc; + return fixFacing(loc); } } - return _spawns.get(UtilMath.r(_spawns.size())); + return fixFacing(_spawns.get(UtilMath.r(_spawns.size()))); } public void AddPlayer(Player player, boolean in) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index ab258e925..7ab4b7812 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -22,7 +22,7 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBaconBlast; import nautilus.game.arcade.kit.perks.PerkSpeed; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; public class KitMamaPig extends Kit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index e0fad7f01..c2a457899 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -1070,7 +1070,7 @@ public class Build extends SoloGame @EventHandler public void entSpawn(CreatureSpawnEvent event) { - if (event.getSpawnReason() != SpawnReason.SPAWNER_EGG) + if (event.getSpawnReason() != SpawnReason.SPAWNER_EGG && (event.getEntityType() != EntityType.ARMOR_STAND || event.getSpawnReason() != SpawnReason.DEFAULT)) { event.setCancelled(true); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java index 61d8ac2a5..aaeda9147 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java @@ -21,15 +21,15 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Entity; import org.bukkit.entity.Ghast; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.meta.ItemMeta; -import net.minecraft.server.v1_7_R4.EntityLightning; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityWeather; +import net.minecraft.server.v1_8_R3.EntityLightning; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityWeather; public class BuildData { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/MobPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/MobPage.java index bf0395491..2165634ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/MobPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/gui/page/MobPage.java @@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.build.gui.page; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -76,7 +76,7 @@ public class MobPage extends ShopPageBase if (_entity instanceof LivingEntity) { final LivingEntity livingEntity = ((LivingEntity) _entity); - final boolean ghost = ((CraftLivingEntity) livingEntity).getHandle().ghost; + final boolean ghost = ((CraftLivingEntity) livingEntity).getHandle().isGhost(); ShopItem item = new ShopItem(Material.FEATHER, (ghost ? "Allow " : "Disable ") + "Pushing " + entityName, null, 0, false, false); addButton(buttonSlot, item, new IButton() @@ -84,7 +84,7 @@ public class MobPage extends ShopPageBase @Override public void onClick(Player player, ClickType clickType) { - ((CraftLivingEntity) livingEntity).getHandle().ghost = !ghost; + ((CraftLivingEntity) livingEntity).getHandle().setGhost(!ghost); UtilPlayer.message(player, F.main("Game", "Pushing " + (ghost ? "Enabled" : "Disabled") + " for " + entityName)); buildPage(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index 657020932..a508ff1cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -8,8 +8,8 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.CraftServer; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; @@ -47,9 +47,9 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.christmas.kits.KitPlayer; import nautilus.game.arcade.game.games.christmas.parts.*; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; public class Christmas extends SoloGame { @@ -93,9 +93,7 @@ public class Christmas extends SoloGame try { PacketPlayOutEntityDestroy destroyPacket = (PacketPlayOutEntityDestroy) packetInfo.getPacket(); - Field f = destroyPacket.getClass().getDeclaredField("a"); - f.setAccessible(true); - int[] entityIds = (int[]) f.get(destroyPacket); + int[] entityIds = destroyPacket.a; int origLength = entityIds.length; for (int a = 0; a < entityIds.length; a++) { @@ -115,7 +113,7 @@ public class Christmas extends SoloGame } if (entityIds.length != origLength) { - f.set(destroyPacket, entityIds); + destroyPacket.a = entityIds; } } catch (Exception ex) @@ -311,7 +309,10 @@ public class Christmas extends SoloGame { public void run() { - getArcadeManager().getPacketHandler().addPacketHandler(_reindeerPackets); + getArcadeManager().getPacketHandler().addPacketHandler( + _reindeerPackets, + PacketPlayOutEntityDestroy.class, + PacketPlayOutSpawnEntityLiving.class); GetSleigh(); @@ -404,7 +405,7 @@ public class Christmas extends SoloGame player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } @@ -422,7 +423,7 @@ public class Christmas extends SoloGame player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } @@ -675,7 +676,7 @@ public class Christmas extends SoloGame 10f, 1.2F); for (Player player : UtilServer.getPlayers()) - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index 621cae361..c4c5e0950 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -21,7 +21,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java index f3f74c8e3..10a772184 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighHorse.java @@ -4,22 +4,21 @@ import java.util.HashSet; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.EntityTrackerEntry; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.Vector3f; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.entity.Horse.Color; @@ -102,8 +101,8 @@ public class SleighHorse int z = zP + pZ; if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127) { - PacketPlayOutEntity relMove = pX != 0 || pZ != 0 ? new PacketPlayOutRelEntityMoveLook() - : new PacketPlayOutRelEntityMove(); + PacketPlayOutEntity relMove = pX != 0 || pZ != 0 ? new PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook() + : new PacketPlayOutEntity.PacketPlayOutRelEntityMove(); relMove.a = hornsAndNose[i]; relMove.b = (byte) x; relMove.c = (byte) y; @@ -139,8 +138,6 @@ public class SleighHorse HashSet cloned = (HashSet) trackedPlayers.clone(); for (EntityPlayer p : cloned) { - if (!UtilPlayer.is1_8(p.getBukkitEntity())) - continue; for (Packet packet : packets1_8) { p.playerConnection.sendPacket(packet); @@ -152,8 +149,6 @@ public class SleighHorse public void spawnHorns(Player player) { - if (!UtilPlayer.is1_8(player)) - return; Location loc = Ent == null ? _lastFacing : Ent.getLocation().add(0, 0.5, 0); for (int i = 0; i < 2; i++) { @@ -169,14 +164,14 @@ public class SleighHorse DataWatcher watcher = new DataWatcher(null); watcher.a(0, (byte) 32); watcher.a(10, (byte) 4); - watcher.a(11, new Vector(0, i * 180, (i == 0 ? -1 : 1) * 60f)); + watcher.a(11, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f)); packet.l = watcher; PacketPlayOutEntityEquipment enquipPacket = new PacketPlayOutEntityEquipment(); enquipPacket.a = id; enquipPacket.b = 4; enquipPacket.c = CraftItemStack.asNMSCopy(new ItemStack(Material.DEAD_BUSH)); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(enquipPacket); + UtilPlayer.sendPacket(player, packet); + UtilPlayer.sendPacket(player, enquipPacket); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java index 40d8c1cdc..2c0406f27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java @@ -7,7 +7,7 @@ import mineplex.core.common.util.UtilMath; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java index 9505ed8c4..39cce1f42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java @@ -7,11 +7,11 @@ import java.util.Iterator; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.christmas.parts.Part5; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java index 7b138f664..0b0909fd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java @@ -11,11 +11,11 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.parts.Part5; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index fa2b4c0b2..cae20e196 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.IronGolem; @@ -25,7 +25,7 @@ import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.ChristmasAudio; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; public class SnowmanBoss { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java index dd3d0112b..db9a10f0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java @@ -9,11 +9,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java index 77bd8edbd..0e2568a54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java @@ -9,11 +9,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index 890209d27..7a96132c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -13,7 +13,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.ChristmasAudio; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import org.bukkit.Location; import org.bukkit.Material; @@ -21,7 +21,7 @@ import org.bukkit.SkullType; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Ageable; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java index d67f13267..741b7f3ac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java @@ -14,7 +14,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.ChristmasAudio; import nautilus.game.arcade.game.games.christmas.content.*; -import net.minecraft.server.v1_7_R4.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityCreature; import org.bukkit.Bukkit; import org.bukkit.Effect; @@ -24,7 +24,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java index 5a22bcb61..50df5fe35 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java @@ -7,7 +7,7 @@ import nautilus.game.arcade.ArcadeManager; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index a0b18be18..24cd6996f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -468,7 +468,7 @@ public class Draw extends SoloGame continue; } - Block block = player.getTargetBlock(null, 200); + Block block = player.getTargetBlock((HashSet) null, 200); if (block == null || !_canvas.contains(block)) continue; @@ -570,7 +570,7 @@ public class Draw extends SoloGame if (!_drawers.HasPlayer(player)) return; - Block block = player.getTargetBlock(null, 200); + Block block = player.getTargetBlock((HashSet) null, 200); if (block == null || !_canvas.contains(block)) return; @@ -613,7 +613,7 @@ public class Draw extends SoloGame if (!_drawers.HasPlayer(player)) return; - Block block = player.getTargetBlock(null, 200); + Block block = player.getTargetBlock((HashSet) null, 200); if (block == null || block.getType() != Material.WOOL || _canvas.contains(block)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java index 3974212b0..c1b609934 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.draw.tools; import java.util.HashMap; +import java.util.HashSet; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; @@ -37,7 +38,7 @@ public abstract class Tool { if (!UtilEvent.isAction(event, ActionType.R)) return; - Block block = event.getPlayer().getTargetBlock(null, 60); + Block block = event.getPlayer().getTargetBlock((HashSet) null, 60); if (block == null) return; @@ -70,7 +71,7 @@ public abstract class Tool _new = new HashMap(); //Calculate New - Block end = _drawer.getTargetBlock(null, 64); + Block end = _drawer.getTargetBlock((HashSet) null, 64); if (end != null && Host.getCanvas().contains(end)) { customDraw(end); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 9dc6de524..487202f0c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -40,7 +40,7 @@ import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -1247,7 +1247,7 @@ public class EventModule extends MiniPlugin for (int i = 0 ; i < count ; i++) { Manager.GetGame().CreatureAllowOverride = true; - entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type)); + entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet)null, 0).getLocation().add(0.5, 1, 0.5), type)); Manager.GetGame().CreatureAllowOverride = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 39ceda806..bfcd5896f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -65,7 +65,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -146,9 +146,7 @@ public class Evolution extends SoloGame AutomaticRespawn = false; DeathSpectateSecs = 4.0; - - VersionRequire1_8 = true; - + CreatureAllow = false; InventoryClick = false; @@ -323,7 +321,7 @@ public class Evolution extends SoloGame player.eject(); player.leaveVehicle(); - ((CraftPlayer) player).getHandle().p(0); + ((CraftPlayer) player).getHandle().o(0); //Freeze Manager.GetCondition().Factory().Cloak("Evolving", player, null, 10, false, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index cd657ace3..c83af71c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -22,28 +22,28 @@ import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; -import net.minecraft.server.v1_7_R4.EntityBlaze; -import net.minecraft.server.v1_7_R4.EntityChicken; -import net.minecraft.server.v1_7_R4.EntityCreeper; -import net.minecraft.server.v1_7_R4.EntityEnderman; -import net.minecraft.server.v1_7_R4.EntityInsentient; -import net.minecraft.server.v1_7_R4.EntityIronGolem; -import net.minecraft.server.v1_7_R4.EntitySkeleton; -import net.minecraft.server.v1_7_R4.EntitySlime; -import net.minecraft.server.v1_7_R4.EntitySnowman; -import net.minecraft.server.v1_7_R4.EntitySpider; -import net.minecraft.server.v1_7_R4.EntityWolf; -import net.minecraft.server.v1_7_R4.EntityZombie; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; -import net.minecraft.server.v1_7_R4.World; +import net.minecraft.server.v1_8_R3.EntityBlaze; +import net.minecraft.server.v1_8_R3.EntityChicken; +import net.minecraft.server.v1_8_R3.EntityCreeper; +import net.minecraft.server.v1_8_R3.EntityEnderman; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityIronGolem; +import net.minecraft.server.v1_8_R3.EntitySkeleton; +import net.minecraft.server.v1_8_R3.EntitySlime; +import net.minecraft.server.v1_8_R3.EntitySnowman; +import net.minecraft.server.v1_8_R3.EntitySpider; +import net.minecraft.server.v1_8_R3.EntityWolf; +import net.minecraft.server.v1_8_R3.EntityZombie; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.World; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -133,7 +133,7 @@ public class EvolveData private void setupViewingToken(EntityInsentient ent) { Location playerEye = _token.Viewing.clone().add(.5, .62, .5); - Location entityHalf = _token.Platform.clone().add(.5, -1, .5).add(0, (ent.boundingBox.e - ent.boundingBox.b) * .75, 0); + Location entityHalf = _token.Platform.clone().add(.5, -1, .5).add(0, (ent.getBoundingBox().e - ent.getBoundingBox().b) * .75, 0); Vector viewing = UtilAlg.getTrajectory(playerEye, entityHalf); _token.Viewing.setPitch(UtilAlg.GetPitch(viewing)); @@ -209,7 +209,7 @@ public class EvolveData if (_holo == null) _holo = new Hologram(manager, _token.Platform); - double add = entity.boundingBox.e - entity.boundingBox.b + .3; + double add = entity.getBoundingBox().e - entity.getBoundingBox().b + .3; _holo.setLocation(_token.Platform.clone().add(0, add, 0)); @@ -357,10 +357,10 @@ public class EvolveData if (invisible) { - entity.Invisible = true; + entity.setInvisible(true); } - entity.ghost = true; + entity.setGhost(true); UtilPlayer.sendPacket(_player, packet); return entity; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index d72652411..ff3419b10 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -158,7 +158,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown //Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); - Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); //Event diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index b38629a80..504ee6d9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -82,7 +82,7 @@ public class PerkSulphurBombEVO extends Perk implements IThrown UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, Effect.SMOKE, 1, UpdateType.SLOW, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 61ba6ca2c..f4b381560 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -13,7 +13,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; @@ -115,8 +115,6 @@ public class Gravity extends SoloGame this.CompassEnabled = true; this.WorldBoundaryKill = false; - - this.VersionRequire1_8 = true; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index 5371ff69f..d4a083d94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -37,7 +37,7 @@ import nautilus.game.arcade.game.games.halloween.waves.WaveBase; import nautilus.game.arcade.game.games.halloween.waves.WaveBoss; import nautilus.game.arcade.game.games.halloween.waves.WaveVictory; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; import org.bukkit.ChatColor; import org.bukkit.Difficulty; @@ -45,7 +45,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Fireball; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -614,7 +614,7 @@ public class Halloween extends SoloGame player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ(), 20f, 1F); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(player, packet); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index 5ee19efdd..cff83a8df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -25,17 +25,18 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.halloween.HalloweenAudio; -import net.minecraft.server.v1_7_R4.EntityArrow; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityArrow; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Arrow; import org.bukkit.entity.Blaze; import org.bukkit.entity.Entity; @@ -286,7 +287,7 @@ public class PumpkinKing extends CreatureBase //Move EntityCreature ec = ((CraftCreature)GetEntity()).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); nav.a(loc.getX(), loc.getY(), loc.getZ(), 1f); } else diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index ee2af9ec4..e4652e638 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.Map.Entry; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -15,7 +16,7 @@ import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Arrow; import org.bukkit.entity.Chicken; @@ -95,9 +96,13 @@ import nautilus.game.arcade.stats.BadHiderStatTracker; import nautilus.game.arcade.stats.HunterKillerStatTracker; import nautilus.game.arcade.stats.HunterOfTheYearStatTracker; import nautilus.game.arcade.stats.MeowStatTracker; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; @SuppressWarnings("deprecation") public class HideSeek extends TeamGame @@ -195,24 +200,99 @@ public class HideSeek extends TeamGame private ArrayList _allowedBlocks; private ArrayList _allowedEnts; - private IPacketHandler _preventSpawnSent = new IPacketHandler() - { + + private IPacketHandler _useEntity = new IPacketHandler() + { + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.getPacket() instanceof PacketPlayInUseEntity) + { + int id = ((PacketPlayInUseEntity) packetInfo.getPacket()).a; - @Override - public void handle(PacketInfo packetInfo) - { - if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntity) - { - Form form = _forms.get(packetInfo.getPlayer()); - if (form != null && form instanceof BlockForm - && ((BlockForm) form).getEntityId() == ((PacketPlayOutSpawnEntity) packetInfo.getPacket()).a) - { - packetInfo.setCancelled(true); - } - } - } + for (Entry entry : _forms.entrySet()) + { + if (entry.getValue() instanceof BlockForm) + { + BlockForm blockForm = (BlockForm) entry.getValue(); - }; + if (blockForm.getBlockId() == id) + { + ((PacketPlayInUseEntity) packetInfo.getPacket()).a = blockForm.Player + .getEntityId(); + break; + } + } + } + } + } + }; + + private IPacketHandler _blockDisguise = new IPacketHandler() + { + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntityLiving) + { + int id = ((PacketPlayOutSpawnEntityLiving) packetInfo + .getPacket()).a; + + for (Entry entry : _forms.entrySet()) + { + if (entry.getValue() instanceof BlockForm) + { + final BlockForm blockForm = (BlockForm) entry + .getValue(); + + if (blockForm.Player.getEntityId() == id + && blockForm.Player != packetInfo.getPlayer()) + { + final Player player = packetInfo.getPlayer(); + + Bukkit.getScheduler().scheduleSyncDelayedTask( + Manager.getPlugin(), new Runnable() + { + public void run() + { + UtilPlayer + .sendPacket( + player, + blockForm + .getBlockPackets()); + } + }); + break; + } + } + } + } + else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy) + { + for (int i : ((PacketPlayOutEntityDestroy) packetInfo + .getPacket()).a) + { + for (Entry entry : _forms.entrySet()) + { + if (entry.getValue() instanceof BlockForm) + { + BlockForm blockForm = (BlockForm) entry.getValue(); + + if (blockForm.Player.getEntityId() == i) + { + UtilPlayer.sendPacket(packetInfo.getPlayer(), + new PacketPlayOutEntityDestroy( + new int[] + { + blockForm.getBlockId() + })); + } + } + } + } + } + } + }; public HideSeek(ArcadeManager manager) { @@ -270,11 +350,13 @@ public class HideSeek extends TeamGame { if (event.GetState() == GameState.Prepare) { - this.getArcadeManager().getPacketHandler().addPacketHandler(_preventSpawnSent); + this.getArcadeManager().getPacketHandler().addPacketHandler(_blockDisguise, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class); + this.getArcadeManager().getPacketHandler().addPacketHandler(_useEntity, true, PacketPlayInUseEntity.class); } - else if (event.GetState() == GameState.End) + else if (event.GetState() == GameState.Dead) { - this.getArcadeManager().getPacketHandler().removePacketHandler(_preventSpawnSent); + this.getArcadeManager().getPacketHandler().removePacketHandler(_blockDisguise); + this.getArcadeManager().getPacketHandler().removePacketHandler(_useEntity); } } @@ -713,7 +795,7 @@ public class HideSeek extends TeamGame UtilAlg.getTrajectory(_mobs.get(ent), ent.getLocation()).multiply(Math.random() * 3)); EntityCreature ec = ((CraftCreature) ent).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); nav.a(loc.getX(), loc.getY(), loc.getZ(), 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java index 4d8570d9d..0ebd75ca8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java @@ -14,15 +14,17 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.hideseek.HideSeek; import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.EntityPlayer; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.Effect; @@ -31,9 +33,9 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; @@ -42,38 +44,35 @@ import org.bukkit.util.Vector; public class BlockForm extends Form { - private Material _mat; + private Material _mat; - private Block _block; - private int _entityId; + private Block _block; + private int _entityId; - private Location _loc; - private int _selfEntityId1; - private int _selfEntityId2; - private Vector _lastSaw; - private Vector _sawDiff = new Vector(); - private boolean _is18; + private Location _loc; + private int _selfEntityId1; + private int _selfEntityId2; + private Vector _lastSaw; + private Vector _sawDiff = new Vector(); + private int _blockId = UtilEnt.getNewEntityId(); - public BlockForm(HideSeek host, Player player, Material mat) - { - super(host, player); + public BlockForm(HideSeek host, Player player, Material mat) + { + super(host, player); - _is18 = UtilPlayer.is1_8(player); - _mat = mat; - _loc = player.getLocation(); - _selfEntityId1 = UtilEnt.getNewEntityId(); - _selfEntityId2 = UtilEnt.getNewEntityId(); - System.out.println("Block Form: " + _mat + " " + _mat.getId()); - } + _mat = mat; + _loc = player.getLocation(); + _selfEntityId1 = UtilEnt.getNewEntityId(); + _selfEntityId2 = UtilEnt.getNewEntityId(); + System.out.println("Block Form: " + _mat + " " + _mat.getId()); + } - @Override + @Override public void Apply() { // Remove Old if (Player.getPassenger() != null) { - Recharge.Instance.useForce(Player, "PassengerChange", 100); - Player.getPassenger().remove(); Player.eject(); } @@ -85,52 +84,44 @@ public class BlockForm extends Form DisguiseChicken disguise = new DisguiseChicken(Player); disguise.setBaby(); -// disguise.setInvisible(true); - disguise.setSoundDisguise(new DisguiseCat(Player)); - Host.Manager.GetDisguise().disguise(disguise); + disguise.setInvisible(true); + disguise.setSoundDisguise(new DisguiseCat(Player)); + Host.Manager.GetDisguise().disguise(disguise); - // Apply Falling Block - FallingBlockCheck(); + // Apply Falling Block + FallingBlockCheck(); - // Spawn the falling block that's visible to the disguised player only. - - Packet[] packets = new Packet[3]; + // Spawn the falling block that's visible to the disguised player only. - if (_is18) - { - PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving(); - packet1.a = _selfEntityId1; - packet1.b = EntityType.SILVERFISH.getTypeId(); - packet1.c = (int) Math.floor(_lastSaw.getX() * 32); - packet1.d = (int) Math.floor(_lastSaw.getY() * 32); - packet1.e = (int) Math.floor(_lastSaw.getZ() * 32); - DataWatcher watcher = new DataWatcher(null); - watcher.a(0, (byte) 32); - watcher.a(1, 0); - packet1.l = watcher; - packets[0] = packet1; + Packet[] packets = new Packet[3]; - PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity(); + PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving(); + packet1.a = _selfEntityId1; + packet1.b = EntityType.SILVERFISH.getTypeId(); + packet1.c = (int) Math.floor(_lastSaw.getX() * 32); + packet1.d = (int) Math.floor(_lastSaw.getY() * 32); + packet1.e = (int) Math.floor(_lastSaw.getZ() * 32); + DataWatcher watcher = new DataWatcher(null); + watcher.a(0, (byte) 32); + watcher.a(1, 0); + packet1.l = watcher; + packets[0] = packet1; - packet3.b = _selfEntityId2; - packet3.c = _selfEntityId1; - packets[2] = packet3; - } + PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity(); - PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, 70, _mat.getId()); - packet2.a = _is18 ? _selfEntityId2 : _selfEntityId1; - packets[1] = packet2; + packet3.b = _selfEntityId2; + packet3.c = _selfEntityId1; + packets[2] = packet3; - for (Packet packet : packets) - { - if (packet != null) - { - player.playerConnection.sendPacket(packet); - } - } + PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, + 70, _mat.getId()); + packet2.a = _selfEntityId2; + packets[1] = packet2; - // Inform - String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false)); + UtilPlayer.sendPacket(Player, packets); + + // Inform + String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false)); if (!blockName.contains("Block")) UtilPlayer.message( Player, @@ -151,264 +142,281 @@ public class BlockForm extends Form Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); } - @Override - public void Remove() - { - SolidifyRemove(); + public Packet[] getBlockPackets() + { + PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(((CraftPlayer) Player).getHandle(), + 70, _mat.getId()); + packet2.a = _blockId; - Host.Manager.GetDisguise().undisguise(Player); + PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity(); - // Remove FB - if (Player.getPassenger() != null) - { - Recharge.Instance.useForce(Player, "PassengerChange", 100); + packet3.b = _blockId; + packet3.c = Player.getEntityId(); - Player.getPassenger().remove(); - Player.eject(); + return new Packet[] {packet2, packet3}; + } + + public int getBlockId() + { + return _blockId; + } + + @Override + public void Remove() + { + SolidifyRemove(); - ((CraftPlayer) Player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[] - { - _selfEntityId1, _selfEntityId2 - })); - } + Host.Manager.GetDisguise().undisguise(Player); - ((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); - } + UtilPlayer.sendPacket(Player, new PacketPlayOutEntityDestroy(new int[] + { + _selfEntityId1, _selfEntityId2, _blockId + })); - public void SolidifyUpdate() - { - if (!Player.isSprinting()) - ((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32)); + ((CraftEntity) Player).getHandle().getDataWatcher() + .watch(0, Byte.valueOf((byte) 0)); + } - // Not a Block - if (_block == null) - { - // Moved - if (!_loc.getBlock().equals(Player.getLocation().getBlock())) - { - Player.setExp(0); - _loc = Player.getLocation(); - } - // Unmoved - else - { - double hideBoost = 0.025; - if (Host.GetKit(Player) instanceof KitHiderQuick) - hideBoost = 0.1; + public void SolidifyUpdate() + { + if (!Player.isSprinting()) + ((CraftEntity) Player).getHandle().getDataWatcher() + .watch(0, Byte.valueOf((byte) 32)); - Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost)); + // Not a Block + if (_block == null) + { + // Moved + if (!_loc.getBlock().equals(Player.getLocation().getBlock())) + { + Player.setExp(0); + _loc = Player.getLocation(); + } + // Unmoved + else + { + double hideBoost = 0.025; + if (Host.GetKit(Player) instanceof KitHiderQuick) + hideBoost = 0.1; - // Set Block - if (Player.getExp() >= 0.999f) - { - Block block = Player.getLocation().getBlock(); + Player.setExp((float) Math.min(0.999f, Player.getExp() + + hideBoost)); - // Not Able - if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) - { - UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here.")); - Player.setExp(0f); - return; - } + // Set Block + if (Player.getExp() >= 0.999f) + { + Block block = Player.getLocation().getBlock(); - Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player)); + // Not Able + if (block.getType() != Material.AIR + || !UtilBlock.solid(block + .getRelative(BlockFace.DOWN))) + { + UtilPlayer.message(Player, F.main("Game", + "You cannot become a Solid Block here.")); + Player.setExp(0f); + return; + } - // Set Block - _block = block; + Bukkit.getPluginManager().callEvent( + new HideSeek.PlayerSolidifyEvent(Player)); - // Effect - Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat); - // block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat); + // Set Block + _block = block; - // Display - SolidifyVisual(); + // Effect + Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, + _mat); + // block.getWorld().playEffect(block.getLocation(), + // Effect.STEP_SOUND, _mat); - // Invisible - // Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false); + // Display + SolidifyVisual(); - // Sound - Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f); + // Invisible + // Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", + // Player, Player, 60000, false, false); - // Teleport falling block to the position. - Vector blockLoc = _block.getLocation().add(0.5, _is18 ? -.21875 : 0, 0.5).toVector(); + // Sound + Player.playSound(Player.getLocation(), Sound.NOTE_PLING, + 1f, 2f); - _sawDiff.add(blockLoc.clone().subtract(_lastSaw)); + // Teleport falling block to the position. + Vector blockLoc = _block.getLocation() + .add(0.5, -.21875, 0.5).toVector(); - Packet packet = this.getPacket(_sawDiff, blockLoc); + _sawDiff.add(blockLoc.clone().subtract(_lastSaw)); - _lastSaw = Player.getLocation().toVector().subtract(new Vector(0, _is18 ? 0.15625 : 0, 0)); - _sawDiff = _lastSaw.clone().subtract(blockLoc); + Packet packet = this.getPacket(_sawDiff, blockLoc); - if (packet != null) - { - if (packet instanceof PacketPlayOutEntityTeleport) - { - _sawDiff = new Vector(); - } + _lastSaw = Player.getLocation().toVector() + .subtract(new Vector(0, 0.15625, 0)); + _sawDiff = _lastSaw.clone().subtract(blockLoc); - ((CraftPlayer) Player).getHandle().playerConnection.sendPacket(packet); - } - } - } - } - // Is a Block - else - { - // Moved - if (!_loc.getBlock().equals(Player.getLocation().getBlock())) - { - SolidifyRemove(); - } - // Send Packets - else - { - SolidifyVisual(); - } - } - } + if (packet != null) + { + if (packet instanceof PacketPlayOutEntityTeleport) + { + _sawDiff = new Vector(); + } - public void SolidifyRemove() - { - if (_block != null) - { - MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0); - _block = null; - } + ((CraftPlayer) Player).getHandle().playerConnection + .sendPacket(packet); + } - Player.setExp(0f); + for (Player player : UtilServer.getPlayers()) + { + UtilPlayer.sendPacket(player, + new PacketPlayOutEntityDestroy(new int[] + { + getBlockId() + })); + } + } + } + } + // Is a Block + else + { + // Moved + if (!_loc.getBlock().equals(Player.getLocation().getBlock())) + { + SolidifyRemove(); + } + // Send Packets + else + { + SolidifyVisual(); + } + } + } - // Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block"); + public void SolidifyRemove() + { + if (_block != null) + { + MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0); + _block = null; - // Inform - Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f); + EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) Player) + .getHandle().world).tracker.trackedEntities.get(Player + .getEntityId()); - FallingBlockCheck(); - } + if (tracker != null) + { + for (EntityPlayer entity : tracker.trackedPlayers) + { + UtilPlayer.sendPacket(entity.getBukkitEntity(), + getBlockPackets()); + } + } + } - @SuppressWarnings("deprecation") - public void SolidifyVisual() - { - if (_block == null) - return; + Player.setExp(0f); - // Remove Old - if (Player.getPassenger() != null) - { - Recharge.Instance.useForce(Player, "PassengerChange", 100); + // Host.Manager.GetCondition().EndCondition(Player, null, + // "Disguised as Block"); - Player.getPassenger().remove(); - Player.eject(); - } + // Inform + Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f); - // Others - for (Player other : UtilServer.getPlayers()) - if (!other.equals(Player)) - other.sendBlockChange(Player.getLocation(), _mat, (byte) 0); + FallingBlockCheck(); + } - // Self - Player.sendBlockChange(Player.getLocation(), 36, (byte) 0); + @SuppressWarnings("deprecation") + public void SolidifyVisual() + { + if (_block == null) + return; - } + // Others + for (Player other : UtilServer.getPlayers()) + if (!other.equals(Player)) + other.sendBlockChange(Player.getLocation(), _mat, (byte) 0); - public void FallingBlockCheck() - { + // Self + Player.sendBlockChange(Player.getLocation(), 36, (byte) 0); - EntityPlayer player = ((CraftPlayer) Player).getHandle(); + } - // Block Form (Hide Falling) - if (_block == null) - { - // Recreate Falling - if (Player.getPassenger() == null || !Player.getPassenger().isValid()) - { - if (Recharge.Instance.use(Player, "PassengerChange", 100, false, false)) - { - _entityId = UtilEnt.getNewEntityId(false); - // Falling Block - FallingBlock block = Player.getWorld().spawnFallingBlock(Player.getEyeLocation(), _mat, (byte) 0); + public void FallingBlockCheck() + { + // Block Form (Hide Falling) + if (_block == null) + { + // Tell falling block to move around - // No Arrow Collision - ((CraftFallingSand) block).getHandle().spectating = true; + if (_lastSaw != null) + { + this._sawDiff.add(Player.getLocation() + .subtract(0, 0.15625, 0).toVector() + .subtract(_lastSaw)); + } - Player.setPassenger(block); - } - } - else - { - // Ensure Falling doesnt Despawn - ((CraftFallingSand) Player.getPassenger()).getHandle().ticksLived = 1; - Player.getPassenger().setTicksLived(1); - } + _lastSaw = Player.getLocation().subtract(0, 0.15625, 0) + .toVector(); - // Tell falling block to move around - - if (_lastSaw != null) - { - this._sawDiff.add(Player.getLocation().subtract(0, _is18 ? 0.15625 : 0, 0).toVector().subtract(_lastSaw)); - } + Packet packet = this.getPacket(_sawDiff, _lastSaw); - _lastSaw = Player.getLocation().subtract(0, _is18 ? 0.15625 : 0, 0).toVector(); + if (packet != null) + { + if (packet instanceof PacketPlayOutRelEntityMove) + { + PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet; + _sawDiff.subtract(new Vector(relPacket.b / 32D, + relPacket.c / 32D, relPacket.d / 32D)); + } + else + { + _sawDiff = new Vector(); + } - Packet packet = this.getPacket(_sawDiff, _lastSaw); + UtilPlayer.sendPacket(Player, packet); + } + } + } - if (packet != null) - { - if (packet instanceof PacketPlayOutRelEntityMove) - { - PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet; - _sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D)); - } - else - { - _sawDiff = new Vector(); - } + private Packet getPacket(Vector blocksFromNewPosition, Vector newPosition) + { + int x = (int) Math.floor(blocksFromNewPosition.getX() * 32); + int y = (int) Math.floor(blocksFromNewPosition.getY() * 32); + int z = (int) Math.floor(blocksFromNewPosition.getZ() * 32); - player.playerConnection.sendPacket(packet); - } + if (x != 0 || y != 0 || z != 0) + { + if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 + && z <= 127) + { + PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove(); + relMove.a = this._selfEntityId1; + relMove.b = (byte) x; + relMove.c = (byte) y; + relMove.d = (byte) z; - } - } + return relMove; + } + else + { + PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); + teleportPacket.a = _selfEntityId1; + teleportPacket.b = (int) Math.floor(32 * newPosition.getX()); + teleportPacket.c = (int) Math.floor(32 * newPosition.getY()); + teleportPacket.d = (int) Math.floor(32 * newPosition.getZ()); - private Packet getPacket(Vector blocksFromNewPosition, Vector newPosition) - { - int x = (int) Math.floor(blocksFromNewPosition.getX() * 32); - int y = (int) Math.floor(blocksFromNewPosition.getY() * 32); - int z = (int) Math.floor(blocksFromNewPosition.getZ() * 32); + return teleportPacket; + } + } - if (x != 0 || y != 0 || z != 0) - { - if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127) - { - PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove(); - relMove.a = this._selfEntityId1; - relMove.b = (byte) x; - relMove.c = (byte) y; - relMove.d = (byte) z; + return null; + } - return relMove; - } - else - { - PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); - teleportPacket.a = _selfEntityId1; - teleportPacket.b = (int) Math.floor(32 * newPosition.getX()); - teleportPacket.c = (int) Math.floor(32 * newPosition.getY()); - teleportPacket.d = (int) Math.floor(32 * newPosition.getZ()); + public Block GetBlock() + { + return _block; + } - return teleportPacket; - } - } - - return null; - } - - public Block GetBlock() - { - return _block; - } - - public int getEntityId() - { - return _entityId; - } + public int getEntityId() + { + return _entityId; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java index c0524e588..3577f78c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java @@ -10,7 +10,7 @@ import nautilus.game.arcade.game.games.hideseek.HideSeek; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java index b736d6346..8ba36c192 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java @@ -5,7 +5,6 @@ import java.util.List; import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java index 2f32b5807..2a99fc93d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java @@ -5,7 +5,6 @@ import java.util.List; import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java index a40c0952e..e74217d13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java @@ -5,7 +5,6 @@ import java.util.List; import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java index 917bf5f77..63e30ce89 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java @@ -57,7 +57,6 @@ public class HoleInTheWall extends SoloGame DamageFall = false; HungerSet = 20; WorldTimeSet = 8000; - VersionRequire1_8 = true; } private ArrayList> getWall() @@ -352,52 +351,6 @@ public class HoleInTheWall extends SoloGame _wallHeight += Math.abs(tnt1.getY() - tnt2.getY()); } - private void setField(Object obj, String fieldName, Object value) - { - try - { - Field field = _fields.get(fieldName); - - if (field == null) - { - field = obj.getClass().getDeclaredField(fieldName); - field.setAccessible(true); - - _fields.put(fieldName, field); - } - - field.set(obj, value); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - private int getField(String fieldName, Object obj) - { - try - { - Field field = _fields.get(fieldName); - - if (field == null) - { - field = obj.getClass().getDeclaredField(fieldName); - field.setAccessible(true); - - _fields.put(fieldName, field); - } - - return field.getInt(obj); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - return 0; - } - @EventHandler public void SpawnWall(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/Wall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/Wall.java index bb52dc597..f9235f329 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/Wall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/Wall.java @@ -10,19 +10,19 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; -import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.DataWatcher; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -219,7 +219,7 @@ public class Wall { entry.getKey().add(vector); - PacketPlayOutRelEntityMove packet = new PacketPlayOutRelEntityMove(); + PacketPlayOutRelEntityMove packet = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(); packet.a = entry.getValue().chicken; packet.b = x; packet.d = z; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 5a7f6a0de..2e519edc8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -229,7 +229,7 @@ public class BombLobbers extends TeamGame implements IThrown canHit.add(pos); } - Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F, canHit); + Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, true, false, true, .2F, canHit); Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); @@ -343,7 +343,7 @@ public class BombLobbers extends TeamGame implements IThrown newTNT.setVelocity(tnt.getKey().getVelocity()); newTNT.setFuseTicks(60); - Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, false, true, .2F); + Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, true, false, true, .2F); tnt.getKey().remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java index db295ff13..de34929a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java @@ -68,7 +68,7 @@ public class PerkMortar extends Perk tnt.setFuseTicks(40); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); - Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, false, false, .2F); + Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, true, false, false, .2F); player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); @@ -107,7 +107,7 @@ public class PerkMortar extends Perk tnt.setFuseTicks(60); UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); - Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, false, false, .2F); + Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, true, false, false, .2F); // l.addThrower(event.getPlayer(), tnt); _scatter.add(tnt); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index 5359d0fa7..ac0054a2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -28,15 +28,16 @@ import nautilus.game.arcade.game.games.milkcow.kits.KitFarmerJump; import nautilus.game.arcade.game.games.milkcow.kits.KitSturdyFarmhand; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Chicken; import org.bukkit.entity.Cow; import org.bukkit.entity.Creature; @@ -225,7 +226,7 @@ public class MilkCow extends SoloGame //Move EntityCreature ec = ((CraftCreature)cow).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); if (UtilMath.offset(cow, host) > 6) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index a49a647fd..736b72cea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -15,8 +15,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; @@ -52,9 +52,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Team; -import org.bukkit.scoreboard.TeamNameTagVisibility; import org.bukkit.util.Vector; import mineplex.core.common.util.C; @@ -112,7 +112,7 @@ import nautilus.game.arcade.stats.KillsWithConditionStatTracker; import nautilus.game.arcade.stats.MineStrikeLastAliveKillStatTracker; import nautilus.game.arcade.stats.TeamDeathsStatTracker; import nautilus.game.arcade.stats.TeamKillsStatTracker; -import net.minecraft.server.v1_7_R4.EntityArrow; +import net.minecraft.server.v1_8_R3.EntityArrow; public class MineStrike extends TeamGame { @@ -265,8 +265,6 @@ public class MineStrike extends TeamGame this.JoinInProgress = true; - this.VersionRequire1_8 = true; - this.DontAllowOverfill = true; _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); @@ -332,7 +330,7 @@ public class MineStrike extends TeamGame System.out.println("Hiding Scoreboard Nametags for Other Teams"); for (Team curTeam : Scoreboard.GetScoreboard().getTeams()) { - curTeam.setNameTagVisibility(TeamNameTagVisibility.HIDE_FOR_OTHER_TEAMS); + curTeam.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS); //UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), // "scoreboard teams option " + curTeam.getName() + " nametagVisibility hideForOtherTeams"); } @@ -1166,7 +1164,7 @@ public class MineStrike extends TeamGame public void removeArrowsFromPlayer(CustomDamageEvent event) { if (event.GetDamageePlayer() != null) - ((CraftPlayer) event.GetDamageePlayer()).getHandle().p(0); + ((CraftPlayer) event.GetDamageePlayer()).getHandle().o(0); } @EventHandler(priority=EventPriority.HIGH) @@ -1657,7 +1655,7 @@ public class MineStrike extends TeamGame { for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true)) { - Block block = player.getTargetBlock(null, 5); + Block block = player.getTargetBlock((HashSet) null, 5); if (block == null || !_bomb.isBlock(block)) continue; @@ -1702,7 +1700,7 @@ public class MineStrike extends TeamGame if (_bombDefuser == null) return; - Block block = _bombDefuser.getTargetBlock(null, 5); + Block block = _bombDefuser.getTargetBlock((HashSet) null, 5); if (!IsAlive(_bombDefuser) || block == null || !_bomb.isBlock(block) || !_bombDefuser.isOnline() || UtilMath.offset(_bombDefuser.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java index fabd6bd90..3d1d29c40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -39,9 +39,10 @@ import nautilus.game.arcade.game.games.monstermaze.events.FirstToSafepadEvent; import nautilus.game.arcade.game.games.monstermaze.events.MonsterBumpPlayerEvent; import nautilus.game.arcade.game.games.monstermaze.events.SafepadBuildEvent; import nautilus.game.arcade.game.games.monstermaze.kits.KitBodyBuilder; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation; -import net.minecraft.server.v1_7_R4.PacketPlayOutBlockBreakAnimation; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockBreakAnimation; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -427,16 +428,9 @@ public class Maze implements Listener { data.getValue().Direction = CardinalDirection.WEST; } - UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f); - } - - //Timeout Move - if (UtilMath.offset(data.getKey().getLocation(), data.getValue().Last) > 0.1) - data.getValue().Time = System.currentTimeMillis(); - - if (UtilTime.elapsed(data.getValue().Time, 2000)) - UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f); + + UtilEnt.CreatureMoveFast(data.getKey(), data.getValue().Target, 1.4f); } } @@ -854,7 +848,7 @@ public class Maze implements Listener private Packet getBreakPacket(Location location, int index, int progress) { - return new PacketPlayOutBlockBreakAnimation(index, location.getBlockX(), location.getBlockY(), location.getBlockZ(), progress); + return new PacketPlayOutBlockBreakAnimation(index, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), progress); } public void decrementSafePadTime() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java index 4238ebba2..1bf407814 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MazeMobWaypoint.java @@ -6,14 +6,12 @@ public class MazeMobWaypoint { public Location Last; public Location Target; - public long Time; public CardinalDirection Direction = CardinalDirection.NULL; public MazeMobWaypoint(Location last) { Last = last; Target = null; - Time = System.currentTimeMillis(); } public enum CardinalDirection diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index 7d9811035..550c5a669 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -92,9 +92,7 @@ public class MonsterMaze extends SoloGame HungerSet = 20; CompassEnabled = false; - - VersionRequire1_8 = true; - + registerStatTrackers( new SnowmanHitTracker(this), new AbilityUseTracker(this), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java index 669ff6cf4..9121659d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java @@ -6,8 +6,9 @@ import java.util.Iterator; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilPlayer; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutBlockBreakAnimation; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockBreakAnimation; import org.bukkit.Location; import org.bukkit.Material; @@ -253,7 +254,7 @@ public class SafePad i++; - Packet packet = new PacketPlayOutBlockBreakAnimation(i, spb.getLocation().getBlockX(), spb.getLocation().getBlockY(), spb.getLocation().getBlockZ(), progress); + Packet packet = new PacketPlayOutBlockBreakAnimation(i, new BlockPosition(spb.getLocation().getBlockX(), spb.getLocation().getBlockY(), spb.getLocation().getBlockZ()), progress); packets.add(packet); } for(Player p : Host.GetPlayers(false)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 19ead99b7..5569229b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -39,7 +39,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EnderPearl; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.LivingEntity; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java index b072dea9a..12a842188 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java @@ -7,7 +7,6 @@ import nautilus.game.arcade.game.Game; import org.bukkit.ChatColor; import org.bukkit.EntityEffect; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 95a7aa264..59c1a8896 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -9,7 +9,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; @@ -34,7 +34,7 @@ import nautilus.game.arcade.game.games.runner.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.DistanceTraveledStatTracker; -import net.minecraft.server.v1_7_R4.EntityArrow; +import net.minecraft.server.v1_8_R3.EntityArrow; public class Runner extends SoloGame implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/EvolveButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/EvolveButton.java index f7b197630..3c81610d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/EvolveButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/EvolveButton.java @@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.searchanddestroy; import mineplex.core.shop.item.IButton; import nautilus.game.arcade.kit.Kit; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java index 50dfd8594..3c22b71c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java @@ -11,7 +11,7 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.hologram.Hologram; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; -import net.minecraft.server.v1_7_R4.EntityTNTPrimed; +import net.minecraft.server.v1_8_R3.EntityTNTPrimed; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -19,7 +19,7 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 38552e39b..835afefc4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -62,7 +62,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.Chest; import org.bukkit.block.DoubleChest; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Chicken; import org.bukkit.entity.Egg; import org.bukkit.entity.EnderPearl; @@ -774,7 +774,7 @@ public abstract class Skywars extends Game @EventHandler public void zombieTarget(EntityTargetLivingEntityEvent event) { - if (event.getEntity() instanceof Zombie && _zombies.containsKey((Zombie)event.getEntity())) + if (event.getTarget() != null && event.getEntity() instanceof Zombie && _zombies.containsKey((Zombie)event.getEntity())) { Zombie zombie = (Zombie)event.getEntity(); Location loc = _zombies.get(zombie); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 6e255aea9..2fcd7a276 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -26,6 +26,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.smash.kits.KitBlaze; import nautilus.game.arcade.game.games.smash.kits.KitChicken; +import nautilus.game.arcade.game.games.smash.kits.KitCow; import nautilus.game.arcade.game.games.smash.kits.KitCreeper; import nautilus.game.arcade.game.games.smash.kits.KitEnderman; import nautilus.game.arcade.game.games.smash.kits.KitGolem; @@ -109,6 +110,7 @@ public abstract class SuperSmash extends Game new KitWitherSkeleton(manager), new KitMagmaCube(manager), new KitZombie(manager), + new KitCow(manager), new KitSheep(manager) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index 91f27649c..bb4b110f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -33,7 +33,7 @@ public class KitChicken extends SmashKit new Perk[] { - new PerkSmashStats(4, 2.0, 0.1, 1.5), + new PerkSmashStats(4, 2.0, 0.15, 2), new PerkFlap(0.8, 0.8, false), new PerkEggGun(), new PerkChickenRocket() @@ -89,7 +89,7 @@ public class KitChicken extends SmashKit ChatColor.RESET + "while also gaining permanant flight.", })); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); + player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 207ff9c34..b8bd5b816 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -2,15 +2,24 @@ package nautilus.game.arcade.game.games.smash.kits; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.disguise.disguises.DisguiseCow; +import mineplex.core.disguise.disguises.DisguiseMooshroom; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkCowAngryHerd; +import nautilus.game.arcade.game.games.smash.perks.PerkCowMilkSpiral; +import nautilus.game.arcade.game.games.smash.perks.PerkCowMooshroomMadness; +import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; @@ -20,7 +29,7 @@ public class KitCow extends SmashKit { public KitCow(ArcadeManager manager) { - super(manager, "Mad Cow", KitAvailability.Gem, 5000, + super(manager, "Cow", KitAvailability.Gem, 6000, new String[] { @@ -28,14 +37,16 @@ public class KitCow extends SmashKit new Perk[] { - new PerkSmashStats(7, 1.0, 0.25, 8), + new PerkSmashStats(6, 0.9, 0.25, 7.5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - - + new PerkCowStampede(), + new PerkCowAngryHerd(), + new PerkCowMilkSpiral(), + new PerkCowMooshroomMadness(), }, EntityType.COW, new ItemStack(Material.MILK_BUCKET), - "", 0, null); + "Mooshroom Madness", 0, null); } @Override @@ -44,24 +55,56 @@ public class KitCow extends SmashKit UtilInv.Clear(player); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Angry Herd", new String[] { - ChatColor.RESET + "", + ChatColor.RESET + "Send forth an angry herd of Cows", + ChatColor.RESET + "which deal damage and knockback", + ChatColor.RESET + "to opponents. Can hit multiple times.", })); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Milk Spiral", new String[] { + ChatColor.RESET + "Spray out a spiral of milk, propelling", + ChatColor.RESET + "yourself forwards through it. Deals damage", + ChatColor.RESET + "to opponents it collides with.", ChatColor.RESET + "", + ChatColor.RESET + "Crouching cancels propulsion.", })); + + if (Manager.GetGame().GetState() == GameState.Recruit) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte)0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", + new String[] + { + ChatColor.RESET + "As you sprint, you will slowly", + ChatColor.RESET + "build up Speed Levels. You attacks", + ChatColor.RESET + "will deal extra damage and knockback", + ChatColor.RESET + "while you have Speed.", + })); + } + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Mooshroom Madness", + new String[] + { + ChatColor.RESET + "Transform into a powerful Mooshroom Cow.", + ChatColor.RESET + "This grants you +1 damage on all attacks", + ChatColor.RESET + "and abilities, halves ability cooldowns,", + ChatColor.RESET + "and increases your health to 15 hearts.", + ChatColor.RESET + "", + ChatColor.RESET + "You remain a Mooshroom until you die.", + })); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index 21222ca52..dacd9344c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -21,6 +21,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkEndermanTeleport; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; @@ -50,6 +51,7 @@ public class KitEnderman extends SmashKit new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkBlink("Blink", 16, 6000), new PerkBlockToss(), + new PerkEndermanTeleport(), new PerkEndermanDragon() }, EntityType.ENDERMAN, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java index cbab11fa3..88549d5da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java @@ -30,7 +30,7 @@ public class KitGolem extends SmashKit new Perk[] { - new PerkSmashStats(7, 1.0, 0.25, 8), + new PerkSmashStats(7, 1.0, 0.2, 8), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkSlow(0), new PerkFissure(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java index 98cdb65fc..5981b1303 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java @@ -214,13 +214,13 @@ public class KitKnight extends SmashKit Horse horse = (Horse)damagee.getVehicle(); //Damage Event - CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), + CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), null, event.GetCause(), event.GetDamageInitial(), true, false, false, UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); - _calledEvents.add(newEvent); - Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); - _calledEvents.remove(newEvent); +// _calledEvents.add(newEvent); +// Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); +// _calledEvents.remove(newEvent); } @EventHandler(priority = EventPriority.LOWEST) @@ -246,7 +246,7 @@ public class KitKnight extends SmashKit Player player = (Player)horse.getPassenger(); //Damage Event - final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), + final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), null, event.GetCause(), event.GetDamageInitial(), true, false, false, UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index 98af5d8fa..4fca31e49 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -30,7 +30,7 @@ public class KitMagmaCube extends SmashKit new Perk[] { - new PerkSmashStats(5, 1.75, 0.4, 5), + new PerkSmashStats(5, 1.75, 0.35, 5), new PerkDoubleJump("Double Jump", 1.2, 1, false), new PerkMagmaBoost(), new PerkMagmaBlast(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index 9dac8b5b3..755cfa69d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -37,7 +37,7 @@ public class KitPig extends SmashKit new Perk[] { - new PerkSmashStats(5, 1.7, 0.25, 5), + new PerkSmashStats(5, 1.5, 0.25, 5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkPigBaconBounce(), new PerkPigBaconBomb(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index 9fb2f108b..db9710e9c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -36,7 +36,7 @@ public class KitSkeletalHorse extends SmashKit new Perk[] { - new PerkSmashStats(6, 1.4, 0.35, 6), + new PerkSmashStats(6, 1.4, 0.3, 6), new PerkDoubleJump("Double Jump", 1, 1, false), new PerkHorseKick(), new PerkBoneRush(), @@ -45,7 +45,7 @@ public class KitSkeletalHorse extends SmashKit }, EntityType.HORSE, new ItemStack(Material.BONE), - "Bone Storm", 24000, Sound.HORSE_SKELETON_DEATH); + "Bone Storm", 20000, Sound.HORSE_SKELETON_DEATH); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 8acafe07d..51ae9b75e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -37,10 +37,10 @@ public class KitSkeleton extends SmashKit new Perk[] { - new PerkSmashStats(5, 1.25, 0.20, 6), + new PerkSmashStats(5, 1.25, 0.15, 6), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkFletcher(2, 4, false), - new PerkKnockbackArrow(1.75), + new PerkFletcher(3, 3, false), + new PerkKnockbackArrow(1.5), new PerkBoneExplosion(), new PerkRopedArrow("Roped Arrow", 1, 5000), new PerkBarrage(5, 300, true, false, true), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index ec5ba59fb..06b78a82e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -13,6 +13,7 @@ import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; @@ -38,6 +39,7 @@ public class KitSkySquid extends SmashKit new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkSuperSquid(), new PerkInkBlast(), + new PerkFishFlurry(), new PerkStormSquid() }, EntityType.SQUID, @@ -67,6 +69,16 @@ public class KitSkySquid extends SmashKit ChatColor.RESET + "the sky in the direction you are looking.", })); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fish Flurry", + new String[] + { + ChatColor.RESET + "Target a location to create a geyser.", + ChatColor.RESET + "After a few seconds, the geyser will explode", + ChatColor.RESET + "with all sorts of marine life which will", + ChatColor.RESET + "damage nearby opponents.", + })); + if (Manager.GetGame().GetState() == GameState.Recruit) player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index 2d319f847..3e40fcc29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -46,7 +46,7 @@ public class KitSlime extends SmashKit new Perk[] { - new PerkSmashStats(6, 1.75, 0.35, 3), + new PerkSmashStats(6, 1.75, 0.5, 3), new PerkDoubleJump("Double Jump", 1.2, 1, false), new PerkSlimeSlam(), new PerkSlimeRocket(), @@ -142,7 +142,7 @@ public class KitSlime extends SmashKit player.setExp(0.99f); - Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 1, false, false, false); + Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 2, false, false, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index 68eb1004d..4771d3865 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -92,8 +92,8 @@ public class KitSnowman extends SmashKit new String[] { ChatColor.RESET + "Creates a field of snow around you", - ChatColor.RESET + "granting 150% damage to opponents", - ChatColor.RESET + "who are standing on it.", + ChatColor.RESET + "granting +1 damage and 60% knockback", + ChatColor.RESET + "to opponents standing on it.", ChatColor.RESET + "", ChatColor.RESET + "Your aura shrinks on low energy.", })); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 2dd3c0108..89cfb0379 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -34,7 +34,7 @@ public class KitSpider extends SmashKit new Perk[] { - new PerkSmashStats(7, 1.5, 0.3, 6), + new PerkSmashStats(6, 1.5, 0.25, 6), new PerkSpiderLeap(), new PerkNeedler(), new PerkWebShot(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 6ec3cf4b0..71e08c798 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -34,7 +34,7 @@ public class KitWolf extends SmashKit new Perk[] { - new PerkSmashStats(5, 1.6, 0.3, 4.5), + new PerkSmashStats(5, 1.6, 0.25, 4.5), new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), new PerkWolf(), }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 08ea676e6..7ab935e7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -37,7 +37,7 @@ public class KitZombie extends SmashKit new Perk[] { - new PerkSmashStats(6, 1.25, 0.3, 4.5), + new PerkSmashStats(6, 1.25, 0.25, 5), new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkFletcher(2, 2, false), new PerkKnockbackArrow(1.5), @@ -66,7 +66,7 @@ public class KitZombie extends SmashKit })); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp", + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp", new String[] { ChatColor.RESET + "Leap forwards. If you collide with an ", @@ -99,6 +99,7 @@ public class KitZombie extends SmashKit player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowCharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowCharge.java new file mode 100644 index 000000000..a03be6065 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowCharge.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import org.bukkit.Location; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class DataCowCharge +{ + public long Time; + public Player Player; + public Vector Direction; + + public Cow Cow; + + public Location LastLoc; + public long LastMoveTime; + + public DataCowCharge(Player player, Cow cow) + { + Time = System.currentTimeMillis(); + + Player = player; + + Direction = player.getLocation().getDirection(); + Direction.setY(0); + Direction.normalize(); + Direction.multiply(0.75); + Direction.setY(-0.2); + + Cow = cow; + + LastLoc = Cow.getLocation(); + LastMoveTime = System.currentTimeMillis(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowMilkSpiral.java new file mode 100644 index 000000000..f4bb60f93 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataCowMilkSpiral.java @@ -0,0 +1,112 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class DataCowMilkSpiral +{ + public long Time; + public Player Player; + public Vector Direction; + + public boolean SuperActive; + + public boolean DisableVelocity = false; + + public Location Spiral; + public Location SpiralA = null; + public Location SpiralB = null; + + public DataCowMilkSpiral(Player player, boolean superActive) + { + Time = System.currentTimeMillis(); + + Player = player; + + SuperActive = superActive; + + Direction = player.getLocation().getDirection(); + + Spiral = player.getLocation().add(new Vector(0,1,0)).add(player.getLocation().getDirection().multiply(2)); + } + + public boolean update() + { + //Propel + if (!DisableVelocity && !Player.isSneaking() && !UtilTime.elapsed(Time, SuperActive ? 2400 : 1800)) + UtilAction.velocity(Player, Direction.clone().add(new Vector(0, 0.1, 0)).normalize().multiply(0.45)); + else + DisableVelocity = true; + + //Move Forward + Spiral.add(Direction.clone().multiply(0.7)); + + //Spiral + for (int i=0 ; i<2 ; i++) + { + double lead = i * ((2d * Math.PI)/2); + + //Orbit + double speed = 3d; + double oX = -Math.sin(Player.getTicksLived()/speed + lead) * 1.5; + double oZ = Math.cos(Player.getTicksLived()/speed + lead) * 1.5; + + Location newSpiral = Spiral.clone(); + newSpiral.add(UtilAlg.getLeft(Direction).multiply(oX)); + newSpiral.add(UtilAlg.getUp(Direction).multiply(oZ)); + + newSpiral.getWorld().playSound(newSpiral, Sound.SPLASH, 0.2f, 0.75f); + + if (i == 0) + { + if (SpiralA != null) + { + while (UtilMath.offset(SpiralA, newSpiral) > 0.2) + { + SpiralA.add(UtilAlg.getTrajectory(SpiralA, newSpiral).multiply(0.2)); + UtilParticle.PlayParticle(SuperActive ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, SpiralA, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + } + } + else + { + SpiralA = newSpiral; + } + } + + + else + { + if (SpiralB != null) + { + while (UtilMath.offset(SpiralB, newSpiral) > 0.1) + { + SpiralB.add(UtilAlg.getTrajectory(SpiralB, newSpiral).multiply(0.1)); + UtilParticle.PlayParticle(SuperActive ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, SpiralB, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + } + } + else + { + SpiralB = newSpiral; + } + } + } + + if (UtilBlock.solid(Spiral.getBlock())) + return true; + + return (UtilTime.elapsed(Time, 3000)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataSquidGeyser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataSquidGeyser.java new file mode 100644 index 000000000..298a40fe3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/DataSquidGeyser.java @@ -0,0 +1,20 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.HashSet; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class DataSquidGeyser +{ + public Player Player; + public HashSet Blocks; + public long StartTime; + + public DataSquidGeyser(Player player, HashSet blocks) + { + StartTime = System.currentTimeMillis(); + Player = player; + Blocks = blocks; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java new file mode 100644 index 000000000..79f51f53b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java @@ -0,0 +1,211 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Cow; +import org.bukkit.entity.MushroomCow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkCowAngryHerd extends SmashPerk +{ + private ArrayList _active = new ArrayList(); + + public PerkCowAngryHerd() + { + super("Angry Herd", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd" + }); + } + + + @EventHandler + public void shoot(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 12000, true, true)) + return; + + event.setCancelled(true); + + for (double i=-2 ; i<3 ; i++) + { + Vector dir = player.getLocation().getDirection(); + dir.setY(0); + dir.normalize(); + + Location loc = player.getLocation(); + + loc.add(dir); + loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); + + Manager.GetGame().CreatureAllowOverride = true; + Cow cow = player.getWorld().spawn(loc, isSuperActive(player) ? MushroomCow.class : Cow.class); + Manager.GetGame().CreatureAllowOverride = false; + + _active.add(new DataCowCharge(player, cow)); + } + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 2f, 0.6f); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator activeIter = _active.iterator(); + + while (activeIter.hasNext()) + { + DataCowCharge data = activeIter.next(); + + //Expire + if (UtilTime.elapsed(data.Time, 3000)) + { + if (data.Cow.isValid()) + { + data.Cow.remove(); + UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + } + + activeIter.remove(); + continue; + } + + //Set Moved + if (UtilMath.offset(data.Cow.getLocation(), data.LastLoc) > 1) + { + + data.LastLoc = data.Cow.getLocation(); + data.LastMoveTime = System.currentTimeMillis(); + } + + //Stuck Remove + if (UtilTime.elapsed(data.LastMoveTime, 1000)) + { + if (data.Cow.isValid()) + { + data.Cow.remove(); + UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + } + + activeIter.remove(); + continue; + } + + //Gravity + if (UtilEnt.isGrounded(data.Cow)) + { + data.Direction.setY(-0.1); + } + else + { + data.Direction.setY(Math.max(-1, data.Direction.getY() - 0.03)); + } + + //Move + if (UtilTime.elapsed(data.LastMoveTime, 350) && UtilEnt.isGrounded(data.Cow)) + data.Cow.setVelocity(data.Direction.clone().add(new Vector(0,0.75,0))); + else + data.Cow.setVelocity(data.Direction); + + if (Math.random() > 0.99) + data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f); + + if (Math.random() > 0.97) + data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f); + + //Hit + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(data.Player)) + continue; + + if (UtilMath.offset(player, data.Cow) < 2.2) + { + if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), 600, false, false)) + { + // Damage Event + Manager.GetDamage().NewDamageEvent(player, data.Player, null, data.Cow.getLocation(), DamageCause.CUSTOM, + 5, true, true, false, UtilEnt.getName(data.Player), GetName()); + + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + + data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.ZOMBIE_WOOD, 0.75f, 0.8f); + data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_HURT, 1.5f, 0.75f); + } + } + } + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 1.25); + } + + @Override + public boolean isSuperActive(Player player) + { + DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + + return disguise != null && disguise instanceof DisguiseMooshroom; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java new file mode 100644 index 000000000..0bea3c61a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMilkSpiral.java @@ -0,0 +1,111 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkCowMilkSpiral extends SmashPerk +{ + private HashMap _active = new HashMap(); + + public PerkCowMilkSpiral() + { + super("Milk Spiral", new String[] + { + C.cYellow + "Right Click" + C.cGray + " with Spade to " + C.cGreen + "Milk Spiral", + C.cGray + "Crouch to cancel movement for Milk Spiral" + }); + } + + @EventHandler + public void activate(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 6000 : 12000, true, true)) + return; + + _active.put(player, new DataCowMilkSpiral(player, isSuperActive(player))); + + //Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator activeIter = _active.values().iterator(); + + while (activeIter.hasNext()) + { + DataCowMilkSpiral data = activeIter.next(); + + if (data.update()) + activeIter.remove(); + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (player.equals(data.Player)) + continue; + + if (UtilMath.offset(player.getLocation().add(0, 1, 0), data.Spiral) < 2) + { + Manager.GetDamage().NewDamageEvent(player, data.Player, null, + DamageCause.CUSTOM, 6, true, false, false, + player.getName(), GetName()); + + UtilParticle.PlayParticle(isSuperActive(player) ? ParticleType.RED_DUST : ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0.3f, 30, ViewDist.LONG, UtilServer.getPlayers()); + player.getWorld().playSound(player.getLocation(), Sound.SPLASH, 0.25f, 2f); + } + } + } + } + + @Override + public boolean isSuperActive(Player player) + { + DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + + return disguise != null && disguise instanceof DisguiseMooshroom; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java new file mode 100644 index 000000000..4ec1a0909 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowMooshroomMadness.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.HashSet; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkCowMooshroomMadness extends SmashPerk +{ + private HashSet _cowSuperActive = new HashSet(); + + public PerkCowMooshroomMadness() + { + super("Mooshroom Madness", new String[] + { + }, false); + } + + @Override + public void addSuperCustom(Player player) + { + _cowSuperActive.add(player.getName()); + + //Disguise + DisguiseMooshroom disguise = new DisguiseMooshroom(player); + + if (Manager.GetGame().GetTeam(player) != null) + disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + else + disguise.setName(player.getName()); + + disguise.setCustomNameVisible(true); + Manager.GetDisguise().disguise(disguise); + + //Armor + player.setMaxHealth(30); + player.setHealth(30); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.COW_HURT, 5f, 0.25f); + + //Recharges + Recharge.Instance.recharge(player, "Angry Herd"); + Recharge.Instance.recharge(player, "Milk Spiral"); + } + + @EventHandler + public void damageBuff(CustomDamageEvent event) + { + Player player = event.GetDamagerPlayer(true); + if (player == null) + return; + + if (_cowSuperActive.contains(player.getName())) + { + event.AddMod(player.getName(), GetName(), 1, false); + } + } + + @Override + public boolean isSuperActive(Player player) + { + DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + + return disguise != null && disguise instanceof DisguiseMooshroom; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowStampede.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowStampede.java new file mode 100644 index 000000000..287ba285e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowStampede.java @@ -0,0 +1,197 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.WeakHashMap; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseMooshroom; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType; +import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.SmashPerk; + +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.potion.PotionEffectType; + +public class PerkCowStampede extends SmashPerk +{ + private WeakHashMap _sprintTime = new WeakHashMap(); + private WeakHashMap _sprintStr = new WeakHashMap(); + + public PerkCowStampede() + { + super("Stampede", new String[] + { + C.cGray + "Build up Speed Levels as you sprint.", + C.cGray + "+1 damage for each Speed Level.", + }); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + //Active - Check for Disable + if (_sprintTime.containsKey(cur)) + { + //Stopped + if (!cur.isSprinting() || cur.getLocation().getBlock().isLiquid()) + { + _sprintTime.remove(cur); + _sprintStr.remove(cur); + cur.removePotionEffect(PotionEffectType.SPEED); + continue; + } + + long time = _sprintTime.get(cur); + int str = _sprintStr.get(cur); + + //Apply Speed + if (str > 0) + Manager.GetCondition().Factory().Speed(GetName(), cur, cur, 1.9, !isSuperActive(cur) ? str-1 : str, false, true, true); + + //Upgrade Speed + if (!UtilTime.elapsed(time, 3000)) + continue; + + _sprintTime.put(cur, System.currentTimeMillis()); + + if (str < 3) + { + _sprintStr.put(cur, str+1); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.COW_HURT, 2f, 0.75f + 0.25f * str); + } + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute)); + } + else if (cur.isSprinting() || !cur.getLocation().getBlock().isLiquid()) + { + //Start Timer + if (!_sprintTime.containsKey(cur)) + { + _sprintTime.put(cur, System.currentTimeMillis()); + _sprintStr.put(cur, 0); + } + } + } + } + + @EventHandler + public void particle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player ent : _sprintStr.keySet()) + { + if (_sprintStr.get(ent) <= 0) + continue; + + UtilParticle.PlayParticle(isSuperActive(ent) ? ParticleType.RED_DUST : ParticleType.CRIT, ent.getLocation(), + (float)(Math.random() - 0.5), 0.2f + (float)Math.random(), (float)(Math.random() - 0.5), 0, _sprintStr.get(ent) * 2, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void damage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!_sprintStr.containsKey(damager)) + return; + + if (_sprintStr.get(damager) == 0) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + //Remove + _sprintTime.remove(damager); + int str = _sprintStr.remove(damager); + damager.removePotionEffect(PotionEffectType.SPEED); + + //Damage + event.AddMod(damager.getName(), GetName(), str, true); + event.AddKnockback(GetName(), 1 + (0.1 * str)); + + //Inform + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + + //Effect + damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f); + damager.getWorld().playSound(damager.getLocation(), Sound.COW_HURT, 2f, 2f); + + //Event + UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); + } + + @EventHandler(priority = EventPriority.HIGH) + public void damageCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + clean(damagee); + Manager.GetCondition().EndCondition(damagee, null, GetName()); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + clean(event.getPlayer()); + } + + public void clean(Player player) + { + _sprintTime.remove(player); + _sprintStr.remove(player); + } + + @Override + public boolean isSuperActive(Player player) + { + DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + + return disguise != null && disguise instanceof DisguiseMooshroom; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java new file mode 100644 index 000000000..c55aa293f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkEndermanTeleport.java @@ -0,0 +1,119 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkEndermanTeleport extends SmashPerk +{ + private HashMap _target = new HashMap(); + private HashMap _charge = new HashMap(); + + public PerkEndermanTeleport() + { + super("Teleport", new String[] + { + C.cYellow + "Hold Sneak" + C.cGray + " to " + C.cGreen + "Teleport" + }); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (!Kit.HasKit(player)) + continue; + + if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName())) + { + _target.remove(player); + _charge.remove(player); + continue; + } + + Block block = player.getTargetBlock((HashSet) null, 200); + + if (!_target.containsKey(player) || !_charge.containsKey(player)) + { + if (block == null || block.getType() == Material.AIR) + continue; + + _target.put(player, block); + _charge.put(player, 0f); + } + + //Invalid Block - End + if (block == null || block.getType() == Material.AIR) + { + _target.remove(player); + _charge.remove(player); + } + //Same Block - Increase Charge + else if (block.equals(_target.get(player))) + { + _charge.put(player, _charge.get(player) + 0.015f); + + UtilTextMiddle.display(null, UtilTextMiddle.progress(_charge.get(player)), 0, 10, 10, player); + + if (_charge.get(player) >= 1f) + { + UtilTextMiddle.display(null, C.cGreen + "Teleported", 0, 10, 10, player); + Recharge.Instance.useForce(player, GetName(), 5000); + + while (block.getRelative(BlockFace.UP).getType() != Material.AIR) + { + block = block.getRelative(BlockFace.UP); + } + + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); + player.teleport(block.getLocation().add(0.5, 1, 0.5)); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f); + + UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG, UtilServer.getPlayers()); + } + else + { + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f + _charge.get(player)); + UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.05f, 10, ViewDist.LONG, UtilServer.getPlayers()); + } + } + //New Block - Reset + else + { + _target.put(player, block); + _charge.put(player, 0f); + } + } + } + + @EventHandler + public void clean(PlayerQuitEvent event) + { + _target.remove(event.getPlayer()); + _charge.remove(event.getPlayer()); + } +} + + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java new file mode 100644 index 000000000..6094d8e70 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java @@ -0,0 +1,206 @@ +package nautilus.game.arcade.game.games.smash.perks; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.SmashPerk; + +public class PerkFishFlurry extends SmashPerk implements IThrown +{ + private ArrayList _active = new ArrayList(); + + public PerkFishFlurry() + { + super("Fish Flurry", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry" + }); + } + + + @EventHandler + public void shoot(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) + return; + + Player player = event.getPlayer(); + + if (isSuperActive(player)) + return; + + if (!Kit.HasKit(player)) + return; + + Block block = player.getTargetBlock((HashSet) null, 64); + + if (block == null || block.getType() == Material.AIR) + { + UtilPlayer.message(player, F.main("Game", "You must target a block.")); + return; + } + + if (!Recharge.Instance.use(player, GetName(), 24000, true, true)) + return; + + event.setCancelled(true); + + HashSet blocks = new HashSet(); + + for (Block cur : UtilBlock.getInRadius(block, 3.5d).keySet()) + { + if (UtilBlock.airFoliage(cur)) + continue; + + if (!UtilBlock.airFoliage(cur.getRelative(BlockFace.UP))) + continue; + + blocks.add(cur); + } + + _active.add(new DataSquidGeyser(player, blocks)); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator activeIter = _active.iterator(); + + while (activeIter.hasNext()) + { + DataSquidGeyser data = activeIter.next(); + + //particles + for (Block block : data.Blocks) + UtilParticle.PlayParticle(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); + + //sound + Block block = UtilAlg.Random(data.Blocks); + if (Math.random() > 0.5) + block.getWorld().playSound(block.getLocation(), Math.random() > 0.5 ? Sound.SPLASH : Sound.SPLASH2, 0.5f, 1f); + + //Fish + if (!UtilTime.elapsed(data.StartTime, 2000)) + { + + } + else if (!UtilTime.elapsed(data.StartTime, 6000)) + { + for (int i=0 ; i<1 ; i++) + { + Item fish = block.getWorld().dropItem(block.getLocation().add(0.5, 1.5, 0.5), + ItemStackFactory.Instance.CreateStack(Material.RAW_FISH, (byte)UtilMath.r(4), 1, "Fish" + System.currentTimeMillis())); + + Vector random = new Vector( + Math.random() - 0.5, + 1 + Math.random() * 1, + Math.random() - 0.5); + + + UtilAction.velocity(fish, random, 0.25 + 0.4 * Math.random(), false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(fish, data.Player, this, + -1, true, false, true, true, + null, 1f, 1f, + null, UpdateType.TICK, 1f); + } + } + else + { + activeIter.remove(); + } + } + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target != null) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.PROJECTILE, 3, true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); + } + + data.GetThrown().remove(); + } + + @Override + public void Idle(ProjectileUser data) + { + data.GetThrown().remove(); + } + + @Override + public void Expire(ProjectileUser data) + { + data.GetThrown().remove(); + } + + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 1.5); + + event.setKnockbackOrigin(event.GetDamageeEntity().getLocation().add(Math.random()-0.5, -0.1, Math.random()-0.5)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java index 25e4cb3f9..9a289d7b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java @@ -12,7 +12,7 @@ import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -27,8 +27,8 @@ import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index a2e27f88e..bf1e6ce2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -36,7 +36,7 @@ import nautilus.game.arcade.game.games.snowfight.kits.KitMedic; import nautilus.game.arcade.game.games.snowfight.kits.KitSportsman; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.SmashKit; -import net.minecraft.server.v1_7_R4.EntityFireball; +import net.minecraft.server.v1_8_R3.EntityFireball; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -48,7 +48,7 @@ import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFireball; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFireball; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -153,7 +153,7 @@ public class SnowFight extends TeamGame { if(IsOnIce(player)) { - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false)); + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false)); } } @@ -510,7 +510,7 @@ public class SnowFight extends TeamGame if(player instanceof Player) { Player damagee = (Player) player; - Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false)); + Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index 17eaf5a5f..73d245050 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -9,7 +9,7 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; @@ -34,7 +34,7 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.SpleefBlockDestroyStatTracker; -import net.minecraft.server.v1_7_R4.EntityArrow; +import net.minecraft.server.v1_8_R3.EntityArrow; public class Spleef extends SoloGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java index 22eaabf18..33477cd48 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java @@ -6,7 +6,7 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; @@ -31,7 +31,7 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.spleef.kits.*; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_7_R4.EntityArrow; +import net.minecraft.server.v1_8_R3.EntityArrow; public class SpleefTeams extends TeamGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/ChunkChange.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/ChunkChange.java index 2d9e5c6c5..f4d9ea553 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/ChunkChange.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/ChunkChange.java @@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.survivalgames; import java.util.ArrayList; -import net.minecraft.server.v1_7_R4.PlayerChunkMap; +import net.minecraft.server.v1_8_R3.PlayerChunkMap; import org.bukkit.Chunk; import org.bukkit.Location; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index a7699db24..5722d92a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.survivalgames; import java.lang.reflect.Field; import java.util.*; -import java.util.Map.Entry; import org.bukkit.*; import org.bukkit.FireworkEffect.Type; @@ -12,8 +11,8 @@ import org.bukkit.block.BlockState; import org.bukkit.block.Chest; import org.bukkit.block.DoubleChest; import org.bukkit.block.Furnace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLargeFireball; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.entity.Boat; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; @@ -38,7 +37,6 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -58,7 +56,6 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -76,7 +73,6 @@ import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.loot.*; -import mineplex.core.packethandler.PacketPlayOutWorldBorder; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -95,12 +91,12 @@ import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker; import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker; import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; -import net.minecraft.server.v1_7_R4.EntityLargeFireball; -import net.minecraft.server.v1_7_R4.PacketPlayOutScoreboardTeam; -import net.minecraft.server.v1_7_R4.ScoreboardTeam; -import net.minecraft.server.v1_7_R4.TileEntity; -import net.minecraft.server.v1_7_R4.TileEntityChest; -import net.minecraft.server.v1_7_R4.WorldServer; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; +import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam; +import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder; +import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder.EnumWorldBorderAction; +import net.minecraft.server.v1_8_R3.ScoreboardTeam; +import net.minecraft.server.v1_8_R3.WorldServer; public abstract class SurvivalGames extends Game { @@ -142,24 +138,17 @@ public abstract class SurvivalGames extends Game private boolean _informedDeathmatchCommand; private int _gameEndTime = 3 * 60; - private Field _nameTagVisibility; private Field _packetTeam; private int _chestRefillTime = 60 * 7; - private NautHashMap _openedChests = new NautHashMap(); - /** - * @The field is originally set to 1, if the next tick finds it at 1, then its set to 10. If the next tick finds it at 10 then - * it removes. - * @Else the ticks set it to 50 - */ - private Field _ticksField; - public SurvivalGames(ArcadeManager manager, GameType type, String[] description) + public SurvivalGames(ArcadeManager manager, GameType type, + String[] description) { super(manager, type, - new Kit[] - { + new Kit[] + { new KitAxeman(manager), // new KitLooter(manager), @@ -181,25 +170,25 @@ public abstract class SurvivalGames extends Game new KitBarbarian(manager), new KitHorseman(manager), - }, description); + }, description); _help = new String[] - { + { C.cGreen + "Use a Compass to find and kill enemies!", C.cGreen + "You lose Speed 2 at start of game if you attack.", C.cAqua + "Avoid enemies who have better gear than you!" - }; + }; // Manager.GetAntiStack().SetEnabled(false); StrictAntiHack = true; - + AnnounceStay = false; - + HideTeamSheep = true; - + this.ReplaceTeamsWithKits = true; GameTimeout = 1500000; @@ -208,7 +197,7 @@ public abstract class SurvivalGames extends Game WorldTimeSet = 0; WorldBoundaryKill = false; - + DamageSelf = true; DamageTeamSelf = true; @@ -223,14 +212,12 @@ public abstract class SurvivalGames extends Game PlaySoundGameStart = false; PrepareTime = 15000; - - VersionRequire1_8 = true; + DeadBodies = true; BlockBreakAllow.add(Material.WEB.getId()); // Web BlockPlaceAllow.add(Material.WEB.getId()); - BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves @@ -251,29 +238,28 @@ public abstract class SurvivalGames extends Game BlockBreakAllow.add(Material.VINE.getId()); BlockBreakAllow.add(Material.WATER_LILY.getId()); - // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened"); + // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", + // "chestsOpened"); setupLoot(); try { - _packetTeam = Class.forName("org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftTeam").getDeclaredField("team"); + _packetTeam = Class.forName( + "org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam") + .getDeclaredField("team"); _packetTeam.setAccessible(true); - - _nameTagVisibility = PacketPlayOutScoreboardTeam.class.getDeclaredField("_nameTagVisibility"); - _nameTagVisibility.setAccessible(true); - - _ticksField = TileEntityChest.class.getDeclaredField("ticks"); - _ticksField.setAccessible(true); } catch (Exception ex) { ex.printStackTrace(); } - registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), new KillsWithinTimeLimitStatTracker(this, 3, 60, - "Bloodlust"), new FirstSupplyDropOpenStatTracker(this), new SimultaneousSkeletonStatTracker(this, 5)); + registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), + new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"), + new FirstSupplyDropOpenStatTracker(this), + new SimultaneousSkeletonStatTracker(this, 5)); } @EventHandler @@ -283,25 +269,10 @@ public abstract class SurvivalGames extends Game if (_placedBlocks.remove(block.getLocation())) { - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, + block.getType()); block.setType(Material.AIR); } - - if (block.getType().name().contains("CHEST")) - { - for (TileEntityChest tileEntityChest : _openedChests.keySet()) - { - if (tileEntityChest.x == block.getX() && tileEntityChest.y == block.getY() && tileEntityChest.z == block.getZ()) - { - WorldServer world = ((CraftWorld) block.getWorld()).getHandle(); - - world.playBlockAction(block.getX(), block.getY(), block.getZ(), - net.minecraft.server.v1_7_R4.Block.getById(block.getTypeId()), 1, 10); - - break; - } - } - } } @EventHandler @@ -361,44 +332,6 @@ public abstract class SurvivalGames extends Game } } - // @EventHandler TODO Wait for bulk chunk packet - public void chestCloseEvent(InventoryCloseEvent event) - { - InventoryHolder holder = event.getInventory().getHolder(); - - if (holder instanceof DoubleChest) - { - holder = (Chest) ((DoubleChest) holder).getLeftSide(); - } - - if (holder instanceof Chest) - { - Block block = ((Chest) holder).getBlock(); - - TileEntity tileEntity = ((CraftWorld) block.getWorld()).getTileEntityAt(block.getX(), block.getY(), block.getZ()); - - if (tileEntity instanceof TileEntityChest) - { - TileEntityChest chest = (TileEntityChest) tileEntity; - - try - { - chest.o = 10; - - int key = (chest.x + chest.y + chest.z) % 200; - - _ticksField.setInt(chest, (200 - key) + 10); - - _openedChests.put(chest, 10); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - } - } - public void refillSecond() { if (_deathMatchTime <= 60) @@ -417,7 +350,8 @@ public abstract class SurvivalGames extends Game for (Player player : Bukkit.getOnlinePlayers()) { - player.playSound(player.getEyeLocation(), Sound.IRONGOLEM_DEATH, 1000, 0); + player.playSound(player.getEyeLocation(), + Sound.IRONGOLEM_DEATH, 1000, 0); } refillChests(); @@ -441,14 +375,17 @@ public abstract class SurvivalGames extends Game if (_chestRefillTime >= 60) { - time = (_chestRefillTime / 60) + " minute" + (_chestRefillTime > 60 ? "s" : ""); + time = (_chestRefillTime / 60) + " minute" + + (_chestRefillTime > 60 ? "s" : ""); } else { - time = _chestRefillTime + " second" + (_chestRefillTime != 1 ? "s" : ""); + time = _chestRefillTime + " second" + + (_chestRefillTime != 1 ? "s" : ""); } - Announce(C.cGold + C.Bold + "The chests will be refilled in " + time, false); + Announce(C.cGold + C.Bold + "The chests will be refilled in " + + time, false); break; default: @@ -456,51 +393,6 @@ public abstract class SurvivalGames extends Game } } - // @EventHandler - public void chestTickEvent(UpdateEvent event) - { - if (event.getType() != UpdateType.SLOW) - return; - - Iterator> itel = _openedChests.entrySet().iterator(); - - while (itel.hasNext()) - { - Entry entry = itel.next(); - // TODO Test this is removed properly when unloaded chunks - // TODO Load chests status when chunk loads packets - try - { - int key = (entry.getKey().x + entry.getKey().y + entry.getKey().z) % 200; - - int ticks = (_ticksField.getInt(entry.getKey()) + key) % 200; - - if (ticks == entry.getValue()) - { - if (ticks == 1) - { - System.out.print("Removed"); - itel.remove(); - } - else - { - _ticksField.setInt(entry.getKey(), (200 - key) + ticks - 1); - _openedChests.put(entry.getKey(), ticks - 1); - } - } - else - { - _ticksField.setInt(entry.getKey(), (200 - key) + 10); - _openedChests.put(entry.getKey(), 10); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - } - @EventHandler public void CreateRandomChests(GameStateChangeEvent event) { @@ -519,13 +411,16 @@ public abstract class SurvivalGames extends Game while (done < 40) { - Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), - WorldData.MinZ + UtilMath.r(zDiff), ignore); + Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), + ignore); - if (!UtilBlock.airFoliage(block) || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) + if (!UtilBlock.airFoliage(block) + || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) continue; - block.setTypeIdAndData(Material.CHEST.getId(), (byte) UtilMath.r(4), true); + block.setTypeIdAndData(Material.CHEST.getId(), + (byte) UtilMath.r(4), true); done++; } } @@ -567,7 +462,8 @@ public abstract class SurvivalGames extends Game { for (int z = -1; z <= 1; z++) { - Block b = event.getVehicle().getLocation().add(x, y, z).getBlock(); + Block b = event.getVehicle().getLocation().add(x, y, z) + .getBlock(); if (b.isLiquid()) { @@ -633,29 +529,34 @@ public abstract class SurvivalGames extends Game if (!IsAlive(event.getPlayer())) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "You are not in the game.")); + UtilPlayer.message(event.getPlayer(), + F.main("Game", "You are not in the game.")); return; } if (!IsLive() || _deathMatchTime <= 60) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now.")); + UtilPlayer.message(event.getPlayer(), + F.main("Game", "Deathmatch cannot be started now.")); return; } if (_secondsSinceStart < 5 * 60 || GetPlayers(true).size() > 4) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now.")); + UtilPlayer.message(event.getPlayer(), + F.main("Game", "Deathmatch cannot be started now.")); return; } - Announce(C.cGreen + C.Bold + event.getPlayer().getName() + " has initiated Deathmatch!"); + Announce(C.cGreen + C.Bold + event.getPlayer().getName() + + " has initiated Deathmatch!"); Announce(C.cGreen + C.Bold + "Deathmatch starting in 60 seconds..."); _deathMatchTime = 60; for (Player player : UtilServer.getPlayers()) - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, + 1f); } public void deathmatchSecond() @@ -668,8 +569,9 @@ public abstract class SurvivalGames extends Game { for (Player player : GetPlayers(true)) { - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 1, false, true, true, "Game End", - "Game End Damage"); + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.CUSTOM, 1, false, true, true, + "Game End", "Game End Damage"); } } @@ -680,16 +582,21 @@ public abstract class SurvivalGames extends Game if (_deathMatchTime > 0 && _deathMatchTime <= 60) { - if (_deathMatchTime % 30 == 0 || _deathMatchTime == 15 || _deathMatchTime == 10 - || (_deathMatchTeleported ? _deathMatchTime <= 10 : _deathMatchTime <= 5)) + if (_deathMatchTime % 30 == 0 + || _deathMatchTime == 15 + || _deathMatchTime == 10 + || (_deathMatchTeleported ? _deathMatchTime <= 10 + : _deathMatchTime <= 5)) { if (_deathMatchTeleported && _deathMatchTime <= 10) { - Announce(C.cRed + C.Bold + "Deathmatch in " + _deathMatchTime + "..."); + Announce(C.cRed + C.Bold + "Deathmatch in " + + _deathMatchTime + "..."); } else { - Announce(C.cGreen + C.Bold + "Deathmatch starting in " + _deathMatchTime + " seconds..."); + Announce(C.cGreen + C.Bold + "Deathmatch starting in " + + _deathMatchTime + " seconds..."); } } } @@ -707,7 +614,8 @@ public abstract class SurvivalGames extends Game { Announce(C.cRed + C.Bold + "Deathmatch has begun!", false); - _spawn.getWorld().playSound(_spawn, Sound.WITHER_DEATH, 1000, 0); + _spawn.getWorld() + .playSound(_spawn, Sound.WITHER_DEATH, 1000, 0); refillChests(); } @@ -730,10 +638,14 @@ public abstract class SurvivalGames extends Game for (double border : buildBorders((2 * 30) - 15, 30.5, 7.5)) { - _borderPositions.put(_secondsSinceStart + 60 + (i++ * 2), border); + _borderPositions.put(_secondsSinceStart + 60 + (i++ * 2), + border); } - setBorder(); + _borderStartedMoving = System.currentTimeMillis(); + + WorldBorder border = WorldData.World.getWorldBorder(); + border.setSize(_currentBorder * 2, 1); _deathMatchTime = 11; } @@ -751,7 +663,8 @@ public abstract class SurvivalGames extends Game if (_informedDeathmatchCommand) return; - Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold + "/dm" + C.cGreen + C.Bold + " to start Deathmatch!"); + Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold + + "/dm" + C.cGreen + C.Bold + " to start Deathmatch!"); _informedDeathmatchCommand = true; } @@ -766,7 +679,8 @@ public abstract class SurvivalGames extends Game @EventHandler public void SnowballEggsDamage(CustomDamageEvent event) { - if (event.GetProjectile() instanceof Snowball || event.GetProjectile() instanceof Egg) + if (event.GetProjectile() instanceof Snowball + || event.GetProjectile() instanceof Egg) { event.AddMod("Projectile", "Projectile", 0.01, false); } @@ -808,7 +722,8 @@ public abstract class SurvivalGames extends Game if (Math.random() > 0.95) items++; - boolean spawnChest = _chestRefillTime > 0 && UtilMath.offset(chest.getLocation(), _spawn) < 8; + boolean spawnChest = _chestRefillTime > 0 + && UtilMath.offset(chest.getLocation(), _spawn) < 8; if (spawnChest) items += 3; @@ -854,7 +769,8 @@ public abstract class SurvivalGames extends Game if (_supplyCrates.contains(block)) { - Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(looter, block)); + Bukkit.getPluginManager().callEvent( + new SupplyChestOpenEvent(looter, block)); } _supplyCrates.remove(block); @@ -873,11 +789,11 @@ public abstract class SurvivalGames extends Game { if (assist) return 3; - else - return 12; + else return 12; } - // If an item spawns and no one is there to see it, does it really spawn? No. + // If an item spawns and no one is there to see it, does it really spawn? + // No. @EventHandler public void ItemSpawn(ItemSpawnEvent event) { @@ -947,11 +863,14 @@ public abstract class SurvivalGames extends Game for (Location loc : GetTeamList().get(0).GetSpawns()) { - Firework firework = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK); + Firework firework = (Firework) loc.getWorld().spawnEntity( + loc, EntityType.FIREWORK); FireworkMeta meta = firework.getFireworkMeta(); - meta.addEffect(FireworkEffect.builder().withColor(Color.AQUA).with(Type.BALL).withTrail().build()); + meta.addEffect(FireworkEffect.builder() + .withColor(Color.AQUA).with(Type.BALL).withTrail() + .build()); firework.setFireworkMeta(meta); } @@ -959,24 +878,6 @@ public abstract class SurvivalGames extends Game }.runTaskTimer(getArcadeManager().getPlugin(), 0, 60); } - @EventHandler - public void onGameState(PlayerChangedWorldEvent event) - { - if (GetState() == GameState.Prepare || IsLive()) - { - setupBorder(event.getPlayer()); - } - } - - @EventHandler - public void onJoin(PlayerJoinEvent event) - { - if (GetState() == GameState.Prepare || IsLive()) - { - setupBorder(event.getPlayer()); - } - } - @EventHandler public void onSecond(UpdateEvent event) { @@ -985,7 +886,6 @@ public abstract class SurvivalGames extends Game return; } - if (!IsLive()) { return; @@ -998,7 +898,10 @@ public abstract class SurvivalGames extends Game { _currentBorder = _borderPositions.get(_secondsSinceStart); - setBorder(); + _borderStartedMoving = System.currentTimeMillis(); + + WorldBorder border = WorldData.World.getWorldBorder(); + border.setSize(_currentBorder * 2, 1); } _secondsSinceStart++; @@ -1026,7 +929,8 @@ public abstract class SurvivalGames extends Game if (item == null || item.getType() != Material.COMPASS) return; - int uses = Integer.parseInt(ChatColor.stripColor(item.getItemMeta().getLore().get(0)).replaceAll("\\D+", "")); + int uses = Integer.parseInt(ChatColor.stripColor( + item.getItemMeta().getLore().get(0)).replaceAll("\\D+", "")); if (uses > 0) { @@ -1039,9 +943,11 @@ public abstract class SurvivalGames extends Game { if (alive != player) { - double distance = alive.getLocation().distance(player.getLocation()); + double distance = alive.getLocation().distance( + player.getLocation()); - if (distance > 10 && (closestPlayer == null || distance < closestDistance)) + if (distance > 10 + && (closestPlayer == null || distance < closestDistance)) { closestDistance = distance; closestPlayer = alive; @@ -1056,29 +962,36 @@ public abstract class SurvivalGames extends Game player.setCompassTarget(closestPlayer.getLocation()); player.setItemInHand(buildCompass(uses)); - player.sendMessage(F.main("Compass", "Located " + closestPlayer.getName() + " " + (int) closestDistance - + " blocks away")); + player.sendMessage(F.main("Compass", + "Located " + closestPlayer.getName() + " " + + (int) closestDistance + " blocks away")); if (uses >= 1) { - player.sendMessage(F.main("Compass", uses + " use" + (uses > 1 ? "s" : "") + " of the compass remaining.")); + player.sendMessage(F.main("Compass", uses + " use" + + (uses > 1 ? "s" : "") + + " of the compass remaining.")); } else { - player.sendMessage(F.main("Compass", "No remaining uses! Next use will break it!")); + player.sendMessage(F.main("Compass", + "No remaining uses! Next use will break it!")); } } else { - player.sendMessage(F.main("Compass", "Can't find anyone! Pointing to spawn!")); + player.sendMessage(F.main("Compass", + "Can't find anyone! Pointing to spawn!")); player.setCompassTarget(_spawn); } } else { - player.sendMessage(F.main("Compass", "The compass breaks! No remaining uses!")); + player.sendMessage(F.main("Compass", + "The compass breaks! No remaining uses!")); - player.getWorld().playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 5); + player.getWorld().playSound(player.getLocation(), Sound.ITEM_BREAK, + 1, 5); player.setItemInHand(new ItemStack(Material.AIR)); } @@ -1107,8 +1020,10 @@ public abstract class SurvivalGames extends Game { DoubleChest doubleChest = (DoubleChest) state; - fillChest(event.getPlayer(), ((Chest) doubleChest.getLeftSide()).getBlock()); - fillChest(event.getPlayer(), ((Chest) doubleChest.getRightSide()).getBlock()); + fillChest(event.getPlayer(), + ((Chest) doubleChest.getLeftSide()).getBlock()); + fillChest(event.getPlayer(), + ((Chest) doubleChest.getRightSide()).getBlock()); } else if (state instanceof Chest) { @@ -1128,7 +1043,8 @@ public abstract class SurvivalGames extends Game if (random == 0) { - inv.setFuel(new ItemStack(Material.STICK, new Random().nextInt(2) + 1)); + inv.setFuel(new ItemStack(Material.STICK, new Random() + .nextInt(2) + 1)); } else if (random <= 3) { @@ -1169,62 +1085,69 @@ public abstract class SurvivalGames extends Game double border = (_previousBorder - 0.3D) + distanceMovedSince; - //24 @ 100+ reduced to 0 at 32- - double borderAttackDist = Math.max(8, (Math.min(100, border) - 28d) / 3d); + // 24 @ 100+ reduced to 0 at 32- + double borderAttackDist = Math.max(8, + (Math.min(100, border) - 28d) / 3d); double borderCheckDist = borderAttackDist + 6; - + for (Player player : UtilServer.getPlayers()) { Location loc = player.getLocation(); - //Bump Players Back In - if (loc.getX() > _spawn.getX() + border || - loc.getX() < _spawn.getX() - border || - loc.getZ() > _spawn.getZ() + border || - loc.getZ() < _spawn.getZ() - border) + // Bump Players Back In + if (loc.getX() > _spawn.getX() + border + || loc.getX() < _spawn.getX() - border + || loc.getZ() > _spawn.getZ() + border + || loc.getZ() < _spawn.getZ() - border) { - if (Recharge.Instance.use(player, "Hit by Border", 1000, false, false)) + if (Recharge.Instance.use(player, "Hit by Border", 1000, false, + false)) { Entity bottom = player; while (bottom.getVehicle() != null) bottom = bottom.getVehicle(); - - UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true); + + UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, + GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, + true); if (Manager.IsAlive(player)) { - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 10, false, false, false, "Nether Field", - "Vaporize"); + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.CUSTOM, 10, false, false, false, + "Nether Field", "Vaporize"); - player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); - player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); + player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, + 1f); + player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, + 1f); } } } if (border < 32) continue; - - //Attack Players who are nearby + + // Attack Players who are nearby boolean isX = true; Location attackSource = null; - if (loc.getX() > _spawn.getX() + (border-borderCheckDist)) + if (loc.getX() > _spawn.getX() + (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setX(_spawn.getX() + border); } - else if (loc.getX() < _spawn.getX() - (border-borderCheckDist)) + else if (loc.getX() < _spawn.getX() - (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setX(_spawn.getX() - border); } - else if (loc.getZ() > _spawn.getZ() + (border-borderCheckDist)) + else if (loc.getZ() > _spawn.getZ() + (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setZ(_spawn.getZ() + border); isX = false; } - else if (loc.getZ() < _spawn.getZ() - (border-borderCheckDist)) + else if (loc.getZ() < _spawn.getZ() - (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setZ(_spawn.getZ() - border); @@ -1233,51 +1156,68 @@ public abstract class SurvivalGames extends Game if (attackSource != null) { - double dist = UtilMath.offset(player.getLocation(), attackSource); - + double dist = UtilMath.offset(player.getLocation(), + attackSource); + double scale = 1 - (dist / borderAttackDist); - - player.playSound(player.getLocation().add(UtilAlg.getTrajectory(player.getLocation(), attackSource).multiply(8)), - Sound.PORTAL, (float)(1 - (dist / borderCheckDist)) * 2, 2f); + + player.playSound( + player.getLocation().add( + UtilAlg.getTrajectory(player.getLocation(), + attackSource).multiply(8)), + Sound.PORTAL, + (float) (1 - (dist / borderCheckDist)) * 2, 2f); if (!Manager.IsAlive(player)) continue; - - //Shoot more frequently when they get closer + + // Shoot more frequently when they get closer if (dist < borderAttackDist && Math.random() < scale) - { - //Spawn Fireball + { + // Spawn Fireball Location spawn = attackSource.clone(); - spawn.add(isX ? 0 : (Math.random()-0.5)*12, 4 + Math.random() * 2 + (Math.random() * 12 * scale), isX ? (Math.random()-0.5)*12 : 0); - - //Raytrace back - double maxBack = 8; + spawn.add(isX ? 0 : (Math.random() - 0.5) * 12, + 4 + Math.random() * 2 + + (Math.random() * 12 * scale), + isX ? (Math.random() - 0.5) * 12 : 0); + + // Raytrace back + double maxBack = 8; double back = 0; - while (spawn.getBlock().getType() == Material.AIR && back < maxBack) + while (spawn.getBlock().getType() == Material.AIR + && back < maxBack) { - spawn.subtract(UtilAlg.getTrajectory(spawn, player.getLocation()).multiply(0.2)); + spawn.subtract(UtilAlg.getTrajectory(spawn, + player.getLocation()).multiply(0.2)); back += 0.1; } - - //Move out of block - spawn.add(UtilAlg.getTrajectory(spawn, player.getLocation()).multiply(Math.min(back, 1))); - - - Fireball ball = player.getWorld().spawn(spawn, Fireball.class); - //Trajectory - Vector traj = UtilAlg.getTrajectory(spawn, player.getLocation()); - traj.add(new Vector((Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2)); + // Move out of block + spawn.add(UtilAlg + .getTrajectory(spawn, player.getLocation()) + .multiply(Math.min(back, 1))); - EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle(); + Fireball ball = player.getWorld().spawn(spawn, + Fireball.class); + + // Trajectory + Vector traj = UtilAlg.getTrajectory(spawn, + player.getLocation()); + traj.add(new Vector((Math.random() - 0.5) * 0.2, (Math + .random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2)); + + EntityLargeFireball eFireball = ((CraftLargeFireball) ball) + .getHandle(); eFireball.dirX = traj.getX() * 0.1; eFireball.dirY = traj.getY() * 0.1; eFireball.dirZ = traj.getZ() * 0.1; - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, spawn, 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - player.getWorld().playSound(attackSource, Sound.GHAST_FIREBALL, 2f, 2f); - } + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, + spawn, 0, 0, 0, 0, 1, ViewDist.MAX, + UtilServer.getPlayers()); + player.getWorld().playSound(attackSource, + Sound.GHAST_FIREBALL, 2f, 2f); + } } } } @@ -1287,26 +1227,32 @@ public abstract class SurvivalGames extends Game { if (!IsLive()) return; - + if (!(event.getEntity() instanceof Fireball)) - return; + return; - Collection blocks = UtilBlock.getInRadius(event.getEntity().getLocation(), 2.4).keySet(); + Collection blocks = UtilBlock.getInRadius( + event.getEntity().getLocation(), 2.4).keySet(); - Manager.GetExplosion().BlockExplosion(blocks, event.getEntity().getLocation(), false); + Manager.GetExplosion().BlockExplosion(blocks, + event.getEntity().getLocation(), false); } public boolean isStableBlock(Block block) { int sides = 0; - if (UtilBlock.solid(block.getRelative(BlockFace.NORTH))) sides++; - if (UtilBlock.solid(block.getRelative(BlockFace.EAST))) sides++; - if (UtilBlock.solid(block.getRelative(BlockFace.SOUTH))) sides++; - if (UtilBlock.solid(block.getRelative(BlockFace.WEST))) sides++; - + if (UtilBlock.solid(block.getRelative(BlockFace.NORTH))) + sides++; + if (UtilBlock.solid(block.getRelative(BlockFace.EAST))) + sides++; + if (UtilBlock.solid(block.getRelative(BlockFace.SOUTH))) + sides++; + if (UtilBlock.solid(block.getRelative(BlockFace.WEST))) + sides++; + return sides >= 3; } - + @EventHandler public void borderDamage(CustomDamageEvent event) { @@ -1321,7 +1267,8 @@ public abstract class SurvivalGames extends Game event.AddKnockback("Fireball", 2); } - private ArrayList buildBorders(int seconds, double border, double leaveRemaining) + private ArrayList buildBorders(int seconds, double border, + double leaveRemaining) { double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50); @@ -1330,7 +1277,8 @@ public abstract class SurvivalGames extends Game for (int i = 0; i <= seconds; i++) { - borders.add(border - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber))); + borders.add(border + - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber))); } return borders; @@ -1369,6 +1317,13 @@ public abstract class SurvivalGames extends Game _supplyLocations = WorldData.GetDataLocs("WHITE"); for (Location loc : _supplyLocations) loc.getBlock().setType(Material.GLASS); + + WorldBorder border = WorldData.World.getWorldBorder(); + border.setCenter(_spawn); + border.setSize(_currentBorder * 2); + border.setDamageBuffer(-99); + border.setWarningDistance(-99); + border.setWarningTime(-99); } @EventHandler @@ -1379,50 +1334,54 @@ public abstract class SurvivalGames extends Game Player player = (Player) event.GetEvent().getEntity(); - FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BALL_LARGE).trail(false) + FireworkEffect effect = FireworkEffect.builder().flicker(false) + .withColor(Color.RED).with(Type.BALL_LARGE).trail(false) .build(); for (int i = 0; i < 3; i++) UtilFirework.launchFirework(player.getLocation(), effect, null, 3); } - + @EventHandler public void killLevelReward(CombatDeathEvent event) { Game game = Manager.GetGame(); - if (game == null) return; + if (game == null) + return; if (!(event.GetEvent().getEntity() instanceof Player)) return; - Player killed = (Player)event.GetEvent().getEntity(); + Player killed = (Player) event.GetEvent().getEntity(); if (event.GetLog().GetKiller() != null) { - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller() + .GetName()); if (killer != null && !killer.equals(killed)) { - //Kill + // Kill killer.giveExpLevels(2); - + killer.playSound(killer.getLocation(), Sound.LEVEL_UP, 1f, 1f); } } for (CombatComponent log : event.GetLog().GetAttackers()) { - if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller())) + if (event.GetLog().GetKiller() != null + && log.equals(event.GetLog().GetKiller())) continue; Player assist = UtilPlayer.searchExact(log.GetName()); - //Assist + // Assist if (assist != null) { assist.giveExpLevels(1); assist.playSound(assist.getLocation(), Sound.ORB_PICKUP, 1f, 1f); } - + } } @@ -1435,7 +1394,8 @@ public abstract class SurvivalGames extends Game { Material type = result.getType(); - if (type == Material.BUCKET || type == Material.GOLDEN_APPLE || type == Material.FLINT_AND_STEEL || type.isBlock()) + if (type == Material.BUCKET || type == Material.GOLDEN_APPLE + || type == Material.FLINT_AND_STEEL || type.isBlock()) { event.getInventory().setResult(new ItemStack(Material.AIR)); } @@ -1448,7 +1408,8 @@ public abstract class SurvivalGames extends Game _lootedBlocks.clear(); - WorldServer world = list.isEmpty() ? null : ((CraftWorld) list.get(0).getWorld()).getHandle(); + WorldServer world = list.isEmpty() ? null : ((CraftWorld) list.get(0) + .getWorld()).getHandle(); for (Location loc : list) { @@ -1469,25 +1430,8 @@ public abstract class SurvivalGames extends Game if (_landedCrates.contains(loc)) continue; - fillChest((Player) holder.getInventory().getViewers().get(0), block); - } - } - } - - if (!open) - { - world.playBlockAction(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), - net.minecraft.server.v1_7_R4.Block.getById(loc.getBlock().getTypeId()), 1, 0); - - Iterator itel = _openedChests.keySet().iterator(); - - while (itel.hasNext()) - { - TileEntityChest tile = itel.next(); - - if (tile.x == loc.getBlockX() && tile.y == loc.getBlockY() && tile.z == loc.getBlockZ()) - { - itel.remove(); + fillChest((Player) holder.getInventory().getViewers() + .get(0), block); } } } @@ -1510,55 +1454,6 @@ public abstract class SurvivalGames extends Game _hiddenNames.remove(event.getPlayer()); } - private void setBorder() - { - _borderStartedMoving = System.currentTimeMillis(); - - PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(); - packet.worldBorderType = 1; - - packet.newRadius = _currentBorder; - packet.oldRadius = _previousBorder; - - packet.speed = _currentBorder != _previousBorder ? 1000 : 0; - - for (Player player : Bukkit.getOnlinePlayers()) - { - if (UtilPlayer.is1_8(player)) - { - UtilPlayer.sendPacket(player, packet); - } - } - } - - private void setupBorder(Player player) - { - PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(); - packet.worldBorderType = 3; - - packet.centerX = _spawn.getX(); - packet.centerZ = _spawn.getZ(); - - packet.newRadius = _currentBorder; - packet.oldRadius = _previousBorder; - - packet.warningBlocks = -10; - packet.warningTime = -10; - - if (_currentBorder != _previousBorder) - { - packet.speed = 1000 - Math.min(1000, (System.currentTimeMillis() - _borderStartedMoving)); - } - - // We don't set warnings speed or blocks as its not particularly useful for this game. - // Also if we don't use it here, its more effective in other places to reinforce the idea what its for. - - if (UtilPlayer.is1_8(player)) - { - UtilPlayer.sendPacket(player, packet); - } - } - private void setupChestsEnchantingCrafting() { ArrayList chests = WorldData.GetCustomLocs("54"); @@ -1657,7 +1552,8 @@ public abstract class SurvivalGames extends Game _baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20)); - _baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15)); + _baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack( + Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15)); _spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15)); _spawnLoot.cloneLoot(_baseLoot); @@ -1707,7 +1603,8 @@ public abstract class SurvivalGames extends Game // Cooked furnace _cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2)); - _cookedFurnace.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); + _cookedFurnace + .addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1)); @@ -1753,8 +1650,14 @@ public abstract class SurvivalGames extends Game { player.playSound(player.getLocation(), Sound.DONKEY_DEATH, 0.8F, 0); - Manager.GetCondition().Factory().Speed("Start Speed", player, player, 30, 1, false, false, false); - Manager.GetCondition().Factory().HealthBoost("Start Health", player, player, 30, 1, false, false, false); + Manager.GetCondition() + .Factory() + .Speed("Start Speed", player, player, 30, 1, false, false, + false); + Manager.GetCondition() + .Factory() + .HealthBoost("Start Health", player, player, 30, 1, false, + false, false); player.setHealth(player.getMaxHealth()); @@ -1786,21 +1689,27 @@ public abstract class SurvivalGames extends Game if (_supplyLocations.isEmpty()) return; - _supplyCurrent = _supplyLocations.remove(UtilMath.r(_supplyLocations.size())); + _supplyCurrent = _supplyLocations.remove(UtilMath + .r(_supplyLocations.size())); // Remove Prior - _supplyCrates.remove(_supplyCurrent.getBlock().getRelative(BlockFace.UP)); - _supplyCurrent.getBlock().getRelative(BlockFace.UP).setType(Material.AIR); + _supplyCrates.remove(_supplyCurrent.getBlock().getRelative( + BlockFace.UP)); + _supplyCurrent.getBlock().getRelative(BlockFace.UP) + .setType(Material.AIR); // Create New _supplyCurrent.getBlock().setType(Material.BEACON); for (int x = -1; x <= 1; x++) for (int z = -1; z <= 1; z++) - _supplyCurrent.getBlock().getRelative(x, -1, z).setType(Material.IRON_BLOCK); + _supplyCurrent.getBlock().getRelative(x, -1, z) + .setType(Material.IRON_BLOCK); // Announce - Announce(C.cYellow + C.Bold + "Supply Drop Incoming (" + ChatColor.RESET - + UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow + C.Bold + ")"); + Announce(C.cYellow + C.Bold + "Supply Drop Incoming (" + + ChatColor.RESET + + UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow + + C.Bold + ")"); } } else @@ -1813,22 +1722,25 @@ public abstract class SurvivalGames extends Game _supplyEffect.setY(250); } - FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BURST) - .trail(false).build(); + FireworkEffect effect = FireworkEffect.builder().flicker(false) + .withColor(Color.YELLOW).with(Type.BURST).trail(false) + .build(); UtilFirework.playFirework(_supplyEffect, effect); _supplyEffect.setY(_supplyEffect.getY() - 2); if (UtilMath.offset(_supplyEffect, _supplyCurrent) < 2) { - effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL_LARGE).trail(true) - .build(); + effect = FireworkEffect.builder().flicker(false) + .withColor(Color.YELLOW).with(Type.BALL_LARGE) + .trail(true).build(); UtilFirework.playFirework(_supplyEffect, effect); // Create Chest _supplyCurrent.getBlock().setType(Material.GLASS); - Block block = _supplyCurrent.getBlock().getRelative(BlockFace.UP); + Block block = _supplyCurrent.getBlock().getRelative( + BlockFace.UP); block.setType(Material.CHEST); _landedCrates.add(block.getLocation()); _supplyCrates.add(block); @@ -1866,8 +1778,9 @@ public abstract class SurvivalGames extends Game continue; } - UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation().add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation() + .add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1, ViewDist.LONG, + UtilServer.getPlayers()); } } @@ -1889,13 +1802,27 @@ public abstract class SurvivalGames extends Game Player player = _tntMap.remove(event.getEntity()); - /*CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), event.getEntity().getLocation(), - ((TNTPrimed) event.getEntity()).getYield(), "Throwing TNT"); + if (_deathMatchTeleported && _deathMatchTime > 0) + { + event.setCancelled(true); + return; + } - explosion.setPlayer(player, true);*/ + /* + * CustomExplosion explosion = new + * CustomExplosion(getArcadeManager().GetDamage(), + * event.getEntity().getLocation(), ((TNTPrimed) + * event.getEntity()).getYield(), "Throwing TNT"); + * + * explosion.setPlayer(player, true); + */ - for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) - Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + for (Player other : UtilPlayer.getNearby(event.getEntity() + .getLocation(), 14)) + Manager.GetCondition() + .Factory() + .Explosion("Throwing TNT", other, player, 50, 0.1, false, + false); } @EventHandler @@ -1916,26 +1843,35 @@ public abstract class SurvivalGames extends Game if (!Recharge.Instance.use(player, "Throw TNT", 0, true, false)) { - UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " yet.")); + UtilPlayer.message( + event.getPlayer(), + F.main(GetName(), "You cannot use " + F.item("Throw TNT") + + " yet.")); return; } - if (!Manager.GetGame().CanThrowTNT(player.getLocation())) + if (!Manager.GetGame().CanThrowTNT(player.getLocation()) || (_deathMatchTeleported && _deathMatchTime > 0)) { // Inform - UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " here.")); + UtilPlayer.message( + event.getPlayer(), + F.main(GetName(), "You cannot use " + F.item("Throw TNT") + + " here.")); return; } UtilInv.remove(player, Material.TNT, (byte) 0, 1); UtilInv.Update(player); - TNTPrimed tnt = player.getWorld() - .spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); + TNTPrimed tnt = player.getWorld().spawn( + player.getEyeLocation() + .add(player.getLocation().getDirection()), + TNTPrimed.class); tnt.setFuseTicks(60); - UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false); + UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, + false, 0, 0.1, 10, false); _tntMap.put(tnt, player); } @@ -1950,11 +1886,13 @@ public abstract class SurvivalGames extends Game if (event.GetLog().GetKiller() != null) { - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller() + .GetName()); if (killer != null && !killer.equals(killed)) { - // Manager.GetStatsManager().addStat(killer, GetName(), "kills", 1); + // Manager.GetStatsManager().addStat(killer, GetName(), "kills", + // 1); } } @@ -1962,7 +1900,8 @@ public abstract class SurvivalGames extends Game { if (killed != null) { - // Manager.GetStatsManager().addStat(killed, GetName(), "deaths", 1); + // Manager.GetStatsManager().addStat(killed, GetName(), + // "deaths", 1); } } } @@ -1976,7 +1915,8 @@ public abstract class SurvivalGames extends Game if (!IsLive()) return; - ArrayList alivePlayers = new ArrayList(_hiddenNames.keySet()); + ArrayList alivePlayers = new ArrayList( + _hiddenNames.keySet()); HashMap> checkedPlayers = new HashMap>(); for (Player target : alivePlayers) @@ -1986,7 +1926,8 @@ public abstract class SurvivalGames extends Game try { - ScoreboardTeam nmsTeam = (ScoreboardTeam) _packetTeam.get(target.getScoreboard().getTeam(target.getName())); + ScoreboardTeam nmsTeam = (ScoreboardTeam) _packetTeam + .get(target.getScoreboard().getTeam(target.getName())); packet = new PacketPlayOutScoreboardTeam(nmsTeam, 2); } @@ -2001,9 +1942,11 @@ public abstract class SurvivalGames extends Game { boolean hideName = false; - if (!checkedPlayers.containsKey(target) || !checkedPlayers.get(target).containsKey(player)) + if (!checkedPlayers.containsKey(target) + || !checkedPlayers.get(target).containsKey(player)) { - if (player.getLocation().distance(target.getLocation()) > (GetKit(target) instanceof KitAssassin ? 8 : 24)) + if (player.getLocation().distance(target.getLocation()) > (GetKit(target) instanceof KitAssassin ? 8 + : 24)) { hideName = true; } @@ -2014,9 +1957,9 @@ public abstract class SurvivalGames extends Game } Player[] players = new Player[] - { + { target, player - }; + }; if (!(GetKit(player) instanceof KitAssassin || GetKit(target) instanceof KitAssassin)) { @@ -2027,7 +1970,8 @@ public abstract class SurvivalGames extends Game if (!checkedPlayers.containsKey(p1)) { - checkedPlayers.put(p1, new HashMap()); + checkedPlayers.put(p1, + new HashMap()); } checkedPlayers.get(p1).put(p2, hideName); @@ -2040,7 +1984,8 @@ public abstract class SurvivalGames extends Game } // If hiddenNames conta - if (hideName != _hiddenNames.get(player).contains(target.getName())) + if (hideName != _hiddenNames.get(player).contains( + target.getName())) { if (!hideName) { @@ -2051,14 +1996,7 @@ public abstract class SurvivalGames extends Game _hiddenNames.get(player).add(target.getName()); } - try - { - _nameTagVisibility.set(packet, hideName ? "never" : "always"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } + packet.e = hideName ? "never" : "always"; UtilPlayer.sendPacket(player, packet); } @@ -2066,30 +2004,30 @@ public abstract class SurvivalGames extends Game } } } - - public int getSecondsSinceStart() + + public int getSecondsSinceStart() { return this._secondsSinceStart; } - - public int getChestRefillTime() + + public int getChestRefillTime() { return this._chestRefillTime; } - - public int getDeathMatchTime() + + public int getDeathMatchTime() { return this._deathMatchTime; } - - public boolean isDeathMatchTeleported() + + public boolean isDeathMatchTeleported() { return this._deathMatchTeleported; } - - public int getGameEndTime() + + public int getGameEndTime() { return this._gameEndTime; } - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 3da737a34..a3012fb12 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -16,8 +16,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -34,8 +34,8 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerQuitEvent; -import net.minecraft.server.v1_7_R4.EntityArrow; -import net.minecraft.server.v1_7_R4.Item; +import net.minecraft.server.v1_8_R3.EntityArrow; +import net.minecraft.server.v1_8_R3.Item; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; @@ -64,6 +64,7 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker; import nautilus.game.arcade.stats.BlockShreadStatTracker; import nautilus.game.arcade.stats.TheComebackStatTracker; +import net.minecraft.server.v1_8_R3.EntityArrow; public class TurfForts extends TeamGame { @@ -756,7 +757,7 @@ public class TurfForts extends TeamGame for (Entity ent : _red.getWorld().getEntities()) { if (!(ent instanceof Item)) - return; + continue; if (ent.getTicksLived() > 40) ent.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 84e3459ae..e1523f86c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -19,7 +19,6 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.packethandler.PacketPlayOutWorldBorder; import mineplex.core.recharge.Recharge; import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; @@ -33,6 +32,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; @@ -42,6 +42,7 @@ import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.WorldBorder; import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -186,8 +187,6 @@ public class UHC extends TeamGame this.DontAllowOverfill = true; - this.VersionRequire1_8 = true; - this.GadgetsDisabled = true; WorldTimeSet = -1; @@ -230,6 +229,13 @@ public class UHC extends TeamGame { _borderPositions.put(i++ * 4, border); } + + WorldBorder border = WorldData.World.getWorldBorder(); + border.setCenter(0, 0); + border.setSize(_currentBorder * 2); + border.setDamageBuffer(-99); + border.setWarningDistance(-99); + border.setWarningTime(-99); } @EventHandler @@ -269,33 +275,15 @@ public class UHC extends TeamGame { _currentBorder = _borderPositions.get(_secondsSinceStart); - setBorder(); + _borderStartedMoving = System.currentTimeMillis(); + + WorldBorder border = WorldData.World.getWorldBorder(); + border.setSize(_currentBorder * 2, 1); } _secondsSinceStart++; } - private void setBorder() - { - _borderStartedMoving = System.currentTimeMillis(); - - PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(); - packet.worldBorderType = 1; - - packet.newRadius = _currentBorder; - packet.oldRadius = _previousBorder; - - packet.speed = _currentBorder != _previousBorder ? 1000 : 0; - - for (Player player : Bukkit.getOnlinePlayers()) - { - if (UtilPlayer.is1_8(player)) - { - UtilPlayer.sendPacket(player, packet); - } - } - } - @EventHandler public void outsideBorder(UpdateEvent event) { @@ -353,49 +341,6 @@ public class UHC extends TeamGame } } - @EventHandler - public void onGameState(PlayerChangedWorldEvent event) - { - if (GetState() == GameState.Prepare || IsLive()) - { - setupBorder(event.getPlayer()); - } - } - - @EventHandler - public void onJoin(PlayerJoinEvent event) - { - if (GetState() == GameState.Prepare || IsLive()) - { - setupBorder(event.getPlayer()); - } - } - - private void setupBorder(Player player) - { - PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(); - packet.worldBorderType = 3; - - packet.newRadius = _currentBorder; - packet.oldRadius = _previousBorder; - - packet.warningBlocks = -10; - packet.warningTime = -10; - - if (_currentBorder != _previousBorder) - { - packet.speed = 1000 - Math.min(1000, (System.currentTimeMillis() - _borderStartedMoving)); - } - - // We don't set warnings speed or blocks as its not particularly useful for this game. - // Also if we don't use it here, its more effective in other places to reinforce the idea what its for. - - if (UtilPlayer.is1_8(player)) - { - UtilPlayer.sendPacket(player, packet); - } - } - private ArrayList buildBorders(int seconds, double border, double leaveRemaining) { double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 47f61d98f..ef4cab48f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -57,7 +57,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -332,7 +332,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer { return; } - if(!GetKit(event.getPlayer()).GetName().contentEquals("Human Editor")) + if(GetKit(event.getPlayer()) != null && !GetKit(event.getPlayer()).GetName().contentEquals("Human Editor")) { event.setCancelled(true); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java index bfdbbb8ba..74456dc5c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.wither.kit; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java index 095fcbb97..2b91f2dc6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.wither.kit; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java index 5e2edb58b..7bab06d4f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.wither.kit; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java index 10a79928f..70bee78bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java @@ -346,7 +346,7 @@ public enum SpellType // ❤ "Explodes with damage at the end!", - "Effected players lose their footing!"), + "Affected players lose their footing!"), SpectralArrow(SpellElement.ATTACK, // Spell element WandElement.DEATH, // Wand element diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index 9dc6ac437..64afb0d14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -50,9 +50,9 @@ import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_7_R4.EntityFireball; -import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot; -import net.minecraft.server.v1_7_R4.PacketPlayOutWindowItems; +import net.minecraft.server.v1_8_R3.EntityFireball; +import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; +import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems; import org.apache.commons.lang.IllegalClassException; import org.bukkit.Bukkit; @@ -65,8 +65,8 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.block.Chest; import org.bukkit.block.DoubleChest; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFireball; -import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFireball; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Fireball; @@ -124,7 +124,6 @@ public class Wizards extends SoloGame private NautHashMap _spells = new NautHashMap(); private WizardSpellMenu _wizard; private NautHashMap _wizards = new NautHashMap(); - private Field _itemField; private IPacketHandler _wizardSpellLevelHandler; public Wizards(ArcadeManager manager) @@ -166,17 +165,6 @@ public class Wizards extends SoloGame DisableKillCommand = false; SoupEnabled = false; DamageTeamSelf = true; - VersionRequire1_8 = true; - - try - { - _itemField = PacketPlayOutSetSlot.class.getDeclaredField("c"); - _itemField.setAccessible(true); - } - catch (Exception ex) - { - ex.printStackTrace(); - } Manager.getCosmeticManager().setHideParticles(true); // Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName); @@ -257,8 +245,7 @@ public class Wizards extends SoloGame try { - item = CraftItemStack.asBukkitCopy((net.minecraft.server.v1_7_R4.ItemStack) _itemField - .get(packet)); + item = CraftItemStack.asBukkitCopy(packet.c); } catch (Exception ex) { @@ -659,7 +646,9 @@ public class Wizards extends SoloGame { if (event.GetState() == GameState.Live) { - getArcadeManager().getPacketHandler().addPacketHandler(_wizardSpellLevelHandler); + getArcadeManager().getPacketHandler().addPacketHandler( + _wizardSpellLevelHandler, PacketPlayOutSetSlot.class, + PacketPlayOutWindowItems.class); } else if (event.GetState() == GameState.Dead) { @@ -1445,7 +1434,7 @@ public class Wizards extends SoloGame CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), getArcadeManager().GetExplosion(), projectile.getLocation(), _endgameSize, "Meteor"); - explosion.setBlockExplosionSize(explosion.size * 1.4F); + explosion.setBlockExplosionSize(_endgameSize * 1.4F); explosion.setFallingBlockExplosionAmount(20); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java index 7bcb923ad..00ea56112 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellFireball.java @@ -3,14 +3,16 @@ package nautilus.game.arcade.game.games.wizards.spells; import mineplex.minecraft.game.core.explosion.CustomExplosion; import nautilus.game.arcade.game.games.wizards.Spell; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; -import net.minecraft.server.v1_7_R4.EntityFireball; +import net.minecraft.server.v1_8_R3.EntityFireball; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFireball; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFireball; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.util.Vector; @@ -19,11 +21,11 @@ public class SpellFireball extends Spell implements SpellClick { @EventHandler - public void onHit(ProjectileHitEvent event) + public void onHit(ExplosionPrimeEvent event) { - Projectile projectile = event.getEntity(); + Entity projectile = event.getEntity(); - if (projectile.hasMetadata("FireballSpell")) + if (projectile != null && projectile.hasMetadata("FireballSpell")) { projectile.remove(); @@ -35,6 +37,8 @@ public class SpellFireball extends Spell implements SpellClick explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true); explosion.setFallingBlockExplosion(true); + + explosion.setBlockExplosionSize(explosion.getSize() + 1); explosion.setDropItems(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java index 1aad6027d..e19a91106 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellGust.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.damage.DamageChange; import nautilus.game.arcade.game.games.wizards.Spell; @@ -61,7 +62,7 @@ public class SpellGust extends Spell implements SpellClick Wizards.Manager.GetDamage().GetCombatManager().Get(target).Attacked(player.getName(), 0, player, "Gust", new ArrayList()); - target.setVelocity(vec); + UtilAction.velocity(target, vec); target.getWorld().playSound(target.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellNapalm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellNapalm.java index 01fbc81ec..1e01953c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellNapalm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellNapalm.java @@ -179,8 +179,8 @@ public class SpellNapalm extends Spell implements SpellClick { if (block.getType() != Material.AIR) { - float strength = net.minecraft.server.v1_7_R4.Block.getById(block.getTypeId()).a( - (net.minecraft.server.v1_7_R4.Entity) null) * 0.7F; + float strength = net.minecraft.server.v1_8_R3.Block.getById(block.getTypeId()).a( + (net.minecraft.server.v1_8_R3.Entity) null) * 0.7F; if (strength <= heat) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSpectralArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSpectralArrow.java index 5aa7748c2..636a42cf3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSpectralArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSpectralArrow.java @@ -16,7 +16,7 @@ import nautilus.game.arcade.game.games.wizards.Spell; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index 45cf115f3..3d1a0247d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -6,7 +6,7 @@ import java.util.Iterator; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; @@ -34,8 +34,9 @@ import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.games.zombiesurvival.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; public class ZombieSurvival extends SoloGame { @@ -266,7 +267,7 @@ public class ZombieSurvival extends SoloGame { //Move EntityCreature ec = ((CraftCreature)mob).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); if (UtilMath.offset(mob.getLocation(), data.Target) > 20) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java index 19783df13..fa5b7e111 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java @@ -1,6 +1,6 @@ package nautilus.game.arcade.gui.spectatorMenu.button; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index 7f75b4533..a5e801770 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -113,11 +113,6 @@ public class SpectatorPage extends private void buildMultipleTeams(List teamList, int playerCount) { - _buttons = new IButton[0]; - _items = new ItemStack[0]; - - int currentRow = 0; - Collections.sort(teamList, new Comparator() { @@ -138,6 +133,11 @@ public class SpectatorPage extends }); + _buttons = new IButton[0]; + _items = new ItemStack[0]; + + int currentRow = 0; + for (GameTeam team : teamList) { ArrayList teamPlayers = team.GetPlayers(true); @@ -155,7 +155,7 @@ public class SpectatorPage extends _buttons = Arrays.copyOf(_buttons, _buttons.length + (rowsNeeded * 9)); - _items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9)); + _items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9) + rowsNeeded); for (int row = 0; row < rowsNeeded; row++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java index e23422a01..22beccdde 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.kit; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -15,6 +16,7 @@ import mineplex.core.achievement.Achievement; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import nautilus.game.arcade.ArcadeFormat; @@ -134,7 +136,7 @@ public abstract class Kit implements Listener type = EntityType.ZOMBIE; - LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); + final LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); @@ -147,9 +149,9 @@ public abstract class Kit implements Listener skel.setSkeletonType(SkeletonType.WITHER); } - UtilEnt.Vegetate(entity); - UtilEnt.silence(entity, true); + UtilEnt.Vegetate(entity, true); UtilEnt.ghost(entity, true, false); + UtilEnt.setFakeHead(entity, true); SpawnCustom(entity); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index aecdbf572..7a151660a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -59,4 +59,9 @@ public abstract class Perk implements Listener { // When listener has been registered } + + public void unregisteredEvents() + { + // When listener has been registered + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java index b039a7b08..b17f86772 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.kit.perks; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -22,7 +23,6 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_7_R4.Item; public class PerkApple extends Perk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java index cd84bcc8f..6016861d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java @@ -9,7 +9,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.kit.Perk; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -47,17 +47,6 @@ public class PerkArcticAura extends Perk //Snow Manager.GetBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0); } - - for (Player other : Manager.GetGame().GetPlayers(true)) - { - if (other.equals(player)) - continue; - - if (UtilMath.offset(player, other) > range) - continue; - - Manager.GetCondition().Factory().Slow("Aura Slow", other, player, 0.9, 0, false, false, false, false); - } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java index a815995cc..d69147917 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java @@ -69,7 +69,7 @@ public class PerkBaconBlast extends Perk implements IThrown UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java index e5a3216e0..cdbe1d699 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatForm.java @@ -166,7 +166,7 @@ public class PerkBatForm extends SmashPerk } //Move - data.Location.add(data.Direction.clone().multiply(0.75)); + data.Location.add(data.Direction.clone().multiply(1)); //Effect UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Location, 0, 0, 0, 0, 1, @@ -186,6 +186,9 @@ public class PerkBatForm extends SmashPerk HashMap targets = UtilEnt.getInRadius(data.Location, 10); for (LivingEntity cur : targets.keySet()) { + if (cur.equals(data.Shooter)) + continue; + Manager.GetDamage().NewDamageEvent(cur, data.Shooter, null, DamageCause.CUSTOM, 12 * targets.get(cur) + 0.5, true, false, false, data.Shooter.getName(), GetName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java index 554fe76a3..8d6e783c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.kit.perks; import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -104,7 +105,9 @@ public class PerkBlink extends SmashPerk //Firework UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); player.teleport(loc); + player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 1f); //Firework UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.BLACK, false, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java index c65127338..4e759312c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java @@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -74,6 +75,9 @@ public class PerkBlockToss extends SmashPerk implements IThrown if (UtilBlock.usable(grab)) return; + + if (!Recharge.Instance.usable(player, GetName())) + return; if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().Contains(grab.getRelative(BlockFace.UP))) { @@ -126,6 +130,9 @@ public class PerkBlockToss extends SmashPerk implements IThrown for (Player cur : throwSet) { + Recharge.Instance.recharge(cur, GetName()); + Recharge.Instance.use(cur, GetName(), 2000, false, true); + BlockTossData data = _hold.remove(cur); FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); @@ -143,7 +150,7 @@ public class PerkBlockToss extends SmashPerk implements IThrown //Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); - Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); //Event diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java index 12c099961..5a388d7ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneExplosion.java @@ -57,7 +57,7 @@ public class PerkBoneExplosion extends SmashPerk if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) return; - HashMap nearby = UtilPlayer.getInRadius(player.getLocation(), 10); + HashMap nearby = UtilPlayer.getInRadius(player.getLocation(), 7); for (Player other : nearby.keySet()) { if (player.equals(other)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java index d04a88096..3bee3341d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java @@ -123,7 +123,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown { Item bone = player.getWorld().dropItem(player.getLocation().add(Math.random()*5 - 2.5, Math.random()*3, Math.random()*5 - 2.5), new ItemStack(Material.BONE)); UtilAction.velocity(bone, dir, 0.6 + 0.3 * Math.random(), false, 0, 0.1 + Math.random() * 0.05, 0.3, false); - Manager.GetProjectile().AddThrow(bone, player, this, -1, true, true, true, false, 0.5f); + Manager.GetProjectile().AddThrow(bone, player, this, 2000, true, true, true, true, 0.5f); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java index 9b1aaa6a9..eb840ba27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java @@ -10,14 +10,15 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.Chicken; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; @@ -107,7 +108,7 @@ public class PerkChicken extends Perk if ((xDiff + yDiff + zDiff) > 4) { EntityCreature ec = ((CraftCreature) chicken).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); int xIndex = -1; int zIndex = -1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java index 5050e26e3..e3461cd2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java @@ -75,7 +75,7 @@ public class PerkCowBomb extends Perk implements IThrown UtilAction.velocity(ent, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java index d2f7f5a6a..c9054de14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java @@ -55,6 +55,8 @@ public class PerkCreeperElectricity extends Perk SetPowered(damagee, true); + Manager.GetCondition().Factory().Speed(GetName(), damagee, damagee, 4, 1, false, false, false); + //Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.CREEPER_HISS, 3f, 1.25f); @@ -117,8 +119,10 @@ public class PerkCreeperElectricity extends Perk //Inform UtilPlayer.message(damagee, F.main("Skill", "You hit " + F.elem(UtilEnt.getName(event.GetDamagerPlayer(false))) + " with " + F.skill(GetName()) + ".")); - //Lightning + //Elec damagee.getWorld().strikeLightningEffect(damagee.getLocation()); + Manager.GetCondition().Factory().Shock(GetName(), event.GetDamagerEntity(false), event.GetDamageeEntity(), 1, false, false); + SetPowered(damagee, false); //Damage Event diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java index e5dc574de..e9759b073 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java @@ -76,12 +76,12 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0)); - UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); + UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, - 0.5f); + 0.65f); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); @@ -130,6 +130,6 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown if (event.GetReason() == null || !event.GetReason().contains(GetName())) return; - event.AddKnockback(GetName(), 1.5); + event.AddKnockback(GetName(), 2); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java index d8ea85b93..5ff154476 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeadlyBones.java @@ -106,6 +106,6 @@ public class PerkDeadlyBones extends SmashPerk if (event.GetReason() == null || !event.GetReason().contains(GetName())) return; - event.AddKnockback(GetName(), 3); + event.AddKnockback(GetName(), 2.5); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java index 51883a447..2730c825b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDeathsGrasp.java @@ -44,7 +44,7 @@ public class PerkDeathsGrasp extends Perk { super("Deaths Grasp", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Deaths Grasp", + C.cYellow + "Left-Click" + C.cGray + " with Bow to use " + C.cGreen + "Deaths Grasp", C.cGray + "+100% Arrow Damage to enemies thrown by Deaths Grasp" }); } @@ -143,7 +143,7 @@ public class PerkDeathsGrasp extends Perk DamageCause.CUSTOM, 6, false, true, false, damager.getName(), GetName()); - UtilAction.velocity(damagee, UtilAlg.getTrajectory(damagee, damager), 1.8, false, 0, 1, 1.8, true); + UtilAction.velocity(damagee, UtilAlg.getTrajectory2d(damagee, damager), 1.6, false, 0, 1.2, 1.8, true); UtilAction.zeroVelocity(damager); @@ -156,6 +156,7 @@ public class PerkDeathsGrasp extends Perk UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); Recharge.Instance.recharge(damager, GetName()); + Recharge.Instance.use(damager, GetName(), 2000, true, true); } @EventHandler(priority = EventPriority.HIGH) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java index 4d0a133e5..4d430ad0b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java @@ -5,7 +5,7 @@ import java.util.HashMap; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.FireworkEffect.Type; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index 2907433d2..5b8a4d23a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -20,6 +20,10 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; @@ -89,7 +93,7 @@ public class PerkFirefly extends SmashPerk if (event.getType() != UpdateType.TICK) return; - _tick = (_tick + 1)%3; + _tick = (_tick + 1)%1000; Iterator dataIterator = _data.iterator(); @@ -106,26 +110,35 @@ public class PerkFirefly extends SmashPerk data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f); data.Location = data.Player.getLocation(); - if (_tick == 0) - { - //Firework - UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), Type.BURST, Color.ORANGE, false, false); - } + //Sound and Effect + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, data.Player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 10, ViewDist.LONG, UtilServer.getPlayers()); + float progress = (float)(System.currentTimeMillis()-data.Time)/1500f; + + data.Player.getWorld().playSound(data.Player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 1f + progress); } //Velocity - else if (!UtilTime.elapsed(data.Time, 2500) || superActive) + else if (!UtilTime.elapsed(data.Time, 2750) || superActive) { UtilAction.velocity(data.Player, data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0))); data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f); - if (_tick == 0) + //Sound and Effect + if (!isSuperActive(data.Player)) { - //Firework - UtilFirework.playFirework(data.Player.getLocation().add(0, 0.6, 0), isSuperActive(data.Player) ? Type.BALL : Type.BURST, Color.RED, false, superActive); - } - - for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 6 : 4)) + UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 1, 0), 0.6f, 0.6f, 0.6f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); + + data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.5f, 1.25f); + } + else + { + UtilParticle.PlayParticle(ParticleType.FLAME, data.Player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LAVA, data.Player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 40, ViewDist.LONG, UtilServer.getPlayers()); + + data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.75f, 0.75f); + } + + for (Player other : UtilPlayer.getNearby(data.Player.getLocation(), isSuperActive(data.Player) ? 7 : 4)) { if (other.equals(data.Player)) continue; @@ -136,10 +149,9 @@ public class PerkFirefly extends SmashPerk other.playEffect(EntityEffect.HURT); if (_tick == 0) - if (!data.Targets.contains(other)) + { + if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false)) { - data.Targets.add(other); - //Damage Event Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 10, true, true, false, @@ -147,6 +159,7 @@ public class PerkFirefly extends SmashPerk UtilPlayer.message(other, F.main("Game", F.elem(Manager.GetColor(data.Player) + data.Player.getName()) + " hit you with " + F.elem(GetName()) + ".")); } + } } } else diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java index 23056492c..490e1e79a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlap.java @@ -93,7 +93,7 @@ public class PerkFlap extends SmashPerk if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { - player.setExp(0.999f); + player.setExp(Math.min(0.9999f, player.getExp() + 0.03f)); player.setAllowFlight(true); } else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java index 399fc38e7..f52eaf0c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFletcher.java @@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java index bc1bbd109..bfea95ac1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIcePath.java @@ -60,8 +60,8 @@ public class PerkIcePath extends Perk if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) return; - UtilAction.zeroVelocity(player); - player.teleport(player.getLocation().add(0, 0.75, 0)); + player.teleport(player.getLocation().add(0, 1, 0)); + UtilAction.velocity(player, new Vector(0,0.5,0)); _data.add(new IcePathData(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java index 739a9afc8..3d04b54bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java @@ -46,7 +46,8 @@ public class PerkInferno extends SmashPerk if (!Kit.HasKit(player)) continue; - player.setExp((float) Math.min(0.999, player.getExp()+0.015)); + if (!player.isBlocking()) + player.setExp((float) Math.min(0.999, player.getExp()+0.025)); } } @@ -105,7 +106,7 @@ public class PerkInferno extends SmashPerk //Fire Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); - Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno"); + Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1.25, "Inferno"); fire.teleport(cur.getEyeLocation()); double x = 0.07 - (UtilMath.r(14)/100d); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index 725b1ab07..99a6f459e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -18,7 +18,11 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -73,7 +77,8 @@ public class PerkInkBlast extends SmashPerk implements IThrown for (int i=0 ; i<7 ; i++) { - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK)); + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), + ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)0, 1, "Ink" + Math.random())); Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); random.normalize(); @@ -84,9 +89,9 @@ public class PerkInkBlast extends SmashPerk implements IThrown UtilAction.velocity(ent, player.getLocation().getDirection().add(random), 1 + 0.4 * Math.random(), false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, - Effect.SMOKE, 4, UpdateType.TICK, + ParticleType.EXPLODE, UpdateType.TICK, 0.5f); } @@ -110,8 +115,8 @@ public class PerkInkBlast extends SmashPerk implements IThrown Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 3, true, true, false, UtilEnt.getName(data.GetThrower()), GetName()); - - Manager.GetCondition().Factory().Blind(GetName(), target, data.GetThrower(), 1.5, 0, false, false, false); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index b707bf669..e629b7d8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -63,7 +63,7 @@ public class PerkIronHook extends Perk implements IThrown UtilAction.velocity(item, player.getLocation().getDirection(), 1.8, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, true, Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.6f); //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index e1cf6acf9..34fdec4b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -151,7 +151,7 @@ public class PerkLazer extends Perk if (other.equals(player)) continue; - if (UtilMath.offset(newTarget, other.getLocation().add(0, 1, 0)) < 3) + if (UtilMath.offset(newTarget, other.getLocation().add(0, 1, 0)) < 2.5) { hitPlayer = true; break; @@ -189,7 +189,7 @@ public class PerkLazer extends Perk continue; //Do from center - if (UtilMath.offset(target, other.getLocation().add(0, 1, 0)) < 3.5) + if (UtilMath.offset(target, other.getLocation().add(0, 1, 0)) < 3) { //Damage Event Manager.GetDamage().NewDamageEvent(other, player, null, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java index 0d1c147f2..339dd0a7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMagmaBlast.java @@ -5,7 +5,7 @@ import java.util.Iterator; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLargeFireball; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -29,7 +29,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_7_R4.EntityLargeFireball; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; public class PerkMagmaBlast extends Perk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java index 4f6cc9ae9..29fa5cda1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMeteorShower.java @@ -1,10 +1,12 @@ package nautilus.game.arcade.kit.perks; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; + import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.kit.SmashPerk; @@ -24,7 +26,7 @@ public class PerkMeteorShower extends SmashPerk @Override public void addSuperCustom(Player player) { - _meteors.add(new MeteorShowerData(player, player.getTargetBlock(null, 128).getLocation())); + _meteors.add(new MeteorShowerData(player, player.getTargetBlock((HashSet) null, 128).getLocation())); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java index 3844440ba..4c39ea23d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNeedler.java @@ -57,7 +57,7 @@ public class PerkNeedler extends SmashPerk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 600 : 1800, !isSuperActive(player), !isSuperActive(player))) + if (!Recharge.Instance.use(player, GetName(), isSuperActive(player) ? 600 : 2000, !isSuperActive(player), !isSuperActive(player))) return; _active.put(player, 8); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java index c4d4511c2..ba3a225c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java @@ -69,7 +69,7 @@ public class PerkPigBaconBomb extends SmashPerk if (!Kit.HasKit(player)) return; - float energy = 0.40f; + float energy = 0.30f; DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); if (disguise != null && disguise instanceof DisguisePigZombie) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java index 934899998..cff63ed81 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java @@ -89,7 +89,7 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown player.setExp(Math.max(0f, player.getExp() - energy)); //Launch - Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK)); + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, "Bacon"+System.currentTimeMillis())); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.4f); ent.setPickupDelay(9999); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java index f3ee858f5..4b41a42e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -78,7 +78,7 @@ public class PerkSeismicSlam extends Perk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; //Action @@ -115,7 +115,7 @@ public class PerkSeismicSlam extends Perk _live.remove(player); //Action - int damage = 11; + int damage = 10; double range = 8; HashMap targets = UtilEnt.getInRadius(player.getLocation(), range); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index 9623aed7d..3533cc8be 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -6,11 +6,12 @@ import mineplex.core.updater.event.*; import mineplex.minecraft.game.core.combat.event.*; import mineplex.minecraft.game.core.damage.*; import nautilus.game.arcade.kit.*; -import net.minecraft.server.v1_7_R4.*; +import net.minecraft.server.v1_8_R3.*; + import org.bukkit.*; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.*; +import org.bukkit.craftbukkit.v1_8_R3.entity.*; import org.bukkit.entity.Entity; import org.bukkit.entity.*; import org.bukkit.event.*; @@ -189,7 +190,7 @@ public class PerkSkeletons extends Perk Location target = skel.getLocation().add(UtilAlg.getTrajectory(skel, player).multiply(3)); EntityCreature ec = ((CraftCreature) skel).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); nav.a(target.getX(), target.getY(), target.getZ(), speed); skel.setTarget(null); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index a0f5a5529..1b16508b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -195,7 +195,7 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge/2d, false, 0, 0.2, 10, true); - Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true, true, null, 0, 0, null, 0, UpdateType.FASTEST, 1f); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java index 029ef5bf4..710589904 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java @@ -6,7 +6,7 @@ import java.util.WeakHashMap; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSnowman; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowman; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -32,7 +32,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.SmashPerk; -import net.minecraft.server.v1_7_R4.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityInsentient; public class PerkSnowTurret extends SmashPerk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java index fd5f576e7..a355bb013 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkStormSquid.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.kit.perks; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -62,7 +63,7 @@ public class PerkStormSquid extends SmashPerk if (event.getAction() == Action.PHYSICAL) return; - Block block = player.getTargetBlock(null, 100); + Block block = player.getTargetBlock((HashSet) null, 100); if (block == null) return; @@ -93,7 +94,7 @@ public class PerkStormSquid extends SmashPerk //Damage Event Manager.GetDamage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, 20 * targets.get(cur), false, true, false, + DamageCause.CUSTOM, 16 * targets.get(cur), false, true, false, player.getName(), GetName()); //Velocity diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java index beb829f45..385cb0d51 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSuperSquid.java @@ -13,9 +13,12 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -93,8 +96,8 @@ public class PerkSuperSquid extends SmashPerk UtilAction.velocity(cur, 0.6, 0.1, 1, true); - cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.2f, 1f); - cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, 8); + cur.getWorld().playSound(cur.getLocation(), Sound.SPLASH2, 0.5f, 1f); + UtilParticle.PlayParticle(ParticleType.SPLASH, cur.getLocation().add(0, 0.5, 0), 0.3f, 0.3f, 0.3f, 0, 60, ViewDist.LONG, UtilServer.getPlayers()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java index c4eff1e87..fb5e90528 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java @@ -7,7 +7,6 @@ import java.util.Iterator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftTNTPrimed; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java index b51869b2f..0fda9bdb4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java @@ -76,7 +76,7 @@ public class PerkWebShot extends SmashPerk implements IThrown random.multiply(0.2); UtilAction.velocity(ent, player.getLocation().getDirection().multiply(-1).add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, 0.5f); } //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index b37320e06..5a7fccc01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -36,7 +36,8 @@ public class PerkWitherImage extends SmashPerk { super("Wither Image", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Image" + C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Image", + C.cYellow + "Double Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Wither Swap" }); } @@ -105,7 +106,7 @@ public class PerkWitherImage extends SmashPerk } else { - if (!Recharge.Instance.use(player, "Wither Swap", 1000, true, false)) + if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false)) return; Skeleton skel = _images.get(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java index f03f12567..de3505cc3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherSkull.java @@ -191,7 +191,7 @@ public class PerkWitherSkull extends SmashPerk double scale = 0.4 + 0.6 * Math.min(1, skull.getTicksLived()/20d); //Players - HashMap players = UtilPlayer.getInRadius(skull.getLocation(), 7); + HashMap players = UtilPlayer.getInRadius(skull.getLocation(), 6); for (Player player : players.keySet()) { if (!Manager.GetGame().IsAlive(player)) @@ -199,7 +199,7 @@ public class PerkWitherSkull extends SmashPerk //Damage Event Manager.GetDamage().NewDamageEvent(player, (LivingEntity)skull.getShooter(), null, - DamageCause.CUSTOM, 2 + 10 * players.get(player) * scale, true, true, false, + DamageCause.CUSTOM, 12 * players.get(player) * scale, true, true, false, UtilEnt.getName((LivingEntity)skull.getShooter()), GetName()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index 57a79f2f9..febca2e0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -8,7 +8,7 @@ import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; @@ -34,8 +34,9 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.SmashPerk; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; public class PerkWolf extends SmashPerk { @@ -82,7 +83,7 @@ public class PerkWolf extends SmashPerk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, "Cub Tackle", isSuperActive(player) ? 800 : 8000, !isSuperActive(player), !isSuperActive(player))) + if (!Recharge.Instance.use(player, "Cub Tackle", isSuperActive(player) ? 1600 : 8000, !isSuperActive(player), !isSuperActive(player))) return; //Get Nearest Wolf @@ -198,7 +199,7 @@ public class PerkWolf extends SmashPerk loc.add(UtilAlg.getTrajectory2d(ent, wolf).multiply(1)); EntityCreature ec = ((CraftCreature)wolf).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); nav.a(loc.getX(), loc.getY(), loc.getZ(), 1); } } @@ -255,7 +256,7 @@ public class PerkWolf extends SmashPerk if (!Kit.HasKit(player)) return; - if (!Recharge.Instance.use(player, "Wolf Strike", isSuperActive(player) ? 800 : 8000, !isSuperActive(player), !isSuperActive(player))) + if (!Recharge.Instance.use(player, "Wolf Strike", isSuperActive(player) ? 1600 : 8000, !isSuperActive(player), !isSuperActive(player))) return; //Velocity diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java index b0255ff8b..ccebfc71c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -10,9 +10,9 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWolf; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; @@ -39,8 +39,9 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; public class PerkWolfPack extends Perk { @@ -296,7 +297,7 @@ public class PerkWolfPack extends Perk //Move EntityCreature ec = ((CraftCreature)wolf).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); nav.a(target.getX(), target.getY(), target.getZ(), speed); wolf.setTarget(null); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index bf7c2ee57..027066090 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -9,9 +9,9 @@ import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftWolf; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -37,8 +37,9 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.Navigation; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.Navigation; +import net.minecraft.server.v1_8_R3.NavigationAbstract; public class PerkWolfPet extends Perk { @@ -174,7 +175,7 @@ public class PerkWolfPet extends Perk //Move EntityCreature ec = ((CraftCreature)wolf).getHandle(); - Navigation nav = ec.getNavigation(); + NavigationAbstract nav = ec.getNavigation(); nav.a(target.getX(), target.getY(), target.getZ(), speed); wolf.setTarget(null); @@ -268,7 +269,7 @@ public class PerkWolfPet extends Perk public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) { //Damage Event - ((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle()); + ((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle(), EntityTargetEvent.TargetReason.CUSTOM, false); //Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 8615521fb..4dc6c0825 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -107,7 +107,7 @@ public class PerkWoolBomb extends Perk implements IThrown UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, 0.5f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java index 57ef2dc4d..116cd0add 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -121,6 +121,15 @@ public class PerkZombieBile extends SmashPerk implements IThrown } } + @EventHandler + public void death(PlayerDeathEvent event) + { + if (_active.containsKey(event.getEntity())) + { + _active.remove(event.getEntity()); + } + } + @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java index 10b4187a7..c04f9b167 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/FireflyData.java @@ -9,7 +9,6 @@ public class FireflyData public org.bukkit.entity.Player Player; public org.bukkit.Location Location; public long Time; - public HashSet Targets = new HashSet(); public FireflyData(org.bukkit.entity.Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java index 19dbf11b9..09edaeadd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/data/MeteorShowerData.java @@ -1,11 +1,11 @@ package nautilus.game.arcade.kit.perks.data; import mineplex.core.common.util.UtilTime; -import net.minecraft.server.v1_7_R4.EntityFireball; -import net.minecraft.server.v1_7_R4.EntityLargeFireball; +import net.minecraft.server.v1_8_R3.EntityFireball; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLargeFireball; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.entity.Player; import org.bukkit.util.Vector; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index d4fea8c1b..3b363b453 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -38,7 +38,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; import org.bukkit.block.DoubleChest; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -735,7 +735,7 @@ public class GameFlagManager implements Listener player.setAllowFlight(true); player.setFlying(true); ((CraftPlayer)player).getHandle().spectating = true; - ((CraftPlayer) player).getHandle().ghost = true; + ((CraftPlayer) player).getHandle().setGhost(true); ((CraftPlayer)player).getHandle().k = false; for (int i=0 ; i<9 ; i++) @@ -1177,102 +1177,7 @@ public class GameFlagManager implements Listener event.setCancelled(true); } } - - @EventHandler - public void versionUpdateCheck(UpdateEvent event) - { - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().VersionRequire1_8) - return; - - if (event.getType() != UpdateType.SEC) - return; - for (Player player : UtilServer.getPlayers()) - { - if (!UtilPlayer.is1_8(player)) - versionKick(player); - } - } - - private HashMap _versionKickCleanup = new HashMap(); - - @EventHandler - public void versionJoinCheck(PlayerJoinEvent event) - { - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().VersionRequire1_8) - return; - - if (!UtilPlayer.is1_8(event.getPlayer())) - versionKick(event.getPlayer()); - } - - public void versionKick(Player player) - { - if (Manager.GetGame() == null) - return; -// -// if (Manager.GetGame().GetType().getResourcePackUrl() == null) -// return; -// - UtilPlayer.message(player, " "); - UtilPlayer.message(player, C.cGold + C.Bold + Manager.GetGame().GetType().GetName() + " requires you to be using Minecraft 1.8!"); - UtilPlayer.message(player, " "); - - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - Manager.GetPortal().sendPlayerToServer(player, "Lobby"); - - if (!_versionKickCleanup.containsKey(player)) - _versionKickCleanup.put(player, System.currentTimeMillis()); - } - - @EventHandler - public void onVersionCleanup(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - if (Manager.GetGame() == null || !Manager.GetGame().VersionRequire1_8) - { - if (!_versionKickCleanup.isEmpty()) - _versionKickCleanup.clear(); - - return; - } - - HashMap copy = new HashMap(); - copy.putAll(_versionKickCleanup); - - for (Player player : copy.keySet()) - { - if (UtilPlayer.is1_8(player)) - { - _versionKickCleanup.remove(player); - continue; - } - - if (!player.isOnline()) - { - _versionKickCleanup.remove(player); - continue; - } - - //Force kick the player after 10 seconds of not being sent to lobby. - if (UtilTime.elapsed(copy.get(player), 10000)) - { - _versionKickCleanup.remove(player); - - player.kickPlayer(C.cGold + C.Bold + Manager.GetGame().GetType().GetName() + " requires you to be using Minecraft 1.8!"); - continue; - } - } - } - @EventHandler public void resourceInform(PlayerJoinEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 1c5d2233f..83230ab09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -22,18 +22,19 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GemData; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam.PlayerState; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.server.v1_8_R3.EntityHuman; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; +import com.mojang.authlib.GameProfile; + public class GameGemManager implements Listener { ArcadeManager Manager; @@ -225,7 +226,7 @@ public class GameGemManager implements Listener try { Field name = GameProfile.class.getDeclaredField("name"); - Field declaredProfile = EntityHuman.class.getDeclaredField("i"); + Field declaredProfile = EntityHuman.class.getDeclaredField("bH"); declaredProfile.setAccessible(true); GameProfile gameProfile = (GameProfile) declaredProfile.get(((CraftHumanEntity)((CraftPlayer) player)).getHandle()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 388cd99b5..513f4182b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -208,7 +208,7 @@ public class GameHostManager implements Listener { Player p = event.getPlayer(); if (Manager.GetServerConfig().PlayerServerWhitelist){ - if (!getWhitelist().contains(p.getName())){ + if (!getWhitelist().contains(p.getName().toLowerCase())){ if ((Manager.GetHost() != null) && (Manager.GetHost().equalsIgnoreCase(p.getName()))) { return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index a18abd254..a77e3f72b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -13,14 +13,12 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlockText; import mineplex.core.common.util.UtilBlockText.TextAlign; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; @@ -28,7 +26,6 @@ import mineplex.core.common.util.UtilWorld; import mineplex.core.cosmetic.event.ActivateGemBoosterEvent; import mineplex.core.donation.Donor; import mineplex.core.event.CustomTagEvent; -import mineplex.core.explosion.ExplosionEvent; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -46,9 +43,9 @@ import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitSorter; -import net.minecraft.server.v1_7_R4.Packet; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_7_R4.WatchableObject; +import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject; +import net.minecraft.server.v1_8_R3.Packet; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -80,7 +77,7 @@ import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; -public class GameLobbyManager implements Listener, IPacketHandler +public class GameLobbyManager implements Listener { public ArcadeManager Manager; @@ -113,8 +110,7 @@ public class GameLobbyManager implements Listener, IPacketHandler private int _oldPlayerCount = 0; private int _oldMaxPlayerCount = 0; // Used for scoreboard when max player count changes - - private boolean _handlingPacket = false; + private String _serverName; private boolean _colorTick = false; @@ -123,8 +119,6 @@ public class GameLobbyManager implements Listener, IPacketHandler { Manager = manager; - packetHandler.addPacketHandler(this); - World world = UtilWorld.getWorld("world"); world.setTime(6000); @@ -140,8 +134,19 @@ public class GameLobbyManager implements Listener, IPacketHandler _advText = new Location(world, 0, 140, -60); _kitDisplay = new Location(world, -17, 101, 0); + + float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(_kitDisplay, + getRealSpawn())); + yaw = Math.round(yaw / 90) * 90; + _kitDisplay.setYaw(yaw); + _teamDisplay = new Location(world, 18, 101, 0); + yaw = UtilAlg.GetYaw(UtilAlg + .getTrajectory(_teamDisplay, getRealSpawn())); + yaw = Math.round(yaw / 90) * 90; + _teamDisplay.setYaw(yaw); + Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); _serverName = Manager.getPlugin().getConfig().getString("serverstatus.name"); @@ -298,9 +303,19 @@ public class GameLobbyManager implements Listener, IPacketHandler UtilBlockText.MakeText(text, loc, face, id, data, TextAlign.CENTER); } - public Location GetSpawn() - { - return spawn.clone().add(4 - Math.random()*8, 0, 4 - Math.random()*8); + public Location GetSpawn() + { + Location loc = spawn.clone().add(4 - Math.random() * 8, 0, + 4 - Math.random() * 8); + + loc.setYaw(90); + + return loc; + } + + public Location getRealSpawn() + { + return spawn; } @EventHandler(priority = EventPriority.MONITOR) @@ -343,6 +358,59 @@ public class GameLobbyManager implements Listener, IPacketHandler CreateScoreboards(); return; } + + //UHC + if (game.GetType() == GameType.UHC) + { + if (game.GetTeamList().size() > 1) + { + //Text + WriteTeamLine("", 0, 159, (byte)15); + WriteTeamLine("", 1, 159, (byte)4); + + for (int i=0 ; i 1 || game.GetTeamList().size() < 6) && game.GetType() != GameType.SurvivalGamesTeams) @@ -374,7 +442,9 @@ public class GameLobbyManager implements Listener, IPacketHandler ent.setColor(DyeColor.getByWoolData(teams.get(i).GetColorData())); - UtilEnt.Vegetate(ent); + UtilEnt.Vegetate(ent, true); + UtilEnt.setFakeHead(ent, true); + UtilEnt.ghost(ent, true, false); teams.get(i).SetTeamEntity(ent); @@ -422,7 +492,9 @@ public class GameLobbyManager implements Listener, IPacketHandler ent.setColor(DyeColor.getByWoolData(teamsA.get(i).GetColorData())); - UtilEnt.Vegetate(ent); + UtilEnt.Vegetate(ent, true); + UtilEnt.setFakeHead(ent, true); + UtilEnt.ghost(ent, true, false); teamsA.get(i).SetTeamEntity(ent); @@ -437,7 +509,7 @@ public class GameLobbyManager implements Listener, IPacketHandler for (int i=0 ; i kitsA = new ArrayList(); - ArrayList kitsB = new ArrayList(); - - for (int i=0 ; i 10) + { + for (int i = 0; i < length; i++) + { + Kit kit = game.GetKits()[i]; + + if (kit.GetAvailability() == KitAvailability.Null) + continue; + + // Circle Math + double lead = ((1.1 * ((i + .5) - (length / 2D))) + (length / 2D)) * ((2d * Math.PI) / (length * 2)); + double sizeMod = 18; + double oX = -Math.sin(lead) * sizeMod; + double oZ = Math.cos(lead) * sizeMod; + + // Location + Location entLoc = spawn.clone().add(Math.floor(oX), 0, + Math.floor(oZ)); + entLoc.setY(_kitDisplay.getY()); + + float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(entLoc, Manager + .GetLobby().getRealSpawn())); + + entLoc.setYaw(yaw); + + // Blocks + byte data = 4; + if (kit.GetAvailability() == KitAvailability.Gem) + data = 5; + else if (kit.GetAvailability() == KitAvailability.Achievement) + data = 2; + SetKitTeamBlocks(entLoc.clone(), 35, data, _kitBlocks); + + entLoc.add(0, 1.5, 0); + + entLoc.getChunk().load(); + + // NPC + Entity ent = kit.SpawnEntity(entLoc); + + if (ent == null) + continue; + + _kits.put(ent, new LobbyEnt(ent, entLoc, kit)); + } + return; + } + } for (int i=0 ; i watchables = new ArrayList(); - - for (WatchableObject watchableObject : (List)((PacketPlayOutEntityMetadata) packet).b) - { - WatchableObject newWatch = new WatchableObject(watchableObject.c(), watchableObject.a(), watchableObject.b()); - - if (newWatch.a() == 10) - { - newWatch.a(customName); - } - - watchables.add(newWatch); - } - - PacketPlayOutEntityMetadata newPacket = new PacketPlayOutEntityMetadata(); - newPacket.a = entityId; - newPacket.b = watchables; - - _handlingPacket = true; - packetVerifier.process(newPacket); - _handlingPacket = false; - - packetInfo.setCancelled(true); - } - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - } - } - } - public void AddPlayerToScoreboards(Player player, String teamName) { if (teamName == null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index b630bbe6a..ba57f7f18 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -18,11 +18,13 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.pet.PetManager; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; @@ -50,7 +52,7 @@ public class GameLootManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); - _rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(), + _rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(), Manager.getGiveawayManager(), 100, 250, 500, 1000, 1500, 2500, @@ -133,7 +135,7 @@ public class GameLootManager implements Listener //Delay after Achievements } - public boolean giveReward(Player player, boolean force) + public boolean giveReward(final Player player, boolean force) { if (!force) { @@ -162,56 +164,60 @@ public class GameLootManager implements Listener return false; } - Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true); - - RewardData rewardData = reward.giveReward(RewardType.GameLoot, player); - - String outputName = reward.getRarity().getColor() + rewardData.getFriendlyName(); - - String rarityName = ""; - if (reward.getRarity() != RewardRarity.COMMON) - rarityName = " " + reward.getRarity().getColor() + reward.getRarity().getName(); - - //Log - System.out.println(F.name(player.getName()) + " found" + rarityName + " " + outputName); - - //Self Display - UtilTextMiddle.display(C.cGreen + "Game Loot", "You found " + outputName, 20, 120, 20, player); - //if (reward.getRarity() == RewardRarity.COMMON) - // UtilPlayer.message(player, F.main("Loot", "You found " + rarityName + outputName)); - - Random _random = new Random(); - - //Announce - //if (reward.getRarity() != RewardRarity.COMMON) + final Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true); + reward.giveReward(RewardType.GameLoot, player, new Callback() { - Bukkit.broadcastMessage(F.main("Loot", F.name(player.getName()) + " found" + rarityName + " " + outputName)); - } - - //Effect - if (reward.getRarity() == RewardRarity.UNCOMMON) - { - FireworkEffect effect = FireworkEffect.builder().withColor(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255))) - .withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255))) - .with(FireworkEffect.Type.STAR) - .build(); + @Override + public void run(RewardData rewardData) + { + String outputName = reward.getRarity().getColor() + rewardData.getFriendlyName(); - UtilFirework.playFirework(player.getEyeLocation(), effect); - } - else if (reward.getRarity() == RewardRarity.RARE) - { - FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL).withColor(Color.YELLOW).withFade(Color.WHITE).build(); - UtilFirework.playFirework(player.getEyeLocation(), effect); - - player.getWorld().playSound(player.getEyeLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 5F, 1.2F); - } - else if (reward.getRarity() == RewardRarity.LEGENDARY) - { - FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build(); - UtilFirework.playFirework(player.getEyeLocation(), effect); - - player.getWorld().playSound(player.getEyeLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F); - } + String rarityName = ""; + if (reward.getRarity() != RewardRarity.COMMON) + rarityName = " " + reward.getRarity().getColor() + reward.getRarity().getName(); + + //Log + System.out.println(F.name(player.getName()) + " found" + rarityName + " " + outputName); + + //Self Display + UtilTextMiddle.display(C.cGreen + "Game Loot", "You found " + outputName, 20, 120, 20, player); + //if (reward.getRarity() == RewardRarity.COMMON) + // UtilPlayer.message(player, F.main("Loot", "You found " + rarityName + outputName)); + + Random _random = new Random(); + + //Announce + //if (reward.getRarity() != RewardRarity.COMMON) + { + Bukkit.broadcastMessage(F.main("Loot", F.name(player.getName()) + " found" + rarityName + " " + outputName)); + } + + //Effect + if (reward.getRarity() == RewardRarity.UNCOMMON) + { + FireworkEffect effect = FireworkEffect.builder().withColor(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255))) + .withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255))) + .with(FireworkEffect.Type.STAR) + .build(); + + UtilFirework.playFirework(player.getEyeLocation(), effect); + } + else if (reward.getRarity() == RewardRarity.RARE) + { + FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL).withColor(Color.YELLOW).withFade(Color.WHITE).build(); + UtilFirework.playFirework(player.getEyeLocation(), effect); + + player.getWorld().playSound(player.getEyeLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 5F, 1.2F); + } + else if (reward.getRarity() == RewardRarity.LEGENDARY) + { + FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build(); + UtilFirework.playFirework(player.getEyeLocation(), effect); + + player.getWorld().playSound(player.getEyeLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F); + } + } + }); return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index d3302b599..21d8c6501 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -13,6 +13,9 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseLiving; +import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.gadgets.MorphWither; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -86,13 +89,17 @@ public class GameManager implements Listener UtilTextTop.displayProgress(text, health, UtilServer.getPlayers()); for (Creature pet : Manager.getCosmeticManager().getPetManager().getPets()) - { - if (pet instanceof Wither) - { - pet.setCustomName(text); - pet.setHealth(Math.max(0.1, 300 * health)); - } - } + { + DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + ((DisguiseLiving) disguise).setHealth((float) Math.max(0.1, + 300 * health)); + disguise.resendMetadata(); + } + } //Name Dragons Appropriately for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index 1a68d11ff..f06f1d2dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -23,13 +23,13 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.KitPackage; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -353,7 +353,7 @@ public class GamePlayerManager implements Listener if (player.isOnline()) { Manager.GetGame().SetKit(player, kit, true); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); + UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); } } }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index d26c941c9..570ea9ea3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -23,9 +23,10 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; -import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction; -import net.minecraft.server.v1_7_R4.TileEntity; -import net.minecraft.server.v1_7_R4.TileEntityEnderChest; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; +import net.minecraft.server.v1_8_R3.TileEntity; +import net.minecraft.server.v1_8_R3.TileEntityEnderChest; import org.bukkit.Effect; import org.bukkit.Location; @@ -33,9 +34,9 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -239,11 +240,11 @@ public class HolidayManager implements Listener private void sendChestPackets(Block block) { - PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(block.getX(), block.getY(), block.getZ(), + PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(new BlockPosition(block.getX(), block.getY(), block.getZ()), CraftMagicNumbers.getBlock(block), 1, 1); for (Player other : UtilServer.getPlayers()) - ((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet); + UtilPlayer.sendPacket(other, packet); } private Block findSpecialBlockLocation(Game game) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java index bf6e1036c..1849d34f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java @@ -1,13 +1,9 @@ package nautilus.game.arcade.scoreboard; import java.util.ArrayList; -import java.util.HashSet; -import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; @@ -16,6 +12,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; @@ -27,7 +24,8 @@ public class GameScoreboard private Objective _sideObjective; private ArrayList _elements = new ArrayList(); - private String[] _current = new String[15]; + private char[] _chars = "1234567890abcdefghijklmnopqrstuvwxyz".toCharArray(); + private ArrayList _previousLines = new ArrayList(); private String _title; private int _shineIndex; @@ -197,18 +195,8 @@ public class GameScoreboard } */ - public String Clean(String line) - { - if (line.length() > 16) - line = line.substring(0, 16); - - return line; - } - public void Write(String line) { - line = Clean(line); - _elements.add(new ScoreboardElementText(line)); } @@ -217,8 +205,6 @@ public class GameScoreboard if (prependScore) line = value + " " + line; - line = Clean(line); - for (ScoreboardElement elem : _elements) { if (elem instanceof ScoreboardElementScores) @@ -246,87 +232,100 @@ public class GameScoreboard if (_debug) System.out.println(); if (_debug) System.out.println("/////////////////////////"); - //Generate Lines + // Generate Lines ArrayList newLines = new ArrayList(); for (ScoreboardElement elem : _elements) { - for (String line : elem.GetLines()) - { - //Ensure no duplicate lines - while (true) - { - boolean matched = false; + newLines.addAll(elem.GetLines()); + } - for (String otherLine : newLines) + int i = 0; + while (true) + { + if (i >= _chars.length) + break; + + String str = ChatColor.COLOR_CHAR + "" + _chars[i]; + + Score score = GetObjectiveSide().getScore(str); + + if (newLines.size() <= i) + { + if (score.isScoreSet()) + { + ResetScore(str); + } + else + { + break; + } + } + else if (i >= _previousLines.size() || !_previousLines.get(i).equals(newLines.get(i))) + { + Team team = GetScoreboard().getTeam(str); + + if (team == null) + { + team = GetScoreboard().registerNewTeam(str); + team.addEntry(str); + } + + String[] line = split(newLines.get(i)); + + team.setPrefix(line[0]); + team.setSuffix(line[1]); + + if (!score.isScoreSet()) + { + if (i == 15) { - if (line.equals(otherLine)) - { - line += ChatColor.RESET; - matched = true; - } + score.setScore(1); } - if (!matched) - break; + score.setScore(15 - i); } - - newLines.add(line); - } - } - - //Find Changes - HashSet toAdd = new HashSet(); - HashSet toDelete = new HashSet(); - - for (int i=0 ; i<15 ; i++) - { - //Delete Old Excess Row - if (i >= newLines.size()) - { - if (_current[i] != null) - { - if (_debug) System.out.println("Delete: " + i + " [" + _current[i] + "]"); - toDelete.add(i); - } - - continue; } - //Update or Add Row - if (_current[i] == null || !_current[i].equals(newLines.get(i))) - { - if (_debug) System.out.println("Update: " + i + " [" + newLines.get(i) + "]"); - toDelete.add(i); - toAdd.add(i); - } - } - - //Delete Elements - Must happen before Add - for (int i : toDelete) - { - //Remove Old Line at Index - if (_current[i] != null) - { - if (_debug) System.out.println("Deleting: " + i + " [" + _current[i] + "]"); - - ResetScore(_current[i]); - _current[i] = null; - } - } - - //Add Elements - for (int i : toAdd) - { - //Insert New Line - String newLine = newLines.get(i); - GetObjectiveSide().getScore(newLine).setScore(15-i); - _current[i] = newLine; - - if (_debug) System.out.println("Setting: " + (15-i) + " [" + newLine + "]"); + i++; } + + _previousLines = newLines; } + private String[] split(String line) + { + String[] strings = new String[2]; + + if (line.length() > 16) + { + String line1 = line.substring(0, 16); + String line2 = line.substring(16); + + if (line1.endsWith(ChatColor.COLOR_CHAR + "")) + { + line2 = line1.substring(15, 16) + line2; + line1 = line1.substring(0, 15); + } + + line2 = ChatColor.getLastColors(line1) + line2; + + if (line2.length() > 16) + { + line2 = line2.substring(0, 16); + } + + strings[0] = line1; + strings[1] = line2; + } + else + { + strings[0] = line; + strings[1] = ""; + } + + return strings; + } public void Reset() { _elements.clear(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index e584708fc..068035b74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -19,7 +19,6 @@ import mineplex.core.timing.TimingManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.uhc.UHC; -import net.minecraft.server.v1_7_R4.ChunkPreLoadEvent; import org.bukkit.Difficulty; import org.bukkit.Location; @@ -28,6 +27,8 @@ import org.bukkit.World.Environment; import org.bukkit.WorldCreator; import org.bukkit.event.world.ChunkUnloadEvent; +import com.mineplex.spigot.ChunkPreLoadEvent; + public class WorldData { public Game Host; @@ -114,6 +115,7 @@ public class WorldData TimingManager.stop("WorldData loading world."); World.setDifficulty(Difficulty.HARD); + World.setGameRuleValue("showDeathMessages", "false"); TimingManager.start("WorldData loading WorldConfig."); //Load World Data @@ -447,11 +449,11 @@ public class WorldData if (World == null) return; - if (!event.GetWorld().equals(World)) + if (!event.getWorld().equals(World)) return; - int x = event.GetX(); - int z = event.GetZ(); + int x = event.getX(); + int z = event.getZ(); if (x >= MinX >> 4 && x <= MaxX >> 4 && z >= MinZ >> 4 && z <= MaxZ >> 4)