mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-08 08:21:50 +01:00
Added CommandData#has and allow #set chaining
This commit is contained in:
parent
c9ab710be2
commit
33a26b80f5
@ -10,8 +10,9 @@ public class CommandData {
|
|||||||
|
|
||||||
private final Map<String, Object> dataMap = new ConcurrentHashMap<>();
|
private final Map<String, Object> dataMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public void set(@NotNull String key, Object value) {
|
public CommandData set(@NotNull String key, Object value) {
|
||||||
this.dataMap.put(key, value);
|
this.dataMap.put(key, value);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -19,6 +20,10 @@ public class CommandData {
|
|||||||
return (T) dataMap.get(key);
|
return (T) dataMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean has(@NotNull String key) {
|
||||||
|
return dataMap.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Map<String, Object> getDataMap() {
|
public Map<String, Object> getDataMap() {
|
||||||
return dataMap;
|
return dataMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user