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