IvnentoruClickEvent sometimes passes null inventories or inventories with null holders

This commit is contained in:
Matthew Miller 2018-10-10 20:33:18 +10:00
parent e0b91e9529
commit 5ad21521be
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
apply plugin: 'idea' apply plugin: 'idea'
repositories { repositories {
maven { url "http://repo.bstats.org/content/repositories/releases/" } maven { url "https://jitpack.io" }
} }
dependencies { dependencies {
@ -13,7 +13,7 @@ compile project(':worldguard-core')
exclude group: 'com.sk89q', module: 'worldedit' exclude group: 'com.sk89q', module: 'worldedit'
exclude group: 'com.zachsthings.libcomponents' exclude group: 'com.zachsthings.libcomponents'
} }
compile 'org.bstats:bstats-bukkit:1.2' compileOnly 'org.bstats.bStats-Metrics:bstats-bukkit:1.3'
testCompile 'junit:junit:4.11' testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-library:1.2.1' testCompile 'org.hamcrest:hamcrest-library:1.2.1'
} }
@ -33,7 +33,7 @@ compile project(':worldguard-core')
dependencies { dependencies {
include(dependency(':worldguard-core')) include(dependency(':worldguard-core'))
relocate ("org.bstats", "com.sk89q.worldguard.bukkit.bstats") { relocate ("org.bstats", "com.sk89q.worldguard.bukkit.bstats") {
include(dependency("org.bstats:bstats-bukkit:1.2")) include(dependency("org.bstats.bStats-Metrics:bstats-bukkit:1.3"))
} }
} }

View File

@ -256,7 +256,7 @@ public void onInventoryClick(InventoryClickEvent event) {
Inventory inventory = event.getInventory(); Inventory inventory = event.getInventory();
ItemStack item = event.getCurrentItem(); ItemStack item = event.getCurrentItem();
if (item != null && entity instanceof Player) { if (item != null && inventory != null && inventory.getHolder() != null && entity instanceof Player) {
Player player = (Player) entity; Player player = (Player) entity;
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager(); ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(entity.getWorld())); BukkitWorldConfiguration wcfg = (BukkitWorldConfiguration) cfg.get(BukkitAdapter.adapt(entity.getWorld()));