Skip to content

Commit

Permalink
Merge pull request #10 from Th3Shadowbroker/fix/grief-prevention
Browse files Browse the repository at this point in the history
Fix/grief prevention
  • Loading branch information
InventivetalentDev authored Oct 13, 2019
2 parents 1987b3b + 469ec0b commit e517298
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<groupId>org.inventivetalent</groupId>
<artifactId>bookshelves</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-SNAPSHOT</version>


<build>
Expand Down
5 changes: 3 additions & 2 deletions src/org/inventivetalent/bookshelves/Bookshelves.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.*;
import java.lang.reflect.Field;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class Bookshelves extends JavaPlugin {

Expand Down Expand Up @@ -87,9 +88,9 @@ public void onEnable() {
getLogger().warning("Could not find PlayerEventHandler for GriefPrevention");
} else {
Field inventoryHolderCacheField = AccessUtil.setAccessible(PlayerEventHandler.getDeclaredField("inventoryHolderCache"));
Map<Integer, Boolean> inventoryHolderCache = (Map<Integer, Boolean>) inventoryHolderCacheField.get(playerEventHandlerInstance);
ConcurrentHashMap<Material, Boolean> inventoryHolderCache = (ConcurrentHashMap<Material, Boolean>) inventoryHolderCacheField.get(playerEventHandlerInstance);

inventoryHolderCache.put(Material.BOOKSHELF.getId(), true);
inventoryHolderCache.put(Material.BOOKSHELF, true);
getLogger().info("Injected Bookshelf as container type into GriefPrevention");
}
} catch (Exception e) {
Expand Down

0 comments on commit e517298

Please sign in to comment.