Compare commits

...

7 Commits
3.3.0 ... 3.3.1

Author SHA1 Message Date
Jikoo
f07cef5621 Bump version to 3.3.2-SNAPSHOT for development 2017-11-07 18:18:33 -05:00
Jikoo
ded6421e33 Bump version to 3.3.1 for release 2017-11-07 18:17:12 -05:00
Jikoo
cbb2b4d232 Lowercase permissions can wait for a major version bump
I don't want to double our permissions checks for backwards compatibility.
2017-11-07 18:16:38 -05:00
Jikoo
48c61eeb82 Support lowercase permissions for consistency. 2017-11-06 19:23:26 -05:00
Jikoo
e3d1af010b Add permissions to alter the default state of Any/SilentChest (#76) 2017-11-05 20:00:22 -05:00
Jikoo
2195677651 Actually fix CME (#71) 2017-08-06 16:35:18 -04:00
Jikoo
c72af5dbac Bump version to 3.3.1-SNAPSHOT for development 2017-07-05 05:53:38 -04:00
34 changed files with 193 additions and 132 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
**/.project
**/.classpath
**/.idea
**/.iml
**/target
**/bin
**/out

View File

@@ -11,8 +11,8 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
- 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`
- **SilentChest**: Open containers without displaying an animation or making sound.
- **AnyChest**: Open containers, even if blocked by ocelots or blocks.
- **SilentContainer**: Open containers without displaying an animation or making sound.
- **AnyContainer**: Open containers, even if blocked by ocelots or blocks.
## Commands
<table width=100%>
@@ -42,14 +42,19 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
<td>Lists all online players that have a certain item in their ender chest.</td>
</tr>
<tr>
<td>/anychest [check]</td>
<td>ac</td>
<td>Check or toggle the AnyChest function, allowing opening blocked containers.</td>
<td>/searchenchant &lt[enchantment] [MinLevel]&gt</td>
<td>searchenchants</td>
<td>Lists all online players with a specific enchantment.</td>
</tr>
<tr>
<td>/silentchest [check]</td>
<td>sc</td>
<td>Check or toggle the SilentChest function, allowing opening containers silently.</td>
<td>/anycontainer [check]</td>
<td>ac, anychest</td>
<td>Check or toggle the AnyContainer function, allowing opening blocked containers.</td>
</tr>
<tr>
<td>/silentcontainer [check]</td>
<td>sc, silentchest</td>
<td>Check or toggle the SilentContainer function, allowing opening containers silently.</td>
</tr>
</table>
@@ -103,18 +108,30 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
<td>OpenInv.search</td>
<td>Required to use /searchinv and /searchender.</td>
</tr>
<tr>
<td>OpenInv.searchenchant</td>
<td>Required to use /searchenchant.</td>
</tr>
<tr>
<td>OpenInv.anychest</td>
<td>Required to use /anychest.</td>
</tr>
<tr>
<td>OpenInv.any.default</td>
<td>Cause AnyContainer to be enabled by default.</td>
</tr>
<tr>
<td>OpenInv.silent</td>
<td>Required to use /silentchest.</td>
<td>Required to use /silentcontainer.</td>
</tr>
<tr>
<td>OpenInv.silent.default</td>
<td>Cause SilentContainer to be enabled by default.</td>
</tr>
</table>
## For Developers
To compile, the relevant Craftbukkit/Spigot jars must be installed in your local repository using the install plugin.
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).
@@ -136,4 +153,4 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
```

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvapi</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvassembly</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvcommon</artifactId>
@@ -22,7 +22,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvapi</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -1,8 +1,10 @@
package com.lishid.openinv.util;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Multimap;
@@ -10,7 +12,7 @@ import com.google.common.collect.TreeMultimap;
/**
* A minimal thread-safe time-based cache implementation backed by a HashMap and TreeMultimap.
*
*
* @author Jikoo
*/
public class Cache<K, V> {
@@ -22,23 +24,23 @@ public class Cache<K, V> {
/**
* Constructs a Cache with the specified retention duration, in use function, and post-removal function.
*
*
* @param retention duration after which keys are automatically invalidated if not in use
* @param inUseCheck Function used to check if a key is considered in use
* @param postRemoval Function used to perform any operations required when a key is invalidated
*/
public Cache(long retention, Function<V> inUseCheck, Function<V> postRemoval) {
public Cache(final long retention, final Function<V> inUseCheck, final Function<V> postRemoval) {
this.internal = new HashMap<K, V>();
this.expiry = TreeMultimap.create(new Comparator<Long>() {
@Override
public int compare(Long long1, Long long2) {
public int compare(final Long long1, final Long long2) {
return long1.compareTo(long2);
}
},
new Comparator<K>() {
@Override
public int compare(K k1, K k2) {
public int compare(final K k1, final K k2) {
return 0;
}
});
@@ -51,70 +53,70 @@ public class Cache<K, V> {
/**
* Set a key and value pair. Keys are unique. Using an existing key will cause the old value to
* be overwritten and the expiration timer to be reset.
*
*
* @param key key with which the specified value is to be associated
* @param value value to be associated with the specified key
*/
public void put(K key, V value) {
public void put(final K key, final V value) {
// Invalidate key - runs lazy check and ensures value won't be cleaned up early
invalidate(key);
this.invalidate(key);
synchronized (internal) {
internal.put(key, value);
expiry.put(System.currentTimeMillis() + retention, key);
synchronized (this.internal) {
this.internal.put(key, value);
this.expiry.put(System.currentTimeMillis() + this.retention, key);
}
}
/**
* Returns the value to which the specified key is mapped, or null if no value is mapped for the key.
*
*
* @param key the key whose associated value is to be returned
* @return the value to which the specified key is mapped, or null if no value is mapped for the key
*/
public V get(K key) {
public V get(final K key) {
// Run lazy check to clean cache
lazyCheck();
this.lazyCheck();
synchronized (internal) {
return internal.get(key);
synchronized (this.internal) {
return this.internal.get(key);
}
}
/**
* Returns true if the specified key is mapped to a value.
*
*
* @param key key to check if a mapping exists for
* @return true if a mapping exists for the specified key
*/
public boolean containsKey(K key) {
public boolean containsKey(final K key) {
// Run lazy check to clean cache
lazyCheck();
this.lazyCheck();
synchronized (internal) {
return internal.containsKey(key);
synchronized (this.internal) {
return this.internal.containsKey(key);
}
}
/**
* Forcibly invalidates a key, even if it is considered to be in use.
*
*
* @param key key to invalidate
*/
public void invalidate(K key) {
public void invalidate(final K key) {
// Run lazy check to clean cache
lazyCheck();
this.lazyCheck();
synchronized (internal) {
if (!internal.containsKey(key)) {
synchronized (this.internal) {
if (!this.internal.containsKey(key)) {
// Value either not present or cleaned by lazy check. Either way, we're good
return;
}
// Remove stored object
internal.remove(key);
this.internal.remove(key);
// Remove expiration entry - prevents more work later, plus prevents issues with values invalidating early
for (Iterator<Map.Entry<Long, K>> iterator = expiry.entries().iterator(); iterator.hasNext();) {
for (Iterator<Map.Entry<Long, K>> iterator = this.expiry.entries().iterator(); iterator.hasNext();) {
if (key.equals(iterator.next().getValue())) {
iterator.remove();
break;
@@ -127,12 +129,12 @@ public class Cache<K, V> {
* Forcibly invalidates all keys, even if they are considered to be in use.
*/
public void invalidateAll() {
synchronized (internal) {
for (V value : internal.values()) {
postRemoval.run(value);
synchronized (this.internal) {
for (V value : this.internal.values()) {
this.postRemoval.run(value);
}
expiry.clear();
internal.clear();
this.expiry.clear();
this.internal.clear();
}
}
@@ -142,9 +144,9 @@ public class Cache<K, V> {
*/
private void lazyCheck() {
long now = System.currentTimeMillis();
long nextExpiry = now + retention;
synchronized (internal) {
for (Iterator<Map.Entry<Long, K>> iterator = expiry.entries().iterator(); iterator
synchronized (this.internal) {
List<K> inUse = new ArrayList<K>();
for (Iterator<Map.Entry<Long, K>> iterator = this.expiry.entries().iterator(); iterator
.hasNext();) {
Map.Entry<Long, K> entry = iterator.next();
@@ -154,18 +156,23 @@ public class Cache<K, V> {
iterator.remove();
if (inUseCheck.run(internal.get(entry.getValue()))) {
expiry.put(nextExpiry, entry.getValue());
if (this.inUseCheck.run(this.internal.get(entry.getValue()))) {
inUse.add(entry.getValue());
continue;
}
V value = internal.remove(entry.getValue());
V value = this.internal.remove(entry.getValue());
if (value == null) {
continue;
}
postRemoval.run(value);
this.postRemoval.run(value);
}
long nextExpiry = now + this.retention;
for (K value : inUse) {
this.expiry.put(nextExpiry, value);
}
}
}

View File

@@ -4,35 +4,44 @@ import org.bukkit.permissions.Permissible;
public enum Permissions {
OPENINV("OpenInv.openinv"),
OVERRIDE("OpenInv.override"),
EXEMPT("OpenInv.exempt"),
CROSSWORLD("OpenInv.crossworld"),
SILENT("OpenInv.silent"),
ANYCHEST("OpenInv.anychest"),
ENDERCHEST("OpenInv.openender"),
ENDERCHEST_ALL("OpenInv.openenderall"),
SEARCH("OpenInv.search"),
EDITINV("OpenInv.editinv"),
EDITENDER("OpenInv.editender"),
OPENSELF("OpenInv.openself");
OPENINV("openinv"),
OVERRIDE("override"),
EXEMPT("exempt"),
CROSSWORLD("crossworld"),
SILENT("silent"),
ANYCHEST("anychest"),
ENDERCHEST("openender"),
ENDERCHEST_ALL("openenderall"),
SEARCH("search"),
EDITINV("editinv"),
EDITENDER("editender"),
OPENSELF("openself");
private final String permission;
private final String[] permission;
private Permissions(String permission) {
this.permission = permission;
Permissions(String... permission) {
this.permission = new String[permission.length + 1];
this.permission[0] = "OpenInv";
System.arraycopy(permission, 0, permission, 1, permission.length);
}
public boolean hasPermission(Permissible permissible) {
String[] parts = permission.split("\\.");
String perm = "";
for (int i = 0; i < parts.length; i++) {
if (permissible.hasPermission(perm + "*")) {
StringBuilder permissionBuilder = new StringBuilder();
// Support wildcard nodes.
for (int i = 0; i < permission.length; i++) {
if (permissible.hasPermission(permissionBuilder.toString() + "*")) {
return true;
}
perm += parts[i] + ".";
permissionBuilder.append(permission[i]).append('.');
}
return permissible.hasPermission(permission);
// Delete trailing period.
if (permissionBuilder.length() > 0) {
permissionBuilder.deleteCharAt(permissionBuilder.length() - 1);
}
return permissible.hasPermission(permissionBuilder.toString());
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_4_5</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_4_6</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvinternal</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_10_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_11_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_12_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_4_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_5_R2</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_5_R3</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_6_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_6_R2</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_6_R3</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_7_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_7_R2</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_7_R3</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_7_R4</artifactId>
@@ -27,7 +27,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_8_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_8_R2</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_8_R3</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_9_R1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvinternal</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvadapter1_9_R2</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvplugincore</artifactId>
@@ -22,12 +22,12 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvpluginv1_10_r1</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -271,7 +271,16 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
@Override
public boolean getPlayerAnyChestStatus(final OfflinePlayer player) {
return this.getConfig().getBoolean("toggles.any-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), false);
boolean defaultState = false;
if (player.isOnline()) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer != null) {
defaultState = onlinePlayer.hasPermission("openinv.anychest.default");
}
}
return this.getConfig().getBoolean("toggles.any-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), defaultState);
}
@Override
@@ -281,7 +290,16 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
@Override
public boolean getPlayerSilentChestStatus(final OfflinePlayer player) {
return this.getConfig().getBoolean("toggles.silent-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), false);
boolean defaultState = false;
if (player.isOnline()) {
Player onlinePlayer = player.getPlayer();
if (onlinePlayer != null) {
defaultState = onlinePlayer.hasPermission("openinv.silentchest.default");
}
}
return this.getConfig().getBoolean("toggles.silent-chest." + this.accessor.getPlayerDataManager().getPlayerDataID(player), defaultState);
}
@Override

View File

@@ -5,6 +5,15 @@ author: lishid
authors: [Jikoo, ShadowRanger]
description: >
This plugin allows you to open a player's inventory as a chest and interact with it in real time.
permissions:
OpenInv.any.default:
description: Permission for AnyContainer to default on prior to toggling.
default: false
OpenInv.silent.default:
description: Permission for SilentContainer to default on prior to toggling.
default: false
commands:
openinv:
aliases: [oi, inv, open]
@@ -30,15 +39,15 @@ commands:
description: Searches and lists players having a specific item in their ender chest
usage: |-
/<command> <item> [MinAmount] - Item is the ID or the Bukkit Material, MinAmount is the minimum amount required
silentchest:
aliases: [sc, silent]
description: Toggle silent chest function, which stops sounds and animations when using containers.
silentcontainer:
aliases: [sc, silent, silentchest]
description: Toggle SilentContainer function, which stops sounds and animations when using containers.
permission: OpenInv.*;OpenInv.silent
usage: |-
/<command> [Check] - Check or toggle silent chest
anychest:
aliases: [ac]
description: Toggle anychest function, which allows opening of blocked chests.
anycontainer:
aliases: [ac, anychest]
description: Toggle AnyContainer function, which allows opening of blocked containers.
permission: OpenInv.*;OpenInv.anychest
usage: |-
/<command> [Check] - Checks or toggle anychest

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvpluginv1_10_r1</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
</parent>
<artifactId>openinvplugin</artifactId>

View File

@@ -6,7 +6,7 @@
<artifactId>openinvparent</artifactId>
<name>OpenInvParent</name>
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
<version>3.3.0</version>
<version>3.3.2-SNAPSHOT</version>
<packaging>pom</packaging>