新增附魔书堆叠
Some checks failed
Java CI-CD with Maven / build (push) Failing after 1h5m42s

This commit is contained in:
zhangyuheng 2024-03-19 00:29:53 +08:00
parent 1040899676
commit ca5e2d943f
5 changed files with 41 additions and 3 deletions

View File

@ -68,6 +68,14 @@ EssentialsX其中D代表Deer。
使用 `enderchest` 可以快速打开末影箱。
### 9. 附魔书堆叠
使用两本书可以合成堆叠为2的附魔书
![](https://ssl.lunadeer.cn:14437/i/2024/03/19/65f86b5f25303.png)
此种特殊堆叠可以用于实现大吸力漏斗等特殊效果(详情可自行搜索学习)。
## 管理员指南
### 1. 无敌模式

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId>
<version>1.8.0</version>
<version>1.9.1</version>
<packaging>jar</packaging>
<name>EssentialsD</name>

View File

@ -4,6 +4,7 @@ import cn.lunadeer.essentialsd.commands.*;
import cn.lunadeer.essentialsd.recipes.Crowbar;
import cn.lunadeer.essentialsd.recipes.InvisibleGlowItemFrame;
import cn.lunadeer.essentialsd.recipes.InvisibleItemFrame;
import cn.lunadeer.essentialsd.recipes.StackedEnchantBook;
import cn.lunadeer.essentialsd.utils.ConfigManager;
import cn.lunadeer.essentialsd.utils.XLogger;
import org.bukkit.Bukkit;
@ -39,6 +40,7 @@ public final class EssentialsD extends JavaPlugin {
this.getServer().addRecipe(InvisibleItemFrame.getRecipe());
this.getServer().addRecipe(InvisibleGlowItemFrame.getRecipe());
this.getServer().addRecipe(Crowbar.getRecipe());
this.getServer().addRecipe(StackedEnchantBook.getRecipe());
XLogger.info("EssentialsD 已加载");
XLogger.info("版本: " + getPluginMeta().getVersion());

View File

@ -5,6 +5,7 @@ import cn.lunadeer.essentialsd.recipes.Crowbar;
import cn.lunadeer.essentialsd.recipes.InvisibleGlowItemFrame;
import cn.lunadeer.essentialsd.recipes.InvisibleItemFrame;
import cn.lunadeer.essentialsd.utils.Notification;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
@ -16,6 +17,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ExpBottleEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
@ -27,6 +29,8 @@ import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataType;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class Events implements Listener {
@ -185,9 +189,9 @@ public class Events implements Listener {
// on throw ExpBottle set multiplier for ExpBottle
@EventHandler(priority = EventPriority.HIGHEST)
public void onExpBottleUsage(ExpBottleEvent event){
public void onExpBottleUsage(ExpBottleEvent event) {
int exp = event.getExperience();
if (exp < 0){
if (exp < 0) {
event.setExperience(0);
}
event.setExperience((int) (exp * EssentialsD.config.getExpBottleRatio()));

View File

@ -0,0 +1,24 @@
package cn.lunadeer.essentialsd.recipes;
import cn.lunadeer.essentialsd.EssentialsD;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapelessRecipe;
public class StackedEnchantBook {
public static ShapelessRecipe getRecipe() {
NamespacedKey key = new NamespacedKey(EssentialsD.instance, "two_curse_of_vanishing_books");
ItemStack item = stackedEnchantBook();
ShapelessRecipe recipe = new ShapelessRecipe(key, item);
recipe.addIngredient(Material.BOOK);
recipe.addIngredient(Material.BOOK);
return recipe;
}
public static ItemStack stackedEnchantBook() {
return new ItemStack(Material.ENCHANTED_BOOK, 2);
}
}