SteamWar/SpigotCore
Archiviert
13
0

UpdateCommandFramework #191

Zusammengeführt
YoyoNow hat 6 Commits von UpdateCommandFramework nach master 2022-05-30 13:02:04 +02:00 zusammengeführt
14 geänderte Dateien mit 298 neuen und 79 gelöschten Zeilen
Nur Änderungen aus Commit d2fa9045e1 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -27,6 +27,6 @@ public class WorldOfColorWrapper12 implements WorldOfColorWrapper.IWorldOfColorW
@Override
public Locale getLocale(Player player){
return Locale.forLanguageTag(player.getLocale());
return Locale.forLanguageTag(player.getLocale().replace('_', '-'));
}
}

Datei anzeigen

@ -27,6 +27,6 @@ public class WorldOfColorWrapper8 implements WorldOfColorWrapper.IWorldOfColorWr
@Override
public Locale getLocale(Player player){
return Locale.forLanguageTag(player.spigot().getLocale());
return Locale.forLanguageTag(player.spigot().getLocale().replace('_', '-'));
}
}

Datei anzeigen

@ -1,7 +1,7 @@
#
# This file is a part of the SteamWar software.
#
# Copyright (C) 2021 SteamWar.de-Serverteam
# Copyright (C) 2022 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
@ -17,90 +17,84 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
COMMAND_SYSTEM_ERROR = §cFehler beim Ausführen des Befehls!
COMMAND_SYSTEM_ERROR = §cError executing the command!
SWLISINV_NEXT_PAGE_ACTIVE = §eSeite vor
SWLISINV_NEXT_PAGE_INACTIVE = §7Seite vor
SWLISINV_PREVIOUS_PAGE_ACTIVE = §eSeite zurück
SWLISINV_PREVIOUS_PAGE_INACTIVE = §7Seite zurück
SWLISINV_NEXT_PAGE_ACTIVE = §eNext page
SWLISINV_NEXT_PAGE_INACTIVE = §7Next page
SWLISINV_PREVIOUS_PAGE_ACTIVE = §ePrevious page
SWLISINV_PREVIOUS_PAGE_INACTIVE = §7Previous page
SCHEM_SELECTOR_TITLE={0} auswählen: {1}
SCHEM_SELECTOR_BACK=§eZurück
SCHEM_SELECTOR_DIR=§9Ordner
SCHEM_SELECTOR_RANK=§8Rang {0}
SCHEM_SELECTOR_OWN=§7Eigene Schematics
SCHEM_SELECTOR_PUB=§7Public Schematics
SCHEM_SELECTOR_SEL_DIR=§7Ordner auswählen
SCHEM_SELECTOR_NEW_DIR=§7Neuer Ordner
SCHEM_SELECTOR_TITLE={0} selection: {1}
SCHEM_SELECTOR_BACK=§eBack
SCHEM_SELECTOR_DIR=§9Directory
SCHEM_SELECTOR_RANK=§8Rank {0}
SCHEM_SELECTOR_OWN=§7Own schematics
SCHEM_SELECTOR_PUB=§7Public schematics
SCHEM_SELECTOR_SEL_DIR=§7Select directory
SCHEM_SELECTOR_NEW_DIR=§7New directory
SCHEM_SELECTOR_FILTER=§7Filter
SCHEM_SELECTOR_SORTING=§7Sortierung
SCHEM_SELECTOR_SORTING_CURRENT=§7Aktuell: §e{0}
SCHEM_SELECTOR_SORTING=§7Order by
SCHEM_SELECTOR_SORTING_CURRENT=§7Current: §e{0}
SCHEM_SELECTOR_SORTING_NAME=Name
SCHEM_SELECTOR_SORTING_TYPE=Schematic-Typ
SCHEM_SELECTOR_SORTING_UPDATE=Letztes Update
SCHEM_SELECTOR_SORTING_DIRECTION=§7Richtung: §e{0}
SCHEM_SELECTOR_SORTING_ASC=Aufsteigend
SCHEM_SELECTOR_SORTING_DSC=Absteigend
SCHEM_SELECTOR_SORTING_TYPE=Schematic type
SCHEM_SELECTOR_SORTING_UPDATE=Last update
SCHEM_SELECTOR_SORTING_DIRECTION=§e{0} §7order
SCHEM_SELECTOR_SORTING_ASC=Ascending
SCHEM_SELECTOR_SORTING_DSC=Descending
SCHEM_SELECTOR_ITEM_NAME=§e{0}
SCHEM_SELECTOR_ITEM_NAME_FILTER=§7{0}
SCHEM_SELECTOR_ITEM_REPLACE=§e{0}§7
SCHEM_SELECTOR_ITEM_LORE_TYPE=§7{0}
SCHEM_SELECTOR_CREATE_DIR_TITLE=Ordner erstellen
SCHEM_SELECTOR_CREATE_DIR_TITLE=Create directory
SCHEM_SELECTOR_FILTER_TITLE=Filter
SCHEM_SELECTOR_FILTER_ENTER_NAME=Name eingeben
SCHEM_SELECTOR_FILTER_NAME=§7Nach Namen suchen...
SCHEM_SELECTOR_FILTER_NAME_SEARCH=§7Suchbegriff: §e{0}
SCHEM_SELECTOR_FILTER_ENTER_OWNER=Besitzer eingeben
SCHEM_SELECTOR_FILTER_OWNER=§7Nach Besitzer suchen...
SCHEM_SELECTOR_FILTER_OWNER_SEARCH=§7Besitzer: §e{0}
SCHEM_SELECTOR_FILTER_SEL_TYPE=Typ wählen...
SCHEM_SELECTOR_FILTER_TYPE=§7Nach Typ filtern...
SCHEM_SELECTOR_FILTER_TYPE_SEARCH=§7Typ: §e{0}
SCHEM_SELECTOR_FILTER_MAT=§7Nach Item filtern...
SCHEM_SELECTOR_FILTER_ENTER_NAME=Insert name
SCHEM_SELECTOR_FILTER_NAME=§7Search by name...
SCHEM_SELECTOR_FILTER_NAME_SEARCH=§7Search term: §e{0}
SCHEM_SELECTOR_FILTER_ENTER_OWNER=Choose owner
SCHEM_SELECTOR_FILTER_OWNER=§7Search by owner...
SCHEM_SELECTOR_FILTER_OWNER_SEARCH=§7Owner: §e{0}
SCHEM_SELECTOR_FILTER_SEL_TYPE=Choose type...
SCHEM_SELECTOR_FILTER_TYPE=§7Search by type...
SCHEM_SELECTOR_FILTER_TYPE_SEARCH=§7Type: §e{0}
SCHEM_SELECTOR_FILTER_MAT=§7Filter by item...
SCHEM_SELECTOR_FILTER_MAT_SEARCH=§7Item: §e{0}
SCHEM_SELECTOR_CANCEL=§eAbbrechen
SCHEM_SELECTOR_GO=§eSuchen...
SCHEM_SELECTOR_CANCEL=§eCancel
SCHEM_SELECTOR_GO=§eSearch...
SCHEM_SELECTOR_SCHEMATIC=Schematic
SCHEM_SELECTOR_DIRECTORY=Ordner
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Ordner
SCHEM_SELECTOR_DIRECTORY=Directory
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Directory
MATERIAL_SELECTOR_TITLE=Material auswählen
MATERIAL_SELECTOR_TITLE=Select material
BAN_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgebannt§8. §7Grund§8: §f{4}
BAN_PERMA=§7Du bist §epermanent §e§lgebannt§8. §7Grund§8: §e{0}
BAN_UNTIL=§7Du bist §ebis zum {0} §e§lgebannt§8. §7Grund§8: §e{1}
UNBAN_ERROR=§cDer Spieler ist nicht gebannt.
UNBAN=§7Du hast §e{0} §e§lentbannt.
BAN_TEAM={0} §e{1} §7was §e§lbanned§7 by §e{2} {3}§8. §7Reason§8: §f{4}
BAN_PERMA=§7You are §e§lbanned §7permanently. Reason§8: §e{0}
BAN_UNTIL=§7You are §e§lbanned §euntil {0} §8. §7Reason§8: §e{1}
UNBAN_ERROR=§cThe player isn't banned.
UNBAN=§7You have §e§lunbanned §e{0}.
MUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4}
MUTE_PERMA=§7Du bist §epermanent §e§lgemuted§8. §7Grund§8: §e{0}
MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1}
UNMUTE_ERROR=§cDer Spieler ist nicht gemuted.
UNMUTE=§7Du hast §e{0} §e§lentmuted.
MUTE_TEAM={0} §e{1} §7was §e§lmuted§7 by §e{2} {3}§8. §7Reason§8: §f{4}
MUTE_PERMA=§7You are §epermanently §e§lmuted§8. §7Reason§8: §e{0}
MUTE_UNTIL=§7You are §e§lmuted §euntil {0}§8. §7Grund§8: §e{1}
UNMUTE_ERROR=§cThe player isn't muted.
UNMUTE=§7You have §e§lmuted §e{0}.
NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten ausgeschlossen§8. §7Grund§8: §f{4}
NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{0}
NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{1}
UNNOSCHEMRECEIVING_ERROR=§cDer Spieler ist nicht vom Erhalten von Schematics ausgeschlossen.
UNNOSCHEMRECEIVING=§e{0} §7darf nun wieder §e§lSchematics erhalten§8.
NOSCHEMRECEIVING_TEAM={0} §e{1} §7was excluded from §e{2} {3} §7from §e§lrecieving schematics§8. §7Reason§8: §f{4}
NOSCHEMRECEIVING_PERMA=§7You are §epermanently §7excluded from receiving §e§lschematics§8. §7Reason§8: §e{0}
NOSCHEMRECEIVING_UNTIL=§7You are excluded from receiving §e§lschematics §euntil {0}§8. §7Reason§8: §e{1}
UNNOSCHEMRECEIVING_ERROR=§cThe player is not excluded from receiving schematics.
UNNOSCHEMRECEIVING=§e{0} §7may now receive §e§lschematics§7 again§8.
NOSCHEMSHARING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicverteilen ausgeschlossen§8. §7Grund§8: §f{4}
NOSCHEMSHARING_PERMA=§7Du bist §epermanent §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0}
NOSCHEMSHARING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1}
UNNOSCHEMSHARING_ERROR=§cDer Spieler ist nicht vom Verteilen von Schematics ausgeschlossen.
UNNOSCHEMSHARING=§e{0} §7darf nun wieder §e§lSchematics verteilen§8.
NOSCHEMSHARING_TEAM={0} §e{1} §7was excluded from §e{2} {3} §7from §e§lsharing schematics§8. §7Reason§8: §f{4}
NOSCHEMSHARING_PERMA=§7You are §epermanently $7excluded from sharing §e§lschematics§8. §7Reason§8: §e{0}
NOSCHEMSHARING_UNTIL=§7You are excluded from sharing §e§lschematics §euntil {0}§8. §7Reason§8: §e{1}
UNNOSCHEMSHARING_ERROR=§cThe player is not excluded from sharing schematics.
UNNOSCHEMSHARING=§e{0} §7may now share §e§lschematics§7 again§8.
NOSCHEMSUBMITTING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematiceinsenden ausgeschlossen§8. §7Grund§8: §f{4}
NOSCHEMSUBMITTING_PERMA=§7Du bist §epermanent §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0}
NOSCHEMSUBMITTING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1}
UNNOSCHEMSUBMITTING_ERROR=§cDer Spieler ist nicht vom Einsenden von Schematics ausgeschlossen.
UNNOSCHEMSUBMITTING=§e{0} §7darf nun wieder §e§lSchematis einsenden§8.
NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot §7erhalten§8, §e{3}
NODEVSERVER_PERMA=§7Du bist §epermanent §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{0}
NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{1}
UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen.
UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver beitreten§8.
NOSCHEMSUBMITTING_TEAM={0} §e{1} §7was excluded from §e{2} {3} §7from §e§lsubmitting schematics§8. §7Reason§8: §f{4}
NOSCHEMSUBMITTING_PERMA=§7You are §epermanently §7excluded from submitting §e§lschematics§8. §7Reason§8: §e{0}
NOSCHEMSUBMITTING_UNTIL=§7You are excluded from submitting §e§lschematics §euntil {0}§8. §7Reason§8: §e{1}
UNNOSCHEMSUBMITTING_ERROR=§cThe player is not excluded from submitting schematics.
UNNOSCHEMSUBMITTING=§e{0} §7may now submit §e§lschematics§7 again§8.

