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