mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 11:29:15 +00:00
fix bugs
This commit is contained in:
@@ -788,7 +788,9 @@ public class ActionManagerImpl implements ActionManager {
|
||||
registerAction("random-title", (args, chance) -> {
|
||||
if (args instanceof ConfigurationSection section) {
|
||||
List<String> titles = section.getStringList("titles");
|
||||
if (titles.size() == 0) titles.add("");
|
||||
List<String> subtitles = section.getStringList("subtitles");
|
||||
if (subtitles.size() == 0) subtitles.add("");
|
||||
int fadeIn = section.getInt("fade-in", 20);
|
||||
int stay = section.getInt("stay", 30);
|
||||
int fadeOut = section.getInt("fade-out", 10);
|
||||
|
||||
@@ -182,12 +182,13 @@ public class Competition implements FishingCompetition {
|
||||
Pair<String, Double> competitionPlayer = iterator.next();
|
||||
this.publicPlaceholders.put("{" + i + "_player}", competitionPlayer.left());
|
||||
this.publicPlaceholders.put("{" + i + "_score}", String.format("%.2f", competitionPlayer.right()));
|
||||
i++;
|
||||
if (i < rewardsMap.size()) {
|
||||
Player player = Bukkit.getPlayer(competitionPlayer.left());
|
||||
if (player != null)
|
||||
for (Action action : rewardsMap.get(String.valueOf(i)))
|
||||
action.trigger(new Condition(player));
|
||||
i++;
|
||||
|
||||
} else {
|
||||
Action[] actions = rewardsMap.get("participation");
|
||||
if (actions != null) {
|
||||
|
||||
@@ -322,15 +322,7 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
// Store fishhook entity and apply the effects
|
||||
final FishHook fishHook = event.getHook();
|
||||
this.hookCacheMap.put(player.getUniqueId(), fishHook);
|
||||
// fishHook.setMaxWaitTime(Math.max(100, (int) (fishHook.getMaxWaitTime() * initialEffect.getHookTimeModifier())));
|
||||
// fishHook.setMinWaitTime(Math.max(100, (int) (fishHook.getMinWaitTime() * initialEffect.getHookTimeModifier())));
|
||||
if (CFConfig.overrideVanilla) {
|
||||
double initialTime = ThreadLocalRandom.current().nextInt(CFConfig.waterMaxTime - CFConfig.waterMinTime + 1) + CFConfig.waterMinTime;
|
||||
fishHook.setWaitTime(Math.max(1, (int) (initialTime * initialEffect.getWaitTimeMultiplier() + initialEffect.getWaitTime())));
|
||||
} else {
|
||||
fishHook.setMaxWaitTime(Math.max(2, (int) (fishHook.getMaxWaitTime() * initialEffect.getWaitTimeMultiplier() + initialEffect.getWaitTime())));
|
||||
fishHook.setMinWaitTime(Math.max(1, (int) (fishHook.getMinWaitTime() * initialEffect.getWaitTimeMultiplier() + initialEffect.getWaitTime())));
|
||||
}
|
||||
|
||||
// Reduce amount & Send animation
|
||||
var baitItem = fishingPreparation.getBaitItemStack();
|
||||
if (baitItem != null) {
|
||||
|
||||
@@ -113,7 +113,8 @@ public class HookCheckTimerTask implements Runnable {
|
||||
this.fishingPreparation.triggerActions(ActionTrigger.LAND);
|
||||
FishHookLandEvent event = new FishHookLandEvent(fishingPreparation.getPlayer(), FishHookLandEvent.Target.LAVA, fishHook, initialEffect);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
firstTime = false;
|
||||
this.setWaitTime();
|
||||
this.firstTime = false;
|
||||
this.setTempState();
|
||||
}
|
||||
// simulate fishing mechanic
|
||||
@@ -148,6 +149,7 @@ public class HookCheckTimerTask implements Runnable {
|
||||
// if the hook is in water
|
||||
// then cancel the task
|
||||
this.destroy();
|
||||
this.setWaitTime();
|
||||
this.setTempState();
|
||||
return;
|
||||
}
|
||||
@@ -289,4 +291,14 @@ public class HookCheckTimerTask implements Runnable {
|
||||
public boolean isFishHooked() {
|
||||
return fishHooked;
|
||||
}
|
||||
|
||||
private void setWaitTime() {
|
||||
if (CFConfig.overrideVanilla) {
|
||||
double initialTime = ThreadLocalRandom.current().nextInt(CFConfig.waterMaxTime - CFConfig.waterMinTime + 1) + CFConfig.waterMinTime;
|
||||
fishHook.setWaitTime(Math.max(1, (int) (initialTime * initialEffect.getWaitTimeMultiplier() + initialEffect.getWaitTime())));
|
||||
} else {
|
||||
fishHook.setMaxWaitTime(Math.max(2, (int) (fishHook.getMaxWaitTime() * initialEffect.getWaitTimeMultiplier() + initialEffect.getWaitTime())));
|
||||
fishHook.setMinWaitTime(Math.max(1, (int) (fishHook.getMinWaitTime() * initialEffect.getWaitTimeMultiplier() + initialEffect.getWaitTime())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user