More changes
This commit is contained in:
parent
3dda9352e7
commit
70c76d976f
Binary file not shown.
@ -247,23 +247,7 @@ public class MapUtil
|
||||
System.out.println("Error removing world from bukkit master list: " + ex.getMessage());
|
||||
}
|
||||
|
||||
MinecraftServer ms = null;
|
||||
|
||||
try
|
||||
{
|
||||
Field f = server.getClass().getDeclaredField("console");
|
||||
f.setAccessible(true);
|
||||
ms = (MinecraftServer) f.get(server);
|
||||
f.setAccessible(false);
|
||||
}
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
System.out.println("Error getting minecraftserver variable: " + ex.getMessage());
|
||||
}
|
||||
catch (NoSuchFieldException ex)
|
||||
{
|
||||
System.out.println("Error getting minecraftserver variable: " + ex.getMessage());
|
||||
}
|
||||
MinecraftServer ms = server.getServer();
|
||||
|
||||
ms.worlds.remove(ms.worlds.indexOf(craftWorld.getHandle()));
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class UtilEnt
|
||||
|
||||
if (_bsRestrictionGoal == null)
|
||||
{
|
||||
_bsRestrictionGoal = EntityCreature.class.getDeclaredField("bs");
|
||||
_bsRestrictionGoal = EntityCreature.class.getDeclaredField("c");
|
||||
_bsRestrictionGoal.setAccessible(true);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,10 @@ public class UtilFirework
|
||||
|
||||
((CraftFirework) firework).getHandle().expectedLifespan = 1;
|
||||
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId());
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
firework.getEntityId()
|
||||
});
|
||||
|
||||
for (Player viewing : UtilServer.getPlayers())
|
||||
{
|
||||
|
@ -68,15 +68,21 @@ public class UtilTextTop
|
||||
|
||||
private static void deleteOld(Player player)
|
||||
{
|
||||
//Delete Dragon (All Clients)
|
||||
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(EntityDragonId);
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyDragonPacket);
|
||||
// Delete Dragon (All Clients)
|
||||
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
EntityDragonId
|
||||
});
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(destroyDragonPacket);
|
||||
|
||||
//Delete Wither (1.8+ Only)
|
||||
// Delete Wither (1.8+ Only)
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(EntityWitherId);
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyWitherPacket);
|
||||
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
EntityWitherId
|
||||
});
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(destroyWitherPacket);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,13 +149,11 @@ public class UtilTextTop
|
||||
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
|
||||
watcher.a(6, (Float) (float) health);
|
||||
watcher.a(2, (String) text); //Entity name
|
||||
watcher.a(10, (String) text); //Entity name
|
||||
watcher.a(3, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
||||
watcher.a(11, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
||||
watcher.a(16, (Integer) (int) health); //Health
|
||||
watcher.a(20, (Integer) (int) 881); //Inv
|
||||
|
||||
int i1 = watcher.getInt(0);
|
||||
int i1 = watcher.getByte(0);
|
||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
||||
|
||||
return watcher;
|
||||
|
@ -83,6 +83,7 @@ public class WorldUtil
|
||||
|
||||
WorldData worldData = new WorldData(new WorldSettings(creator.seed(), WorldSettings.EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), name);
|
||||
WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), worldData, dimension, server.getServer().methodProfiler, creator.environment(), generator);
|
||||
internal.b();
|
||||
|
||||
boolean containsWorld = false;
|
||||
for (World otherWorld : server.getWorlds())
|
||||
|
@ -174,7 +174,15 @@ public class ZipUtil
|
||||
int size;
|
||||
byte[] buffer = new byte[2048];
|
||||
|
||||
fileOutputStream = new FileOutputStream(outputDirectory + File.separator + entry.getName());
|
||||
String fileName = outputDirectory + File.separator + entry.getName();
|
||||
|
||||
if (fileName.endsWith("/"))
|
||||
{
|
||||
new File(fileName).mkdirs();
|
||||
continue;
|
||||
}
|
||||
|
||||
fileOutputStream = new FileOutputStream(fileName);
|
||||
bufferedOutputStream = new BufferedOutputStream(fileOutputStream, buffer.length);
|
||||
|
||||
while ((size = zipInputStream.read(buffer, 0, buffer.length)) != -1)
|
||||
|
@ -222,9 +222,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>)spawnPacket.l.c())
|
||||
{
|
||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1)
|
||||
if (watchable.a() == 3 && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1)
|
||||
{
|
||||
final String entityName = spawnPacket.l.getString(10);
|
||||
final String entityName = spawnPacket.l.getString(2);
|
||||
|
||||
if (entityName.isEmpty())
|
||||
{
|
||||
@ -234,7 +234,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
|
||||
if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a))
|
||||
{
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(spawnPacket.a)));
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_entityMap.get(owner.getName()).get(spawnPacket.a)
|
||||
}));
|
||||
}
|
||||
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
@ -257,13 +260,13 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>)metaPacket.b)
|
||||
{
|
||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1)
|
||||
if (watchable.a() == 3 && watchable.b() instanceof Byte && ((Byte) watchable.b()) == 1)
|
||||
{
|
||||
nameShowing = true;
|
||||
}
|
||||
if ((watchable.a() == 10 || watchable.a() == 2) && watchable.b() instanceof String)
|
||||
if (watchable.a() == 2 && watchable.b() instanceof String)
|
||||
{
|
||||
entityName = (String)watchable.b();
|
||||
entityName = (String) watchable.b();
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,7 +291,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
if (_entityMap.get(owner.getName()).containsKey(id))
|
||||
{
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(id)));
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_entityMap.get(owner.getName()).get(id)
|
||||
}));
|
||||
_entityMap.get(owner.getName()).remove(id);
|
||||
_entityVehicleMap.get(owner.getName()).remove(id);
|
||||
_entityNameMap.get(owner.getName()).remove(id);
|
||||
@ -520,7 +526,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
watcher.a(10, Byte.valueOf((byte)0));
|
||||
|
||||
// Set invisible
|
||||
int i1 = watcher.getInt(0);
|
||||
int i1 = watcher.getByte(0);
|
||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
||||
|
||||
// Set small
|
||||
|
@ -10,6 +10,7 @@ import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.Block;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Chunk;
|
||||
import net.minecraft.server.v1_8_R3.ChunkSection;
|
||||
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||
@ -41,8 +42,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -92,18 +91,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
|
||||
private boolean _handlingPacket = false;
|
||||
|
||||
private Field _attributesA;
|
||||
private Field _attributesB;
|
||||
private Field _soundB;
|
||||
private Field _soundC;
|
||||
private Field _soundD;
|
||||
private Field _bedA;
|
||||
private Field _bedB;
|
||||
private Field _bedD;
|
||||
private Field _xChunk;
|
||||
private Field _zChunk;
|
||||
private Field _eStatusId;
|
||||
private Field _eStatusState;
|
||||
|
||||
private Chunk _bedChunk;
|
||||
private boolean _bedPackets;
|
||||
@ -123,33 +112,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
|
||||
try
|
||||
{
|
||||
_attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a");
|
||||
_attributesA.setAccessible(true);
|
||||
_attributesB = PacketPlayOutUpdateAttributes.class.getDeclaredField("b");
|
||||
_attributesB.setAccessible(true);
|
||||
_soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b");
|
||||
_soundB.setAccessible(true);
|
||||
_soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c");
|
||||
_soundC.setAccessible(true);
|
||||
_soundD = PacketPlayOutNamedSoundEffect.class.getDeclaredField("d");
|
||||
_soundD.setAccessible(true);
|
||||
_bedA = PacketPlayOutBed.class.getDeclaredField("a");
|
||||
_bedA.setAccessible(true);
|
||||
_bedB = PacketPlayOutBed.class.getDeclaredField("b");
|
||||
_bedB.setAccessible(true);
|
||||
_bedD = PacketPlayOutBed.class.getDeclaredField("d");
|
||||
_bedD.setAccessible(true);
|
||||
_eStatusId = PacketPlayOutEntityStatus.class.getDeclaredField("a");
|
||||
_eStatusId.setAccessible(true);
|
||||
_eStatusState = PacketPlayOutEntityStatus.class.getDeclaredField("b");
|
||||
_eStatusState.setAccessible(true);
|
||||
|
||||
_bedChunk = new Chunk(null, 0, 0);
|
||||
Field cSection = Chunk.class.getDeclaredField("sections");
|
||||
cSection.setAccessible(true);
|
||||
|
||||
ChunkSection chunkSection = new ChunkSection(0, false);
|
||||
Block block = Block.getById(Material.BED_BLOCK.getId());
|
||||
// Block block = Block.getById(Material.BED_BLOCK.getId());
|
||||
|
||||
// block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"),"byId")
|
||||
// .get(null))[Material.BED_BLOCK.getId()];
|
||||
@ -461,13 +429,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
PacketPlayOutBed bedPacket = new PacketPlayOutBed();
|
||||
|
||||
_bedA.set(bedPacket, playerDisguise.GetEntityId());
|
||||
bedPacket.a = playerDisguise.GetEntityId();
|
||||
|
||||
int chunkX = getChunk(recieving.getX());
|
||||
int chunkZ = getChunk(recieving.getZ());
|
||||
|
||||
_bedB.set(bedPacket, (chunkX * 16) + 1 + playerDisguise.getSleepingDirection().getModX());
|
||||
_bedD.set(bedPacket, (chunkZ * 16) + 1 + playerDisguise.getSleepingDirection().getModZ());
|
||||
bedPacket.b = new BlockPosition((chunkX * 16) + 1 + playerDisguise.getSleepingDirection().getModX(), 0, (chunkZ * 16)
|
||||
+ 1 + playerDisguise.getSleepingDirection().getModZ());
|
||||
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(playerDisguise.GetEntity());
|
||||
|
||||
@ -590,17 +558,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
rabbitHops.put(owner.getEntityId(), System.currentTimeMillis());
|
||||
|
||||
PacketPlayOutEntityStatus entityStatus = new PacketPlayOutEntityStatus();
|
||||
try
|
||||
{
|
||||
_eStatusId.set(entityStatus, entityId);
|
||||
_eStatusState.set(entityStatus, (byte) 1);
|
||||
|
||||
handlePacket(entityStatus, packetVerifier);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
entityStatus.a = entityId;
|
||||
entityStatus.b = (byte) 1;
|
||||
|
||||
handlePacket(entityStatus, packetVerifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -660,20 +622,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutUpdateAttributes)
|
||||
{
|
||||
int entityId = -1;
|
||||
|
||||
try
|
||||
{
|
||||
entityId = (int) _attributesA.get((PacketPlayOutUpdateAttributes) packet);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
int entityId = ((PacketPlayOutUpdateAttributes) packet).a;
|
||||
|
||||
if (_spawnPacketMap.containsKey(entityId)
|
||||
&& owner.getEntityId() != entityId
|
||||
|
@ -56,7 +56,7 @@ public class BlockMap implements Listener
|
||||
{
|
||||
// Make sure the world doesn't change the mapcount information
|
||||
PersistentCollection collection = ((CraftWorld) corner1.getWorld()).getHandle().worldMaps;
|
||||
Field f = collection.getClass().getDeclaredField("a");
|
||||
Field f = collection.getClass().getDeclaredField("b");
|
||||
f.setAccessible(true);
|
||||
f.set(collection, null);
|
||||
}
|
||||
|
@ -352,52 +352,6 @@ public class HoleInTheWall extends SoloGame
|
||||
_wallHeight += Math.abs(tnt1.getY() - tnt2.getY());
|
||||
}
|
||||
|
||||
private void setField(Object obj, String fieldName, Object value)
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = _fields.get(fieldName);
|
||||
|
||||
if (field == null)
|
||||
{
|
||||
field = obj.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
|
||||
_fields.put(fieldName, field);
|
||||
}
|
||||
|
||||
field.set(obj, value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int getField(String fieldName, Object obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = _fields.get(fieldName);
|
||||
|
||||
if (field == null)
|
||||
{
|
||||
field = obj.getClass().getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
|
||||
_fields.put(fieldName, field);
|
||||
}
|
||||
|
||||
return field.getInt(obj);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SpawnWall(UpdateEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user