mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Implement bulk prefix/suffix removal
This commit is contained in:
parent
1da1df156e
commit
58e223e74b
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.group.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupRemovePrefix extends SubCommand<Group> {
|
||||
@ -56,6 +58,57 @@ public class GroupRemovePrefix extends SubCommand<Group> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (prefix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : group.getNodes()) {
|
||||
if (!node.isPrefix()) continue;
|
||||
if (node.getPrefix().getKey() != priority) continue;
|
||||
if (node.isTemporary()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
group.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "prefix." + priority + "." + ArgumentChecker.escapeCharacters(prefix);
|
||||
|
||||
try {
|
||||
@ -96,4 +149,5 @@ public class GroupRemovePrefix extends SubCommand<Group> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.group.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupRemoveSuffix extends SubCommand<Group> {
|
||||
@ -56,6 +58,57 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (suffix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : group.getNodes()) {
|
||||
if (!node.isSuffix()) continue;
|
||||
if (node.getSuffix().getKey() != priority) continue;
|
||||
if (node.isTemporary()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
group.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "suffix." + priority + "." + ArgumentChecker.escapeCharacters(suffix);
|
||||
|
||||
try {
|
||||
@ -96,4 +149,5 @@ public class GroupRemoveSuffix extends SubCommand<Group> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.group.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupRemoveTempPrefix extends SubCommand<Group> {
|
||||
@ -57,6 +59,57 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (prefix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : group.getNodes()) {
|
||||
if (!node.isPrefix()) continue;
|
||||
if (node.getPrefix().getKey() != priority) continue;
|
||||
if (node.isPermanent()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
group.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "prefix." + priority + "." + ArgumentChecker.escapeCharacters(prefix);
|
||||
|
||||
try {
|
||||
@ -97,4 +150,5 @@ public class GroupRemoveTempPrefix extends SubCommand<Group> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.group.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.groups.Group;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GroupRemoveTempSuffix extends SubCommand<Group> {
|
||||
@ -57,6 +59,57 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (suffix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : group.getNodes()) {
|
||||
if (!node.isSuffix()) continue;
|
||||
if (node.getSuffix().getKey() != priority) continue;
|
||||
if (node.isPermanent()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
group.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(group, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "suffix." + priority + "." + ArgumentChecker.escapeCharacters(suffix);
|
||||
|
||||
try {
|
||||
@ -97,4 +150,5 @@ public class GroupRemoveTempSuffix extends SubCommand<Group> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserRemovePrefix extends SubCommand<User> {
|
||||
@ -56,6 +58,57 @@ public class UserRemovePrefix extends SubCommand<User> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (prefix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : user.getNodes()) {
|
||||
if (!node.isPrefix()) continue;
|
||||
if (node.getPrefix().getKey() != priority) continue;
|
||||
if (node.isTemporary()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
user.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "prefix." + priority + "." + ArgumentChecker.escapeCharacters(prefix);
|
||||
|
||||
try {
|
||||
@ -96,4 +149,5 @@ public class UserRemovePrefix extends SubCommand<User> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserRemoveSuffix extends SubCommand<User> {
|
||||
@ -56,6 +58,57 @@ public class UserRemoveSuffix extends SubCommand<User> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (suffix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : user.getNodes()) {
|
||||
if (!node.isSuffix()) continue;
|
||||
if (node.getSuffix().getKey() != priority) continue;
|
||||
if (node.isTemporary()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
user.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "suffix." + priority + "." + ArgumentChecker.escapeCharacters(suffix);
|
||||
|
||||
try {
|
||||
@ -96,4 +149,5 @@ public class UserRemoveSuffix extends SubCommand<User> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserRemoveTempPrefix extends SubCommand<User> {
|
||||
@ -57,6 +59,57 @@ public class UserRemoveTempPrefix extends SubCommand<User> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (prefix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : user.getNodes()) {
|
||||
if (!node.isPrefix()) continue;
|
||||
if (node.getPrefix().getKey() != priority) continue;
|
||||
if (node.isPermanent()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
user.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "prefix." + priority + "." + ArgumentChecker.escapeCharacters(prefix);
|
||||
|
||||
try {
|
||||
@ -97,4 +150,5 @@ public class UserRemoveTempPrefix extends SubCommand<User> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
package me.lucko.luckperms.commands.user.subcommands;
|
||||
|
||||
import me.lucko.luckperms.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.commands.*;
|
||||
import me.lucko.luckperms.constants.Message;
|
||||
import me.lucko.luckperms.constants.Permission;
|
||||
@ -31,6 +32,7 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import me.lucko.luckperms.users.User;
|
||||
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserRemoveTempSuffix extends SubCommand<User> {
|
||||
@ -57,6 +59,57 @@ public class UserRemoveTempSuffix extends SubCommand<User> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (suffix.equalsIgnoreCase("null")) {
|
||||
String server = null;
|
||||
String world = null;
|
||||
|
||||
if (args.size() >= 3) {
|
||||
server = args.get(2).toLowerCase();
|
||||
if (ArgumentChecker.checkServer(server)) {
|
||||
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (args.size() != 3) {
|
||||
world = args.get(3).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
List<Node> toRemove = new ArrayList<>();
|
||||
for (Node node : user.getNodes()) {
|
||||
if (!node.isSuffix()) continue;
|
||||
if (node.getSuffix().getKey() != priority) continue;
|
||||
if (node.isPermanent()) continue;
|
||||
|
||||
if (node.getServer().isPresent()) {
|
||||
if (server == null) continue;
|
||||
if (!node.getServer().get().equalsIgnoreCase(server)) continue;
|
||||
} else {
|
||||
if (server != null) continue;
|
||||
}
|
||||
|
||||
if (node.getWorld().isPresent()) {
|
||||
if (world == null) continue;
|
||||
if (!node.getWorld().get().equalsIgnoreCase(world)) continue;
|
||||
} else {
|
||||
if (world != null) continue;
|
||||
}
|
||||
|
||||
toRemove.add(node);
|
||||
}
|
||||
|
||||
toRemove.forEach(n -> {
|
||||
try {
|
||||
user.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {}
|
||||
});
|
||||
|
||||
Message.BULK_CHANGE_SUCCESS.send(sender, toRemove.size());
|
||||
save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
final String node = "suffix." + priority + "." + ArgumentChecker.escapeCharacters(suffix);
|
||||
|
||||
try {
|
||||
@ -97,4 +150,5 @@ public class UserRemoveTempSuffix extends SubCommand<User> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user