Merge branch 'development'

This commit is contained in:
Christian Koop 2024-10-02 15:59:10 +02:00
commit 0ca4534d74
No known key found for this signature in database
GPG Key ID: 6A4A09E8ED946113
5 changed files with 57 additions and 11 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.craftaro</groupId> <groupId>com.craftaro</groupId>
<artifactId>UltimateTimber</artifactId> <artifactId>UltimateTimber</artifactId>
<version>3.0.0</version> <version>3.2.0</version>
<name>UltimateTimber</name> <name>UltimateTimber</name>
<description>Give your players a new and exciting way to chop down trees</description> <description>Give your players a new and exciting way to chop down trees</description>
@ -35,7 +35,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version> <version>3.5.3</version>
<executions> <executions>
<execution> <execution>
@ -74,10 +74,10 @@
<excludeDefaults>false</excludeDefaults> <excludeDefaults>false</excludeDefaults>
<includes> <includes>
<include>**/nms/v*/**</include> <include>**/nms/v*/**</include>
<include>**/third_party/net/kyori/**</include>
</includes> </includes>
<excludes> <excludes>
<exclude>**/third_party/org/apache/**</exclude> <exclude>**/third_party/org/apache/**</exclude>
<exclude>**/third_party/net/kyori/**</exclude>
<exclude>**/third_party/com/zaxxer/**</exclude> <exclude>**/third_party/com/zaxxer/**</exclude>
<exclude>**/third_party/org/jooq/**</exclude> <exclude>**/third_party/org/jooq/**</exclude>
<exclude>**/third_party/org/mariadb/**</exclude> <exclude>**/third_party/org/mariadb/**</exclude>
@ -118,7 +118,7 @@
<dependency> <dependency>
<groupId>com.craftaro</groupId> <groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId> <artifactId>CraftaroCore</artifactId>
<version>3.0.0-SNAPSHOT</version> <version>3.5.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -38,6 +38,6 @@ public class CommandReload extends AbstractCommand {
@Override @Override
public String getDescription() { public String getDescription() {
return this.plugin.getLocale().getMessage("command.reload.description").getMessage(); return this.plugin.getLocale().getMessage("command.reload.description").getMessage().toString();
} }
} }

View File

@ -42,7 +42,7 @@ public class CommandToggle extends AbstractCommand {
@Override @Override
public String getDescription() { public String getDescription() {
return this.plugin.getLocale().getMessage("command.toggle.description").getMessage(); return this.plugin.getLocale().getMessage("command.toggle.description").getMessage().toString();
} }
} }

View File

@ -161,13 +161,30 @@ public class TreeFallManager extends Manager implements Listener {
sstack.addDamage(player, toolDamage, true); sstack.addDamage(player, toolDamage, true);
//Destroy item if durability is less than 0 //Destroy item if durability is less than 0
ItemMeta meta = sstack.getItem().getItemMeta(); ItemStack itemStack = sstack.getItem();
if (meta instanceof Damageable) { ItemMeta meta = itemStack.getItemMeta();
Damageable damageable = (Damageable)meta; boolean isDamageableAvailable = false;
try {
Class.forName("org.bukkit.inventory.meta.Damageable");
isDamageableAvailable = true;
} catch (ClassNotFoundException e) {
isDamageableAvailable = false;
}
if (isDamageableAvailable && meta instanceof org.bukkit.inventory.meta.Damageable) {
org.bukkit.inventory.meta.Damageable damageable = (org.bukkit.inventory.meta.Damageable) meta;
int damage = damageable.getDamage(); int damage = damageable.getDamage();
if (damage >= sstack.getItem().getType().getMaxDurability()) { if (damage >= itemStack.getType().getMaxDurability()) {
//Break tool
player.getInventory().setItemInMainHand(null); player.getInventory().setItemInMainHand(null);
} else {
itemStack.setItemMeta(meta);
}
} else {
short currentDurability = itemStack.getDurability();
short maxDurability = itemStack.getType().getMaxDurability();
if (currentDurability >= maxDurability) {
player.getInventory().setItemInMainHand(null);
} else {
itemStack.setDurability(currentDurability);
} }
} }
} }

View File

@ -0,0 +1,29 @@
#########################################################
# 参考 By https://www.mcbbs.net/thread-1297859-1-1.html #
# command.give.not-a-player #
# command.give.given #
# command.give.no-axe #
#########################################################
# 一般信息
general:
nametag:
prefix: '&8[&6UltimateTimber&8] '
nopermission: '&c你没有权限'
# 命令消息
command:
reload:
description: '&8 - &a/ut reload &7 - 配置已重载'
reloaded: '&7配置和语言环境文件已重新加载'
toggle:
description: '&8 - &a/ut toggle &7 - 切换砍树模式'
enabled: '&7Chopping Mode: &a开启'
disabled: '&7Chopping Mode: &c关闭'
give:
not-a-player: '&c你貌似并非一个玩家'
given: '&f给予玩家 &a%player%'
no-axe: '&cAxe 加载失败惹'
# 事件消息
event:
'on':
cooldown: '&e冷却中, 暂不能砍树哦'