From e652b436708625b50c1c93f5eb7a66286f5f0420 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Wed, 8 Nov 2017 17:37:22 -0500 Subject: [PATCH] Classic mistake, changed my mind and only changed part of the code. Also the actual mistake. Never forget. (#81) --- README.MD | 4 ++-- .../main/java/com/lishid/openinv/util/Permissions.java | 8 +++++--- .../src/main/java/com/lishid/openinv/OpenInv.java | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.MD b/README.MD index cf5a5f5..0b62e35 100644 --- a/README.MD +++ b/README.MD @@ -7,7 +7,7 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi - Cross-world support! Don't grant `OpenInv.crossworld` - No self-opening! Don't grant `OpenInv.openself` - Drop items as the player! Place items in the unused slots to the right of the armor to drop them -- **OpenEnder**: Open anyone's inventory, even if they're offline. +- **OpenEnder**: Open anyone's ender chest, even if they're offline. - Read-only mode! No edits allowed! Don't grant `OpenInv.editender` - Cross-world support! Don't grant `OpenInv.crossworld` - No opening others! Don't grant `OpenInv.openenderall` @@ -134,7 +134,7 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi To compile, the relevant Craftbukkit/Spigot jars must be installed in your local repository using the install plugin. Ex: `mvn install:install-file -Dpackaging=jar -Dfile=spigot-1.11-R0.1-SNAPSHOT.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.11-R0.1-SNAPSHOT` -To compile for a specific version or set of versions, you'll need to use a profile. Provided profiles are `latest`, `modern` (versions 1.8+), and `all`. Select an existing profile using the `-P` argument (ex: `mvn clean package -am -P all`) or make your own. For more information, check out the [official guide](http://maven.apache.org/guides/introduction/introduction-to-profiles.html). +To compile for a specific version or set of versions, you'll need to use a profile. Provided profiles are `latest`, `recent` (last 2 major Minecraft versions), and `all`. Select an existing profile using the `-P` argument (ex: `mvn clean package -am -P all`) or make your own. For more information, check out the [official guide](http://maven.apache.org/guides/introduction/introduction-to-profiles.html). The final file is target/OpenInv.jar diff --git a/common/src/main/java/com/lishid/openinv/util/Permissions.java b/common/src/main/java/com/lishid/openinv/util/Permissions.java index 2e9476b..3d8e4ec 100644 --- a/common/src/main/java/com/lishid/openinv/util/Permissions.java +++ b/common/src/main/java/com/lishid/openinv/util/Permissions.java @@ -9,7 +9,9 @@ public enum Permissions { EXEMPT("exempt"), CROSSWORLD("crossworld"), SILENT("silent"), + SILENT_DEFAULT("silent", "default"), ANYCHEST("anychest"), + ANY_DEFAULT("any", "default"), ENDERCHEST("openender"), ENDERCHEST_ALL("openenderall"), SEARCH("search"), @@ -19,10 +21,10 @@ public enum Permissions { private final String[] permission; - Permissions(String... permission) { - this.permission = new String[permission.length + 1]; + Permissions(String... permissions) { + this.permission = new String[permissions.length + 1]; this.permission[0] = "OpenInv"; - System.arraycopy(permission, 0, permission, 1, permission.length); + System.arraycopy(permissions, 0, this.permission, 1, permissions.length); } public boolean hasPermission(Permissible permissible) { diff --git a/plugin/plugin-core/src/main/java/com/lishid/openinv/OpenInv.java b/plugin/plugin-core/src/main/java/com/lishid/openinv/OpenInv.java index 19489a2..02e05b1 100644 --- a/plugin/plugin-core/src/main/java/com/lishid/openinv/OpenInv.java +++ b/plugin/plugin-core/src/main/java/com/lishid/openinv/OpenInv.java @@ -276,7 +276,7 @@ public class OpenInv extends JavaPlugin implements IOpenInv { if (player.isOnline()) { Player onlinePlayer = player.getPlayer(); if (onlinePlayer != null) { - defaultState = onlinePlayer.hasPermission("openinv.anychest.default"); + defaultState = Permissions.ANY_DEFAULT.hasPermission(onlinePlayer); } } @@ -295,7 +295,7 @@ public class OpenInv extends JavaPlugin implements IOpenInv { if (player.isOnline()) { Player onlinePlayer = player.getPlayer(); if (onlinePlayer != null) { - defaultState = onlinePlayer.hasPermission("openinv.silentchest.default"); + defaultState = Permissions.SILENT_DEFAULT.hasPermission(onlinePlayer); } }