mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Export using the /lp alias
This commit is contained in:
parent
6dec1ba8af
commit
de4c6b384c
@ -113,7 +113,7 @@ public class Exporter implements Runnable {
|
||||
|
||||
for (Group group : groups) {
|
||||
if (!group.getName().equals("default")) {
|
||||
write(writer, "/luckperms creategroup " + group.getName());
|
||||
write(writer, "/lp creategroup " + group.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class Exporter implements Runnable {
|
||||
|
||||
write(writer, "# Export group: " + group.getName());
|
||||
for (Node node : group.getEnduringNodes().values()) {
|
||||
write(writer, NodeFactory.nodeAsCommand(node, group.getName(), true, true));
|
||||
write(writer, "/lp " + NodeFactory.nodeAsCommand(node, group.getName(), true, true));
|
||||
}
|
||||
write(writer, "");
|
||||
log.logAllProgress("Exported {} groups so far.", groupCount.incrementAndGet());
|
||||
@ -144,7 +144,7 @@ public class Exporter implements Runnable {
|
||||
// Create the actual tracks first
|
||||
write(writer, "# Create tracks");
|
||||
for (Track track : tracks) {
|
||||
write(writer, "/luckperms createtrack " + track.getName());
|
||||
write(writer, "/lp createtrack " + track.getName());
|
||||
}
|
||||
|
||||
write(writer, "");
|
||||
@ -153,7 +153,7 @@ public class Exporter implements Runnable {
|
||||
for (Track track : plugin.getTrackManager().getAll().values()) {
|
||||
write(writer, "# Export track: " + track.getName());
|
||||
for (String group : track.getGroups()) {
|
||||
write(writer, "/luckperms track " + track.getName() + " append " + group);
|
||||
write(writer, "/lp track " + track.getName() + " append " + group);
|
||||
}
|
||||
write(writer, "");
|
||||
log.logAllProgress("Exported {} tracks so far.", trackCount.incrementAndGet());
|
||||
@ -230,15 +230,15 @@ public class Exporter implements Runnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
output.add(NodeFactory.nodeAsCommand(node, user.getUuid().toString(), false, true));
|
||||
output.add("/lp" + NodeFactory.nodeAsCommand(node, user.getUuid().toString(), false, true));
|
||||
}
|
||||
|
||||
if (!user.getPrimaryGroup().getStoredValue().equalsIgnoreCase("default")) {
|
||||
output.add("/luckperms user " + user.getUuid().toString() + " switchprimarygroup " + user.getPrimaryGroup().getStoredValue());
|
||||
output.add("/lp user " + user.getUuid().toString() + " switchprimarygroup " + user.getPrimaryGroup().getStoredValue());
|
||||
}
|
||||
|
||||
if (!inDefault) {
|
||||
output.add("/luckperms user " + user.getUuid().toString() + " parent remove default");
|
||||
output.add("/lp user " + user.getUuid().toString() + " parent remove default");
|
||||
}
|
||||
|
||||
plugin.getUserManager().cleanup(user);
|
||||
|
@ -72,10 +72,8 @@ public class Importer implements Runnable {
|
||||
.filter(s -> !s.isEmpty())
|
||||
.filter(s -> !s.startsWith("#"))
|
||||
.filter(s -> !s.startsWith("//"))
|
||||
.map(s -> s.startsWith("/") ? s.substring("/".length()) : s)
|
||||
.map(s -> s.startsWith("perms ") ? s.substring("perms ".length()) : s)
|
||||
.map(s -> s.startsWith("lp ") ? s.substring("lp ".length()) : s)
|
||||
.map(s -> s.startsWith("luckperms ") ? s.substring("luckperms ".length()) : s)
|
||||
.map(s -> s.startsWith("/luckperms ") ? s.substring("/luckperms ".length()) : s)
|
||||
.map(s -> s.startsWith("/lp ") ? s.substring("/lp ".length()) : s)
|
||||
.collect(Collectors.toList());
|
||||
this.toExecute = new ArrayList<>();
|
||||
}
|
||||
@ -91,7 +89,7 @@ public class Importer implements Runnable {
|
||||
ImportCommand cmd = new ImportCommand(commandManager, index, command);
|
||||
toExecute.add(cmd);
|
||||
|
||||
if (cmd.getCommand().startsWith("creategroup ") || cmd.getCommand().startsWith("createtrack")) {
|
||||
if (cmd.getCommand().startsWith("creategroup ") || cmd.getCommand().startsWith("createtrack ")) {
|
||||
cmd.process(); // process immediately
|
||||
}
|
||||
|
||||
|
@ -169,8 +169,7 @@ public class MetaInfo extends SharedSubCommand {
|
||||
), '¥'));
|
||||
|
||||
boolean group = !(holder instanceof User);
|
||||
String command = NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false)
|
||||
.replace("/luckperms", "/" + label);
|
||||
String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false);
|
||||
|
||||
return component -> {
|
||||
component.hoverEvent(hoverEvent);
|
||||
@ -194,8 +193,7 @@ public class MetaInfo extends SharedSubCommand {
|
||||
), '¥'));
|
||||
|
||||
boolean group = !(holder instanceof User);
|
||||
String command = NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false)
|
||||
.replace("/luckperms", "/" + label);
|
||||
String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false);
|
||||
|
||||
return component -> {
|
||||
component.hoverEvent(hoverEvent);
|
||||
|
@ -129,8 +129,7 @@ public class ParentInfo extends SharedSubCommand {
|
||||
), Constants.FORMAT_CHAR));
|
||||
|
||||
boolean group = !(holder instanceof User);
|
||||
String command = NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false)
|
||||
.replace("/luckperms", "/" + label);
|
||||
String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false);
|
||||
|
||||
return component -> {
|
||||
component.hoverEvent(hoverEvent);
|
||||
|
@ -190,8 +190,7 @@ public class PermissionInfo extends SharedSubCommand {
|
||||
), '¥'));
|
||||
|
||||
boolean group = !(holder instanceof User);
|
||||
String command = NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false)
|
||||
.replace("/luckperms", "/" + label);
|
||||
String command = "/" + label + " " + NodeFactory.nodeAsCommand(node, group ? holder.getObjectName() : holder.getFriendlyName(), group, false);
|
||||
|
||||
return component -> {
|
||||
component.hoverEvent(hoverEvent);
|
||||
|
@ -197,8 +197,7 @@ public class GroupListMembers extends SubCommand<Group> {
|
||||
"&7Click to remove this parent from " + holderName
|
||||
), Constants.FORMAT_CHAR));
|
||||
|
||||
String command = NodeFactory.nodeAsCommand(perm.asNode(), holderName, group, false)
|
||||
.replace("/luckperms", "/" + label);
|
||||
String command = "/" + label + " " + NodeFactory.nodeAsCommand(perm.asNode(), holderName, group, false);
|
||||
|
||||
return component -> {
|
||||
component.hoverEvent(hoverEvent);
|
||||
|
@ -196,8 +196,7 @@ public class SearchCommand extends SingleCommand {
|
||||
"&7Click to remove this node from " + holderName
|
||||
), Constants.FORMAT_CHAR));
|
||||
|
||||
String command = NodeFactory.nodeAsCommand(perm.asNode(), holderName, group, false)
|
||||
.replace("/luckperms", "/" + label);
|
||||
String command = "/" + label + " " + NodeFactory.nodeAsCommand(perm.asNode(), holderName, group, false);
|
||||
|
||||
return component -> {
|
||||
component.hoverEvent(hoverEvent);
|
||||
|
@ -137,7 +137,7 @@ public class NodeFactory {
|
||||
|
||||
public static String nodeAsCommand(Node node, String id, boolean group, boolean set) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("/luckperms ").append(group ? "group " : "user ").append(id).append(" ");
|
||||
sb.append(group ? "group " : "user ").append(id).append(" ");
|
||||
|
||||
if (node.isGroupNode()) {
|
||||
sb.append(node.isTemporary() ? (set ? "parent addtemp " : "parent removetemp ") : (set ? "parent add " : "parent remove "));
|
||||
|
Loading…
Reference in New Issue
Block a user