9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-29 11:59:11 +00:00

1.3.0-beta

This commit is contained in:
Xiao-MoMi
2023-03-06 01:24:08 +08:00
parent 319e174a69
commit a4037f96eb
12 changed files with 47 additions and 129 deletions

View File

@@ -135,8 +135,8 @@ public class EffectManager extends Function {
if (baitSection == null) continue;
Item item = new Item(baitSection, key);
baitItems.put(key, ItemStackUtil.addIdentifier(ItemStackUtil.getFromItem(item), "bait", key));
if (config.contains(key + ".effect")) {
baitEffects.put(key, getEffect(config.getConfigurationSection(key + ".effect")));
if (baitSection.contains("effect")) {
baitEffects.put(key, getEffect(baitSection.getConfigurationSection("effect")));
}
}
}
@@ -160,8 +160,8 @@ public class EffectManager extends Function {
if (rodSection == null) continue;
Item item = new Item(rodSection, key);
rodItems.put(key, ItemStackUtil.addIdentifier(ItemStackUtil.getFromItem(item), "rod", key));
if (config.contains(key + ".effect")) {
rodEffects.put(key, getEffect(config.getConfigurationSection(key + ".effect")));
if (rodSection.contains("effect")) {
rodEffects.put(key, getEffect(rodSection.getConfigurationSection("effect")));
}
}
}

View File

