mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-19 14:02:00 +01:00
feat: Improve playerlimit checking
This commit is contained in:
parent
05c5cd8d66
commit
418146e14c
@ -23,6 +23,7 @@ public enum ActionCheckResult implements ActionResult {
|
||||
CANNOT_PAY_ENTRY_FEE(false),
|
||||
FREE_ENTRY(true),
|
||||
|
||||
NO_PLAYERLIMIT(true),
|
||||
WITHIN_PLAYERLIMIT(true),
|
||||
EXCEED_PLAYERLIMIT(false),
|
||||
BYPASS_PLAYERLIMIT(true),
|
||||
|
@ -152,7 +152,10 @@ public class PlayerActionChecker {
|
||||
}
|
||||
|
||||
public ActionCheckResult isWithinPlayerLimit(@NotNull CommandSender sender, @NotNull MVWorld toWorld) {
|
||||
if (toWorld.getPlayerLimit() < 0 || toWorld.getCBWorld().getPlayers().size() <= toWorld.getPlayerLimit()) {
|
||||
if (toWorld.getPlayerLimit() <= -1) {
|
||||
return ActionCheckResult.NO_PLAYERLIMIT;
|
||||
}
|
||||
if (toWorld.getPlayerLimit() > toWorld.getCBWorld().getPlayers().size()) {
|
||||
return ActionCheckResult.WITHIN_PLAYERLIMIT;
|
||||
}
|
||||
return permissionsTool.hasBypassPlayerLimit(sender, toWorld)
|
||||
|
Loading…
Reference in New Issue
Block a user