9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2026-01-04 15:41:35 +00:00

checkpoint - 29

This commit is contained in:
XiaoMoMi
2024-07-07 05:10:00 +08:00
parent 8a0b969f23
commit 91a14727f2
29 changed files with 853 additions and 210 deletions

View File

@@ -21,9 +21,7 @@ import net.momirealms.customfishing.api.mechanic.context.Context;
import net.momirealms.customfishing.api.mechanic.loot.Loot;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;

View File

@@ -23,7 +23,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface BlockManager extends Reloadable {

View File

@@ -64,6 +64,7 @@ public class ContextKeys<T> {
public static final ContextKeys<String> REST_FORMATTED = of("rest_formatted", String.class);
public static final ContextKeys<Integer> SOLD_ITEM_AMOUNT = of("sold_item_amount", Integer.class);
public static final ContextKeys<Integer> AMOUNT = of("amount", Integer.class);
public static final ContextKeys<Integer> TOTAL_AMOUNT = of("total_amount", Integer.class);
public static final ContextKeys<Double> WEIGHT = of("0", Double.class);
public static final ContextKeys<String> TIME_LEFT = of("time_left", String.class);
public static final ContextKeys<String> PROGRESS = of("progress", String.class);

View File

@@ -22,7 +22,6 @@ import net.momirealms.customfishing.common.plugin.feature.Reloadable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;

View File

@@ -434,12 +434,13 @@ public class CustomFishingHook {
if (!nextLoot.disableStats()) {
plugin.getStorageManager().getOnlineUser(player.getUniqueId()).ifPresent(
userData -> {
userData.statistics().addAmount(id, 1);
userData.statistics().addAmount(nextLoot.statisticKey().amountKey(), 1);
context.arg(ContextKeys.TOTAL_AMOUNT, userData.statistics().getAmount(nextLoot.statisticKey().amountKey()));
Optional.ofNullable(context.arg(ContextKeys.SIZE)).ifPresent(size -> {
float max = Math.max(0, userData.statistics().getMaxSize(id));
float max = Math.max(0, userData.statistics().getMaxSize(nextLoot.statisticKey().sizeKey()));
context.arg(ContextKeys.RECORD, max);
context.arg(ContextKeys.RECORD_FORMATTED, String.format("%.2f", max));
if (userData.statistics().updateSize(id, size)) {
if (userData.statistics().updateSize(nextLoot.statisticKey().sizeKey(), size)) {
plugin.getEventManager().trigger(context, id, type, ActionTrigger.NEW_SIZE_RECORD);
}
});

View File

@@ -24,7 +24,7 @@ import org.bukkit.inventory.ItemStack;
public interface MarketManager extends Reloadable {
void openMarketGUI(Player player);
boolean openMarketGUI(Player player);
double getItemPrice(Context<Player> context, ItemStack itemStack);

View File

@@ -147,4 +147,9 @@ public interface FishingStatistics {
*/
FishingStatistics build();
}
enum Type {
MAX_SIZE,
AMOUNT_OF_FISH_CAUGHT
}
}