mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Add server and world args to clear command, and add clearmeta command
This commit is contained in:
parent
e9216d3e0f
commit
924041bff4
@ -60,6 +60,7 @@ public class GroupMainCommand extends MainCommand<Group> {
|
|||||||
.add(new GroupAddTempSuffix())
|
.add(new GroupAddTempSuffix())
|
||||||
.add(new GroupRemoveTempPrefix())
|
.add(new GroupRemoveTempPrefix())
|
||||||
.add(new GroupRemoveTempSuffix())
|
.add(new GroupRemoveTempSuffix())
|
||||||
|
.add(new GroupClearMeta())
|
||||||
.add(new GroupBulkChange())
|
.add(new GroupBulkChange())
|
||||||
.add(new GroupClear())
|
.add(new GroupClear())
|
||||||
.add(new GroupRename())
|
.add(new GroupRename())
|
||||||
|
@ -23,27 +23,56 @@
|
|||||||
package me.lucko.luckperms.commands.group.subcommands;
|
package me.lucko.luckperms.commands.group.subcommands;
|
||||||
|
|
||||||
import me.lucko.luckperms.LuckPermsPlugin;
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.commands.CommandResult;
|
import me.lucko.luckperms.commands.*;
|
||||||
import me.lucko.luckperms.commands.Predicate;
|
|
||||||
import me.lucko.luckperms.commands.Sender;
|
|
||||||
import me.lucko.luckperms.commands.SubCommand;
|
|
||||||
import me.lucko.luckperms.constants.Message;
|
import me.lucko.luckperms.constants.Message;
|
||||||
import me.lucko.luckperms.constants.Permission;
|
import me.lucko.luckperms.constants.Permission;
|
||||||
import me.lucko.luckperms.data.LogEntry;
|
import me.lucko.luckperms.data.LogEntry;
|
||||||
import me.lucko.luckperms.groups.Group;
|
import me.lucko.luckperms.groups.Group;
|
||||||
|
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class GroupClear extends SubCommand<Group> {
|
public class GroupClear extends SubCommand<Group> {
|
||||||
public GroupClear() {
|
public GroupClear() {
|
||||||
super("clear", "Clears the group's permissions", Permission.GROUP_CLEAR, Predicate.alwaysFalse(), null);
|
super("clear", "Clears the group's permissions and parent groups", Permission.GROUP_CLEAR, Predicate.notInRange(0, 2),
|
||||||
|
Arg.list(
|
||||||
|
Arg.create("server", false, "the server name to filter by"),
|
||||||
|
Arg.create("world", false, "the world name to filter by")
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
||||||
|
int before = group.getNodes().size();
|
||||||
|
|
||||||
|
if (args.size() == 0) {
|
||||||
group.clearNodes();
|
group.clearNodes();
|
||||||
Message.CLEAR_SUCCESS.send(sender, group.getDisplayName());
|
} else {
|
||||||
LogEntry.build().actor(sender).acted(group).action("clear").build().submit(plugin, sender);
|
final String server = args.get(0);
|
||||||
|
if (ArgumentChecker.checkServer(server)) {
|
||||||
|
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||||
|
return CommandResult.INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
final String world = args.get(1);
|
||||||
|
group.clearNodes(server, world);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
group.clearNodes(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int changed = before - group.getNodes().size();
|
||||||
|
if (changed == 1) {
|
||||||
|
Message.CLEAR_SUCCESS_SINGULAR.send(sender, group.getName(), changed);
|
||||||
|
} else {
|
||||||
|
Message.CLEAR_SUCCESS.send(sender, group.getName(), changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogEntry.build().actor(sender).acted(group).action("clear " + args.stream().collect(Collectors.joining(" "))).build().submit(plugin, sender);
|
||||||
save(group, sender, plugin);
|
save(group, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.commands.group.subcommands;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
|
import me.lucko.luckperms.commands.*;
|
||||||
|
import me.lucko.luckperms.constants.Message;
|
||||||
|
import me.lucko.luckperms.constants.Permission;
|
||||||
|
import me.lucko.luckperms.data.LogEntry;
|
||||||
|
import me.lucko.luckperms.groups.Group;
|
||||||
|
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class GroupClearMeta extends SubCommand<Group> {
|
||||||
|
public GroupClearMeta() {
|
||||||
|
super("clearmeta", "Clears the groups's meta", Permission.GROUP_CLEARMETA, Predicate.notInRange(0, 2),
|
||||||
|
Arg.list(
|
||||||
|
Arg.create("server", false, "the server name to filter by"),
|
||||||
|
Arg.create("world", false, "the world name to filter by")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List<String> args, String label) {
|
||||||
|
int before = group.getNodes().size();
|
||||||
|
|
||||||
|
if (args.size() == 0) {
|
||||||
|
group.clearMeta();
|
||||||
|
} else {
|
||||||
|
final String server = args.get(0);
|
||||||
|
if (ArgumentChecker.checkServer(server)) {
|
||||||
|
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||||
|
return CommandResult.INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
final String world = args.get(1);
|
||||||
|
group.clearMeta(server, world);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
group.clearMeta(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int changed = before - group.getNodes().size();
|
||||||
|
if (changed == 1) {
|
||||||
|
Message.META_CLEAR_SUCCESS_SINGULAR.send(sender, group.getName(), changed);
|
||||||
|
} else {
|
||||||
|
Message.META_CLEAR_SUCCESS.send(sender, group.getName(), changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogEntry.build().actor(sender).acted(group).action("clearmeta " + args.stream().collect(Collectors.joining(" "))).build().submit(plugin, sender);
|
||||||
|
save(group, sender, plugin);
|
||||||
|
return CommandResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,7 @@ public class UserMainCommand extends MainCommand<User> {
|
|||||||
.add(new UserAddTempSuffix())
|
.add(new UserAddTempSuffix())
|
||||||
.add(new UserRemoveTempPrefix())
|
.add(new UserRemoveTempPrefix())
|
||||||
.add(new UserRemoveTempSuffix())
|
.add(new UserRemoveTempSuffix())
|
||||||
|
.add(new UserClearMeta())
|
||||||
.add(new UserBulkChange())
|
.add(new UserBulkChange())
|
||||||
.add(new UserClear())
|
.add(new UserClear())
|
||||||
.build()
|
.build()
|
||||||
|
@ -23,28 +23,56 @@
|
|||||||
package me.lucko.luckperms.commands.user.subcommands;
|
package me.lucko.luckperms.commands.user.subcommands;
|
||||||
|
|
||||||
import me.lucko.luckperms.LuckPermsPlugin;
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.commands.CommandResult;
|
import me.lucko.luckperms.commands.*;
|
||||||
import me.lucko.luckperms.commands.Predicate;
|
|
||||||
import me.lucko.luckperms.commands.Sender;
|
|
||||||
import me.lucko.luckperms.commands.SubCommand;
|
|
||||||
import me.lucko.luckperms.constants.Message;
|
import me.lucko.luckperms.constants.Message;
|
||||||
import me.lucko.luckperms.constants.Permission;
|
import me.lucko.luckperms.constants.Permission;
|
||||||
import me.lucko.luckperms.data.LogEntry;
|
import me.lucko.luckperms.data.LogEntry;
|
||||||
import me.lucko.luckperms.users.User;
|
import me.lucko.luckperms.users.User;
|
||||||
|
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class UserClear extends SubCommand<User> {
|
public class UserClear extends SubCommand<User> {
|
||||||
public UserClear() {
|
public UserClear() {
|
||||||
super("clear", "Clears the user's permissions and groups", Permission.USER_CLEAR, Predicate.alwaysFalse(), null);
|
super("clear", "Clears the user's permissions and groups", Permission.USER_CLEAR, Predicate.notInRange(0, 2),
|
||||||
|
Arg.list(
|
||||||
|
Arg.create("server", false, "the server name to filter by"),
|
||||||
|
Arg.create("world", false, "the world name to filter by")
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
|
||||||
user.clearNodes();
|
int before = user.getNodes().size();
|
||||||
Message.CLEAR_SUCCESS.send(sender, user.getName());
|
|
||||||
LogEntry.build().actor(sender).acted(user).action("clear").build().submit(plugin, sender);
|
|
||||||
|
|
||||||
|
if (args.size() == 0) {
|
||||||
|
user.clearNodes();
|
||||||
|
} else {
|
||||||
|
final String server = args.get(0);
|
||||||
|
if (ArgumentChecker.checkServer(server)) {
|
||||||
|
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||||
|
return CommandResult.INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
final String world = args.get(1);
|
||||||
|
user.clearNodes(server, world);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
user.clearNodes(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int changed = before - user.getNodes().size();
|
||||||
|
if (changed == 1) {
|
||||||
|
Message.CLEAR_SUCCESS_SINGULAR.send(sender, user.getName(), changed);
|
||||||
|
} else {
|
||||||
|
Message.CLEAR_SUCCESS.send(sender, user.getName(), changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogEntry.build().actor(sender).acted(user).action("clear " + args.stream().collect(Collectors.joining(" "))).build().submit(plugin, sender);
|
||||||
save(user, sender, plugin);
|
save(user, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.commands.user.subcommands;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.LuckPermsPlugin;
|
||||||
|
import me.lucko.luckperms.commands.*;
|
||||||
|
import me.lucko.luckperms.constants.Message;
|
||||||
|
import me.lucko.luckperms.constants.Permission;
|
||||||
|
import me.lucko.luckperms.data.LogEntry;
|
||||||
|
import me.lucko.luckperms.users.User;
|
||||||
|
import me.lucko.luckperms.utils.ArgumentChecker;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class UserClearMeta extends SubCommand<User> {
|
||||||
|
public UserClearMeta() {
|
||||||
|
super("clearmeta", "Clears the user's meta", Permission.USER_CLEARMETA, Predicate.notInRange(0, 2),
|
||||||
|
Arg.list(
|
||||||
|
Arg.create("server", false, "the server name to filter by"),
|
||||||
|
Arg.create("world", false, "the world name to filter by")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User user, List<String> args, String label) {
|
||||||
|
int before = user.getNodes().size();
|
||||||
|
|
||||||
|
if (args.size() == 0) {
|
||||||
|
user.clearMeta();
|
||||||
|
} else {
|
||||||
|
final String server = args.get(0);
|
||||||
|
if (ArgumentChecker.checkServer(server)) {
|
||||||
|
Message.SERVER_INVALID_ENTRY.send(sender);
|
||||||
|
return CommandResult.INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 2) {
|
||||||
|
final String world = args.get(1);
|
||||||
|
user.clearMeta(server, world);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
user.clearMeta(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int changed = before - user.getNodes().size();
|
||||||
|
if (changed == 1) {
|
||||||
|
Message.META_CLEAR_SUCCESS_SINGULAR.send(sender, user.getName(), changed);
|
||||||
|
} else {
|
||||||
|
Message.META_CLEAR_SUCCESS.send(sender, user.getName(), changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
LogEntry.build().actor(sender).acted(user).action("clearmeta " + args.stream().collect(Collectors.joining(" "))).build().submit(plugin, sender);
|
||||||
|
save(user, sender, plugin);
|
||||||
|
return CommandResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
@ -171,7 +171,10 @@ public enum Message {
|
|||||||
UNSET_TEMP_PERMISSION_SUCCESS("&aUnset temporary permission &b{0}&a for &b{1}&a.", true),
|
UNSET_TEMP_PERMISSION_SUCCESS("&aUnset temporary permission &b{0}&a for &b{1}&a.", true),
|
||||||
UNSET_TEMP_PERMISSION_SERVER_SUCCESS("&aUnset temporary permission &b{0}&a for &b{1}&a on server &b{2}&a.", true),
|
UNSET_TEMP_PERMISSION_SERVER_SUCCESS("&aUnset temporary permission &b{0}&a for &b{1}&a on server &b{2}&a.", true),
|
||||||
UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS("&aUnset temporary permission &b{0}&a for &b{1}&a on server &b{2}&a, world &b{3}&a.", true),
|
UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS("&aUnset temporary permission &b{0}&a for &b{1}&a on server &b{2}&a, world &b{3}&a.", true),
|
||||||
CLEAR_SUCCESS("&b{0}&a's permissions were cleared.", true),
|
CLEAR_SUCCESS("&b{0}&a's permissions were cleared. (&b{1}&a nodes were removed.)", true),
|
||||||
|
CLEAR_SUCCESS_SINGULAR("&b{0}&a's permissions were cleared. (&b{1}&a node was removed.)", true),
|
||||||
|
META_CLEAR_SUCCESS("&b{0}&a's meta was cleared. (&b{1}&a nodes were removed.)", true),
|
||||||
|
META_CLEAR_SUCCESS_SINGULAR("&b{0}&a's meta was cleared. (&b{1}&a node was removed.)", true),
|
||||||
ILLEGAL_DATE_ERROR("Could not parse date '{0}'.", true),
|
ILLEGAL_DATE_ERROR("Could not parse date '{0}'.", true),
|
||||||
PAST_DATE_ERROR("You cannot set a date in the past!", true),
|
PAST_DATE_ERROR("You cannot set a date in the past!", true),
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ public enum Permission {
|
|||||||
USER_REMOVE_TEMP_PREFIX("removetempprefix", "user"),
|
USER_REMOVE_TEMP_PREFIX("removetempprefix", "user"),
|
||||||
USER_ADD_TEMP_SUFFIX("addtempsuffix", "user"),
|
USER_ADD_TEMP_SUFFIX("addtempsuffix", "user"),
|
||||||
USER_REMOVE_TEMP_SUFFIX("removetempsuffix", "user"),
|
USER_REMOVE_TEMP_SUFFIX("removetempsuffix", "user"),
|
||||||
|
USER_CLEARMETA("clearmeta", "user"),
|
||||||
USER_BULKCHANGE("bulkchange", "user"),
|
USER_BULKCHANGE("bulkchange", "user"),
|
||||||
USER_CLEAR("clear", "user"),
|
USER_CLEAR("clear", "user"),
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ public enum Permission {
|
|||||||
GROUP_REMOVE_TEMP_PREFIX("removetempprefix", "group"),
|
GROUP_REMOVE_TEMP_PREFIX("removetempprefix", "group"),
|
||||||
GROUP_ADD_TEMP_SUFFIX("addtempsuffix", "group"),
|
GROUP_ADD_TEMP_SUFFIX("addtempsuffix", "group"),
|
||||||
GROUP_REMOVE_TEMP_SUFFIX("removetempsuffix", "group"),
|
GROUP_REMOVE_TEMP_SUFFIX("removetempsuffix", "group"),
|
||||||
|
GROUP_CLEARMETA("clearmeta", "group"),
|
||||||
GROUP_BULKCHANGE("bulkchange", "group"),
|
GROUP_BULKCHANGE("bulkchange", "group"),
|
||||||
GROUP_CLEAR("clear", "group"),
|
GROUP_CLEAR("clear", "group"),
|
||||||
GROUP_RENAME("rename", "group"),
|
GROUP_RENAME("rename", "group"),
|
||||||
|
@ -162,6 +162,76 @@ public abstract class PermissionHolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearNodes(String server) {
|
||||||
|
if (server == null) {
|
||||||
|
server = "global";
|
||||||
|
}
|
||||||
|
String finalServer = server;
|
||||||
|
|
||||||
|
synchronized (nodes) {
|
||||||
|
nodes.removeIf(n -> n.getServer().orElse("global").equalsIgnoreCase(finalServer));
|
||||||
|
invalidateCache(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearNodes(String server, String world) {
|
||||||
|
if (server == null) {
|
||||||
|
server = "global";
|
||||||
|
}
|
||||||
|
String finalServer = server;
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
world = "null";
|
||||||
|
}
|
||||||
|
String finalWorld = world;
|
||||||
|
|
||||||
|
synchronized (nodes) {
|
||||||
|
nodes.removeIf(n -> n.getServer().orElse("global").equalsIgnoreCase(finalServer) && n.getWorld().orElse("null").equalsIgnoreCase(finalWorld));
|
||||||
|
invalidateCache(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearMeta() {
|
||||||
|
synchronized (nodes) {
|
||||||
|
nodes.removeIf(n -> n.isMeta() || n.isPrefix() || n.isSuffix());
|
||||||
|
invalidateCache(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearMeta(String server) {
|
||||||
|
if (server == null) {
|
||||||
|
server = "global";
|
||||||
|
}
|
||||||
|
String finalServer = server;
|
||||||
|
|
||||||
|
synchronized (nodes) {
|
||||||
|
nodes.removeIf(n -> (n.isMeta() || n.isPrefix() || n.isSuffix()) &&
|
||||||
|
n.getServer().orElse("global").equalsIgnoreCase(finalServer)
|
||||||
|
);
|
||||||
|
invalidateCache(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearMeta(String server, String world) {
|
||||||
|
if (server == null) {
|
||||||
|
server = "global";
|
||||||
|
}
|
||||||
|
String finalServer = server;
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
world = "null";
|
||||||
|
}
|
||||||
|
String finalWorld = world;
|
||||||
|
|
||||||
|
synchronized (nodes) {
|
||||||
|
nodes.removeIf(n -> (n.isMeta() || n.isPrefix() || n.isSuffix()) &&
|
||||||
|
(n.getServer().orElse("global").equalsIgnoreCase(finalServer) &&
|
||||||
|
n.getWorld().orElse("null").equalsIgnoreCase(finalWorld))
|
||||||
|
);
|
||||||
|
invalidateCache(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void clearTransientNodes() {
|
public void clearTransientNodes() {
|
||||||
synchronized (transientNodes) {
|
synchronized (transientNodes) {
|
||||||
transientNodes.clear();
|
transientNodes.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user