Compare commits

...

10 Commits

Author SHA1 Message Date
007142891b 新增对掉落物的优化,可以吃到精准采集buff 2024-10-06 23:00:06 +08:00
bda0f8dee7 增加对 Unbreakable 属性的支持 2024-10-06 20:25:53 +08:00
0c3c0e0726 修复重载配置文件指令无效问题
All checks were successful
Java CI-CD with Maven / build (push) Successful in 12m33s
2024-09-23 13:05:47 +08:00
7fd8f8450c 修复了无法产生掉落物的问题
All checks were successful
Java CI-CD with Maven / build (push) Successful in 17m12s
2024-09-19 22:58:16 +08:00
198c4dd426 新增权限节点
All checks were successful
Java CI-CD with Maven / build (push) Successful in 7m17s
2024-07-08 14:09:49 +08:00
e7cb4cfb80 新增op与创造玩家可以无损使用lwe
Some checks failed
Java CI-CD with Maven / build (push) Failing after 32m39s
2024-07-01 15:46:41 +08:00
3038fc6e3c 修改警告提示位置
All checks were successful
Java CI-CD with Maven / build (push) Successful in 6m26s
2024-05-30 11:05:04 +08:00
17bb269f76 吸水新增消耗下届合金耐久度
All checks were successful
Java CI-CD with Maven / build (push) Successful in 5m38s
2024-05-30 10:55:26 +08:00
acae6d5ec7 更新了下载提示信息 2024-05-01 10:06:48 +08:00
d7362c2f0d 更新了自动更新脚本提示信息
All checks were successful
Java CI-CD with Maven / build (push) Successful in 8m18s
2024-04-28 17:49:58 +08:00
10 changed files with 63 additions and 27 deletions

View File

