mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-29 11:59:11 +00:00
1.3.0-beta-4
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package net.momirealms.customfishing.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class DataFunction extends Function {
|
||||
|
||||
protected final HashMap<UUID, Integer> triedTimes;
|
||||
|
||||
public DataFunction() {
|
||||
this.triedTimes = new HashMap<>();
|
||||
}
|
||||
|
||||
protected boolean checkTriedTimes(UUID uuid) {
|
||||
Integer previous = triedTimes.get(uuid);
|
||||
if (previous == null) {
|
||||
triedTimes.put(uuid, 1);
|
||||
return false;
|
||||
}
|
||||
else if (previous > 2) {
|
||||
triedTimes.remove(uuid);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
triedTimes.put(uuid, previous + 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user