Fix sleeping disguises
This commit is contained in:
parent
291942b9b4
commit
6e77551f2e
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>LibsDisguises</groupId>
|
<groupId>LibsDisguises</groupId>
|
||||||
<artifactId>LibsDisguises</artifactId>
|
<artifactId>LibsDisguises</artifactId>
|
||||||
<version>9.0.7</version>
|
<version>9.0.7-SNAPSHOT</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
@ -53,9 +53,11 @@ public class DisguiseListener implements Listener
|
|||||||
public DisguiseListener(LibsDisguises libsDisguises)
|
public DisguiseListener(LibsDisguises libsDisguises)
|
||||||
{
|
{
|
||||||
plugin = libsDisguises;
|
plugin = libsDisguises;
|
||||||
|
|
||||||
if (plugin.getConfig().getBoolean("NotifyUpdate"))
|
if (plugin.getConfig().getBoolean("NotifyUpdate"))
|
||||||
{
|
{
|
||||||
currentVersion = plugin.getDescription().getVersion();
|
currentVersion = plugin.getDescription().getVersion();
|
||||||
|
|
||||||
updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable()
|
updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -65,10 +67,16 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
UpdateChecker updateChecker = new UpdateChecker();
|
UpdateChecker updateChecker = new UpdateChecker();
|
||||||
updateChecker.checkUpdate("v" + currentVersion);
|
updateChecker.checkUpdate("v" + currentVersion);
|
||||||
|
|
||||||
latestVersion = updateChecker.getLatestVersion();
|
latestVersion = updateChecker.getLatestVersion();
|
||||||
if (latestVersion != null)
|
|
||||||
|
if (latestVersion == null)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
latestVersion = "v" + latestVersion;
|
latestVersion = "v" + latestVersion;
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -76,16 +84,17 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (p.hasPermission(DisguiseConfig.getUpdateNotificationPermission()))
|
if (!p.hasPermission(DisguiseConfig.getUpdateNotificationPermission()))
|
||||||
{
|
{
|
||||||
p.sendMessage(String.format(DisguiseConfig.getUpdateMessage(), currentVersion,
|
continue;
|
||||||
latestVersion));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.sendMessage(
|
||||||
|
String.format(DisguiseConfig.getUpdateMessage(), currentVersion, latestVersion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
System.out.print(String.format("[LibsDisguises] Failed to check for update: %s", ex.getMessage()));
|
System.out.print(String.format("[LibsDisguises] Failed to check for update: %s", ex.getMessage()));
|
||||||
@ -102,10 +111,12 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
r.cancel();
|
r.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Disguise d : disguiseEntity.values())
|
for (Disguise d : disguiseEntity.values())
|
||||||
{
|
{
|
||||||
d.removeDisguise();
|
d.removeDisguise();
|
||||||
}
|
}
|
||||||
|
|
||||||
disguiseClone.clear();
|
disguiseClone.clear();
|
||||||
updaterTask.cancel();
|
updaterTask.cancel();
|
||||||
}
|
}
|
||||||
@ -113,9 +124,11 @@ public class DisguiseListener implements Listener
|
|||||||
private void checkPlayerCanBlowDisguise(Player entity)
|
private void checkPlayerCanBlowDisguise(Player entity)
|
||||||
{
|
{
|
||||||
Disguise[] disguises = DisguiseAPI.getDisguises(entity);
|
Disguise[] disguises = DisguiseAPI.getDisguises(entity);
|
||||||
|
|
||||||
if (disguises.length > 0)
|
if (disguises.length > 0)
|
||||||
{
|
{
|
||||||
DisguiseAPI.undisguiseToAll(entity);
|
DisguiseAPI.undisguiseToAll(entity);
|
||||||
|
|
||||||
if (DisguiseConfig.getDisguiseBlownMessage().length() > 0)
|
if (DisguiseConfig.getDisguiseBlownMessage().length() > 0)
|
||||||
{
|
{
|
||||||
entity.sendMessage(DisguiseConfig.getDisguiseBlownMessage());
|
entity.sendMessage(DisguiseConfig.getDisguiseBlownMessage());
|
||||||
@ -127,6 +140,7 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Resend the bed chunks
|
||||||
for (PacketContainer packet : DisguiseUtilities.getBedChunkPacket(newLoc, oldLoc))
|
for (PacketContainer packet : DisguiseUtilities.getBedChunkPacket(newLoc, oldLoc))
|
||||||
{
|
{
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet, false);
|
||||||
@ -138,11 +152,19 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
for (TargetedDisguise disguise : list)
|
for (TargetedDisguise disguise : list)
|
||||||
{
|
{
|
||||||
if (disguise.isPlayerDisguise() && disguise.canSee(player)
|
if (!disguise.isPlayerDisguise())
|
||||||
&& ((PlayerDisguise) disguise).getWatcher().isSleeping()
|
continue;
|
||||||
&& DisguiseUtilities.getPerverts(disguise).contains(player))
|
|
||||||
{
|
if (!disguise.canSee(player))
|
||||||
PacketContainer[] packets = DisguiseUtilities.getBedPackets(player,
|
continue;
|
||||||
|
|
||||||
|
if (!((PlayerDisguise) disguise).getWatcher().isSleeping())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!DisguiseUtilities.getPerverts(disguise).contains(player))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PacketContainer[] packets = DisguiseUtilities.getBedPackets(
|
||||||
disguise.getEntity() == player ? newLoc : disguise.getEntity().getLocation(), newLoc,
|
disguise.getEntity() == player ? newLoc : disguise.getEntity().getLocation(), newLoc,
|
||||||
(PlayerDisguise) disguise);
|
(PlayerDisguise) disguise);
|
||||||
|
|
||||||
@ -162,7 +184,6 @@ public class DisguiseListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (InvocationTargetException e)
|
catch (InvocationTargetException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace(System.out);
|
e.printStackTrace(System.out);
|
||||||
@ -190,10 +211,12 @@ public class DisguiseListener implements Listener
|
|||||||
public void onJoin(PlayerJoinEvent event)
|
public void onJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
if (latestVersion != null && p.hasPermission(DisguiseConfig.getUpdateNotificationPermission()))
|
if (latestVersion != null && p.hasPermission(DisguiseConfig.getUpdateNotificationPermission()))
|
||||||
{
|
{
|
||||||
p.sendMessage(String.format(DisguiseConfig.getUpdateMessage(), currentVersion, latestVersion));
|
p.sendMessage(String.format(DisguiseConfig.getUpdateMessage(), currentVersion, latestVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DisguiseConfig.isBedPacketsEnabled())
|
if (DisguiseConfig.isBedPacketsEnabled())
|
||||||
{
|
{
|
||||||
chunkMove(p, p.getLocation(), null);
|
chunkMove(p, p.getLocation(), null);
|
||||||
@ -210,11 +233,9 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
int x1 = (int) Math.floor(to.getX() / 16D) - 17;
|
|
||||||
int x2 = (int) Math.floor(from.getX() / 16D) - 17;
|
if (DisguiseUtilities.getChunkCord(to.getBlockX()) != DisguiseUtilities.getChunkCord(from.getBlockX())
|
||||||
int z1 = (int) Math.floor(to.getZ() / 16D) - 17;
|
|| DisguiseUtilities.getChunkCord(to.getBlockZ()) != DisguiseUtilities.getChunkCord(from.getBlockZ()))
|
||||||
int z2 = (int) Math.floor(from.getZ() / 16D) - 17;
|
|
||||||
if (x1 - (x1 % 8) != x2 - (x2 % 8) || z1 - (z1 % 8) != z2 - (z2 % 8))
|
|
||||||
{
|
{
|
||||||
chunkMove(event.getPlayer(), to, from);
|
chunkMove(event.getPlayer(), to, from);
|
||||||
}
|
}
|
||||||
@ -223,14 +244,17 @@ public class DisguiseListener implements Listener
|
|||||||
if (DisguiseConfig.isStopShulkerDisguisesFromMoving())
|
if (DisguiseConfig.isStopShulkerDisguisesFromMoving())
|
||||||
{
|
{
|
||||||
Disguise disguise;
|
Disguise disguise;
|
||||||
|
|
||||||
if ((disguise = DisguiseAPI.getDisguise(event.getPlayer())) != null)
|
if ((disguise = DisguiseAPI.getDisguise(event.getPlayer())) != null)
|
||||||
{
|
{
|
||||||
if (disguise.getType() == DisguiseType.SHULKER)
|
if (disguise.getType() == DisguiseType.SHULKER)
|
||||||
{ // Stop Shulker disguises from moving their coordinates
|
{ // Stop Shulker disguises from moving their coordinates
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
|
|
||||||
to.setX(from.getX());
|
to.setX(from.getX());
|
||||||
to.setZ(from.getZ());
|
to.setZ(from.getZ());
|
||||||
|
|
||||||
event.setTo(to);
|
event.setTo(to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,6 +271,7 @@ public class DisguiseListener implements Listener
|
|||||||
public void onRespawn(PlayerRespawnEvent event)
|
public void onRespawn(PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
Disguise[] disguises = DisguiseAPI.getDisguises(event.getPlayer());
|
Disguise[] disguises = DisguiseAPI.getDisguises(event.getPlayer());
|
||||||
|
|
||||||
for (Disguise disguise : disguises)
|
for (Disguise disguise : disguises)
|
||||||
{
|
{
|
||||||
if (disguise.isRemoveDisguiseOnDeath())
|
if (disguise.isRemoveDisguiseOnDeath())
|
||||||
@ -254,6 +279,22 @@ public class DisguiseListener implements Listener
|
|||||||
disguise.removeDisguise();
|
disguise.removeDisguise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DisguiseConfig.isBedPacketsEnabled())
|
||||||
|
{
|
||||||
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
|
chunkMove(event.getPlayer(), null, player.getLocation());
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
chunkMove(player, player.getLocation(), null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -262,10 +303,13 @@ public class DisguiseListener implements Listener
|
|||||||
if (disguiseEntity.containsKey(event.getPlayer().getName()) || disguiseClone.containsKey(event.getPlayer().getName()))
|
if (disguiseEntity.containsKey(event.getPlayer().getName()) || disguiseClone.containsKey(event.getPlayer().getName()))
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
disguiseRunnable.remove(p.getName()).cancel();
|
disguiseRunnable.remove(p.getName()).cancel();
|
||||||
|
|
||||||
Entity entity = event.getRightClicked();
|
Entity entity = event.getRightClicked();
|
||||||
String entityName;
|
String entityName;
|
||||||
|
|
||||||
if (entity instanceof Player && !disguiseClone.containsKey(p.getName()))
|
if (entity instanceof Player && !disguiseClone.containsKey(p.getName()))
|
||||||
{
|
{
|
||||||
entityName = entity.getName();
|
entityName = entity.getName();
|
||||||
@ -274,10 +318,13 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
entityName = DisguiseType.getType(entity).toReadable();
|
entityName = DisguiseType.getType(entity).toReadable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disguiseClone.containsKey(p.getName()))
|
if (disguiseClone.containsKey(p.getName()))
|
||||||
{
|
{
|
||||||
Boolean[] options = disguiseClone.remove(p.getName());
|
Boolean[] options = disguiseClone.remove(p.getName());
|
||||||
|
|
||||||
Disguise disguise = DisguiseAPI.getDisguise(p, entity);
|
Disguise disguise = DisguiseAPI.getDisguise(p, entity);
|
||||||
|
|
||||||
if (disguise == null)
|
if (disguise == null)
|
||||||
{
|
{
|
||||||
disguise = DisguiseAPI.constructDisguise(entity, options[0], options[1], options[2]);
|
disguise = DisguiseAPI.constructDisguise(entity, options[0], options[1], options[2]);
|
||||||
@ -286,22 +333,28 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
disguise = disguise.clone();
|
disguise = disguise.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();
|
char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||||
|
|
||||||
String reference = null;
|
String reference = null;
|
||||||
int referenceLength = Math.max(2, (int) Math.ceil((0.1D + DisguiseConfig.getMaxClonedDisguises()) / 26D));
|
int referenceLength = Math.max(2, (int) Math.ceil((0.1D + DisguiseConfig.getMaxClonedDisguises()) / 26D));
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
|
|
||||||
while (reference == null && attempts++ < 1000)
|
while (reference == null && attempts++ < 1000)
|
||||||
{
|
{
|
||||||
reference = "@";
|
reference = "@";
|
||||||
|
|
||||||
for (int i = 0; i < referenceLength; i++)
|
for (int i = 0; i < referenceLength; i++)
|
||||||
{
|
{
|
||||||
reference += alphabet[DisguiseUtilities.random.nextInt(alphabet.length)];
|
reference += alphabet[DisguiseUtilities.random.nextInt(alphabet.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DisguiseUtilities.getClonedDisguise(reference) != null)
|
if (DisguiseUtilities.getClonedDisguise(reference) != null)
|
||||||
{
|
{
|
||||||
reference = null;
|
reference = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reference != null && DisguiseUtilities.addClonedDisguise(reference, disguise))
|
if (reference != null && DisguiseUtilities.addClonedDisguise(reference, disguise))
|
||||||
{
|
{
|
||||||
p.sendMessage(ChatColor.RED + "Constructed a " + entityName + " disguise! Your reference is " + reference);
|
p.sendMessage(ChatColor.RED + "Constructed a " + entityName + " disguise! Your reference is " + reference);
|
||||||
@ -316,6 +369,7 @@ public class DisguiseListener implements Listener
|
|||||||
else if (disguiseEntity.containsKey(p.getName()))
|
else if (disguiseEntity.containsKey(p.getName()))
|
||||||
{
|
{
|
||||||
Disguise disguise = disguiseEntity.remove(p.getName());
|
Disguise disguise = disguiseEntity.remove(p.getName());
|
||||||
|
|
||||||
if (disguise != null)
|
if (disguise != null)
|
||||||
{
|
{
|
||||||
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()
|
if (disguise.isMiscDisguise() && !DisguiseConfig.isMiscDisguisesForLivingEnabled()
|
||||||
@ -331,14 +385,18 @@ public class DisguiseListener implements Listener
|
|||||||
if (disguise.getWatcher() instanceof LivingWatcher)
|
if (disguise.getWatcher() instanceof LivingWatcher)
|
||||||
{
|
{
|
||||||
disguise.getWatcher().setCustomName(((Player) entity).getDisplayName());
|
disguise.getWatcher().setCustomName(((Player) entity).getDisplayName());
|
||||||
|
|
||||||
if (DisguiseConfig.isNameAboveHeadAlwaysVisible())
|
if (DisguiseConfig.isNameAboveHeadAlwaysVisible())
|
||||||
{
|
{
|
||||||
disguise.getWatcher().setCustomNameVisible(true);
|
disguise.getWatcher().setCustomNameVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisguiseAPI.disguiseToAll(entity, disguise);
|
DisguiseAPI.disguiseToAll(entity, disguise);
|
||||||
|
|
||||||
String disguiseName = "a ";
|
String disguiseName = "a ";
|
||||||
|
|
||||||
if (disguise instanceof PlayerDisguise)
|
if (disguise instanceof PlayerDisguise)
|
||||||
{
|
{
|
||||||
disguiseName = "the player " + ((PlayerDisguise) disguise).getName();
|
disguiseName = "the player " + ((PlayerDisguise) disguise).getName();
|
||||||
@ -347,6 +405,7 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
disguiseName += disguise.getType().toReadable();
|
disguiseName += disguise.getType().toReadable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disguise.isDisguiseInUse())
|
if (disguise.isDisguiseInUse())
|
||||||
{
|
{
|
||||||
p.sendMessage(ChatColor.RED + "Disguised " + (entity instanceof Player ? "" : "the ") + entityName
|
p.sendMessage(ChatColor.RED + "Disguised " + (entity instanceof Player ? "" : "the ") + entityName
|
||||||
@ -364,6 +423,7 @@ public class DisguiseListener implements Listener
|
|||||||
if (DisguiseAPI.isDisguised(entity))
|
if (DisguiseAPI.isDisguised(entity))
|
||||||
{
|
{
|
||||||
DisguiseAPI.undisguiseToAll(entity);
|
DisguiseAPI.undisguiseToAll(entity);
|
||||||
|
|
||||||
p.sendMessage(ChatColor.RED + "Undisguised " + (entity instanceof Player ? "" : "the ") + entityName);
|
p.sendMessage(ChatColor.RED + "Undisguised " + (entity instanceof Player ? "" : "the ") + entityName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -396,40 +456,35 @@ public class DisguiseListener implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onTeleport(final PlayerTeleportEvent event)
|
public void onTeleport(PlayerTeleportEvent event)
|
||||||
{
|
{
|
||||||
if (!DisguiseAPI.isDisguised(event.getPlayer()))
|
final Player player = event.getPlayer();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
|
|
||||||
if (DisguiseConfig.isBedPacketsEnabled())
|
if (DisguiseConfig.isBedPacketsEnabled())
|
||||||
{
|
{
|
||||||
int x1 = (int) Math.floor(to.getX() / 16D) - 17;
|
if (DisguiseUtilities.getChunkCord(to.getBlockX()) != DisguiseUtilities.getChunkCord(from.getBlockX())
|
||||||
int x2 = (int) Math.floor(from.getX() / 16D) - 17;
|
|| DisguiseUtilities.getChunkCord(to.getBlockZ()) != DisguiseUtilities.getChunkCord(from.getBlockZ()))
|
||||||
int z1 = (int) Math.floor(to.getZ() / 16D) - 17;
|
|
||||||
int z2 = (int) Math.floor(from.getZ() / 16D) - 17;
|
|
||||||
if (x1 - (x1 % 8) != x2 - (x2 % 8) || z1 - (z1 % 8) != z2 - (z2 % 8))
|
|
||||||
{
|
{
|
||||||
chunkMove(event.getPlayer(), null, from);
|
chunkMove(player, null, from);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (!event.isCancelled())
|
chunkMove(player, player.getLocation(), null);
|
||||||
{
|
|
||||||
chunkMove(event.getPlayer(), event.getTo(), null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chunkMove(event.getPlayer(), event.getPlayer().getLocation(), null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DisguiseAPI.isDisguised(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (DisguiseConfig.isUndisguiseOnWorldChange() && to.getWorld() != null && from.getWorld() != null
|
if (DisguiseConfig.isUndisguiseOnWorldChange() && to.getWorld() != null && from.getWorld() != null
|
||||||
&& to.getWorld() != from.getWorld())
|
&& to.getWorld() != from.getWorld())
|
||||||
{
|
{
|
||||||
@ -446,6 +501,7 @@ public class DisguiseListener implements Listener
|
|||||||
if (event.getEntered() instanceof Player && DisguiseAPI.isDisguised((Player) event.getEntered(), event.getEntered()))
|
if (event.getEntered() instanceof Player && DisguiseAPI.isDisguised((Player) event.getEntered(), event.getEntered()))
|
||||||
{
|
{
|
||||||
DisguiseUtilities.removeSelfDisguise((Player) event.getEntered());
|
DisguiseUtilities.removeSelfDisguise((Player) event.getEntered());
|
||||||
|
|
||||||
((Player) event.getEntered()).updateInventory();
|
((Player) event.getEntered()).updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,6 +512,7 @@ public class DisguiseListener implements Listener
|
|||||||
if (event.getExited() instanceof Player)
|
if (event.getExited() instanceof Player)
|
||||||
{
|
{
|
||||||
final Disguise disguise = DisguiseAPI.getDisguise((Player) event.getExited(), event.getExited());
|
final Disguise disguise = DisguiseAPI.getDisguise((Player) event.getExited(), event.getExited());
|
||||||
|
|
||||||
if (disguise != null)
|
if (disguise != null)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
Bukkit.getScheduler().runTask(plugin, new Runnable()
|
||||||
@ -464,6 +521,7 @@ public class DisguiseListener implements Listener
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
DisguiseUtilities.setupFakeDisguise(disguise);
|
DisguiseUtilities.setupFakeDisguise(disguise);
|
||||||
|
|
||||||
((Player) disguise.getEntity()).updateInventory();
|
((Player) disguise.getEntity()).updateInventory();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -474,14 +532,16 @@ public class DisguiseListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onWorldSwitch(final PlayerChangedWorldEvent event)
|
public void onWorldSwitch(final PlayerChangedWorldEvent event)
|
||||||
{
|
{
|
||||||
if (!DisguiseAPI.isDisguised(event.getPlayer()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (DisguiseConfig.isBedPacketsEnabled())
|
if (DisguiseConfig.isBedPacketsEnabled())
|
||||||
{
|
{
|
||||||
chunkMove(event.getPlayer(), event.getPlayer().getLocation(), null);
|
chunkMove(event.getPlayer(), event.getPlayer().getLocation(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DisguiseAPI.isDisguised(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (DisguiseConfig.isUndisguiseOnWorldChange())
|
if (DisguiseConfig.isUndisguiseOnWorldChange())
|
||||||
{
|
{
|
||||||
for (Disguise disguise : DisguiseAPI.getDisguises(event.getPlayer()))
|
for (Disguise disguise : DisguiseAPI.getDisguises(event.getPlayer()))
|
||||||
@ -493,10 +553,13 @@ public class DisguiseListener implements Listener
|
|||||||
{
|
{
|
||||||
// Stupid hack to fix worldswitch invisibility bug
|
// Stupid hack to fix worldswitch invisibility bug
|
||||||
final boolean viewSelfToggled = DisguiseAPI.isViewSelfToggled(event.getPlayer());
|
final boolean viewSelfToggled = DisguiseAPI.isViewSelfToggled(event.getPlayer());
|
||||||
|
|
||||||
if (viewSelfToggled)
|
if (viewSelfToggled)
|
||||||
{
|
{
|
||||||
final Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer());
|
final Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer());
|
||||||
|
|
||||||
disguise.setViewSelfDisguise(false);
|
disguise.setViewSelfDisguise(false);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable()
|
Bukkit.getScheduler().runTaskLater(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -517,6 +580,7 @@ public class DisguiseListener implements Listener
|
|||||||
run.cancel();
|
run.cancel();
|
||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
BukkitRunnable runnable = new BukkitRunnable()
|
BukkitRunnable runnable = new BukkitRunnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -526,7 +590,9 @@ public class DisguiseListener implements Listener
|
|||||||
disguiseRunnable.remove(player);
|
disguiseRunnable.remove(player);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
runnable.runTaskLater(plugin, 20 * DisguiseConfig.getDisguiseCloneExpire());
|
runnable.runTaskLater(plugin, 20 * DisguiseConfig.getDisguiseCloneExpire());
|
||||||
|
|
||||||
disguiseRunnable.put(player, runnable);
|
disguiseRunnable.put(player, runnable);
|
||||||
disguiseClone.put(player, options);
|
disguiseClone.put(player, options);
|
||||||
}
|
}
|
||||||
@ -539,6 +605,7 @@ public class DisguiseListener implements Listener
|
|||||||
run.cancel();
|
run.cancel();
|
||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
BukkitRunnable runnable = new BukkitRunnable()
|
BukkitRunnable runnable = new BukkitRunnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -548,7 +615,9 @@ public class DisguiseListener implements Listener
|
|||||||
disguiseRunnable.remove(player);
|
disguiseRunnable.remove(player);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
runnable.runTaskLater(plugin, 20 * DisguiseConfig.getDisguiseEntityExpire());
|
runnable.runTaskLater(plugin, 20 * DisguiseConfig.getDisguiseEntityExpire());
|
||||||
|
|
||||||
disguiseRunnable.put(player, runnable);
|
disguiseRunnable.put(player, runnable);
|
||||||
disguiseEntity.put(player, disguise);
|
disguiseEntity.put(player, disguise);
|
||||||
}
|
}
|
||||||
|
@ -197,9 +197,9 @@ public class PlayerWatcher extends LivingWatcher
|
|||||||
{
|
{
|
||||||
this.sleepingDirection = BlockFace.values()[sleepingDirection.ordinal() % 4];
|
this.sleepingDirection = BlockFace.values()[sleepingDirection.ordinal() % 4];
|
||||||
}
|
}
|
||||||
if (sleeping != isSleeping())
|
|
||||||
{
|
|
||||||
isInBed = sleeping;
|
isInBed = sleeping;
|
||||||
|
|
||||||
if (DisguiseConfig.isBedPacketsEnabled() && DisguiseUtilities.isDisguiseInUse(getDisguise()))
|
if (DisguiseConfig.isBedPacketsEnabled() && DisguiseUtilities.isDisguiseInUse(getDisguise()))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -208,15 +208,17 @@ public class PlayerWatcher extends LivingWatcher
|
|||||||
{
|
{
|
||||||
for (Player player : DisguiseUtilities.getPerverts(getDisguise()))
|
for (Player player : DisguiseUtilities.getPerverts(getDisguise()))
|
||||||
{
|
{
|
||||||
PacketContainer[] packets = DisguiseUtilities.getBedPackets(player,
|
PacketContainer[] packets = DisguiseUtilities.getBedPackets(getDisguise().getEntity().getLocation(),
|
||||||
this.getDisguise().getEntity().getLocation(), player.getLocation(),
|
player.getLocation(), (PlayerDisguise) getDisguise());
|
||||||
(PlayerDisguise) this.getDisguise());
|
|
||||||
if (getDisguise().getEntity() == player)
|
if (getDisguise().getEntity() == player)
|
||||||
{
|
{
|
||||||
for (PacketContainer packet : packets)
|
for (PacketContainer packet : packets)
|
||||||
{
|
{
|
||||||
packet = packet.shallowClone();
|
packet = packet.shallowClone();
|
||||||
|
|
||||||
packet.getIntegers().write(0, DisguiseAPI.getSelfDisguiseId());
|
packet.getIntegers().write(0, DisguiseAPI.getSelfDisguiseId());
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -232,13 +234,15 @@ public class PlayerWatcher extends LivingWatcher
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
PacketContainer packet = new PacketContainer(Server.ANIMATION);
|
PacketContainer packet = new PacketContainer(Server.ANIMATION);
|
||||||
|
|
||||||
StructureModifier<Integer> mods = packet.getIntegers();
|
StructureModifier<Integer> mods = packet.getIntegers();
|
||||||
|
|
||||||
mods.write(0, getDisguise().getEntity().getEntityId());
|
mods.write(0, getDisguise().getEntity().getEntityId());
|
||||||
mods.write(1, 3);
|
mods.write(1, 3);
|
||||||
|
|
||||||
for (Player player : DisguiseUtilities.getPerverts(getDisguise()))
|
for (Player player : DisguiseUtilities.getPerverts(getDisguise()))
|
||||||
{
|
{
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,7 +252,6 @@ public class PlayerWatcher extends LivingWatcher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setSkinFlags(int i, boolean flag)
|
private void setSkinFlags(int i, boolean flag)
|
||||||
{
|
{
|
||||||
|
@ -36,10 +36,12 @@ import org.bukkit.scoreboard.Team.OptionStatus;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType.Play.Server;
|
import com.comphenix.protocol.PacketType.Play.Server;
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
|
|
||||||
@ -63,7 +65,6 @@ public class DisguiseUtilities
|
|||||||
* the plugin to do that.
|
* the plugin to do that.
|
||||||
*/
|
*/
|
||||||
private static HashSet<String> addedByPlugins = new HashSet<>();
|
private static HashSet<String> addedByPlugins = new HashSet<>();
|
||||||
private static Object bedChunk;
|
|
||||||
private static LinkedHashMap<String, Disguise> clonedDisguises = new LinkedHashMap<>();
|
private static LinkedHashMap<String, Disguise> clonedDisguises = new LinkedHashMap<>();
|
||||||
/**
|
/**
|
||||||
* A hashmap of the uuid's of entitys, alive and dead. And their disguises in use
|
* A hashmap of the uuid's of entitys, alive and dead. And their disguises in use
|
||||||
@ -81,8 +82,8 @@ public class DisguiseUtilities
|
|||||||
private static LibsDisguises libsDisguises;
|
private static LibsDisguises libsDisguises;
|
||||||
private static HashMap<String, ArrayList<Object>> runnables = new HashMap<>();
|
private static HashMap<String, ArrayList<Object>> runnables = new HashMap<>();
|
||||||
private static HashSet<UUID> selfDisguised = new HashSet<>();
|
private static HashSet<UUID> selfDisguised = new HashSet<>();
|
||||||
private static Field xChunk, zChunk;
|
|
||||||
private static Thread mainThread;
|
private static Thread mainThread;
|
||||||
|
private static PacketContainer spawnChunk;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
@ -91,7 +92,7 @@ public class DisguiseUtilities
|
|||||||
Object server = ReflectionManager.getNmsMethod("MinecraftServer", "getServer").invoke(null);
|
Object server = ReflectionManager.getNmsMethod("MinecraftServer", "getServer").invoke(null);
|
||||||
Object world = ((List) server.getClass().getField("worlds").get(server)).get(0);
|
Object world = ((List) server.getClass().getField("worlds").get(server)).get(0);
|
||||||
|
|
||||||
bedChunk = ReflectionManager.getNmsClass("Chunk")
|
Object bedChunk = ReflectionManager.getNmsClass("Chunk")
|
||||||
.getConstructor(ReflectionManager.getNmsClass("World"), int.class, int.class).newInstance(world, 0, 0);
|
.getConstructor(ReflectionManager.getNmsClass("World"), int.class, int.class).newInstance(world, 0, 0);
|
||||||
|
|
||||||
Field cSection = bedChunk.getClass().getDeclaredField("sections");
|
Field cSection = bedChunk.getClass().getDeclaredField("sections");
|
||||||
@ -100,18 +101,8 @@ public class DisguiseUtilities
|
|||||||
Object chunkSection = ReflectionManager.getNmsClass("ChunkSection").getConstructor(int.class, boolean.class)
|
Object chunkSection = ReflectionManager.getNmsClass("ChunkSection").getConstructor(int.class, boolean.class)
|
||||||
.newInstance(0, true);
|
.newInstance(0, true);
|
||||||
|
|
||||||
Object block;
|
Object block = ReflectionManager.getNmsClass("Block").getMethod("getById", int.class).invoke(null,
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
block = ReflectionManager.getNmsClass("Block").getMethod("getById", int.class).invoke(null,
|
|
||||||
Material.BED_BLOCK.getId());
|
Material.BED_BLOCK.getId());
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"), "byId")
|
|
||||||
.get(null))[Material.BED_BLOCK.getId()];
|
|
||||||
}
|
|
||||||
|
|
||||||
Method fromLegacyData = block.getClass().getMethod("fromLegacyData", int.class);
|
Method fromLegacyData = block.getClass().getMethod("fromLegacyData", int.class);
|
||||||
Method setType = chunkSection.getClass().getMethod("setType", int.class, int.class, int.class,
|
Method setType = chunkSection.getClass().getMethod("setType", int.class, int.class, int.class,
|
||||||
@ -141,11 +132,8 @@ public class DisguiseUtilities
|
|||||||
|
|
||||||
cSection.set(bedChunk, array);
|
cSection.set(bedChunk, array);
|
||||||
|
|
||||||
xChunk = bedChunk.getClass().getField("locX");
|
spawnChunk = ProtocolLibrary.getProtocolManager()
|
||||||
xChunk.setAccessible(true);
|
.createPacketConstructor(PacketType.Play.Server.MAP_CHUNK, bedChunk, 65535).createPacket(bedChunk, 65535);
|
||||||
|
|
||||||
zChunk = bedChunk.getClass().getField("locZ");
|
|
||||||
zChunk.setAccessible(true);
|
|
||||||
|
|
||||||
Field threadField = ReflectionManager.getNmsField("MinecraftServer", "primaryThread");
|
Field threadField = ReflectionManager.getNmsField("MinecraftServer", "primaryThread");
|
||||||
threadField.setAccessible(true);
|
threadField.setAccessible(true);
|
||||||
@ -439,105 +427,75 @@ public class DisguiseUtilities
|
|||||||
return addedByPlugins;
|
return addedByPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getChunkCord(int blockCord)
|
||||||
|
{
|
||||||
|
int cord = (int) Math.floor(blockCord / 16D) - 17;
|
||||||
|
|
||||||
|
cord -= (cord % 8);
|
||||||
|
|
||||||
|
return cord;
|
||||||
|
}
|
||||||
|
|
||||||
public static PacketContainer[] getBedChunkPacket(Location newLoc, Location oldLoc)
|
public static PacketContainer[] getBedChunkPacket(Location newLoc, Location oldLoc)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
PacketContainer[] packets = new PacketContainer[newLoc != null ? 2 + (oldLoc != null ? 1 : 0) : 1];
|
PacketContainer[] packets = new PacketContainer[(newLoc != null ? 1 : 0) + (oldLoc != null ? 1 : 0)];
|
||||||
|
|
||||||
for (Location loc : new Location[]
|
if (oldLoc != null)
|
||||||
{
|
{
|
||||||
oldLoc, newLoc
|
PacketContainer despawn = new PacketContainer(Server.UNLOAD_CHUNK);
|
||||||
})
|
|
||||||
{
|
StructureModifier<Object> modifier = despawn.getModifier();
|
||||||
if (loc == null)
|
|
||||||
{
|
modifier.write(0, getChunkCord(oldLoc.getBlockX()));
|
||||||
continue;
|
modifier.write(1, getChunkCord(oldLoc.getBlockZ()));
|
||||||
|
|
||||||
|
packets[i++] = despawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
int chunkX = (int) Math.floor(loc.getX() / 16D) - 17, chunkZ = (int) Math.floor(loc.getZ() / 16D) - 17;
|
if (newLoc != null)
|
||||||
|
|
||||||
chunkX -= chunkX % 8;
|
|
||||||
chunkZ -= chunkZ % 8;
|
|
||||||
|
|
||||||
// Make unload packets
|
|
||||||
|
|
||||||
packets[i] = ProtocolLibrary.getProtocolManager().createPacketConstructor(Server.UNLOAD_CHUNK, chunkX, chunkZ)
|
|
||||||
.createPacket(chunkX, chunkZ);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
|
|
||||||
// Make load packets
|
|
||||||
if (oldLoc == null || i > 1)
|
|
||||||
{
|
{
|
||||||
try
|
PacketContainer spawn = spawnChunk.shallowClone();
|
||||||
{
|
|
||||||
xChunk.set(bedChunk, chunkX);
|
|
||||||
zChunk.set(bedChunk, chunkZ);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
ex.printStackTrace(System.out);
|
|
||||||
}
|
|
||||||
|
|
||||||
// MAP_CHUNK_BULK was replaced in 1.9 with several seperated chunk packets
|
StructureModifier<Object> modifier = spawn.getModifier();
|
||||||
// packets[i] = ProtocolLibrary.getProtocolManager()
|
|
||||||
// .createPacketConstructor(Server.MAP_CHUNK_BULK, Arrays.asList(bedChunk))
|
|
||||||
// .createPacket(Arrays.asList(bedChunk));
|
|
||||||
// Make unload packets
|
|
||||||
try
|
|
||||||
{
|
|
||||||
packets[i] = ProtocolLibrary.getProtocolManager().createPacketConstructor(Server.MAP_CHUNK, bedChunk, 0)
|
|
||||||
.createPacket(bedChunk, 0);
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException ex)
|
|
||||||
{
|
|
||||||
packets[i] = ProtocolLibrary.getProtocolManager().createPacketConstructor(Server.MAP_CHUNK, bedChunk, true, 0)
|
|
||||||
.createPacket(bedChunk, true, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
modifier.write(0, getChunkCord(newLoc.getBlockX()));
|
||||||
}
|
modifier.write(1, getChunkCord(newLoc.getBlockZ()));
|
||||||
|
|
||||||
|
packets[i++] = spawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return packets;
|
return packets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketContainer[] getBedPackets(Player player, Location loc, Location playerLocation, PlayerDisguise disguise)
|
public static PacketContainer[] getBedPackets(Location sleepingLocation, Location playerLocation, PlayerDisguise disguise)
|
||||||
{
|
{
|
||||||
Entity entity = disguise.getEntity();
|
int entity = disguise.getEntity().getEntityId();
|
||||||
|
PlayerWatcher watcher = disguise.getWatcher();
|
||||||
|
|
||||||
PacketContainer setBed = new PacketContainer(Server.BED);
|
PacketContainer setBed = new PacketContainer(Server.BED);
|
||||||
|
|
||||||
int chunkX = (int) Math.floor(playerLocation.getX() / 16D) - 17,
|
int bX = (getChunkCord(playerLocation.getBlockX()) * 16) + 1 + watcher.getSleepingDirection().getModX();
|
||||||
chunkZ = (int) Math.floor(playerLocation.getZ() / 16D) - 17;
|
int bZ = (getChunkCord(playerLocation.getBlockZ()) * 16) + 1 + watcher.getSleepingDirection().getModZ();
|
||||||
chunkX -= chunkX % 8;
|
|
||||||
chunkZ -= chunkZ % 8;
|
|
||||||
|
|
||||||
PlayerWatcher watcher = disguise.getWatcher();
|
setBed.getIntegers().write(0, entity);
|
||||||
|
setBed.getBlockPositionModifier().write(0, new BlockPosition(bX, 0, bZ));
|
||||||
StructureModifier<Integer> bedInts = setBed.getIntegers();
|
|
||||||
bedInts.write(0, entity.getEntityId());
|
|
||||||
|
|
||||||
bedInts.write(1, (chunkX * 16) + 1 + watcher.getSleepingDirection().getModX());
|
|
||||||
bedInts.write(3, (chunkZ * 16) + 1 + watcher.getSleepingDirection().getModZ());
|
|
||||||
|
|
||||||
PacketContainer teleport = new PacketContainer(Server.ENTITY_TELEPORT);
|
PacketContainer teleport = new PacketContainer(Server.ENTITY_TELEPORT);
|
||||||
|
|
||||||
StructureModifier<Integer> ints = teleport.getIntegers();
|
|
||||||
ints.write(0, entity.getEntityId());
|
|
||||||
|
|
||||||
StructureModifier<Double> doubles = teleport.getDoubles();
|
StructureModifier<Double> doubles = teleport.getDoubles();
|
||||||
|
|
||||||
doubles.write(0, loc.getX());
|
teleport.getIntegers().write(0, entity);
|
||||||
doubles.write(1, PacketsManager.getYModifier(disguise.getEntity(), disguise) + loc.getY());
|
|
||||||
doubles.write(2, loc.getZ());
|
doubles.write(0, sleepingLocation.getX());
|
||||||
|
doubles.write(1, PacketsManager.getYModifier(disguise.getEntity(), disguise) + sleepingLocation.getY());
|
||||||
|
doubles.write(2, sleepingLocation.getZ());
|
||||||
|
|
||||||
return new PacketContainer[]
|
return new PacketContainer[]
|
||||||
{
|
{
|
||||||
setBed, teleport
|
setBed, teleport
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Disguise getClonedDisguise(String key)
|
public static Disguise getClonedDisguise(String key)
|
||||||
|
@ -260,7 +260,7 @@ public class PacketsManager
|
|||||||
newPackets[0] = spawnPackets[0];
|
newPackets[0] = spawnPackets[0];
|
||||||
spawnPackets = newPackets;
|
spawnPackets = newPackets;
|
||||||
|
|
||||||
PacketContainer[] bedPackets = DisguiseUtilities.getBedPackets(observer,
|
PacketContainer[] bedPackets = DisguiseUtilities.getBedPackets(
|
||||||
loc.clone().subtract(0, PacketsManager.getYModifier(disguisedEntity, disguise), 0),
|
loc.clone().subtract(0, PacketsManager.getYModifier(disguisedEntity, disguise), 0),
|
||||||
observer.getLocation(), ((PlayerDisguise) disguise));
|
observer.getLocation(), ((PlayerDisguise) disguise));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user