Removes the error message displayed when teleportation is cancelled because handleLeashedCreatures is disabled
The message should be removed as it's inconsistent with how disabled vehicle teleportation is silent
This commit is contained in:
parent
bab51d76fd
commit
0740cd0a66
@ -173,7 +173,7 @@ public class PlayerEventListener implements Listener {
|
||||
}
|
||||
|
||||
//Make sure to check if the player has any leashed creatures, even though leashed teleportation is disabled
|
||||
return Teleporter.noLeashedCreaturesPreventTeleportation(player, entrancePortal.getOptions().isSilent());
|
||||
return Teleporter.noLeashedCreaturesPreventTeleportation(player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@ public class VehicleEventListener implements Listener {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Teleporter.noLeashedCreaturesPreventTeleportation(player, entrancePortal.getOptions().isSilent());
|
||||
return Teleporter.noLeashedCreaturesPreventTeleportation(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -254,23 +254,18 @@ public abstract class Teleporter {
|
||||
* Checks whether a player has leashed creatures that block the teleportation
|
||||
*
|
||||
* @param player <p>The player trying to teleport</p>
|
||||
* @param silent <p>Whether the entrance portal is silent</p>
|
||||
* @return <p>False if the player has leashed any creatures that cannot go through the portal</p>
|
||||
*/
|
||||
public static boolean noLeashedCreaturesPreventTeleportation(Player player, boolean silent) {
|
||||
public static boolean noLeashedCreaturesPreventTeleportation(Player player) {
|
||||
//If it's enabled, there is no problem
|
||||
if (Stargate.getGateConfig().handleLeashedCreatures()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Find any nearby leashed entities to teleport with the player
|
||||
List<Creature> nearbyEntities = getLeashedCreatures(player);
|
||||
|
||||
//If this feature is disabled, just return
|
||||
if (!Stargate.getGateConfig().handleLeashedCreatures()) {
|
||||
boolean isAllowed = nearbyEntities.isEmpty();
|
||||
if (!isAllowed && !silent) {
|
||||
Stargate.getMessageSender().sendErrorMessage(player, "Leashed teleportation is disabled");
|
||||
}
|
||||
return isAllowed;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return nearbyEntities.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user