Untested bugfixes
This commit is contained in:
parent
6d0ca4f813
commit
496983ee04
@ -789,4 +789,29 @@ public class UtilPlayer
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isGliding(Player player)
|
||||
{
|
||||
return ((CraftPlayer) player).getHandle().isGliding();
|
||||
}
|
||||
|
||||
public static void setGliding(Player player, boolean gliding)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().setGliding(gliding);
|
||||
}
|
||||
|
||||
public static void setAutoDeploy(Player player, boolean autoDeploy)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().setAutoWingsDeploy(autoDeploy);
|
||||
}
|
||||
|
||||
public static void setGlidableWithoutWings(Player player, boolean glidableWithoutWings)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().setGlidableWithoutWings(glidableWithoutWings);
|
||||
}
|
||||
|
||||
public static void setAutoDeployDistance(Player player, float distance)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().setWingsDeployAt(distance);
|
||||
}
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
||||
PacketPlayOutNamedEntitySpawn.class, PacketPlayInUseEntity.class, PacketPlayOutAttachEntity.class);
|
||||
|
||||
// NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
||||
// NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
||||
// NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
||||
// NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
||||
NCPHookManager.addHook(CheckType.ALL, this);
|
||||
}
|
||||
|
||||
@ -256,15 +256,16 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
return;
|
||||
}
|
||||
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
Integer[] ids = new Integer[]
|
||||
{
|
||||
UtilEnt.getNewEntityId(),
|
||||
UtilEnt.getNewEntityId()
|
||||
};
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName);
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, new Integer[]
|
||||
{
|
||||
newId
|
||||
});
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, ids);
|
||||
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true, -1);
|
||||
sendProtocolPackets(owner, spawnPacket.a, ids[1], entityName, verifier, true, ids[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -331,13 +332,13 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
}
|
||||
|
||||
String newName = currentName;
|
||||
boolean newDisplay = isDisplaying;
|
||||
boolean displayName = isDisplaying;
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>) metaPacket.b)
|
||||
{
|
||||
if (watchable.a() == 3 && watchable.b() instanceof Byte)
|
||||
{
|
||||
newDisplay = ((Byte) watchable.b()) == 1;
|
||||
displayName = ((Byte) watchable.b()) == 1;
|
||||
}
|
||||
|
||||
if (watchable.a() == 2 && watchable.b() instanceof String)
|
||||
@ -347,10 +348,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
}
|
||||
|
||||
// If the name has changed and the name should be showing, or the name display status has changed.
|
||||
if ((!newName.equals(currentName) && newDisplay) || newDisplay != isDisplaying)
|
||||
if ((!newName.equals(currentName) && displayName) || displayName != isDisplaying)
|
||||
{
|
||||
// If name is still being displayed
|
||||
if (newDisplay)
|
||||
if (displayName)
|
||||
{
|
||||
Integer[] newId;
|
||||
|
||||
@ -363,6 +364,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
newId = new Integer[]
|
||||
{
|
||||
UtilEnt.getNewEntityId(),
|
||||
UtilEnt.getNewEntityId()
|
||||
};
|
||||
|
||||
@ -370,7 +372,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
}
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(metaPacket.a, newName);
|
||||
sendProtocolPackets(owner, metaPacket.a, newId[0], newName, verifier, !isDisplaying, -1);
|
||||
sendProtocolPackets(owner, metaPacket.a, newId[1], newName, verifier, !isDisplaying,
|
||||
!isDisplaying ? newId[0] : -1);
|
||||
}
|
||||
else
|
||||
{ // Lets delete it
|
||||
@ -483,8 +486,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
|
||||
_entityRiding.get(owner.getName()).remove(attachPacket.b);
|
||||
|
||||
sendProtocolPackets(owner, vehicleId, ids[ids.length - 1], _entityNameMap.get(owner.getName()).get(vehicleId),
|
||||
verifier, true, ids.length > 1 ? ids[0] : -1);
|
||||
sendProtocolPackets(owner, vehicleId, ids[1], _entityNameMap.get(owner.getName()).get(vehicleId), verifier,
|
||||
true, ids[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public enum GameDisplay
|
||||
Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13),
|
||||
DragonsTeams("Dragons Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 14),
|
||||
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
|
||||
ElytraRings("ElytraRings", Material.ELYTRA, (byte) 0, GameCategory.CLASSICS, 61),
|
||||
ElytraRings("Elytra Rings", Material.ELYTRA, (byte) 0, GameCategory.CLASSICS, 61),
|
||||
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
||||
Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18),
|
||||
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||
|
@ -871,6 +871,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
UtilInv.Clear(player);
|
||||
|
||||
UtilPlayer.setAutoDeploy(player, false);
|
||||
UtilPlayer.setGlidableWithoutWings(player, false);
|
||||
UtilPlayer.setGliding(player, false);
|
||||
UtilPlayer.setAutoDeployDistance(player, 1.15F);
|
||||
|
||||
((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0), EntityLiving.META_ENTITYDATA, (byte) 0);
|
||||
|
||||
player.setCustomName("");
|
||||
|
@ -240,54 +240,45 @@ public class HideSeek extends TeamGame
|
||||
|
||||
for (Entry<Player, Form> entry : _forms.entrySet())
|
||||
{
|
||||
if (entry.getValue() instanceof BlockForm)
|
||||
if (!(entry.getValue() instanceof BlockForm))
|
||||
continue;
|
||||
|
||||
final BlockForm blockForm = (BlockForm) entry.getValue();
|
||||
|
||||
if (blockForm.Player.getEntityId() != id || blockForm.Player == packetInfo.getPlayer())
|
||||
continue;
|
||||
|
||||
final Player player = packetInfo.getPlayer();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
final BlockForm blockForm = (BlockForm) entry
|
||||
.getValue();
|
||||
|
||||
if (blockForm.Player.getEntityId() == id
|
||||
&& blockForm.Player != packetInfo.getPlayer())
|
||||
public void run()
|
||||
{
|
||||
final Player player = packetInfo.getPlayer();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(
|
||||
Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilPlayer
|
||||
.sendPacket(
|
||||
player,
|
||||
blockForm
|
||||
.getBlockPackets(UtilPlayer.is1_9(player)));
|
||||
}
|
||||
});
|
||||
break;
|
||||
UtilPlayer.sendPacket(player, blockForm.getBlockPackets(UtilPlayer.is1_9(player)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy)
|
||||
{
|
||||
for (int i : ((PacketPlayOutEntityDestroy) packetInfo
|
||||
.getPacket()).a)
|
||||
for (int i : ((PacketPlayOutEntityDestroy) packetInfo.getPacket()).a)
|
||||
{
|
||||
for (Entry<Player, Form> entry : _forms.entrySet())
|
||||
{
|
||||
if (entry.getValue() instanceof BlockForm)
|
||||
{
|
||||
BlockForm blockForm = (BlockForm) entry.getValue();
|
||||
if (!(entry.getValue() instanceof BlockForm))
|
||||
continue;
|
||||
|
||||
if (blockForm.Player.getEntityId() == i)
|
||||
BlockForm blockForm = (BlockForm) entry.getValue();
|
||||
|
||||
if (blockForm.Player.getEntityId() != i)
|
||||
continue;
|
||||
|
||||
UtilPlayer.sendPacket(packetInfo.getPlayer(), new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
UtilPlayer.sendPacket(packetInfo.getPlayer(),
|
||||
new PacketPlayOutEntityDestroy(
|
||||
new int[]
|
||||
{
|
||||
blockForm.getBlockId()
|
||||
}));
|
||||
}
|
||||
}
|
||||
blockForm.getBlockId()
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ public class BlockForm extends Form
|
||||
private int _entityId;
|
||||
|
||||
private Location _loc;
|
||||
private int _selfEntityId1;
|
||||
private int _selfEntityId2;
|
||||
private int _fakeSilverfishId;
|
||||
private int _fakeBlockId;
|
||||
private Vector _lastSaw;
|
||||
private Vector _sawDiff = new Vector();
|
||||
private int _blockId = UtilEnt.getNewEntityId();
|
||||
@ -66,8 +66,8 @@ public class BlockForm extends Form
|
||||
|
||||
_mat = mat;
|
||||
_loc = player.getLocation();
|
||||
_selfEntityId1 = UtilEnt.getNewEntityId();
|
||||
_selfEntityId2 = UtilEnt.getNewEntityId();
|
||||
_fakeSilverfishId = UtilEnt.getNewEntityId();
|
||||
_fakeBlockId = UtilEnt.getNewEntityId();
|
||||
System.out.println("Block Form: " + _mat + " " + _mat.getId());
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ public class BlockForm extends Form
|
||||
Packet[] packets = new Packet[3];
|
||||
|
||||
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
|
||||
packet1.a = _selfEntityId1;
|
||||
packet1.a = _fakeSilverfishId;
|
||||
packet1.b = EntityType.SILVERFISH.getTypeId();
|
||||
packet1.c = (int) Math.floor(_lastSaw.getX() * 32);
|
||||
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
|
||||
@ -114,9 +114,9 @@ public class BlockForm extends Form
|
||||
|
||||
if (UtilPlayer.is1_9(Player))
|
||||
{
|
||||
packets[2] = new PacketPlayOutNewAttachEntity(_selfEntityId1, new int[]
|
||||
packets[2] = new PacketPlayOutNewAttachEntity(_fakeSilverfishId, new int[]
|
||||
{
|
||||
_selfEntityId2
|
||||
_fakeBlockId
|
||||
});
|
||||
|
||||
}
|
||||
@ -124,14 +124,14 @@ public class BlockForm extends Form
|
||||
{
|
||||
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
|
||||
|
||||
packet3.b = _selfEntityId2;
|
||||
packet3.c = _selfEntityId1;
|
||||
packet3.b = _fakeBlockId;
|
||||
packet3.c = _fakeSilverfishId;
|
||||
|
||||
packets[2] = packet3;
|
||||
}
|
||||
|
||||
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, 70, _mat.getId());
|
||||
packet2.a = _selfEntityId2;
|
||||
packet2.a = _fakeBlockId;
|
||||
packet2.uuid = UUID.randomUUID();
|
||||
packets[1] = packet2;
|
||||
|
||||
@ -140,16 +140,11 @@ public class BlockForm extends Form
|
||||
// Inform
|
||||
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
|
||||
if (!blockName.contains("Block"))
|
||||
UtilPlayer.message(
|
||||
Player,
|
||||
F.main("Game",
|
||||
C.cWhite + "You are now a "
|
||||
+ F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!"));
|
||||
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a "
|
||||
+ F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!"));
|
||||
else
|
||||
UtilPlayer.message(
|
||||
Player,
|
||||
F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false))
|
||||
+ "!"));
|
||||
UtilPlayer.message(Player, F.main("Game",
|
||||
C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false)) + "!"));
|
||||
|
||||
// Give Item
|
||||
Player.getInventory().setItem(8, new ItemStack(Host.GetItemEquivilent(_mat)));
|
||||
@ -171,11 +166,11 @@ public class BlockForm extends Form
|
||||
|
||||
if (is19)
|
||||
{
|
||||
packets[2] = new PacketPlayOutNewAttachEntity(_blockId, new int[]
|
||||
packets[1] = new PacketPlayOutNewAttachEntity(Player.getEntityId(), new int[]
|
||||
{
|
||||
Player.getEntityId()
|
||||
});
|
||||
_blockId
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -203,8 +198,8 @@ public class BlockForm extends Form
|
||||
|
||||
UtilPlayer.sendPacket(Player, new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_selfEntityId1,
|
||||
_selfEntityId2,
|
||||
_fakeSilverfishId,
|
||||
_fakeBlockId,
|
||||
_blockId
|
||||
}));
|
||||
|
||||
@ -214,8 +209,8 @@ public class BlockForm extends Form
|
||||
public void SolidifyUpdate()
|
||||
{
|
||||
if (!Player.isSprinting())
|
||||
((CraftEntity) Player).getHandle().getDataWatcher()
|
||||
.watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32);
|
||||
((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA,
|
||||
(byte) 32);
|
||||
|
||||
// Not a Block
|
||||
if (_block == null)
|
||||
@ -273,26 +268,26 @@ public class BlockForm extends Form
|
||||
|
||||
_sawDiff.add(blockLoc.clone().subtract(_lastSaw));
|
||||
|
||||
Packet packet = this.getPacket(_sawDiff, blockLoc);
|
||||
Packet[] packet = this.getPacket(_sawDiff, blockLoc);
|
||||
|
||||
_lastSaw = Player.getLocation().toVector().subtract(new Vector(0, 0.15625, 0));
|
||||
_sawDiff = _lastSaw.clone().subtract(blockLoc);
|
||||
|
||||
if (packet != null)
|
||||
{
|
||||
if (packet instanceof PacketPlayOutEntityTeleport)
|
||||
if (packet[0] instanceof PacketPlayOutEntityTeleport)
|
||||
{
|
||||
_sawDiff = new Vector();
|
||||
}
|
||||
|
||||
((CraftPlayer) Player).getHandle().playerConnection.sendPacket(packet);
|
||||
UtilPlayer.sendPacket(Player, packet[UtilPlayer.is1_9(Player) ? 1 : 0]);
|
||||
}
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
getBlockId()
|
||||
getBlockId()
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -321,8 +316,8 @@ public class BlockForm extends Form
|
||||
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0);
|
||||
_block = null;
|
||||
|
||||
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) Player).getHandle().world).tracker.trackedEntities
|
||||
.get(Player.getEntityId());
|
||||
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) Player)
|
||||
.getHandle().world).tracker.trackedEntities.get(Player.getEntityId());
|
||||
|
||||
if (tracker != null)
|
||||
{
|
||||
@ -374,13 +369,13 @@ public class BlockForm extends Form
|
||||
|
||||
_lastSaw = Player.getLocation().subtract(0, 0.15625, 0).toVector();
|
||||
|
||||
Packet packet = this.getPacket(_sawDiff, _lastSaw);
|
||||
Packet[] packet = this.getPacket(_sawDiff, _lastSaw);
|
||||
|
||||
if (packet != null)
|
||||
{
|
||||
if (packet instanceof PacketPlayOutRelEntityMove)
|
||||
if (!UtilPlayer.is1_9(Player) && packet[0] instanceof PacketPlayOutRelEntityMove)
|
||||
{
|
||||
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet;
|
||||
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet[0];
|
||||
_sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D));
|
||||
}
|
||||
else
|
||||
@ -388,12 +383,12 @@ public class BlockForm extends Form
|
||||
_sawDiff = new Vector();
|
||||
}
|
||||
|
||||
UtilPlayer.sendPacket(Player, packet);
|
||||
UtilPlayer.sendPacket(Player, packet[UtilPlayer.is1_9(Player) ? 1 : 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Packet getPacket(Vector blocksFromNewPosition, Vector newPosition)
|
||||
private Packet[] getPacket(Vector blocksFromNewPosition, Vector newPosition)
|
||||
{
|
||||
int x = (int) Math.floor(blocksFromNewPosition.getX() * 32);
|
||||
int y = (int) Math.floor(blocksFromNewPosition.getY() * 32);
|
||||
@ -401,26 +396,33 @@ public class BlockForm extends Form
|
||||
|
||||
if (x != 0 || y != 0 || z != 0)
|
||||
{
|
||||
Packet[] packets = new Packet[2];
|
||||
|
||||
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
|
||||
{
|
||||
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
|
||||
relMove.a = this._selfEntityId1;
|
||||
relMove.a = this._fakeSilverfishId;
|
||||
relMove.b = (byte) x;
|
||||
relMove.c = (byte) y;
|
||||
relMove.d = (byte) z;
|
||||
|
||||
return relMove;
|
||||
packets[0] = relMove;
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
||||
teleportPacket.a = _selfEntityId1;
|
||||
teleportPacket.a = _fakeSilverfishId;
|
||||
teleportPacket.b = (int) Math.floor(32 * newPosition.getX());
|
||||
teleportPacket.c = (int) Math.floor(32 * newPosition.getY());
|
||||
teleportPacket.d = (int) Math.floor(32 * newPosition.getZ());
|
||||
|
||||
return teleportPacket;
|
||||
if (packets[0] == null)
|
||||
packets[0] = teleportPacket;
|
||||
|
||||
packets[1] = teleportPacket;
|
||||
}
|
||||
|
||||
return packets;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user