diff --git a/build.gradle b/build.gradle index 2244926..523fee6 100644 --- a/build.gradle +++ b/build.gradle @@ -83,7 +83,7 @@ shadowJar { def targetJavaVersion = 8 java { def javaVersion = JavaVersion.toVersion(targetJavaVersion) - sourceCompatibility = javaVersion + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = javaVersion if (JavaVersion.current() < javaVersion) { toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) diff --git a/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java b/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java index 1127a23..70b899f 100644 --- a/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java +++ b/src/main/java/me/byteful/plugin/leveltools/listeners/XPListener.java @@ -50,9 +50,11 @@ protected void handle(LevelToolsItem tool, Player player, double modifier) { int newLevel = tool.getLevel() + 1; final int maxLevel = LevelToolsPlugin.getInstance().getConfig().getInt("max_level"); - if (newLevel > maxLevel && tool.getXp() != tool.getMaxXp()) { - tool.setXp(tool.getMaxXp()); - LevelToolsUtil.setHand(player, tool.getItemStack()); + if (newLevel > maxLevel) { + if (tool.getXp() != tool.getMaxXp()) { + tool.setXp(tool.getMaxXp()); + LevelToolsUtil.setHand(player, tool.getItemStack()); + } return; }