mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Refactor the log creation process
This commit is contained in:
parent
94a4051d29
commit
357717886e
@ -30,6 +30,7 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonPrimitive;
|
import com.google.gson.JsonPrimitive;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.LogEntry;
|
import me.lucko.luckperms.api.LogEntry;
|
||||||
|
import me.lucko.luckperms.api.context.ContextSet;
|
||||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||||
import me.lucko.luckperms.common.model.Group;
|
import me.lucko.luckperms.common.model.Group;
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
@ -38,8 +39,11 @@ import me.lucko.luckperms.common.model.User;
|
|||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.utils.DateUtil;
|
import me.lucko.luckperms.common.utils.DateUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extended version of {@link LogEntry}, with helper methods for
|
* An extended version of {@link LogEntry}, with helper methods for
|
||||||
@ -127,6 +131,37 @@ public class ExtendedLogEntry extends LogEntry {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExtendedLogEntryBuilder action(Object... args) {
|
||||||
|
List<String> parts = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Object o : args) {
|
||||||
|
|
||||||
|
// special formatting for ContextSets instead of just #toString
|
||||||
|
if (o instanceof ContextSet) {
|
||||||
|
ContextSet set = (ContextSet) o;
|
||||||
|
|
||||||
|
for (String value : set.getValues("server")) {
|
||||||
|
parts.add("server=" + value);
|
||||||
|
}
|
||||||
|
for (String value : set.getValues("world")) {
|
||||||
|
parts.add("world=" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<String, String> context : set.toSet()) {
|
||||||
|
if (context.getKey().equals("server") || context.getKey().equals("world")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
parts.add(context.getKey() + "=" + context.getValue());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parts.add(String.valueOf(o));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.action(parts.stream().collect(Collectors.joining(" ")));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExtendedLogEntry build() {
|
public ExtendedLogEntry build() {
|
||||||
if (getTimestamp() == 0L) {
|
if (getTimestamp() == 0L) {
|
||||||
|
@ -51,7 +51,6 @@ import net.kyori.text.TextComponent;
|
|||||||
import net.kyori.text.event.HoverEvent;
|
import net.kyori.text.event.HoverEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaAddChatMeta extends SharedSubCommand {
|
public class MetaAddChatMeta extends SharedSubCommand {
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
@ -94,7 +93,7 @@ public class MetaAddChatMeta extends SharedSubCommand {
|
|||||||
sender.sendMessage(builder.build());
|
sender.sendMessage(builder.build());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta add" + type.name().toLowerCase() + " " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta" , "add" + type.name().toLowerCase(), priority, meta, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -56,7 +56,6 @@ import net.kyori.text.event.HoverEvent;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaAddTempChatMeta extends SharedSubCommand {
|
public class MetaAddTempChatMeta extends SharedSubCommand {
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
@ -104,7 +103,7 @@ public class MetaAddTempChatMeta extends SharedSubCommand {
|
|||||||
sender.sendMessage(builder.build());
|
sender.sendMessage(builder.build());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta addtemp" + type.name().toLowerCase() + " " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta" , "addtemp" + type.name().toLowerCase(), priority, meta, duration, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -44,7 +44,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaClear extends SharedSubCommand {
|
public class MetaClear extends SharedSubCommand {
|
||||||
public MetaClear(LocaleManager locale) {
|
public MetaClear(LocaleManager locale) {
|
||||||
@ -109,7 +108,7 @@ public class MetaClear extends SharedSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta clear " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta", "clear", context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -51,7 +51,6 @@ import net.kyori.text.TextComponent;
|
|||||||
import net.kyori.text.event.HoverEvent;
|
import net.kyori.text.event.HoverEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaRemoveChatMeta extends SharedSubCommand {
|
public class MetaRemoveChatMeta extends SharedSubCommand {
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
@ -92,6 +91,11 @@ public class MetaRemoveChatMeta extends SharedSubCommand {
|
|||||||
n.getFullContexts().makeImmutable().equals(context.makeImmutable())
|
n.getFullContexts().makeImmutable().equals(context.makeImmutable())
|
||||||
);
|
);
|
||||||
Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), type.name().toLowerCase(), priority, Util.contextSetToString(context));
|
Message.BULK_REMOVE_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), type.name().toLowerCase(), priority, Util.contextSetToString(context));
|
||||||
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
|
.action("meta" , "remove" + type.name().toLowerCase(), priority, "*", context)
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
@ -108,7 +112,7 @@ public class MetaRemoveChatMeta extends SharedSubCommand {
|
|||||||
sender.sendMessage(builder.build());
|
sender.sendMessage(builder.build());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta remove" + type.name().toLowerCase() + " " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta" , "remove" + type.name().toLowerCase(), priority, meta, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -51,7 +51,6 @@ import net.kyori.text.TextComponent;
|
|||||||
import net.kyori.text.event.HoverEvent;
|
import net.kyori.text.event.HoverEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaRemoveTempChatMeta extends SharedSubCommand {
|
public class MetaRemoveTempChatMeta extends SharedSubCommand {
|
||||||
private final ChatMetaType type;
|
private final ChatMetaType type;
|
||||||
@ -92,6 +91,11 @@ public class MetaRemoveTempChatMeta extends SharedSubCommand {
|
|||||||
n.getFullContexts().makeImmutable().equals(context.makeImmutable())
|
n.getFullContexts().makeImmutable().equals(context.makeImmutable())
|
||||||
);
|
);
|
||||||
Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), type.name().toLowerCase(), priority, Util.contextSetToString(context));
|
Message.BULK_REMOVE_TEMP_CHATMETA_SUCCESS.send(sender, holder.getFriendlyName(), type.name().toLowerCase(), priority, Util.contextSetToString(context));
|
||||||
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
|
.action("meta" , "removetemp" + type.name().toLowerCase(), priority, "*", context)
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
@ -108,7 +112,7 @@ public class MetaRemoveTempChatMeta extends SharedSubCommand {
|
|||||||
sender.sendMessage(builder.build());
|
sender.sendMessage(builder.build());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta removetemp" + type.name().toLowerCase() + " " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta" , "removetemp" + type.name().toLowerCase(), priority, meta, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -49,7 +49,6 @@ import net.kyori.text.TextComponent;
|
|||||||
import net.kyori.text.event.HoverEvent;
|
import net.kyori.text.event.HoverEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaSet extends SharedSubCommand {
|
public class MetaSet extends SharedSubCommand {
|
||||||
public MetaSet(LocaleManager locale) {
|
public MetaSet(LocaleManager locale) {
|
||||||
@ -96,7 +95,7 @@ public class MetaSet extends SharedSubCommand {
|
|||||||
sender.sendMessage(builder.build());
|
sender.sendMessage(builder.build());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta set " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta", "set", key, value, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -53,7 +53,6 @@ import net.kyori.text.TextComponent;
|
|||||||
import net.kyori.text.event.HoverEvent;
|
import net.kyori.text.event.HoverEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaSetTemp extends SharedSubCommand {
|
public class MetaSetTemp extends SharedSubCommand {
|
||||||
public MetaSetTemp(LocaleManager locale) {
|
public MetaSetTemp(LocaleManager locale) {
|
||||||
@ -102,7 +101,7 @@ public class MetaSetTemp extends SharedSubCommand {
|
|||||||
sender.sendMessage(builder.build());
|
sender.sendMessage(builder.build());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta settemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta", "settemp", key, value, duration, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -43,7 +43,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaUnset extends SharedSubCommand {
|
public class MetaUnset extends SharedSubCommand {
|
||||||
public MetaUnset(LocaleManager locale) {
|
public MetaUnset(LocaleManager locale) {
|
||||||
@ -74,7 +73,7 @@ public class MetaUnset extends SharedSubCommand {
|
|||||||
Message.UNSET_META_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
Message.UNSET_META_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta unset " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta", "unset", key, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -43,7 +43,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MetaUnsetTemp extends SharedSubCommand {
|
public class MetaUnsetTemp extends SharedSubCommand {
|
||||||
public MetaUnsetTemp(LocaleManager locale) {
|
public MetaUnsetTemp(LocaleManager locale) {
|
||||||
@ -74,7 +73,7 @@ public class MetaUnsetTemp extends SharedSubCommand {
|
|||||||
Message.UNSET_META_TEMP_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
Message.UNSET_META_TEMP_SUCCESS.send(sender, key, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("meta unsettemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("meta", "unsettemp", key, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -30,6 +30,7 @@ import me.lucko.luckperms.common.actionlog.ExtendedLogEntry;
|
|||||||
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
||||||
import me.lucko.luckperms.common.commands.CommandException;
|
import me.lucko.luckperms.common.commands.CommandException;
|
||||||
import me.lucko.luckperms.common.commands.CommandResult;
|
import me.lucko.luckperms.common.commands.CommandResult;
|
||||||
|
import me.lucko.luckperms.common.commands.abstraction.SharedSubCommand;
|
||||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||||
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
import me.lucko.luckperms.common.commands.utils.ArgumentUtils;
|
||||||
@ -38,14 +39,11 @@ import me.lucko.luckperms.common.constants.CommandPermission;
|
|||||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||||
import me.lucko.luckperms.common.locale.Message;
|
import me.lucko.luckperms.common.locale.Message;
|
||||||
import me.lucko.luckperms.common.model.Group;
|
|
||||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
import me.lucko.luckperms.common.model.User;
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class HolderClear<T extends PermissionHolder> extends SubCommand<T> {
|
public class HolderClear<T extends PermissionHolder> extends SubCommand<T> {
|
||||||
public HolderClear(LocaleManager locale, boolean user) {
|
public HolderClear(LocaleManager locale, boolean user) {
|
||||||
@ -82,15 +80,10 @@ public class HolderClear<T extends PermissionHolder> extends SubCommand<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("clear " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("clear", context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
if (holder instanceof User) {
|
SharedSubCommand.save(holder, sender, plugin);
|
||||||
save((User) holder, sender, plugin);
|
|
||||||
} else if (holder instanceof Group) {
|
|
||||||
save((Group) holder, sender, plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ public class ParentAdd extends SharedSubCommand {
|
|||||||
Message.SET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), Util.contextSetToString(context));
|
Message.SET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent add " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "add", group.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -51,7 +51,6 @@ import me.lucko.luckperms.common.utils.Predicates;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ public class ParentAddTemp extends SharedSubCommand {
|
|||||||
Message.SET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), DateUtil.formatDateDiff(duration), Util.contextSetToString(context));
|
Message.SET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), DateUtil.formatDateDiff(duration), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent addtemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "addtemp", group.getName(), duration, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -43,7 +43,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class ParentClear extends SharedSubCommand {
|
public class ParentClear extends SharedSubCommand {
|
||||||
public ParentClear(LocaleManager locale) {
|
public ParentClear(LocaleManager locale) {
|
||||||
@ -80,7 +79,7 @@ public class ParentClear extends SharedSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent clear " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "clear", context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -46,7 +46,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete;
|
||||||
|
|
||||||
@ -117,7 +116,7 @@ public class ParentClearTrack extends SharedSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent cleartrack " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "cleartrack", track.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -47,7 +47,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ public class ParentRemove extends SharedSubCommand {
|
|||||||
Message.UNSET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, Util.contextSetToString(context));
|
Message.UNSET_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent remove " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "remove", groupName, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
if (holder instanceof User) {
|
if (holder instanceof User) {
|
||||||
|
@ -45,7 +45,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ public class ParentRemoveTemp extends SharedSubCommand {
|
|||||||
Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, Util.contextSetToString(context));
|
Message.UNSET_TEMP_INHERIT_SUCCESS.send(sender, holder.getFriendlyName(), groupName, Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent removetemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "removetemp", groupName, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -45,7 +45,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||||
|
|
||||||
@ -94,7 +93,7 @@ public class ParentSet extends SharedSubCommand {
|
|||||||
Message.SET_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), Util.contextSetToString(context));
|
Message.SET_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), group.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent set " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "set", group.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -46,7 +46,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete;
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete;
|
||||||
@ -131,7 +130,7 @@ public class ParentSetTrack extends SharedSubCommand {
|
|||||||
Message.SET_TRACK_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), track.getName(), group.getFriendlyName(), Util.contextSetToString(context));
|
Message.SET_TRACK_PARENT_SUCCESS.send(sender, holder.getFriendlyName(), track.getName(), group.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("parent settrack " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("parent", "settrack", track.getName(), groupName, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -45,7 +45,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getBoolTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getBoolTabComplete;
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||||
@ -82,7 +81,7 @@ public class PermissionSet extends SharedSubCommand {
|
|||||||
Message.SETPERMISSION_SUCCESS.send(sender, node, b, holder.getFriendlyName(), Util.contextSetToString(context));
|
Message.SETPERMISSION_SUCCESS.send(sender, node, b, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("permission set " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("permission", "set", node, b, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -50,7 +50,6 @@ import me.lucko.luckperms.common.utils.Predicates;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getBoolTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getBoolTabComplete;
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||||
@ -90,7 +89,7 @@ public class PermissionSetTemp extends SharedSubCommand {
|
|||||||
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, b, holder.getFriendlyName(), DateUtil.formatDateDiff(duration), Util.contextSetToString(context));
|
Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, b, holder.getFriendlyName(), DateUtil.formatDateDiff(duration), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("permission settemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("permission", "settemp", node, b, duration, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -45,7 +45,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ public class PermissionUnset extends SharedSubCommand {
|
|||||||
Message.UNSETPERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), Util.contextSetToString(context));
|
Message.UNSETPERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("permission unset " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("permission", "unset", node, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -45,7 +45,6 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
|||||||
import me.lucko.luckperms.common.utils.Predicates;
|
import me.lucko.luckperms.common.utils.Predicates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete;
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ public class PermissionUnsetTemp extends SharedSubCommand {
|
|||||||
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), Util.contextSetToString(context));
|
Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, holder.getFriendlyName(), Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(holder)
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
.action("permission unsettemp " + args.stream().map(ArgumentUtils.WRAPPER).collect(Collectors.joining(" ")))
|
.action("permission", "unsettemp", node, context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(holder, sender, plugin);
|
save(holder, sender, plugin);
|
||||||
|
@ -70,7 +70,11 @@ public class CreateGroup extends SingleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message.CREATE_SUCCESS.send(sender, groupName);
|
Message.CREATE_SUCCESS.send(sender, groupName);
|
||||||
ExtendedLogEntry.build().actor(sender).actedName(groupName).entryType(LogEntry.Type.GROUP).action("create").build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).actedName(groupName).entryType(LogEntry.Type.GROUP)
|
||||||
|
.action("create")
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,11 @@ public class DeleteGroup extends SingleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message.DELETE_SUCCESS.send(sender, group.getFriendlyName());
|
Message.DELETE_SUCCESS.send(sender, group.getFriendlyName());
|
||||||
ExtendedLogEntry.build().actor(sender).actedName(groupName).entryType(LogEntry.Type.GROUP).action("delete").build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).actedName(groupName).entryType(LogEntry.Type.GROUP)
|
||||||
|
.action("delete")
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
plugin.getUpdateTaskBuffer().request();
|
plugin.getUpdateTaskBuffer().request();
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,11 @@ public class GroupClone extends SubCommand<Group> {
|
|||||||
newGroup.replaceEnduringNodes(group.getEnduringNodes());
|
newGroup.replaceEnduringNodes(group.getEnduringNodes());
|
||||||
|
|
||||||
Message.CLONE_SUCCESS.send(sender, group.getName(), newGroup.getName());
|
Message.CLONE_SUCCESS.send(sender, group.getName(), newGroup.getName());
|
||||||
ExtendedLogEntry.build().actor(sender).acted(group).action("clone " + newGroup.getName()).build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(group)
|
||||||
|
.action("clone", newGroup.getName())
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(newGroup, sender, plugin);
|
save(newGroup, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,11 @@ public class GroupRename extends SubCommand<Group> {
|
|||||||
newGroup.replaceEnduringNodes(group.getEnduringNodes());
|
newGroup.replaceEnduringNodes(group.getEnduringNodes());
|
||||||
|
|
||||||
Message.RENAME_SUCCESS.send(sender, group.getName(), newGroup.getName());
|
Message.RENAME_SUCCESS.send(sender, group.getName(), newGroup.getName());
|
||||||
ExtendedLogEntry.build().actor(sender).acted(group).action("rename " + newGroup.getName()).build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(group)
|
||||||
|
.action("rename", newGroup.getName())
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(newGroup, sender, plugin);
|
save(newGroup, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.commands.impl.group;
|
package me.lucko.luckperms.common.commands.impl.group;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.common.actionlog.ExtendedLogEntry;
|
||||||
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
||||||
import me.lucko.luckperms.common.commands.CommandException;
|
import me.lucko.luckperms.common.commands.CommandException;
|
||||||
import me.lucko.luckperms.common.commands.CommandResult;
|
import me.lucko.luckperms.common.commands.CommandResult;
|
||||||
@ -76,15 +77,25 @@ public class GroupSetDisplayName extends SubCommand<Group> {
|
|||||||
group.removeIf(n -> n.getPermission().startsWith("displayname."));
|
group.removeIf(n -> n.getPermission().startsWith("displayname."));
|
||||||
|
|
||||||
if (name.equals(group.getName())) {
|
if (name.equals(group.getName())) {
|
||||||
save(group, sender, plugin);
|
|
||||||
Message.GROUP_SET_DISPLAY_NAME_REMOVED.send(sender, group.getName());
|
Message.GROUP_SET_DISPLAY_NAME_REMOVED.send(sender, group.getName());
|
||||||
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(group)
|
||||||
|
.action("setdisplayname", name)
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
|
save(group, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
group.setPermission(NodeFactory.newBuilder("displayname." + name).build());
|
group.setPermission(NodeFactory.newBuilder("displayname." + name).build());
|
||||||
|
|
||||||
save(group, sender, plugin);
|
|
||||||
Message.GROUP_SET_DISPLAY_NAME.send(sender, name, group.getName());
|
Message.GROUP_SET_DISPLAY_NAME.send(sender, name, group.getName());
|
||||||
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(group)
|
||||||
|
.action("setdisplayname", name)
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
|
save(group, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package me.lucko.luckperms.common.commands.impl.group;
|
package me.lucko.luckperms.common.commands.impl.group;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.common.actionlog.ExtendedLogEntry;
|
||||||
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
||||||
import me.lucko.luckperms.common.commands.CommandException;
|
import me.lucko.luckperms.common.commands.CommandException;
|
||||||
import me.lucko.luckperms.common.commands.CommandResult;
|
import me.lucko.luckperms.common.commands.CommandResult;
|
||||||
@ -59,8 +60,13 @@ public class GroupSetWeight extends SubCommand<Group> {
|
|||||||
group.removeIf(n -> n.getPermission().startsWith("weight."));
|
group.removeIf(n -> n.getPermission().startsWith("weight."));
|
||||||
group.setPermission(NodeFactory.newBuilder("weight." + weight).build());
|
group.setPermission(NodeFactory.newBuilder("weight." + weight).build());
|
||||||
|
|
||||||
save(group, sender, plugin);
|
|
||||||
Message.GROUP_SET_WEIGHT.send(sender, weight, group.getFriendlyName());
|
Message.GROUP_SET_WEIGHT.send(sender, weight, group.getFriendlyName());
|
||||||
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(group)
|
||||||
|
.action("setweight", weight)
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
|
save(group, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||||
|
import me.lucko.luckperms.common.actionlog.ExtendedLogEntry;
|
||||||
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
import me.lucko.luckperms.common.commands.ArgumentPermissions;
|
||||||
import me.lucko.luckperms.common.commands.CommandException;
|
import me.lucko.luckperms.common.commands.CommandException;
|
||||||
import me.lucko.luckperms.common.commands.CommandResult;
|
import me.lucko.luckperms.common.commands.CommandResult;
|
||||||
@ -141,6 +142,10 @@ public class ApplyEditsCommand extends SingleCommand {
|
|||||||
return CommandResult.NO_PERMISSION;
|
return CommandResult.NO_PERMISSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(holder)
|
||||||
|
.action("applyedits", part1 + "/" + part2)
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
Set<NodeModel> nodes = deserializePermissions(data.getAsJsonArray("nodes"));
|
Set<NodeModel> nodes = deserializePermissions(data.getAsJsonArray("nodes"));
|
||||||
holder.setEnduringNodes(nodes.stream().map(NodeModel::toNode).collect(Collectors.toSet()));
|
holder.setEnduringNodes(nodes.stream().map(NodeModel::toNode).collect(Collectors.toSet()));
|
||||||
Message.APPLY_EDITS_SUCCESS.send(sender, nodes.size(), holder.getFriendlyName());
|
Message.APPLY_EDITS_SUCCESS.send(sender, nodes.size(), holder.getFriendlyName());
|
||||||
|
@ -70,7 +70,11 @@ public class CreateTrack extends SingleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message.CREATE_SUCCESS.send(sender, trackName);
|
Message.CREATE_SUCCESS.send(sender, trackName);
|
||||||
ExtendedLogEntry.build().actor(sender).actedName(trackName).entryType(LogEntry.Type.TRACK).action("create").build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).actedName(trackName).entryType(LogEntry.Type.TRACK)
|
||||||
|
.action("create").build()
|
||||||
|
.submit(plugin, sender);
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,11 @@ public class DeleteTrack extends SingleCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message.DELETE_SUCCESS.send(sender, trackName);
|
Message.DELETE_SUCCESS.send(sender, trackName);
|
||||||
ExtendedLogEntry.build().actor(sender).actedName(trackName).entryType(LogEntry.Type.TRACK).action("delete").build().submit(plugin, sender);
|
|
||||||
plugin.getUpdateTaskBuffer().request();
|
ExtendedLogEntry.build().actor(sender).actedName(trackName).entryType(LogEntry.Type.TRACK)
|
||||||
|
.action("delete")
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,9 +75,11 @@ public class TrackAppend extends SubCommand<Track> {
|
|||||||
if (track.getGroups().size() > 1) {
|
if (track.getGroups().size() > 1) {
|
||||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName()));
|
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track)
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
.action("append " + group.getName())
|
.action("append", group.getName())
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(track, sender, plugin);
|
save(track, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,7 +49,11 @@ public class TrackClear extends SubCommand<Track> {
|
|||||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) throws CommandException {
|
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track track, List<String> args, String label) throws CommandException {
|
||||||
track.clearGroups();
|
track.clearGroups();
|
||||||
Message.TRACK_CLEAR.send(sender, track.getName());
|
Message.TRACK_CLEAR.send(sender, track.getName());
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track).action("clear").build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
|
.action("clear")
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(track, sender, plugin);
|
save(track, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,11 @@ public class TrackClone extends SubCommand<Track> {
|
|||||||
newTrack.setGroups(track.getGroups());
|
newTrack.setGroups(track.getGroups());
|
||||||
|
|
||||||
Message.CLONE_SUCCESS.send(sender, track.getName(), newTrack.getName());
|
Message.CLONE_SUCCESS.send(sender, track.getName(), newTrack.getName());
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track).action("clone " + newTrack.getName()).build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
|
.action("clone", newTrack.getName())
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(newTrack, sender, plugin);
|
save(newTrack, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,11 @@ public class TrackInsert extends SubCommand<Track> {
|
|||||||
if (track.getGroups().size() > 1) {
|
if (track.getGroups().size() > 1) {
|
||||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName()));
|
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track)
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
.action("insert " + group.getName() + " " + pos)
|
.action("insert", group.getName(), pos)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(track, sender, plugin);
|
save(track, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,9 +63,11 @@ public class TrackRemove extends SubCommand<Track> {
|
|||||||
if (track.getGroups().size() > 1) {
|
if (track.getGroups().size() > 1) {
|
||||||
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups()));
|
Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track)
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
.action("remove " + groupName)
|
.action("remove", groupName)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(track, sender, plugin);
|
save(track, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
@ -80,7 +80,11 @@ public class TrackRename extends SubCommand<Track> {
|
|||||||
newTrack.setGroups(track.getGroups());
|
newTrack.setGroups(track.getGroups());
|
||||||
|
|
||||||
Message.RENAME_SUCCESS.send(sender, track.getName(), newTrack.getName());
|
Message.RENAME_SUCCESS.send(sender, track.getName(), newTrack.getName());
|
||||||
ExtendedLogEntry.build().actor(sender).acted(track).action("rename " + newTrack.getName()).build().submit(plugin, sender);
|
|
||||||
|
ExtendedLogEntry.build().actor(sender).acted(track)
|
||||||
|
.action("rename", newTrack.getName())
|
||||||
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(newTrack, sender, plugin);
|
save(newTrack, sender, plugin);
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ public class UserDemote extends SubCommand<User> {
|
|||||||
Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), user.getFriendlyName(), old);
|
Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), user.getFriendlyName(), old);
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
.action("demote " + args.stream().collect(Collectors.joining(" ")))
|
.action("demote", track.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(user, sender, plugin);
|
save(user, sender, plugin);
|
||||||
@ -166,7 +166,7 @@ public class UserDemote extends SubCommand<User> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
.action("demote " + args.stream().collect(Collectors.joining(" ")))
|
.action("demote", track.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(user, sender, plugin);
|
save(user, sender, plugin);
|
||||||
|
@ -119,8 +119,9 @@ public class UserPromote extends SubCommand<User> {
|
|||||||
user.setPermission(NodeFactory.newBuilder("group." + first).withExtraContext(context).build());
|
user.setPermission(NodeFactory.newBuilder("group." + first).withExtraContext(context).build());
|
||||||
|
|
||||||
Message.USER_TRACK_ADDED_TO_FIRST.send(sender, user.getFriendlyName(), first, Util.contextSetToString(context));
|
Message.USER_TRACK_ADDED_TO_FIRST.send(sender, user.getFriendlyName(), first, Util.contextSetToString(context));
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
.action("promote " + args.stream().collect(Collectors.joining(" ")))
|
.action("promote", track.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(user, sender, plugin);
|
save(user, sender, plugin);
|
||||||
@ -177,7 +178,7 @@ public class UserPromote extends SubCommand<User> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
.action("promote " + args.stream().collect(Collectors.joining(" ")))
|
.action("promote", track.getName(), context)
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(user, sender, plugin);
|
save(user, sender, plugin);
|
||||||
|
@ -79,8 +79,9 @@ public class UserSwitchPrimaryGroup extends SubCommand<User> {
|
|||||||
|
|
||||||
user.getPrimaryGroup().setStoredValue(group.getName());
|
user.getPrimaryGroup().setStoredValue(group.getName());
|
||||||
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getFriendlyName(), group.getFriendlyName());
|
Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getFriendlyName(), group.getFriendlyName());
|
||||||
|
|
||||||
ExtendedLogEntry.build().actor(sender).acted(user)
|
ExtendedLogEntry.build().actor(sender).acted(user)
|
||||||
.action("setprimarygroup " + group.getName())
|
.action("setprimarygroup", group.getName())
|
||||||
.build().submit(plugin, sender);
|
.build().submit(plugin, sender);
|
||||||
|
|
||||||
save(user, sender, plugin);
|
save(user, sender, plugin);
|
||||||
|
@ -199,6 +199,7 @@ public class SqlDao extends AbstractDao {
|
|||||||
try (Connection connection = provider.getConnection()) {
|
try (Connection connection = provider.getConnection()) {
|
||||||
try (Statement s = connection.createStatement()) {
|
try (Statement s = connection.createStatement()) {
|
||||||
s.execute(prefix.apply("ALTER TABLE {prefix}actions MODIFY COLUMN actor_name VARCHAR(36)"));
|
s.execute(prefix.apply("ALTER TABLE {prefix}actions MODIFY COLUMN actor_name VARCHAR(36)"));
|
||||||
|
s.execute(prefix.apply("ALTER TABLE {prefix}actions MODIFY COLUMN action VARCHAR(300)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ CREATE TABLE `{prefix}actions` (
|
|||||||
`type` CHAR(1) NOT NULL,
|
`type` CHAR(1) NOT NULL,
|
||||||
`acted_uuid` VARCHAR(36) NOT NULL,
|
`acted_uuid` VARCHAR(36) NOT NULL,
|
||||||
`acted_name` VARCHAR(36) NOT NULL,
|
`acted_name` VARCHAR(36) NOT NULL,
|
||||||
`action` VARCHAR(256) NOT NULL,
|
`action` VARCHAR(300) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ CREATE TABLE `{prefix}actions` (
|
|||||||
`type` CHAR(1) NOT NULL,
|
`type` CHAR(1) NOT NULL,
|
||||||
`acted_uuid` VARCHAR(36) NOT NULL,
|
`acted_uuid` VARCHAR(36) NOT NULL,
|
||||||
`acted_name` VARCHAR(36) NOT NULL,
|
`acted_name` VARCHAR(36) NOT NULL,
|
||||||
`action` VARCHAR(256) NOT NULL,
|
`action` VARCHAR(300) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) DEFAULT CHARSET = utf8;
|
) DEFAULT CHARSET = utf8;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ CREATE TABLE `{prefix}actions` (
|
|||||||
`type` CHAR(1) NOT NULL,
|
`type` CHAR(1) NOT NULL,
|
||||||
`acted_uuid` VARCHAR(36) NOT NULL,
|
`acted_uuid` VARCHAR(36) NOT NULL,
|
||||||
`acted_name` VARCHAR(36) NOT NULL,
|
`acted_name` VARCHAR(36) NOT NULL,
|
||||||
`action` VARCHAR(256) NOT NULL,
|
`action` VARCHAR(300) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) DEFAULT CHARSET = utf8;
|
) DEFAULT CHARSET = utf8;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ CREATE TABLE "{prefix}actions" (
|
|||||||
"type" CHAR(1) NOT NULL,
|
"type" CHAR(1) NOT NULL,
|
||||||
"acted_uuid" VARCHAR(36) NOT NULL,
|
"acted_uuid" VARCHAR(36) NOT NULL,
|
||||||
"acted_name" VARCHAR(36) NOT NULL,
|
"acted_name" VARCHAR(36) NOT NULL,
|
||||||
"action" VARCHAR(256) NOT NULL
|
"action" VARCHAR(300) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE "{prefix}tracks" (
|
CREATE TABLE "{prefix}tracks" (
|
||||||
|
@ -47,7 +47,7 @@ CREATE TABLE `{prefix}actions` (
|
|||||||
`type` CHAR(1) NOT NULL,
|
`type` CHAR(1) NOT NULL,
|
||||||
`acted_uuid` VARCHAR(36) NOT NULL,
|
`acted_uuid` VARCHAR(36) NOT NULL,
|
||||||
`acted_name` VARCHAR(36) NOT NULL,
|
`acted_name` VARCHAR(36) NOT NULL,
|
||||||
`action` VARCHAR(256) NOT NULL
|
`action` VARCHAR(300) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `{prefix}tracks` (
|
CREATE TABLE `{prefix}tracks` (
|
||||||
|
Loading…
Reference in New Issue
Block a user