Cleanstate
Dieser Commit ist enthalten in:
Ursprung
3efad52ec3
Commit
fa8ba1ab81
@ -22,16 +22,13 @@ package de.steamwar.bausystem.region;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonPrimitive;
|
import com.google.gson.JsonPrimitive;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.FlagType;
|
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.FREEZE;
|
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.TNT;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class FlagStorage {
|
public class FlagStorage {
|
||||||
|
|
||||||
protected final Map<FlagType<?>, Flag.Value<?>> flags;
|
protected final Map<Flag, Flag.Value<?>> flags;
|
||||||
protected final JsonObject jsonObject;
|
protected final JsonObject jsonObject;
|
||||||
|
|
||||||
public FlagStorage(final JsonObject jsonObject) {
|
public FlagStorage(final JsonObject jsonObject) {
|
||||||
@ -40,12 +37,11 @@ public class FlagStorage {
|
|||||||
readKeys();
|
readKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Enum<T> & Flag.Value<T>> boolean set(final FlagType<T> flagType, final Flag.Value<T> value) {
|
public boolean set(final Flag flagType, final Flag.Value<?> value) {
|
||||||
return flags.put(flagType, value) != value;
|
return flags.put(flagType, value) != value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Flag.Value<?> get(final Flag flagType) {
|
public Flag.Value<?> get(final Flag flagType) {
|
||||||
set(Flag.TNT_FLAG, TNT.ALLOW);
|
|
||||||
return flags.get(flagType);
|
return flags.get(flagType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.region.flags;
|
|
||||||
|
|
||||||
public interface FlagType<T extends Flag.Value<?>> {
|
|
||||||
|
|
||||||
String name();
|
|
||||||
}
|
|
In neuem Issue referenzieren
Einen Benutzer sperren