Fixed incorrect message when trying to use teleport levers while teleblocked

This commit is contained in:
Player Name 2023-08-20 03:40:36 +00:00 committed by Ryan
parent f8cdb5cff5
commit 7a585796be
4 changed files with 33 additions and 14 deletions

View file

@ -68,8 +68,12 @@ public final class WildernessLeverPlugin extends OptionHandler {
GameWorld.getPulser().submit(new Pulse(2, player) { GameWorld.getPulser().submit(new Pulse(2, player) {
@Override @Override
public boolean pulse() { public boolean pulse() {
lever.message(player, index); if (player.timers.getTimer("teleblock") == null) {
lever.teleport(player, lever.getLocation(index)); lever.message(player, index);
lever.teleport(player, lever.getLocation(index));
} else {
player.getPacketDispatch().sendMessage("A magical force has stopped you from teleporting.");
}
return true; return true;
} }
}); });

View file

@ -17,6 +17,7 @@ import core.game.world.GameWorld
/** /**
* This class covers some listeners for the Lost City quest * This class covers some listeners for the Lost City quest
* @author lila * @author lila
* @author Player Name
*/ */
@Initializable @Initializable
class LostCityListeners : InteractionListener { class LostCityListeners : InteractionListener {
@ -36,8 +37,12 @@ class LostCityListeners : InteractionListener {
override fun pulse(): Boolean { override fun pulse(): Boolean {
when (count++) { when (count++) {
0 -> { 0 -> {
sendMessage(player,"The world starts to shimmer...") if (player.isTeleBlocked()) {
teleport(player, Location(2452, 4473, 0), TeleportType.FAIRY_RING) sendMessage(player,"A magical force has stopped you from teleporting.")
} else {
sendMessage(player,"The world starts to shimmer...")
teleport(player, Location(2452, 4473, 0), TeleportType.FAIRY_RING)
}
} }
1 -> return isQuestComplete(player,quest) 1 -> return isQuestComplete(player,quest)
2 -> { 2 -> {

View file

@ -19,8 +19,9 @@ import core.tools.RandomFunction;
/** /**
* Represents the wilderness obelisk plugin. * Represents the wilderness obelisk plugin.
* @author 'Vexia, small changes by Player Name * @author 'Vexia
* @version 1.1 * @author Player Name
* @version 1.2
*/ */
@Initializable @Initializable
public final class WildernessObeliskPlugin extends OptionHandler { public final class WildernessObeliskPlugin extends OptionHandler {
@ -103,10 +104,14 @@ public final class WildernessObeliskPlugin extends OptionHandler {
Obelisk newObelisk = newObelisks[index]; Obelisk newObelisk = newObelisks[index];
// Teleport players standing within a 3-by-3 bounding box // Teleport players standing within a 3-by-3 bounding box
for (Player player : RegionManager.getLocalPlayersBoundingBox(center, 1, 1)) { for (Player player : RegionManager.getLocalPlayersBoundingBox(center, 1, 1)) {
player.getPacketDispatch().sendMessage("Ancient magic teleports you somewhere in the wilderness."); if (player.timers.getTimer("teleblock") == null) {
int xOffset = player.getLocation().getX() - center.getX(); player.getPacketDispatch().sendMessage("Ancient magic teleports you somewhere in the wilderness.");
int yOffset = player.getLocation().getY() - center.getY(); int xOffset = player.getLocation().getX() - center.getX();
player.getTeleporter().send(Location.create(newObelisk.getLocation().getX() + xOffset, newObelisk.getLocation().getY() + yOffset, 0), TeleportType.OBELISK, 2); int yOffset = player.getLocation().getY() - center.getY();
player.getTeleporter().send(Location.create(newObelisk.getLocation().getX() + xOffset, newObelisk.getLocation().getY() + yOffset, 0), TeleportType.OBELISK, 2);
} else {
player.getPacketDispatch().sendMessage("A magical force has stopped you from teleporting.");
}
} }
super.setDelay(1); super.setDelay(1);
return false; return false;

View file

@ -71,7 +71,8 @@ public final class WildernessPlugin extends OptionHandler {
* Represents the plugin used to handle kbd nodes. * Represents the plugin used to handle kbd nodes.
* *
* @author 'Vexia * @author 'Vexia
* @version 1.0 * @author Player Name
* @version 1.1
*/ */
public static final class KBDPlugin extends OptionHandler { public static final class KBDPlugin extends OptionHandler {
@ -123,9 +124,13 @@ public final class WildernessPlugin extends OptionHandler {
if (player.getLocation().withinDistance(LOCATIONS[5])) { if (player.getLocation().withinDistance(LOCATIONS[5])) {
animate(player, 2140, false); animate(player, 2140, false);
playAudio(player, Sounds.LEVER_2400); playAudio(player, Sounds.LEVER_2400);
player.getPacketDispatch().sendMessage("You pull the lever..."); if (player.isTeleBlocked()) {
player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL); player.getPacketDispatch().sendMessage("A magical force has stopped you from teleporting.");
player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5); } else {
player.getPacketDispatch().sendMessage("You pull the lever...");
player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL);
player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5);
}
} }
break; break;
case 1817: case 1817: