mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-19 15:09:24 +00:00
added actionbar tip
This commit is contained in:
@@ -86,7 +86,9 @@ public class ContextKeys<T> {
|
||||
public static final ContextKeys<String> TIME_LEFT = of("time_left", String.class);
|
||||
public static final ContextKeys<String> PROGRESS = of("progress", String.class);
|
||||
public static final ContextKeys<Float> RECORD = of("record", Float.class);
|
||||
public static final ContextKeys<Float> PREVIOUS_RECORD = of("previous_record", Float.class);
|
||||
public static final ContextKeys<String> RECORD_FORMATTED = of("record_formatted", String.class);
|
||||
public static final ContextKeys<String> PREVIOUS_RECORD_FORMATTED = of("previous_record_formatted", String.class);
|
||||
public static final ContextKeys<Integer> CLICKS_LEFT = of("left_clicks", Integer.class);
|
||||
public static final ContextKeys<Integer> REQUIRED_TIMES = of("clicks", Integer.class);
|
||||
public static final ContextKeys<EquipmentSlot> SLOT = of("hand", EquipmentSlot.class);
|
||||
|
||||
@@ -620,9 +620,12 @@ public class CustomFishingHook {
|
||||
Pair<Integer, Integer> result = 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(size, userData.statistics().getMaxSize(nextLoot.statisticKey().sizeKey()));
|
||||
float currentRecord = userData.statistics().getMaxSize(nextLoot.statisticKey().sizeKey());
|
||||
float max = Math.max(size, currentRecord);
|
||||
context.arg(ContextKeys.RECORD, max);
|
||||
context.arg(ContextKeys.PREVIOUS_RECORD, currentRecord);
|
||||
context.arg(ContextKeys.RECORD_FORMATTED, String.format("%.2f", max));
|
||||
context.arg(ContextKeys.PREVIOUS_RECORD_FORMATTED, String.format("%.2f", currentRecord));
|
||||
if (userData.statistics().updateSize(nextLoot.statisticKey().sizeKey(), size)) {
|
||||
plugin.getEventManager().trigger(context, id, MechanicType.LOOT, ActionTrigger.NEW_SIZE_RECORD);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user