Added CommandData#has and allow #set chaining

This commit is contained in:
themode 2021-02-12 08:34:05 +01:00
parent c9ab710be2
commit 33a26b80f5

View File

@ -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;