mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 00:44:46 +01:00
Refactoring (#1660)
* Refactor a couple of iterators * Use side-effect instead of second iterator * Make World::onTick return shouldDelete instead of success * Replace Shop iterator with side effects * Scene * Clean up Expeditions * Refactor Expeditions * Clean up Expeditions, Player * Limit Expeditions by AR * Lombokify props Co-authored-by: AnimeGitB <AnimeGitB@bigblueball.in>
This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
public enum PlayerProperty {
|
||||
PROP_NONE (0),
|
||||
@@ -53,8 +54,8 @@ public enum PlayerProperty {
|
||||
PROP_PLAYER_WAIT_SUB_HOME_COIN (10043);
|
||||
|
||||
private static final int inf = Integer.MAX_VALUE; // Maybe this should be something else?
|
||||
private final int id, min, max;
|
||||
private final boolean dynamicRange;
|
||||
@Getter private final int id, min, max;
|
||||
@Getter private final boolean dynamicRange;
|
||||
private static final Int2ObjectMap<PlayerProperty> map = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
static {
|
||||
@@ -84,22 +85,6 @@ public enum PlayerProperty {
|
||||
this(id, Integer.MIN_VALUE, inf, dynamicRange);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getMin() {
|
||||
return this.min;
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return this.max;
|
||||
}
|
||||
|
||||
public boolean getDynamicRange() {
|
||||
return dynamicRange;
|
||||
}
|
||||
|
||||
public static PlayerProperty getPropById(int value) {
|
||||
return map.getOrDefault(value, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user