Compare commits

...

6 Commits

Author SHA1 Message Date
08afee6f38 Add SettingsCommand
Some checks failed
SteamWarCI Build failed
2026-04-02 10:05:35 +02:00
2ad8cc3f4a Merge branch 'RemoveUnusedSQL'
All checks were successful
SteamWarCI Build successful
2026-04-02 09:01:20 +02:00
e190fe0858 Fix FreezeListener
All checks were successful
SteamWarCI Build successful
2026-04-01 19:43:31 +02:00
569d91a0d3 Remove SelectAdjacent as it annoys most players
All checks were successful
SteamWarCI Build successful
2026-03-29 14:15:01 +02:00
404ab2abfb Update GDPRQuery
All checks were successful
SteamWarCI Build successful
2026-03-25 07:46:38 +01:00
59a927c33c Remove Team.address and Team.port
All checks were successful
SteamWarCI Build successful
Remove PollAnswer and UserElo from GDPRQuery
2026-03-24 22:11:19 +01:00
12 changed files with 129 additions and 430 deletions

View File

@@ -46,6 +46,16 @@ import org.bukkit.event.player.PlayerInteractEvent;
@Linked
public class FreezeListener implements Listener, ScoreboardElement {
@EventHandler
public void onBlockExplode(BlockExplodeEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;
e.setCancelled(true);
BlockState state = e.getBlock().getState();
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
state.update(true, false);
}, 1L);
}
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return;

View File

@@ -1,189 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.worldedit;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.core.SWPlayer;
import de.steamwar.core.WorldEditRenderer;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
@Linked
@MinVersion(20)
public class SelectAdjacent implements Listener {
private Vector[] FACES = {
new Vector(1, 0, 0),
new Vector(-1, 0, 0),
new Vector(0, 1, 0),
new Vector(0, -1, 0),
new Vector(0, 0, 1),
new Vector(0, 0, -1),
new Vector(1, 1, 0),
new Vector(1, -1, 0),
new Vector(1, 0, 1),
new Vector(1, 0, -1),
new Vector(-1, 1, 0),
new Vector(-1, -1, 0),
new Vector(-1, 0, 1),
new Vector(-1, 0, -1),
new Vector(0, 1, 1),
new Vector(0, 1, -1),
new Vector(0, -1, 1),
new Vector(0, -1, -1),
};
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!event.hasItem()) return;
if (event.getItem().getType() != Material.WOODEN_AXE) return;
if (!event.getPlayer().isSneaking()) return;
if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
Material material = event.getPlayer().getInventory().getItemInOffHand().getType();
Selector selector;
if (material.isAir()) {
selector = new Selector(event.getClickedBlock(), event.getPlayer(), __ -> true);
} else {
selector = new Selector(event.getClickedBlock(), event.getPlayer(), type -> type == material);
}
SWPlayer.of(event.getPlayer()).setComponent(selector);
}
private class Selector implements SWPlayer.Component {
private static final int MAX_BLOCKS = 500_000;
private int minX;
private int minY;
private int minZ;
private int maxX;
private int maxY;
private int maxZ;
private BukkitTask bukkitTask;
private Predicate<Material> predicate;
private Set<Location> seen = new HashSet<>();
private Set<Location> toCalc = new HashSet<>();
private Region.Area area;
public Selector(Block block, Player player, Predicate<Material> predicate) {
this.predicate = predicate;
toCalc.add(block.getLocation());
minX = block.getX();
minY = block.getY();
minZ = block.getZ();
maxX = block.getX();
maxY = block.getY();
maxZ = block.getZ();
Region region = Region.getRegion(block.getLocation());
area = Region.Area.EMPTY;
if (region.getBuildArea().inRegion(block.getLocation(), true)) {
area = region.getBuildArea();
} else if (region.getTestblockArea().inRegion(block.getLocation(), true)) {
area = region.getTestblockArea();
} else if (region.getArea().inRegion(block.getLocation(), true)) {
area = region.getArea();
}
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
run();
long volume = (long)(maxX - minX + 1) * (long)(maxY - minY + 1) * (long)(maxZ - minZ + 1);
player.sendTitle("", "§e" + volume + " §7Blocks", 0, 5, 0);
Point minPoint = new Point(minX, minY, minZ);
Point maxPoint = new Point(maxX, maxY, maxZ);
FlatteningWrapper.impl.setSelection(player, minPoint, maxPoint);
WorldEditRenderer.renderPlayer(player);
// boolean finished = toCalc.stream().allMatch(location -> {
// return location.getBlockX() >= minX && location.getBlockY() >= minY && location.getBlockZ() >= minZ &&
// location.getBlockX() <= maxX && location.getBlockY() <= maxY && location.getBlockZ() <= maxZ;
// });
if (toCalc.isEmpty() || seen.size() > MAX_BLOCKS) {
bukkitTask.cancel();
player.sendTitle("§aDone", "§e" + volume + " §7Blocks", 0, 20, 5);
SWPlayer.of(player).removeComponent(Selector.class);
}
}, 1, 1);
}
private void cancel() {
bukkitTask.cancel();
}
private void run() {
Set<Location> current = toCalc;
toCalc = new HashSet<>();
for (Location location : current) {
Block block = location.getBlock();
if (block.isEmpty() || block.isLiquid()) continue;
if (!predicate.test(block.getType())) continue;
seen.add(location);
if (!area.inRegion(block.getLocation(), true)) continue;
minX = Math.min(minX, location.getBlockX());
maxX = Math.max(maxX, location.getBlockX());
minY = Math.min(minY, location.getBlockY());
maxY = Math.max(maxY, location.getBlockY());
minZ = Math.min(minZ, location.getBlockZ());
maxZ = Math.max(maxZ, location.getBlockZ());
for (Vector face : FACES) {
Block next = block.getRelative(face.getBlockX(), face.getBlockY(), face.getBlockZ());
if (next.isEmpty() || next.isLiquid()) continue;
if (!predicate.test(next.getType())) continue;
Location loc = next.getLocation();
if (seen.contains(loc)) continue;
toCalc.add(loc);
}
}
}
@Override
public void onUnmount(SWPlayer player) {
cancel();
}
}
}

