mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-29 03:49:07 +00:00
1.2.5
This commit is contained in:
@@ -71,6 +71,7 @@ public class ConfigManager {
|
||||
public static boolean logEarning;
|
||||
public static boolean vaultHook;
|
||||
public static boolean disableBar;
|
||||
public static boolean instantBar;
|
||||
public static String fishingBagTitle;
|
||||
public static HashSet<Material> bagWhiteListItems;
|
||||
|
||||
@@ -96,6 +97,7 @@ public class ConfigManager {
|
||||
worlds = worldList.toArray(new World[0]);
|
||||
|
||||
disableBar = config.getBoolean("mechanics.disable-bar-mechanic", false);
|
||||
instantBar = config.getBoolean("mechanics.instant-bar", false);
|
||||
alwaysFishingBar = config.getBoolean("mechanics.other-loots.fishing-bar", true);
|
||||
otherLootBar = config.getBoolean("mechanics.other-loots.fishing-bar", true);
|
||||
enableVanillaLoot = config.getBoolean("mechanics.other-loots.vanilla.enable", true);
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.momirealms.customcrops.config.MainConfig;
|
||||
import net.momirealms.customfishing.CustomFishing;
|
||||
import net.momirealms.customfishing.api.event.*;
|
||||
import net.momirealms.customfishing.competition.Competition;
|
||||
@@ -255,7 +256,7 @@ public class FishingManager extends Function {
|
||||
|
||||
nextBonus.put(player, initialBonus);
|
||||
|
||||
if (ConfigManager.needRodToFish && noSpecialRod){
|
||||
if (ConfigManager.needRodToFish && noSpecialRod) {
|
||||
nextLoot.put(player, Loot.EMPTY);
|
||||
return;
|
||||
}
|
||||
@@ -263,7 +264,7 @@ public class FishingManager extends Function {
|
||||
int entityID = 0;
|
||||
if (baitItem != null) {
|
||||
baitItem.setAmount(1);
|
||||
entityID = new Random().nextInt(1000000);
|
||||
entityID = new Random().nextInt(100000000);
|
||||
try {
|
||||
CustomFishing.protocolManager.sendServerPacket(player, FakeItemUtil.getSpawnPacket(entityID, fishHook.getLocation()));
|
||||
CustomFishing.protocolManager.sendServerPacket(player, FakeItemUtil.getMetaPacket(entityID, baitItem));
|
||||
@@ -434,8 +435,8 @@ public class FishingManager extends Function {
|
||||
summonMob(player, loot, event.getHook().getLocation(), mob, bonus.getScore());
|
||||
return;
|
||||
}
|
||||
if (loot instanceof DroppedItem droppedItem){
|
||||
if (ConfigManager.enableMcMMOLoot && Math.random() < ConfigManager.mcMMOLootChance){
|
||||
if (loot instanceof DroppedItem droppedItem) {
|
||||
if (ConfigManager.enableMcMMOLoot && Math.random() < ConfigManager.mcMMOLootChance) {
|
||||
if (dropMcMMOLoot(player, event.getHook().getLocation(), bonus.getDoubleLoot() > Math.random())){
|
||||
return;
|
||||
}
|
||||
@@ -495,7 +496,9 @@ public class FishingManager extends Function {
|
||||
//not in fishing
|
||||
BobberCheckTask bobberCheckTask = bobberTaskCache.get(player);
|
||||
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
||||
showPlayerBar(player, nextLoot.get(player));
|
||||
Loot loot = nextLoot.get(player);
|
||||
if (loot == Loot.EMPTY) return;
|
||||
showPlayerBar(player, loot);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -754,7 +757,19 @@ public class FishingManager extends Function {
|
||||
}
|
||||
|
||||
public void onBite(PlayerFishEvent event) {
|
||||
//Empty
|
||||
if (ConfigManager.disableBar) return;
|
||||
if (!ConfigManager.instantBar) return;
|
||||
final Player player = event.getPlayer();
|
||||
showBar(player);
|
||||
}
|
||||
|
||||
public void showBar(Player player) {
|
||||
if (fishingPlayerCache.get(player) != null) return;
|
||||
Loot loot = nextLoot.get(player);
|
||||
if (loot != null) {
|
||||
if (loot == Loot.EMPTY) return;
|
||||
showPlayerBar(player, loot);
|
||||
}
|
||||
}
|
||||
|
||||
public void onInGround(PlayerFishEvent event) {
|
||||
@@ -896,8 +911,6 @@ public class FishingManager extends Function {
|
||||
|
||||
private void showPlayerBar(Player player, @Nullable Loot loot){
|
||||
|
||||
if (loot == Loot.EMPTY) return;
|
||||
|
||||
Layout layout;
|
||||
if (loot != null && loot.getLayout() != null){
|
||||
layout = loot.getLayout()[new Random().nextInt(loot.getLayout().length)];
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -88,6 +89,11 @@ public class BobberCheckTask extends BukkitRunnable {
|
||||
}
|
||||
if (timer > 3600) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
if (fishHook.getHookedEntity() != null && fishHook.getHookedEntity().getType() != EntityType.ARMOR_STAND) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
if (!fishHook.isValid()) {
|
||||
stop();
|
||||
@@ -100,6 +106,7 @@ public class BobberCheckTask extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
if (first) {
|
||||
sendRemovePacket();
|
||||
ArmorStandUtil.sendAnimationToPlayer(fishHook.getLocation(), player, ConfigManager.lava_item, ConfigManager.lava_time);
|
||||
first = false;
|
||||
}
|
||||
@@ -148,13 +155,16 @@ public class BobberCheckTask extends BukkitRunnable {
|
||||
entityCache.remove();
|
||||
entityCache = null;
|
||||
}
|
||||
if (entityID != 0) {
|
||||
try {
|
||||
CustomFishing.protocolManager.sendServerPacket(player, FakeItemUtil.getDestroyPacket(entityID));
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sendRemovePacket();
|
||||
}
|
||||
|
||||
private void sendRemovePacket() {
|
||||
if (entityID == 0) return;
|
||||
try {
|
||||
CustomFishing.protocolManager.sendServerPacket(player, FakeItemUtil.getDestroyPacket(entityID));
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +197,7 @@ public class BobberCheckTask extends BukkitRunnable {
|
||||
hooked = true;
|
||||
if (entityCache != null && !entityCache.isDead()) entityCache.remove();
|
||||
AdventureUtil.playerSound(player, Sound.Source.NEUTRAL, Key.key("minecraft:block.pointed_dripstone.drip_lava_into_cauldron"), 1, 1);
|
||||
if (ConfigManager.instantBar) fishingManager.showBar(player);
|
||||
}, random);
|
||||
cache_2 = Bukkit.getScheduler().runTaskLater(CustomFishing.plugin, () -> {
|
||||
hooked = false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# don't change
|
||||
config-version: '12'
|
||||
config-version: '13'
|
||||
|
||||
# chinese/english/spanish
|
||||
lang: english
|
||||
@@ -50,7 +50,13 @@ worlds:
|
||||
mechanics:
|
||||
|
||||
# Disable the fishing bar totally
|
||||
# 关闭捕鱼条
|
||||
disable-bar-mechanic: false
|
||||
# Does the fishing bar show up instantly when the fish is hooked
|
||||
# [Note] In this mode, vanilla loots are not available unless you add them to the loot system!
|
||||
# 是否在鱼咬钩后立刻显示捕鱼条,而不是需要右键后才显示
|
||||
# 注意:启用本设置会导致无法获取原版钓鱼战利品
|
||||
instant-bar: false
|
||||
|
||||
other-loots:
|
||||
# Should other loots have the same fishing mechanic CustomFishing provides
|
||||
|
||||
Reference in New Issue
Block a user