Datei anzeigen

@ -0,0 +1,101 @@
#
# This file is a part of the SteamWar software.
#
# Copyright (C) 2022 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/>.
#
COMMAND_SYSTEM_ERROR = §cFehler beim Ausführen des Befehls!
SWLISINV_NEXT_PAGE_ACTIVE = §eSeite vor
SWLISINV_NEXT_PAGE_INACTIVE = §7Seite vor
SWLISINV_PREVIOUS_PAGE_ACTIVE = §eSeite zurück
SWLISINV_PREVIOUS_PAGE_INACTIVE = §7Seite zurück
SCHEM_SELECTOR_TITLE={0} auswählen: {1}
SCHEM_SELECTOR_BACK=§eZurück
SCHEM_SELECTOR_DIR=§9Ordner
SCHEM_SELECTOR_RANK=§8Rang {0}
SCHEM_SELECTOR_OWN=§7Eigene Schematics
SCHEM_SELECTOR_PUB=§7Public Schematics
SCHEM_SELECTOR_SEL_DIR=§7Ordner auswählen
SCHEM_SELECTOR_NEW_DIR=§7Neuer Ordner
SCHEM_SELECTOR_FILTER=§7Filter
SCHEM_SELECTOR_SORTING=§7Sortierung
SCHEM_SELECTOR_SORTING_CURRENT=§7Aktuell: §e{0}
SCHEM_SELECTOR_SORTING_NAME=Name
SCHEM_SELECTOR_SORTING_TYPE=Schematic-Typ
SCHEM_SELECTOR_SORTING_UPDATE=Letztes Update
SCHEM_SELECTOR_SORTING_DIRECTION=§7Richtung: §e{0}
SCHEM_SELECTOR_SORTING_ASC=Aufsteigend
SCHEM_SELECTOR_SORTING_DSC=Absteigend
SCHEM_SELECTOR_CREATE_DIR_TITLE=Ordner erstellen
SCHEM_SELECTOR_FILTER_TITLE=Filter
SCHEM_SELECTOR_FILTER_ENTER_NAME=Name eingeben
SCHEM_SELECTOR_FILTER_NAME=§7Nach Namen suchen...
SCHEM_SELECTOR_FILTER_NAME_SEARCH=§7Suchbegriff: §e{0}
SCHEM_SELECTOR_FILTER_ENTER_OWNER=Besitzer eingeben
SCHEM_SELECTOR_FILTER_OWNER=§7Nach Besitzer suchen...
SCHEM_SELECTOR_FILTER_OWNER_SEARCH=§7Besitzer: §e{0}
SCHEM_SELECTOR_FILTER_SEL_TYPE=Typ wählen...
SCHEM_SELECTOR_FILTER_TYPE=§7Nach Typ filtern...
SCHEM_SELECTOR_FILTER_TYPE_SEARCH=§7Typ: §e{0}
SCHEM_SELECTOR_FILTER_MAT=§7Nach Item filtern...
SCHEM_SELECTOR_FILTER_MAT_SEARCH=§7Item: §e{0}
SCHEM_SELECTOR_CANCEL=§eAbbrechen
SCHEM_SELECTOR_GO=§eSuchen...
SCHEM_SELECTOR_SCHEMATIC=Schematic
SCHEM_SELECTOR_DIRECTORY=Ordner
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Ordner
MATERIAL_SELECTOR_TITLE=Material auswählen
BAN_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgebannt§8. §7Grund§8: §f{4}
BAN_PERMA=§7Du bist §epermanent §e§lgebannt§8. §7Grund§8: §e{0}
BAN_UNTIL=§7Du bist §ebis zum {0} §e§lgebannt§8. §7Grund§8: §e{1}
UNBAN_ERROR=§cDer Spieler ist nicht gebannt.
UNBAN=§7Du hast §e{0} §e§lentbannt.
MUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4}
MUTE_PERMA=§7Du bist §epermanent §e§lgemuted§8. §7Grund§8: §e{0}
MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1}
UNMUTE_ERROR=§cDer Spieler ist nicht gemuted.
UNMUTE=§7Du hast §e{0} §e§lentmuted.
NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten ausgeschlossen§8. §7Grund§8: §f{4}
NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{0}
NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{1}
UNNOSCHEMRECEIVING_ERROR=§cDer Spieler ist nicht vom Erhalten von Schematics ausgeschlossen.
UNNOSCHEMRECEIVING=§e{0} §7darf nun wieder §e§lSchematics erhalten§8.
NOSCHEMSHARING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicverteilen ausgeschlossen§8. §7Grund§8: §f{4}
NOSCHEMSHARING_PERMA=§7Du bist §epermanent §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0}
NOSCHEMSHARING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1}
UNNOSCHEMSHARING_ERROR=§cDer Spieler ist nicht vom Verteilen von Schematics ausgeschlossen.
UNNOSCHEMSHARING=§e{0} §7darf nun wieder §e§lSchematics verteilen§8.
NOSCHEMSUBMITTING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematiceinsenden ausgeschlossen§8. §7Grund§8: §f{4}
NOSCHEMSUBMITTING_PERMA=§7Du bist §epermanent §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0}
NOSCHEMSUBMITTING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1}
UNNOSCHEMSUBMITTING_ERROR=§cDer Spieler ist nicht vom Einsenden von Schematics ausgeschlossen.
UNNOSCHEMSUBMITTING=§e{0} §7darf nun wieder §e§lSchematis einsenden§8.
NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot §7erhalten§8, §e{3}
NODEVSERVER_PERMA=§7Du bist §epermanent §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{0}
NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{1}
UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen.
UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver beitreten§8.

