mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
1.0
This commit is contained in:
@@ -215,59 +215,44 @@ public class ConfigReader{
|
|||||||
YamlConfiguration config = getConfig("loots.yml");
|
YamlConfiguration config = getConfig("loots.yml");
|
||||||
Set<String> keys = Objects.requireNonNull(config.getConfigurationSection("items")).getKeys(false);
|
Set<String> keys = Objects.requireNonNull(config.getConfigurationSection("items")).getKeys(false);
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
/*
|
|
||||||
必设置的内容,为构造所需
|
|
||||||
*/
|
|
||||||
String name;
|
|
||||||
if (config.contains("items." + key + ".display.name")) {
|
|
||||||
name = config.getString("items." + key + ".display.name");
|
|
||||||
} else {
|
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的物品名称!</red>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Difficulty difficulty;
|
Difficulty difficulty;
|
||||||
if (config.contains("items." + key + ".difficulty")) {
|
if (config.contains("items." + key + ".difficulty")) {
|
||||||
String[] split = StringUtils.split(config.getString("items." + key + ".difficulty"), "-");
|
String[] split = StringUtils.split(config.getString("items." + key + ".difficulty"), "-");
|
||||||
assert split != null;
|
assert split != null;
|
||||||
if (Integer.parseInt(split[1]) <= 0 || Integer.parseInt(split[0]) <= 0){
|
if (Integer.parseInt(split[1]) <= 0 || Integer.parseInt(split[0]) <= 0){
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! " + key + " 的捕获难度必须为正整数与正整数的组合!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! " + key + " has wrong difficulty format!</red>");
|
||||||
return;
|
return;
|
||||||
}else {
|
}else {
|
||||||
difficulty = new Difficulty(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
difficulty = new Difficulty(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的捕获难度!</red>");
|
difficulty = new Difficulty(1, 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
int weight;
|
int weight;
|
||||||
if (config.contains("items." + key + ".weight")) {
|
if (config.contains("items." + key + ".weight")) {
|
||||||
weight = config.getInt("items." + key + ".weight");
|
weight = config.getInt("items." + key + ".weight");
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的捕获权重!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No weight set for " + key + " !</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int time;
|
int time;
|
||||||
if (config.contains("items." + key + ".time")) {
|
if (config.contains("items." + key + ".time")) {
|
||||||
time = config.getInt("items." + key + ".time");
|
time = config.getInt("items." + key + ".time");
|
||||||
if (time <= 0){
|
if (time <= 0){
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! " + key + " 的捕捉时间必须为正整数!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! " + key + " time must be positive!</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的捕捉时间!</red>");
|
time = 10000;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//新建单例
|
Loot loot = new Loot(key, difficulty, weight, time);
|
||||||
Loot loot = new Loot(key, name, difficulty, weight, time);
|
|
||||||
|
|
||||||
/*
|
|
||||||
必须设置的内容,但并非构造所需
|
|
||||||
*/
|
|
||||||
if (config.contains("items." + key + ".material")) {
|
if (config.contains("items." + key + ".material")) {
|
||||||
loot.setMaterial(config.getString("items." + key + ".material"));
|
loot.setMaterial(config.getString("items." + key + ".material"));
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的物品材质!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No material set for " + key + " !</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -275,6 +260,8 @@ public class ConfigReader{
|
|||||||
*/
|
*/
|
||||||
if (config.contains("items." + key + ".display.lore"))
|
if (config.contains("items." + key + ".display.lore"))
|
||||||
loot.setLore(config.getStringList("items." + key + ".display.lore"));
|
loot.setLore(config.getStringList("items." + key + ".display.lore"));
|
||||||
|
if (config.contains("items." + key + ".display.name"))
|
||||||
|
loot.setName(config.getString("items." + key + ".display.name"));
|
||||||
if (config.contains("items." + key + ".enchantments")) {
|
if (config.contains("items." + key + ".enchantments")) {
|
||||||
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
||||||
config.getStringList("items." + key + ".enchantments").forEach(enchant -> {
|
config.getStringList("items." + key + ".enchantments").forEach(enchant -> {
|
||||||
@@ -292,13 +279,15 @@ public class ConfigReader{
|
|||||||
loot.setItemFlags(arrayList);
|
loot.setItemFlags(arrayList);
|
||||||
}
|
}
|
||||||
if (config.contains("items." + key + ".nbt"))
|
if (config.contains("items." + key + ".nbt"))
|
||||||
loot.setNbt(config.getMapList("items." + key + ".nbt").get(0));
|
loot.setNbt((Map<String, Object>) config.getMapList("items." + key + ".nbt").get(0));
|
||||||
|
if (config.contains("items." + key + ".custom-model-data"))
|
||||||
|
loot.setCustommodeldata(config.getInt("items." + key + ".custom-model-data"));
|
||||||
if (config.contains("items."+ key +".nick")){
|
if (config.contains("items."+ key +".nick")){
|
||||||
loot.setNick(config.getString("items."+key+".nick"));
|
loot.setNick(config.getString("items."+key+".nick"));
|
||||||
}else {
|
}else {
|
||||||
loot.setNick(loot.getName());
|
loot.setNick(loot.getName());
|
||||||
}
|
}
|
||||||
|
loot.setUnbreakable(config.getBoolean("items." + key + ".unbreakable",false));
|
||||||
|
|
||||||
if (config.contains("items." + key + ".action.message"))
|
if (config.contains("items." + key + ".action.message"))
|
||||||
loot.setMsg(config.getString("items." + key + ".action.message"));
|
loot.setMsg(config.getString("items." + key + ".action.message"));
|
||||||
@@ -328,7 +317,7 @@ public class ConfigReader{
|
|||||||
if (Config.season){
|
if (Config.season){
|
||||||
requirements.add(new Season(config.getStringList("items." + key + ".requirements.season")));
|
requirements.add(new Season(config.getStringList("items." + key + ".requirements.season")));
|
||||||
}else {
|
}else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 使用季节特性请先在 config.yml 中启用季节特性!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Plz enable season in config.yml!</red>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "world" -> requirements.add(new World(config.getStringList("items." + key + ".requirements.world")));
|
case "world" -> requirements.add(new World(config.getStringList("items." + key + ".requirements.world")));
|
||||||
@@ -338,7 +327,7 @@ public class ConfigReader{
|
|||||||
if (Config.wg){
|
if (Config.wg){
|
||||||
requirements.add(new Region(config.getStringList("items." + key + ".requirements.regions")));
|
requirements.add(new Region(config.getStringList("items." + key + ".requirements.regions")));
|
||||||
}else {
|
}else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 指定钓鱼区域需要启用 WorldGuard 兼容!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Plz enable WorldGuard Integration!</red>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "time" -> requirements.add(new Time(config.getStringList("items." + key + ".requirements.time")));
|
case "time" -> requirements.add(new Time(config.getStringList("items." + key + ".requirements.time")));
|
||||||
@@ -361,7 +350,7 @@ public class ConfigReader{
|
|||||||
if (config.contains("mobs." + key + ".name")) {
|
if (config.contains("mobs." + key + ".name")) {
|
||||||
name = config.getString("mobs." + key + ".name");
|
name = config.getString("mobs." + key + ".name");
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的怪物名称!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No name set for mob " + key + " !</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Difficulty difficulty;
|
Difficulty difficulty;
|
||||||
@@ -369,42 +358,40 @@ public class ConfigReader{
|
|||||||
String[] split = StringUtils.split(config.getString("mobs." + key + ".difficulty"), "-");
|
String[] split = StringUtils.split(config.getString("mobs." + key + ".difficulty"), "-");
|
||||||
assert split != null;
|
assert split != null;
|
||||||
if (Integer.parseInt(split[1]) <= 0 || Integer.parseInt(split[0]) <= 0){
|
if (Integer.parseInt(split[1]) <= 0 || Integer.parseInt(split[0]) <= 0){
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! " + key + " 的捕获难度必须为正整数与正整数的组合!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! " + key + " has wrong difficulty format!</red>");
|
||||||
return;
|
return;
|
||||||
}else {
|
}else {
|
||||||
difficulty = new Difficulty(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
difficulty = new Difficulty(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的捕获难度!</red>");
|
difficulty = new Difficulty(1, 1);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
int weight;
|
int weight;
|
||||||
if (config.contains("mobs." + key + ".weight")) {
|
if (config.contains("mobs." + key + ".weight")) {
|
||||||
weight = config.getInt("mobs." + key + ".weight");
|
weight = config.getInt("mobs." + key + ".weight");
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的捕获权重!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No weight set for " + key + " !</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int time;
|
int time;
|
||||||
if (config.contains("mobs." + key + ".time")) {
|
if (config.contains("mobs." + key + ".time")) {
|
||||||
time = config.getInt("mobs." + key + ".time");
|
time = config.getInt("mobs." + key + ".time");
|
||||||
if (time <= 0){
|
if (time <= 0){
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! " + key + " 的捕捉时间必须为正整数!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! " + key + " time must be positive!</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的捕捉时间!</red>");
|
time = 10000;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
//新建单例
|
//新建单例
|
||||||
Loot loot = new Loot(key, name, difficulty, weight, time);
|
Loot loot = new Loot(key, difficulty, weight, time);
|
||||||
//设置昵称
|
//设置昵称
|
||||||
loot.setNick(name);
|
loot.setNick(name);
|
||||||
//设置MM怪ID
|
//设置MM怪ID
|
||||||
if (config.contains("mobs." + key + ".mythicmobsID")) {
|
if (config.contains("mobs." + key + ".mythicmobsID")) {
|
||||||
loot.setMm(config.getString("mobs." + key + ".mythicmobsID"));
|
loot.setMm(config.getString("mobs." + key + ".mythicmobsID"));
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的MM怪ID!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No MythicMobs id set for " + key + " !</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//设置MM怪位移
|
//设置MM怪位移
|
||||||
@@ -444,7 +431,7 @@ public class ConfigReader{
|
|||||||
if (Config.season){
|
if (Config.season){
|
||||||
requirements.add(new Season(config.getStringList("mobs." + key + ".requirements.season")));
|
requirements.add(new Season(config.getStringList("mobs." + key + ".requirements.season")));
|
||||||
}else {
|
}else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 使用季节特性请先在 config.yml 中启用季节特性!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Plz enable season in config.yml!</red>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "world" -> requirements.add(new World(config.getStringList("mobs." + key + ".requirements.world")));
|
case "world" -> requirements.add(new World(config.getStringList("mobs." + key + ".requirements.world")));
|
||||||
@@ -454,7 +441,7 @@ public class ConfigReader{
|
|||||||
if (Config.wg){
|
if (Config.wg){
|
||||||
requirements.add(new Region(config.getStringList("mobs." + key + ".requirements.regions")));
|
requirements.add(new Region(config.getStringList("mobs." + key + ".requirements.regions")));
|
||||||
}else {
|
}else {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 指定钓鱼区域需要启用 WorldGuard 兼容!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Plz enable WorldGuard Integration!</red>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "time" -> requirements.add(new Time(config.getStringList("mobs." + key + ".requirements.time")));
|
case "time" -> requirements.add(new Time(config.getStringList("mobs." + key + ".requirements.time")));
|
||||||
@@ -466,7 +453,7 @@ public class ConfigReader{
|
|||||||
LOOT.put(key, loot);
|
LOOT.put(key, loot);
|
||||||
});
|
});
|
||||||
if (keys.size() != LOOTITEM.size() || mobs.size() != LOOT.size()- LOOTITEM.size()) {
|
if (keys.size() != LOOTITEM.size() || mobs.size() != LOOT.size()- LOOTITEM.size()) {
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] loots.yml 文件存在配置错误!</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] loots.yml exists error!</red>");
|
||||||
} else {
|
} else {
|
||||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><white>" + keys.size() + " <color:#E1FFFF>loots loaded!");
|
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><white>" + keys.size() + " <color:#E1FFFF>loots loaded!");
|
||||||
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><white>" + mobs.size() + " <color:#E1FFFF>mobs loaded!");
|
AdventureManager.consoleMessage("<gradient:#0070B3:#A0EACF>[CustomFishing] </gradient><white>" + mobs.size() + " <color:#E1FFFF>mobs loaded!");
|
||||||
@@ -494,13 +481,7 @@ public class ConfigReader{
|
|||||||
/*
|
/*
|
||||||
必设置的内容,为构造所需
|
必设置的内容,为构造所需
|
||||||
*/
|
*/
|
||||||
String name;
|
|
||||||
if (config.contains("utils." + key + ".display.name")) {
|
|
||||||
name = config.getString("utils." + key + ".display.name");
|
|
||||||
} else {
|
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No name set for " + key + " !</red>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String material;
|
String material;
|
||||||
if (config.contains("utils." + key + ".material")) {
|
if (config.contains("utils." + key + ".material")) {
|
||||||
material = config.getString("utils." + key + ".material");
|
material = config.getString("utils." + key + ".material");
|
||||||
@@ -509,12 +490,16 @@ public class ConfigReader{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Util utilInstance = new Util(key, name, material);
|
Util utilInstance = new Util(material);
|
||||||
|
if (config.contains("utils." + key + ".custom-model-data"))
|
||||||
|
utilInstance.setCustommodeldata(config.getInt("utils." + key + ".custom-model-data"));
|
||||||
|
if (config.contains("utils." + key + ".display.name"))
|
||||||
|
utilInstance.setName(config.getString("utils." + key + ".display.name"));
|
||||||
if (config.contains("utils." + key + ".display.lore"))
|
if (config.contains("utils." + key + ".display.lore"))
|
||||||
utilInstance.setLore(config.getStringList("utils." + key + ".display.lore"));
|
utilInstance.setLore(config.getStringList("utils." + key + ".display.lore"));
|
||||||
if (config.contains("utils." + key + ".nbt"))
|
if (config.contains("utils." + key + ".nbt"))
|
||||||
utilInstance.setNbt(config.getMapList("utils." + key + ".nbt").get(0));
|
utilInstance.setNbt((Map<String, Object>) config.getMapList("utils." + key + ".nbt").get(0));
|
||||||
|
utilInstance.setUnbreakable(config.getBoolean("utils." + key + ".unbreakable",false));
|
||||||
if (config.contains("utils." + key + ".enchantments")) {
|
if (config.contains("utils." + key + ".enchantments")) {
|
||||||
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
||||||
config.getStringList("utils." + key + ".enchantments").forEach(enchant -> {
|
config.getStringList("utils." + key + ".enchantments").forEach(enchant -> {
|
||||||
@@ -531,6 +516,7 @@ public class ConfigReader{
|
|||||||
});
|
});
|
||||||
utilInstance.setItemFlags(arrayList);
|
utilInstance.setItemFlags(arrayList);
|
||||||
}
|
}
|
||||||
|
|
||||||
UTIL.put(key, utilInstance);
|
UTIL.put(key, utilInstance);
|
||||||
UTILITEM.put(key, NBTUtil.addIdentifier(ItemStackGenerator.fromItem(utilInstance), "util", key));
|
UTILITEM.put(key, NBTUtil.addIdentifier(ItemStackGenerator.fromItem(utilInstance), "util", key));
|
||||||
});
|
});
|
||||||
@@ -553,20 +539,16 @@ public class ConfigReader{
|
|||||||
Set<String> keys = Objects.requireNonNull(config.getConfigurationSection("rods")).getKeys(false);
|
Set<String> keys = Objects.requireNonNull(config.getConfigurationSection("rods")).getKeys(false);
|
||||||
|
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
String name;
|
Rod rodInstance = new Rod();
|
||||||
if (config.contains("rods." + key + ".display.name")) {
|
if (config.contains("rods." + key + ".display.name"))
|
||||||
name = config.getString("rods." + key + ".display.name");
|
rodInstance.setName(config.getString("rods." + key + ".display.name"));
|
||||||
} else {
|
if (config.contains("rods." + key + ".display.lore"))
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 错误! 未设置 " + key + " 的物品名称!</red>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Rod rodInstance = new Rod(name);
|
|
||||||
if (config.contains("rods." + key + ".display.lore")) {
|
|
||||||
rodInstance.setLore(config.getStringList("rods." + key + ".display.lore"));
|
rodInstance.setLore(config.getStringList("rods." + key + ".display.lore"));
|
||||||
}
|
if (config.contains("rods." + key + ".nbt"))
|
||||||
if (config.contains("rods." + key + ".nbt")) {
|
rodInstance.setNbt((Map<String, Object>)(config.getMapList("rods." + key + ".nbt").get(0)));
|
||||||
rodInstance.setNbt(config.getMapList("rods." + key + ".nbt").get(0));
|
if (config.contains("rods." + key + ".custom-model-data"))
|
||||||
}
|
rodInstance.setCustommodeldata(config.getInt("rods." + key + ".custom-model-data"));
|
||||||
|
rodInstance.setUnbreakable(config.getBoolean("rods." + key + ".unbreakable",false));
|
||||||
if (config.contains("rods." + key + ".enchantments")) {
|
if (config.contains("rods." + key + ".enchantments")) {
|
||||||
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
||||||
config.getStringList("rods." + key + ".enchantments").forEach(enchant -> {
|
config.getStringList("rods." + key + ".enchantments").forEach(enchant -> {
|
||||||
@@ -626,13 +608,6 @@ public class ConfigReader{
|
|||||||
Set<String> keys = config.getConfigurationSection("baits").getKeys(false);
|
Set<String> keys = config.getConfigurationSection("baits").getKeys(false);
|
||||||
|
|
||||||
keys.forEach(key -> {
|
keys.forEach(key -> {
|
||||||
String name;
|
|
||||||
if (config.contains("baits." + key + ".display.name")) {
|
|
||||||
name = config.getString("baits." + key + ".display.name");
|
|
||||||
} else {
|
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No name set for " + key + " !</red>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String material;
|
String material;
|
||||||
if (config.contains("baits." + key + ".material")) {
|
if (config.contains("baits." + key + ".material")) {
|
||||||
material = config.getString("baits." + key + ".material");
|
material = config.getString("baits." + key + ".material");
|
||||||
@@ -640,13 +615,17 @@ public class ConfigReader{
|
|||||||
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No material set for " + key + " !</red>");
|
AdventureManager.consoleMessage("<red>[CustomFishing] Error! No material set for " + key + " !</red>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bait baitInstance = new Bait(name, material);
|
Bait baitInstance = new Bait(material);
|
||||||
if (config.contains("baits." + key + ".display.lore")) {
|
if (config.contains("baits." + key + ".display.lore"))
|
||||||
baitInstance.setLore(config.getStringList("baits." + key + ".display.lore"));
|
baitInstance.setLore(config.getStringList("baits." + key + ".display.lore"));
|
||||||
}
|
if (config.contains("baits." + key + ".display.name"))
|
||||||
|
baitInstance.setName(config.getString("baits." + key + ".display.name"));
|
||||||
|
if (config.contains("baits." + key + ".custom-model-data"))
|
||||||
|
baitInstance.setCustommodeldata(config.getInt("baits." + key + ".custom-model-data"));
|
||||||
if (config.contains("baits." + key + ".nbt")) {
|
if (config.contains("baits." + key + ".nbt")) {
|
||||||
baitInstance.setNbt(config.getMapList("baits." + key + ".nbt").get(0));
|
baitInstance.setNbt((Map<String, Object>) config.getMapList("baits." + key + ".nbt").get(0));
|
||||||
}
|
}
|
||||||
|
baitInstance.setUnbreakable(config.getBoolean("baits." + key + ".unbreakable",false));
|
||||||
if (config.contains("baits." + key + ".enchantments")) {
|
if (config.contains("baits." + key + ".enchantments")) {
|
||||||
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
ArrayList<Enchantment> arrayList = new ArrayList<>();
|
||||||
config.getStringList("baits." + key + ".enchantments").forEach(enchant -> {
|
config.getStringList("baits." + key + ".enchantments").forEach(enchant -> {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class Layout {
|
|||||||
public void setStart(String start) {this.start = start;}
|
public void setStart(String start) {this.start = start;}
|
||||||
public void setTitle(String title) {this.title = title;}
|
public void setTitle(String title) {this.title = title;}
|
||||||
|
|
||||||
public String getKey(){return this.key;}
|
|
||||||
public int getRange(){return this.range;}
|
public int getRange(){return this.range;}
|
||||||
public double[] getSuccessRate(){return this.successRate;}
|
public double[] getSuccessRate(){return this.successRate;}
|
||||||
public int getSize(){return this.size;}
|
public int getSize(){return this.size;}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.momirealms.customfishing.item.Bait;
|
|||||||
import net.momirealms.customfishing.item.Loot;
|
import net.momirealms.customfishing.item.Loot;
|
||||||
import net.momirealms.customfishing.item.Rod;
|
import net.momirealms.customfishing.item.Rod;
|
||||||
import net.momirealms.customfishing.item.Util;
|
import net.momirealms.customfishing.item.Util;
|
||||||
|
import net.momirealms.customfishing.utils.SaveItem;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -18,17 +19,17 @@ public class Execute implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
//没有权限的快走啦
|
|
||||||
if (!(sender.hasPermission("customfishing.admin") || sender.isOp())) {
|
if (!(sender.hasPermission("customfishing.admin") || sender.isOp())) {
|
||||||
AdventureManager.playerMessage((Player) sender,ConfigReader.Message.prefix + ConfigReader.Message.noPerm);
|
AdventureManager.playerMessage((Player) sender,ConfigReader.Message.prefix + ConfigReader.Message.noPerm);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//参数打不全的赶紧走开
|
|
||||||
if (args.length < 1){
|
if (args.length < 1){
|
||||||
lackArgs(sender);
|
lackArgs(sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//重载命令
|
|
||||||
if (args[0].equalsIgnoreCase("reload")) {
|
if (args[0].equalsIgnoreCase("reload")) {
|
||||||
ConfigReader.Reload();
|
ConfigReader.Reload();
|
||||||
if (sender instanceof Player){
|
if (sender instanceof Player){
|
||||||
@@ -38,7 +39,18 @@ public class Execute implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//获取物品命令
|
|
||||||
|
if (args[0].equalsIgnoreCase("export")) {
|
||||||
|
if (args.length < 2){
|
||||||
|
lackArgs(sender);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (sender instanceof Player player){
|
||||||
|
SaveItem.saveToFile(player.getInventory().getItemInMainHand(), args[1]);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("items")) {
|
if (args[0].equalsIgnoreCase("items")) {
|
||||||
if (args.length < 4){
|
if (args.length < 4){
|
||||||
lackArgs(sender);
|
lackArgs(sender);
|
||||||
|
|||||||
@@ -15,17 +15,20 @@ public class TabComplete implements TabCompleter {
|
|||||||
@Override
|
@Override
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
//没有权限还想补全?
|
|
||||||
if (!(sender.hasPermission("customfishing.admin") || sender.isOp())) {
|
if (!(sender.hasPermission("customfishing.admin") || sender.isOp())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (args.length == 1){
|
if (args.length == 1){
|
||||||
return Arrays.asList("reload","items");
|
return Arrays.asList("reload","items","export");
|
||||||
}
|
}
|
||||||
if (args.length == 2){
|
if (args.length == 2){
|
||||||
if (args[0].equalsIgnoreCase("items")){
|
if (args[0].equalsIgnoreCase("items")){
|
||||||
return Arrays.asList("loot","bait","rod","util");
|
return Arrays.asList("loot","bait","rod","util");
|
||||||
}
|
}
|
||||||
|
if (args[0].equalsIgnoreCase("export")){
|
||||||
|
return List.of("FileName");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (args.length == 3){
|
if (args.length == 3){
|
||||||
if (args[0].equalsIgnoreCase("items")){
|
if (args[0].equalsIgnoreCase("items")){
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ public final class LibraryLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void load(Dependency d) {
|
public static void load(Dependency d) {
|
||||||
//Log.info(String.format("Loading dependency %s:%s:%s from %s", d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getRepoUrl()));
|
|
||||||
String name = d.getArtifactId() + "-" + d.getVersion();
|
String name = d.getArtifactId() + "-" + d.getVersion();
|
||||||
|
|
||||||
File saveLocation = new File(getLibFolder(d), name + ".jar");
|
File saveLocation = new File(getLibFolder(d), name + ".jar");
|
||||||
if (!saveLocation.exists()) {
|
if (!saveLocation.exists()) {
|
||||||
|
|
||||||
@@ -100,13 +98,13 @@ public final class LibraryLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!saveLocation.exists()) {
|
if (!saveLocation.exists()) {
|
||||||
throw new RuntimeException("Unable to download dependency: " + d.toString());
|
throw new RuntimeException("Unable to download dependency: " + d);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URL_INJECTOR.get().addURL(saveLocation.toURI().toURL());
|
URL_INJECTOR.get().addURL(saveLocation.toURI().toURL());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Unable to load dependency: " + saveLocation.toString(), e);
|
throw new RuntimeException("Unable to load dependency: " + saveLocation, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Bait implements Item{
|
public class Bait implements Item{
|
||||||
|
|
||||||
private final String name;
|
private String name;
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
private Map<?, ?> nbt;
|
private Map<String,Object> nbt;
|
||||||
private HashMap<String, Double> weightMQ;
|
private HashMap<String, Double> weightMQ;
|
||||||
private HashMap<String, Integer> weightPM;
|
private HashMap<String, Integer> weightPM;
|
||||||
private double time;
|
private double time;
|
||||||
@@ -22,9 +22,10 @@ public class Bait implements Item{
|
|||||||
private final String material;
|
private final String material;
|
||||||
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
||||||
private List<ItemFlag> itemFlags;
|
private List<ItemFlag> itemFlags;
|
||||||
|
private int custommodeldata;
|
||||||
|
private boolean unbreakable;
|
||||||
|
|
||||||
public Bait(String name, String material) {
|
public Bait(String material) {
|
||||||
this.name = name;
|
|
||||||
this.material = material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,15 +36,18 @@ public class Bait implements Item{
|
|||||||
player.getInventory().addItem(itemStack);
|
player.getInventory().addItem(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {this.name = name;}
|
||||||
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
||||||
public void setDifficulty(int difficulty) {this.difficulty = difficulty;}
|
public void setDifficulty(int difficulty) {this.difficulty = difficulty;}
|
||||||
public void setNbt(Map<?, ?> nbt) {this.nbt = nbt;}
|
public void setNbt(Map<String,Object> nbt) {this.nbt = nbt;}
|
||||||
public void setLore(List<String> lore) {this.lore = lore;}
|
public void setLore(List<String> lore) {this.lore = lore;}
|
||||||
public void setTime(double time) {this.time = time;}
|
public void setTime(double time) {this.time = time;}
|
||||||
public void setWeightMQ(HashMap<String, Double> weightMQ) {this.weightMQ = weightMQ;}
|
public void setWeightMQ(HashMap<String, Double> weightMQ) {this.weightMQ = weightMQ;}
|
||||||
public void setWeightPM(HashMap<String, Integer> weightPM) {this.weightPM = weightPM;}
|
public void setWeightPM(HashMap<String, Integer> weightPM) {this.weightPM = weightPM;}
|
||||||
public void setDoubleLoot(double doubleLoot) {this.doubleLoot = doubleLoot;}
|
public void setDoubleLoot(double doubleLoot) {this.doubleLoot = doubleLoot;}
|
||||||
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
||||||
|
public void setCustommodeldata(int custommodeldata){this.custommodeldata = custommodeldata;}
|
||||||
|
public void setUnbreakable(boolean unbreakable){this.unbreakable = unbreakable;}
|
||||||
|
|
||||||
public double getDoubleLoot() {return this.doubleLoot;}
|
public double getDoubleLoot() {return this.doubleLoot;}
|
||||||
public int getDifficulty() {return difficulty;}
|
public int getDifficulty() {return difficulty;}
|
||||||
@@ -51,10 +55,14 @@ public class Bait implements Item{
|
|||||||
public HashMap<String, Double> getWeightMQ() {return weightMQ;}
|
public HashMap<String, Double> getWeightMQ() {return weightMQ;}
|
||||||
public HashMap<String, Integer> getWeightPM() {return weightPM;}
|
public HashMap<String, Integer> getWeightPM() {return weightPM;}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnbreakable() {return this.unbreakable;}
|
||||||
|
@Override
|
||||||
|
public int getCustomModelData() {return this.custommodeldata;}
|
||||||
@Override
|
@Override
|
||||||
public List<String> getLore() {return lore;}
|
public List<String> getLore() {return lore;}
|
||||||
@Override
|
@Override
|
||||||
public Map<?, ?> getNbt() {return nbt;}
|
public Map<String,Object> getNbt() {return nbt;}
|
||||||
@Override
|
@Override
|
||||||
public String getMaterial() {return this.material;}
|
public String getMaterial() {return this.material;}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package net.momirealms.customfishing.item;
|
|||||||
|
|
||||||
import net.momirealms.customfishing.utils.Enchantment;
|
import net.momirealms.customfishing.utils.Enchantment;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -13,5 +12,7 @@ public interface Item {
|
|||||||
List<ItemFlag> getItemFlags();
|
List<ItemFlag> getItemFlags();
|
||||||
String getName();
|
String getName();
|
||||||
List<String> getLore();
|
List<String> getLore();
|
||||||
Map<?, ?> getNbt();
|
Map<String,Object> getNbt();
|
||||||
|
int getCustomModelData();
|
||||||
|
boolean isUnbreakable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import java.util.*;
|
|||||||
public class Loot implements Item {
|
public class Loot implements Item {
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
private final String name;
|
private String name;
|
||||||
private String nick;
|
private String nick;
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
private Map<?, ?> nbt;
|
private Map<String,Object> nbt;
|
||||||
private String material;
|
private String material;
|
||||||
private String msg;
|
private String msg;
|
||||||
private String mm;
|
private String mm;
|
||||||
@@ -33,10 +33,11 @@ public class Loot implements Item {
|
|||||||
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
||||||
private List<ItemFlag> itemFlags;
|
private List<ItemFlag> itemFlags;
|
||||||
private boolean showInFinder;
|
private boolean showInFinder;
|
||||||
|
private int custommodeldata;
|
||||||
|
private boolean unbreakable;
|
||||||
|
|
||||||
public Loot(String key, String name, Difficulty difficulty, int weight, int time){
|
public Loot(String key, Difficulty difficulty, int weight, int time){
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.name = name;
|
|
||||||
this.difficulty = difficulty;
|
this.difficulty = difficulty;
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
@@ -69,11 +70,16 @@ public class Loot implements Item {
|
|||||||
@Override
|
@Override
|
||||||
public List<ItemFlag> getItemFlags() {return this.itemFlags;}
|
public List<ItemFlag> getItemFlags() {return this.itemFlags;}
|
||||||
@Override
|
@Override
|
||||||
public Map<?, ?> getNbt(){return this.nbt;}
|
public Map<String,Object> getNbt(){return this.nbt;}
|
||||||
|
@Override
|
||||||
|
public int getCustomModelData() {return this.custommodeldata;}
|
||||||
|
@Override
|
||||||
|
public boolean isUnbreakable() {return this.unbreakable;}
|
||||||
|
|
||||||
|
public void setName(String name) {this.name = name;}
|
||||||
public void setShowInFinder(boolean showInFinder) {this.showInFinder = showInFinder;}
|
public void setShowInFinder(boolean showInFinder) {this.showInFinder = showInFinder;}
|
||||||
public void setLore(List<String> lore){this.lore = lore;}
|
public void setLore(List<String> lore){this.lore = lore;}
|
||||||
public void setNbt(Map<?, ?> nbt){this.nbt = nbt;}
|
public void setNbt(Map<String,Object> nbt){this.nbt = nbt;}
|
||||||
public void setRequirements(List<Requirement> requirements) {this.requirements = requirements;}
|
public void setRequirements(List<Requirement> requirements) {this.requirements = requirements;}
|
||||||
public void setMaterial(String material){this.material = material;}
|
public void setMaterial(String material){this.material = material;}
|
||||||
public void setNick(String nick){this.nick = nick;}
|
public void setNick(String nick){this.nick = nick;}
|
||||||
@@ -87,6 +93,8 @@ public class Loot implements Item {
|
|||||||
public void setExp(int exp) {this.exp = exp;}
|
public void setExp(int exp) {this.exp = exp;}
|
||||||
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
||||||
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
||||||
|
public void setCustommodeldata(int custommodeldata){this.custommodeldata = custommodeldata;}
|
||||||
|
public void setUnbreakable(boolean unbreakable){this.unbreakable = unbreakable;}
|
||||||
|
|
||||||
public static void givePlayerLoot(Player player, String lootKey, int amount){
|
public static void givePlayerLoot(Player player, String lootKey, int amount){
|
||||||
ItemStack itemStack = ConfigReader.LOOTITEM.get(lootKey);
|
ItemStack itemStack = ConfigReader.LOOTITEM.get(lootKey);
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Rod implements Item{
|
public class Rod implements Item{
|
||||||
|
|
||||||
private final String name;
|
private String name;
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
private Map<?, ?> nbt;
|
private Map<String,Object> nbt;
|
||||||
private HashMap<String, Double> weightMQ;
|
private HashMap<String, Double> weightMQ;
|
||||||
private HashMap<String, Integer> weightPM;
|
private HashMap<String, Integer> weightPM;
|
||||||
private double time;
|
private double time;
|
||||||
@@ -22,10 +22,8 @@ public class Rod implements Item{
|
|||||||
private double doubleLoot;
|
private double doubleLoot;
|
||||||
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
||||||
private List<ItemFlag> itemFlags;
|
private List<ItemFlag> itemFlags;
|
||||||
|
private int custommodeldata;
|
||||||
public Rod(String name) {
|
private boolean unbreakable;
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void givePlayerRod(Player player, String rodKey, int amount){
|
public static void givePlayerRod(Player player, String rodKey, int amount){
|
||||||
ItemStack itemStack = ConfigReader.RODITEM.get(rodKey);
|
ItemStack itemStack = ConfigReader.RODITEM.get(rodKey);
|
||||||
@@ -35,18 +33,29 @@ public class Rod implements Item{
|
|||||||
|
|
||||||
public void setDifficulty(int difficulty) {this.difficulty = difficulty;}
|
public void setDifficulty(int difficulty) {this.difficulty = difficulty;}
|
||||||
public void setDoubleLoot(double doubleLoot) {this.doubleLoot = doubleLoot;}
|
public void setDoubleLoot(double doubleLoot) {this.doubleLoot = doubleLoot;}
|
||||||
public void setNbt(Map<?, ?> nbt) {this.nbt = nbt;}
|
public void setNbt(Map<String,Object> nbt) {this.nbt = nbt;}
|
||||||
public void setLore(List<String> lore) {this.lore = lore;}
|
public void setLore(List<String> lore) {this.lore = lore;}
|
||||||
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
||||||
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
||||||
public void setTime(double time) {this.time = time;}
|
public void setTime(double time) {this.time = time;}
|
||||||
public void setWeightMQ(HashMap<String, Double> weightMQ) {this.weightMQ = weightMQ;}
|
public void setWeightMQ(HashMap<String, Double> weightMQ) {this.weightMQ = weightMQ;}
|
||||||
public void setWeightPM(HashMap<String, Integer> weightPM) {this.weightPM = weightPM;}
|
public void setWeightPM(HashMap<String, Integer> weightPM) {this.weightPM = weightPM;}
|
||||||
|
public void setCustommodeldata(int custommodeldata){this.custommodeldata = custommodeldata;}
|
||||||
|
public void setUnbreakable(boolean unbreakable){this.unbreakable = unbreakable;}
|
||||||
|
public void setName(String name) {this.name = name;}
|
||||||
|
|
||||||
|
public double getTime() {return time;}
|
||||||
|
public HashMap<String, Double> getWeightMQ() {return weightMQ;}
|
||||||
|
public HashMap<String, Integer> getWeightPM() {return weightPM;}
|
||||||
public int getDifficulty() {return difficulty;}
|
public int getDifficulty() {return difficulty;}
|
||||||
public double getDoubleLoot() {return this.doubleLoot;}
|
public double getDoubleLoot() {return this.doubleLoot;}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<?, ?> getNbt() {return nbt;}
|
public boolean isUnbreakable() {return this.unbreakable;}
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> getNbt() {return nbt;}
|
||||||
|
@Override
|
||||||
|
public int getCustomModelData() {return this.custommodeldata;}
|
||||||
@Override
|
@Override
|
||||||
public String getMaterial() {return "fishing_rod";}
|
public String getMaterial() {return "fishing_rod";}
|
||||||
@Override
|
@Override
|
||||||
@@ -57,8 +66,4 @@ public class Rod implements Item{
|
|||||||
public String getName() {return this.name;}
|
public String getName() {return this.name;}
|
||||||
@Override
|
@Override
|
||||||
public List<String> getLore() {return this.lore;}
|
public List<String> getLore() {return this.lore;}
|
||||||
|
|
||||||
public double getTime() {return time;}
|
|
||||||
public HashMap<String, Double> getWeightMQ() {return weightMQ;}
|
|
||||||
public HashMap<String, Integer> getWeightPM() {return weightPM;}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,24 +11,40 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Util implements Item{
|
public class Util implements Item{
|
||||||
|
|
||||||
private final String key;
|
private String name;
|
||||||
private final String name;
|
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
private Map<?, ?> nbt;
|
private Map<String,Object> nbt;
|
||||||
private final String material;
|
private final String material;
|
||||||
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
private List<net.momirealms.customfishing.utils.Enchantment> enchantment;
|
||||||
private List<ItemFlag> itemFlags;
|
private List<ItemFlag> itemFlags;
|
||||||
|
private int custommodeldata;
|
||||||
|
private boolean unbreakable;
|
||||||
|
|
||||||
public Util(String key, String name, String material){
|
public Util(String material){
|
||||||
this.key = key;
|
|
||||||
this.name = name;
|
|
||||||
this.material = material;
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKey(){return this.key;}
|
public static void givePlayerUtil(Player player, String utilKey, int amount){
|
||||||
public List<String> getLore(){return this.lore;}
|
ItemStack itemStack = ConfigReader.UTILITEM.get(utilKey);
|
||||||
public String getMaterial(){return this.material;}
|
if (itemStack == null) return;
|
||||||
|
itemStack.setAmount(amount);
|
||||||
|
player.getInventory().addItem(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLore(List<String> lore){this.lore = lore;}
|
||||||
|
public void setNbt(Map<String,Object> nbt){this.nbt = nbt;}
|
||||||
|
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
||||||
|
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
||||||
|
public void setCustommodeldata(int custommodeldata){this.custommodeldata = custommodeldata;}
|
||||||
|
public void setUnbreakable(boolean unbreakable){this.unbreakable = unbreakable;}
|
||||||
|
public void setName(String name) {this.name = name;}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnbreakable() {return this.unbreakable;}
|
||||||
|
@Override
|
||||||
|
public List<String> getLore(){return this.lore;}
|
||||||
|
@Override
|
||||||
|
public String getMaterial(){return this.material;}
|
||||||
@Override
|
@Override
|
||||||
public String getName(){return this.name;}
|
public String getName(){return this.name;}
|
||||||
@Override
|
@Override
|
||||||
@@ -36,16 +52,7 @@ public class Util implements Item{
|
|||||||
@Override
|
@Override
|
||||||
public List<ItemFlag> getItemFlags() {return this.itemFlags;}
|
public List<ItemFlag> getItemFlags() {return this.itemFlags;}
|
||||||
@Override
|
@Override
|
||||||
public Map<?, ?> getNbt(){return this.nbt;}
|
public Map<String,Object> getNbt(){return this.nbt;}
|
||||||
|
@Override
|
||||||
public void setLore(List<String> lore){this.lore = lore;}
|
public int getCustomModelData() {return this.custommodeldata;}
|
||||||
public void setNbt(Map<?, ?> nbt){this.nbt = nbt;}
|
|
||||||
public void setEnchantment(List<net.momirealms.customfishing.utils.Enchantment> enchantment) {this.enchantment = enchantment;}
|
|
||||||
public void setItemFlags(List<ItemFlag> itemFlags) {this.itemFlags = itemFlags;}
|
|
||||||
|
|
||||||
public static void givePlayerUtil(Player player, String utilKey, int amount){
|
|
||||||
ItemStack itemStack = ConfigReader.UTILITEM.get(utilKey);
|
|
||||||
itemStack.setAmount(amount);
|
|
||||||
player.getInventory().addItem(itemStack);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ public class ItemStackGenerator {
|
|||||||
|
|
||||||
ItemStack itemStack = new ItemStack(Material.valueOf(item.getMaterial().toUpperCase()));
|
ItemStack itemStack = new ItemStack(Material.valueOf(item.getMaterial().toUpperCase()));
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
if (item.getCustomModelData() != 0){
|
||||||
|
itemMeta.setCustomModelData(item.getCustomModelData());
|
||||||
|
}
|
||||||
|
if (item.isUnbreakable()){
|
||||||
|
itemMeta.setUnbreakable(true);
|
||||||
|
}
|
||||||
if (item.getItemFlags() != null){
|
if (item.getItemFlags() != null){
|
||||||
item.getItemFlags().forEach(itemMeta::addItemFlags);
|
item.getItemFlags().forEach(itemMeta::addItemFlags);
|
||||||
}
|
}
|
||||||
@@ -41,16 +47,16 @@ public class ItemStackGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NBTItem nbtItem = new NBTItem(itemStack);
|
NBTItem nbtItem = new NBTItem(itemStack);
|
||||||
|
|
||||||
NBTCompound display = nbtItem.addCompound("display");
|
NBTCompound display = nbtItem.addCompound("display");
|
||||||
String name = item.getName();
|
if (item.getName() != null){
|
||||||
if (name.contains("&") || name.contains("§")){
|
String name = item.getName();
|
||||||
name = name.replaceAll("&","§");
|
if (name.contains("&") || name.contains("§")){
|
||||||
display.setString("Name", GsonComponentSerializer.gson().serialize(LegacyComponentSerializer.legacyAmpersand().deserialize(name)));
|
name = name.replaceAll("&","§");
|
||||||
}else {
|
display.setString("Name", GsonComponentSerializer.gson().serialize(LegacyComponentSerializer.legacyAmpersand().deserialize(name)));
|
||||||
display.setString("Name", GsonComponentSerializer.gson().serialize(MiniMessage.miniMessage().deserialize("<italic:false>" + name)));
|
}else {
|
||||||
|
display.setString("Name", GsonComponentSerializer.gson().serialize(MiniMessage.miniMessage().deserialize("<italic:false>" + name)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item.getLore() != null){
|
if(item.getLore() != null){
|
||||||
List<String> lore = display.getStringList("Lore");
|
List<String> lore = display.getStringList("Lore");
|
||||||
item.getLore().forEach(line -> {
|
item.getLore().forEach(line -> {
|
||||||
@@ -62,7 +68,6 @@ public class ItemStackGenerator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getNbt() != null){
|
if (item.getNbt() != null){
|
||||||
NBTUtil nbtUtil = new NBTUtil(item.getNbt(), nbtItem.getItem());
|
NBTUtil nbtUtil = new NBTUtil(item.getNbt(), nbtItem.getItem());
|
||||||
return nbtUtil.getNBTItem().getItem();
|
return nbtUtil.getNBTItem().getItem();
|
||||||
|
|||||||
@@ -2,17 +2,18 @@ package net.momirealms.customfishing.utils;
|
|||||||
|
|
||||||
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
||||||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||||
import net.momirealms.customfishing.AdventureManager;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class NBTUtil {
|
public class NBTUtil {
|
||||||
|
|
||||||
private final Map<?,?> nbt;
|
private final Map<String,Object> nbt;
|
||||||
private final NBTItem nbtItem;
|
private final NBTItem nbtItem;
|
||||||
|
|
||||||
public NBTUtil(Map<?,?> nbt, ItemStack itemStack){
|
public NBTUtil(Map<String,Object> nbt, ItemStack itemStack){
|
||||||
this.nbt = nbt;
|
this.nbt = nbt;
|
||||||
this.nbtItem = new NBTItem(itemStack);
|
this.nbtItem = new NBTItem(itemStack);
|
||||||
}
|
}
|
||||||
@@ -26,58 +27,76 @@ public class NBTUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NBTItem getNBTItem(){
|
public NBTItem getNBTItem(){
|
||||||
nbt.keySet().forEach(key -> {
|
setTags(nbt, nbtItem);
|
||||||
if (nbt.get(key) instanceof Map<?,?> map){
|
|
||||||
nbtItem.addCompound((String) key);
|
|
||||||
setTags(map, nbtItem.getCompound((String) key));
|
|
||||||
}else {
|
|
||||||
setNbt(nbtItem, (String) key, nbt.get(key));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return this.nbtItem;
|
return this.nbtItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTags(Map<?,?> map, NBTCompound nbtCompound){
|
private NBTCompound setTags(Map<String,Object> map, NBTCompound nbtCompound){
|
||||||
map.keySet().forEach(key -> {
|
map.keySet().forEach(key -> {
|
||||||
if (map.get(key) instanceof Map map2){
|
if (map.get(key) instanceof Map map2){
|
||||||
nbtCompound.addCompound((String) key);
|
nbtCompound.addCompound(key);
|
||||||
setTags(map2, nbtCompound.getCompound((String) key));
|
setTags(map2, nbtCompound.getCompound(key));
|
||||||
}else {
|
}
|
||||||
setNbt(nbtCompound, (String) key, map.get(key));
|
else if(map.get(key) instanceof List list){
|
||||||
|
for (Object o : list) {
|
||||||
|
if (o instanceof String s) {
|
||||||
|
if (s.startsWith("(String) ")) {
|
||||||
|
nbtCompound.getStringList(key).add(s.substring(9));
|
||||||
|
} else if (s.startsWith("(UUID) ")) {
|
||||||
|
nbtCompound.getUUIDList(key).add(UUID.fromString(s.substring(7)));
|
||||||
|
} else if (s.startsWith("(Double) ")) {
|
||||||
|
nbtCompound.getDoubleList(key).add(Double.valueOf(s.substring(9)));
|
||||||
|
} else if (s.startsWith("(Long) ")) {
|
||||||
|
nbtCompound.getLongList(key).add(Long.valueOf(s.substring(7)));
|
||||||
|
} else if (s.startsWith("(Float) ")) {
|
||||||
|
nbtCompound.getFloatList(key).add(Float.valueOf(s.substring(8)));
|
||||||
|
} else if (s.startsWith("(Int) ")) {
|
||||||
|
nbtCompound.getIntegerList(key).add(Integer.valueOf(s.substring(6)));
|
||||||
|
} else if (s.startsWith("(IntArray) ")){
|
||||||
|
String[] split = s.substring(11).replace("[","").replace("]","").replaceAll("\\s", "").split(",");
|
||||||
|
int[] array = Arrays.asList(split).stream().mapToInt(Integer::parseInt).toArray();
|
||||||
|
nbtCompound.getIntArrayList(key).add(array);
|
||||||
|
}
|
||||||
|
} else if (o instanceof Map map1) {
|
||||||
|
setTags(map1, nbtCompound.getCompoundList(key).addCompound());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (map.get(key) instanceof String string){
|
||||||
|
if (string.startsWith("(Int) ")){
|
||||||
|
nbtCompound.setInteger(key, Integer.valueOf(string.substring(6)));
|
||||||
|
}else if (string.startsWith("(String) ")){
|
||||||
|
nbtCompound.setString(key, string.substring(9));
|
||||||
|
}else if (string.startsWith("(Long) ")){
|
||||||
|
nbtCompound.setLong(key, Long.valueOf(string.substring(7)));
|
||||||
|
}else if (string.startsWith("(Float) ")){
|
||||||
|
nbtCompound.setFloat(key, Float.valueOf(string.substring(8)));
|
||||||
|
} else if (string.startsWith("(Double) ")){
|
||||||
|
nbtCompound.setDouble(key, Double.valueOf(string.substring(9)));
|
||||||
|
}else if (string.startsWith("(Short) ")){
|
||||||
|
nbtCompound.setShort(key, Short.valueOf(string.substring(8)));
|
||||||
|
}else if (string.startsWith("(Boolean) ")){
|
||||||
|
nbtCompound.setBoolean(key, Boolean.valueOf(string.substring(10)));
|
||||||
|
}else if (string.startsWith("(UUID) ")){
|
||||||
|
nbtCompound.setUUID(key, UUID.fromString(string.substring(7)));
|
||||||
|
}else if (string.startsWith("(Byte) ")){
|
||||||
|
nbtCompound.setByte(key, Byte.valueOf(string.substring(7)));
|
||||||
|
}else if (string.startsWith("(ByteArray) ")){
|
||||||
|
String[] split = string.substring(12).replace("[","").replace("]","").replaceAll("\\s", "").split(",");
|
||||||
|
byte[] bytes = new byte[split.length];
|
||||||
|
for (int i = 0; i < split.length; i++){
|
||||||
|
bytes[i] = Byte.parseByte(split[i]);
|
||||||
|
}
|
||||||
|
nbtCompound.setByteArray(key, bytes);
|
||||||
|
}else if (string.startsWith("(IntArray) ")){
|
||||||
|
String[] split = string.substring(11).replace("[","").replace("]","").replaceAll("\\s", "").split(",");
|
||||||
|
int[] array = Arrays.asList(split).stream().mapToInt(Integer::parseInt).toArray();
|
||||||
|
nbtCompound.setIntArray(key, array);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
return nbtCompound;
|
||||||
|
|
||||||
private void setNbt(NBTCompound nbtCompound, String key, Object value){
|
|
||||||
if (value instanceof String string){
|
|
||||||
if (string.startsWith("(Int) ")){
|
|
||||||
nbtCompound.setInteger(key, Integer.valueOf(string.substring(6)));
|
|
||||||
}else if (string.startsWith("(String) ")){
|
|
||||||
nbtCompound.setString(key, string.substring(9));
|
|
||||||
}else if (string.startsWith("(Long) ")){
|
|
||||||
nbtCompound.setLong(key, Long.valueOf(string.substring(7)));
|
|
||||||
}else if (string.startsWith("(Float) ")){
|
|
||||||
nbtCompound.setFloat(key, Float.valueOf(string.substring(8)));
|
|
||||||
} else if (string.startsWith("(Double) ")){
|
|
||||||
nbtCompound.setDouble(key, Double.valueOf(string.substring(9)));
|
|
||||||
}else if (string.startsWith("(Short) ")){
|
|
||||||
nbtCompound.setShort(key, Short.valueOf(string.substring(8)));
|
|
||||||
}else if (string.startsWith("(Boolean) ")){
|
|
||||||
nbtCompound.setBoolean(key, Boolean.valueOf(string.substring(10)));
|
|
||||||
}else if (string.startsWith("(UUID) ")){
|
|
||||||
nbtCompound.setUUID(key, UUID.fromString(string.substring(7)));
|
|
||||||
}else if (string.startsWith("(Byte) ")){
|
|
||||||
nbtCompound.setByte(key, Byte.valueOf(string.substring(7)));
|
|
||||||
}else {
|
|
||||||
nbtCompound.setString(key, string);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
try {
|
|
||||||
nbtCompound.setInteger(key, (Integer) value);
|
|
||||||
}catch (ClassCastException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
AdventureManager.consoleMessage("<red>[CustomFishing] 非Int类型数字必须加上强制转换标识!</red>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
130
src/main/java/net/momirealms/customfishing/utils/SaveItem.java
Normal file
130
src/main/java/net/momirealms/customfishing/utils/SaveItem.java
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
package net.momirealms.customfishing.utils;
|
||||||
|
|
||||||
|
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
||||||
|
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||||
|
import net.momirealms.customfishing.CustomFishing;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class SaveItem {
|
||||||
|
|
||||||
|
public static void saveToFile(ItemStack itemStack, String fileName){
|
||||||
|
|
||||||
|
if (itemStack == null || itemStack.getType() == Material.AIR) return;
|
||||||
|
|
||||||
|
YamlConfiguration yamlConfiguration = new YamlConfiguration();
|
||||||
|
|
||||||
|
yamlConfiguration.set(fileName + ".material", itemStack.getType().toString());
|
||||||
|
|
||||||
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
if (itemMeta.hasDisplayName()){
|
||||||
|
yamlConfiguration.set(fileName + ".display.name", itemMeta.getDisplayName());
|
||||||
|
}
|
||||||
|
if (itemMeta.hasLore()){
|
||||||
|
yamlConfiguration.set(fileName + ".display.lore", itemMeta.getLore());
|
||||||
|
}
|
||||||
|
if (itemMeta.hasCustomModelData()) {
|
||||||
|
yamlConfiguration.set(fileName + ".custom-model-data", itemMeta.getCustomModelData());
|
||||||
|
}
|
||||||
|
if (itemMeta.isUnbreakable()) {
|
||||||
|
yamlConfiguration.set(fileName + ".unbreakable", itemMeta.isUnbreakable());
|
||||||
|
}
|
||||||
|
if (itemMeta.hasEnchants()) {
|
||||||
|
ArrayList<String> enchants = new ArrayList<>();
|
||||||
|
itemMeta.getEnchants().forEach((enchantment, level) -> {
|
||||||
|
enchants.add(enchantment.getKey() + "/" + level);
|
||||||
|
});
|
||||||
|
yamlConfiguration.set(fileName + ".enchantments", enchants);
|
||||||
|
}
|
||||||
|
if (itemMeta.getItemFlags().size() > 0){
|
||||||
|
ArrayList<String> itemFlags = new ArrayList<>();
|
||||||
|
itemStack.getItemFlags().forEach(itemFlag -> {
|
||||||
|
itemFlags.add(itemFlag.name());
|
||||||
|
});
|
||||||
|
yamlConfiguration.set(fileName + ".item_flags", itemFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTItem nbtItem = new NBTItem(itemStack);
|
||||||
|
|
||||||
|
Map<String, Object> map0 = compoundToMap(nbtItem);
|
||||||
|
if (map0.size() != 0){
|
||||||
|
ArrayList<Map<String, Object>> mapArrayList = new ArrayList<>();
|
||||||
|
mapArrayList.add(map0);
|
||||||
|
yamlConfiguration.set(fileName + ".nbt", mapArrayList);
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(CustomFishing.instance.getDataFolder(), File.separator + "export" + File.separator + fileName + ".yml");
|
||||||
|
|
||||||
|
try {
|
||||||
|
yamlConfiguration.save(file);
|
||||||
|
}catch (IOException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Object> compoundToMap(NBTCompound nbtCompound){
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
nbtCompound.getKeys().forEach(key -> {
|
||||||
|
if (key.equals("Enchantments")) return;
|
||||||
|
if (key.equals("Name")) return;
|
||||||
|
if (key.equals("Lore")) return;
|
||||||
|
if (key.equals("HideFlags")) return;
|
||||||
|
if (key.equals("CustomModelData")) return;
|
||||||
|
if (key.equals("Unbreakable")) return;
|
||||||
|
switch (nbtCompound.getType(key)){
|
||||||
|
case NBTTagByte -> map.put(key, "(Byte) " + nbtCompound.getByte(key));
|
||||||
|
case NBTTagInt -> map.put(key, "(Int) " + nbtCompound.getInteger(key));
|
||||||
|
case NBTTagDouble -> map.put(key, "(Double) " + nbtCompound.getDouble(key));
|
||||||
|
case NBTTagLong -> map.put(key, "(Long) " + nbtCompound.getLong(key));
|
||||||
|
case NBTTagFloat -> map.put(key, "(Float) " + nbtCompound.getFloat(key));
|
||||||
|
case NBTTagShort -> map.put(key, "(Short) " + nbtCompound.getShort(key));
|
||||||
|
case NBTTagString -> map.put(key, "(String) " + nbtCompound.getString(key));
|
||||||
|
case NBTTagByteArray -> map.put(key, "(ByteArray) " + Arrays.toString(nbtCompound.getByteArray(key)));
|
||||||
|
case NBTTagIntArray -> map.put(key, "(IntArray) " + Arrays.toString(nbtCompound.getIntArray(key)));
|
||||||
|
case NBTTagCompound -> {
|
||||||
|
Map<String, Object> map1 = compoundToMap(nbtCompound.getCompound(key));
|
||||||
|
if (map1.size() != 0){
|
||||||
|
map.put(key, map1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case NBTTagList -> {
|
||||||
|
List<Object> list = new ArrayList<>();
|
||||||
|
switch (nbtCompound.getListType(key)){
|
||||||
|
case NBTTagInt -> nbtCompound.getIntegerList(key).forEach(a -> {
|
||||||
|
list.add("(Int) " + a);
|
||||||
|
});
|
||||||
|
case NBTTagDouble -> nbtCompound.getDoubleList(key).forEach(a -> {
|
||||||
|
list.add("(Double) " + a);
|
||||||
|
});
|
||||||
|
case NBTTagString -> nbtCompound.getStringList(key).forEach(a -> {
|
||||||
|
list.add("(String) " + a);
|
||||||
|
});
|
||||||
|
case NBTTagCompound -> nbtCompound.getCompoundList(key).forEach(a -> {
|
||||||
|
list.add(compoundToMap(a));
|
||||||
|
});
|
||||||
|
case NBTTagFloat -> nbtCompound.getFloatList(key).forEach(a -> {
|
||||||
|
list.add("(Float) " + a);
|
||||||
|
});
|
||||||
|
case NBTTagLong -> nbtCompound.getLongList(key).forEach(a -> {
|
||||||
|
list.add("(Long) " + a);
|
||||||
|
});
|
||||||
|
case NBTTagIntArray -> nbtCompound.getIntArrayList(key).forEach(a -> {
|
||||||
|
list.add("(IntArray) " + Arrays.toString(a));
|
||||||
|
});
|
||||||
|
default -> nbtCompound.getUUIDList(key).forEach(a -> {
|
||||||
|
list.add("(UUID) " + a);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
map.put(key, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,8 +6,7 @@ baits:
|
|||||||
lore:
|
lore:
|
||||||
- '<white>减少捕鱼的时间'
|
- '<white>减少捕鱼的时间'
|
||||||
- '<white>但是加大捕鱼的难度'
|
- '<white>但是加大捕鱼的难度'
|
||||||
nbt:
|
custom-model-data: 1
|
||||||
- CustomModelData: '(Int) 1'
|
|
||||||
#钓饵增益
|
#钓饵增益
|
||||||
modifier:
|
modifier:
|
||||||
#改变指定组的loot权重
|
#改变指定组的loot权重
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#https://docs.adventure.kyori.net/minimessage/format.html
|
#https://docs.adventure.kyori.net/minimessage/format.html
|
||||||
|
|
||||||
items:
|
items:
|
||||||
#最基本的物品需要填写如下项目
|
|
||||||
rubbish:
|
rubbish:
|
||||||
material: paper
|
material: paper
|
||||||
display:
|
display:
|
||||||
@@ -24,13 +23,14 @@ items:
|
|||||||
lore:
|
lore:
|
||||||
- '<gray>This is a <font:uniform>rainbow fish!'
|
- '<gray>This is a <font:uniform>rainbow fish!'
|
||||||
- '<gray> 这是一条七色彩虹鱼'
|
- '<gray> 这是一条七色彩虹鱼'
|
||||||
|
|
||||||
|
custom-model-data: 1
|
||||||
#自定义NBT
|
#自定义NBT
|
||||||
#可类型(Int) (Byte) (String) (Float) (String) (Double) (Short) (Long) (UUID) (Boolean)
|
#可类型(Int) (Byte) (String) (Float) (String) (Double) (Short) (Long) (UUID) (Boolean)
|
||||||
nbt:
|
nbt:
|
||||||
- itemsadder:
|
- itemsadder:
|
||||||
namespace: '(String) momirealms'
|
namespace: '(String) momirealms'
|
||||||
id: '(String) rainbow_fish'
|
id: '(String) rainbow_fish'
|
||||||
CustomModelData: '(Int) 1'
|
|
||||||
SomeNBT:
|
SomeNBT:
|
||||||
NBTS:
|
NBTS:
|
||||||
byte: '(Byte) 127'
|
byte: '(Byte) 127'
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ rods:
|
|||||||
name: '普通的木鱼竿'
|
name: '普通的木鱼竿'
|
||||||
lore:
|
lore:
|
||||||
- '就是一把普通的鱼竿而已啦'
|
- '就是一把普通的鱼竿而已啦'
|
||||||
nbt:
|
custom-model-data: 1
|
||||||
- CustomModelData: '(Int) 1'
|
|
||||||
#鱼竿增益
|
#鱼竿增益
|
||||||
modifier:
|
modifier:
|
||||||
#改变指定组的loot权重
|
#改变指定组的loot权重
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ utils:
|
|||||||
name: '找鱼器'
|
name: '找鱼器'
|
||||||
lore:
|
lore:
|
||||||
- '右键查看这个地方能钓到什么鱼吧!'
|
- '右键查看这个地方能钓到什么鱼吧!'
|
||||||
nbt:
|
custom-model-data: 1
|
||||||
- CustomModelData: '(Int) 1'
|
|
||||||
Reference in New Issue
Block a user