mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-06 00:08:04 +01:00
Add config value (teleportintercept
)
New config value sets whether to attempt to block non-permissible teleport attempts initiated from other plugins. Previous behavior was new config value `false` - MV would not intercept these outside teleports. New default configured value is `true` - MV will intercept (and possibly block) other plugins' teleports.
This commit is contained in:
parent
6761be6952
commit
8345c83afd
@ -58,6 +58,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
public static boolean EnforceGameModes;
|
||||
public static boolean PrefixChat;
|
||||
public static boolean DisplayPermErrors;
|
||||
public static boolean TeleportIntercept;
|
||||
public static Map<String, String> teleportQueue = new HashMap<String, String>();
|
||||
private AnchorManager anchorManager = new AnchorManager(this);
|
||||
|
||||
@ -325,6 +326,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
EnforceGameModes = this.multiverseConfig.getBoolean("enforcegamemodes", true);
|
||||
PrefixChat = this.multiverseConfig.getBoolean("worldnameprefix", true);
|
||||
DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true);
|
||||
TeleportIntercept = this.multiverseConfig.getBoolean("teleportintercept", true);
|
||||
// Default as the server.props world.
|
||||
this.worldManager.setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld", getDefaultWorldName()));
|
||||
DisplayPermErrors = this.multiverseConfig.getBoolean("displaypermerrors", true);
|
||||
|
@ -56,6 +56,7 @@ public class VersionCommand extends MultiverseCommand {
|
||||
logAndAddToPasteBinBuffer("enforceaccess: " + MultiverseCore.EnforceAccess);
|
||||
logAndAddToPasteBinBuffer("enforcegamemodes: " + MultiverseCore.EnforceGameModes);
|
||||
logAndAddToPasteBinBuffer("displaypermerrors: " + MultiverseCore.DisplayPermErrors);
|
||||
logAndAddToPasteBinBuffer("teleportintercept: " + MultiverseCore.TeleportIntercept);
|
||||
logAndAddToPasteBinBuffer("debug: " + MultiverseCore.GlobalDebug);
|
||||
logAndAddToPasteBinBuffer("Special Code: FRN002");
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
public enum ConfigProperty {
|
||||
messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstworldspawn;
|
||||
messagecooldown, teleportcooldown, worldnameprefix, enforcegamemodes, enforceaccess, displaypermerrors, debug, firstworldspawn, teleportintercept;
|
||||
|
||||
public static String getAllValues() {
|
||||
String buffer = "";
|
||||
|
@ -83,18 +83,32 @@ public class PermissionTools {
|
||||
}
|
||||
|
||||
public boolean playerHasMoneyToEnter(MultiverseWorld fromWorld, MultiverseWorld toWorld, CommandSender teleporter, Player teleportee, boolean pay) {
|
||||
if (teleporter instanceof ConsoleCommandSender) {
|
||||
return true;
|
||||
}
|
||||
Player teleporterPlayer;
|
||||
if (MultiverseCore.TeleportIntercept) {
|
||||
if (teleporter instanceof ConsoleCommandSender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (teleporter == null) {
|
||||
teleporter = teleportee;
|
||||
}
|
||||
if (teleporter == null && MultiverseCore.TeleportIntercept) {
|
||||
teleporter = teleportee;
|
||||
}
|
||||
|
||||
if (!(teleporter instanceof Player)) {
|
||||
return false;
|
||||
if (!(teleporter instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
teleporterPlayer = (Player) teleporter;
|
||||
} else {
|
||||
if (teleporter instanceof Player) {
|
||||
teleporterPlayer = (Player) teleporter;
|
||||
} else {
|
||||
teleporterPlayer = null;
|
||||
}
|
||||
|
||||
// Old-style!
|
||||
if (teleporterPlayer == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Player teleporterPlayer = (Player) teleporter;
|
||||
|
||||
// Only check payments if it's a different world:
|
||||
if (!toWorld.equals(fromWorld)) {
|
||||
@ -132,21 +146,35 @@ public class PermissionTools {
|
||||
public boolean playerCanGoFromTo(MultiverseWorld fromWorld, MultiverseWorld toWorld, CommandSender teleporter, Player teleportee) {
|
||||
this.plugin.log(Level.FINEST, "Checking '" + teleporter + "' can send '" + teleportee + "' somewhere");
|
||||
|
||||
// The console can send anyone anywhere
|
||||
if (teleporter instanceof ConsoleCommandSender) {
|
||||
return true;
|
||||
}
|
||||
Player teleporterPlayer;
|
||||
if(MultiverseCore.TeleportIntercept) {
|
||||
// The console can send anyone anywhere
|
||||
if (teleporter instanceof ConsoleCommandSender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make sure we have a teleporter of some kind, even if it's inferred to be the teleportee
|
||||
if (teleporter == null) {
|
||||
teleporter = teleportee;
|
||||
}
|
||||
// Make sure we have a teleporter of some kind, even if it's inferred to be the teleportee
|
||||
if (teleporter == null) {
|
||||
teleporter = teleportee;
|
||||
}
|
||||
|
||||
// Now make sure we can cast the teleporter to a player, 'cause I'm tired of console things now
|
||||
if (!(teleporter instanceof Player)) {
|
||||
return false;
|
||||
// Now make sure we can cast the teleporter to a player, 'cause I'm tired of console things now
|
||||
if (!(teleporter instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
teleporterPlayer = (Player) teleporter;
|
||||
} else {
|
||||
if (teleporter instanceof Player) {
|
||||
teleporterPlayer = (Player) teleporter;
|
||||
} else {
|
||||
teleporterPlayer = null;
|
||||
}
|
||||
|
||||
// Old-style!
|
||||
if (teleporterPlayer == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Player teleporterPlayer = (Player) teleporter;
|
||||
|
||||
// Actual checks
|
||||
if (toWorld != null) {
|
||||
|
@ -10,3 +10,4 @@ enforcegamemodes: true
|
||||
bedrespawn: true
|
||||
version: 2.4
|
||||
displaypermerrors: true
|
||||
teleportintercept: true
|
||||
|
Loading…
Reference in New Issue
Block a user