Datei anzeigen

@ -23,6 +23,7 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import de.steamwar.comms.handlers.BungeeHandler;
import de.steamwar.comms.handlers.InventoryHandler;
import de.steamwar.comms.handlers.LocaleInvalidationHandler;
import de.steamwar.core.BountifulWrapper;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
@ -57,6 +58,7 @@ public class BungeeReceiver implements PluginMessageListener {
Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID());
player.closeInventory();
});
registerHandler(PacketIdManager.LOCALE_INVALIDATION, new LocaleInvalidationHandler());
}
@Override

Datei anzeigen

@ -28,6 +28,8 @@ public class PacketIdManager {
public static final byte PREPARE_SCHEM = 0x03;
public static final byte BAUMEMBER_UPDATE = 0x04;
public static final byte EXECUTE_COMMAND = 0x05;
public static final byte LOCALE_INVALIDATION = 0x06;
//0x1(X) Bungee Inventory
public static final byte INVENTORY_PACKET = 0x10;
public static final byte INVENTORY_CALLBACK_PACKET = 0x11;

Datei anzeigen

@ -0,0 +1,31 @@
/*
* 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.comms.handlers;
import com.google.common.io.ByteArrayDataInput;
import de.steamwar.sql.SteamwarUser;
public class LocaleInvalidationHandler implements BungeeHandler {
@Override
public void handle(ByteArrayDataInput byteArrayDataInput) {
SteamwarUser.invalidate(byteArrayDataInput.readInt());
}
}

Datei anzeigen

@ -84,6 +84,7 @@ public class Core extends JavaPlugin{
}
private ErrorHandler errorHandler;
private CrashDetector crashDetector;
@Override
public void onLoad() {
@ -94,6 +95,8 @@ public class Core extends JavaPlugin{
public void onEnable() {
setSqlConfig();
errorHandler = new ErrorHandler();
if(VERSION > 15)
crashDetector = new CrashDetector();
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this);
@ -112,6 +115,8 @@ public class Core extends JavaPlugin{
@Override
public void onDisable() {
TinyProtocol.instance.close();
if(VERSION > 15)
crashDetector.stop();
errorHandler.unregister();
if(!standalone) {
Statement.close();

Datei anzeigen

@ -0,0 +1,64 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2022 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.core;
import de.steamwar.sql.SWException;
import org.bukkit.Bukkit;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
public class CrashDetector {
private static final long TIMEOUT = 20000;
private final AtomicLong lastTick = new AtomicLong(Long.MAX_VALUE);
private final Thread mainThread = Thread.currentThread();
private final Thread watchdog;
private boolean run = true;
public CrashDetector () {
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> lastTick.set(System.currentTimeMillis()), 0, 1);
watchdog = new Thread(this::run, "SteamWar Watchdog");
watchdog.setDaemon(true);
watchdog.start();
}
public void stop() {
run = false;
watchdog.interrupt();
}
private void run() {
while (run) {
long curTime = System.currentTimeMillis();
if(curTime - TIMEOUT > lastTick.get()) {
SWException.log(Bukkit.getServer().getVersion() + " server hung for " + (curTime - lastTick.get()) + "ms, ", Arrays.stream(mainThread.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")));
lastTick.set(curTime);
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.message;
import de.steamwar.core.BountifulWrapper;
import de.steamwar.core.WorldOfColorWrapper;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
@ -74,7 +75,7 @@ public class Message {
}
private Locale getLocale(Player player){
return WorldOfColorWrapper.impl.getLocale(player);
return SteamwarUser.get(player).getLocale();
}
/* Send a message to one player */

Datei anzeigen

@ -331,7 +331,8 @@ public class SQLProvider implements Provider {
}
private SteamwarUser newSteamwarUser(ResultSet rs) throws SQLException {
return new SteamwarUser(rs.getInt("id"), UUID.fromString(rs.getString("UUID")), rs.getString("UserName"), UserGroup.getUsergroup(rs.getString("UserGroup")), rs.getInt("Team"), rs.getBoolean("Bedrock"));
String dbLocale = rs.getString("Locale");
return new SteamwarUser(rs.getInt("id"), UUID.fromString(rs.getString("UUID")), rs.getString("UserName"), UserGroup.getUsergroup(rs.getString("UserGroup")), rs.getInt("Team"), rs.getBoolean("Bedrock"), dbLocale != null ? Locale.forLanguageTag(dbLocale) : null);
}
private static final Statement insert = new Statement("INSERT INTO Exception (server, message, stacktrace) VALUES (?, ?, ?)");

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.sql;
import de.steamwar.core.WorldEditWrapper;
import de.steamwar.core.WorldOfColorWrapper;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
@ -168,12 +169,12 @@ public class StandaloneProvider implements Provider {
Player player = Bukkit.getPlayer(userName);
if(player == null)
return null;
return usersByUUID.computeIfAbsent(player.getUniqueId(), uuid -> new SteamwarUser(userId++, uuid, userName, UserGroup.Member, 0, false));
return usersByUUID.computeIfAbsent(player.getUniqueId(), uuid -> new SteamwarUser(userId++, uuid, userName, UserGroup.Member, 0, false, null));
}
@Override
public SteamwarUser getUserByUUID(UUID uuid) {
return usersByUUID.computeIfAbsent(uuid, uuid1 -> new SteamwarUser(userId++, uuid1, Objects.requireNonNull(Objects.requireNonNull(Bukkit.getOfflinePlayer(uuid1)).getName()), UserGroup.Member, 0, false));
return usersByUUID.computeIfAbsent(uuid, uuid1 -> new SteamwarUser(userId++, uuid1, Objects.requireNonNull(Objects.requireNonNull(Bukkit.getOfflinePlayer(uuid1)).getName()), UserGroup.Member, 0, false, null));
}
@Override

Datei anzeigen

@ -20,13 +20,11 @@
package de.steamwar.sql;
import de.steamwar.core.Core;
import de.steamwar.core.WorldOfColorWrapper;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
public class SteamwarUser {
@ -43,20 +41,30 @@ public class SteamwarUser {
}, 72000, 72000);
}
public static void invalidate(int userId) {
SteamwarUser user = byId.remove(userId);
if (user == null)
return;
byName.remove(user.getUserName());
byUUID.remove(user.getUUID());
}
private final int id;
private final UUID uuid;
private final String userName;
private final UserGroup userGroup;
private final int team;
private final boolean bedrock;
private Locale locale;
public SteamwarUser(int id, UUID uuid, String userName, UserGroup userGroup, int team, boolean bedrock) {
public SteamwarUser(int id, UUID uuid, String userName, UserGroup userGroup, int team, boolean bedrock, Locale locale) {
this.id = id;
this.uuid = uuid;
this.userName = userName;
this.userGroup = userGroup;
this.team = team;
this.bedrock = bedrock;
this.locale = locale;
byUUID.put(uuid, this);
byName.put(userName.toLowerCase(), this);
@ -87,6 +95,15 @@ public class SteamwarUser {
return bedrock;
}
public Locale getLocale() {
if(locale != null)
return locale;
Locale locale = WorldOfColorWrapper.impl.getLocale(Bukkit.getPlayer(uuid));
if (locale != null)
return locale;
return Locale.getDefault();
}
public static SteamwarUser get(String userName){
SteamwarUser user = byName.get(userName.toLowerCase());
if(user == null)