Added support for a shop plugin.

This commit is contained in:
Brianna 2019-07-13 21:00:43 -04:00
parent 544cf08309
commit 1c6703fcc3
2 changed files with 10 additions and 2 deletions

View File

@ -4,7 +4,7 @@ stages:
variables: variables:
name: "UltimateStacker" name: "UltimateStacker"
path: "/builds/$CI_PROJECT_PATH" path: "/builds/$CI_PROJECT_PATH"
version: "1.6.5" version: "1.6.6"
build: build:
stage: build stage: build

View File

@ -4,6 +4,7 @@ import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.utils.Methods; import com.songoda.ultimatestacker.utils.Methods;
import com.songoda.ultimatestacker.utils.ServerVersion; import com.songoda.ultimatestacker.utils.ServerVersion;
import com.songoda.ultimatestacker.utils.settings.Setting; import com.songoda.ultimatestacker.utils.settings.Setting;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -62,9 +63,16 @@ public class ItemListeners implements Listener {
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onDispense(ItemSpawnEvent event) { public void onExist(ItemSpawnEvent event) {
if (!Setting.STACK_ITEMS.getBoolean()) return; if (!Setting.STACK_ITEMS.getBoolean()) return;
ItemStack itemStack = event.getEntity().getItemStack();
if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName() &&
StringUtils.substring(itemStack.getItemMeta().getDisplayName(), 0, 3).equals("***")) {
return; //Compatibility with Shop instance: https://www.spigotmc.org/resources/shop-a-simple-intuitive-shop-instance.9628/
}
Methods.updateItemAmount(event.getEntity(), event.getEntity().getItemStack().getAmount()); Methods.updateItemAmount(event.getEntity(), event.getEntity().getItemStack().getAmount());
} }