diff --git a/src/main/java/net/momirealms/customfishing/data/storage/MySQLStorageImpl.java b/src/main/java/net/momirealms/customfishing/data/storage/MySQLStorageImpl.java index 0e7505ed..4a7b3454 100644 --- a/src/main/java/net/momirealms/customfishing/data/storage/MySQLStorageImpl.java +++ b/src/main/java/net/momirealms/customfishing/data/storage/MySQLStorageImpl.java @@ -123,7 +123,7 @@ public class MySQLStorageImpl implements DataStorageInterface { } else { Calendar calendar = Calendar.getInstance(); - playerSellData = new PlayerSellData(calendar.get(Calendar.MONTH) * 100 + calendar.get(Calendar.DATE), 0); + playerSellData = new PlayerSellData(0, (calendar.get(Calendar.MONTH) +1)* 100 + calendar.get(Calendar.DATE)); insertSellData(player.getUniqueId(), playerSellData.getDate()); } } catch (SQLException e) { @@ -202,15 +202,17 @@ public class MySQLStorageImpl implements DataStorageInterface { String sql_1 = String.format(SqlConstants.SQL_ALTER_TABLE, sqlConnection.getTablePrefix() + "_" + "fishingbag"); try (Connection connection = sqlConnection.getConnectionAndCheck(); PreparedStatement statement = connection.prepareStatement(sql_1)) { statement.executeUpdate(); - AdventureUtil.consoleMessage("[CustomFishing] 1/2 tables updated"); + AdventureUtil.consoleMessage("[CustomFishing] Tables updated"); } catch (SQLException ex) { + AdventureUtil.consoleMessage(ex.getSQLState()); AdventureUtil.consoleMessage("[CustomFishing] Failed to migrate data"); } - String sql_2 = String.format(SqlConstants.SQL_ALTER_TABLE, sqlConnection.getTablePrefix() + "_" + "selldata"); + String sql_2 = String.format(SqlConstants.SQL_DROP_TABLE, sqlConnection.getTablePrefix() + "_" + "sellcache"); try (Connection connection = sqlConnection.getConnectionAndCheck(); PreparedStatement statement = connection.prepareStatement(sql_2)) { statement.executeUpdate(); - AdventureUtil.consoleMessage("[CustomFishing] 2/2 tables updated"); + AdventureUtil.consoleMessage("[CustomFishing] Outdated table deleted"); } catch (SQLException ex) { + AdventureUtil.consoleMessage(ex.getSQLState()); AdventureUtil.consoleMessage("[CustomFishing] Failed to migrate data"); } } diff --git a/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java b/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java index 299a53bf..8f0963f0 100644 --- a/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java +++ b/src/main/java/net/momirealms/customfishing/data/storage/SqlConstants.java @@ -28,5 +28,6 @@ public class SqlConstants { public static final String SQL_SELECT_BAG_BY_UUID = "SELECT * FROM `%s` WHERE `uuid` = ?"; public static final String SQL_SELECT_SELL_BY_UUID = "SELECT * FROM `%s` WHERE `uuid` = ?"; public static final String SQL_LOCK_BY_UUID = "UPDATE `%s` SET `version` = 1 WHERE `uuid` = ?"; - public static final String SQL_ALTER_TABLE = "ALTER TABLE `%s` ADD COLUMN `version` INT NOT NULL DEFAULT `0` AFTER `uuid`"; + public static final String SQL_ALTER_TABLE = "ALTER TABLE `%s` ADD COLUMN `version` INT NOT NULL AFTER `uuid`"; + public static final String SQL_DROP_TABLE = "DROP TABLE `%s`"; } diff --git a/src/main/java/net/momirealms/customfishing/fishing/MiniGameConfig.java b/src/main/java/net/momirealms/customfishing/fishing/MiniGameConfig.java index ac5d98c7..9f2a5cf7 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/MiniGameConfig.java +++ b/src/main/java/net/momirealms/customfishing/fishing/MiniGameConfig.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing; import net.momirealms.customfishing.fishing.bar.FishingBar; diff --git a/src/main/java/net/momirealms/customfishing/fishing/bar/FishingBar.java b/src/main/java/net/momirealms/customfishing/fishing/bar/FishingBar.java index bdc038e0..15d41864 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/bar/FishingBar.java +++ b/src/main/java/net/momirealms/customfishing/fishing/bar/FishingBar.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing.bar; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/momirealms/customfishing/fishing/bar/ModeThreeBar.java b/src/main/java/net/momirealms/customfishing/fishing/bar/ModeThreeBar.java index ce9c2080..554469d4 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/bar/ModeThreeBar.java +++ b/src/main/java/net/momirealms/customfishing/fishing/bar/ModeThreeBar.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing.bar; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/momirealms/customfishing/fishing/bar/ModeTwoBar.java b/src/main/java/net/momirealms/customfishing/fishing/bar/ModeTwoBar.java index baffe34f..cdb84fec 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/bar/ModeTwoBar.java +++ b/src/main/java/net/momirealms/customfishing/fishing/bar/ModeTwoBar.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing.bar; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java b/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java index d2d3721d..794ced82 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java +++ b/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java @@ -46,6 +46,7 @@ public class Item { public Item(Material material, String key) { this.material = material; this.key = key; + this.amount = 1; } public Item(ConfigurationSection section, String key) { diff --git a/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java b/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java index bbd65ead..a338a95a 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java +++ b/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing.mode; import net.momirealms.customfishing.CustomFishing; diff --git a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java index 7232d335..dd6744c6 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java +++ b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing.mode; import net.momirealms.customfishing.CustomFishing; diff --git a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java index f99ac5cf..c17f484e 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java +++ b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) <2022> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package net.momirealms.customfishing.fishing.mode; import net.momirealms.customfishing.CustomFishing; diff --git a/src/main/java/net/momirealms/customfishing/fishing/requirements/SkillLevelImpl.java b/src/main/java/net/momirealms/customfishing/fishing/requirements/SkillLevelImpl.java index bfce89d5..25dfb731 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/requirements/SkillLevelImpl.java +++ b/src/main/java/net/momirealms/customfishing/fishing/requirements/SkillLevelImpl.java @@ -2,11 +2,14 @@ package net.momirealms.customfishing.fishing.requirements; import net.momirealms.customfishing.CustomFishing; import net.momirealms.customfishing.fishing.FishingCondition; +import net.momirealms.customfishing.integration.SkillInterface; public record SkillLevelImpl(int level) implements RequirementInterface { @Override public boolean isConditionMet(FishingCondition fishingCondition) { - return CustomFishing.getInstance().getIntegrationManager().getSkillInterface().getLevel(fishingCondition.getPlayer()) >= level; + SkillInterface skillInterface = CustomFishing.getInstance().getIntegrationManager().getSkillInterface(); + if (skillInterface == null) return false; + return skillInterface.getLevel(fishingCondition.getPlayer()) >= level; } } diff --git a/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java b/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java index ab781b8b..de338b75 100644 --- a/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java +++ b/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java @@ -22,6 +22,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryOpenEvent; public class InventoryListener implements Listener { @@ -46,4 +47,9 @@ public class InventoryListener implements Listener { public void onClose(InventoryCloseEvent event){ function.onCloseInventory(event); } + + @EventHandler + public void onDrag(InventoryDragEvent event) { + function.onDragInventory(event); + } } diff --git a/src/main/java/net/momirealms/customfishing/manager/FishingManager.java b/src/main/java/net/momirealms/customfishing/manager/FishingManager.java index 4474ce58..8ee858bc 100644 --- a/src/main/java/net/momirealms/customfishing/manager/FishingManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/FishingManager.java @@ -837,8 +837,8 @@ public class FishingManager extends Function { available.add(loot); } else { - for (RequirementInterface requirement : requirements){ - if (!requirement.isConditionMet(fishingCondition)){ + for (RequirementInterface requirement : requirements) { + if (!requirement.isConditionMet(fishingCondition)) { continue outer; } } diff --git a/src/main/java/net/momirealms/customfishing/manager/LootManager.java b/src/main/java/net/momirealms/customfishing/manager/LootManager.java index d20b3f98..4dc1d747 100644 --- a/src/main/java/net/momirealms/customfishing/manager/LootManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/LootManager.java @@ -115,6 +115,10 @@ public class LootManager extends Function { mobSection.getDouble("vector.vertical",1.3) ) ); + + setActions(mobSection, loot); + setRequirements(mobSection.getConfigurationSection("requirements"), loot); + if (mobSection.getBoolean("in-lava", false)) lavaLoots.put(key, loot); else waterLoots.put(key, loot); } @@ -221,15 +225,17 @@ public class LootManager extends Function { (float) section.getDouble(action + ".pitch") )); case "potion-effect" -> { - PotionEffectType type = PotionEffectType.getByName(section.getString(action + ".type", "BLINDNESS").toUpperCase()); - if (type == null) AdventureUtil.consoleMessage("[CustomFishing] Potion effect " + section.getString(action + ".type", "BLINDNESS") + " doesn't exists"); - actions.add(new PotionEffectImpl( - new PotionEffect( - type == null ? PotionEffectType.LUCK : type, - section.getInt(action + ".duration"), - section.getInt(action + ".amplifier") - ) - )); + List potionEffectList = new ArrayList<>(); + for (String key : section.getConfigurationSection(action).getKeys(false)) { + PotionEffectType type = PotionEffectType.getByName(section.getString(action + "." + key + ".type", "BLINDNESS").toUpperCase()); + if (type == null) AdventureUtil.consoleMessage("[CustomFishing] Potion effect " + section.getString(action + "." + key + ".type", "BLINDNESS") + " doesn't exists"); + potionEffectList.add(new PotionEffect( + type == null ? PotionEffectType.LUCK : type, + section.getInt(action + "." + key + ".duration"), + section.getInt(action + "." + key + ".amplifier") + )); + } + actions.add(new PotionEffectImpl(potionEffectList.toArray(new PotionEffect[0]))); } } } @@ -242,6 +248,7 @@ public class LootManager extends Function { if (section != null) { for (String type : section.getKeys(false)) { switch (type) { + case "biome" -> requirements.add(new BiomeImpl(section.getStringList(type))); case "weather" -> requirements.add(new WeatherImpl(section.getStringList(type))); case "ypos" -> requirements.add(new YPosImpl(section.getStringList(type))); case "season" -> requirements.add(new SeasonImpl(section.getStringList(type))); diff --git a/src/main/java/net/momirealms/customfishing/manager/SellManager.java b/src/main/java/net/momirealms/customfishing/manager/SellManager.java index 3d437261..c48ce755 100644 --- a/src/main/java/net/momirealms/customfishing/manager/SellManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/SellManager.java @@ -49,6 +49,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -171,7 +172,7 @@ public class SellManager extends Function { } private void loadConfig() { - YamlConfiguration config = ConfigUtil.getConfig("sell-fish-gui.yml"); + YamlConfiguration config = ConfigUtil.getConfig("sell-fish.yml"); formula = config.getString("price-formula", "{base} + {bonus} * {size}"); sellLimitation = config.getBoolean("sell-limitation.enable", false); upperLimit = config.getInt("sell-limitation.upper-limit", 10000); @@ -203,10 +204,16 @@ public class SellManager extends Function { if (sellIconSection != null) { sellIcon = new Item(sellIconSection, "sellIcon"); } + else { + AdventureUtil.consoleMessage("[CustomFishing] Sell icon is missing"); + } ConfigurationSection denyIconSection = config.getConfigurationSection("functional-icons.deny"); if (denyIconSection != null) { denyIcon = new Item(denyIconSection, "denyIcon"); } + else { + AdventureUtil.consoleMessage("[CustomFishing] Deny icon is missing"); + } for (int slot : config.getIntegerList("functional-icons.slots")) { guiItems.put(slot - 1, ItemStackUtil.getFromItem(sellIcon)); @@ -293,7 +300,7 @@ public class SellManager extends Function { } Calendar calendar = Calendar.getInstance(); - int currentDate = calendar.get(Calendar.DATE); + int currentDate = (calendar.get(Calendar.MONTH) + 1) * 100 + calendar.get(Calendar.DATE); if (currentDate != sellData.getDate()) { sellData.setDate(currentDate); sellData.setMoney(0); @@ -343,6 +350,19 @@ public class SellManager extends Function { } } + @Override + public void onDragInventory(InventoryDragEvent event) { + final Player player = (Player) event.getView().getPlayer(); + Inventory inventory = inventoryMap.get(player); + if (inventory == null) return; + Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { + ItemStack icon = ItemStackUtil.getFromItem(sellIcon.cloneWithPrice(getTotalPrice(getPlayerItems(inventory)))); + for (int slot : functionIconSlots) { + inventory.setItem(slot, icon); + } + }); + } + @Override public void onCloseInventory(InventoryCloseEvent event) { final Player player = (Player) event.getPlayer(); @@ -374,7 +394,7 @@ public class SellManager extends Function { private boolean hasEmptySlot(PlayerInventory inventory) { for (ItemStack itemStack : inventory.getStorageContents()) { - if (itemStack.getType() == Material.AIR) return true; + if (itemStack == null || itemStack.getType() == Material.AIR) return true; } return false; } diff --git a/src/main/java/net/momirealms/customfishing/object/Function.java b/src/main/java/net/momirealms/customfishing/object/Function.java index fc6d442f..279666d9 100644 --- a/src/main/java/net/momirealms/customfishing/object/Function.java +++ b/src/main/java/net/momirealms/customfishing/object/Function.java @@ -22,6 +22,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; @@ -66,4 +67,7 @@ public class Function { public void onConsumeItem(PlayerItemConsumeEvent event) { } + + public void onDragInventory(InventoryDragEvent event) { + } } diff --git a/src/main/java/net/momirealms/customfishing/object/action/PotionEffectImpl.java b/src/main/java/net/momirealms/customfishing/object/action/PotionEffectImpl.java index 3eed6803..40ddf346 100644 --- a/src/main/java/net/momirealms/customfishing/object/action/PotionEffectImpl.java +++ b/src/main/java/net/momirealms/customfishing/object/action/PotionEffectImpl.java @@ -21,10 +21,12 @@ import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.jetbrains.annotations.Nullable; -public record PotionEffectImpl(PotionEffect potionEffect) implements ActionInterface { +public record PotionEffectImpl(PotionEffect[] potionEffects) implements ActionInterface { @Override public void doOn(Player player, @Nullable Player anotherPlayer) { - player.addPotionEffect(potionEffect); + for (PotionEffect potionEffect : potionEffects) { + player.addPotionEffect(potionEffect); + } } } diff --git a/src/main/java/net/momirealms/customfishing/util/InventoryUtil.java b/src/main/java/net/momirealms/customfishing/util/InventoryUtil.java index 4032f847..1f2b0bbe 100644 --- a/src/main/java/net/momirealms/customfishing/util/InventoryUtil.java +++ b/src/main/java/net/momirealms/customfishing/util/InventoryUtil.java @@ -20,6 +20,7 @@ package net.momirealms.customfishing.util; import org.bukkit.inventory.ItemStack; import org.bukkit.util.io.BukkitObjectInputStream; import org.bukkit.util.io.BukkitObjectOutputStream; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; @@ -34,8 +35,7 @@ public class InventoryUtil { * @param contents items * @return base64 */ - @Nullable - public static String toBase64(ItemStack[] contents) { + public static @NotNull String toBase64(ItemStack[] contents) { boolean convert = false; for (ItemStack content : contents) { if (content != null) { @@ -58,7 +58,7 @@ public class InventoryUtil { throw new RuntimeException("[CustomFishing] Data save error", e); } } - return null; + return ""; } /** diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b4e5037e..6270426f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -17,7 +17,7 @@ worlds: # Mechanic settings mechanics: # Add custom nbt tags to the loots so plugin could identify - # Disable this will lose the trigger actions when eating fish + # Disable this will be unable to trigger the actions when eating fish # 为每个战利品增加特殊的CustomFishing NBT标签以被插件识别 # 禁用此项目将会导致吃食物触发的动作失效 add-custom-fishing-tags-to-loots: true diff --git a/src/main/resources/loots/default.yml b/src/main/resources/loots/default.yml index 42f00614..2153311a 100644 --- a/src/main/resources/loots/default.yml +++ b/src/main/resources/loots/default.yml @@ -6,7 +6,7 @@ rubbish: lore: - 'Maybe we need to protect the environment...' weight: 130 - custom-model-data: 640 + custom-model-data: 50000 action: success: mending: 3 diff --git a/src/main/resources/loots/example.yml b/src/main/resources/loots/example.yml index f5adf8bd..0aa6a699 100644 --- a/src/main/resources/loots/example.yml +++ b/src/main/resources/loots/example.yml @@ -21,9 +21,10 @@ rainbow_fish: # The score to get in competition # 比赛中获取的分数 score: 10 - - minigame: - - + # Specify the fish's mini-games + # 指定鱼的小游戏 + mini-game: + - rainbow # Basic elements of an item # You can use MiniMessage format in name & lore @@ -36,6 +37,8 @@ rainbow_fish: - 'This is a rainbow fish!' - 'It is {size}cm long!' custom-model-data: 1 + # 数量 + amount: 1 # unbreakable # 不可破坏 @@ -46,7 +49,7 @@ rainbow_fish: size: 10~200 # Optional - # The base price and size bonus, and you can customize price formula in sell-fish-gui.yml + # The base price and size bonus, and you can customize price formula in sell-fish.yml price: base: 50 bonus: 0.3 @@ -64,9 +67,10 @@ rainbow_fish: action: consume: potion-effect: - type: blindness - amplifier: 1 - duration: 200 + effect_1: + type: blindness + amplifier: 1 + duration: 200 success: message: - 'You got a {loot} lol!' @@ -78,6 +82,11 @@ rainbow_fish: mending: 5 # Fishing Skill xp (requires skill plugin hook) skill-xp: 100 + sound: + source: player + key: 'minecraft:block.amethyst_block.break' + volume: 1 + pitch: 1 failure: message: - 'The fish escaped!' diff --git a/src/main/resources/mobs/default.yml b/src/main/resources/mobs/default.yml index 11f0512c..fe3c6a48 100644 --- a/src/main/resources/mobs/default.yml +++ b/src/main/resources/mobs/default.yml @@ -23,18 +23,4 @@ skeletalknight: weather: - thunder world: - - world - -piranha: - enable: false - mobID: piranha - name: 'Piranha' - weight: 50 - time: 1000000 - difficulty: 1-1 - action: - success: - command: - - 'say {player} Caught a piranha!' - vector: - vertical: 2 \ No newline at end of file + - world \ No newline at end of file diff --git a/src/main/resources/rods/default.yml b/src/main/resources/rods/default.yml index 7595cfdc..bcc6340c 100644 --- a/src/main/resources/rods/default.yml +++ b/src/main/resources/rods/default.yml @@ -14,7 +14,7 @@ nature_fishing_cane: lore: - 'The wild power makes it easier to be hooked' - 'But also increase the difficulty' - custom-model-data: 2 + custom-model-data: 50001 modifier: time: 0.9 difficulty: 1 @@ -24,7 +24,7 @@ silver_fishing_rod: name: 'Silver Fishing Rod' lore: - 'Increase the chance of getting silver quality fish' - custom-model-data: 3 + custom-model-data: 50002 modifier: weight-add: silver: 20 @@ -35,7 +35,7 @@ golden_fishing_rod: name: 'Golden Fishing Rod' lore: - 'Increase the chance of getting golden quality fish' - custom-model-data: 4 + custom-model-data: 50003 modifier: weight-add: silver: -20 @@ -46,7 +46,7 @@ star_fishing_rod: name: 'Star Fishing Rod' lore: - 'Grants you the ability to fish in the lava' - custom-model-data: 5 + custom-model-data: 50004 modifier: weight-add: silver: 20 diff --git a/src/main/resources/sell-fish.yml b/src/main/resources/sell-fish.yml new file mode 100644 index 00000000..771448cf --- /dev/null +++ b/src/main/resources/sell-fish.yml @@ -0,0 +1,93 @@ +container-title: 'Sell Fish' + +rows: 6 + +# Limit the money player can earn per day +sell-limitation: + enable: true + upper-limit: 10000 + +price-formula: '{base} + {bonus} * {size}' + +vanilla-item-price: + COD: 10 + PUFFERFISH: 10 + SALMON: 10 + TROPICAL_FISH: 10 + +sounds: + open: minecraft:block.chest.open + close: minecraft:block.chest.close + success: minecraft:block.amethyst_block.break + deny: minecraft:block.anvil.destroy + confirm: minecraft:entity.villager.trade + type: player + +actions: + message: + enable: true + text: 'You earned {money}$ from selling the fish! You can still gain {remains}$ from selling fish today' + title: + enable: true + title: 'Success' + subtitle: 'You earned {money}$ from selling the fish' + in: 20 + stay: 40 + out: 20 + actionbar: + enable: true + text: 'You earned {money}$ from selling the fish' + commands: + enable: false + value: + - 'cmi broadcast {player} earned {money}' + +functional-icons: + slots: + - 50 + sell: + material: IRON_BLOCK + display: + name: '<#00CED1>Sell the fish' + lore: + - 'You will gain {money}$' + custom-model-data: 1 + deny: + material: REDSTONE_BLOCK + display: + name: 'Denied' + lore: + - 'Nothing to sell!' + custom-model-data: 1 + +decorative-icons: + glass-pane: + material: BLACK_STAINED_GLASS_PANE + display: + name: ' ' + slots: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 18 + - 19 + - 27 + - 28 + - 36 + - 37 + - 45 + - 46 + - 47 + - 48 + - 49 + - 51 + - 52 + - 53 + - 54 \ No newline at end of file