mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Fixed //limit being overridden each time a LocalSession is fetched.
This commit is contained in:
parent
5402da6c70
commit
caa5fcdcdf
@ -277,6 +277,7 @@ public class WorldEdit {
|
|||||||
session = sessions.get(player.getName());
|
session = sessions.get(player.getName());
|
||||||
} else {
|
} else {
|
||||||
session = new LocalSession(config);
|
session = new LocalSession(config);
|
||||||
|
session.setBlockChangeLimit(config.defaultChangeLimit);
|
||||||
// Remember the session
|
// Remember the session
|
||||||
sessions.put(player.getName(), session);
|
sessions.put(player.getName(), session);
|
||||||
}
|
}
|
||||||
@ -284,22 +285,25 @@ public class WorldEdit {
|
|||||||
// Set the limit on the number of blocks that an operation can
|
// Set the limit on the number of blocks that an operation can
|
||||||
// change at once, or don't if the player has an override or there
|
// change at once, or don't if the player has an override or there
|
||||||
// is no limit. There is also a default limit
|
// is no limit. There is also a default limit
|
||||||
|
int currentChangeLimit = session.getBlockChangeLimit();
|
||||||
|
|
||||||
if (!player.hasPermission("worldedit.limit.unrestricted")
|
if (!player.hasPermission("worldedit.limit.unrestricted")
|
||||||
&& config.maxChangeLimit > -1) {
|
&& config.maxChangeLimit > -1) {
|
||||||
|
|
||||||
// If the default limit is infinite but there is a maximum
|
// If the default limit is infinite but there is a maximum
|
||||||
// limit, make sure to not have it be overridden
|
// limit, make sure to not have it be overridden
|
||||||
if (config.defaultChangeLimit < 0) {
|
if (config.defaultChangeLimit < 0) {
|
||||||
session.setBlockChangeLimit(config.maxChangeLimit);
|
if (currentChangeLimit < 0 || currentChangeLimit > config.maxChangeLimit) {
|
||||||
|
session.setBlockChangeLimit(config.maxChangeLimit);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Bound the change limit
|
// Bound the change limit
|
||||||
int limit = Math.min(config.defaultChangeLimit,
|
int maxChangeLimit = Math.min(config.defaultChangeLimit,
|
||||||
config.maxChangeLimit);
|
config.maxChangeLimit);
|
||||||
session.setBlockChangeLimit(limit);
|
if (currentChangeLimit == -1 || currentChangeLimit > maxChangeLimit) {
|
||||||
|
session.setBlockChangeLimit(maxChangeLimit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// No change limit or override
|
|
||||||
session.setBlockChangeLimit(config.defaultChangeLimit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have the session use inventory if it's enabled and the player
|
// Have the session use inventory if it's enabled and the player
|
||||||
|
Loading…
Reference in New Issue
Block a user