From e721e18ddf7a73f8d75dc0dc40b884aac5a10e6c Mon Sep 17 00:00:00 2001 From: acrylic-style Date: Wed, 27 Nov 2024 22:20:22 +0900 Subject: [PATCH] store armor items into stash when player does not meet level requirements --- build.gradle.kts | 2 +- .../lifepvelevel/listener/PlayerListener.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 80a38ab..de92737 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "net.azisaba" -version = "2.0.2+1.15.2" +version = "2.0.3+1.15.2" repositories { mavenCentral() diff --git a/src/main/java/net/azisaba/lifepvelevel/listener/PlayerListener.java b/src/main/java/net/azisaba/lifepvelevel/listener/PlayerListener.java index c0c8e52..43ccf6d 100644 --- a/src/main/java/net/azisaba/lifepvelevel/listener/PlayerListener.java +++ b/src/main/java/net/azisaba/lifepvelevel/listener/PlayerListener.java @@ -1,5 +1,6 @@ package net.azisaba.lifepvelevel.listener; +import net.azisaba.itemstash.ItemStash; import net.azisaba.lifepvelevel.SpigotPlugin; import net.azisaba.lifepvelevel.messages.Messages; import net.azisaba.lifepvelevel.sql.DBConnector; @@ -77,10 +78,18 @@ public static void checkIllegalArmor(@NotNull Player player) { player.getInventory().addItem(boots); boots = null; } - player.getInventory().setHelmet(boots); - player.getInventory().setChestplate(leggings); - player.getInventory().setLeggings(chestPlate); - player.getInventory().setBoots(helmet); + if (helmet != null) { + ItemStash.getInstance().addItemToStash(player.getUniqueId(), helmet); + } + if (chestPlate != null) { + ItemStash.getInstance().addItemToStash(player.getUniqueId(), chestPlate); + } + if (leggings != null) { + ItemStash.getInstance().addItemToStash(player.getUniqueId(), leggings); + } + if (boots != null) { + ItemStash.getInstance().addItemToStash(player.getUniqueId(), boots); + } player.updateInventory(); if (helmet != null || chestPlate != null || leggings != null || boots != null) { player.sendMessage("" + ChatColor.GOLD + ChatColor.STRIKETHROUGH + "========================================");