mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-02 17:00:19 +01:00
Allow for stricter movement check; resolves #802
This commit is contained in:
parent
5cc5073062
commit
c84f3564d5
@ -48,7 +48,7 @@ public class MainConfig extends DREConfig {
|
||||
NEVER
|
||||
}
|
||||
|
||||
public static final int CONFIG_VERSION = 19;
|
||||
public static final int CONFIG_VERSION = 20;
|
||||
|
||||
private String language = "english";
|
||||
private boolean enableEconomy = false;
|
||||
@ -97,6 +97,7 @@ public class MainConfig extends DREConfig {
|
||||
/* Performance */
|
||||
private int maxInstances = 10;
|
||||
private int editInstanceRemovalDelay = 5;
|
||||
private boolean strictMovementCheckEnabled = true;
|
||||
|
||||
/* Secure Mode */
|
||||
private boolean secureModeEnabled = false;
|
||||
@ -282,6 +283,14 @@ public class MainConfig extends DREConfig {
|
||||
editInstanceRemovalDelay = delay;
|
||||
}
|
||||
|
||||
public boolean isStrictMovementCheckEnabled() {
|
||||
return strictMovementCheckEnabled;
|
||||
}
|
||||
|
||||
public void setStrictMovementCheckEnabled(boolean enabled) {
|
||||
strictMovementCheckEnabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isSecureModeEnabled() {
|
||||
return secureModeEnabled;
|
||||
}
|
||||
@ -435,6 +444,10 @@ public class MainConfig extends DREConfig {
|
||||
config.set("editInstanceRemovalDelay", editInstanceRemovalDelay);
|
||||
}
|
||||
|
||||
if (!config.contains("strictMovementCheckEnabled")) {
|
||||
config.set("strictMovementCheckEnabled", strictMovementCheckEnabled);
|
||||
}
|
||||
|
||||
if (!config.contains("secureMode.enabled")) {
|
||||
config.set("secureMode.enabled", secureModeEnabled);
|
||||
}
|
||||
@ -528,6 +541,7 @@ public class MainConfig extends DREConfig {
|
||||
|
||||
maxInstances = config.getInt("maxInstances", maxInstances);
|
||||
editInstanceRemovalDelay = config.getInt("editInstanceRemovalDelay", editInstanceRemovalDelay);
|
||||
strictMovementCheckEnabled = config.getBoolean("strictMovementCheckEnabled", strictMovementCheckEnabled);
|
||||
secureModeEnabled = config.getBoolean("secureMode.enabled", secureModeEnabled);
|
||||
openInventories = config.getBoolean("secureMode.openInventories", openInventories);
|
||||
dropItems = config.getBoolean("secureMode.dropItems", dropItems);
|
||||
|
@ -243,13 +243,13 @@ public class DPortal extends GlobalProtection {
|
||||
|
||||
PlayerGroup group = plugin.getPlayerGroup(player);
|
||||
if (group == null) {
|
||||
MessageUtil.sendMessage(player, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||
MessageUtil.sendActionBarMessage(player, DMessage.ERROR_JOIN_GROUP.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
Dungeon dungeon = group.getDungeon();
|
||||
if (dungeon == null) {
|
||||
MessageUtil.sendMessage(player, DMessage.ERROR_NO_SUCH_DUNGEON.getMessage());
|
||||
MessageUtil.sendActionBarMessage(player, DMessage.ERROR_NO_SUCH_DUNGEON.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ public class DPortal extends GlobalProtection {
|
||||
if (resource != null) {
|
||||
target = resource.instantiateGameWorld(false);
|
||||
if (target == null) {
|
||||
MessageUtil.sendMessage(player, DMessage.ERROR_TOO_MANY_INSTANCES.getMessage());
|
||||
MessageUtil.sendActionBarMessage(player, DMessage.ERROR_TOO_MANY_INSTANCES.getMessage());
|
||||
return;
|
||||
}
|
||||
group.setGameWorld(target);
|
||||
@ -285,7 +285,7 @@ public class DPortal extends GlobalProtection {
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
MessageUtil.sendMessage(player, DMessage.ERROR_NO_SUCH_DUNGEON.getMessage());
|
||||
MessageUtil.sendActionBarMessage(player, DMessage.ERROR_NO_SUCH_DUNGEON.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,16 +148,19 @@ public class GlobalProtectionListener implements Listener {
|
||||
if (DPlayerListener.isCitizensNPC(player)) {
|
||||
return;
|
||||
}
|
||||
DPortal dPortal = DPortal.getByLocation(plugin, player.getEyeLocation());
|
||||
if (dPortal == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.getMainConfig().isStrictMovementCheckEnabled()) {
|
||||
Block blockFrom = event.getFrom().getBlock();
|
||||
Block blockTo = event.getTo().getBlock();
|
||||
if (blockFrom.equals(blockTo)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DPortal dPortal = DPortal.getByLocation(plugin, player.getEyeLocation());
|
||||
if (dPortal == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
dPortal.teleport(player);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user