diff --git a/Server/src/main/java/core/game/content/quest/members/animalmagnetism/AnimalMagnetismPlugin.java b/Server/src/main/java/core/game/content/quest/members/animalmagnetism/AnimalMagnetismPlugin.java index 73056266d..d5aaa3565 100644 --- a/Server/src/main/java/core/game/content/quest/members/animalmagnetism/AnimalMagnetismPlugin.java +++ b/Server/src/main/java/core/game/content/quest/members/animalmagnetism/AnimalMagnetismPlugin.java @@ -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,25 +124,26 @@ public final class AnimalMagnetismPlugin extends OptionHandler { * @param item the item. */ private void handleEctophial(final Player player, final Item item) { - 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) { - @Override - public boolean pulse() { - player.faceLocation(new Location(3659, 3519, 0)); - if (player.getInventory().containsItem(new Item(4252))) { - player.animate(Animation.create(1652)); - player.getAudioManager().send(1132); - player.getInventory().remove(new Item(4252)); - player.getInventory().add(item); - player.sendMessage("You refill the ectophial from the Ectofuntus."); + 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.getAudioManager().send(4580); + player.sendMessage("You empty the ectoplasm onto the ground around your feet..."); + player.getPulseManager().run(new Pulse(9, player) { + @Override + public boolean pulse() { + player.faceLocation(new Location(3659, 3519, 0)); + if (player.getInventory().containsItem(new Item(4252))) { + player.animate(Animation.create(1652)); + player.getAudioManager().send(1132); + player.getInventory().remove(new Item(4252)); + player.getInventory().add(item); + player.sendMessage("You refill the ectophial from the Ectofuntus."); + } + return true; } - return true; - } - }); + }); + } } /** diff --git a/Server/src/main/kotlin/api/ContentAPI.kt b/Server/src/main/kotlin/api/ContentAPI.kt index 92c03d23d..3d8b26bc8 100644 --- a/Server/src/main/kotlin/api/ContentAPI.kt +++ b/Server/src/main/kotlin/api/ContentAPI.kt @@ -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) } /**