Add DepthCommand to toggle Depth Counter
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-03-13 17:04:59 +01:00
parent 34e4cd7060
commit 9eca9ab990
4 changed files with 53 additions and 1 deletions

View File

@ -406,6 +406,8 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e
BLOCK_COUNTER_ENABLE=§7BlockCounter activated BLOCK_COUNTER_ENABLE=§7BlockCounter activated
BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated
# DepthCounter # DepthCounter
DEPTH_COUNTER_DISABLE=§7Depth Counter disabled
DEPTH_COUNTER_ENABLE=§7Depth Counter enabled
DEPTH_COUNTER_MESSAGE=§7Depth §8> §7 DEPTH_COUNTER_MESSAGE=§7Depth §8> §7
DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5} DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5}
DEPTH_COUNTER_HOVER=§7X§8×§7Y§8×§7Z DEPTH_COUNTER_HOVER=§7X§8×§7Y§8×§7Z

View File

@ -369,6 +369,8 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT
BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht
BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht
# DepthCounter # DepthCounter
DEPTH_COUNTER_DISABLE=§7Depth Counter deaktiviert
DEPTH_COUNTER_ENABLE=§7Depth Counter aktiviert
DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7 DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7
# TPSLimit # TPSLimit
TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein

View File

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.cannon.depth; package de.steamwar.bausystem.features.cannon.depth;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionExtensionType;
@ -65,7 +66,9 @@ public class Depth {
dimensions.setZ(Math.abs(dimensions.getZ())); dimensions.setZ(Math.abs(dimensions.getZ()));
RegionUtils.message(region, player -> { RegionUtils.message(region, player -> {
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount)); if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount));
}
}); });
} }

View File

@ -0,0 +1,45 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 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.features.cannon.depth;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.entity.Player;
@Linked
public class DepthCommand extends SWCommand {
public DepthCommand() {
super("depth");
}
@Register
public void toggle(Player player) {
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
Config.getInstance().get(player).put("depth_message", false);
BauSystem.MESSAGE.send("DEPTH_COUNTER_DISABLE", player);
} else {
Config.getInstance().get(player).put("depth_message", true);
BauSystem.MESSAGE.send("DEPTH_COUNTER_ENABLE", player);
}
}
}