Splits the PortalTeleporter into a PlayerTeleporter and a VehicleTeleporter for better structuring
Moves player-related teleportation code to PlayerTeleporter, moves vehicle-related teleportation code to VehicleTeleporter and makes them both extend the Teleporter which now contains all common teleportation code.
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
package net.knarcraft.stargate.utility;
|
||||
|
||||
import net.knarcraft.stargate.Stargate;
|
||||
import net.knarcraft.stargate.portal.PlayerTeleporter;
|
||||
import net.knarcraft.stargate.portal.Portal;
|
||||
import net.knarcraft.stargate.portal.PortalHandler;
|
||||
import net.knarcraft.stargate.portal.PortalTeleporter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -131,7 +131,7 @@ public final class BungeeHelper {
|
||||
Stargate.logger.info(Stargate.getString("prefix") + "Bungee gate " + destination + " does not exist");
|
||||
return;
|
||||
}
|
||||
new PortalTeleporter(destinationPortal).teleport(player, destinationPortal, null);
|
||||
new PlayerTeleporter(destinationPortal, player).teleport(destinationPortal, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public final class EconomyHandler {
|
||||
* Checks whether the given player can afford the given fee
|
||||
*
|
||||
* @param player <p>The player to check</p>
|
||||
* @param cost <p>The fee to pay</p>
|
||||
* @param cost <p>The fee to pay</p>
|
||||
* @return <p>True if the player can afford to pay the fee</p>
|
||||
*/
|
||||
public static boolean canAffordFee(Player player, int cost) {
|
||||
|
@ -2,9 +2,9 @@ package net.knarcraft.stargate.utility;
|
||||
|
||||
import net.knarcraft.stargate.Stargate;
|
||||
import net.knarcraft.stargate.event.StargateAccessEvent;
|
||||
import net.knarcraft.stargate.portal.PlayerTeleporter;
|
||||
import net.knarcraft.stargate.portal.Portal;
|
||||
import net.knarcraft.stargate.portal.PortalOption;
|
||||
import net.knarcraft.stargate.portal.PortalTeleporter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
@ -390,7 +390,7 @@ public final class PermissionHelper {
|
||||
// Not open for this player
|
||||
if (!entrancePortal.isOpenFor(player)) {
|
||||
Stargate.sendErrorMessage(player, Stargate.getString("denyMsg"));
|
||||
new PortalTeleporter(entrancePortal).teleport(player, entrancePortal, event);
|
||||
new PlayerTeleporter(entrancePortal, player).teleport(entrancePortal, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ public final class PermissionHelper {
|
||||
//Player cannot access portal
|
||||
if (PermissionHelper.cannotAccessPortal(player, entrancePortal, destination)) {
|
||||
Stargate.sendErrorMessage(player, Stargate.getString("denyMsg"));
|
||||
new PortalTeleporter(entrancePortal).teleport(player, entrancePortal, event);
|
||||
new PlayerTeleporter(entrancePortal, player).teleport(entrancePortal, event);
|
||||
entrancePortal.close(false);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user