Export using the /lp alias

This commit is contained in:
Luck 2017-10-12 18:47:35 +01:00
parent 6dec1ba8af
commit de4c6b384c
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
8 changed files with 17 additions and 25 deletions

View File

@ -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);

View File

@ -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<>();
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 "));