Fixed Ectophial emptying when used while teleblocked

This commit is contained in:
Lila Hioh
2022-08-10 09:26:46 +00:00
committed by Ryan
parent edb9dfe955
commit d545b2a119
2 changed files with 27 additions and 21 deletions
@@ -34,6 +34,8 @@ import core.plugin.Plugin;
import rs09.plugin.ClassScanner;
import core.tools.RandomFunction;
import static api.ContentAPIKt.teleport;
/**
* Handles the animal magnetism plugin.
* @author Vexia
@@ -122,9 +124,9 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
* @param item the item.
*/
private void handleEctophial(final Player player, final Item item) {
if(teleport(player,Location.create(3658, 3517, 0), TeleportType.ECTOPHIAL)) {
player.getInventory().replace(new Item(4252), item.getSlot());
player.sendMessage("...and the world changes around you.", 4);
player.getTeleporter().send(Location.create(3658, 3517, 0), TeleportType.ECTOPHIAL);
player.getAudioManager().send(4580);
player.sendMessage("You empty the ectoplasm onto the ground around your feet...");
player.getPulseManager().run(new Pulse(9, player) {
@@ -142,6 +144,7 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
}
});
}
}
/**
* Handles the hammering of a magnet.
+6 -3
View File
@@ -1064,9 +1064,12 @@ fun runWorldTask(task: () -> Unit): Pulse {
* @param loc the Location object to move them to
* @param type the teleport type to use (defaults to instant). An enum exists as TeleportManager.TeleportType.
*/
fun teleport(entity: Entity, loc: Location, type: TeleportManager.TeleportType = TeleportManager.TeleportType.INSTANT) {
if (type == TeleportManager.TeleportType.INSTANT) entity.properties.teleportLocation = loc
else entity.teleporter.send(loc, type)
fun teleport(entity: Entity, loc: Location, type: TeleportManager.TeleportType = TeleportManager.TeleportType.INSTANT) : Boolean {
if (type == TeleportManager.TeleportType.INSTANT) {
entity.properties.teleportLocation = loc
return true
}
else return entity.teleporter.send(loc, type)
}
/**