Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/mineplex
This commit is contained in:
commit
e4a86e0600
@ -108,6 +108,7 @@
|
||||
<zipfileset src="../Libraries/httpmime-4.2.jar" />
|
||||
<zipfileset src="../Libraries/gson-2.2.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
|
||||
<zipfileset src="../Libraries/commons-io-2.4" />
|
||||
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
|
||||
</jar>
|
||||
<copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/>
|
||||
|
@ -13,7 +13,7 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -4,8 +4,8 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
|
||||
public class BlockRegenerateData
|
||||
{
|
||||
@ -46,7 +46,7 @@ public class BlockRegenerateData
|
||||
//if (_loc.getBlock().getType() == Material.CHEST)
|
||||
// return;
|
||||
|
||||
net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle();
|
||||
net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle();
|
||||
|
||||
c.a(_loc.getBlockX() & 0xF, _loc.getBlockY(), _loc.getBlockZ() & 0xF, _id, _data);
|
||||
((CraftWorld)_loc.getChunk().getWorld()).getHandle().notify(_loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ());
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftChunk;
|
||||
|
||||
public class BlockRegenerateSet
|
||||
{
|
||||
@ -61,7 +61,7 @@ public class BlockRegenerateSet
|
||||
{
|
||||
for (Chunk chunk : _chunks)
|
||||
{
|
||||
net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)chunk).getHandle();
|
||||
net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)chunk).getHandle();
|
||||
c.initLighting();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
|
@ -11,24 +11,24 @@ import mineplex.core.fakeEntity.FakeEntityManager;
|
||||
import mineplex.core.fakeEntity.FakePlayer;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import net.minecraft.server.v1_6_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_6_R3.Packet31RelEntityMove;
|
||||
import net.minecraft.server.v1_6_R3.Packet34EntityTeleport;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_7_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_7_R1.Packet31RelEntityMove;
|
||||
import net.minecraft.server.v1_7_R1.Packet34EntityTeleport;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalSelector;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftAgeable;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftAgeable;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
|
@ -7,8 +7,8 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.fakeEntity.FakeEntity;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Packet28EntityVelocity;
|
||||
|
||||
public class UpdateThread extends Thread
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ package me.chiss.Core.Utility;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class InventoryUtil
|
||||
|
Binary file not shown.
Binary file not shown.
@ -2,7 +2,7 @@ package mineplex.core.common.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class InventoryUtil
|
||||
|
@ -3,30 +3,31 @@ package mineplex.core.common.util;
|
||||
import java.io.File;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.lang.reflect.Field;
|
||||
import java.rmi.registry.Registry;
|
||||
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_6_R3.Block;
|
||||
import net.minecraft.server.v1_6_R3.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_6_R3.ChunkSection;
|
||||
import net.minecraft.server.v1_6_R3.IContainer;
|
||||
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_6_R3.Packet52MultiBlockChange;
|
||||
import net.minecraft.server.v1_6_R3.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_6_R3.RegionFile;
|
||||
import net.minecraft.server.v1_7_R1.Block;
|
||||
import net.minecraft.server.v1_7_R1.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_7_R1.ChunkSection;
|
||||
import net.minecraft.server.v1_7_R1.IContainer;
|
||||
import net.minecraft.server.v1_7_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutMultiBlockChange;
|
||||
import net.minecraft.server.v1_7_R1.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_7_R1.RegionFile;
|
||||
|
||||
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_6_R3.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
@ -37,7 +38,7 @@ public class MapUtil
|
||||
{
|
||||
public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer)
|
||||
{
|
||||
net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)chunk).getHandle();
|
||||
net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)chunk).getHandle();
|
||||
|
||||
for(int x = 0; x < 16; x++)
|
||||
{
|
||||
@ -45,11 +46,11 @@ public class MapUtil
|
||||
{
|
||||
for(int y = 0; y < 18; y++)
|
||||
{
|
||||
int bX = c.x << 4 | x & 0xF;
|
||||
int bX = c.locX << 4 | x & 0xF;
|
||||
int bY = y & 0xFF;
|
||||
int bZ = c.z << 4 | z & 0xF;
|
||||
int bZ = c.locZ << 4 | z & 0xF;
|
||||
|
||||
if(c.getTypeId(bX & 0xF, bY, bZ & 0xF) == replacee.getId())
|
||||
if(c.getType(bX & 0xF, bY, bZ & 0xF).k() == replacee.getId())
|
||||
{
|
||||
c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId());
|
||||
}
|
||||
@ -83,9 +84,9 @@ 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_6_R3.Chunk c = ((CraftChunk)chunk).getHandle();
|
||||
net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)chunk).getHandle();
|
||||
|
||||
c.a(x & 0xF, y, z & 0xF, id, data);
|
||||
c.a(x & 0xF, y, z & 0xF, Block.e(id), data);
|
||||
((CraftWorld)world).getHandle().notify(x, y, z);
|
||||
}
|
||||
|
||||
@ -128,16 +129,16 @@ public class MapUtil
|
||||
return totalHeight / count;
|
||||
}
|
||||
|
||||
public static void ResendChunksForNearbyPlayers(Collection<net.minecraft.server.v1_6_R3.Chunk> chunks)
|
||||
public static void ResendChunksForNearbyPlayers(Collection<net.minecraft.server.v1_7_R1.Chunk> chunks)
|
||||
{
|
||||
for (net.minecraft.server.v1_6_R3.Chunk c : chunks)
|
||||
for (net.minecraft.server.v1_7_R1.Chunk c : chunks)
|
||||
{
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
Vector pV = player.getLocation().toVector();
|
||||
int xDist = Math.abs((pV.getBlockX() >> 4) - c.x);
|
||||
int zDist = Math.abs((pV.getBlockZ() >> 4) - c.z);
|
||||
int xDist = Math.abs((pV.getBlockX() >> 4) - c.locX);
|
||||
int zDist = Math.abs((pV.getBlockZ() >> 4) - c.locZ);
|
||||
|
||||
if (xDist + zDist <= 12)
|
||||
{
|
||||
@ -147,32 +148,33 @@ public class MapUtil
|
||||
}
|
||||
}
|
||||
|
||||
public static net.minecraft.server.v1_6_R3.Chunk ChunkBlockChange(Location location, int id, byte data)
|
||||
public static net.minecraft.server.v1_7_R1.Chunk ChunkBlockChange(Location location, int id, byte data)
|
||||
{
|
||||
return ChunkBlockChange(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, data);
|
||||
}
|
||||
|
||||
public static net.minecraft.server.v1_6_R3.Chunk ChunkBlockChange(World world, int x, int y, int z, int id, byte data)
|
||||
public static net.minecraft.server.v1_7_R1.Chunk ChunkBlockChange(World world, int x, int y, int z, int id, byte data)
|
||||
{
|
||||
net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)world.getChunkAt(x >> 4, z >> 4)).getHandle();
|
||||
|
||||
net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)world.getChunkAt(x >> 4, z >> 4)).getHandle();
|
||||
Block block = Block.e(id);
|
||||
|
||||
x = x & 0xF;
|
||||
z = z & 0xF;
|
||||
|
||||
int l1 = c.getTypeId(x, y, z);
|
||||
int l1 = c.getType(x, y, z).k();
|
||||
int i2 = c.getData(x, y, z);
|
||||
|
||||
ChunkSection chunksection = c.i()[(y >> 4)];
|
||||
ChunkSection chunksection = c.i()[(y >> 4)] == null ? new ChunkSection(y >> 4 << 4, !c.world.worldProvider.g) : c.i()[(y >> 4)];
|
||||
|
||||
int j2 = c.x * 16 + x;
|
||||
int k2 = c.z * 16 + z;
|
||||
int j2 = c.locX * 16 + x;
|
||||
int k2 = c.locZ * 16 + z;
|
||||
|
||||
if ((l1 != 0) && (!c.world.isStatic))
|
||||
Block.byId[l1].l(c.world, j2, y, k2, i2);
|
||||
Block.e(l1).f(c.world, j2, y, k2, i2);
|
||||
|
||||
chunksection.setTypeId(x, y & 0xF, z, block);
|
||||
|
||||
chunksection.setTypeId(x, y & 0xF, z, id);
|
||||
|
||||
if (chunksection.getTypeId(x, y & 0xF, z) != id)
|
||||
if (chunksection.getTypeId(x, y & 0xF, z) != block)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -182,9 +184,9 @@ public class MapUtil
|
||||
return c;
|
||||
}
|
||||
|
||||
public static void SendChunkForPlayer(net.minecraft.server.v1_6_R3.Chunk chunk, Player player)
|
||||
public static void SendChunkForPlayer(net.minecraft.server.v1_7_R1.Chunk chunk, Player player)
|
||||
{
|
||||
SendChunkForPlayer(chunk.x, chunk.z, player);
|
||||
SendChunkForPlayer(chunk.locX, chunk.locZ, player);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -198,7 +200,7 @@ public class MapUtil
|
||||
public static void SendMultiBlockForPlayer(int x, int z, short[] dirtyBlocks, int dirtyCount, World world, Player player)
|
||||
{
|
||||
//System.out.println("Sending MultiBlockChunk " + x + ", " + z);
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet52MultiBlockChange(x, z, dirtyBlocks, dirtyCount, ((CraftWorld)world).getHandle()));
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutMultiBlockChange(dirtyCount, dirtyBlocks, ((CraftWorld)world).getHandle().getChunkAt(x, z)));
|
||||
}
|
||||
|
||||
public static void UnloadWorld(JavaPlugin plugin, World world)
|
||||
@ -215,11 +217,11 @@ public class MapUtil
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld)world).getHandle().getWorld()));
|
||||
|
||||
Iterator<net.minecraft.server.v1_6_R3.Chunk> chunkIterator = ((CraftWorld)world).getHandle().chunkProviderServer.chunks.values().iterator();
|
||||
Iterator<net.minecraft.server.v1_7_R1.Chunk> chunkIterator = ((CraftWorld)world).getHandle().chunkProviderServer.chunks.values().iterator();
|
||||
|
||||
while (chunkIterator.hasNext())
|
||||
{
|
||||
net.minecraft.server.v1_6_R3.Chunk chunk = chunkIterator.next();
|
||||
net.minecraft.server.v1_7_R1.Chunk chunk = chunkIterator.next();
|
||||
chunk.removeEntities();
|
||||
}
|
||||
|
||||
@ -273,10 +275,10 @@ public class MapUtil
|
||||
|
||||
try
|
||||
{
|
||||
Field a = net.minecraft.server.v1_6_R3.RegionFileCache.class.getDeclaredField("a");
|
||||
Field a = net.minecraft.server.v1_7_R1.RegionFileCache.class.getDeclaredField("a");
|
||||
a.setAccessible(true);
|
||||
regionfiles = (HashMap) a.get(null);
|
||||
rafField = net.minecraft.server.v1_6_R3.RegionFile.class.getDeclaredField("c");
|
||||
rafField = net.minecraft.server.v1_7_R1.RegionFile.class.getDeclaredField("c");
|
||||
rafField.setAccessible(true);
|
||||
}
|
||||
catch (Throwable t)
|
||||
|
@ -3,17 +3,17 @@ package mineplex.core.common.util;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet205ClientCommand;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet29DestroyEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
import net.minecraft.server.v1_7_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayInClientCommand;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -32,8 +32,8 @@ public class UtilDisplay
|
||||
}
|
||||
|
||||
//Accessing packets
|
||||
public static Packet24MobSpawn getMobPacket(String text, double healthPercent, Location loc){
|
||||
Packet24MobSpawn mobPacket = new Packet24MobSpawn();
|
||||
public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, double healthPercent, Location loc){
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
|
||||
mobPacket.a = (int) ENTITY_ID; //Entity ID
|
||||
mobPacket.b = (byte) EntityType.ENDER_DRAGON.getTypeId(); //Mob type (ID: 64)
|
||||
@ -49,33 +49,24 @@ public class UtilDisplay
|
||||
|
||||
DataWatcher watcher = getWatcher(text, healthPercent * 200);
|
||||
|
||||
try{
|
||||
Field t = Packet24MobSpawn.class.getDeclaredField("t");
|
||||
|
||||
t.setAccessible(true);
|
||||
t.set(mobPacket, watcher);
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
mobPacket.l = watcher;
|
||||
|
||||
return mobPacket;
|
||||
}
|
||||
|
||||
public static Packet29DestroyEntity getDestroyEntityPacket(){
|
||||
Packet29DestroyEntity packet = new Packet29DestroyEntity();
|
||||
|
||||
packet.a = new int[]{ENTITY_ID};
|
||||
public static PacketPlayOutEntityDestroy getDestroyEntityPacket(){
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(ENTITY_ID);
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static Packet40EntityMetadata getMetadataPacket(DataWatcher watcher){
|
||||
Packet40EntityMetadata metaPacket = new Packet40EntityMetadata();
|
||||
public static PacketPlayOutEntityMetadata getMetadataPacket(DataWatcher watcher){
|
||||
PacketPlayOutEntityMetadata metaPacket = new PacketPlayOutEntityMetadata();
|
||||
|
||||
metaPacket.a = (int) ENTITY_ID;
|
||||
|
||||
try{
|
||||
Field b = Packet40EntityMetadata.class.getDeclaredField("b");
|
||||
Field b = PacketPlayOutEntityMetadata.class.getDeclaredField("b");
|
||||
|
||||
b.setAccessible(true);
|
||||
b.set(metaPacket, watcher.c());
|
||||
@ -86,16 +77,8 @@ public class UtilDisplay
|
||||
return metaPacket;
|
||||
}
|
||||
|
||||
public static Packet205ClientCommand getRespawnPacket(){
|
||||
Packet205ClientCommand packet = new Packet205ClientCommand();
|
||||
|
||||
packet.a = (int) 1;
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static DataWatcher getWatcher(String text, double health){
|
||||
DataWatcher watcher = new DataWatcher();
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
|
||||
watcher.a(0, (Byte) (byte) 0x20); //Flags, 0x20 = invisible
|
||||
watcher.a(6, (Float) (float) health);
|
||||
@ -109,7 +92,7 @@ public class UtilDisplay
|
||||
//Other methods
|
||||
public static void displayTextBar(JavaPlugin plugin, final Player player, double healthPercent, String text)
|
||||
{
|
||||
Packet24MobSpawn mobPacket = getMobPacket(text, healthPercent, player.getLocation());
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, healthPercent, player.getLocation());
|
||||
|
||||
sendPacket(player, mobPacket);
|
||||
hasHealthBar.put(player.getName(), true);
|
||||
@ -117,7 +100,7 @@ public class UtilDisplay
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
Packet29DestroyEntity destroyEntityPacket = getDestroyEntityPacket();
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
hasHealthBar.put(player.getName(), false);
|
||||
@ -126,7 +109,7 @@ public class UtilDisplay
|
||||
}
|
||||
|
||||
public static void displayLoadingBar(final String text, final String completeText, final Player player, final int healthAdd, final long delay, final boolean loadUp, final JavaPlugin plugin){
|
||||
Packet24MobSpawn mobPacket = getMobPacket(text, 0, player.getLocation());
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, 0, player.getLocation());
|
||||
|
||||
sendPacket(player, mobPacket);
|
||||
hasHealthBar.put(player.getName(), true);
|
||||
@ -138,7 +121,7 @@ public class UtilDisplay
|
||||
public void run(){
|
||||
if((loadUp ? health < 200 : health > 0)){
|
||||
DataWatcher watcher = getWatcher(text, health);
|
||||
Packet40EntityMetadata metaPacket = getMetadataPacket(watcher);
|
||||
PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
|
||||
|
||||
sendPacket(player, metaPacket);
|
||||
|
||||
@ -149,28 +132,28 @@ public class UtilDisplay
|
||||
}
|
||||
} else {
|
||||
DataWatcher watcher = getWatcher(text, (loadUp ? 200 : 0));
|
||||
Packet40EntityMetadata metaPacket = getMetadataPacket(watcher);
|
||||
Packet29DestroyEntity destroyEntityPacket = getDestroyEntityPacket();
|
||||
PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher);
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, metaPacket);
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
hasHealthBar.put(player.getName(), false);
|
||||
|
||||
//Complete text
|
||||
Packet24MobSpawn mobPacket = getMobPacket(completeText, 100, player.getLocation());
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, 100, player.getLocation());
|
||||
|
||||
sendPacket(player, mobPacket);
|
||||
hasHealthBar.put(player.getName(), true);
|
||||
|
||||
DataWatcher watcher2 = getWatcher(completeText, 200);
|
||||
Packet40EntityMetadata metaPacket2 = getMetadataPacket(watcher2);
|
||||
PacketPlayOutEntityMetadata metaPacket2 = getMetadataPacket(watcher2);
|
||||
|
||||
sendPacket(player, metaPacket2);
|
||||
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
Packet29DestroyEntity destroyEntityPacket = getDestroyEntityPacket();
|
||||
PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket();
|
||||
|
||||
sendPacket(player, destroyEntityPacket);
|
||||
hasHealthBar.put(player.getName(), false);
|
||||
|
@ -4,33 +4,33 @@ import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EntityBat;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_6_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_7_R1.EntityBat;
|
||||
import net.minecraft.server.v1_7_R1.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R1.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_7_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalMoveTowardsRestriction;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalSelector;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
|
||||
public class UtilEnt
|
||||
{
|
||||
|
@ -3,10 +3,10 @@ package mineplex.core.common.util;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import net.minecraft.server.v1_6_R3.Packet63WorldParticles;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UtilParticle
|
||||
@ -57,7 +57,7 @@ public class UtilParticle
|
||||
|
||||
public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count)
|
||||
{
|
||||
Packet63WorldParticles packet = new Packet63WorldParticles();
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
|
||||
|
||||
for (Field field : packet.getClass().getDeclaredFields())
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Chunk;
|
||||
import net.minecraft.server.v1_7_R1.Chunk;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -2,22 +2,23 @@ package mineplex.core.common.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.ConvertProgressUpdater;
|
||||
import net.minecraft.server.v1_6_R3.Convertable;
|
||||
import net.minecraft.server.v1_6_R3.EntityTracker;
|
||||
import net.minecraft.server.v1_6_R3.EnumGamemode;
|
||||
import net.minecraft.server.v1_6_R3.IWorldAccess;
|
||||
import net.minecraft.server.v1_6_R3.ServerNBTManager;
|
||||
import net.minecraft.server.v1_6_R3.WorldLoaderServer;
|
||||
import net.minecraft.server.v1_6_R3.WorldManager;
|
||||
import net.minecraft.server.v1_6_R3.WorldServer;
|
||||
import net.minecraft.server.v1_6_R3.WorldSettings;
|
||||
import net.minecraft.server.v1_6_R3.WorldType;
|
||||
import net.minecraft.server.v1_7_R1.ConvertProgressUpdater;
|
||||
import net.minecraft.server.v1_7_R1.Convertable;
|
||||
import net.minecraft.server.v1_7_R1.EntityTracker;
|
||||
import net.minecraft.server.v1_7_R1.EnumDifficulty;
|
||||
import net.minecraft.server.v1_7_R1.EnumGamemode;
|
||||
import net.minecraft.server.v1_7_R1.IWorldAccess;
|
||||
import net.minecraft.server.v1_7_R1.ServerNBTManager;
|
||||
import net.minecraft.server.v1_7_R1.WorldLoaderServer;
|
||||
import net.minecraft.server.v1_7_R1.WorldManager;
|
||||
import net.minecraft.server.v1_7_R1.WorldServer;
|
||||
import net.minecraft.server.v1_7_R1.WorldSettings;
|
||||
import net.minecraft.server.v1_7_R1.WorldType;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.event.world.WorldInitEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@ -78,7 +79,7 @@ public class WorldUtil
|
||||
} while(used);
|
||||
boolean hardcore = false;
|
||||
|
||||
WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, server.getServer().getLogger(), creator.environment(), generator);
|
||||
WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator);
|
||||
|
||||
boolean containsWorld = false;
|
||||
for (World otherWorld : server.getWorlds())
|
||||
@ -93,10 +94,13 @@ public class WorldUtil
|
||||
if (!containsWorld)
|
||||
return null;
|
||||
|
||||
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 = 1;
|
||||
internal.difficulty = EnumDifficulty.HARD;
|
||||
internal.setSpawnFlags(true, true);
|
||||
server.getServer().worlds.add(internal);
|
||||
|
||||
|
@ -8,7 +8,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -32,7 +32,7 @@ public class Blood extends MiniPlugin
|
||||
@EventHandler
|
||||
public void Death(PlayerDeathEvent event)
|
||||
{
|
||||
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT, 1f, 1f, Material.INK_SACK, (byte)1, true);
|
||||
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT_FLESH, 1f, 1f, Material.INK_SACK, (byte)1, true);
|
||||
}
|
||||
|
||||
public void Effects(Location loc, int particles, double velMult, Sound sound,
|
||||
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -5,25 +5,26 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.ChunkAddEntityEvent;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet18ArmAnimation;
|
||||
import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_6_R3.Packet29DestroyEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet31RelEntityMove;
|
||||
import net.minecraft.server.v1_6_R3.Packet33RelEntityMoveLook;
|
||||
import net.minecraft.server.v1_6_R3.Packet34EntityTeleport;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
import net.minecraft.server.v1_6_R3.Packet44UpdateAttributes;
|
||||
import net.minecraft.server.v1_6_R3.Packet5EntityEquipment;
|
||||
import net.minecraft.server.v1_6_R3.Packet62NamedSoundEffect;
|
||||
import net.minecraft.server.v1_7_R1.ChunkAddEntityEvent;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityVelocity;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMove;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMoveLook;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutUpdateAttributes;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedSoundEffect;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -42,16 +43,16 @@ import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.packethandler.IPacketRunnable;
|
||||
import mineplex.core.packethandler.PacketArrayList;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketVerifier;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
{
|
||||
private NautHashMap<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
|
||||
private NautHashMap<Integer, Packet28EntityVelocity> _movePacketMap = new NautHashMap<Integer, Packet28EntityVelocity>();
|
||||
private NautHashMap<Integer, Packet28EntityVelocity> _moveTempMap = new NautHashMap<Integer, Packet28EntityVelocity>();
|
||||
private NautHashMap<Integer, PacketPlayOutEntityVelocity> _movePacketMap = new NautHashMap<Integer, PacketPlayOutEntityVelocity>();
|
||||
private NautHashMap<Integer, PacketPlayOutEntityVelocity> _moveTempMap = new NautHashMap<Integer, PacketPlayOutEntityVelocity>();
|
||||
private HashSet<Integer> _goingUp = new HashSet<Integer>();
|
||||
private NautHashMap<String, DisguiseBase> _entityDisguiseMap = new NautHashMap<String, DisguiseBase>();
|
||||
private NautHashMap<String, EntityType> _addTempList = new NautHashMap<String, EntityType>();
|
||||
@ -70,13 +71,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
try
|
||||
{
|
||||
_attributesA = Packet44UpdateAttributes.class.getDeclaredField("a");
|
||||
_attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a");
|
||||
_attributesA.setAccessible(true);
|
||||
_soundB = Packet62NamedSoundEffect.class.getDeclaredField("b");
|
||||
_soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b");
|
||||
_soundB.setAccessible(true);
|
||||
_soundC = Packet62NamedSoundEffect.class.getDeclaredField("c");
|
||||
_soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c");
|
||||
_soundC.setAccessible(true);
|
||||
_soundD = Packet62NamedSoundEffect.class.getDeclaredField("d");
|
||||
_soundD = PacketPlayOutNamedSoundEffect.class.getDeclaredField("d");
|
||||
_soundD.setAccessible(true);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
@ -124,7 +125,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
continue;
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(entity.getEntityId()));
|
||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(entity.getEntityId()));
|
||||
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
@ -132,7 +133,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
}
|
||||
else
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(new Packet24MobSpawn(((CraftLivingEntity)entity).getHandle()));
|
||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving(((CraftLivingEntity)entity).getHandle()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +151,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
|
||||
entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(disguise.GetEntityId()));
|
||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntityId()));
|
||||
}
|
||||
|
||||
List<Packet> tempArmor = new ArrayList<Packet>();
|
||||
@ -240,7 +241,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
continue;
|
||||
|
||||
if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0)
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet34EntityTeleport(((CraftPlayer)otherPlayer).getHandle()));
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(((CraftPlayer)otherPlayer).getHandle()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,35 +264,35 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(Packet packet, Player owner, final PacketArrayList packetList)
|
||||
public boolean run(final Packet packet, Player owner, final PacketVerifier packetList)
|
||||
{
|
||||
if (packet instanceof Packet20NamedEntitySpawn)
|
||||
if (packet instanceof PacketPlayOutNamedEntitySpawn)
|
||||
{
|
||||
int entityId = ((Packet20NamedEntitySpawn)packet).a;
|
||||
int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId))
|
||||
{
|
||||
packetList.forceAdd(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
||||
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet24MobSpawn)
|
||||
else if (packet instanceof PacketPlayOutSpawnEntity)
|
||||
{
|
||||
int entityId = ((Packet24MobSpawn)packet).a;
|
||||
int entityId = ((PacketPlayOutSpawnEntity)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId))
|
||||
{
|
||||
packetList.forceAdd(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
||||
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet44UpdateAttributes)
|
||||
else if (packet instanceof PacketPlayOutUpdateAttributes)
|
||||
{
|
||||
int entityId = -1;
|
||||
|
||||
try
|
||||
{
|
||||
entityId = (int)_attributesA.get((Packet44UpdateAttributes)packet);
|
||||
entityId = (int)_attributesA.get((PacketPlayOutUpdateAttributes)packet);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@ -309,40 +310,40 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet18ArmAnimation)
|
||||
else if (packet instanceof PacketPlayOutAnimation)
|
||||
{
|
||||
int entityId = ((Packet18ArmAnimation)packet).a;
|
||||
int entityId = ((PacketPlayOutAnimation)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet40EntityMetadata)
|
||||
else if (packet instanceof PacketPlayOutEntityMetadata)
|
||||
{
|
||||
int entityId = ((Packet40EntityMetadata)packet).a;
|
||||
int entityId = ((PacketPlayOutEntityMetadata)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
|
||||
{
|
||||
packetList.forceAdd(_spawnPacketMap.get(entityId).GetMetaDataPacket());
|
||||
packetList.forceProcess(_spawnPacketMap.get(entityId).GetMetaDataPacket());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet5EntityEquipment)
|
||||
else if (packet instanceof PacketPlayOutEntityEquipment)
|
||||
{
|
||||
int entityId = ((Packet5EntityEquipment)packet).a;
|
||||
int entityId = ((PacketPlayOutEntityEquipment)packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient)
|
||||
{
|
||||
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((Packet5EntityEquipment)packet).b != 0)
|
||||
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet28EntityVelocity)
|
||||
else if (packet instanceof PacketPlayOutEntityVelocity)
|
||||
{
|
||||
Packet28EntityVelocity velocityPacket = (Packet28EntityVelocity)packet;
|
||||
PacketPlayOutEntityVelocity velocityPacket = (PacketPlayOutEntityVelocity)packet;
|
||||
|
||||
// Only for viewers
|
||||
if (velocityPacket.a == owner.getEntityId())
|
||||
@ -359,9 +360,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet31RelEntityMove)
|
||||
else if (packet instanceof PacketPlayOutRelEntityMove)
|
||||
{
|
||||
final Packet31RelEntityMove movePacket = (Packet31RelEntityMove)packet;
|
||||
final PacketPlayOutRelEntityMove movePacket = (PacketPlayOutRelEntityMove)packet;
|
||||
|
||||
// Only for viewers
|
||||
if (movePacket.a == owner.getEntityId())
|
||||
@ -376,7 +377,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
if (!_spawnPacketMap.containsKey(movePacket.a))
|
||||
return true;
|
||||
|
||||
final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity();
|
||||
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
|
||||
velocityPacket.a = movePacket.a;
|
||||
velocityPacket.b = movePacket.b * 100;
|
||||
velocityPacket.c = movePacket.c * 100;
|
||||
@ -384,7 +385,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
if (_movePacketMap.containsKey(movePacket.a))
|
||||
{
|
||||
Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
|
||||
PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
|
||||
|
||||
velocityPacket.b = (int) (.8 * lastVelocityPacket.b);
|
||||
velocityPacket.c = (int) (.8 * lastVelocityPacket.c);
|
||||
@ -393,7 +394,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
_movePacketMap.put(movePacket.a, velocityPacket);
|
||||
|
||||
packetList.forceAdd(velocityPacket);
|
||||
packetList.forceProcess(velocityPacket);
|
||||
|
||||
if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20)
|
||||
{
|
||||
@ -401,7 +402,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
packetList.forceAdd(velocityPacket);
|
||||
packetList.forceProcess(velocityPacket);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -411,9 +412,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet33RelEntityMoveLook)
|
||||
else if (packet instanceof PacketPlayOutRelEntityMoveLook)
|
||||
{
|
||||
final Packet33RelEntityMoveLook movePacket = (Packet33RelEntityMoveLook)packet;
|
||||
final PacketPlayOutRelEntityMoveLook movePacket = (PacketPlayOutRelEntityMoveLook)packet;
|
||||
|
||||
// Only for viewers
|
||||
if (movePacket.a == owner.getEntityId())
|
||||
@ -428,7 +429,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
if (!_spawnPacketMap.containsKey(movePacket.a))
|
||||
return true;
|
||||
|
||||
final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity();
|
||||
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
|
||||
velocityPacket.a = movePacket.a;
|
||||
velocityPacket.b = movePacket.b * 100;
|
||||
velocityPacket.c = movePacket.c * 100;
|
||||
@ -436,7 +437,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
if (_movePacketMap.containsKey(movePacket.a))
|
||||
{
|
||||
Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
|
||||
PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a);
|
||||
|
||||
velocityPacket.b = (int) (.8 * lastVelocityPacket.b);
|
||||
velocityPacket.c = (int) (.8 * lastVelocityPacket.c);
|
||||
@ -445,7 +446,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
|
||||
_movePacketMap.put(movePacket.a, velocityPacket);
|
||||
|
||||
packetList.forceAdd(velocityPacket);
|
||||
packetList.forceProcess(velocityPacket);
|
||||
|
||||
if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20)
|
||||
{
|
||||
@ -453,18 +454,18 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
packetList.forceAdd(velocityPacket);
|
||||
packetList.forceProcess(velocityPacket);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (packet instanceof Packet62NamedSoundEffect)
|
||||
else if (packet instanceof PacketPlayOutNamedSoundEffect)
|
||||
{
|
||||
try
|
||||
{
|
||||
int x = (int) _soundB.get((Packet62NamedSoundEffect)packet) / 8;
|
||||
int y = (int) _soundC.get((Packet62NamedSoundEffect)packet) / 8;
|
||||
int z = (int) _soundD.get((Packet62NamedSoundEffect)packet) / 8;
|
||||
int x = (int) _soundB.get((PacketPlayOutNamedSoundEffect)packet) / 8;
|
||||
int y = (int) _soundC.get((PacketPlayOutNamedSoundEffect)packet) / 8;
|
||||
int z = (int) _soundD.get((PacketPlayOutNamedSoundEffect)packet) / 8;
|
||||
|
||||
for (DisguiseBase disguise : _spawnPacketMap.values())
|
||||
{
|
||||
|
@ -1,12 +1,13 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_6_R3.Entity;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
import net.minecraft.server.v1_7_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
|
||||
|
||||
public abstract class DisguiseBase
|
||||
{
|
||||
@ -18,7 +19,7 @@ public abstract class DisguiseBase
|
||||
public DisguiseBase(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
Entity = ((CraftEntity)entity).getHandle();
|
||||
DataWatcher = new DataWatcher();
|
||||
DataWatcher = new DataWatcher(new DummyEntity(((CraftWorld)entity.getWorld()).getHandle()));
|
||||
|
||||
DataWatcher.a(0, Byte.valueOf((byte)0));
|
||||
DataWatcher.a(1, Short.valueOf((short)300));
|
||||
@ -42,7 +43,7 @@ public abstract class DisguiseBase
|
||||
public Packet GetMetaDataPacket()
|
||||
{
|
||||
UpdateDataWatcher();
|
||||
return new Packet40EntityMetadata(Entity.id, DataWatcher, true);
|
||||
return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true);
|
||||
}
|
||||
|
||||
public void setSoundDisguise(DisguiseBase soundDisguise)
|
||||
@ -75,7 +76,7 @@ public abstract class DisguiseBase
|
||||
|
||||
public int GetEntityId()
|
||||
{
|
||||
return Entity.id;
|
||||
return Entity.getId();
|
||||
}
|
||||
|
||||
protected abstract String getHurtSound();
|
||||
|
@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
|
||||
|
||||
public class DisguiseBlock extends DisguiseBase
|
||||
{
|
||||
@ -34,8 +34,8 @@ public class DisguiseBlock extends DisguiseBase
|
||||
@Override
|
||||
public Packet GetSpawnPacket()
|
||||
{
|
||||
Packet23VehicleSpawn packet = new Packet23VehicleSpawn();
|
||||
packet.a = Entity.id;
|
||||
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = MathHelper.floor(Entity.locX * 32.0D);
|
||||
packet.c = MathHelper.floor(Entity.locY * 32.0D);
|
||||
packet.d = MathHelper.floor(Entity.locZ * 32.0D);
|
||||
|
@ -1,31 +1,23 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EnumEntitySize;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_7_R1.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
public abstract class DisguiseCreature extends DisguiseInsentient
|
||||
{
|
||||
private static Field _spawnDataWatcherField;
|
||||
private static Field _spawnListField;
|
||||
|
||||
public DisguiseCreature(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
|
||||
SetSpawnDataWatcherField();
|
||||
SetSpawnListField();
|
||||
}
|
||||
|
||||
protected abstract int GetEntityTypeId();
|
||||
|
||||
public Packet GetSpawnPacket()
|
||||
{
|
||||
Packet24MobSpawn packet = new Packet24MobSpawn();
|
||||
packet.a = Entity.id;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = (byte) GetEntityTypeId();
|
||||
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
|
||||
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
||||
@ -73,72 +65,9 @@ public abstract class DisguiseCreature extends DisguiseInsentient
|
||||
packet.g = (int)(var6 * 8000.0D);
|
||||
packet.h = (int)(var8 * 8000.0D);
|
||||
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField.set(packet, DataWatcher);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_spawnListField.set(packet, DataWatcher.b());
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
packet.l = DataWatcher;
|
||||
packet.m = DataWatcher.b();
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
private void SetSpawnListField()
|
||||
{
|
||||
if (_spawnListField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
|
||||
_spawnListField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSpawnDataWatcherField()
|
||||
{
|
||||
if (_spawnDataWatcherField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
|
||||
_spawnDataWatcherField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.MobEffect;
|
||||
import net.minecraft.server.v1_6_R3.MobEffectList;
|
||||
import net.minecraft.server.v1_6_R3.PotionBrewer;
|
||||
import net.minecraft.server.v1_7_R1.MobEffect;
|
||||
import net.minecraft.server.v1_7_R1.MobEffectList;
|
||||
import net.minecraft.server.v1_7_R1.PotionBrewer;
|
||||
|
||||
public class DisguiseEnderman extends DisguiseMonster
|
||||
{
|
||||
|
@ -3,8 +3,8 @@ package mineplex.core.disguise.disguises;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet5EntityEquipment;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment;
|
||||
|
||||
public abstract class DisguiseInsentient extends DisguiseLiving
|
||||
{
|
||||
@ -55,16 +55,16 @@ public abstract class DisguiseInsentient extends DisguiseLiving
|
||||
|
||||
public List<Packet> getArmorPackets()
|
||||
{
|
||||
List<Packet5EntityEquipment> p5 = new ArrayList<Packet5EntityEquipment>();
|
||||
net.minecraft.server.v1_6_R3.ItemStack[] armorContents = Entity.getEquipment();
|
||||
List<PacketPlayOutEntityEquipment> p5 = new ArrayList<PacketPlayOutEntityEquipment>();
|
||||
net.minecraft.server.v1_7_R1.ItemStack[] armorContents = Entity.getEquipment();
|
||||
|
||||
for (short i=0; i < armorContents.length; i++)
|
||||
{
|
||||
net.minecraft.server.v1_6_R3.ItemStack armorSlot = armorContents[i];
|
||||
net.minecraft.server.v1_7_R1.ItemStack armorSlot = armorContents[i];
|
||||
|
||||
if (armorSlot != null)
|
||||
{
|
||||
p5.add(new Packet5EntityEquipment(Entity.id, i, armorSlot));
|
||||
p5.add(new PacketPlayOutEntityEquipment(Entity.getId(), i, armorSlot));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,25 +1,17 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EnumEntitySize;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_7_R1.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
public class DisguiseMagmaCube extends DisguiseInsentient
|
||||
{
|
||||
private static Field _spawnDataWatcherField;
|
||||
private static Field _spawnListField;
|
||||
|
||||
public DisguiseMagmaCube(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
|
||||
DataWatcher.a(16, new Byte((byte)1));
|
||||
|
||||
SetSpawnDataWatcherField();
|
||||
SetSpawnListField();
|
||||
}
|
||||
|
||||
public void SetSize(int i)
|
||||
@ -34,8 +26,8 @@ public class DisguiseMagmaCube extends DisguiseInsentient
|
||||
|
||||
public Packet GetSpawnPacket()
|
||||
{
|
||||
Packet24MobSpawn packet = new Packet24MobSpawn();
|
||||
packet.a = Entity.id;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = (byte) 62;
|
||||
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
|
||||
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
||||
@ -83,75 +75,12 @@ public class DisguiseMagmaCube extends DisguiseInsentient
|
||||
packet.g = (int)(var6 * 8000.0D);
|
||||
packet.h = (int)(var8 * 8000.0D);
|
||||
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField.set(packet, DataWatcher);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_spawnListField.set(packet, DataWatcher.b());
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
packet.l = DataWatcher;
|
||||
packet.m = DataWatcher.b();
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
private void SetSpawnListField()
|
||||
{
|
||||
if (_spawnListField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
|
||||
_spawnListField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSpawnDataWatcherField()
|
||||
{
|
||||
if (_spawnDataWatcherField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
|
||||
_spawnDataWatcherField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
|
||||
|
@ -15,6 +15,6 @@ public class DisguisePig extends DisguiseAnimal
|
||||
|
||||
public String getHurtSound()
|
||||
{
|
||||
return "mob.pig.hurt";
|
||||
return "mob.pig.say";
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
public class DisguisePlayer extends DisguiseHuman
|
||||
{
|
||||
private static Field _spawnDataWatcherField;
|
||||
|
||||
private String _name;
|
||||
|
||||
public DisguisePlayer(org.bukkit.entity.Entity entity, String name)
|
||||
@ -22,55 +19,21 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
}
|
||||
|
||||
_name = name;
|
||||
|
||||
SetSpawnDataWatcherField();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet GetSpawnPacket()
|
||||
{
|
||||
Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn();
|
||||
packet.a = Entity.id;
|
||||
packet.b = _name;
|
||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = new GameProfile("1", _name);
|
||||
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
||||
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
||||
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
||||
packet.f = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||
packet.g = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
|
||||
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField.set(packet, DataWatcher);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
packet.i = DataWatcher;
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
private void SetSpawnDataWatcherField()
|
||||
{
|
||||
if (_spawnDataWatcherField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i");
|
||||
_spawnDataWatcherField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,17 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EnumEntitySize;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_7_R1.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
public class DisguiseSlime extends DisguiseInsentient
|
||||
{
|
||||
private static Field _spawnDataWatcherField;
|
||||
private static Field _spawnListField;
|
||||
|
||||
public DisguiseSlime(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
|
||||
DataWatcher.a(16, new Byte((byte)1));
|
||||
|
||||
SetSpawnDataWatcherField();
|
||||
SetSpawnListField();
|
||||
}
|
||||
|
||||
public void SetSize(int i)
|
||||
@ -34,8 +26,8 @@ public class DisguiseSlime extends DisguiseInsentient
|
||||
|
||||
public Packet GetSpawnPacket()
|
||||
{
|
||||
Packet24MobSpawn packet = new Packet24MobSpawn();
|
||||
packet.a = Entity.id;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = (byte) 55;
|
||||
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
|
||||
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
||||
@ -82,76 +74,12 @@ public class DisguiseSlime extends DisguiseInsentient
|
||||
packet.f = (int)(var4 * 8000.0D);
|
||||
packet.g = (int)(var6 * 8000.0D);
|
||||
packet.h = (int)(var8 * 8000.0D);
|
||||
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField.set(packet, DataWatcher);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_spawnListField.set(packet, DataWatcher.b());
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
packet.l = DataWatcher;
|
||||
packet.m = DataWatcher.b();
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
private void SetSpawnListField()
|
||||
{
|
||||
if (_spawnListField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
|
||||
_spawnListField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSpawnDataWatcherField()
|
||||
{
|
||||
if (_spawnDataWatcherField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
|
||||
_spawnDataWatcherField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
|
||||
|
@ -34,7 +34,7 @@ public class DisguiseSquid extends DisguiseMonster
|
||||
|
||||
protected String getHurtSound()
|
||||
{
|
||||
return null;
|
||||
return "damage.hit";
|
||||
}
|
||||
|
||||
protected float getVolume()
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.BlockCloth;
|
||||
import net.minecraft.server.v1_7_R1.BlockCloth;
|
||||
|
||||
public class DisguiseWolf extends DisguiseTameableAnimal
|
||||
{
|
||||
@ -10,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.j_(1)));
|
||||
DataWatcher.a(20, new Byte((byte)BlockCloth.b(1)));
|
||||
}
|
||||
|
||||
public boolean isAngry()
|
||||
|
@ -0,0 +1,28 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_7_R1.World;
|
||||
|
||||
public class DummyEntity extends Entity
|
||||
{
|
||||
public DummyEntity(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void c()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void a(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void b(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
}
|
||||
}
|
@ -2,17 +2,22 @@ package mineplex.core.fakeEntity;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.BlockCloth;
|
||||
import net.minecraft.server.v1_6_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_6_R3.EnumEntitySize;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet29DestroyEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet39AttachEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
import net.minecraft.server.v1_7_R1.BlockCloth;
|
||||
import net.minecraft.server.v1_7_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R1.Entity;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.EntitySlime;
|
||||
import net.minecraft.server.v1_7_R1.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutAttachEntity;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class FakeEntity
|
||||
@ -63,15 +68,12 @@ public class FakeEntity
|
||||
|
||||
public Packet Destroy()
|
||||
{
|
||||
Packet29DestroyEntity packet = new Packet29DestroyEntity();
|
||||
packet.a = new int[] { GetEntityId() };
|
||||
|
||||
return packet;
|
||||
return new PacketPlayOutEntityDestroy(new int[] { GetEntityId() });
|
||||
}
|
||||
|
||||
public Packet Spawn(int id)
|
||||
{
|
||||
Packet24MobSpawn packet = new Packet24MobSpawn();
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
packet.a = id;
|
||||
packet.b = (byte) _entityType.getTypeId();
|
||||
packet.c = (int)EnumEntitySize.SIZE_2.a(_location.getX());
|
||||
@ -119,8 +121,8 @@ public class FakeEntity
|
||||
packet.f = (int)(var4 * 8000.0D);
|
||||
packet.g = (int)(var6 * 8000.0D);
|
||||
packet.h = (int)(var8 * 8000.0D);
|
||||
|
||||
DataWatcher dataWatcher = new DataWatcher();
|
||||
|
||||
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
|
||||
|
||||
UpdateDataWatcher(dataWatcher);
|
||||
|
||||
@ -160,27 +162,27 @@ public class FakeEntity
|
||||
|
||||
public Packet Hide(int entityId)
|
||||
{
|
||||
DataWatcher dataWatcher = new DataWatcher();
|
||||
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
|
||||
|
||||
UpdateDataWatcher(dataWatcher);
|
||||
|
||||
dataWatcher.watch(0, Byte.valueOf((byte) 32));
|
||||
|
||||
return new Packet40EntityMetadata(entityId, dataWatcher, false);
|
||||
return new PacketPlayOutEntityMetadata(entityId, dataWatcher, false);
|
||||
}
|
||||
|
||||
public Packet Show()
|
||||
{
|
||||
DataWatcher dataWatcher = new DataWatcher();
|
||||
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
|
||||
|
||||
UpdateDataWatcher(dataWatcher);
|
||||
|
||||
return new Packet40EntityMetadata(_entityId, dataWatcher, true);
|
||||
return new PacketPlayOutEntityMetadata(_entityId, dataWatcher, true);
|
||||
}
|
||||
|
||||
public Packet SetVehicle(int vehicleId)
|
||||
{
|
||||
Packet39AttachEntity vehiclePacket = new Packet39AttachEntity();
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
vehiclePacket.b = _entityId;
|
||||
vehiclePacket.c = vehicleId;
|
||||
@ -195,7 +197,7 @@ public class FakeEntity
|
||||
|
||||
public Packet SetPassenger(int passengerId, int entityId)
|
||||
{
|
||||
Packet39AttachEntity vehiclePacket = new Packet39AttachEntity();
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
vehiclePacket.b = passengerId;
|
||||
vehiclePacket.c = entityId;
|
||||
@ -244,7 +246,7 @@ public class FakeEntity
|
||||
case WOLF:
|
||||
dataWatcher.a(18, new Integer(20));
|
||||
dataWatcher.a(19, new Byte((byte) 0));
|
||||
dataWatcher.a(20, new Byte((byte) BlockCloth.j_(1)));
|
||||
dataWatcher.a(20, new Byte((byte) BlockCloth.b(1)));
|
||||
case SKELETON:
|
||||
dataWatcher.a(13, new Byte((byte) 0));
|
||||
break;
|
||||
@ -277,17 +279,15 @@ public class FakeEntity
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnListField = Packet24MobSpawn.class.getDeclaredField("u");
|
||||
_spawnListField = PacketPlayOutSpawnEntityLiving.class.getDeclaredField("m");
|
||||
_spawnListField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -299,19 +299,17 @@ public class FakeEntity
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t");
|
||||
_spawnDataWatcherField = PacketPlayOutSpawnEntityLiving.class.getDeclaredField("l");
|
||||
_spawnDataWatcherField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,9 +3,9 @@ package mineplex.core.fakeEntity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package mineplex.core.fakeEntity;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EnumEntitySize;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn;
|
||||
import net.minecraft.server.v1_7_R1.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -23,7 +23,7 @@ public class FakeFallingBlock extends FakeEntity
|
||||
|
||||
public Packet Spawn(int id)
|
||||
{
|
||||
Packet23VehicleSpawn packet = new Packet23VehicleSpawn();
|
||||
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
|
||||
packet.a = id;
|
||||
packet.b = (int)EnumEntitySize.SIZE_2.a(GetLocation().getX());
|
||||
packet.c = (int)MathHelper.floor(GetLocation().getY() * 32.0D);
|
||||
|
@ -1,13 +1,13 @@
|
||||
package mineplex.core.fakeEntity;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_6_R3.ItemStack;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn;
|
||||
import net.minecraft.server.v1_7_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R1.ItemStack;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class FakeItemDrop extends FakeEntity
|
||||
@ -23,7 +23,7 @@ public class FakeItemDrop extends FakeEntity
|
||||
|
||||
public Packet Spawn()
|
||||
{
|
||||
Packet23VehicleSpawn packet = new Packet23VehicleSpawn();
|
||||
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
|
||||
packet.a = GetEntityId();
|
||||
packet.b = MathHelper.floor(GetLocation().getX() * 32.0D);
|
||||
packet.c = MathHelper.floor(GetLocation().getY() * 32.0D);
|
||||
@ -75,7 +75,7 @@ public class FakeItemDrop extends FakeEntity
|
||||
dataWatcher.a(1, Short.valueOf((short)300));
|
||||
dataWatcher.a(8, Integer.valueOf(0));
|
||||
dataWatcher.a(9, Byte.valueOf((byte) 0));
|
||||
dataWatcher.a(10, new net.minecraft.server.v1_6_R3.ItemStack(_itemStack.getItem(), _itemStack.count));
|
||||
dataWatcher.a(10, new net.minecraft.server.v1_7_R1.ItemStack(_itemStack.getItem(), _itemStack.count));
|
||||
}
|
||||
|
||||
public void SetItemStack(org.bukkit.inventory.ItemStack itemStack)
|
||||
|
@ -2,12 +2,16 @@ package mineplex.core.fakeEntity;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_6_R3.MathHelper;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn;
|
||||
import net.minecraft.server.v1_7_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R1.EntitySlime;
|
||||
import net.minecraft.server.v1_7_R1.MathHelper;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class FakePlayer extends FakeEntity
|
||||
@ -21,55 +25,25 @@ public class FakePlayer extends FakeEntity
|
||||
super(EntityType.PLAYER, location);
|
||||
|
||||
_name = name;
|
||||
|
||||
if (_spawnDataWatcherField == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i");
|
||||
_spawnDataWatcherField.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Packet Spawn(int id)
|
||||
{
|
||||
Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn();
|
||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||
packet.a = id;
|
||||
packet.b = _name;
|
||||
packet.b = new GameProfile("1", _name);
|
||||
packet.c = MathHelper.floor(GetLocation().getX() * 32.0D);
|
||||
packet.d = MathHelper.floor(GetLocation().getY() * 32.0D);
|
||||
packet.e = MathHelper.floor(GetLocation().getZ() * 32.0D);
|
||||
packet.f = (byte) ((int) (GetLocation().getYaw() * 256.0F / 360.0F));
|
||||
packet.g = (byte) ((int) (GetLocation().getPitch() * 256.0F / 360.0F));
|
||||
|
||||
DataWatcher dataWatcher = new DataWatcher();
|
||||
DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle()));
|
||||
|
||||
UpdateDataWatcher(dataWatcher);
|
||||
|
||||
try
|
||||
{
|
||||
_spawnDataWatcherField.set(packet, dataWatcher);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
packet.i = dataWatcher;
|
||||
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
@ -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_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
|
22
Plugins/Mineplex.Core/src/mineplex/core/join/JoinQuit.java
Normal file
22
Plugins/Mineplex.Core/src/mineplex/core/join/JoinQuit.java
Normal file
@ -0,0 +1,22 @@
|
||||
package mineplex.core.join;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
|
||||
public class JoinQuit
|
||||
{
|
||||
@EventHandler
|
||||
public void Join(PlayerJoinEvent event)
|
||||
{
|
||||
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
event.setQuitMessage(F.sys("Quit", event.getPlayer().getName()));
|
||||
}
|
||||
}
|
@ -2,12 +2,12 @@ package mineplex.core.memory;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.IInventory;
|
||||
import net.minecraft.server.v1_7_R1.IInventory;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
@ -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_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package mineplex.core.npc;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R1.EntityCreature;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class NpcEntry
|
||||
|
@ -11,15 +11,15 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EntityAgeable;
|
||||
import net.minecraft.server.v1_6_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R1.EntityAgeable;
|
||||
import net.minecraft.server.v1_7_R1.EntityInsentient;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftAgeable;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftAgeable;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -2,9 +2,9 @@ package mineplex.core.packethandler;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
|
||||
public interface IPacketRunnable
|
||||
{
|
||||
boolean run(Packet packet, Player owner, PacketArrayList packetList);
|
||||
boolean run(Packet packet, Player owner, PacketVerifier packetList);
|
||||
}
|
||||
|
@ -1,161 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_6_R3.Packet31RelEntityMove;
|
||||
import net.minecraft.server.v1_6_R3.Packet33RelEntityMoveLook;
|
||||
import net.minecraft.server.v1_6_R3.Packet34EntityTeleport;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PacketArrayList extends ArrayList<Packet>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Player _owner;
|
||||
private PacketHandler _handler;
|
||||
private Field _packet40Metadata;
|
||||
|
||||
public PacketArrayList(Player owner, PacketHandler handler)
|
||||
{
|
||||
_owner = owner;
|
||||
_handler = handler;
|
||||
|
||||
try
|
||||
{
|
||||
_packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b");
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
_packet40Metadata.setAccessible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Packet o)
|
||||
{
|
||||
/*
|
||||
else if (o instanceof Packet201PlayerInfo)
|
||||
{
|
||||
if (!_handler.IsTracked((Packet201PlayerInfo)o))
|
||||
return false;
|
||||
//if (( && _packetHandler.IsPlayerTracked(((Packet201PlayerInfo)o).a) )
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
}
|
||||
else if (o instanceof Packet40EntityMetadata)
|
||||
{
|
||||
List<WatchableObject> objects = null;
|
||||
try
|
||||
{
|
||||
objects = (List<WatchableObject>)_packet40Metadata.get(((Packet40EntityMetadata)o));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println("Packet40EntityMetadata for " + ((Packet40EntityMetadata)o).a);
|
||||
|
||||
if (objects != null)
|
||||
{
|
||||
for (WatchableObject watched : objects)
|
||||
{
|
||||
System.out.println("a(" + watched.a() + ", " + watched.b() + ") " + GetDataType(watched.c()));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("End Packet40EntityMetadata");
|
||||
}
|
||||
*/
|
||||
if (o instanceof Packet34EntityTeleport)
|
||||
{
|
||||
Packet34EntityTeleport packet = (Packet34EntityTeleport)o;
|
||||
|
||||
//System.out.println("Packet34EntityTeleport (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
return super.add(new Packet34EntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof Packet28EntityVelocity)
|
||||
{
|
||||
Packet28EntityVelocity packet = (Packet28EntityVelocity)o;
|
||||
|
||||
//System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ") for " + packet.a + " to " + _owner.getName());
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
// Occasional velocity sent for player in MK jacks up karts so don't process this.
|
||||
return false;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof Packet31RelEntityMove)
|
||||
{
|
||||
Packet31RelEntityMove packet = (Packet31RelEntityMove)o;
|
||||
|
||||
//System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
return super.add(new Packet31RelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d));
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof Packet33RelEntityMoveLook)
|
||||
{
|
||||
Packet33RelEntityMoveLook packet = (Packet33RelEntityMoveLook)o;
|
||||
|
||||
//System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
return super.add(new Packet33RelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
else if (!(o instanceof Packet206SetScoreboardObjective) && !(o instanceof Packet207SetScoreboardScore) && !(o instanceof Packet208SetScoreboardDisplayObjective) && !(o instanceof Packet56MapChunkBulk) && !(o instanceof Packet0KeepAlive) && !(o instanceof Packet4UpdateTime) && !(o instanceof Packet43SetExperience) && !(o instanceof Packet35EntityHeadRotation) && !(o instanceof Packet32EntityLook))
|
||||
{
|
||||
System.out.println(o.getClass());
|
||||
}
|
||||
*/
|
||||
|
||||
if (_handler.FireRunnables(o, _owner, this))
|
||||
{
|
||||
return forceAdd(o);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean forceAdd(Packet packet)
|
||||
{
|
||||
return super.add(packet);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
_owner = null;
|
||||
_packet40Metadata = null;
|
||||
}
|
||||
}
|
@ -1,18 +1,13 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import net.minecraft.server.v1_6_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -20,12 +15,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@SuppressWarnings( { "rawtypes", "unchecked" } )
|
||||
public class PacketHandler extends MiniPlugin
|
||||
{
|
||||
private Field syncField;
|
||||
private Field highField;
|
||||
|
||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _forwardMap;
|
||||
private NautHashMap<String, HashSet<Integer>> _blockMap;
|
||||
private NautHashMap<String, NautHashMap<Integer, Packet>> _fakeVehicleMap;
|
||||
@ -41,18 +32,6 @@ public class PacketHandler extends MiniPlugin
|
||||
_fakeVehicleMap = new NautHashMap<String, NautHashMap<Integer, Packet>>();
|
||||
_fakePassengerMap = new NautHashMap<String, NautHashMap<Integer, Packet>>();
|
||||
_packetRunnables = new ArrayList<IPacketRunnable>();
|
||||
|
||||
try
|
||||
{
|
||||
this.syncField = NetworkManager.class.getDeclaredField("h");
|
||||
this.syncField.setAccessible(true);
|
||||
this.highField = NetworkManager.class.getDeclaredField("highPriorityQueue");
|
||||
this.highField.setAccessible(true);
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
System.out.println("Error initializing " + GetName() + " NetworkManager fields...");
|
||||
}
|
||||
}
|
||||
|
||||
public String GetDataType(int c)
|
||||
@ -141,27 +120,12 @@ public class PacketHandler extends MiniPlugin
|
||||
|
||||
public void in(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.nom(this.getManager(player), Collections.synchronizedList(new PacketArrayList(player, this)));
|
||||
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
// new TagAPIException("[TagAPI] Failed to inject into networkmanager for " + player.getName(), e).printStackTrace();
|
||||
}
|
||||
((CraftPlayer) player).getHandle().playerConnection.PacketVerifier.addPacketVerifier(new PacketVerifier(player, this));
|
||||
}
|
||||
|
||||
public void out(Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.nom(this.getManager(player), Collections.synchronizedList(new ArrayList()), true);
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
this._plugin.getLogger().log(Level.WARNING, "Failed to restore " + player.getName() + ". Could be a problem.", e);
|
||||
}
|
||||
((CraftPlayer) player).getHandle().playerConnection.PacketVerifier.clearVerifiers();
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
@ -175,48 +139,6 @@ public class PacketHandler extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
private NetworkManager getManager(Player player)
|
||||
{
|
||||
return (NetworkManager) ((CraftPlayer) player).getHandle().playerConnection.networkManager;
|
||||
}
|
||||
|
||||
private void nom(NetworkManager nm, List list) throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
this.nom(nm, list, false);
|
||||
}
|
||||
|
||||
private void nom(NetworkManager nm, List list, boolean onlyIfOldIsHacked) throws IllegalArgumentException, IllegalAccessException
|
||||
{
|
||||
final List old = (List) this.highField.get(nm);
|
||||
boolean copy = true;
|
||||
|
||||
if (onlyIfOldIsHacked)
|
||||
{
|
||||
if (!(old instanceof PacketArrayList))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
copy = false;
|
||||
((PacketArrayList)old).Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (this.syncField.get(nm))
|
||||
{
|
||||
if (copy)
|
||||
{
|
||||
for (final Object object : old)
|
||||
{
|
||||
list.add(object);
|
||||
}
|
||||
}
|
||||
|
||||
this.highField.set(nm, list);
|
||||
}
|
||||
}
|
||||
|
||||
public void ForwardMovement(Player viewer, int travellerId, int entityId)
|
||||
{
|
||||
if (!_forwardMap.containsKey(viewer.getName()))
|
||||
@ -278,7 +200,7 @@ public class PacketHandler extends MiniPlugin
|
||||
_forwardMap.remove(viewer.getName());
|
||||
}
|
||||
|
||||
public boolean FireRunnables(Packet o, Player owner, PacketArrayList packetList)
|
||||
public boolean FireRunnables(Packet o, Player owner, PacketVerifier packetList)
|
||||
{
|
||||
boolean addOriginal = true;
|
||||
|
||||
|
@ -0,0 +1,97 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import net.minecraft.server.v1_7_R1.IPacketVerifier;
|
||||
import net.minecraft.server.v1_7_R1.Packet;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityVelocity;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMove;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMoveLook;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PacketVerifier implements IPacketVerifier
|
||||
{
|
||||
private Player _owner;
|
||||
private PacketHandler _handler;
|
||||
|
||||
public PacketVerifier(Player owner, PacketHandler handler)
|
||||
{
|
||||
_owner = owner;
|
||||
_handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verify(Packet o)
|
||||
{
|
||||
if (o instanceof PacketPlayOutEntityTeleport)
|
||||
{
|
||||
PacketPlayOutEntityTeleport packet = (PacketPlayOutEntityTeleport)o;
|
||||
|
||||
//System.out.println("Packet34EntityTeleport (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
forceProcess(new PacketPlayOutEntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
|
||||
return true;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof PacketPlayOutEntityVelocity)
|
||||
{
|
||||
PacketPlayOutEntityVelocity packet = (PacketPlayOutEntityVelocity)o;
|
||||
|
||||
//System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ") for " + packet.a + " to " + _owner.getName());
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
// Occasional velocity sent for player in MK jacks up karts so don't process this.
|
||||
return false;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof PacketPlayOutRelEntityMove)
|
||||
{
|
||||
PacketPlayOutRelEntityMove packet = (PacketPlayOutRelEntityMove)o;
|
||||
|
||||
//System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
forceProcess(new PacketPlayOutRelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d));
|
||||
return true;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
else if (o instanceof PacketPlayOutRelEntityMoveLook)
|
||||
{
|
||||
PacketPlayOutRelEntityMoveLook packet = (PacketPlayOutRelEntityMoveLook)o;
|
||||
|
||||
//System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")");
|
||||
|
||||
if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a))
|
||||
{
|
||||
forceProcess(new PacketPlayOutRelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f));
|
||||
return true;
|
||||
}
|
||||
else if (_handler.IsBlocked(_owner, packet.a))
|
||||
return false;
|
||||
}
|
||||
|
||||
return _handler.FireRunnables(o, _owner, this);
|
||||
}
|
||||
|
||||
public void forceProcess(Packet packet)
|
||||
{
|
||||
((CraftPlayer)_owner).getHandle().playerConnection.networkManager.handle(packet, new GenericFutureListener[0]);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
_owner = null;
|
||||
}
|
||||
}
|
@ -16,13 +16,14 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_6_R3.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_7_R1.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_7_R1.PathfinderGoalSelector;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -32,8 +33,8 @@ 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_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -4,13 +4,15 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.Item;
|
||||
import net.minecraft.server.v1_6_R3.Packet100OpenWindow;
|
||||
import net.minecraft.server.v1_6_R3.Packet103SetSlot;
|
||||
import net.minecraft.server.v1_7_R1.Block;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.Item;
|
||||
import net.minecraft.server.v1_7_R1.Items;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutOpenWindow;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutSetSlot;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -110,11 +112,11 @@ public class PetPage extends ShopPageBase<PetManager, PetShop>
|
||||
PetTagPage petTagPage = new PetTagPage(Plugin, Shop, ClientManager, DonationManager, "Repairing", Player, pet, petPurchase);
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)Player).getHandle();
|
||||
int containerCounter = entityPlayer.nextContainerCounter();
|
||||
entityPlayer.playerConnection.sendPacket(new Packet100OpenWindow(containerCounter, 8, "Repairing", 9, true));
|
||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 9, true));
|
||||
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
|
||||
entityPlayer.activeContainer.windowId = containerCounter;
|
||||
entityPlayer.activeContainer.addSlotListener(entityPlayer);
|
||||
entityPlayer.playerConnection.sendPacket(new Packet103SetSlot(containerCounter, 0, new net.minecraft.server.v1_6_R3.ItemStack(Item.NAME_TAG)));
|
||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R1.ItemStack(Items.NAME_TAG)));
|
||||
|
||||
Shop.SetCurrentPageForPlayer(Player, petTagPage);
|
||||
}
|
||||
|
@ -14,8 +14,9 @@ import mineplex.core.pet.repository.token.PetChangeToken;
|
||||
import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import net.minecraft.server.v1_6_R3.Item;
|
||||
import net.minecraft.server.v1_6_R3.ItemStack;
|
||||
import net.minecraft.server.v1_7_R1.Item;
|
||||
import net.minecraft.server.v1_7_R1.ItemStack;
|
||||
import net.minecraft.server.v1_7_R1.Items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -42,7 +43,7 @@ public class PetTagPage extends ShopPageBase<PetManager, PetShop>
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
inventory.setItem(0, new ItemStack(Item.NAME_TAG));
|
||||
inventory.setItem(0, new ItemStack(Items.NAME_TAG));
|
||||
|
||||
ButtonMap.put(0, new CloseButton());
|
||||
ButtonMap.put(1, new CloseButton());
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -106,9 +106,9 @@ public class ProjectileUser
|
||||
{
|
||||
for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().entityList)
|
||||
{
|
||||
if (entity instanceof net.minecraft.server.v1_6_R3.Entity)
|
||||
if (entity instanceof net.minecraft.server.v1_7_R1.Entity)
|
||||
{
|
||||
Entity bukkitEntity = ((net.minecraft.server.v1_6_R3.Entity) entity).getBukkitEntity();
|
||||
Entity bukkitEntity = ((net.minecraft.server.v1_7_R1.Entity) entity).getBukkitEntity();
|
||||
|
||||
if (bukkitEntity instanceof LivingEntity)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -390,7 +390,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
@EventHandler
|
||||
public void OnInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player)
|
||||
if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player)
|
||||
{
|
||||
if (_buttonMap.containsKey(event.getRawSlot()))
|
||||
{
|
||||
@ -407,7 +407,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
@EventHandler
|
||||
public void OnInventoryClose(InventoryCloseEvent event)
|
||||
{
|
||||
if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player)
|
||||
if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player)
|
||||
{
|
||||
ClosePunish();
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
|
||||
@EventHandler
|
||||
public void OnInventoryClose(InventoryCloseEvent event)
|
||||
{
|
||||
if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
|
||||
if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle() != null && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
|
||||
{
|
||||
PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed();
|
||||
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import net.minecraft.server.v1_6_R3.IInventory;
|
||||
import net.minecraft.server.v1_7_R1.IInventory;
|
||||
|
||||
public interface ISalesPackage
|
||||
{
|
||||
|
@ -5,10 +5,10 @@ import java.util.List;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.util.InventoryUtil;
|
||||
import net.minecraft.server.v1_6_R3.IInventory;
|
||||
import net.minecraft.server.v1_7_R1.IInventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package mineplex.core.shop.item;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.NBTTagList;
|
||||
import net.minecraft.server.v1_6_R3.NBTTagString;
|
||||
import net.minecraft.server.v1_7_R1.NBTTagList;
|
||||
import net.minecraft.server.v1_7_R1.NBTTagString;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ShopItem extends CraftItemStack
|
||||
@ -66,8 +66,8 @@ public class ShopItem extends CraftItemStack
|
||||
UpdateVisual(false);
|
||||
|
||||
// Fix for temp save junk(fixes problem when disconnecting and trying to return)
|
||||
if (getHandle().tag != null)
|
||||
getHandle().tag.setName("tag");
|
||||
//if (getHandle().tag != null)
|
||||
// getHandle().tag.setName("tag");
|
||||
|
||||
getHandle().tag.setByte("Count", (byte)Math.max(deliveryAmount, 1));
|
||||
getHandle().tag.set("AttributeModifiers", new NBTTagList());
|
||||
@ -100,8 +100,8 @@ public class ShopItem extends CraftItemStack
|
||||
return false;
|
||||
}
|
||||
|
||||
net.minecraft.server.v1_6_R3.ItemStack original = ((CraftItemStack)this).getHandle();
|
||||
net.minecraft.server.v1_6_R3.ItemStack comparison = ((CraftItemStack)obj).getHandle();
|
||||
net.minecraft.server.v1_7_R1.ItemStack original = ((CraftItemStack)this).getHandle();
|
||||
net.minecraft.server.v1_7_R1.ItemStack comparison = ((CraftItemStack)obj).getHandle();
|
||||
|
||||
return original.tag == null || original.tag.equals(comparison.tag);
|
||||
}
|
||||
@ -120,14 +120,14 @@ public class ShopItem extends CraftItemStack
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagList lore = new NBTTagList("Lore");
|
||||
NBTTagList lore = new NBTTagList();
|
||||
|
||||
if (_lore != null)
|
||||
{
|
||||
for (String line : _lore)
|
||||
{
|
||||
if (line != null && !line.isEmpty())
|
||||
lore.add(new NBTTagString("Test", line));
|
||||
lore.add(new NBTTagString(line));
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,14 +159,14 @@ public class ShopItem extends CraftItemStack
|
||||
{
|
||||
_lore = string;
|
||||
|
||||
NBTTagList lore = new NBTTagList("Lore");
|
||||
NBTTagList lore = new NBTTagList();
|
||||
|
||||
if (_lore != null)
|
||||
{
|
||||
for (String line : _lore)
|
||||
{
|
||||
if (line != null && !line.isEmpty())
|
||||
lore.add(new NBTTagString("Test", line));
|
||||
lore.add(new NBTTagString(line));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
package mineplex.core.shop.page;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryDoubleChest;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryPlayer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryView;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryDoubleChest;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryView;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Container;
|
||||
import net.minecraft.server.v1_6_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R3.IInventory;
|
||||
import net.minecraft.server.v1_6_R3.InventoryLargeChest;
|
||||
import net.minecraft.server.v1_6_R3.PlayerInventory;
|
||||
import net.minecraft.server.v1_6_R3.Slot;
|
||||
import net.minecraft.server.v1_7_R1.Container;
|
||||
import net.minecraft.server.v1_7_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R1.IInventory;
|
||||
import net.minecraft.server.v1_7_R1.InventoryLargeChest;
|
||||
import net.minecraft.server.v1_7_R1.PlayerInventory;
|
||||
import net.minecraft.server.v1_7_R1.Slot;
|
||||
|
||||
public class AnvilContainer extends Container
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
package mineplex.core.shop.page;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
@ -10,8 +10,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
|
@ -10,5 +10,6 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-io-2.4.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -264,7 +264,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown()))));
|
||||
|
||||
//Effect
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f);
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f);
|
||||
|
||||
//Portal Delay
|
||||
Manager.SetPortalDelay(target);
|
||||
|
@ -6,7 +6,7 @@ import java.util.HashSet;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEnderDragon;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEnderDragon;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -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_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
import net.minecraft.server.v1_7_R1.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R1.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -68,7 +68,7 @@ public class BackStab extends Skill
|
||||
event.AddMod(damager.getName(), GetName(), 1 + level, true);
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT, 1f, 2f);
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class MarkedForDeath extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -125,7 +125,7 @@ public class MarkedForDeath extends SkillActive
|
||||
if (level == 0) return;
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));
|
||||
|
@ -73,7 +73,7 @@ public class SilencingArrow extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -126,7 +126,7 @@ public class SilencingArrow extends SkillActive
|
||||
Factory.Condition().Factory().Silence(GetName(), damagee, damager, confuseDur, true, true);
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));
|
||||
|
@ -107,7 +107,7 @@ public class Stealth extends Skill
|
||||
Factory.Condition().Factory().Vulnerable(GetName(), player, player, 120000, 3, false, true, true);
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 0.5f, 0.5f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
public void Remove(Player player, LivingEntity source)
|
||||
|
@ -73,7 +73,7 @@ public class ToxicArrow extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -126,7 +126,7 @@ public class ToxicArrow extends SkillActive
|
||||
Factory.Condition().Factory().Confuse(GetName(), damagee, damager, confuseDur, 0, true, true, true);
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + "."));
|
||||
|
@ -56,7 +56,7 @@ public class NullBlade extends Skill
|
||||
event.AddMod(damager.getName(), GetName(), 0, true);
|
||||
|
||||
//Effect
|
||||
damager.getWorld().playSound(damager.getLocation(), Sound.BREATH, 0.6f, 0.6f);
|
||||
damager.getWorld().playSound(damager.getLocation(), Sound.BLAZE_BREATH, 0.6f, 0.6f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,7 +117,7 @@ public class Void extends Skill
|
||||
return;
|
||||
|
||||
for (Player cur : _active)
|
||||
cur.getWorld().playSound(cur.getLocation(), Sound.BREATH, 0.5f, 0.5f);
|
||||
cur.getWorld().playSound(cur.getLocation(), Sound.BLAZE_BREATH, 0.5f, 0.5f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -173,7 +173,7 @@ public class Void extends Skill
|
||||
event.SetKnockback(false);
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2f, 1f);
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2f, 1f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class HealingShot extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -74,7 +74,7 @@ public class IncendiaryShot extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -74,7 +74,7 @@ public class NapalmShot extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -68,7 +68,7 @@ public class RopedArrow extends SkillActive
|
||||
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -117,7 +117,7 @@ public class RopedArrow extends SkillActive
|
||||
0.4 + mult, false, 0, 0.3 * mult, 1.2 * mult, true);
|
||||
|
||||
//Effect
|
||||
proj.getWorld().playSound(proj.getLocation(), Sound.BREATH, 2.5f, 2.0f);
|
||||
proj.getWorld().playSound(proj.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -55,7 +55,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
||||
|
||||
try
|
||||
{
|
||||
_itemMaxDurability = net.minecraft.server.v1_6_R3.Item.class.getDeclaredField("durability");
|
||||
_itemMaxDurability = net.minecraft.server.v1_7_R1.Item.class.getDeclaredField("durability");
|
||||
_itemMaxDurability.setAccessible(true);
|
||||
}
|
||||
catch (SecurityException e)
|
||||
@ -195,7 +195,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
||||
|
||||
try
|
||||
{
|
||||
_itemMaxDurability.setInt(net.minecraft.server.v1_6_R3.Item.byId[newItem.GetType().getId()], 56);
|
||||
_itemMaxDurability.setInt(net.minecraft.server.v1_7_R1.Item.d(newItem.GetType().getId()), 56);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.item;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -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_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.minecraft.game.classcombat.shop;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -3,9 +3,9 @@ package mineplex.minecraft.game.core.combat;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.ItemStack;
|
||||
import net.minecraft.server.v1_7_R1.ItemStack;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -19,7 +19,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
|
||||
public class ConditionEffect implements Listener
|
||||
{
|
||||
|
@ -17,15 +17,15 @@ import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
|
||||
import net.minecraft.server.v1_6_R3.DamageSource;
|
||||
import net.minecraft.server.v1_6_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R1.DamageSource;
|
||||
import net.minecraft.server.v1_7_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R1.EntityLiving;
|
||||
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -102,6 +102,7 @@ public class DamageManager extends MiniPlugin
|
||||
NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel);
|
||||
|
||||
event.setCancelled(true);
|
||||
System.out.println("Cancelled original");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -318,6 +319,7 @@ public class DamageManager extends MiniPlugin
|
||||
{
|
||||
EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle();
|
||||
EntityLiving entityDamager = null;
|
||||
|
||||
if (damager != null)
|
||||
entityDamager= ((CraftLivingEntity)damager).getHandle();
|
||||
|
||||
@ -330,6 +332,7 @@ public class DamageManager extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Applying damage (" + (damage - entityDamagee.lastDamage) + ")");
|
||||
ApplyDamage(entityDamagee, damage - entityDamagee.lastDamage, ignoreArmor);
|
||||
entityDamagee.lastDamage = damage;
|
||||
}
|
||||
@ -338,6 +341,7 @@ public class DamageManager extends MiniPlugin
|
||||
entityDamagee.lastDamage = damage;
|
||||
entityDamagee.ax = entityDamagee.getHealth();
|
||||
//entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks;
|
||||
System.out.println("Applying damage (" + (damage - entityDamagee.lastDamage) + ")");
|
||||
ApplyDamage(entityDamagee, damage, ignoreArmor);
|
||||
//entityDamagee.hurtTicks = entityDamagee.aW = 10;
|
||||
}
|
||||
@ -345,11 +349,12 @@ public class DamageManager extends MiniPlugin
|
||||
if (entityDamager != null)
|
||||
entityDamagee.b(entityDamager);
|
||||
|
||||
_lastDamageByPlayerTime.setInt(entityDamagee, 60);
|
||||
|
||||
if (entityDamager != null)
|
||||
if (entityDamager instanceof EntityHuman)
|
||||
{
|
||||
_lastDamageByPlayerTime.setInt(entityDamagee, 100);
|
||||
entityDamagee.killer = (EntityHuman)entityDamager;
|
||||
}
|
||||
|
||||
if (entityDamagee.getHealth() <= 0)
|
||||
{
|
||||
@ -446,7 +451,7 @@ public class DamageManager extends MiniPlugin
|
||||
{
|
||||
if (!ignoreArmor)
|
||||
{
|
||||
int j = 25 - entityLiving.aQ();
|
||||
int j = 25 - entityLiving.aV();
|
||||
float k = damage * (float)j;
|
||||
|
||||
_k.invoke(entityLiving, damage);
|
||||
|
@ -27,7 +27,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
|
||||
public class Fire extends MiniPlugin
|
||||
{
|
||||
|
@ -1,80 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.PendingConnection;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.util.Waitable;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AsyncLoginThread extends Thread
|
||||
{
|
||||
final PendingConnection pendingConnection;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server;
|
||||
|
||||
AsyncLoginThread(PendingConnection pendingconnection, CraftServer server)
|
||||
{
|
||||
this.server = server;
|
||||
// CraftBukkit end
|
||||
this.pendingConnection = pendingconnection;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
// CraftBukkit start
|
||||
if (this.pendingConnection.getSocket() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress());
|
||||
this.server.getPluginManager().callEvent(asyncEvent);
|
||||
|
||||
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0)
|
||||
{
|
||||
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress());
|
||||
if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED)
|
||||
{
|
||||
event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
|
||||
}
|
||||
Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>()
|
||||
{
|
||||
@Override
|
||||
protected PlayerPreLoginEvent.Result evaluate()
|
||||
{
|
||||
AsyncLoginThread.this.server.getPluginManager().callEvent(event);
|
||||
return event.getResult();
|
||||
}};
|
||||
|
||||
PendingConnection.b(this.pendingConnection).processQueue.add(waitable);
|
||||
if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED)
|
||||
{
|
||||
this.pendingConnection.disconnect(event.getKickMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED)
|
||||
{
|
||||
this.pendingConnection.disconnect(asyncEvent.getKickMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
PendingConnection.a(this.pendingConnection, true);
|
||||
// CraftBukkit start
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
this.pendingConnection.disconnect("Failed to verify username!");
|
||||
server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + PendingConnection.d(this.pendingConnection), exception);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
@ -1,315 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.TrigMath;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public abstract class EntityCreature extends EntityInsentient
|
||||
{
|
||||
public static final UUID h = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
|
||||
public static final AttributeModifier i = new AttributeModifier(h, "Fleeing speed bonus", 2.0D, 2).a(false);
|
||||
public PathEntity pathEntity;
|
||||
public Entity target;
|
||||
protected boolean bn;
|
||||
protected int bo;
|
||||
private ChunkCoordinates bq = new ChunkCoordinates(0, 0, 0);
|
||||
private float br = -1.0F;
|
||||
private PathfinderGoal bs = new PathfinderGoalMoveTowardsRestriction(this, 1.0D);
|
||||
private boolean bt;
|
||||
|
||||
public EntityCreature(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected boolean bJ() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void bl() {
|
||||
this.world.methodProfiler.a("ai");
|
||||
if ((this.bo > 0) && (--this.bo == 0)) {
|
||||
AttributeInstance attributeinstance = getAttributeInstance(GenericAttributes.d);
|
||||
|
||||
attributeinstance.b(i);
|
||||
}
|
||||
|
||||
this.bn = bJ();
|
||||
float f11 = 16.0F;
|
||||
|
||||
if (this.target == null)
|
||||
{
|
||||
Entity target = findTarget();
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null)
|
||||
this.target = null;
|
||||
else {
|
||||
this.target = ((CraftEntity)event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.target != null)
|
||||
this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true);
|
||||
}
|
||||
else if (this.target.isAlive()) {
|
||||
float f1 = this.target.d(this);
|
||||
|
||||
if (o(this.target))
|
||||
a(this.target, f1);
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityTargetEvent event = new EntityTargetEvent(getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null)
|
||||
this.target = null;
|
||||
else {
|
||||
this.target = ((CraftEntity)event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
if ((!this.bn) && (this.target != null) && ((this.pathEntity == null) || (this.random.nextInt(20) == 0)))
|
||||
this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true);
|
||||
else if ((!this.bn) && (((this.pathEntity == null) && (this.random.nextInt(180) == 0)) || (((this.random.nextInt(120) == 0) || (this.bo > 0)) && (this.aV < 100)))) {
|
||||
bK();
|
||||
}
|
||||
|
||||
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
|
||||
boolean flag = H();
|
||||
boolean flag1 = J();
|
||||
|
||||
this.pitch = 0.0F;
|
||||
if ((this.pathEntity != null) && (this.random.nextInt(100) != 0)) {
|
||||
this.world.methodProfiler.a("followpath");
|
||||
Vec3D vec3d = this.pathEntity.a(this);
|
||||
double d0 = this.width * 2.0F;
|
||||
|
||||
while ((vec3d != null) && (vec3d.d(this.locX, vec3d.d, this.locZ) < d0 * d0)) {
|
||||
this.pathEntity.a();
|
||||
if (this.pathEntity.b()) {
|
||||
vec3d = null;
|
||||
this.pathEntity = null;
|
||||
} else {
|
||||
vec3d = this.pathEntity.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
this.bd = false;
|
||||
if (vec3d != null) {
|
||||
double d1 = vec3d.c - this.locX;
|
||||
double d2 = vec3d.e - this.locZ;
|
||||
double d3 = vec3d.d - i;
|
||||
|
||||
float f2 = (float)(TrigMath.atan2(d2, d1) * 180.0D / 3.141592741012573D) - 90.0F;
|
||||
float f3 = MathHelper.g(f2 - this.yaw);
|
||||
|
||||
this.bf = ((float)getAttributeInstance(GenericAttributes.d).getValue());
|
||||
if (f3 > 30.0F) {
|
||||
f3 = 30.0F;
|
||||
}
|
||||
|
||||
if (f3 < -30.0F) {
|
||||
f3 = -30.0F;
|
||||
}
|
||||
|
||||
this.yaw += f3;
|
||||
if ((this.bn) && (this.target != null)) {
|
||||
double d4 = this.target.locX - this.locX;
|
||||
double d5 = this.target.locZ - this.locZ;
|
||||
float f4 = this.yaw;
|
||||
|
||||
this.yaw = ((float)(Math.atan2(d5, d4) * 180.0D / 3.141592741012573D) - 90.0F);
|
||||
f3 = (f4 - this.yaw + 90.0F) * 3.141593F / 180.0F;
|
||||
this.be = (-MathHelper.sin(f3) * this.bf * 1.0F);
|
||||
this.bf = (MathHelper.cos(f3) * this.bf * 1.0F);
|
||||
}
|
||||
|
||||
if (d3 > 0.0D) {
|
||||
this.bd = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.target != null) {
|
||||
a(this.target, 30.0F, 30.0F);
|
||||
}
|
||||
|
||||
if ((this.positionChanged) && (!bM())) {
|
||||
this.bd = true;
|
||||
}
|
||||
|
||||
if ((this.random.nextFloat() < 0.8F) && ((flag) || (flag1))) {
|
||||
this.bd = true;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
} else {
|
||||
super.bl();
|
||||
this.pathEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void bK() {
|
||||
this.world.methodProfiler.a("stroll");
|
||||
boolean flag = false;
|
||||
int i = -1;
|
||||
int j = -1;
|
||||
int k = -1;
|
||||
float f = -99999.0F;
|
||||
|
||||
for (int l = 0; l < 10; l++) {
|
||||
int i1 = MathHelper.floor(this.locX + this.random.nextInt(13) - 6.0D);
|
||||
int j1 = MathHelper.floor(this.locY + this.random.nextInt(7) - 3.0D);
|
||||
int k1 = MathHelper.floor(this.locZ + this.random.nextInt(13) - 6.0D);
|
||||
float f1 = a(i1, j1, k1);
|
||||
|
||||
if (f1 > f) {
|
||||
f = f1;
|
||||
i = i1;
|
||||
j = j1;
|
||||
k = k1;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true);
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
protected void a(Entity entity, float f) {
|
||||
}
|
||||
|
||||
public float a(int i, int j, int k) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.boundingBox.b);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
return (super.canSpawn()) && (a(i, j, k) >= 0.0F);
|
||||
}
|
||||
|
||||
public boolean bM() {
|
||||
return this.pathEntity != null;
|
||||
}
|
||||
|
||||
public void setPathEntity(PathEntity pathentity) {
|
||||
this.pathEntity = pathentity;
|
||||
}
|
||||
|
||||
public Entity bN() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public void setTarget(Entity entity) {
|
||||
this.target = entity;
|
||||
}
|
||||
|
||||
public boolean bO() {
|
||||
return b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
|
||||
}
|
||||
|
||||
public boolean b(int i, int j, int k) {
|
||||
return this.br == -1.0F;
|
||||
}
|
||||
|
||||
public void b(int i, int j, int k, int l) {
|
||||
this.bq.b(i, j, k);
|
||||
this.br = l;
|
||||
}
|
||||
|
||||
public ChunkCoordinates bP() {
|
||||
return this.bq;
|
||||
}
|
||||
|
||||
public float bQ() {
|
||||
return this.br;
|
||||
}
|
||||
|
||||
public void bR() {
|
||||
this.br = -1.0F;
|
||||
}
|
||||
|
||||
public boolean bS() {
|
||||
return this.br != -1.0F;
|
||||
}
|
||||
|
||||
protected void bF() {
|
||||
super.bF();
|
||||
if ((bH()) && (getLeashHolder() != null) && (getLeashHolder().world == this.world) && this.PullWhileLeashed) {
|
||||
Entity entity = getLeashHolder();
|
||||
|
||||
b((int)entity.locX, (int)entity.locY, (int)entity.locZ, 5);
|
||||
float f = d(entity);
|
||||
|
||||
if (((this instanceof EntityTameableAnimal)) && (((EntityTameableAnimal)this).isSitting())) {
|
||||
if (f > 10.0F) {
|
||||
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
|
||||
unleash(true, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.bt) {
|
||||
this.goalSelector.a(2, this.bs);
|
||||
getNavigation().a(false);
|
||||
this.bt = true;
|
||||
}
|
||||
|
||||
o(f);
|
||||
if (f > 4.0F) {
|
||||
getNavigation().a(entity, 1.0D);
|
||||
}
|
||||
|
||||
if (f > 6.0F) {
|
||||
double d0 = (entity.locX - this.locX) / f;
|
||||
double d1 = (entity.locY - this.locY) / f;
|
||||
double d2 = (entity.locZ - this.locZ) / f;
|
||||
|
||||
this.motX += d0 * Math.abs(d0) * 0.4D;
|
||||
this.motY += d1 * Math.abs(d1) * 0.4D;
|
||||
this.motZ += d2 * Math.abs(d2) * 0.4D;
|
||||
}
|
||||
|
||||
if (f > 10.0F) {
|
||||
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
|
||||
unleash(true, true);
|
||||
}
|
||||
} else if ((!bH()) && (this.bt)) {
|
||||
this.bt = false;
|
||||
this.goalSelector.a(this.bs);
|
||||
getNavigation().a(true);
|
||||
bR();
|
||||
}
|
||||
}
|
||||
|
||||
protected void o(float f)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class EntityFallingBlock extends Entity
|
||||
{
|
||||
public int id;
|
||||
public int data;
|
||||
public int c;
|
||||
public boolean dropItem;
|
||||
private boolean f;
|
||||
private boolean hurtEntities;
|
||||
private int fallHurtMax;
|
||||
private float fallHurtAmount;
|
||||
public NBTTagCompound tileEntityData;
|
||||
|
||||
public boolean spectating;
|
||||
|
||||
public EntityFallingBlock(World world)
|
||||
{
|
||||
super(world);
|
||||
this.dropItem = true;
|
||||
this.fallHurtMax = 40;
|
||||
this.fallHurtAmount = 2.0F;
|
||||
}
|
||||
|
||||
public EntityFallingBlock(World world, double d0, double d1, double d2, int i) {
|
||||
this(world, d0, d1, d2, i, 0);
|
||||
}
|
||||
|
||||
public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int j) {
|
||||
super(world);
|
||||
this.dropItem = true;
|
||||
this.fallHurtMax = 40;
|
||||
this.fallHurtAmount = 2.0F;
|
||||
this.id = i;
|
||||
this.data = j;
|
||||
this.m = true;
|
||||
a(0.98F, 0.98F);
|
||||
this.height = (this.length / 2.0F);
|
||||
setPosition(d0, d1, d2);
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
protected void a() {
|
||||
}
|
||||
|
||||
public boolean L() {
|
||||
return !this.dead && !spectating;
|
||||
}
|
||||
|
||||
public void l_() {
|
||||
if (this.id == 0) {
|
||||
die();
|
||||
} else {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.c += 1;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
move(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
if (!this.world.isStatic) {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (this.c == 1)
|
||||
{
|
||||
if ((this.c != 1) || (this.world.getTypeId(i, j, k) != this.id) || (this.world.getData(i, j, k) != this.data) || (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, 0, 0).isCancelled())) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
this.world.setAir(i, j, k);
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
|
||||
die();
|
||||
|
||||
if ((!this.f) && (this.world.mayPlace(this.id, i, j, k, true, 1, (Entity)null, (ItemStack)null)) && (!BlockSand.canFall(this.world, i, j - 1, k)) && (i >= -30000000) && (k >= -30000000) && (i < 30000000) && (k < 30000000) && (j > 0) && (j < 256) && ((this.world.getTypeId(i, j, k) != this.id) || (this.world.getData(i, j, k) != this.data))) {
|
||||
if (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.id, this.data).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
this.world.setTypeIdAndData(i, j, k, this.id, this.data, 3);
|
||||
|
||||
if ((Block.byId[this.id] instanceof BlockSand)) {
|
||||
((BlockSand)Block.byId[this.id]).a_(this.world, i, j, k, this.data);
|
||||
}
|
||||
|
||||
if ((this.tileEntityData != null) && ((Block.byId[this.id] instanceof IContainer))) {
|
||||
TileEntity tileentity = this.world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentity != null) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
tileentity.b(nbttagcompound);
|
||||
Iterator iterator = this.tileEntityData.c().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
NBTBase nbtbase = (NBTBase)iterator.next();
|
||||
|
||||
if ((!nbtbase.getName().equals("x")) && (!nbtbase.getName().equals("y")) && (!nbtbase.getName().equals("z"))) {
|
||||
nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
|
||||
}
|
||||
}
|
||||
|
||||
tileentity.a(nbttagcompound);
|
||||
tileentity.update();
|
||||
}
|
||||
}
|
||||
} else if ((this.dropItem) && (!this.f)) {
|
||||
a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F);
|
||||
}
|
||||
}
|
||||
} else if (((this.c > 100) && (!this.world.isStatic) && ((j < 1) || (j > 256))) || (this.c > 600)) {
|
||||
if (this.dropItem) {
|
||||
a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F);
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(float f) {
|
||||
if (this.hurtEntities) {
|
||||
int i = MathHelper.f(f - 1.0F);
|
||||
|
||||
if (i > 0) {
|
||||
ArrayList arraylist = new ArrayList(this.world.getEntities(this, this.boundingBox));
|
||||
DamageSource damagesource = this.id == Block.ANVIL.id ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK;
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity)iterator.next();
|
||||
|
||||
float damage = Math.min(MathHelper.d(i * this.fallHurtAmount), this.fallHurtMax);
|
||||
|
||||
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(this, entity, EntityDamageEvent.DamageCause.FALLING_BLOCK, damage);
|
||||
if (!event.isCancelled())
|
||||
{
|
||||
entity.damageEntity(damagesource, (float)event.getDamage());
|
||||
}
|
||||
}
|
||||
|
||||
if ((this.id == Block.ANVIL.id) && (this.random.nextFloat() < 0.0500000007450581D + i * 0.05D)) {
|
||||
int j = this.data >> 2;
|
||||
int k = this.data & 0x3;
|
||||
|
||||
j++;
|
||||
if (j > 2)
|
||||
this.f = true;
|
||||
else
|
||||
this.data = (k | j << 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setByte("Tile", (byte)this.id);
|
||||
nbttagcompound.setInt("TileID", this.id);
|
||||
nbttagcompound.setByte("Data", (byte)this.data);
|
||||
nbttagcompound.setByte("Time", (byte)this.c);
|
||||
nbttagcompound.setBoolean("DropItem", this.dropItem);
|
||||
nbttagcompound.setBoolean("HurtEntities", this.hurtEntities);
|
||||
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
|
||||
nbttagcompound.setInt("FallHurtMax", this.fallHurtMax);
|
||||
if (this.tileEntityData != null)
|
||||
nbttagcompound.setCompound("TileEntityData", this.tileEntityData);
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
if (nbttagcompound.hasKey("TileID"))
|
||||
this.id = nbttagcompound.getInt("TileID");
|
||||
else {
|
||||
this.id = (nbttagcompound.getByte("Tile") & 0xFF);
|
||||
}
|
||||
|
||||
this.data = (nbttagcompound.getByte("Data") & 0xFF);
|
||||
this.c = (nbttagcompound.getByte("Time") & 0xFF);
|
||||
if (nbttagcompound.hasKey("HurtEntities")) {
|
||||
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
|
||||
this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount");
|
||||
this.fallHurtMax = nbttagcompound.getInt("FallHurtMax");
|
||||
} else if (this.id == Block.ANVIL.id) {
|
||||
this.hurtEntities = true;
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("DropItem")) {
|
||||
this.dropItem = nbttagcompound.getBoolean("DropItem");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("TileEntityData")) {
|
||||
this.tileEntityData = nbttagcompound.getCompound("TileEntityData");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("Bukkit.tileData")) {
|
||||
this.tileEntityData = ((NBTTagCompound)nbttagcompound.getCompound("Bukkit.tileData").clone());
|
||||
}
|
||||
|
||||
if (this.id == 0)
|
||||
this.id = Block.SAND.id;
|
||||
}
|
||||
|
||||
public void a(boolean flag)
|
||||
{
|
||||
this.hurtEntities = flag;
|
||||
}
|
||||
|
||||
public void a(CrashReportSystemDetails crashreportsystemdetails) {
|
||||
super.a(crashreportsystemdetails);
|
||||
crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(this.id));
|
||||
crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data));
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
CraftEventFactory.handleEntityDamageEvent(this, damagesource, f);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,263 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
//CraftBukkit start
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
//CraftBukkit end
|
||||
|
||||
public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
public int h;
|
||||
public double i;
|
||||
public double j;
|
||||
public double bn;
|
||||
private Entity target;
|
||||
private int br;
|
||||
public int bo;
|
||||
public int bp;
|
||||
private int explosionPower = 1;
|
||||
|
||||
public EntityGhast(World world) {
|
||||
super(world);
|
||||
this.a(4.0F, 4.0F);
|
||||
this.fireProof = true;
|
||||
this.b = 5;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerable()) {
|
||||
return false;
|
||||
} else if ("fireball".equals(damagesource.n()) && damagesource.getEntity() instanceof EntityHuman) {
|
||||
super.damageEntity(damagesource, 1000.0F);
|
||||
((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y);
|
||||
return true;
|
||||
} else {
|
||||
return super.damageEntity(damagesource, f);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
protected void az() {
|
||||
super.az();
|
||||
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
|
||||
}
|
||||
|
||||
protected void bl() {
|
||||
if (!this.world.isStatic && this.world.difficulty == 0) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
if (Vegetated)
|
||||
{
|
||||
double d0 = this.i - this.locX;
|
||||
double d1 = this.j - this.locY;
|
||||
double d2 = this.bn - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
this.motZ += d2 / d3 * 0.1D;
|
||||
|
||||
double d5 = this.i - this.locX;
|
||||
double d6 = this.bn - this.locZ;
|
||||
|
||||
this.aN = this.yaw = -((float) Math.atan2(d5, d6)) * 180.0F / 3.1415927F;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.u();
|
||||
this.bo = this.bp;
|
||||
double d0 = this.i - this.locX;
|
||||
double d1 = this.j - this.locY;
|
||||
double d2 = this.bn - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 < 1.0D || d3 > 3600.0D) {
|
||||
this.i = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.j = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.bn = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
|
||||
if (this.h-- <= 0) {
|
||||
this.h += this.random.nextInt(5) + 2;
|
||||
d3 = (double) MathHelper.sqrt(d3);
|
||||
if (this.a(this.i, this.j, this.bn, d3)) {
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
this.motZ += d2 / d3 * 0.1D;
|
||||
} else {
|
||||
this.i = this.locX;
|
||||
this.j = this.locY;
|
||||
this.bn = this.locZ;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.target != null && this.target.dead) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.target = null;
|
||||
} else {
|
||||
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.target == null || this.br-- <= 0) {
|
||||
// CraftBukkit start
|
||||
Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D);
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.target = null;
|
||||
} else {
|
||||
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.target != null) {
|
||||
this.br = 20;
|
||||
}
|
||||
}
|
||||
|
||||
double d4 = 64.0D;
|
||||
|
||||
if (this.target != null && this.target.e((Entity) this) < d4 * d4) {
|
||||
double d5 = this.target.locX - this.locX;
|
||||
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
|
||||
double d7 = this.target.locZ - this.locZ;
|
||||
|
||||
this.aN = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.o(this.target)) {
|
||||
if (this.bp == 10) {
|
||||
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
}
|
||||
|
||||
++this.bp;
|
||||
if (this.bp == 20) {
|
||||
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7);
|
||||
|
||||
// CraftBukkit - set bukkitYield when setting explosionpower
|
||||
entitylargefireball.bukkitYield = entitylargefireball.yield = this.explosionPower;
|
||||
double d8 = 4.0D;
|
||||
Vec3D vec3d = this.j(1.0F);
|
||||
|
||||
entitylargefireball.locX = this.locX + vec3d.c * d8;
|
||||
entitylargefireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
|
||||
entitylargefireball.locZ = this.locZ + vec3d.e * d8;
|
||||
this.world.addEntity(entitylargefireball);
|
||||
this.bp = -40;
|
||||
}
|
||||
} else if (this.bp > 0) {
|
||||
--this.bp;
|
||||
}
|
||||
} else {
|
||||
this.aN = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
if (this.bp > 0) {
|
||||
--this.bp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
byte b1 = (byte) (this.bp > 10 ? 1 : 0);
|
||||
|
||||
if (b0 != b1) {
|
||||
this.datawatcher.watch(16, Byte.valueOf(b1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(double d0, double d1, double d2, double d3) {
|
||||
double d4 = (this.i - this.locX) / d3;
|
||||
double d5 = (this.j - this.locY) / d3;
|
||||
double d6 = (this.bn - this.locZ) / d3;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
|
||||
|
||||
for (int i = 1; (double) i < d3; ++i) {
|
||||
axisalignedbb.d(d4, d5, d6);
|
||||
if (!this.world.getCubes(this, axisalignedbb).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String r() {
|
||||
return "mob.ghast.moan";
|
||||
}
|
||||
|
||||
protected String aO() {
|
||||
return "mob.ghast.scream";
|
||||
}
|
||||
|
||||
protected String aP() {
|
||||
return "mob.ghast.death";
|
||||
}
|
||||
|
||||
protected int getLootId() {
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
// CraftBukkit start
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int j = this.random.nextInt(2) + this.random.nextInt(1 + i);
|
||||
|
||||
int k;
|
||||
|
||||
if (j > 0) {
|
||||
loot.add(CraftItemStack.asNewCraftStack(Item.GHAST_TEAR, j));
|
||||
}
|
||||
|
||||
j = this.random.nextInt(3) + this.random.nextInt(1 + i);
|
||||
|
||||
if (j > 0) {
|
||||
loot.add(CraftItemStack.asNewCraftStack(Item.SULPHUR, j));
|
||||
}
|
||||
|
||||
org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected float ba() {
|
||||
return 10.0F;
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
|
||||
}
|
||||
|
||||
public int bv() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("ExplosionPower", this.explosionPower);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
if (nbttagcompound.hasKey("ExplosionPower")) {
|
||||
this.explosionPower = nbttagcompound.getInt("ExplosionPower");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public class EntityTNTPrimed extends Entity
|
||||
{
|
||||
public int fuseTicks;
|
||||
private EntityLiving source;
|
||||
public float yield = 4.0F;
|
||||
public boolean isIncendiary = false;
|
||||
|
||||
public boolean spectating = false;
|
||||
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.m = true;
|
||||
a(0.98F, 0.98F);
|
||||
this.height = (this.length / 2.0F);
|
||||
}
|
||||
|
||||
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
|
||||
this(world);
|
||||
setPosition(d0, d1, d2);
|
||||
float f = (float)(Math.random() * 3.141592741012573D * 2.0D);
|
||||
|
||||
this.motX = (-(float)Math.sin(f) * 0.02F);
|
||||
this.motY = 0.2000000029802322D;
|
||||
this.motZ = (-(float)Math.cos(f) * 0.02F);
|
||||
this.fuseTicks = 80;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
this.source = entityliving;
|
||||
}
|
||||
protected void a() {
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean L() {
|
||||
return !this.dead && !spectating;
|
||||
}
|
||||
|
||||
public void l_() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
move(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
|
||||
if (this.fuseTicks-- <= 0)
|
||||
{
|
||||
if (!this.world.isStatic) {
|
||||
explode();
|
||||
}
|
||||
die();
|
||||
}
|
||||
else {
|
||||
this.world.addParticle("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
CraftServer server = this.world.getServer();
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive)CraftEntity.getEntity(server, this));
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled())
|
||||
{
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setByte("Fuse", (byte)this.fuseTicks);
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.fuseTicks = nbttagcompound.getByte("Fuse");
|
||||
}
|
||||
|
||||
public EntityLiving getSource() {
|
||||
return this.source;
|
||||
}
|
||||
}
|
@ -1,435 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Connection;
|
||||
import net.minecraft.server.v1_6_R3.IConsoleLogManager;
|
||||
import net.minecraft.server.v1_6_R3.IntHashMap;
|
||||
import net.minecraft.server.v1_6_R3.ItemStack;
|
||||
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_6_R3.NBTCompressedStreamTools;
|
||||
import net.minecraft.server.v1_6_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet0KeepAlive;
|
||||
import net.minecraft.server.v1_6_R3.Packet100OpenWindow;
|
||||
import net.minecraft.server.v1_6_R3.Packet101CloseWindow;
|
||||
import net.minecraft.server.v1_6_R3.Packet102WindowClick;
|
||||
import net.minecraft.server.v1_6_R3.Packet103SetSlot;
|
||||
import net.minecraft.server.v1_6_R3.Packet104WindowItems;
|
||||
import net.minecraft.server.v1_6_R3.Packet105CraftProgressBar;
|
||||
import net.minecraft.server.v1_6_R3.Packet106Transaction;
|
||||
import net.minecraft.server.v1_6_R3.Packet107SetCreativeSlot;
|
||||
import net.minecraft.server.v1_6_R3.Packet108ButtonClick;
|
||||
import net.minecraft.server.v1_6_R3.Packet10Flying;
|
||||
import net.minecraft.server.v1_6_R3.Packet11PlayerPosition;
|
||||
import net.minecraft.server.v1_6_R3.Packet12PlayerLook;
|
||||
import net.minecraft.server.v1_6_R3.Packet130UpdateSign;
|
||||
import net.minecraft.server.v1_6_R3.Packet131ItemData;
|
||||
import net.minecraft.server.v1_6_R3.Packet132TileEntityData;
|
||||
import net.minecraft.server.v1_6_R3.Packet133OpenTileEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet13PlayerLookMove;
|
||||
import net.minecraft.server.v1_6_R3.Packet14BlockDig;
|
||||
import net.minecraft.server.v1_6_R3.Packet15Place;
|
||||
import net.minecraft.server.v1_6_R3.Packet16BlockItemSwitch;
|
||||
import net.minecraft.server.v1_6_R3.Packet17EntityLocationAction;
|
||||
import net.minecraft.server.v1_6_R3.Packet18ArmAnimation;
|
||||
import net.minecraft.server.v1_6_R3.Packet19EntityAction;
|
||||
import net.minecraft.server.v1_6_R3.Packet1Login;
|
||||
import net.minecraft.server.v1_6_R3.Packet200Statistic;
|
||||
import net.minecraft.server.v1_6_R3.Packet201PlayerInfo;
|
||||
import net.minecraft.server.v1_6_R3.Packet202Abilities;
|
||||
import net.minecraft.server.v1_6_R3.Packet203TabComplete;
|
||||
import net.minecraft.server.v1_6_R3.Packet204LocaleAndViewDistance;
|
||||
import net.minecraft.server.v1_6_R3.Packet205ClientCommand;
|
||||
import net.minecraft.server.v1_6_R3.Packet206SetScoreboardObjective;
|
||||
import net.minecraft.server.v1_6_R3.Packet207SetScoreboardScore;
|
||||
import net.minecraft.server.v1_6_R3.Packet208SetScoreboardDisplayObjective;
|
||||
import net.minecraft.server.v1_6_R3.Packet209SetScoreboardTeam;
|
||||
import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet22Collect;
|
||||
import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet24MobSpawn;
|
||||
import net.minecraft.server.v1_6_R3.Packet250CustomPayload;
|
||||
import net.minecraft.server.v1_6_R3.Packet252KeyResponse;
|
||||
import net.minecraft.server.v1_6_R3.Packet253KeyRequest;
|
||||
import net.minecraft.server.v1_6_R3.Packet254GetInfo;
|
||||
import net.minecraft.server.v1_6_R3.Packet255KickDisconnect;
|
||||
import net.minecraft.server.v1_6_R3.Packet25EntityPainting;
|
||||
import net.minecraft.server.v1_6_R3.Packet26AddExpOrb;
|
||||
import net.minecraft.server.v1_6_R3.Packet27PlayerInput;
|
||||
import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
|
||||
import net.minecraft.server.v1_6_R3.Packet29DestroyEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet2Handshake;
|
||||
import net.minecraft.server.v1_6_R3.Packet30Entity;
|
||||
import net.minecraft.server.v1_6_R3.Packet31RelEntityMove;
|
||||
import net.minecraft.server.v1_6_R3.Packet32EntityLook;
|
||||
import net.minecraft.server.v1_6_R3.Packet33RelEntityMoveLook;
|
||||
import net.minecraft.server.v1_6_R3.Packet34EntityTeleport;
|
||||
import net.minecraft.server.v1_6_R3.Packet35EntityHeadRotation;
|
||||
import net.minecraft.server.v1_6_R3.Packet38EntityStatus;
|
||||
import net.minecraft.server.v1_6_R3.Packet39AttachEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet3Chat;
|
||||
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
|
||||
import net.minecraft.server.v1_6_R3.Packet41MobEffect;
|
||||
import net.minecraft.server.v1_6_R3.Packet42RemoveMobEffect;
|
||||
import net.minecraft.server.v1_6_R3.Packet43SetExperience;
|
||||
import net.minecraft.server.v1_6_R3.Packet44UpdateAttributes;
|
||||
import net.minecraft.server.v1_6_R3.Packet4UpdateTime;
|
||||
import net.minecraft.server.v1_6_R3.Packet51MapChunk;
|
||||
import net.minecraft.server.v1_6_R3.Packet52MultiBlockChange;
|
||||
import net.minecraft.server.v1_6_R3.Packet53BlockChange;
|
||||
import net.minecraft.server.v1_6_R3.Packet54PlayNoteBlock;
|
||||
import net.minecraft.server.v1_6_R3.Packet55BlockBreakAnimation;
|
||||
import net.minecraft.server.v1_6_R3.Packet56MapChunkBulk;
|
||||
import net.minecraft.server.v1_6_R3.Packet5EntityEquipment;
|
||||
import net.minecraft.server.v1_6_R3.Packet60Explosion;
|
||||
import net.minecraft.server.v1_6_R3.Packet61WorldEvent;
|
||||
import net.minecraft.server.v1_6_R3.Packet62NamedSoundEffect;
|
||||
import net.minecraft.server.v1_6_R3.Packet63WorldParticles;
|
||||
import net.minecraft.server.v1_6_R3.Packet6SpawnPosition;
|
||||
import net.minecraft.server.v1_6_R3.Packet70Bed;
|
||||
import net.minecraft.server.v1_6_R3.Packet71Weather;
|
||||
import net.minecraft.server.v1_6_R3.Packet7UseEntity;
|
||||
import net.minecraft.server.v1_6_R3.Packet8UpdateHealth;
|
||||
import net.minecraft.server.v1_6_R3.Packet9Respawn;
|
||||
import net.minecraft.server.v1_6_R3.PacketCounter;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
public abstract class Packet {
|
||||
|
||||
public static IntHashMap l = new IntHashMap();
|
||||
private static Map a = new HashMap();
|
||||
private static Set b = new HashSet();
|
||||
private static Set c = new HashSet();
|
||||
protected IConsoleLogManager m;
|
||||
public final long timestamp = MinecraftServer.aq();
|
||||
public static long o;
|
||||
public static long p;
|
||||
public static long q;
|
||||
public static long r;
|
||||
public boolean lowPriority;
|
||||
// CraftBukkit start - Calculate packet ID once - used a bunch of times
|
||||
private int packetID;
|
||||
|
||||
public Packet() {
|
||||
packetID = ((Integer) a.get(this.getClass())).intValue();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
static void a(int i, boolean flag, boolean flag1, Class oclass) {
|
||||
if (l.b(i)) {
|
||||
throw new IllegalArgumentException("Duplicate packet id:" + i);
|
||||
} else if (a.containsKey(oclass)) {
|
||||
throw new IllegalArgumentException("Duplicate packet class:" + oclass);
|
||||
} else {
|
||||
l.a(i, oclass);
|
||||
a.put(oclass, Integer.valueOf(i));
|
||||
if (flag) {
|
||||
b.add(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
c.add(Integer.valueOf(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet a(IConsoleLogManager iconsolelogmanager, int i) {
|
||||
try {
|
||||
Class oclass = (Class) l.get(i);
|
||||
|
||||
return oclass == null ? null : (Packet) oclass.newInstance();
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
iconsolelogmanager.severe("Skipping packet with id " + i);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(DataOutput dataoutput, byte[] abyte) throws IOException { // CraftBukkit - throws IOException
|
||||
dataoutput.writeShort(abyte.length);
|
||||
dataoutput.write(abyte);
|
||||
}
|
||||
|
||||
public static byte[] b(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
|
||||
short short1 = datainput.readShort();
|
||||
|
||||
if (short1 < 0) {
|
||||
throw new IOException("Key was smaller than nothing! Weird key!");
|
||||
} else {
|
||||
byte[] abyte = new byte[short1];
|
||||
|
||||
datainput.readFully(abyte);
|
||||
return abyte;
|
||||
}
|
||||
}
|
||||
|
||||
public final int n() {
|
||||
return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit
|
||||
}
|
||||
|
||||
public static Packet a(IConsoleLogManager iconsolelogmanager, DataInput datainput, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException
|
||||
boolean flag1 = false;
|
||||
Packet packet = null;
|
||||
int i = socket.getSoTimeout();
|
||||
|
||||
int j;
|
||||
|
||||
try {
|
||||
j = datainput.readUnsignedByte();
|
||||
if (flag && !c.contains(Integer.valueOf(j)) || !flag && !b.contains(Integer.valueOf(j))) {
|
||||
throw new IOException("Bad packet id " + j);
|
||||
}
|
||||
|
||||
packet = a(iconsolelogmanager, j);
|
||||
if (packet == null) {
|
||||
throw new IOException("Bad packet id " + j);
|
||||
}
|
||||
|
||||
packet.m = iconsolelogmanager;
|
||||
if (packet instanceof Packet254GetInfo) {
|
||||
socket.setSoTimeout(1500);
|
||||
}
|
||||
|
||||
packet.a(datainput);
|
||||
++o;
|
||||
p += (long) packet.a();
|
||||
} catch (EOFException eofexception) {
|
||||
if (eofexception.getMessage() != null)
|
||||
iconsolelogmanager.severe("Reached end of stream for " + socket.getInetAddress());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
catch (java.net.SocketTimeoutException exception) {
|
||||
iconsolelogmanager.info("Read timed out");
|
||||
return null;
|
||||
} catch (java.net.SocketException exception) {
|
||||
iconsolelogmanager.info("Connection reset");
|
||||
return null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
PacketCounter.a(j, (long) packet.a());
|
||||
++o;
|
||||
p += (long) packet.a();
|
||||
socket.setSoTimeout(i);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static void a(Packet packet, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
|
||||
dataoutput.write(packet.n());
|
||||
packet.a(dataoutput);
|
||||
++q;
|
||||
r += (long) packet.a();
|
||||
}
|
||||
|
||||
public static void a(String s, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
|
||||
if (s.length() > 32767) {
|
||||
throw new IOException("String too big");
|
||||
} else {
|
||||
dataoutput.writeShort(s.length());
|
||||
dataoutput.writeChars(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(DataInput datainput, int i) throws IOException { // CraftBukkit - throws IOException
|
||||
short short1 = datainput.readShort();
|
||||
|
||||
if (short1 > i) {
|
||||
throw new IOException("Received string length longer than maximum allowed (" + short1 + " > " + i + ")");
|
||||
} else if (short1 < 0) {
|
||||
throw new IOException("Received string length is less than zero! Weird string!");
|
||||
} else {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
|
||||
for (int j = 0; j < short1; ++j) {
|
||||
stringbuilder.append(datainput.readChar());
|
||||
}
|
||||
|
||||
return stringbuilder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void a(DataInput datainput) throws IOException; // CraftBukkit - throws IOException
|
||||
|
||||
public abstract void a(DataOutput dataoutput) throws IOException; // CraftBukkit - throws IOException
|
||||
|
||||
public abstract void handle(Connection connection);
|
||||
|
||||
public abstract int a();
|
||||
|
||||
public boolean e() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean a(Packet packet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean a_() {
|
||||
return this instanceof Packet3Chat && !((Packet3Chat) this).message.startsWith("/"); // CraftBukkit - async chat
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String s = this.getClass().getSimpleName();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public static ItemStack c(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
|
||||
ItemStack itemstack = null;
|
||||
short short1 = datainput.readShort();
|
||||
|
||||
if (short1 >= 0) {
|
||||
byte b0 = datainput.readByte();
|
||||
short short2 = datainput.readShort();
|
||||
|
||||
itemstack = new ItemStack(short1, b0, short2);
|
||||
itemstack.tag = d(datainput);
|
||||
// CraftBukkit start
|
||||
if (itemstack.tag != null) {
|
||||
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public static void a(ItemStack itemstack, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
|
||||
if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
||||
dataoutput.writeShort(-1);
|
||||
} else {
|
||||
dataoutput.writeShort(itemstack.id);
|
||||
dataoutput.writeByte(itemstack.count);
|
||||
dataoutput.writeShort(itemstack.getData());
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
|
||||
if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) {
|
||||
nbttagcompound = itemstack.tag;
|
||||
}
|
||||
|
||||
a(nbttagcompound, dataoutput);
|
||||
}
|
||||
}
|
||||
|
||||
public static NBTTagCompound d(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
|
||||
short short1 = datainput.readShort();
|
||||
|
||||
if (short1 < 0) {
|
||||
return null;
|
||||
} else {
|
||||
byte[] abyte = new byte[short1];
|
||||
|
||||
datainput.readFully(abyte);
|
||||
return NBTCompressedStreamTools.a(abyte);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
|
||||
if (nbttagcompound == null) {
|
||||
dataoutput.writeShort(-1);
|
||||
} else {
|
||||
byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
|
||||
|
||||
dataoutput.writeShort((short) abyte.length);
|
||||
dataoutput.write(abyte);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
a(0, true, true, Packet0KeepAlive.class);
|
||||
a(1, true, true, Packet1Login.class);
|
||||
a(2, false, true, Packet2Handshake.class);
|
||||
a(3, true, true, Packet3Chat.class);
|
||||
a(4, true, false, Packet4UpdateTime.class);
|
||||
a(5, true, false, Packet5EntityEquipment.class);
|
||||
a(6, true, false, Packet6SpawnPosition.class);
|
||||
a(7, false, true, Packet7UseEntity.class);
|
||||
a(8, true, false, Packet8UpdateHealth.class);
|
||||
a(9, true, true, Packet9Respawn.class);
|
||||
a(10, true, true, Packet10Flying.class);
|
||||
a(11, true, true, Packet11PlayerPosition.class);
|
||||
a(12, true, true, Packet12PlayerLook.class);
|
||||
a(13, true, true, Packet13PlayerLookMove.class);
|
||||
a(14, false, true, Packet14BlockDig.class);
|
||||
a(15, false, true, Packet15Place.class);
|
||||
a(16, true, true, Packet16BlockItemSwitch.class);
|
||||
a(17, true, false, Packet17EntityLocationAction.class);
|
||||
a(18, true, true, Packet18ArmAnimation.class);
|
||||
a(19, false, true, Packet19EntityAction.class);
|
||||
a(20, true, false, Packet20NamedEntitySpawn.class);
|
||||
a(22, true, false, Packet22Collect.class);
|
||||
a(23, true, false, Packet23VehicleSpawn.class);
|
||||
a(24, true, false, Packet24MobSpawn.class);
|
||||
a(25, true, false, Packet25EntityPainting.class);
|
||||
a(26, true, false, Packet26AddExpOrb.class);
|
||||
a(27, false, true, Packet27PlayerInput.class);
|
||||
a(28, true, false, Packet28EntityVelocity.class);
|
||||
a(29, true, false, Packet29DestroyEntity.class);
|
||||
a(30, true, false, Packet30Entity.class);
|
||||
a(31, true, false, Packet31RelEntityMove.class);
|
||||
a(32, true, false, Packet32EntityLook.class);
|
||||
a(33, true, false, Packet33RelEntityMoveLook.class);
|
||||
a(34, true, false, Packet34EntityTeleport.class);
|
||||
a(35, true, false, Packet35EntityHeadRotation.class);
|
||||
a(38, true, false, Packet38EntityStatus.class);
|
||||
a(39, true, false, Packet39AttachEntity.class);
|
||||
a(40, true, false, Packet40EntityMetadata.class);
|
||||
a(41, true, false, Packet41MobEffect.class);
|
||||
a(42, true, false, Packet42RemoveMobEffect.class);
|
||||
a(43, true, false, Packet43SetExperience.class);
|
||||
a(44, true, false, Packet44UpdateAttributes.class);
|
||||
a(51, true, false, Packet51MapChunk.class);
|
||||
a(52, true, false, Packet52MultiBlockChange.class);
|
||||
a(53, true, false, Packet53BlockChange.class);
|
||||
a(54, true, false, Packet54PlayNoteBlock.class);
|
||||
a(55, true, false, Packet55BlockBreakAnimation.class);
|
||||
a(56, true, false, Packet56MapChunkBulk.class);
|
||||
a(60, true, false, Packet60Explosion.class);
|
||||
a(61, true, false, Packet61WorldEvent.class);
|
||||
a(62, true, false, Packet62NamedSoundEffect.class);
|
||||
a(63, true, false, Packet63WorldParticles.class);
|
||||
a(70, true, false, Packet70Bed.class);
|
||||
a(71, true, false, Packet71Weather.class);
|
||||
a(100, true, false, Packet100OpenWindow.class);
|
||||
a(101, true, true, Packet101CloseWindow.class);
|
||||
a(102, false, true, Packet102WindowClick.class);
|
||||
a(103, true, false, Packet103SetSlot.class);
|
||||
a(104, true, false, Packet104WindowItems.class);
|
||||
a(105, true, false, Packet105CraftProgressBar.class);
|
||||
a(106, true, true, Packet106Transaction.class);
|
||||
a(107, true, true, Packet107SetCreativeSlot.class);
|
||||
a(108, false, true, Packet108ButtonClick.class);
|
||||
a(130, true, true, Packet130UpdateSign.class);
|
||||
a(131, true, false, Packet131ItemData.class);
|
||||
a(132, true, false, Packet132TileEntityData.class);
|
||||
a(133, true, false, Packet133OpenTileEntity.class);
|
||||
a(200, true, false, Packet200Statistic.class);
|
||||
a(201, true, false, Packet201PlayerInfo.class);
|
||||
a(202, true, true, Packet202Abilities.class);
|
||||
a(203, true, true, Packet203TabComplete.class);
|
||||
a(204, false, true, Packet204LocaleAndViewDistance.class);
|
||||
a(205, false, true, Packet205ClientCommand.class);
|
||||
a(206, true, false, Packet206SetScoreboardObjective.class);
|
||||
a(207, true, false, Packet207SetScoreboardScore.class);
|
||||
a(208, true, false, Packet208SetScoreboardDisplayObjective.class);
|
||||
a(209, true, false, Packet209SetScoreboardTeam.class);
|
||||
a(250, true, true, Packet250CustomPayload.class);
|
||||
a(252, true, true, Packet252KeyResponse.class);
|
||||
a(253, true, false, Packet253KeyRequest.class);
|
||||
a(254, false, true, Packet254GetInfo.class);
|
||||
a(255, true, true, Packet255KickDisconnect.class);
|
||||
}
|
||||
}
|
@ -1,234 +0,0 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Connection;
|
||||
import net.minecraft.server.v1_6_R3.DedicatedServerConnection;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.INetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_6_R3.NetworkManager;
|
||||
import net.minecraft.server.v1_6_R3.Packet;
|
||||
import net.minecraft.server.v1_6_R3.Packet1Login;
|
||||
import net.minecraft.server.v1_6_R3.Packet205ClientCommand;
|
||||
import net.minecraft.server.v1_6_R3.Packet252KeyResponse;
|
||||
import net.minecraft.server.v1_6_R3.Packet253KeyRequest;
|
||||
import net.minecraft.server.v1_6_R3.Packet254GetInfo;
|
||||
import net.minecraft.server.v1_6_R3.Packet255KickDisconnect;
|
||||
import net.minecraft.server.v1_6_R3.Packet2Handshake;
|
||||
import net.minecraft.server.v1_6_R3.PendingConnection;
|
||||
import net.minecraft.server.v1_6_R3.PlayerList;
|
||||
import net.minecraft.server.v1_6_R3.StripColor;
|
||||
|
||||
public class PendingConnection extends Connection {
|
||||
|
||||
private static Random random = new Random();
|
||||
private byte[] d;
|
||||
private final MinecraftServer server;
|
||||
public final NetworkManager networkManager;
|
||||
public boolean b;
|
||||
private int f;
|
||||
private String g;
|
||||
private volatile boolean h;
|
||||
private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
|
||||
private boolean j;
|
||||
private SecretKey k;
|
||||
public String hostname = ""; // CraftBukkit - add field
|
||||
|
||||
public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException
|
||||
this.server = minecraftserver;
|
||||
this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.H().getPrivate());
|
||||
this.networkManager.e = 0;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public Socket getSocket() {
|
||||
return this.networkManager.getSocket();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void d() {
|
||||
if (this.h) {
|
||||
this.e();
|
||||
}
|
||||
|
||||
if (this.f++ == 600) {
|
||||
this.disconnect("Took too long to log in");
|
||||
} else {
|
||||
this.networkManager.b();
|
||||
}
|
||||
}
|
||||
|
||||
public void disconnect(String s) {
|
||||
try {
|
||||
this.server.getLogger().info("Disconnecting " + this.getName() + ": " + s);
|
||||
this.networkManager.queue(new Packet255KickDisconnect(s));
|
||||
this.networkManager.d();
|
||||
this.b = true;
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet2Handshake packet2handshake) {
|
||||
if (this.g != null) {
|
||||
this.disconnect("Quit repeating yourself!");
|
||||
} else {
|
||||
this.g = packet2handshake.f();
|
||||
if (!this.g.equals(StripColor.a(this.g))) {
|
||||
this.disconnect("Invalid username!");
|
||||
} else {
|
||||
PublicKey publickey = this.server.H().getPublic();
|
||||
if (packet2handshake.d() != 78) {
|
||||
if (packet2handshake.d() > 78) {
|
||||
this.disconnect("Outdated server!");
|
||||
} else {
|
||||
this.disconnect("Outdated client!");
|
||||
}
|
||||
} else {
|
||||
this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-";
|
||||
this.d = new byte[4];
|
||||
random.nextBytes(this.d);
|
||||
this.networkManager.queue(new Packet253KeyRequest(this.loginKey, publickey, this.d));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet252KeyResponse packet252keyresponse) {
|
||||
PrivateKey privatekey = this.server.H().getPrivate();
|
||||
|
||||
this.k = packet252keyresponse.a(privatekey);
|
||||
if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) {
|
||||
this.disconnect("Invalid client reply");
|
||||
}
|
||||
|
||||
this.networkManager.queue(new Packet252KeyResponse());
|
||||
}
|
||||
|
||||
public void a(Packet205ClientCommand packet205clientcommand) {
|
||||
if (packet205clientcommand.a == 0) {
|
||||
if (this.j) {
|
||||
this.disconnect("Duplicate login");
|
||||
return;
|
||||
}
|
||||
|
||||
this.j = true;
|
||||
(new AsyncLoginThread(this, server.server)).start(); // CraftBukkit - add CraftServer
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet1Login packet1login) {}
|
||||
|
||||
public void e() {
|
||||
// CraftBukkit start
|
||||
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.g, this.hostname);
|
||||
|
||||
if (s == null) {
|
||||
// this.disconnect(s);
|
||||
return;
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.g -> s
|
||||
|
||||
if (entityplayer != null) {
|
||||
this.server.getPlayerList().a((INetworkManager) this.networkManager, entityplayer);
|
||||
}
|
||||
}
|
||||
|
||||
this.b = true;
|
||||
}
|
||||
|
||||
public void a(String s, Object[] aobject) {
|
||||
this.server.getLogger().info(this.getName() + " lost connection");
|
||||
this.b = true;
|
||||
}
|
||||
|
||||
public void a(Packet254GetInfo packet254getinfo) {
|
||||
if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
|
||||
try {
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
String s = null;
|
||||
// CraftBukkit
|
||||
org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers());
|
||||
if (packet254getinfo.d()) {
|
||||
// CraftBukkit
|
||||
s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
|
||||
} else {
|
||||
List list = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(78), this.server.getVersion(), pingEvent.getMotd(), Integer.valueOf(playerlist.getPlayerCount()), pingEvent.getMaxPlayers()});
|
||||
|
||||
Object object;
|
||||
|
||||
for (Iterator iterator = list.iterator(); iterator.hasNext(); s = s + object.toString().replaceAll("\0", "")) {
|
||||
object = iterator.next();
|
||||
if (s == null) {
|
||||
s = "\u00A7";
|
||||
} else {
|
||||
s = s + '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
if (this.networkManager.getSocket() != null) {
|
||||
inetaddress = this.networkManager.getSocket().getInetAddress();
|
||||
}
|
||||
|
||||
this.networkManager.queue(new Packet255KickDisconnect(s));
|
||||
this.networkManager.d();
|
||||
if (inetaddress != null && this.server.ag() instanceof DedicatedServerConnection) {
|
||||
((DedicatedServerConnection) this.server.ag()).a(inetaddress);
|
||||
}
|
||||
|
||||
this.b = true;
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void onUnhandledPacket(Packet packet) {
|
||||
this.disconnect("Protocol error");
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
static String a(PendingConnection pendingconnection) {
|
||||
return pendingconnection.loginKey;
|
||||
}
|
||||
|
||||
static MinecraftServer b(PendingConnection pendingconnection) {
|
||||
return pendingconnection.server;
|
||||
}
|
||||
|
||||
static SecretKey c(PendingConnection pendingconnection) {
|
||||
return pendingconnection.k;
|
||||
}
|
||||
|
||||
static String d(PendingConnection pendingconnection) {
|
||||
return pendingconnection.g;
|
||||
}
|
||||
|
||||
static boolean a(PendingConnection pendingconnection, boolean flag) {
|
||||
return pendingconnection.h = flag;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
package net.minecraft.server.v1_7_R1;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
@ -1,4 +1,4 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
package net.minecraft.server.v1_7_R1;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
@ -1,42 +1,38 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
package net.minecraft.server.v1_7_R1;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.server.v1_7_R1.ChunkPreLoadEvent;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.BlockSand;
|
||||
import net.minecraft.server.v1_6_R3.Chunk;
|
||||
import net.minecraft.server.v1_6_R3.ChunkCoordinates;
|
||||
import net.minecraft.server.v1_6_R3.ChunkPosition;
|
||||
import net.minecraft.server.v1_6_R3.ChunkRegionLoader;
|
||||
import net.minecraft.server.v1_6_R3.CrashReport;
|
||||
import net.minecraft.server.v1_6_R3.CrashReportSystemDetails;
|
||||
import net.minecraft.server.v1_6_R3.EmptyChunk;
|
||||
import net.minecraft.server.v1_6_R3.EnumCreatureType;
|
||||
import net.minecraft.server.v1_6_R3.IChunkLoader;
|
||||
import net.minecraft.server.v1_6_R3.IChunkProvider;
|
||||
import net.minecraft.server.v1_6_R3.IProgressUpdate;
|
||||
import net.minecraft.server.v1_6_R3.ReportedException;
|
||||
import net.minecraft.server.v1_6_R3.World;
|
||||
import net.minecraft.server.v1_6_R3.WorldServer;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.chunkio.ChunkIOExecutor;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.util.LongHash;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.util.LongHashSet;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.util.LongObjectHashMap;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.chunkio.ChunkIOExecutor;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.util.LongHash;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.util.LongHashSet;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.util.LongObjectHashMap;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
// CraftBukkit start
|
||||
public LongHashSet unloadQueue = new LongHashSet();
|
||||
private static final Logger b = LogManager.getLogger();
|
||||
// CraftBukkit start - private -> public
|
||||
public LongHashSet unloadQueue = new LongHashSet(); // LongHashSet
|
||||
public Chunk emptyChunk;
|
||||
public IChunkProvider chunkProvider; // CraftBukkit
|
||||
private IChunkLoader e;
|
||||
public IChunkProvider chunkProvider;
|
||||
private IChunkLoader f;
|
||||
public boolean forceChunkLoad = false; // true -> false
|
||||
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
|
||||
public WorldServer world;
|
||||
@ -45,7 +41,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
|
||||
this.emptyChunk = new EmptyChunk(worldserver, 0, 0);
|
||||
this.world = worldserver;
|
||||
this.e = ichunkloader;
|
||||
this.f = ichunkloader;
|
||||
this.chunkProvider = ichunkprovider;
|
||||
}
|
||||
|
||||
@ -88,11 +84,11 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
|
||||
this.queueUnload(chunk.x, chunk.z);
|
||||
this.queueUnload(chunk.locX, chunk.locZ);
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start - add async variant, provide compatibility
|
||||
// CraftBukkit start - Add async variant, provide compatibility
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
return getChunkAt(i, j, null);
|
||||
}
|
||||
@ -103,16 +99,34 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
boolean newChunk = false;
|
||||
ChunkRegionLoader loader = null;
|
||||
|
||||
if (this.e instanceof ChunkRegionLoader) {
|
||||
loader = (ChunkRegionLoader) this.e;
|
||||
if (this.f instanceof ChunkRegionLoader) {
|
||||
loader = (ChunkRegionLoader) this.f;
|
||||
}
|
||||
|
||||
// If the chunk exists but isn't loaded do it async
|
||||
if (chunk == null && runnable != null && loader != null && loader.chunkExists(this.world, i, j)) {
|
||||
ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable);
|
||||
return null;
|
||||
// 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);
|
||||
return null;
|
||||
} else {
|
||||
chunk = ChunkIOExecutor.syncChunkLoad(this.world, loader, this, i, j);
|
||||
}
|
||||
} else if (chunk == null) {
|
||||
chunk = this.originalGetChunkAt(i, j);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
// If we didn't load the chunk async and have a callback run it now
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public Chunk originalGetChunkAt(int i, int j) {
|
||||
this.unloadQueue.remove(i, j);
|
||||
Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));
|
||||
boolean newChunk = false;
|
||||
|
||||
Server server = this.world.getServer();
|
||||
|
||||
@ -124,7 +138,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (event.isCancelled())
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (chunk == null) {
|
||||
chunk = this.loadChunk(i, j);
|
||||
if (chunk == null) {
|
||||
@ -138,7 +152,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated");
|
||||
|
||||
crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
|
||||
crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j)));
|
||||
crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); // CraftBukkit - Use LongHash
|
||||
crashreportsystemdetails.a("Generator", this.chunkProvider.getName());
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@ -147,9 +161,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit
|
||||
if (chunk != null) {
|
||||
chunk.addEntities();
|
||||
}
|
||||
chunk.addEntities();
|
||||
|
||||
// CraftBukkit start
|
||||
if (server != null) {
|
||||
@ -161,16 +173,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
chunk.a(this, this, i, j);
|
||||
}
|
||||
|
||||
// CraftBukkit start - If we didn't need to load the chunk run the callback now
|
||||
if (runnable != null) {
|
||||
runnable.run();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@ -180,9 +185,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
if (chunk == this.emptyChunk) return chunk;
|
||||
if (i != chunk.x || j != chunk.z) {
|
||||
this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
|
||||
this.world.getLogger().severe(chunk.getClass().getName());
|
||||
if (i != chunk.locX || j != chunk.locZ) {
|
||||
b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
|
||||
b.error(chunk.getClass().getName());
|
||||
Throwable ex = new Throwable();
|
||||
ex.fillInStackTrace();
|
||||
ex.printStackTrace();
|
||||
@ -192,14 +197,14 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public
|
||||
if (this.e == null) {
|
||||
if (this.f == null) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Chunk chunk = this.e.a(this.world, i, j);
|
||||
Chunk chunk = this.f.a(this.world, i, j);
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.n = this.world.getTime();
|
||||
chunk.p = this.world.getTime();
|
||||
if (this.chunkProvider != null) {
|
||||
this.chunkProvider.recreateStructures(i, j);
|
||||
}
|
||||
@ -207,35 +212,35 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
return chunk;
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
b.error("Couldn\'t load chunk", exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public
|
||||
if (this.e != null) {
|
||||
if (this.f != null) {
|
||||
try {
|
||||
this.e.b(this.world, chunk);
|
||||
this.f.b(this.world, chunk);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
b.error("Couldn\'t save entities", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
|
||||
if (this.e != null) {
|
||||
if (this.f != null) {
|
||||
try {
|
||||
chunk.n = this.world.getTime();
|
||||
this.e.a(this.world, chunk);
|
||||
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
ioexception.printStackTrace();
|
||||
// CraftBukkit start - remove extra exception
|
||||
chunk.p = this.world.getTime();
|
||||
this.f.a(this.world, chunk);
|
||||
// CraftBukkit start - IOException to Exception
|
||||
} catch (Exception ioexception) {
|
||||
b.error("Couldn\'t save chunk", ioexception);
|
||||
/* Remove extra exception
|
||||
} catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
|
||||
// CraftBukkit end */
|
||||
}
|
||||
// } catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
// exceptionworldconflict.printStackTrace();
|
||||
// }
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +248,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
Chunk chunk = this.getOrCreateChunk(i, j);
|
||||
|
||||
if (!chunk.done) {
|
||||
chunk.done = true;
|
||||
chunk.p();
|
||||
if (this.chunkProvider != null) {
|
||||
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
|
||||
|
||||
@ -257,8 +262,13 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
org.bukkit.World world = this.world.getWorld();
|
||||
if (world != null) {
|
||||
for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
populator.populate(world, random, chunk.bukkitChunk);
|
||||
this.world.populating = true;
|
||||
try {
|
||||
for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
|
||||
populator.populate(world, random, chunk.bukkitChunk);
|
||||
}
|
||||
} finally {
|
||||
this.world.populating = false;
|
||||
}
|
||||
}
|
||||
BlockSand.instaFall = false;
|
||||
@ -285,7 +295,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
if (chunk.a(flag)) {
|
||||
this.saveChunk(chunk);
|
||||
chunk.l = false;
|
||||
chunk.n = false;
|
||||
++i;
|
||||
if (i == 24 && !flag) {
|
||||
return false;
|
||||
@ -297,11 +307,11 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public void b() {
|
||||
if (this.e != null) {
|
||||
this.e.b();
|
||||
if (this.f != null) {
|
||||
this.f.b();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean unloadChunks() {
|
||||
if (!this.world.savingDisabled) {
|
||||
// CraftBukkit start
|
||||
@ -317,14 +327,15 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
chunk.removeEntities();
|
||||
this.saveChunk(chunk);
|
||||
this.saveChunkNOP(chunk);
|
||||
// this.unloadQueue.remove(integer);
|
||||
// this.unloadQueue.remove(olong);
|
||||
// this.chunks.remove(olong.longValue());
|
||||
this.chunks.remove(chunkcoordinates); // CraftBukkit
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.e != null) {
|
||||
this.e.a();
|
||||
if (this.f != null) {
|
||||
this.f.a();
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +347,8 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit
|
||||
// CraftBukkit - this.chunks.count() -> .values().size()
|
||||
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size();
|
||||
}
|
||||
|
||||
public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {
|
||||
@ -348,7 +360,8 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public int getLoadedChunks() {
|
||||
return this.chunks.values().size(); // CraftBukkit
|
||||
// CraftBukkit - this.chunks.count() -> .values().size()
|
||||
return this.chunks.values().size();
|
||||
}
|
||||
|
||||
public void recreateStructures(int i, int j) {}
|
@ -1,14 +1,8 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
package net.minecraft.server.v1_7_R1;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.ContainerAnvil;
|
||||
import net.minecraft.server.v1_6_R3.IInventory;
|
||||
import net.minecraft.server.v1_6_R3.InventorySubcontainer;
|
||||
import net.minecraft.server.v1_6_R3.ItemStack;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftHumanEntity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
// CraftBukkit end
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user