Skip to content

Commit

Permalink
allow multiple flags/perms with player event switches
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 18, 2020
1 parent 31a5018 commit 4e19312
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -348,8 +348,10 @@ public boolean runFlaggedCheck(ScriptPath path, String switchName, PlayerTag pla
if (player == null) {
return false;
}
if (!FlagManager.playerHasFlag(player, flagged)) {
return false;
for (String flag : CoreUtilities.split(flagged, '|')) {
if (!FlagManager.playerHasFlag(player, flag)) {
return false;
}
}
return true;
}
Expand All @@ -366,8 +368,10 @@ public boolean runPermissionCheck(ScriptPath path, String switchName, PlayerTag
if (player == null || !player.isOnline()) {
return false;
}
if (!player.getPlayerEntity().hasPermission(perm)) {
return false;
for (String permName : CoreUtilities.split(perm, '|')) {
if (!player.getPlayerEntity().hasPermission(permName)) {
return false;
}
}
return true;
}
Expand All @@ -386,6 +390,8 @@ public boolean runPermissionCheck(ScriptPath path, String switchName, PlayerTag
//
// Note that these switches will be ignored for events that do not have a linked player.
// Be cautious with events that will only sometimes have a linked player.
//
// For multiple flag or permission requirements, just list them separated by '|' pipes, like "flagged:a|b|c".
// -->

public boolean runAutomaticPlayerSwitches(ScriptPath path) {
Expand Down

0 comments on commit 4e19312

Please sign in to comment.