View File

@@ -254,12 +254,27 @@ class SteamwarUser(id: EntityID<Int>): IntEntity(id) {
punishments[punishment] = Punishment.createPunishment(this@SteamwarUser.id.value, from, punishment, reason, time, perma)
}
fun setLocale(locale: Locale?, manualeLocale: Boolean) {
if (locale == null || (this.manualLocale && !manualLocale)) return
fun setJoinLocale(locale: Locale?) {
if (locale == null || this.manualLocale) return
setCurrentLocale(locale)
}
fun setCurrentLocale(locale: Locale?) {
if (locale == null) return
useDb {
this@SteamwarUser.locale = locale
this@SteamwarUser.manualLocale = manualeLocale
}
}
fun lockLocale() {
useDb {
this@SteamwarUser.manualLocale = true
}
}
fun unlockLocale() {
useDb {
this@SteamwarUser.manualLocale = false
}
}

View File

@@ -32,12 +32,12 @@ object TeamTable : IntIdTable("Team", "TeamID") {
val color = char("TeamColor", 1).default("8")
val name = varchar("TeamName", 16)
val deleted = bool("TeamDeleted").default(false)
val address = text("Address").nullable()
val port = ushort("Port").default(25565u)
}
class Team(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<Team>(TeamTable) {
const val PUBLIC: Int = 0
private val teamCache = mutableMapOf<Int, Team>()
@JvmStatic

View File

@@ -1,181 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.teamserver.listener;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.world.World;
import de.steamwar.core.WorldEditRenderer;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import de.steamwar.teamserver.Builder;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import java.util.*;
import java.util.function.Predicate;
@Linked
@MinVersion(20)
public class SelectAdjacent implements Listener {
private Vector[] FACES = {
new Vector(1, 0, 0),
new Vector(-1, 0, 0),
new Vector(0, 1, 0),
new Vector(0, -1, 0),
new Vector(0, 0, 1),
new Vector(0, 0, -1),
new Vector(1, 1, 0),
new Vector(1, -1, 0),
new Vector(1, 0, 1),
new Vector(1, 0, -1),
new Vector(-1, 1, 0),
new Vector(-1, -1, 0),
new Vector(-1, 0, 1),
new Vector(-1, 0, -1),
new Vector(0, 1, 1),
new Vector(0, 1, -1),
new Vector(0, -1, 1),
new Vector(0, -1, -1),
};
private Map<Player, Selector> selectors = new HashMap<>();
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!event.hasItem()) return;
if (event.getItem().getType() != Material.WOODEN_AXE) return;
if (!event.getPlayer().isSneaking()) return;
if (event.getAction() != Action.LEFT_CLICK_BLOCK) return;
Selector selector = selectors.get(event.getPlayer());
if (selector != null) selector.cancel();
Material material = event.getPlayer().getInventory().getItemInOffHand().getType();
if (material.isAir()) {
selector = new Selector(event.getClickedBlock(), event.getPlayer(), __ -> true);
} else {
selector = new Selector(event.getClickedBlock(), event.getPlayer(), type -> type == material);
}
selectors.put(event.getPlayer(), selector);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Selector selector = selectors.remove(event.getPlayer());
if (selector != null) selector.cancel();
}
private static final WorldEditPlugin WORLDEDIT_PLUGIN = Objects.requireNonNull((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
private static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
private class Selector {
private static final int MAX_BLOCKS = 1_000_000;
private int minX;
private int minY;
private int minZ;
private int maxX;
private int maxY;
private int maxZ;
private BukkitTask bukkitTask;
private Predicate<Material> predicate;
private Set<Location> seen = new HashSet<>();
private Set<Location> toCalc = new HashSet<>();
public Selector(Block block, Player player, Predicate<Material> predicate) {
this.predicate = predicate;
toCalc.add(block.getLocation());
minX = block.getX();
minY = block.getY();
minZ = block.getZ();
maxX = block.getX();
maxY = block.getY();
maxZ = block.getZ();
bukkitTask = Bukkit.getScheduler().runTaskTimer(Builder.getInstance(), () -> {
run();
long volume = (long)(maxX - minX + 1) * (long)(maxY - minY + 1) * (long)(maxZ - minZ + 1);
player.sendTitle("", "§e" + volume + " §7Blocks", 0, 5, 0);
WORLDEDIT_PLUGIN.getSession(player).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, BlockVector3.at(minX, minY, minZ), BlockVector3.at(maxX, maxY, maxZ)));
WorldEditRenderer.renderPlayer(player);
// boolean finished = toCalc.stream().allMatch(location -> {
// return location.getBlockX() >= minX && location.getBlockY() >= minY && location.getBlockZ() >= minZ &&
// location.getBlockX() <= maxX && location.getBlockY() <= maxY && location.getBlockZ() <= maxZ;
// });
if (toCalc.isEmpty() || seen.size() > MAX_BLOCKS) {
bukkitTask.cancel();
player.sendTitle("§aDone", "§e" + volume + " §7Blocks", 0, 20, 5);
}
}, 1, 1);
}
private void cancel() {
bukkitTask.cancel();
}
private void run() {
Set<Location> current = toCalc;
toCalc = new HashSet<>();
for (Location location : current) {
Block block = location.getBlock();
if (block.isEmpty() || block.isLiquid()) continue;
if (!predicate.test(block.getType())) continue;
seen.add(location);
minX = Math.min(minX, location.getBlockX());
maxX = Math.max(maxX, location.getBlockX());
minY = Math.min(minY, location.getBlockY());
maxY = Math.max(maxY, location.getBlockY());
minZ = Math.min(minZ, location.getBlockZ());
maxZ = Math.max(maxZ, location.getBlockZ());
for (Vector face : FACES) {
Block next = block.getRelative(face.getBlockX(), face.getBlockY(), face.getBlockZ());
if (next.isEmpty() || next.isLiquid()) continue;
if (!predicate.test(next.getType())) continue;
Location loc = next.getLocation();
if (seen.contains(loc)) continue;
toCalc.add(loc);
}
}
}
}
}

View File

@@ -17,6 +17,19 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
LOCALE = English
SETTINGS_TITLE = Settings
SETTINGS_LOCALE_ITEM = §fLocale
SETTINGS_LOCALE_CURRENT = §fCurrent locale §e{0}§8.
SETTINGS_LOCALE_LOCKED = §cLocked§f to the current locale§8.
SETTINGS_LOCALE_UNLOCKED = §aChanged§f by Client locale§8.
SETTINGS_PREFIX_ITEM = §fChat prefix
SETTINGS_PREFIX_SELECTED = §a> {0}
SETTINGS_PREFIX_UNSELECTED = §f> {0}
SETTINGS_PREFIX_SW = §eS§8W
SETTINGS_PREFIX_TEAM = §{0}{1}
COMMAND_SYSTEM_ERROR = §cError executing the command!
COMMAND_HELP_HEAD=§7---=== (§e{0}§7) ===---

View File

@@ -17,6 +17,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
LOCALE = Deutsch
COMMAND_SYSTEM_ERROR = §cFehler beim Ausführen des Befehls!
PREFIX=§eSteam§8War»

View File

@@ -19,14 +19,14 @@
package de.steamwar.velocitycore.commands;
import de.steamwar.linkage.Linked;
import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.PlayerChatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import de.steamwar.sql.internal.Statement;
import de.steamwar.velocitycore.VelocityCore;
import java.io.*;
import java.util.zip.ZipEntry;
@@ -76,13 +76,11 @@ public class GDPRQuery extends SWCommand {
sqlCSV(user, out, bauweltMember, "BuildMember.csv");
sqlCSV(user, out, bauweltMembers, "BuildMembers.csv");
sqlCSV(user, out, checkedSchems, "SchematicChecksessions.csv");
sqlCSV(user, out, userElo, "UserElo.csv");
sqlCSV(user, out, fights, "Fights.csv");
sqlCSV(user, out, ignoredPlayers, "IgnoredPlayers.csv");
sqlCSV(user, out, ignoringPlayers, "IgnoringPlayers.csv");
sqlCSV(user, out, schematicMember, "SchematicMember.csv");
sqlCSV(user, out, schematicMembers, "SchematicMembers.csv");
sqlCSV(user, out, pollAnswers, "PollAnswers.csv");
sqlCSV(user, out, punishments, "Punishments.csv");
sqlCSV(user, out, sessions, "Sessions.csv");
sqlCSV(user, out, userData, "UserData.csv");
@@ -104,13 +102,11 @@ public class GDPRQuery extends SWCommand {
private static final Statement bauweltMember = new Statement("SELECT BauweltID AS Bauwelt, WorldEdit, World FROM BauweltMember WHERE MemberID = ?");
private static final Statement bauweltMembers = new Statement("SELECT u.UserName AS 'User', m.WorldEdit AS WorldEdit, m.World AS World FROM BauweltMember m INNER JOIN UserData u ON m.MemberID = u.id WHERE m.BauweltID = ?");
private static final Statement checkedSchems = new Statement("SELECT NodeName AS Schematic, StartTime, EndTime, DeclineReason AS Result FROM CheckedSchematic WHERE NodeOwner = ? ORDER BY StartTime ASC");
private static final Statement userElo = new Statement("SELECT GameMode, Elo, Season FROM Elo WHERE UserID = ?");
private static final Statement fights = new Statement("SELECT p.Team AS Team, p.Kit AS Kit, p.Kills AS Kills, p.IsOut AS Died, f.GameMode AS GameMode, f.Server AS Server, f.StartTime AS StartTime, f.Duration AS Duration, (f.BlueLeader = p.UserID) AS IsBlueLeader, (f.RedLeader = p.UserID) AS IsRedLeader, f.Win AS Winner, f.WinCondition AS WinCondition FROM Fight f INNER JOIN FightPlayer p ON f.FightID = p.FightID WHERE p.UserID = ? ORDER BY StartTime ASC");
private static final Statement ignoredPlayers = new Statement("SELECT u.UserName AS IgnoredPlayer FROM IgnoredPlayers i INNER JOIN UserData u ON i.Ignored = u.id WHERE Ignorer = ?");
private static final Statement ignoringPlayers = new Statement("SELECT Ignorer AS IgnoringPlayers FROM IgnoredPlayers WHERE Ignored = ?");
private static final Statement schematicMember = new Statement("SELECT s.NodeName AS SchematicName, u.UserName AS SchematicOwner FROM NodeMember m INNER JOIN SchematicNode s ON m.NodeId = s.NodeId INNER JOIN UserData u ON s.NodeOwner = u.id WHERE m.UserId = ?");
private static final Statement schematicMembers = new Statement("SELECT s.NodeName AS SchematicName, u.UserName AS Member FROM NodeMember m INNER JOIN SchematicNode s ON m.NodeId = s.NodeId INNER JOIN UserData u ON m.UserId = u.id WHERE s.NodeOwner = ?");
private static final Statement pollAnswers = new Statement("SELECT Question, Answer FROM PollAnswer WHERE UserID = ?");
private static final Statement punishments = new Statement("SELECT Type, StartTime, EndTime, Perma, Reason FROM Punishments WHERE UserId = ?");
private static final Statement sessions = new Statement("SELECT StartTime, EndTime FROM Session WHERE UserID = ?");
private static final Statement userData = new Statement("SELECT * FROM UserData WHERE id = ?");

View File

@@ -1,41 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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.velocitycore.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.messages.PlayerChatter;
import de.steamwar.network.packets.server.LocaleInvalidationPacket;
import de.steamwar.velocitycore.network.NetworkSender;
@Linked
public class SetLocaleCommand extends SWCommand {
public SetLocaleCommand() {
super("setlocale", "setlanguage");
}
@Register
public void genericCommand(PlayerChatter sender) {
sender.user().setLocale(sender.getPlayer().getPlayerSettings().getLocale(), true);
sender.withPlayer(player -> NetworkSender.send(player, new LocaleInvalidationPacket(sender.user().getId())));
sender.system("LOCK_LOCALE_CHANGED");
}
}

View File

@@ -0,0 +1,74 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2026 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.velocitycore.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import de.steamwar.messages.Message;
import de.steamwar.messages.PlayerChatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team;
import de.steamwar.sql.UserPerm;
import de.steamwar.velocitycore.inventory.SWInventory;
import de.steamwar.velocitycore.inventory.SWItem;
@Linked
public class SettingsCommand extends SWCommand {
public SettingsCommand() {
super("settings");
}
@Register
public void genericCommand(PlayerChatter sender) {
SWInventory inventory = new SWInventory(sender, 9, new Message("SETTINGS_TITLE"));
SteamwarUser user = sender.user();
String localeItem = user.getManualLocale() ? "BOOK" : "BOOK_AND_QUILL";
SWItem localeSwItem = new SWItem(localeItem, new Message("SETTINGS_LOCALE_ITEM"));
localeSwItem.addLore(new Message("SETTINGS_LOCALE_CURRENT", new Message("LOCALE")));
if (user.getManualLocale()) {
localeSwItem.addLore(new Message("SETTINGS_LOCALE_LOCKED"));
} else {
localeSwItem.addLore(new Message("SETTINGS_LOCALE_UNLOCKED"));
}
inventory.addItem(2, localeSwItem, click -> {
if (user.getManualLocale()) {
user.unlockLocale();
} else {
user.lockLocale();
}
genericCommand(sender);
});
Team team = Team.byId(user.getTeam());
String chatPrefixItem = !user.hasPerm(UserPerm.TEAM) ? "BARRIER" : "NAME_TAG";
SWItem swItem = new SWItem(chatPrefixItem, new Message("SETTINGS_PREFIX_ITEM"));
if (user.hasPerm(UserPerm.TEAM)) {
swItem.addLore(new Message("SETTINGS_PREFIX_SELECTED", new Message("SETTINGS_PREFIX_SW")));
}
if (user.getTeam() != Team.PUBLIC) {
swItem.addLore(new Message("SETTINGS_PREFIX_UNSELECTED", new Message("SETTINGS_PREFIX_TEAM", team.getTeamColor(), team.getTeamKuerzel())));
}
inventory.addItem(6, swItem, click -> {
});
inventory.open();
}
}

View File

@@ -60,7 +60,7 @@ public class TeamCommand extends SWCommand {
helpMessages(sender, "TEAM_HELP_HEADER", "TEAM_HELP_LIST", "TEAM_HELP_INFO");
SteamwarUser user = sender.user();
if(user.getTeam() == 0) {
if(user.getTeam() == Team.PUBLIC) {
helpMessages(sender, "TEAM_HELP_CREATE", "TEAM_HELP_JOIN");
}else{
helpMessages(sender, "TEAM_HELP_CHAT", "TEAM_HELP_EVENT", "TEAM_HELP_LEAVE");
@@ -162,7 +162,7 @@ public class TeamCommand extends SWCommand {
return;
}
user.setTeam(0);
user.setTeam(Team.PUBLIC);
if(teamSize == 1)
team.disband(user);
@@ -182,7 +182,7 @@ public class TeamCommand extends SWCommand {
if(notDuringEvent(sender))
return;
if(target.getTeam() != 0){
if(target.getTeam() != Team.PUBLIC){
sender.system("TEAM_INVITE_IN_TEAM");
return;
}
@@ -218,7 +218,7 @@ public class TeamCommand extends SWCommand {
return;
}
target.setTeam(0);
target.setTeam(Team.PUBLIC);
sender.system("TEAM_REMOVE_REMOVED");
Chatter.of(target).system("TEAM_REMOVE_REMOVED_TARGET");
@@ -493,7 +493,7 @@ public class TeamCommand extends SWCommand {
@Validator(value = "isNotInTeam", local = true)
public TypeValidator<Chatter> isNotInTeamValidator() {
return (sender, value, messageSender) -> {
if (sender.user().getTeam() != 0) {
if (sender.user().getTeam() != Team.PUBLIC) {
messageSender.send("TEAM_IN_TEAM");
return false;
}
@@ -504,7 +504,7 @@ public class TeamCommand extends SWCommand {
@Validator(value = "isInTeam", local = true)
public TypeValidator<Chatter> isInTeamValidator() {
return (sender, value, messageSender) -> {
if (sender.user().getTeam() == 0) {
if (sender.user().getTeam() == Team.PUBLIC) {
messageSender.send("TEAM_NOT_IN_TEAM");
return false;
}
@@ -516,7 +516,7 @@ public class TeamCommand extends SWCommand {
public TypeValidator<Chatter> isLeaderValidator() {
return (sender, value, messageSender) -> {
SteamwarUser user = sender.user();
if (user.getTeam() == 0) {
if (user.getTeam() == Team.PUBLIC) {
messageSender.send("TEAM_NOT_IN_TEAM");
return false;
}

View File

@@ -36,7 +36,7 @@ public class SettingsChangedListener extends BasicListener {
VelocityCore.schedule(() -> {
Player player = event.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
user.setLocale(event.getPlayerSettings().getLocale(), false);
user.setJoinLocale(event.getPlayerSettings().getLocale());
NetworkSender.send(player, new LocaleInvalidationPacket(user.getId()));
}).schedule();
}