From 958a5f0da82812474587a4e54545d1c4b21d849e Mon Sep 17 00:00:00 2001 From: XiaMoHuaHuo_CN Date: Mon, 10 Jul 2023 16:33:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=E6=94=AF=E6=8C=811.?= =?UTF-8?q?20x=E7=89=88=E6=9C=AC=20=E5=B0=86=E5=86=99=E6=AD=BB=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=86=99=E5=85=A5=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=85=81=E8=AE=B8=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=89=A9=E5=93=81=E4=BB=A5=E6=94=AF=E6=8C=81=E5=85=A8=E7=89=88?= =?UTF-8?q?=E6=9C=AC=20=E6=9B=B4=E6=96=B0Gradle=E5=88=B08.0=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/cn/enaium/treecutter/Events.java | 9 ++--- .../java/cn/enaium/treecutter/LLTMap.java | 13 +++++++ .../java/cn/enaium/treecutter/TreeCutter.java | 12 ++++--- src/main/resources/config.yml | 35 ++++++++++++++++++- 6 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 src/main/java/cn/enaium/treecutter/LLTMap.java diff --git a/build.gradle b/build.gradle index 3cfb0c5..23faa84 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 group 'cn.enaium' -version '1.2.0' +version '1.3.0' repositories { mavenCentral() diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 938f0c1..6bc0eeb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/java/cn/enaium/treecutter/Events.java b/src/main/java/cn/enaium/treecutter/Events.java index 09e2d05..c0d1f83 100644 --- a/src/main/java/cn/enaium/treecutter/Events.java +++ b/src/main/java/cn/enaium/treecutter/Events.java @@ -1,7 +1,6 @@ package cn.enaium.treecutter; import org.bukkit.GameMode; -import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -12,19 +11,17 @@ import org.bukkit.plugin.java.JavaPlugin; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.logging.Level; /** * @author Enaium */ public class Events implements Listener { - private final List logs = Arrays.asList("WARPED_STEM", "CRIMSON_STEM", "OAK_LOG", "BIRCH_LOG", "SPRUCE_LOG", "JUNGLE_LOG", "DARK_OAK_LOG", "ACACIA_LOG"); - private final List leaves = Arrays.asList("NETHER_WART_BLOCK", "WARPED_WART_BLOCK", "OAK_LEAVES", "BIRCH_LEAVES", "SPRUCE_LEAVES", "JUNGLE_LEAVES", "DARK_OAK_LEAVES", "ACACIA_LEAVES"); + private final List logs = LLTMap.logs; + private final List leaves = LLTMap.leaves; private final List target = new ArrayList<>(); - private final List tools = Arrays.asList("NETHERITE_AXE", "DIAMOND_AXE", "GOLDEN_AXE", "IRON_AXE", "STONE_AXE", "WOODEN_AXE"); + private final List tools = LLTMap.tools; private final JavaPlugin javaPlugin; diff --git a/src/main/java/cn/enaium/treecutter/LLTMap.java b/src/main/java/cn/enaium/treecutter/LLTMap.java new file mode 100644 index 0000000..9b0b2f8 --- /dev/null +++ b/src/main/java/cn/enaium/treecutter/LLTMap.java @@ -0,0 +1,13 @@ +package cn.enaium.treecutter; + +import java.util.List; + +public interface LLTMap { + List logs = TreeCutter.INSTANCE.getConfig().getStringList("list.logs"); + //Arrays.asList("WARPED_STEM", "CRIMSON_STEM", "OAK_LOG", "BIRCH_LOG", "SPRUCE_LOG", "JUNGLE_LOG", "DARK_OAK_LOG", "ACACIA_LOG") + List leaves = TreeCutter.INSTANCE.getConfig().getStringList("list.leaves"); + //Arrays.asList("NETHER_WART_BLOCK", "WARPED_WART_BLOCK", "OAK_LEAVES", "BIRCH_LEAVES", "SPRUCE_LEAVES", "JUNGLE_LEAVES", "DARK_OAK_LEAVES", "ACACIA_LEAVES"); + List tools = TreeCutter.INSTANCE.getConfig().getStringList("list.tools"); + //Arrays.asList("NETHERITE_AXE", "DIAMOND_AXE", "GOLDEN_AXE", "IRON_AXE", "STONE_AXE", "WOODEN_AXE"); + +} diff --git a/src/main/java/cn/enaium/treecutter/TreeCutter.java b/src/main/java/cn/enaium/treecutter/TreeCutter.java index 54ae730..dfeb381 100644 --- a/src/main/java/cn/enaium/treecutter/TreeCutter.java +++ b/src/main/java/cn/enaium/treecutter/TreeCutter.java @@ -1,22 +1,24 @@ package cn.enaium.treecutter; -import org.bukkit.Material; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import java.util.Objects; import java.util.logging.Level; public final class TreeCutter extends JavaPlugin { + static Plugin INSTANCE = null; + @Override public void onEnable() { - getLogger().log(Level.INFO, "TreeCutter is enable"); + INSTANCE = this; + saveDefaultConfig(); getServer().getPluginManager().registerEvents(new Events(this), this); + getLogger().log(Level.INFO, "TreeCutter is enabled."); } @Override public void onDisable() { - saveConfig(); - getLogger().log(Level.INFO, "TreeCutter is disable"); + getLogger().log(Level.INFO, "TreeCutter is disabled."); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index fccf3ea..2e77a34 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -5,4 +5,37 @@ enable: true log: true # Break leave -leave: false \ No newline at end of file +leave: false + +# LLTMap +list: + logs: + - "WARPED_STEM" + - "CRIMSON_STEM" + - "OAK_LOG" + - "BIRCH_LOG" + - "SPRUCE_LOG" + - "JUNGLE_LOG" + - "DARK_OAK_LOG" + - "ACACIA_LOG" + - "MANGROVE_ROOTS" + - "MANGROVE_LOG" + - "CHERRY_LOG" + leaves: + - "NETHER_WART_BLOCK" + - "WARPED_WART_BLOCK" + - "OAK_LEAVES" + - "BIRCH_LEAVES" + - "SPRUCE_LEAVES" + - "JUNGLE_LEAVES" + - "DARK_OAK_LEAVES" + - "ACACIA_LEAVES" + - "MANGROVE_LEAVES" + - "CHERRY_LEAVES" + tools: + - "NETHERITE_AXE" + - "DIAMOND_AXE" + - "GOLDEN_AXE" + - "IRON_AXE" + - "STONE_AXE" + - "WOODEN_AXE"