Skip to content

Commit

Permalink
更新到支持1.20x版本
Browse files Browse the repository at this point in the history
将写死的代码写入配置文件,允许自定义物品以支持全版本
更新Gradle到8.0版本
  • Loading branch information
XiaMoHuaHuo_CN committed Jul 10, 2023
1 parent 68dd568 commit 958a5f0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/cn/enaium/treecutter/Events.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<String> logs = Arrays.asList("WARPED_STEM", "CRIMSON_STEM", "OAK_LOG", "BIRCH_LOG", "SPRUCE_LOG", "JUNGLE_LOG", "DARK_OAK_LOG", "ACACIA_LOG");
private final List<String> 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<String> logs = LLTMap.logs;
private final List<String> leaves = LLTMap.leaves;
private final List<String> target = new ArrayList<>();
private final List<String> tools = Arrays.asList("NETHERITE_AXE", "DIAMOND_AXE", "GOLDEN_AXE", "IRON_AXE", "STONE_AXE", "WOODEN_AXE");
private final List<String> tools = LLTMap.tools;

private final JavaPlugin javaPlugin;

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/cn/enaium/treecutter/LLTMap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cn.enaium.treecutter;

import java.util.List;

public interface LLTMap {
List<String> 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<String> 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<String> tools = TreeCutter.INSTANCE.getConfig().getStringList("list.tools");
//Arrays.asList("NETHERITE_AXE", "DIAMOND_AXE", "GOLDEN_AXE", "IRON_AXE", "STONE_AXE", "WOODEN_AXE");

}
12 changes: 7 additions & 5 deletions src/main/java/cn/enaium/treecutter/TreeCutter.java
Original file line number Diff line number Diff line change
@@ -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.");
}
}
35 changes: 34 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,37 @@ enable: true
log: true

# Break leave
leave: false
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"

0 comments on commit 958a5f0

Please sign in to comment.