Classic mistake, changed my mind and only changed part of the code.

Also the actual mistake. Never forget. (#81)
This commit is contained in:
Jikoo 2017-11-08 17:37:22 -05:00
parent f07cef5621
commit e652b43670
3 changed files with 9 additions and 7 deletions

View file

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

View file

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

View file

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