Archiviert
1
0

Merge branch 'master' into dc_5.0

Dieser Commit ist enthalten in:
Chaoscaot 2023-03-19 20:28:31 +01:00
Commit 36b329dc4f
12 geänderte Dateien mit 21 neuen und 69 gelöschten Zeilen

@ -1 +1 @@
Subproject commit b2b96cff0477dc3078c1abfd8f8b047e3a6d903d Subproject commit 7474478489da42735a32e84b3f91144c64847e30

Datei anzeigen

@ -30,7 +30,7 @@ class Broadcaster {
Broadcaster(){ Broadcaster(){
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
if(!ProxyServer.getInstance().getPlayers().isEmpty()) if(!ProxyServer.getInstance().getPlayers().isEmpty() && broadCastMsgs.length > 0)
BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + broadCastMsgs[lastBroadCast]); BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + broadCastMsgs[lastBroadCast]);
lastBroadCast++; lastBroadCast++;
if(lastBroadCast == broadCastMsgs.length){ if(lastBroadCast == broadCastMsgs.length){

Datei anzeigen

@ -345,7 +345,7 @@ public class BungeeCore extends Plugin {
} }
File discordFile = new File(System.getProperty("user.home"), "discord.yml"); File discordFile = new File(System.getProperty("user.home"), "discord.yml");
if(discordFile.exists()) { if(discordFile.exists() && !EVENT_MODE) {
try { try {
SteamwarDiscordBotConfig.loadConfig(ConfigurationProvider.getProvider(YamlConfiguration.class).load(discordFile)); SteamwarDiscordBotConfig.loadConfig(ConfigurationProvider.getProvider(YamlConfiguration.class).load(discordFile));
} catch (IOException e) { } catch (IOException e) {

Datei anzeigen

@ -116,7 +116,7 @@ public class ServerStarter {
public ServerStarter build19(UUID owner) { public ServerStarter build19(UUID owner) {
directory = new File(SERVER_PATH, "Bau19"); directory = new File(SERVER_PATH, "Bau19");
serverJar = "paper-1.19.2.jar"; serverJar = "paper-1.19.3.jar";
worldDir = WORLDS19_PATH; worldDir = WORLDS19_PATH;
worldName = String.valueOf(SteamwarUser.get(owner).getId()); worldName = String.valueOf(SteamwarUser.get(owner).getId());
buildWithWorld(owner, new File(directory, "Bauwelt").getPath()); buildWithWorld(owner, new File(directory, "Bauwelt").getPath());
@ -337,7 +337,7 @@ public class ServerStarter {
public enum Version { public enum Version {
SPIGOT_12("spigot-1.12.2.jar", 12), SPIGOT_12("spigot-1.12.2.jar", 12),
SPIGOT_15("spigot-1.15.2.jar", 15), SPIGOT_15("spigot-1.15.2.jar", 15),
PAPER_19("paper-1.19.2.jar", 19); PAPER_19("paper-1.19.3.jar", 19);
private final String serverJar; private final String serverJar;
private final int versionSuffix; private final int versionSuffix;

Datei anzeigen

@ -19,8 +19,8 @@
package de.steamwar.bungeecore.bot.listeners; package de.steamwar.bungeecore.bot.listeners;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.sql.NodeData;
import de.steamwar.sql.Punishment; import de.steamwar.sql.Punishment;
import de.steamwar.sql.SchematicData;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
@ -66,14 +66,14 @@ public class PrivateMessageListener extends BasicDiscordListener {
continue; continue;
} }
SchematicNode node = SchematicNode.getSchematicNode(user.getId(), name, 0); SchematicNode node = SchematicNode.getSchematicNode(user.getId(), name, (Integer) null);
if(node == null) { if(node == null) {
node = SchematicNode.createSchematic(user.getId(), name, null); node = SchematicNode.createSchematic(user.getId(), name, null);
} }
try { try {
InputStream in = attachment.retrieveInputStream().get(); InputStream in = attachment.retrieveInputStream().get();
new SchematicData(node).saveFromStream(in, newFormat); NodeData.get(node).saveFromStream(in, newFormat);
in.close(); in.close();
event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue(); event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue();
} catch (Exception e) { } catch (Exception e) {

Datei anzeigen

@ -20,11 +20,8 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.*;
import de.steamwar.sql.EventFight; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.*;
import de.steamwar.sql.Team;
import de.steamwar.sql.TeamTeilnahme;
import de.steamwar.sql.Event;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
@ -121,8 +118,11 @@ public class EventCommand extends SWCommand {
Message.send("EVENT_NO_FIGHT_TEAM", player); Message.send("EVENT_NO_FIGHT_TEAM", player);
return; return;
} }
ChatSender sender = ChatSender.of(player);
if (!PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer)) {
SubserverSystem.sendPlayer(eventArena, player); SubserverSystem.sendPlayer(eventArena, player);
} }
}
@ClassMapper(Team.class) @ClassMapper(Team.class)
@Cached(cacheDuration = 10, global = true) @Cached(cacheDuration = 10, global = true)

Datei anzeigen

@ -115,7 +115,7 @@ public class PunishmentCommand {
public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) { public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) {
new SWCommand(command, "bungeecore.ban") { new SWCommand(command, "bungeecore.ban") {
@Register(description = "PUNISHMENT_USAGE") @Register(description = "PUNISHMENT_USAGE")
public void genericCommand(ProxiedPlayer player, String toPunish, String date, String... message) { public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE") String... message) {
SteamwarUser punisher = SteamwarUser.get(player.getUniqueId()); SteamwarUser punisher = SteamwarUser.get(player.getUniqueId());
if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) { if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) {
return; return;

Datei anzeigen

@ -367,7 +367,7 @@ public class TeamCommand extends SWCommand {
public void info(ProxiedPlayer player, String... args){ public void info(ProxiedPlayer player, String... args){
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Team team = Team.get(user.getTeam()); Team team = Team.get(user.getTeam());
if(args.length == 1 && user.getTeam() == 0){ if(args.length == 0 && user.getTeam() == 0){
Message.send("TEAM_INFO_USAGE", player); Message.send("TEAM_INFO_USAGE", player);
return; return;
}else if(user.getTeam() == 0 || args.length == 1){ }else if(user.getTeam() == 0 || args.length == 1){

Datei anzeigen

@ -24,11 +24,11 @@ import de.steamwar.bungeecore.inventory.SWInventory;
import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.bungeecore.inventory.SWStreamInv; import de.steamwar.bungeecore.inventory.SWStreamInv;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Tutorial;
import de.steamwar.bungeecore.util.Chat19; import de.steamwar.bungeecore.util.Chat19;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Tutorial;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -37,7 +37,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class TutorialCommand extends SWCommand { public class TutorialCommand extends SWCommand {
@ -60,7 +59,7 @@ public class TutorialCommand extends SWCommand {
public void rate(ProxiedPlayer player, int id) { public void rate(ProxiedPlayer player, int id) {
Tutorial tutorial = Tutorial.get(id); Tutorial tutorial = Tutorial.get(id);
if(tutorial == null) { if(tutorial == null) {
BungeeCore.get().getLogger().log(Level.SEVERE, "rate executed with nonexistent id: " + id); Chat19.chat(player, "/tutorial rate"); // Catch players manually entering numbers
return; return;
} }

Datei anzeigen

@ -47,7 +47,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
private static final UUID[] uuids = IntStream.range(0, 80).mapToObj(i -> UUID.randomUUID()).toArray(UUID[]::new); private static final UUID[] uuids = IntStream.range(0, 80).mapToObj(i -> UUID.randomUUID()).toArray(UUID[]::new);
private static final String[] names = IntStream.range(0, 80).mapToObj(i -> " »SW« " + String.format("%02d", i)).toArray(String[]::new); private static final String[] names = IntStream.range(0, 80).mapToObj(i -> " »SW« " + String.format("%02d", i)).toArray(String[]::new);
private static final String TAB_TEAM = "»SW-Tab"; private static final String TAB_TEAM = "»SW-Tab";
private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), "always", "always", 21, (byte)0x00, names); private static final Team teamPacket = new Team(TAB_TEAM, (byte) 0, ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), ComponentSerializer.toString(TextComponent.fromLegacyText("")), "never", "always", 21, (byte)0x00, names);
private final Map<UUID, PlayerListItem.Item> directTabItems; private final Map<UUID, PlayerListItem.Item> directTabItems;
private final Set<UUID> npcs = new HashSet<>(); private final Set<UUID> npcs = new HashSet<>();

Datei anzeigen

@ -1,47 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 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.sql;
import de.steamwar.sql.internal.SqlTypeMapper;
import de.steamwar.sql.internal.Statement;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.sql.PreparedStatement;
public class SchematicData {
static {
new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
}
private static final Statement updateDatabase = new Statement("UPDATE SchematicNode SET NodeData = ?, NodeFormat = ? WHERE NodeId = ?");
private final SchematicNode node;
public SchematicData(SchematicNode node) {
this.node = node;
}
public void saveFromStream(InputStream blob, boolean newFormat) {
updateDatabase.update(new BufferedInputStream(blob), newFormat, node.getId());
node.setNodeFormat(newFormat);
}
}