@ -37,7 +37,7 @@ jobs:
- name: "Release"
uses: https://ssl.lunadeer.cn:14446/zhangyuheng/release-action@main
with:
note: "提示:带 original- 前缀的文件无法用于运行,请下载不带此前缀的版本。"
note: "带 `original-` 前缀的文件无法用于运行,请下载不带此前缀的版本。"
files: |-
staging/*.jar
api_key: '${{secrets.RELEASE_TOKEN}}'

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>LiteWorldEdit</artifactId>
<version>2.4.3.2</version>
<version>2.5.0.1</version>
<packaging>jar</packaging>
<name>LiteWorldEdit</name>

View File

@ -5,6 +5,7 @@ import cn.lunadeer.liteworldedit.JobGenerator.Empty;
import cn.lunadeer.liteworldedit.JobGenerator.Fill;
import cn.lunadeer.liteworldedit.JobGenerator.OverLay;
import cn.lunadeer.liteworldedit.Jobs.Job;
import cn.lunadeer.liteworldedit.Managers.ConfigManager;
import cn.lunadeer.liteworldedit.Managers.Point;
import org.bukkit.Location;
import org.bukkit.Material;
@ -102,11 +103,11 @@ public class Commands implements TabExecutor {
if (!player.isOp()) {
Notification.error(player, "你没有权限。");
} else {
LiteWorldEdit.instance.reloadConfig();
LiteWorldEdit.config.reload();
Notification.info(player, "已重载配置文件。");
}
} else {
LiteWorldEdit.instance.reloadConfig();
LiteWorldEdit.config.reload();
LoggerX.info("已重载配置文件。");
}
}

View File

@ -87,7 +87,11 @@ public class GiteaReleaseCheck {
LoggerX.debug("HTML URL: " + latest_release.html_url);
if (isNewVersion(current_version, latest_release.tag_name)) {
LoggerX.info("发现新版本:" + latest_release.tag_name);
LoggerX.info("版本信息:" + latest_release.message);
LoggerX.info("版本信息:");
String[] message = latest_release.message.split("\n");
for (String line : message) {
LoggerX.info("\t" + line);
}
LoggerX.info("下载页面:" + latest_release.html_url);
} else {
LoggerX.info("当前已是最新版本:" + current_version);

View File

@ -1,10 +1,7 @@
package cn.lunadeer.liteworldedit.Jobs;
import cn.lunadeer.liteworldedit.LoggerX;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPlaceEvent;
@ -40,9 +37,23 @@ public class Absorb extends Job {
// 模拟海绵吸水事件
BlockPlaceEvent event = new BlockPlaceEvent(raw_block, raw_block.getState(), raw_block, new ItemStack(Material.SPONGE), _creator, true, null);
Bukkit.getPluginManager().callEvent(event);
// 获取玩家背包中的下届合金镐
HashMap<Integer, ?> pickaxes = getNetherPickaxes(_creator);
if (pickaxes.size() == 0) {
return JobErrCode.NO_PICKAXE;
}
ItemStack pickaxe = getUsableNetherPickaxe(pickaxes, _creator);
// 没有合适的镐
if (pickaxe == null) {
return JobErrCode.NOT_ENOUGH_DURATION;
}
if (!event.isCancelled()) {
raw_block.setType(Material.SPONGE);
raw_block.setType(Material.AIR);
// 损坏镐
if (!_creator.isOp() && _creator.getGameMode() != GameMode.CREATIVE) {
useNetherPickaxe(pickaxe);
}
return JobErrCode.OK;
} else {
return JobErrCode.NO_PERMISSION;

View File

@ -91,10 +91,12 @@ public class Job {
}
// 如果耐久小于10提示玩家
pickaxe_damage = (Damageable) pickaxe_meta;
if (!pickaxe_meta.isUnbreakable()) {
if (pickaxe_damage.getDamage() >= 2031 - 10) {
LoggerX.debug(index + " 下界合金镐耐久太低!");
continue;
}
}
pickaxe = p;
break;
}
@ -104,9 +106,13 @@ public class Job {
public static ItemStack useNetherPickaxe(ItemStack pickaxe) {
int durability = pickaxe.getEnchantmentLevel(Enchantment.DURABILITY);
double random = Math.random();
Damageable pickaxe_damage = (Damageable) pickaxe.getItemMeta();
if (pickaxe_damage.isUnbreakable()) {
// 无限耐久则不损坏
return pickaxe;
}
if (random < 1.0 / (durability + 1)) {
// 扣除耐久
Damageable pickaxe_damage = (Damageable) pickaxe.getItemMeta();
pickaxe_damage.setDamage(pickaxe_damage.getDamage() + 1);
pickaxe.setItemMeta(pickaxe_damage);
}

View File

@ -1,10 +1,7 @@
package cn.lunadeer.liteworldedit.Jobs;
import cn.lunadeer.liteworldedit.LoggerX;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.ShulkerBox;
import org.bukkit.entity.Player;
@ -75,7 +72,9 @@ public class Place extends Job {
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
raw_block.setType(_block);
if (!_creator.isOp() && _creator.getGameMode() != GameMode.CREATIVE) {
stack.setAmount(stack.getAmount() - 1);
}
return JobErrCode.OK;
} else {
return JobErrCode.NO_PERMISSION;

View File

@ -2,15 +2,13 @@ package cn.lunadeer.liteworldedit.Jobs;
import cn.lunadeer.liteworldedit.LiteWorldEdit;
import cn.lunadeer.liteworldedit.LoggerX;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import java.util.Collection;
import java.util.HashMap;
public class Remove extends Job {
@ -37,7 +35,7 @@ public class Remove extends Job {
}
// 获取玩家背包中的下届合金镐
HashMap<Integer, ?> pickaxes = getNetherPickaxes(_creator);
if (pickaxes.size() == 0) {
if (pickaxes.isEmpty()) {
return JobErrCode.NO_PICKAXE;
}
ItemStack pickaxe = getUsableNetherPickaxe(pickaxes, _creator);
@ -48,12 +46,17 @@ public class Remove extends Job {
BlockBreakEvent event = new BlockBreakEvent(raw_block, _creator);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Collection<ItemStack> drops = raw_block.getDrops(pickaxe, _creator);
raw_block.setType(Material.AIR);
if (LiteWorldEdit.instance.getConfigMgr().isDropItems()) {
raw_block.getWorld().dropItemNaturally(raw_block.getLocation(), new ItemStack(raw_block.getType()));
for (ItemStack drop : drops) {
raw_block.getWorld().dropItemNaturally(raw_block.getLocation(), drop);
}
}
// 损坏镐
if (!_creator.isOp() && _creator.getGameMode() != GameMode.CREATIVE) {
useNetherPickaxe(pickaxe);
}
return JobErrCode.OK;
} else {
return JobErrCode.NO_PERMISSION;

View File

@ -2,6 +2,11 @@ package cn.lunadeer.liteworldedit;
import cn.lunadeer.liteworldedit.Jobs.Job;
import cn.lunadeer.liteworldedit.Jobs.JobErrCode;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.entity.Player;
public class Task implements Runnable {
@ -40,7 +45,8 @@ public class Task implements Runnable {
}
Player player = job.get_creator();
if (re.canContinue()) {
Notification.titleWarn(player, "警告", re.getMessage());
TextComponent warn = Component.text("警告:" + re.getMessage(), Style.style(TextColor.color(TextColor.color(255, 185, 69)), TextDecoration.BOLD));
player.sendActionBar(warn);
job = this.xPlayer.popJob();
if (job == null) {
return;

View File

@ -12,4 +12,10 @@ commands:
LiteWorldEdit:
description: 简易创世神命令
usage: /lwe <cmd>
aliases: [lwe]
aliases: [ lwe ]
permission: lwe.command
permission-message: 你没有权限使用这个命令。
permissions:
lwe.command:
description: 是否允许使用 LiteWorldEdit
default: true