From bbeed1e4ed3c0492754155605e28ed5b5c3da127 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 20 Aug 2016 17:49:23 +0100 Subject: [PATCH] A few small fixes --- README.md | 252 +----------------- .../luckperms/commands/SenderFactory.java | 21 +- .../luckperms/commands/group/CreateGroup.java | 2 +- .../luckperms/commands/group/DeleteGroup.java | 2 +- .../group/subcommands/GroupClear.java | 2 +- .../group/subcommands/GroupSetInherit.java | 6 +- .../group/subcommands/GroupSetPermission.java | 6 +- .../subcommands/GroupSetTempInherit.java | 6 +- .../subcommands/GroupSetTempPermission.java | 6 +- .../subcommands/GroupUnSetPermission.java | 6 +- .../group/subcommands/GroupUnsetInherit.java | 6 +- .../subcommands/GroupUnsetTempInherit.java | 6 +- .../subcommands/GroupUnsetTempPermission.java | 6 +- .../log/subcommands/LogGroupHistory.java | 2 +- .../log/subcommands/LogTrackHistory.java | 2 +- .../luckperms/commands/track/CreateTrack.java | 2 +- .../luckperms/commands/track/DeleteTrack.java | 2 +- .../track/subcommands/TrackAppend.java | 6 +- .../track/subcommands/TrackClear.java | 2 +- .../track/subcommands/TrackInsert.java | 6 +- .../track/subcommands/TrackRemove.java | 6 +- .../user/subcommands/UserAddGroup.java | 6 +- .../user/subcommands/UserAddTempGroup.java | 6 +- .../commands/user/subcommands/UserClear.java | 2 +- .../commands/user/subcommands/UserDemote.java | 2 +- .../user/subcommands/UserPromote.java | 2 +- .../user/subcommands/UserRemoveGroup.java | 6 +- .../user/subcommands/UserRemoveTempGroup.java | 6 +- .../user/subcommands/UserSetPermission.java | 6 +- .../user/subcommands/UserSetPrimaryGroup.java | 2 +- .../subcommands/UserSetTempPermission.java | 6 +- .../user/subcommands/UserUnSetPermission.java | 6 +- .../subcommands/UserUnsetTempPermission.java | 6 +- .../luckperms/core/PermissionHolder.java | 8 +- .../me/lucko/luckperms/data/LogEntry.java | 3 +- pom.xml | 18 ++ 36 files changed, 108 insertions(+), 332 deletions(-) diff --git a/README.md b/README.md index 63c63323a..64c7680c2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A permissions implementation for Bukkit/Spigot, BungeeCord and Sponge. ## Links * **Development Builds** - * **Javadocs** - +* **Wiki** - ## Why LuckPerms? _Features checked on 19th Aug 2016. If you find any inaccuracies, please do let me know. I tried to be as fair as possible, and copy all major features from the respective plugin pages._ @@ -37,256 +38,5 @@ _Features checked on 19th Aug 2016. If you find any inaccuracies, please do let * **Sponge compatible** - permissions, users and groups are synced across all LuckPerms instances (bukkit --> sponge, for example) * **Support for MySQL, MongoDB, SQLite, H2 & Flatfile (JSON)** - other storage methods coming soon (maybe) -## Setup -All configuration options are in the **config.yml/luckperms.conf** file, which is generated automagically when the plugin first starts. - -You can define the settings for per-server permissions, the storage method and credentials within this file. - -## Info -### Permission Calculation -#### Permissions are calculated based on a priority system as follows. - -* **Non wildcard/regex permissions will be overridden by normal permissions** - -Example: if a user has a true permission set for "luckperms.\*", and a false permission set for "luckperms.something", the non-wildcard permission will override the wildcard, and "luckperms.something" will be set to false, despite the wildcard. - -* **More specific wildcards override less specific ones** - -Example: if a user has "luckperms.\*" set to true, but "luckperms.user.\*" set to false, all of the user permissions will be set to false, despite the more generic wildcard for "luckperms.*". - -* **Temporary permissions will override non-temporary permissions.** - -Example: if a user has a false permission set for "test.node", and a temporary true permission set for "test.node", the temporary permission will override the permanent one, and the user will be granted the true node. - -* **World specific permissions will override generic permissions.** - -Example: if a user has a global "fly.use" permission, and then has a negated "fly.use" permission in the "world_nether" world, the world specific permission will override the globally defined one, and the user will be granted the negated node (provided they're in that world, of course.). - -* **Server specific permissions will override generic/global permissions.** - -Example: if a user has a global "fly.use" permission, and then has a negated "fly.use" permission on the "factions" server, the server specific permission will override the globally defined one, and the user will be granted the negated node (provided they're on that server). - -* **Inherited permissions will be overridden by an objects own permissions.** - -Example: A user is a member of the default group, which grants "some.thing.perm", but the users own permissions has "some.thing.perm" set to false. The inherited permission will be overridden by the users own permissions, and the user will be granted the negative node. - -### Temporary Permissions -Temporary permissions are audited once every 3 seconds, to check if they have expired. This check happens regardless of the sync interval setting. This means that you can safely set temporary permissions to expire after a matter of seconds, and they will be removed on-time. - -### Shorthand Permissions -LuckPerms has it's own system (although it's quite similar to PermissionsEx :P) that allows you to set permissions in a shorthand format. - -Using the LuckPerms permission nodes as an example, say for instance, you wanted to let a user set and unset permissions for both groups and users. - -Without shorthand, you would have to apply 4 nodes. -``` -luckperms.user.setpermission -luckperms.user.unsetpermission -luckperms.group.setpermission -luckperms.group.unsetpermission -``` -However, with shorthand, you can just apply the following node: - -`luckperms.(user|group).(setpermission|unsetpermission)` - -You use brackets to define part of a node as a shorthand group, and then use the vertical bar `|` to separate entries. - -There are some limitations, firstly, you cannot use shorthand in the first part of the node. (The "luckperms" part in the example above) - -Additionally, you cannot combine shorthand and normal text in the same part of the node. -For example, `luckperms.(user|group).(set|unset)permission` would not work. - -### Regex -LuckPerms has support for regex when defining permission nodes and server/world names. - -Whenever regex is used, it MUST be prefixed with "R=", so LuckPerms knows to treat it as regex, and not as a normal string. - -For example, if you wanted to give all members of the default group, the `essentials.fly` permission on all of your hub servers, where the hub server names are hub1, hub2, hub3, etc. -You would use the command `/perms group default set essentials.fly true R=hub\d+`. - -You can also use regex in permission nodes. -Once again using LuckPerms permissions as an example, if you wanted a user to be able to create both groups and tracks, you would normally just add the two permission nodes. However with regex, you can just add one. `luckperms\.create.*` Remember to escape any characters, specifically dots, as the entire node will be parsed. - -## API -LuckPerms has an extensive API, allowing for easy integration with other projects. To use the Api, you need to obtain an instance of the `LuckPermsApi` interface. This can be done in a number of ways. - -```java -// On all platforms (throws IllegalStateException if the API is not loaded) -final LuckPermsApi api = LuckPerms.getApi(); - -// Or with Optional -Optional provider = LuckPerms.getApiSafe(); -if (provider.isPresent()) { - final LuckPermsApi api = provider.get(); -} - -// On Bukkit/Spigot -ServicesManager manager = Bukkit.getServicesManager(); -if (manager.isProvidedFor(LuckPermsApi.class)) { - final LuckPermsApi api = manager.getRegistration(LuckPermsApi.class).getProvider(); -} - -// On Sponge -Optional provider = Sponge.getServiceManager().provide(LuckPermsApi.class); -if (provider.isPresent()) { - final LuckPermsApi api = provider.get(); -} -``` - -If you want to use LuckPerms in your onEnable method, you need to add the following to your plugins `plugin.yml`. -```yml -depend: [LuckPerms] -``` -All of the available methods can be seen in the various interfaces in the `luckperms-api` module. - -You can add LuckPerms as a Maven dependency by adding the following to your projects `pom.xml`. -````xml - - - luck-repo - https://repo.lucko.me/ - - - - - - me.lucko.luckperms - luckperms-api - 2.5 - - -```` - -### Events -LuckPerms exposes a full read/write API, as well as an event listening system. Due to the multi-platform nature of the project, an internal Event system is used, as opposed to the systems already in place on each platform. (the Bukkit Event api, for example). This means that simply registering your listener with the platform is not sufficient. - -All events are *fired asynchronously*. This means you should not interact with or call any non-thread safe methods from within listeners. - -To listen to an event, you need to first make a class that implements `LPListener`. Then within this class, you can define all of your listener methods. - -Each listener method must be annotated with `@Subscribe`. For example... - -```java -package me.lucko.test; - -import com.google.common.eventbus.Subscribe; -import me.lucko.luckperms.api.event.LPListener; -import me.lucko.luckperms.api.event.events.PermissionSetEvent; - -public class TestListener implements LPListener { - - @Subscribe - public void onPermissionSet(PermissionSetEvent event) { - - } - -} -``` - -You also need to register your new Listener with the API. -```java -@Override -public void onEnable() { - LuckPermsApi api; - api.registerListener(new TestListener()); -} -``` - -## Versioning -As of version 2.0, LuckPerms roughly follows the standards set out in Semantic Versioning. - -The only difference is that the patch number is not included anywhere within the pom, and is calculated each build, based upon how may commits have been made since the last tag. (A new tag is made every minor version) - -This means that API versions do not have a patch number (as no API changes are made in patches). API versions will be x.y, and each individual build of LuckPerms will follow x.y.z. - -## Commands -Command usage is printed to the console/chat whenever invalid arguments are provided. Simply typing /perms will list all commands a user has permission to use. - -### Aliases -| Bukkit | Bungee | -|------------------|------------------| -| /luckperms | /luckpermsbungee | -| /perms | /bperms | -| /permissions | /bpermissions | -| /lp | /lpb | -| /perm | /bperm | - -Arguments: \ [optional] - -Users with OP have access to all commands. - -Additionally, you can use wildcards to grant users access to a selection of commands. -* **All commands** - luckperms.* -* **All user commands** - luckperms.user.* -* **All group commands** - luckperms.group.* -* **All track commands** - luckperms.track.* -* **All log commands** - luckperms.log.* - -### General -* /perms - n/a -* /perms sync - luckperms.sync -* /perms info - luckperms.info -* /perms debug - luckperms.debug -* /perms import \ - luckperms.import -* /perms creategroup \ - luckperms.creategroup -* /perms deletegroup \ - luckperms.deletegroup -* /perms listgroups - luckperms.listgroups -* /perms createtrack \ - luckperms.createtrack -* /perms deletetrack \ - luckperms.deletetrack -* /perms listtracks - luckperms.listtracks - -### User -* /perms user \ info - luckperms.user.info -* /perms user \ getuuid - luckperms.user.getuuid -* /perms user \ listnodes - luckperms.user.listnodes -* /perms user \ haspermission \ [server] [world] - luckperms.user.haspermission -* /perms user \ inheritspermission \ [server] [world] - luckperms.user.inheritspermission -* /perms user \ set \ \ [server] [world] - luckperms.user.setpermission -* /perms user \ unset \ [server] [world] - luckperms.user.unsetpermission -* /perms user \ addgroup \ [server] [world] - luckperms.user.addgroup -* /perms user \ removegroup \ [server] [world] - luckperms.user.removegroup -* /perms user \ settemp \ \ \ [server] [world] - luckperms.user.settemppermission -* /perms user \ unsettemp \ [server] [world] - luckperms.user.unsettemppermission -* /perms user \ addtempgroup \ \ [server] [world] - luckperms.user.addtempgroup -* /perms user \ removetempgroup \ [server] [world] - luckperms.user.removetempgroup -* /perms user \ setprimarygroup \ - luckperms.user.setprimarygroup -* /perms user \ showtracks - luckperms.user.showtracks -* /perms user \ promote \ - luckperms.user.promote -* /perms user \ demote \ - luckperms.user.demote -* /perms user \ showpos \ - luckperms.user.showpos -* /perms user \ clear - luckperms.user.clear - -### Group -* /perms group \ info - luckperms.group.info -* /perms group \ listnodes - luckperms.group.listnodes -* /perms group \ haspermission \ [server] [world] - luckperms.group.haspermission -* /perms group \ inheritspermission \ [server] [world] - luckperms.group.inheritspermission -* /perms group \ set \ \ [server] [world] - luckperms.group.setpermission -* /perms group \ unset \ [server] [world] - luckperms.group.unsetpermission -* /perms group \ setinherit \ [server] [world] - luckperms.group.setinherit -* /perms group \ unsetinherit \ [server] [world] - luckperms.group.unsetinherit -* /perms group \ settemp \ \ \ [server] [world] - settemppermission -* /perms group \ unsettemp \ [server] [world] - luckperms.group.unsettemppermission -* /perms group \ settempinherit \ \ [server] [world] - luckperms.group.settempinherit -* /perms group \ unsettempinherit \ [server] [world] - luckperms.group.unsettempinherit -* /perms group \ showtracks - luckperms.group.showtracks -* /perms group \ clear - luckperms.group.clear - -### Track -* /perms track \ info - luckperms.track.info -* /perms track \ append \ - luckperms.track.append -* /perms track \ insert \ \ - luckperms.track.insert -* /perms track \ remove \ - luckperms.track.remove -* /perms track \ clear - luckperms.track.clear - -### Log -* /perms log recent [user] [page] - luckperms.log.recent -* /perms log search \ [page] - luckperms.log.search -* /perms log notify [on|off] - luckperms.log.notify -* /perms log export \ - luckperms.log.export -* /perms log userhistory \ [page] - luckperms.log.userhistory -* /perms log grouphistory \ [page] - luckperms.log.grouphistory -* /perms log trackhistory \ [page] - luckperms.log.trackhistory - ## License See LICENSE.md. \ No newline at end of file diff --git a/common/src/main/java/me/lucko/luckperms/commands/SenderFactory.java b/common/src/main/java/me/lucko/luckperms/commands/SenderFactory.java index 5954165c8..138701ebb 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/SenderFactory.java +++ b/common/src/main/java/me/lucko/luckperms/commands/SenderFactory.java @@ -34,9 +34,8 @@ import java.util.stream.Collectors; * @param the command sender type */ public abstract class SenderFactory implements Runnable { - // Ensures messages are sent in order, etc. - private final List tasks = new ArrayList<>(); - + private final Map> messages = new HashMap<>(); + //private final List> messages = new ArrayList<>(); private final SenderFactory factory = this; protected abstract String getName(T t); @@ -63,8 +62,12 @@ public abstract class SenderFactory implements Runnable { public void sendMessage(String s) { final T t = tRef.get(); if (t != null) { - synchronized (tasks) { - tasks.add(() -> factory.sendMessage(t, s)); + synchronized (messages) { + if (!messages.containsKey(t)) { + messages.put(t, new ArrayList<>()); + } + + messages.get(t).add(s); } } } @@ -80,10 +83,10 @@ public abstract class SenderFactory implements Runnable { @Override public final void run() { - synchronized (tasks) { - if (!tasks.isEmpty()) { - tasks.forEach(Runnable::run); - tasks.clear(); + synchronized (messages) { + if (!messages.isEmpty()) { + messages.entrySet().forEach(e -> e.getValue().forEach(s -> factory.sendMessage(e.getKey(), s))); + messages.clear(); } } } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroup.java b/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroup.java index 8c43c0de9..76a979441 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/CreateGroup.java @@ -62,7 +62,7 @@ public class CreateGroup extends SingleMainCommand { } Message.CREATE_SUCCESS.send(sender, groupName); - LogEntry.build().actor(sender).actedName(groupName).type('G').action("create").build().submit(plugin); + LogEntry.build().actor(sender).actedName(groupName).type('G').action("create").build().submit(plugin, sender); plugin.runUpdateTask(); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java b/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java index 4c10e5059..8679d8001 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/DeleteGroup.java @@ -78,7 +78,7 @@ public class DeleteGroup extends SingleMainCommand { } Message.DELETE_SUCCESS.send(sender, groupName); - LogEntry.build().actor(sender).actedName(groupName).type('G').action("delete").build().submit(plugin); + LogEntry.build().actor(sender).actedName(groupName).type('G').action("delete").build().submit(plugin, sender); plugin.runUpdateTask(); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java index 8f1b02974..9682d873a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupClear.java @@ -44,7 +44,7 @@ public class GroupClear extends SubCommand { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group group, List args, String label) { group.clearNodes(); Message.CLEAR_SUCCESS.send(sender, group.getName()); - LogEntry.build().actor(sender).acted(group).action("clear").build().submit(plugin); + LogEntry.build().actor(sender).acted(group).action("clear").build().submit(plugin, sender); save(group, sender, plugin); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java index 3b6955634..fc5071502 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetInherit.java @@ -76,14 +76,14 @@ public class GroupSetInherit extends SubCommand { Message.GROUP_SETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), group1.getName(), server); LogEntry.build().actor(sender).acted(group) .action("setinherit " + group1.getName() + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.setInheritGroup(group1, server, world); Message.GROUP_SETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), group1.getName(), server, world); LogEntry.build().actor(sender).acted(group) .action("setinherit " + group1.getName() + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -91,7 +91,7 @@ public class GroupSetInherit extends SubCommand { Message.GROUP_SETINHERIT_SUCCESS.send(sender, group.getName(), group1.getName()); LogEntry.build().actor(sender).acted(group) .action("setinherit " + group1.getName()) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java index a456a8512..10e716f8c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetPermission.java @@ -78,14 +78,14 @@ public class GroupSetPermission extends SubCommand { Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, group.getName(), server); LogEntry.build().actor(sender).acted(group) .action("set " + node + " " + b + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.setPermission(node, b, server, world); Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, group.getName(), server, world); LogEntry.build().actor(sender).acted(group) .action("set " + node + " " + b + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -93,7 +93,7 @@ public class GroupSetPermission extends SubCommand { Message.SETPERMISSION_SUCCESS.send(sender, node, bool, group.getName()); LogEntry.build().actor(sender).acted(group) .action("set " + node + " " + b) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java index c09b9b058..bad0f4336 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java @@ -95,7 +95,7 @@ public class GroupSetTempInherit extends SubCommand { DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settempinherit " + group1.getName() + " " + duration + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); group.setInheritGroup(group1, server, world, duration); @@ -103,7 +103,7 @@ public class GroupSetTempInherit extends SubCommand { world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settempinherit " + group1.getName() + " " + duration + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -111,7 +111,7 @@ public class GroupSetTempInherit extends SubCommand { Message.GROUP_SET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), group1.getName(), DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settempinherit " + group1.getName() + " " + duration) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java index 17880c09a..d1f1e639d 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java @@ -98,7 +98,7 @@ public class GroupSetTempPermission extends SubCommand { DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settemp " + node + " " + b + " " + duration + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(4).toLowerCase(); group.setPermission(node, b, server, world, duration); @@ -106,7 +106,7 @@ public class GroupSetTempPermission extends SubCommand { world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settemp " + node + " " + b + " " + duration + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -114,7 +114,7 @@ public class GroupSetTempPermission extends SubCommand { Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, group.getName(), DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(group) .action("settemp " + node + " " + b + " " + duration) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java index 7604f6efc..f1a521170 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnSetPermission.java @@ -70,14 +70,14 @@ public class GroupUnSetPermission extends SubCommand { Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server); LogEntry.build().actor(sender).acted(group) .action("unset " + node + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission(node, server, world); Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world); LogEntry.build().actor(sender).acted(group) .action("unset " + node + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -85,7 +85,7 @@ public class GroupUnSetPermission extends SubCommand { Message.UNSETPERMISSION_SUCCESS.send(sender, node, group.getName()); LogEntry.build().actor(sender).acted(group) .action("unset " + node) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java index a433701ff..8ea0b790e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetInherit.java @@ -65,14 +65,14 @@ public class GroupUnsetInherit extends SubCommand { Message.GROUP_UNSETINHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server); LogEntry.build().actor(sender).acted(group) .action("unsetinherit " + groupName + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission("group." + groupName, server, world); Message.GROUP_UNSETINHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world); LogEntry.build().actor(sender).acted(group) .action("unsetinherit " + groupName + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -80,7 +80,7 @@ public class GroupUnsetInherit extends SubCommand { Message.GROUP_UNSETINHERIT_SUCCESS.send(sender, group.getName(), groupName); LogEntry.build().actor(sender).acted(group) .action("unsetinherit " + groupName) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java index 841ada64e..82afead4b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempInherit.java @@ -65,14 +65,14 @@ public class GroupUnsetTempInherit extends SubCommand { Message.GROUP_UNSET_TEMP_INHERIT_SERVER_SUCCESS.send(sender, group.getName(), groupName, server); LogEntry.build().actor(sender).acted(group) .action("unsettempinherit " + groupName + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission("group." + groupName, server, world, true); Message.GROUP_UNSET_TEMP_INHERIT_SERVER_WORLD_SUCCESS.send(sender, group.getName(), groupName, server, world); LogEntry.build().actor(sender).acted(group) .action("unsettempinherit " + groupName + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -80,7 +80,7 @@ public class GroupUnsetTempInherit extends SubCommand { Message.GROUP_UNSET_TEMP_INHERIT_SUCCESS.send(sender, group.getName(), groupName); LogEntry.build().actor(sender).acted(group) .action("unsettempinherit " + groupName) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java index 23e612b78..13555713c 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupUnsetTempPermission.java @@ -71,14 +71,14 @@ public class GroupUnsetTempPermission extends SubCommand { Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, group.getName(), server); LogEntry.build().actor(sender).acted(group) .action("unsettemp " + node + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); group.unsetPermission(node, server, world); Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, group.getName(), server, world); LogEntry.build().actor(sender).acted(group) .action("unsettemp " + node + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -86,7 +86,7 @@ public class GroupUnsetTempPermission extends SubCommand { Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, group.getName()); LogEntry.build().actor(sender).acted(group) .action("unsettemp " + node) - .build().submit(plugin); + .build().submit(plugin, sender); } save(group, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java index ed86ef266..432847144 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogGroupHistory.java @@ -46,7 +46,7 @@ public class LogGroupHistory extends SubCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, List args, String label) { - String group = args.get(0); + String group = args.get(0).toLowerCase(); int page = -999; if (args.size() == 2) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java index 869327520..d4b8b8dae 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java +++ b/common/src/main/java/me/lucko/luckperms/commands/log/subcommands/LogTrackHistory.java @@ -46,7 +46,7 @@ public class LogTrackHistory extends SubCommand { @Override public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, List args, String label) { - String track = args.get(0); + String track = args.get(0).toLowerCase(); int page = -999; if (args.size() == 2) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrack.java b/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrack.java index a261edb5c..078134fc2 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrack.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/CreateTrack.java @@ -62,7 +62,7 @@ public class CreateTrack extends SingleMainCommand { } Message.CREATE_SUCCESS.send(sender, trackName); - LogEntry.build().actor(sender).actedName(trackName).type('T').action("create").build().submit(plugin); + LogEntry.build().actor(sender).actedName(trackName).type('T').action("create").build().submit(plugin, sender); plugin.runUpdateTask(); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrack.java b/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrack.java index b9f617606..803ac4c18 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrack.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/DeleteTrack.java @@ -72,7 +72,7 @@ public class DeleteTrack extends SingleMainCommand { } Message.DELETE_SUCCESS.send(sender, trackName); - LogEntry.build().actor(sender).actedName(trackName).type('T').action("delete").build().submit(plugin); + LogEntry.build().actor(sender).actedName(trackName).type('T').action("delete").build().submit(plugin, sender); plugin.runUpdateTask(); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java index a5b119d5b..e2ffe24cb 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackAppend.java @@ -63,10 +63,12 @@ public class TrackAppend extends SubCommand { try { track.appendGroup(group); Message.TRACK_APPEND_SUCCESS.send(sender, group.getName(), track.getName()); - Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName())); + if (track.getGroups().size() > 1) { + Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName())); + } LogEntry.build().actor(sender).acted(track) .action("append " + group.getName()) - .build().submit(plugin); + .build().submit(plugin, sender); save(track, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java index d0c1ff4c8..8e89952df 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackClear.java @@ -44,7 +44,7 @@ public class TrackClear extends SubCommand { public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track track, List args, String label) { track.clearGroups(); Message.TRACK_CLEAR.send(sender, track.getName()); - LogEntry.build().actor(sender).acted(track).action("clear").build().submit(plugin); + LogEntry.build().actor(sender).acted(track).action("clear").build().submit(plugin, sender); save(track, sender, plugin); return CommandResult.SUCCESS; } diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java index 9a7721056..e3bbd3214 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackInsert.java @@ -71,10 +71,12 @@ public class TrackInsert extends SubCommand { try { track.insertGroup(group, pos - 1); Message.TRACK_INSERT_SUCCESS.send(sender, group.getName(), track.getName(), pos); - Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName())); + if (track.getGroups().size() > 1) { + Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), group.getName())); + } LogEntry.build().actor(sender).acted(track) .action("insert " + group.getName() + " " + pos) - .build().submit(plugin); + .build().submit(plugin, sender); save(track, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectAlreadyHasException e) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java index c90c9f132..061f19265 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java +++ b/common/src/main/java/me/lucko/luckperms/commands/track/subcommands/TrackRemove.java @@ -51,10 +51,12 @@ public class TrackRemove extends SubCommand { try { track.removeGroup(groupName); Message.TRACK_REMOVE_SUCCESS.send(sender, groupName, track.getName()); - Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups())); + if (track.getGroups().size() > 1) { + Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups())); + } LogEntry.build().actor(sender).acted(track) .action("remove " + groupName) - .build().submit(plugin); + .build().submit(plugin, sender); save(track, sender, plugin); return CommandResult.SUCCESS; } catch (ObjectLacksException e) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java index 86ec19964..8766aae6e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddGroup.java @@ -76,14 +76,14 @@ public class UserAddGroup extends SubCommand { Message.USER_ADDGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server); LogEntry.build().actor(sender).acted(user) .action("addgroup " + group.getName() + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); user.addGroup(group, server, world); Message.USER_ADDGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world); LogEntry.build().actor(sender).acted(user) .action("addgroup " + group.getName() + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -91,7 +91,7 @@ public class UserAddGroup extends SubCommand { Message.USER_ADDGROUP_SUCCESS.send(sender, user.getName(), groupName); LogEntry.build().actor(sender).acted(user) .action("addgroup " + group.getName()) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java index 3ae27b4d0..d2300804b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java @@ -96,7 +96,7 @@ public class UserAddTempGroup extends SubCommand { DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("addtempgroup " + group.getName() + " " + duration + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); user.addGroup(group, server, world, duration); @@ -104,7 +104,7 @@ public class UserAddTempGroup extends SubCommand { world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("addtempgroup " + group.getName() + " " + duration + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -112,7 +112,7 @@ public class UserAddTempGroup extends SubCommand { Message.USER_ADDTEMPGROUP_SUCCESS.send(sender, user.getName(), groupName, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("addtempgroup " + group.getName() + " " + duration) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java index 038a70a87..31ecf14e2 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserClear.java @@ -45,7 +45,7 @@ public class UserClear extends SubCommand { user.clearNodes(); plugin.getUserManager().giveDefaults(user); Message.CLEAR_SUCCESS.send(sender, user.getName()); - LogEntry.build().actor(sender).acted(user).action("clear").build().submit(plugin); + LogEntry.build().actor(sender).acted(user).action("clear").build().submit(plugin, sender); save(user, sender, plugin); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java index 99645e1c8..4eeb04e61 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserDemote.java @@ -108,7 +108,7 @@ public class UserDemote extends SubCommand { Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), previousGroup.getName(), old, true)); LogEntry.build().actor(sender).acted(user) .action("demote " + track.getName() + "(from " + old + " to " + previousGroup.getName() + ")") - .build().submit(plugin); + .build().submit(plugin, sender); save(user, sender, plugin); plugin.getApiProvider().fireEventAsync(new UserDemoteEvent(new TrackLink(track), new UserLink(user), old, previousGroup.getName())); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java index e349a897a..7839463a8 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserPromote.java @@ -108,7 +108,7 @@ public class UserPromote extends SubCommand { Message.EMPTY.send(sender, Util.listToArrowSep(track.getGroups(), old, nextGroup.getName(), false)); LogEntry.build().actor(sender).acted(user) .action("promote " + track.getName() + "(from " + old + " to " + nextGroup.getName() + ")") - .build().submit(plugin); + .build().submit(plugin, sender); save(user, sender, plugin); plugin.getApiProvider().fireEventAsync(new UserPromoteEvent(new TrackLink(track), new UserLink(user), old, nextGroup.getName())); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java index c38eec295..c3342a672 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveGroup.java @@ -70,14 +70,14 @@ public class UserRemoveGroup extends SubCommand { Message.USER_REMOVEGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server); LogEntry.build().actor(sender).acted(user) .action("removegroup " + groupName + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); user.unsetPermission("group." + groupName, server, world); Message.USER_REMOVEGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world); LogEntry.build().actor(sender).acted(user) .action("removegroup " + groupName + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -85,7 +85,7 @@ public class UserRemoveGroup extends SubCommand { Message.USER_REMOVEGROUP_SUCCESS.send(sender, user.getName(), groupName); LogEntry.build().actor(sender).acted(user) .action("removegroup " + groupName) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java index e0e7b876c..a64a7174e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserRemoveTempGroup.java @@ -65,14 +65,14 @@ public class UserRemoveTempGroup extends SubCommand { Message.USER_REMOVETEMPGROUP_SERVER_SUCCESS.send(sender, user.getName(), groupName, server); LogEntry.build().actor(sender).acted(user) .action("removetempgroup " + groupName + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); user.unsetPermission("group." + groupName, server, world, true); Message.USER_REMOVETEMPGROUP_SERVER_WORLD_SUCCESS.send(sender, user.getName(), groupName, server, world); LogEntry.build().actor(sender).acted(user) .action("removetempgroup " + groupName + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -80,7 +80,7 @@ public class UserRemoveTempGroup extends SubCommand { Message.USER_REMOVETEMPGROUP_SUCCESS.send(sender, user.getName(), groupName); LogEntry.build().actor(sender).acted(user) .action("removetempgroup " + groupName) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java index 7a2749283..e33b7cd8e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPermission.java @@ -79,14 +79,14 @@ public class UserSetPermission extends SubCommand { Message.SETPERMISSION_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server); LogEntry.build().actor(sender).acted(user) .action("set " + node + " " + b + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(3).toLowerCase(); user.setPermission(node, b, server, world); Message.SETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, bool, user.getName(), server, world); LogEntry.build().actor(sender).acted(user) .action("set " + node + " " + b + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -94,7 +94,7 @@ public class UserSetPermission extends SubCommand { Message.SETPERMISSION_SUCCESS.send(sender, node, bool, user.getName()); LogEntry.build().actor(sender).acted(user) .action("set " + node + " " + b) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java index ff0168ba0..a154a6b42 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetPrimaryGroup.java @@ -63,7 +63,7 @@ public class UserSetPrimaryGroup extends SubCommand { Message.USER_PRIMARYGROUP_SUCCESS.send(sender, user.getName(), group.getName()); LogEntry.build().actor(sender).acted(user) .action("setprimarygroup " + group.getName()) - .build().submit(plugin); + .build().submit(plugin, sender); save(user, sender, plugin); return CommandResult.SUCCESS; diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java index e1b5ea9ab..2e0a3d6b7 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java @@ -97,14 +97,14 @@ public class UserSetTempPermission extends SubCommand { Message.SETPERMISSION_TEMP_SERVER_SUCCESS.send(sender, node, bool, user.getName(), server, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("settemp " + node + " " + b + " " + duration + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(4).toLowerCase(); user.setPermission(node, b, server, world, duration); Message.SETPERMISSION_TEMP_SERVER_WORLD_SUCCESS.send(sender, node, bool, user.getName(), server, world, DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("settemp " + node + " " + b + " " + duration + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -112,7 +112,7 @@ public class UserSetTempPermission extends SubCommand { Message.SETPERMISSION_TEMP_SUCCESS.send(sender, node, bool, user.getName(), DateUtil.formatDateDiff(duration)); LogEntry.build().actor(sender).acted(user) .action("settemp " + node + " " + b + " " + duration) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java index 7bd10d7ad..f1bfc8552 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnSetPermission.java @@ -70,14 +70,14 @@ public class UserUnSetPermission extends SubCommand { Message.UNSETPERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server); LogEntry.build().actor(sender).acted(user) .action("unset " + node + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); user.unsetPermission(node, server, world); Message.UNSETPERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, user.getName(), server, world); LogEntry.build().actor(sender).acted(user) .action("unset " + node + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -85,7 +85,7 @@ public class UserUnSetPermission extends SubCommand { Message.UNSETPERMISSION_SUCCESS.send(sender, node, user.getName()); LogEntry.build().actor(sender).acted(user) .action("unset " + node) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java index fd1f046b6..53f1ec77e 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserUnsetTempPermission.java @@ -71,14 +71,14 @@ public class UserUnsetTempPermission extends SubCommand { Message.UNSET_TEMP_PERMISSION_SERVER_SUCCESS.send(sender, node, user.getName(), server); LogEntry.build().actor(sender).acted(user) .action("unsettemp " + node + " " + server) - .build().submit(plugin); + .build().submit(plugin, sender); } else { final String world = args.get(2).toLowerCase(); user.unsetPermission(node, server, world, true); Message.UNSET_TEMP_PERMISSION_SERVER_WORLD_SUCCESS.send(sender, node, user.getName(), server, world); LogEntry.build().actor(sender).acted(user) .action("unsettemp " + node + " " + server + " " + world) - .build().submit(plugin); + .build().submit(plugin, sender); } } else { @@ -86,7 +86,7 @@ public class UserUnsetTempPermission extends SubCommand { Message.UNSET_TEMP_PERMISSION_SUCCESS.send(sender, node, user.getName()); LogEntry.build().actor(sender).acted(user) .action("unsettemp " + node) - .build().submit(plugin); + .build().submit(plugin, sender); } save(user, sender, plugin); diff --git a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java index 9bfdbc491..5b92834d8 100644 --- a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java @@ -332,9 +332,8 @@ public abstract class PermissionHolder { builder.append("/"); } else { if (world != null) { - builder.append("global-").append(world); + builder.append("global-").append(world).append("/"); } - builder.append("/"); } builder.append(node); @@ -346,7 +345,7 @@ public abstract class PermissionHolder { final String finalNode = builder.toString(); - if (hasPermission(node, value)) { + if (hasPermission(finalNode, value)) { throw new ObjectAlreadyHasException(); } @@ -431,9 +430,8 @@ public abstract class PermissionHolder { builder.append("/"); } else { if (world != null) { - builder.append("global-").append(world); + builder.append("global-").append(world).append("/"); } - builder.append("/"); } builder.append(node); diff --git a/common/src/main/java/me/lucko/luckperms/data/LogEntry.java b/common/src/main/java/me/lucko/luckperms/data/LogEntry.java index 3fa8ec623..bf8fe4f43 100644 --- a/common/src/main/java/me/lucko/luckperms/data/LogEntry.java +++ b/common/src/main/java/me/lucko/luckperms/data/LogEntry.java @@ -44,7 +44,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry { super(); } - public void submit(LuckPermsPlugin plugin) { + public void submit(LuckPermsPlugin plugin, Sender sender) { plugin.getDatastore().logAction(this); LogNotifyEvent event = new LogNotifyEvent(this); @@ -60,6 +60,7 @@ public class LogEntry extends me.lucko.luckperms.api.LogEntry { senders.stream() .filter(s -> !plugin.getIgnoringLogs().contains(s.getUuid())) + .filter(s -> !s.getUuid().equals(sender.getUuid())) .forEach(s -> Message.LOG.send(s, msg)); } diff --git a/pom.xml b/pom.xml index 13a92c445..bdf02ba52 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,25 @@ sponge + LuckPerms + An advanced permissions implementation for Bukkit/Spigot, BungeeCord and Sponge. + https://github.com/lucko/LuckPerms + + + + MIT + https://opensource.org/licenses/MIT + + + + + scm:git:https://github.com/lucko/LuckPerms.git + scm:git:git@github.com:lucko/LuckPerms.git + https://github.com/lucko/LuckPerms + + pom + UTF-8 2.5