mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-29 11:59:11 +00:00
fix bugs
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package net.momirealms.customfishing.command.sub;
|
||||
|
||||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import dev.jorel.commandapi.CommandAPICommand;
|
||||
import dev.jorel.commandapi.IStringTooltip;
|
||||
import dev.jorel.commandapi.StringTooltip;
|
||||
@@ -32,7 +33,10 @@ import net.momirealms.customfishing.api.mechanic.condition.FishingPreparation;
|
||||
import net.momirealms.customfishing.api.mechanic.effect.EffectCarrier;
|
||||
import net.momirealms.customfishing.api.mechanic.effect.EffectModifier;
|
||||
import net.momirealms.customfishing.api.mechanic.effect.FishingEffect;
|
||||
import net.momirealms.customfishing.util.ConfigUtils;
|
||||
import net.momirealms.customfishing.util.NBTUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -50,7 +54,8 @@ public class DebugCommand {
|
||||
getBiomeCommand(),
|
||||
getSeasonCommand(),
|
||||
getGroupCommand(),
|
||||
getCategoryCommand()
|
||||
getCategoryCommand(),
|
||||
getNBTCommand()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,6 +66,20 @@ public class DebugCommand {
|
||||
});
|
||||
}
|
||||
|
||||
public CommandAPICommand getNBTCommand() {
|
||||
return new CommandAPICommand("nbt")
|
||||
.executesPlayer((player, arg) -> {
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (item.getType() == Material.AIR)
|
||||
return;
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
ConfigUtils.mapToReadableStringList(NBTUtils.compoundToMap(new NBTItem(item)), list, 0, false);
|
||||
for (String line : list) {
|
||||
AdventureManagerImpl.getInstance().sendMessage(player, line);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CommandAPICommand getSeasonCommand() {
|
||||
return new CommandAPICommand("season")
|
||||
.executesPlayer((player, arg) -> {
|
||||
|
||||
@@ -182,13 +182,11 @@ 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));
|
||||
|
||||
} else {
|
||||
Action[] actions = rewardsMap.get("participation");
|
||||
if (actions != null) {
|
||||
@@ -199,6 +197,7 @@ public class Competition implements FishingCompetition {
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -726,7 +726,7 @@ public class ItemManagerImpl implements ItemManager, Listener {
|
||||
if (size == null) return this;
|
||||
editors.put("size", (player, nbtItem, placeholders) -> {
|
||||
NBTCompound cfCompound = nbtItem.getOrCreateCompound("CustomFishing");
|
||||
float random = size.left() + ThreadLocalRandom.current().nextFloat(size.right() - size.left());
|
||||
float random = size.left() + size.left() <= size.right() ? 0 : ThreadLocalRandom.current().nextFloat(size.right() - size.left());
|
||||
float bonus = Float.parseFloat(placeholders.getOrDefault("{size-multiplier}", "1.0"));
|
||||
double fixed = Double.parseDouble(placeholders.getOrDefault("{size-fixed}", "0.0"));
|
||||
random *= bonus;
|
||||
|
||||
Reference in New Issue
Block a user