mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Make the clone commands work for existing tracks/groups too
This commit is contained in:
parent
91626f079d
commit
281060a972
@ -41,7 +41,7 @@ import java.util.List;
|
||||
public class GroupClone extends SubCommand<Group> {
|
||||
public GroupClone() {
|
||||
super("clone", "Clone the group", Permission.GROUP_CLONE, Predicates.not(1),
|
||||
Arg.list(Arg.create("name", true, "the name of the clone"))
|
||||
Arg.list(Arg.create("name", true, "the name of the group to clone onto"))
|
||||
);
|
||||
}
|
||||
|
||||
@ -53,15 +53,7 @@ public class GroupClone extends SubCommand<Group> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (plugin.getStorage().loadGroup(newGroupName).join()) {
|
||||
Message.GROUP_ALREADY_EXISTS.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (!plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).join()) {
|
||||
Message.CREATE_GROUP_ERROR.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).join();
|
||||
|
||||
Group newGroup = plugin.getGroupManager().getIfLoaded(newGroupName);
|
||||
if (newGroup == null) {
|
||||
|
@ -41,7 +41,7 @@ import java.util.List;
|
||||
public class TrackClone extends SubCommand<Track> {
|
||||
public TrackClone() {
|
||||
super("clone", "Clone the track", Permission.TRACK_CLONE, Predicates.not(1),
|
||||
Arg.list(Arg.create("name", true, "the name of the clone"))
|
||||
Arg.list(Arg.create("name", true, "the name of the track to clone onto"))
|
||||
);
|
||||
}
|
||||
|
||||
@ -53,15 +53,7 @@ public class TrackClone extends SubCommand<Track> {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (plugin.getStorage().loadTrack(newTrackName).join()) {
|
||||
Message.TRACK_ALREADY_EXISTS.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (!plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.INTERNAL).join()) {
|
||||
Message.CREATE_TRACK_ERROR.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.INTERNAL).join();
|
||||
|
||||
Track newTrack = plugin.getTrackManager().getIfLoaded(newTrackName);
|
||||
if (newTrack == null) {
|
||||
|
@ -122,7 +122,7 @@ public enum Message {
|
||||
CREATE_SUCCESS("&b{0}&a was successfully created.", true),
|
||||
DELETE_SUCCESS("&b{0}&a was successfully deleted.", true),
|
||||
RENAME_SUCCESS("&b{0}&a was successfully renamed to &b{1}&a.", true),
|
||||
CLONE_SUCCESS("&b{0}&a was successfully cloned to &b{1}&a.", true),
|
||||
CLONE_SUCCESS("&b{0}&a was successfully cloned onto &b{1}&a.", true),
|
||||
|
||||
ALREADY_INHERITS("{0} already inherits '{1}'.", true),
|
||||
DOES_NOT_INHERIT("{0} does not inherit '{1}'.", true),
|
||||
|
@ -76,7 +76,7 @@ check-result: "&aPermission check result on user &b{0}&a for permission &b{1}&a:
|
||||
create-success: "&b{0}&a was successfully created."
|
||||
delete-success: "&b{0}&a was successfully deleted."
|
||||
rename-success: "&b{0}&a was successfully renamed to &b{1}&a."
|
||||
clone-success: "&b{0}&a was successfully cloned to &b{1}&a."
|
||||
clone-success: "&b{0}&a was successfully cloned onto &b{1}&a."
|
||||
|
||||
already-inherits: "{0} already inherits '{1}'."
|
||||
does-not-inherit: "{0} does not inherit '{1}'."
|
||||
|
Loading…
Reference in New Issue
Block a user