@@ -873,6 +873,14 @@ public class FishingManager extends Function {
if (blockID == null) return;
List<TotemConfig> totemList = plugin.getTotemManager().getTotemsByCoreID(blockID);
if (totemList == null || !totemList.contains(totem)) return;
FishingCondition fishingCondition = new FishingCondition(block.getLocation(), player);
for (RequirementInterface requirement : totem.getRequirements()) {
if (!requirement.isConditionMet(fishingCondition)) {
return;
}
}
Location coreLoc = block.getLocation();
int direction = plugin.getTotemManager().checkLocationModel(totem.getOriginalModel(), coreLoc);
if (direction == 0) return;

View File

@@ -208,7 +208,7 @@ public class LootManager extends Function {
loot.setRequirements(getRequirements(section));
}
private ActionInterface[] getActions(ConfigurationSection section, String nick) {
public ActionInterface[] getActions(ConfigurationSection section, String nick) {
List<ActionInterface> actions = new ArrayList<>();
if (section != null) {
for (String action : section.getKeys(false)) {
@@ -243,7 +243,7 @@ public class LootManager extends Function {
return actions.toArray(new ActionInterface[0]);
}
private RequirementInterface[] getRequirements(ConfigurationSection section) {
public RequirementInterface[] getRequirements(ConfigurationSection section) {
List<RequirementInterface> requirements = new ArrayList<>();
if (section != null) {
for (String type : section.getKeys(false)) {

View File

@@ -181,7 +181,7 @@ public class TotemManager extends Function {
config.getInt(key + ".radius", 16),
config.getInt(key + ".duration", 300),
Particle.valueOf(config.getString(key + ".particle", "SPELL_MOB").toUpperCase()),
EffectManager.getEffect(config.getConfigurationSection(key + ".modifier"))
EffectManager.getEffect(config.getConfigurationSection(key + ".effect"))
);
List<ActionInterface> actionList = new ArrayList<>();
@@ -196,26 +196,10 @@ public class TotemManager extends Function {
}
}
}
totem.setActivatorActions(actionList.toArray(new ActionInterface[0]));
totem.setNearbyActions(nearActionList.toArray(new ActionInterface[0]));
if (config.contains(key + ".requirements")) {
List<RequirementInterface> requirements = new ArrayList<>();
Objects.requireNonNull(config.getConfigurationSection(key + ".requirements")).getKeys(false).forEach(requirement -> {
switch (requirement){
case "weather" -> requirements.add(new WeatherImpl(config.getStringList(key + ".requirements.weather")));
case "ypos" -> requirements.add(new YPosImpl(config.getStringList(key + ".requirements.ypos")));
case "season" -> requirements.add(new SeasonImpl(config.getStringList(key + ".requirements.season")));
case "world" -> requirements.add(new WorldImpl(config.getStringList(key + ".requirements.world")));
case "biome" -> requirements.add(new BiomeImpl(config.getStringList(key + ".requirements.biome")));
case "permission" -> requirements.add(new PermissionImpl(config.getString(key + ".requirements.permission")));
case "time" -> requirements.add(new TimeImpl(config.getStringList(key + ".requirements.time")));
case "skill-level" -> requirements.add(new SkillLevelImpl(config.getInt(key + ".requirements.skill-level")));
case "papi-condition" -> requirements.add(new CustomPapi(config.getConfigurationSection(key + ".requirements.papi-condition").getValues(false)));
}
});
totem.setRequirements(requirements.toArray(new RequirementInterface[0]));
}
totem.setRequirements(plugin.getLootManager().getRequirements(config.getConfigurationSection(key + ".requirements")));
if (config.getBoolean(key + ".hologram.enable", false)) {
totem.setHoloText(config.getStringList(key + ".hologram.text").toArray(new String[0]));
@@ -225,7 +209,6 @@ public class TotemManager extends Function {
if (config.contains(key + ".potion-effects")) {
List<PotionEffect> potionEffectList = new ArrayList<>();
for (String potion : config.getConfigurationSection(key + ".potion-effects").getKeys(false)) {
PotionEffectType potionType = PotionEffectType.getByName(potion.toUpperCase());
if (potionType == null) continue;
int time = 40;

View File

@@ -544,7 +544,7 @@ bar_11:
title: '{strain}'
subtitle:
font: 'customfishing:default'
bar: ''
bar: ''
fish: '뀎'
struggling-fish:
-

View File

@@ -1,6 +1,7 @@
# Don't change
config-version: '16'
# Wiki: https://mo-mi.gitbook.io/xiaomomi-plugins/
# chinese/english/spanish
lang: english

View File

@@ -4,7 +4,9 @@ config-version: '1'
data-storage-method: YAML
# Migrate from 1.2 to 1.3
# 迁移 1.2->1.3
# This option would automatically be set to false when migration finishes
# 这个选项会在迁移完毕后自动设置为false
migration: false
# MySQL settings

View File

@@ -5,7 +5,7 @@ wooden_rod:
- '<gray>Its just an ordinary fishing rod'
- '<gray>But it''s quite friendly to a starter!'
# Click here to learn how modifier system works: https://www.yuque.com/docs/share/4842ac5f-b5ea-4568-acef-d510f8bc9064?# 《Modifier System》
modifier:
effect:
difficulty: -1
nature_fishing_cane:
@@ -15,7 +15,7 @@ nature_fishing_cane:
- '<gray>The wild power makes it easier to be hooked'
- '<gray>But also increase the difficulty'
custom-model-data: 50001
modifier:
effect:
time: 0.9
difficulty: 1
@@ -25,7 +25,7 @@ silver_fishing_rod:
lore:
- '<gray>Increase the chance of getting silver quality fish'
custom-model-data: 50002
modifier:
effect:
weight-add:
silver: 20
gold: -10
@@ -36,7 +36,7 @@ golden_fishing_rod:
lore:
- '<gray>Increase the chance of getting golden quality fish'
custom-model-data: 50003
modifier:
effect:
weight-add:
silver: -20
gold: 20
@@ -47,7 +47,7 @@ star_fishing_rod:
lore:
- '<gray>Grants you the ability to fish in the lava'
custom-model-data: 50004
modifier:
effect:
weight-add:
silver: 20
gold: 10

View File

@@ -1,93 +0,0 @@
container-title: '<gradient:#A52A2A:#800000:#A52A2A>Sell Fish</gradient>'
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: '<green>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><bold>● <bold:false>Sell the fish'
lore:
- '<font:uniform><gradient:#E6E6FA:#48D1CC:#E6E6FA>You will gain {money}$</gradient></font>'
custom-model-data: 1
deny:
material: REDSTONE_BLOCK
display:
name: '<red><bold>● <bold:false>Denied'
lore:
- '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>Nothing to sell!</gradient></font>'
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

View File

@@ -1,20 +1,26 @@
# GUI标题
container-title: '<gradient:#A52A2A:#800000:#A52A2A>Sell Fish</gradient>'
# GUI行数
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
@@ -23,6 +29,7 @@ sounds:
confirm: minecraft:entity.villager.trade
type: player
# 销售时发生的动作
actions:
message:
enable: true
@@ -41,10 +48,11 @@ actions:
enable: false
value:
- 'cmi broadcast {player} earned {money}'
# 功能性的图标
functional-icons:
slots:
- 50
# 销售信息图标
sell:
material: IRON_BLOCK
display:
@@ -52,6 +60,7 @@ functional-icons:
lore:
- '<font:uniform><gradient:#E6E6FA:#48D1CC:#E6E6FA>You will gain {money}$</gradient></font>'
custom-model-data: 1
# 拒绝图标
deny:
material: REDSTONE_BLOCK
display:
@@ -60,6 +69,7 @@ functional-icons:
- '<font:uniform><gradient:#E6E6FA:red:#E6E6FA>Nothing to sell!</gradient></font>'
custom-model-data: 1
# 装饰性的图标
decorative-icons:
glass-pane:
material: BLACK_STAINED_GLASS_PANE

View File

@@ -20,7 +20,7 @@ double_loot_fishing_totem:
NIGHT_VISION: 1
# Fishing bonus
modifier:
effect:
double-loot: 1
# placeholders: {activator} {player} {world} {x} {y} {z}
@@ -35,12 +35,19 @@ double_loot_fishing_totem:
# The layout of the totem
# 图腾的摆放放
# The greater the layer number is, the higher the y position is
# 层数越高则对应的Y坐标也越高
# Totem core can be put anywhere in the layout
# 图腾核心可以位于摆放中的任意位置
# “*” represents any type of block is allowed here [example *]
# “*” 代表这个位置可以用任何方块
# “()“ represents the block is protected and will not be removed when activating [example (a)]
# “()“ 代表图腾激活后此方块会被保护
# “>“ represents the block would turn into another block after activating [example: a>b]
# ">" 代表图腾激活后,左边的方块会变成右边的方块
# “|“ represents alternative block choice for this place [example a|b>c]
# “|“ 代表这个位置可以使用多种替选方块
layer:
4:
- '(p) (o) (p)'

View File

@@ -1,7 +1,7 @@
fishfinder:
material: COMPASS
material: PAPER
display:
name: '<gray>Fish Finder'
lore:
- '<white>Right click to see what fish can be caught in this place!'
custom-model-data: 50001
custom-model-data: 50000