Dieser Commit ist enthalten in:
Ursprung
b47753d400
Commit
312381d47c
@ -21,7 +21,6 @@ package de.steamwar.bausystem.configplayer;
|
||||
|
||||
import de.steamwar.bausystem.config.ConfigField;
|
||||
import de.steamwar.bausystem.config.YamlConfig;
|
||||
import de.steamwar.bausystem.features.testblock.depthcounter.CountMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import lombok.Getter;
|
||||
@ -33,10 +32,8 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Config extends YamlConfig {
|
||||
|
||||
@ -61,11 +58,27 @@ public class Config extends YamlConfig {
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigField
|
||||
private List<String> depthCounter;
|
||||
private boolean simulatorAutoTrace;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigField
|
||||
private boolean simulatorAutoTrace;
|
||||
private boolean detonatorAutostart;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigField
|
||||
private boolean blockCounter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigField
|
||||
private boolean smartPlace;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigField
|
||||
private boolean inventoryFill;
|
||||
|
||||
@Getter
|
||||
@ConfigField
|
||||
@ -75,9 +88,6 @@ public class Config extends YamlConfig {
|
||||
super(configuration);
|
||||
this.uuid = uuid;
|
||||
|
||||
if(depthCounter == null)
|
||||
depthCounter = CountMode.ALL().stream().map(CountMode::name).collect(Collectors.toList());
|
||||
|
||||
if(baugui.isEmpty()) {
|
||||
// 0: ? | 1: ? | 2: 10 | 3: 3 | 4: 7 | 5: 17 | 6: 15 | 7: ? | 8: ?
|
||||
// 9: 5 | 10: ? | 11: ? | 12: ? | 13: ? | 14: ? | 15: ? | 16: ? | 17: 16
|
||||
|
@ -79,7 +79,7 @@ public class Detonator {
|
||||
|
||||
public static void activateDetonator(DetonatorStorage detonator) {
|
||||
Player p = detonator.getPlayer();
|
||||
if (Config.getInstance().get(p).getPlainValueOrDefault("detonator-autostart", false)) {
|
||||
if (Config.get(p).isDetonatorAutostart()) {
|
||||
AutostartListener.instance.activate(p);
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ public class DetonatorCommand extends SWCommand {
|
||||
|
||||
@Register(value = "autostart", description = "DETONATOR_HELP_AUTOSTART")
|
||||
public void toggleAutostartTimer(Player p) {
|
||||
boolean current = Config.getInstance().get(p).getPlainValueOrDefault("detonator-autostart", false);
|
||||
Config.getInstance().get(p).put("detonator-autostart", !current);
|
||||
boolean current = Config.get(p).isDetonatorAutostart();
|
||||
Config.get(p).setDetonatorAutostart(!current);
|
||||
if (!current) {
|
||||
BauSystem.MESSAGE.send("DETONATOR_AUTOSTART_ENABLE", p);
|
||||
} else {
|
||||
|
@ -30,7 +30,7 @@ public class InventoryFillBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
||||
String loreKey = Config.get(player).isInventoryFill() ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
||||
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {}).getItemStack();
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class InventoryFiller implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||
if (!Config.get(event.getPlayer()).isInventoryFill()) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
Block block = event.getPlayer().getTargetBlockExact(5);
|
||||
if (block == null) return;
|
||||
@ -59,7 +59,7 @@ public class InventoryFiller implements Listener {
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||
if (!Config.get(event.getPlayer()).isInventoryFill()) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if (itemStack.getType() == Material.AIR) return;
|
||||
|
@ -16,8 +16,8 @@ public class InventoryFillerCommand extends SWCommand {
|
||||
|
||||
@Register(description = {"INVENTORY_FILL_HELP", "INVENTORY_FILL_INFO"})
|
||||
public void toggle(Player player) {
|
||||
boolean inventoryFill = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false);
|
||||
Config.getInstance().get(player).put("inventoryfill", !inventoryFill);
|
||||
boolean inventoryFill = Config.get(player).isInventoryFill();
|
||||
Config.get(player).setInventoryFill(!inventoryFill);
|
||||
if (!inventoryFill) {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player));
|
||||
BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player);
|
||||
|
@ -119,9 +119,9 @@ public class TNTSimulatorGui {
|
||||
}));
|
||||
}
|
||||
|
||||
boolean simulatorAutoTrace = Config.getInstance().get(player).getPlainValueOrDefault("simulatorAutoTrace", false);
|
||||
boolean simulatorAutoTrace = Config.get(player).isSimulatorAutoTrace();
|
||||
inv.setItem(47, new SWItem(simulatorAutoTrace ? Material.CHAIN_COMMAND_BLOCK : Material.COMMAND_BLOCK, BauSystem.MESSAGE.parse("SIMULATOR_GUI_AUTO_TRACE", player, simulatorAutoTrace), clickType -> {
|
||||
Config.getInstance().get(player).put("simulatorAutoTrace", !simulatorAutoTrace);
|
||||
Config.get(player).setSimulatorAutoTrace(!simulatorAutoTrace);
|
||||
open(player, currentTntSimulator, currentTntGroup, simulatorElements, back);
|
||||
}));
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ public class SmartPlaceCommand extends SWCommand {
|
||||
|
||||
@Register(description = {"SMART_PLACE_HELP", "SMART_PLACE_INFO"})
|
||||
public void genericToggle(Player p) {
|
||||
boolean smartPlace = Config.getInstance().get(p).getPlainValueOrDefault("smartPlace", false);
|
||||
Config.getInstance().get(p).put("smartPlace", !smartPlace);
|
||||
boolean smartPlace = Config.get(p).isSmartPlace();
|
||||
Config.get(p).setSmartPlace(!smartPlace);
|
||||
if (!smartPlace) {
|
||||
SWUtils.sendToActionbar(p, BauSystem.MESSAGE.parse("SMART_PLACE_ENABLE", p));
|
||||
BauSystem.MESSAGE.send("SMART_PLACE_INFO", p);
|
||||
|
@ -46,7 +46,7 @@ public class SmartPlaceListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
if (!Config.get(event.getPlayer()).isSmartPlace()) return;
|
||||
if (smartPlaceBehaviours.isEmpty()) LinkageUtils.linkSmartPlace();
|
||||
SmartPlaceBehaviour.SmartPlaceResult smartPlaceResult = SmartPlaceBehaviour.SmartPlaceResult.IGNORED;
|
||||
for (SmartPlaceBehaviour smartPlaceBehaviour : smartPlaceBehaviours) {
|
||||
@ -61,7 +61,7 @@ public class SmartPlaceListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
if (!Config.get(event.getPlayer()).isSmartPlace()) return;
|
||||
if (smartPlaceBehaviours.isEmpty()) LinkageUtils.linkSmartPlace();
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if (event.getPlayer().getGameMode() == GameMode.SPECTATOR) return;
|
||||
|
@ -34,18 +34,15 @@ public class BlockCounter {
|
||||
public final Map<Region, BlockCount> blockCountMap = new HashMap<>();
|
||||
|
||||
public boolean isActive(final Player p) {
|
||||
if (!Config.getInstance().get(p).containsKey("blockCounter")) {
|
||||
return false;
|
||||
}
|
||||
return Config.getInstance().get(p).getPlainValue("blockCounter");
|
||||
return Config.get(p).isBlockCounter();
|
||||
}
|
||||
|
||||
public void enable(final Player p) {
|
||||
Config.getInstance().get(p).put("blockCounter", true);
|
||||
Config.get(p).setBlockCounter(true);
|
||||
}
|
||||
|
||||
public void disable(final Player p) {
|
||||
Config.getInstance().get(p).put("blockCounter", false);
|
||||
Config.get(p).setBlockCounter(false);
|
||||
}
|
||||
|
||||
public String getMessage(Player player, int count, int tntCount, long tick, long lastTick) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren