Skip to content

Commit

Permalink
Partial fix for #739, however this cannot be fully fixed due to how l…
Browse files Browse the repository at this point in the history
…lama spit behaves
  • Loading branch information
libraryaddict committed Jan 17, 2024
1 parent 6145b20 commit 4dcc283
Showing 1 changed file with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,27 @@ public void onMove(PlayerMoveEvent event) {
DisguiseUtilities.doBoundingBox((TargetedDisguise) disguise);
}

if (DisguiseConfig.isStopShulkerDisguisesFromMoving()) {
Disguise disguise;

if ((disguise = DisguiseAPI.getDisguise(event.getPlayer())) != null) {
if (disguise.getType() == DisguiseType.SHULKER) { // Stop Shulker disguises from moving their coordinates
Location from = event.getFrom();
Location to = event.getTo();

to.setX(from.getX());
to.setZ(from.getZ());

event.setTo(to);
Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer());

if (disguise != null) {
if (DisguiseConfig.isStopShulkerDisguisesFromMoving() &&
disguise.getType() == DisguiseType.SHULKER) { // Stop Shulker disguises from moving their coordinates
Location from = event.getFrom();
Location to = event.getTo();

to.setX(from.getX());
to.setZ(from.getZ());

event.setTo(to);
} else if (disguise.getType() == DisguiseType.LLAMA_SPIT) {
Location from = event.getFrom();
Location to = event.getTo();

// Llama spit disappears when it encounters a solid
if (Math.min(from.getY(), to.getY()) >= from.getWorld().getMinHeight() && Math.max(from.getY(), to.getY()) < from.getWorld().getMaxHeight()) {
if (!from.getBlock().isEmpty() && to.getBlock().isEmpty()) {
DisguiseUtilities.refreshTrackers((TargetedDisguise) disguise);
}
}
}
}
Expand Down

0 comments on commit 4dcc283

Please sign in to comment.