Fix error with Shulkerbox filter on MC 1.14

This commit is contained in:
GeorgH93 2019-06-21 21:26:27 +02:00
parent c730c18b05
commit 4b41901c38
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
3 changed files with 13 additions and 20 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks</artifactId>
<version>2.0.5</version>
<version>2.0.6</version>
<scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
@ -21,6 +21,7 @@
<name>Minepacks</name>
<description>Minepacks is a backpack plugin with different backpack sizes, multi language support and SQLite and MySQL storage support.</description>
<url>https://www.spigotmc.org/resources/19286/</url>
<inceptionYear>2014</inceptionYear>
<licenses>
<license>
@ -31,7 +32,6 @@
</licenses>
<properties>
<author>GeorgH93</author>
<website>https://www.spigotmc.org/resources/19286/</website>
<version>${project.version}</version>
<dependencies>depend: [ PCGF_PluginLib ]</dependencies>
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}</mainClass>
@ -235,7 +235,6 @@
<artifact>at.pcgamingfreaks:PluginLib</artifact>
<excludes>
<exclude>*.yml</exclude>
<exclude>META-INF/*.txt</exclude>
</excludes>
</filter>
</filters>

View File

@ -1,6 +1,6 @@
name: "${project.name}"
author: "${author}"
website: "${website}"
website: "${project.url}"
main: "${mainClass}"
description: "${project.description}"
version: "${version}"

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2018 GeorgH93
* Copyright (C) 2019 GeorgH93
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -102,20 +102,17 @@ public void onInventoryClick(InventoryClickEvent event)
@EventHandler(ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent event)
{
if(event.getInventory() != null && event.getInventory().getHolder() != null && event.getInventory().getHolder().getClass().getName().toLowerCase().contains("shulker"))
if(event.getInventory().getHolder() != null && event.getInventory().getHolder().getClass().getName().toLowerCase().contains("shulker"))
{
if(removeExisting)
{
Block shulkerBlock = ((ShulkerBox) event.getInventory().getHolder()).getBlock();
if(shulkerBlock != null)
if(dropExistingContent)
{
if(dropExistingContent)
{
Utils.dropInventory(event.getInventory(), shulkerBlock.getLocation());
}
event.getInventory().clear();
shulkerBlock.setType(Material.AIR);
Utils.dropInventory(event.getInventory(), shulkerBlock.getLocation());
}
event.getInventory().clear();
shulkerBlock.setType(Material.AIR);
}
event.setCancelled(true);
}
@ -200,12 +197,9 @@ private boolean handleShulkerBlock(Block block)
if(removeExisting)
{
ShulkerBox shulkerBox = (ShulkerBox) block.getState();
if(shulkerBox != null)
{
if(dropExistingContent) Utils.dropInventory(shulkerBox.getInventory(), shulkerBox.getLocation());
shulkerBox.getInventory().clear();
block.setType(Material.AIR);
}
if(dropExistingContent) Utils.dropInventory(shulkerBox.getInventory(), shulkerBox.getLocation());
shulkerBox.getInventory().clear();
block.setType(Material.AIR);
}
return true;
}
@ -242,6 +236,7 @@ public void onBlockDispense(BlockDispenseEvent event)
@EventHandler(ignoreCancelled = true)
public void onPrepareItemCraftEvent(PrepareItemCraftEvent event)
{
if(event.getRecipe() == null) return;
Material itemType = event.getRecipe().getResult().getType();
if(itemType == Material.SHULKER_SHELL || SHULKER_BOX_MATERIALS.contains(itemType))
{
@ -253,7 +248,6 @@ public void onPrepareItemCraftEvent(PrepareItemCraftEvent event)
@EventHandler(ignoreCancelled = true)
public void onDrop(PlayerDropItemEvent event)
{
//TODO null checks
Material itemType = event.getItemDrop().getItemStack().getType();
if(itemType == Material.SHULKER_SHELL || SHULKER_BOX_MATERIALS.contains(itemType))
{