CommonDB #463
@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bungeecore;
|
||||
|
||||
import de.steamwar.bungeecore.sql.SWException;
|
||||
import de.steamwar.sql.SWException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
@ -61,7 +61,7 @@ public class ErrorLogger extends Handler {
|
||||
}
|
||||
|
||||
|
||||
SWException.log("Bungee", message, stacktrace);
|
||||
SWException.log(message, stacktrace);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
package de.steamwar.bungeecore;
|
||||
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
@ -144,8 +144,8 @@ public class ServerStarter {
|
||||
public ServerStarter tutorial(ProxiedPlayer owner, Tutorial tutorial) {
|
||||
directory = new File(SERVER_PATH, "Tutorial");
|
||||
buildWithTemp(owner);
|
||||
tempWorld(TUTORIAL_PATH + tutorial.id());
|
||||
arguments.put("tutorial", String.valueOf(tutorial.id()));
|
||||
tempWorld(TUTORIAL_PATH + tutorial.getId());
|
||||
arguments.put("tutorial", String.valueOf(tutorial.getId()));
|
||||
return send(owner);
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,8 @@ import de.steamwar.bungeecore.bot.listeners.*;
|
||||
import de.steamwar.bungeecore.bot.util.DiscordRolesMessage;
|
||||
import de.steamwar.bungeecore.bot.util.DiscordRulesMessage;
|
||||
import de.steamwar.bungeecore.bot.util.DiscordTicketMessage;
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.Event;
|
||||
import lombok.Getter;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bungeecore.bot.commands;
|
||||
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.UserGroup;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
|
||||
|
@ -19,10 +19,10 @@
|
||||
|
||||
package de.steamwar.bungeecore.bot.commands;
|
||||
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.bungeecore.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Emoji;
|
||||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bungeecore.bot.config;
|
||||
|
||||
import de.steamwar.bungeecore.sql.UserGroup;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -21,10 +21,10 @@ package de.steamwar.bungeecore.bot.events;
|
||||
|
||||
import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
|
||||
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.bungeecore.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.Event;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
|
@ -21,10 +21,10 @@ package de.steamwar.bungeecore.bot.listeners;
|
||||
|
||||
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
|
||||
import de.steamwar.bungeecore.bot.events.EventManager;
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.bungeecore.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.dv8tion.jda.api.events.interaction.SelectionMenuEvent;
|
||||
import net.dv8tion.jda.api.interactions.components.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -24,12 +24,14 @@ import de.steamwar.bungeecore.inventory.SWInventory;
|
||||
import de.steamwar.bungeecore.inventory.SWItem;
|
||||
import de.steamwar.bungeecore.network.NetworkSender;
|
||||
import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.bungeecore.util.BauLock;
|
||||
import de.steamwar.bungeecore.util.Chat19;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.network.packets.server.BaumemberUpdatePacket;
|
||||
import de.steamwar.bungeecore.util.BauLockState;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.sql.SWException;
|
||||
import de.steamwar.sql.SWException;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
@ -34,7 +34,7 @@ public class BugCommand extends SWCommand {
|
||||
public void bugMessage(ProxiedPlayer player, String... message) {
|
||||
String server = player.getServer().getInfo().getName();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
SWException.log(server, String.join(" ", message), player.getName() + " " + user.getId());
|
||||
SWException.log(String.join(" ", message), server + " " + player.getName() + " " + user.getId());
|
||||
ChatSender.of(player).system("BUG_MESSAGE");
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,11 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.SchematicType;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
|
@ -20,11 +20,11 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.listeners.PollSystem;
|
||||
import de.steamwar.bungeecore.sql.PollAnswer;
|
||||
import de.steamwar.sql.PollAnswer;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
|
@ -21,7 +21,7 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.listeners.PollSystem;
|
||||
import de.steamwar.bungeecore.sql.PollAnswer;
|
||||
import de.steamwar.sql.PollAnswer;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -36,10 +36,10 @@ public class PollresultCommand extends SWCommand {
|
||||
|
||||
@Register
|
||||
public void genericCommand(@Validator ProxiedPlayer player) {
|
||||
Map<String, Integer> voted = PollAnswer.getCurrentResults();
|
||||
Message.send("POLLRESULT_HEADER", player, voted.values().stream().reduce(Integer::sum).orElse(0), PollSystem.getQuestion());
|
||||
for (Map.Entry<String, Integer> e: voted.entrySet()) {
|
||||
Message.send("POLLRESULT_LIST", player, e.getKey(), e.getValue());
|
||||
Map<Integer, Integer> voted = PollAnswer.getCurrentResults();
|
||||
Message.send("POLLRESULT_HEADER", player, voted.values().stream().reduce(Integer::sum).orElse(0), PollAnswer.getCurrentPoll());
|
||||
for (Map.Entry<Integer, Integer> e: voted.entrySet()) {
|
||||
Message.send("POLLRESULT_LIST", player, PollSystem.getAnswer(e.getKey()), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ import de.steamwar.bungeecore.sql.SchematicType;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -23,8 +23,12 @@ import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Storage;
|
||||
import de.steamwar.bungeecore.inventory.SWItem;
|
||||
import de.steamwar.bungeecore.inventory.SWListInv;
|
||||
import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.bungeecore.sql.Punishment;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
|
@ -20,9 +20,14 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.bungeecore.sql.BauweltMember;
|
||||
import de.steamwar.bungeecore.sql.Punishment;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
import de.steamwar.bungeecore.util.BauLock;
|
||||
import de.steamwar.bungeecore.util.Chat19;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
|
@ -96,36 +96,37 @@ public class TutorialCommand extends SWCommand {
|
||||
player,
|
||||
Message.parse("TUTORIAL_TITLE", player),
|
||||
(click, tutorial) -> {
|
||||
if(!released && click.isShiftClick() && user.getUserGroup().isTeamGroup() && user != tutorial.creator()) {
|
||||
if(!released && click.isShiftClick() && user.getUserGroup().isTeamGroup() && user.getId() != tutorial.getCreator()) {
|
||||
tutorial.release();
|
||||
openInventory(player, released, own);
|
||||
return;
|
||||
} else if(own && click.isShiftClick() && click.isRightClick()) {
|
||||
tutorial.delete();
|
||||
SubserverSystem.deleteFolder(BungeeCore.local, world(tutorial).getPath());
|
||||
openInventory(player, released, own);
|
||||
return;
|
||||
}
|
||||
|
||||
new ServerStarter().tutorial(player, tutorial).start();
|
||||
},
|
||||
page -> (own ? Tutorial.getOwn(user, page, 45) : Tutorial.getPage(page, 45, released)).stream().map(tutorial -> new SWListInv.SWListEntry<>(getTutorialItem(player, tutorial, own), tutorial)).collect(Collectors.toList())
|
||||
page -> (own ? Tutorial.getOwn(user.getId(), page, 45) : Tutorial.getPage(page, 45, released)).stream().map(tutorial -> new SWListInv.SWListEntry<>(getTutorialItem(player, tutorial, own), tutorial)).collect(Collectors.toList())
|
||||
).open();
|
||||
}
|
||||
|
||||
private SWItem getTutorialItem(ProxiedPlayer player, Tutorial tutorial, boolean personalHighlights) {
|
||||
SWItem item = new SWItem(tutorial.item(), Message.parse("TUTORIAL_NAME", player, tutorial.name()));
|
||||
SWItem item = new SWItem(tutorial.getItem(), Message.parse("TUTORIAL_NAME", player, tutorial.getName()));
|
||||
item.setHideAttributes(true);
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(Message.parse("TUTORIAL_BY", player, tutorial.creator().getUserName()));
|
||||
lore.add(Message.parse("TUTORIAL_STARS", player, String.format("%.1f", tutorial.stars())));
|
||||
lore.add(Message.parse("TUTORIAL_BY", player, SteamwarUser.get(tutorial.getCreator()).getUserName()));
|
||||
lore.add(Message.parse("TUTORIAL_STARS", player, String.format("%.1f", tutorial.getStars())));
|
||||
|
||||
if (personalHighlights)
|
||||
lore.add(Message.parse("TUTORIAL_DELETE", player));
|
||||
|
||||
item.setLore(lore);
|
||||
|
||||
if (personalHighlights && tutorial.released())
|
||||
if (personalHighlights && tutorial.isReleased())
|
||||
item.setEnchanted(true);
|
||||
|
||||
return item;
|
||||
@ -136,7 +137,7 @@ public class TutorialCommand extends SWCommand {
|
||||
int[] rates = new int[]{1, 2, 3, 4, 5};
|
||||
|
||||
new SWListInv<>(player, Message.parse("TUTORIAL_RATE_TITLE", player), Arrays.stream(rates).mapToObj(rate -> new SWListInv.SWListEntry<>(new SWItem("NETHER_STAR", Message.parse("TUTORIAL_RATE", player, rate)), rate)).collect(Collectors.toList()), (click, rate) -> {
|
||||
tutorial.rate(user, rate);
|
||||
tutorial.rate(user.getId(), rate);
|
||||
SWInventory.close(player);
|
||||
}).open();
|
||||
}
|
||||
@ -153,8 +154,8 @@ public class TutorialCommand extends SWCommand {
|
||||
|
||||
subserver.execute("save-all");
|
||||
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||
Tutorial tutorial = Tutorial.create(user, name, item);
|
||||
File tutorialWorld = tutorial.world();
|
||||
Tutorial tutorial = Tutorial.create(user.getId(), name, item);
|
||||
File tutorialWorld = world(tutorial);
|
||||
|
||||
if (tutorialWorld.exists())
|
||||
SubserverSystem.deleteFolder(BungeeCore.local, tutorialWorld.getPath());
|
||||
@ -162,4 +163,8 @@ public class TutorialCommand extends SWCommand {
|
||||
Message.send("TUTORIAL_CREATED", player);
|
||||
}, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private File world(Tutorial tutorial) {
|
||||
return new File(ServerStarter.TUTORIAL_PATH, String.valueOf(tutorial.getId()));
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
|
@ -22,7 +22,7 @@ package de.steamwar.bungeecore.listeners;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.listeners.mods.Forge;
|
||||
import de.steamwar.bungeecore.sql.BannedUserIPs;
|
||||
import de.steamwar.sql.BannedUserIPs;
|
||||
import de.steamwar.bungeecore.sql.Punishment;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
|
@ -26,6 +26,7 @@ import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.bungeecore.util.Chat19;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.network.packets.server.PingPacket;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import net.md_5.bungee.api.*;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.ChatEvent;
|
||||
|
@ -30,7 +30,7 @@ import de.steamwar.bungeecore.commands.CheckCommand;
|
||||
import de.steamwar.bungeecore.commands.MsgCommand;
|
||||
import de.steamwar.bungeecore.listeners.mods.Utils;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.UserGroup;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import net.md_5.bungee.api.AbstractReconnectHandler;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package de.steamwar.bungeecore.listeners;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.Event;
|
||||
import de.steamwar.bungeecore.sql.EventFight;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bungeecore.listeners;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.PollAnswer;
|
||||
import de.steamwar.sql.PollAnswer;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -40,6 +40,8 @@ public class PollSystem extends BasicListener {
|
||||
|
||||
if(noCurrentPoll())
|
||||
return;
|
||||
|
||||
PollAnswer.setCurrentPoll(question);
|
||||
new PollSystem();
|
||||
}
|
||||
|
||||
@ -70,10 +72,6 @@ public class PollSystem extends BasicListener {
|
||||
return question == null || question.equals("");
|
||||
}
|
||||
|
||||
public static String getQuestion() {
|
||||
return question;
|
||||
}
|
||||
|
||||
public static int answers(){
|
||||
return answers.size();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bungeecore.listeners;
|
||||
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.sql.Session;
|
||||
import de.steamwar.sql.Session;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
|
@ -28,7 +28,7 @@ import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Storage;
|
||||
import de.steamwar.bungeecore.listeners.BasicListener;
|
||||
import de.steamwar.bungeecore.sql.Mod;
|
||||
import de.steamwar.bungeecore.sql.SWException;
|
||||
import de.steamwar.sql.SWException;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -158,7 +158,7 @@ public class Fabric extends BasicListener {
|
||||
}
|
||||
|
||||
public void logMessage(SteamwarUser user, String reason, String data) {
|
||||
SWException.log("Bungee", "FabricModSender " + user.getUserName() + ": " + reason, data);
|
||||
SWException.log("FabricModSender " + user.getUserName() + ": " + reason, data);
|
||||
}
|
||||
|
||||
public static void remove(ProxiedPlayer player) {
|
||||
|
@ -68,7 +68,7 @@ public class Utils {
|
||||
|
||||
static boolean handleMods(UUID uuid, Locale locale, Consumer<BaseComponent[]> disconnect, List<Mod> mods){
|
||||
SteamwarUser user = SteamwarUser.get(uuid);
|
||||
boolean privileged = user.getUserGroup().privilegedMods();
|
||||
boolean privileged = user.getUserGroup().isPrivilegedMods();
|
||||
playerModMap.put(uuid,new ArrayList<>(mods));
|
||||
|
||||
ModType max = ModType.YELLOW;
|
||||
|
@ -22,7 +22,7 @@ package de.steamwar.bungeecore.network;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.commands.TeamCommand;
|
||||
import de.steamwar.bungeecore.listeners.BasicListener;
|
||||
import de.steamwar.bungeecore.sql.SWException;
|
||||
import de.steamwar.sql.SWException;
|
||||
import de.steamwar.network.packets.NetworkPacket;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
@ -42,7 +42,7 @@ public class NetworkReceiver extends BasicListener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPluginMessage(PluginMessageEvent event) {
|
||||
if (blockedTags.contains(event.getTag()) && !TeamCommand.isLocalhost(((InetSocketAddress) event.getSender().getSocketAddress()).getAddress())) {
|
||||
SWException.log("Bungee", ((InetSocketAddress) event.getSender().getSocketAddress()).getHostString() + " tried to send a plugin message with tag " + event.getTag(), Base64.getEncoder().encodeToString(event.getData()));
|
||||
SWException.log(((InetSocketAddress) event.getSender().getSocketAddress()).getHostString() + " tried to send a plugin message with tag " + event.getTag(), Base64.getEncoder().encodeToString(event.getData()));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BannedUserIPs {
|
||||
|
||||
private static final Statement getByID = new Statement("SELECT * FROM BannedUserIPs WHERE UserID = ? ORDER BY Timestamp ASC");
|
||||
private static final Statement getByIP = new Statement("SELECT * FROM BannedUserIPs WHERE IP = ? ORDER BY Timestamp DESC");
|
||||
private static final Statement banIP = new Statement("INSERT INTO BannedUserIPs (UserID, Timestamp, IP) VALUES (?, NOW(), ?) ON DUPLICATE KEY UPDATE Timestamp=NOW()");
|
||||
|
||||
private final int userID;
|
||||
private final Timestamp timestamp;
|
||||
|
||||
private BannedUserIPs(int userID, Timestamp timestamp){
|
||||
this.userID = userID;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public static List<BannedUserIPs> get(int userID){
|
||||
return getByID.select(rs -> {
|
||||
List<BannedUserIPs> userIPs = new ArrayList<>();
|
||||
while(rs.next()) {
|
||||
userIPs.add(new BannedUserIPs(
|
||||
userID,
|
||||
rs.getTimestamp("Timestamp")));
|
||||
}
|
||||
return userIPs;
|
||||
}, userID);
|
||||
}
|
||||
|
||||
public static List<BannedUserIPs> get(String ip){
|
||||
return getByIP.select(rs -> {
|
||||
List<BannedUserIPs> userIDs = new ArrayList<>();
|
||||
while(rs.next()) {
|
||||
userIDs.add(new BannedUserIPs(
|
||||
rs.getInt("UserID"),
|
||||
rs.getTimestamp("Timestamp")));
|
||||
}
|
||||
return userIDs;
|
||||
}, ip);
|
||||
}
|
||||
|
||||
static void banIP(SteamwarUser user, String ip){
|
||||
banIP.update(user.getId(), ip);
|
||||
}
|
||||
|
||||
public int getUserID() {
|
||||
return userID;
|
||||
}
|
||||
|
||||
public java.sql.Timestamp getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
@UtilityClass
|
||||
public class BauLock {
|
||||
|
||||
private static final String BAU_LOCK_CONFIG_NAME = "baulockstate";
|
||||
public static void setLocked(ProxiedPlayer p, BauLockState state) {
|
||||
SteamwarUser owner = SteamwarUser.get(p.getUniqueId());
|
||||
UserConfig.updateUserConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name());
|
||||
Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer());
|
||||
}
|
||||
|
||||
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||
if (owner.getId() == target.getId())
|
||||
return false;
|
||||
|
||||
String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME);
|
||||
switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) {
|
||||
case NOBODY:
|
||||
return true;
|
||||
case TEAM:
|
||||
return owner.getTeam() != target.getTeam();
|
||||
case OPEN:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
public enum BauLockState {
|
||||
|
||||
NOBODY, // Locks the build server for all users
|
||||
TEAM, //opens the build server only for every added user which is in the same team as the buildOwner
|
||||
OPEN //unlocks the build server for all users
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Event {
|
||||
|
||||
private static final Statement byCurrent = new Statement("SELECT * FROM Event WHERE Start < now() AND End > now()");
|
||||
private static final Statement byId = new Statement("SELECT * FROM Event WHERE EventID = ?");
|
||||
private static final Statement byName = new Statement("SELECT * FROM Event WHERE lower(EventName) = ?");
|
||||
private static final Statement byComing = new Statement("SELECT * FROM Event WHERE Start > now()");
|
||||
|
||||
private final int eventID;
|
||||
private final String eventName;
|
||||
private final Timestamp start;
|
||||
private final Timestamp end;
|
||||
private final int maximumTeamMembers;
|
||||
private final boolean publicSchemsOnly;
|
||||
private final boolean spectateSystem;
|
||||
private final Timestamp deadline;
|
||||
private final String schemType;
|
||||
|
||||
private static Event current = null;
|
||||
|
||||
private Event(ResultSet rs) throws SQLException{
|
||||
this.eventID = rs.getInt("EventID");
|
||||
this.eventName = rs.getString("EventName");
|
||||
this.start = rs.getTimestamp("Start");
|
||||
this.end = rs.getTimestamp("End");
|
||||
this.maximumTeamMembers = rs.getInt("MaximumTeamMembers");
|
||||
this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly");
|
||||
this.spectateSystem = rs.getBoolean("SpectateSystem");
|
||||
this.deadline = rs.getTimestamp("Deadline");
|
||||
this.schemType = rs.getString("SchemType");
|
||||
}
|
||||
|
||||
public static Event get(){
|
||||
if(current != null && current.now())
|
||||
return current;
|
||||
|
||||
return byCurrent.select(rs -> {
|
||||
if(rs.next())
|
||||
current = new Event(rs);
|
||||
else
|
||||
current = null;
|
||||
return current;
|
||||
});
|
||||
}
|
||||
|
||||
public static Event get(int eventID){
|
||||
return byId.select(rs -> {
|
||||
if(!rs.next())
|
||||
throw new SQLException("Couldn't find event " + eventID);
|
||||
return new Event(rs);
|
||||
}, eventID);
|
||||
}
|
||||
|
||||
public static Event get(String eventName){
|
||||
return byName.select(rs -> {
|
||||
if(!rs.next())
|
||||
return null;
|
||||
|
||||
return new Event(rs);
|
||||
}, eventName.toLowerCase());
|
||||
}
|
||||
|
||||
public static List<Event> getComing(){
|
||||
return byComing.select(rs -> {
|
||||
List<Event> events = new ArrayList<>();
|
||||
while(rs.next())
|
||||
events.add(new Event(rs));
|
||||
return events;
|
||||
});
|
||||
}
|
||||
|
||||
private boolean now(){
|
||||
Instant now = Instant.now();
|
||||
return now.isAfter(start.toInstant()) && now.isBefore(end.toInstant());
|
||||
}
|
||||
|
||||
public int getEventID() {
|
||||
return eventID;
|
||||
}
|
||||
public String getEventName() {
|
||||
return eventName;
|
||||
}
|
||||
public Timestamp getStart() {
|
||||
return start;
|
||||
}
|
||||
public Timestamp getEnd() {
|
||||
return end;
|
||||
}
|
||||
public int getMaximumTeamMembers() {
|
||||
return maximumTeamMembers;
|
||||
}
|
||||
public boolean publicSchemsOnly() {
|
||||
return publicSchemsOnly;
|
||||
}
|
||||
public boolean spectateSystem(){
|
||||
return spectateSystem;
|
||||
}
|
||||
public Timestamp getDeadline() {
|
||||
return deadline;
|
||||
}
|
||||
public String getSchemType() {
|
||||
return schemType;
|
||||
}
|
||||
}
|
@ -1,5 +1,25 @@
|
||||
/*
|
||||
* 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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.FightPlayer;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import de.steamwar.bungeecore.ArenaMode;
|
||||
|
||||
@ -62,17 +82,17 @@ public class Fight {
|
||||
return f;
|
||||
}, page * elementsPerPage, elementsPerPage);
|
||||
|
||||
List<FightPlayer> fightPlayers = FightPlayer.batchGet(fights.stream().map(f -> f.fightID).collect(Collectors.toSet()));
|
||||
List<FightPlayer> fightPlayers = FightPlayer.batchGet(fights.stream().map(f -> f.fightID).toArray(Integer[]::new));
|
||||
for(Fight fight : fights) {
|
||||
fight.initPlayers(fightPlayers);
|
||||
}
|
||||
|
||||
SteamwarUser.batchCache(fightPlayers.stream().map(FightPlayer::getUserID).collect(Collectors.toSet()));
|
||||
de.steamwar.bungeecore.sql.SteamwarUser.batchCache(fightPlayers.stream().map(FightPlayer::getUserID).collect(Collectors.toSet()));
|
||||
return fights;
|
||||
}
|
||||
|
||||
public SchematicType getSchemType() {
|
||||
return SchematicType.fromDB(gameMode);
|
||||
public de.steamwar.bungeecore.sql.SchematicType getSchemType() {
|
||||
return de.steamwar.bungeecore.sql.SchematicType.fromDB(gameMode);
|
||||
}
|
||||
|
||||
public ArenaMode getGameMode() {
|
||||
@ -90,11 +110,11 @@ public class Fight {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public SteamwarUser getBlueLeader() {
|
||||
return SteamwarUser.get(blueLeader);
|
||||
public de.steamwar.bungeecore.sql.SteamwarUser getBlueLeader() {
|
||||
return de.steamwar.bungeecore.sql.SteamwarUser.get(blueLeader);
|
||||
}
|
||||
|
||||
public SteamwarUser getRedLeader() {
|
||||
public de.steamwar.bungeecore.sql.SteamwarUser getRedLeader() {
|
||||
return SteamwarUser.get(redLeader);
|
||||
}
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FightPlayer {
|
||||
|
||||
private final int fightID;
|
||||
private final int userID;
|
||||
private final int team;
|
||||
private final String kit;
|
||||
private final int kills;
|
||||
private final boolean isOut;
|
||||
|
||||
private FightPlayer(ResultSet rs) throws SQLException {
|
||||
fightID = rs.getInt("FightID");
|
||||
userID = rs.getInt("UserID");
|
||||
team = rs.getInt("Team");
|
||||
kit = rs.getString("Kit");
|
||||
kills = rs.getInt("Kills");
|
||||
isOut = rs.getBoolean("IsOut");
|
||||
}
|
||||
|
||||
public static List<FightPlayer> batchGet(Set<Integer> fightIds) {
|
||||
List<FightPlayer> fightPlayers = new ArrayList<>();
|
||||
if(fightIds.isEmpty())
|
||||
return fightPlayers;
|
||||
|
||||
try (Statement batch = new Statement("SELECT * FROM FightPlayer WHERE FightID IN (" + fightIds.stream().map(Object::toString).collect(Collectors.joining(", ")) + ")")) {
|
||||
batch.select(rs -> {
|
||||
while(rs.next())
|
||||
fightPlayers.add(new FightPlayer(rs));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
return fightPlayers;
|
||||
}
|
||||
|
||||
public int getFightID() {
|
||||
return fightID;
|
||||
}
|
||||
|
||||
public int getTeam() {
|
||||
return team;
|
||||
}
|
||||
|
||||
public int getUserID() {
|
||||
return userID;
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import de.steamwar.bungeecore.listeners.PollSystem;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PollAnswer {
|
||||
|
||||
private static final Statement get = new Statement("SELECT * FROM PollAnswer WHERE UserID = ? AND Question = ?");
|
||||
private static final Statement getResults = new Statement("SELECT Count(UserID) AS Times, Answer FROM PollAnswer WHERE Question = ? GROUP BY Answer ORDER BY `Times` ASC");
|
||||
private static final Statement insert = new Statement("INSERT INTO PollAnswer (UserID, Question, Answer) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Answer = VALUES(Answer)");
|
||||
|
||||
private final int userID;
|
||||
private final String question;
|
||||
private int answer;
|
||||
|
||||
private PollAnswer(ResultSet rs) throws SQLException {
|
||||
this(rs.getInt("UserID"), rs.getString("Question"));
|
||||
answer = rs.getInt("Answer");
|
||||
}
|
||||
private PollAnswer(int userID, String question){
|
||||
this.userID = userID;
|
||||
this.question = question;
|
||||
answer = 0;
|
||||
}
|
||||
|
||||
public static PollAnswer get(int userID){
|
||||
return get.select(rs -> {
|
||||
if(rs.next())
|
||||
return new PollAnswer(rs);
|
||||
return new PollAnswer(userID, PollSystem.getQuestion());
|
||||
}, userID, PollSystem.getQuestion());
|
||||
}
|
||||
|
||||
public static Map<String, Integer> getCurrentResults() {
|
||||
return getResults.select(rs -> {
|
||||
Map<String, Integer> retMap = new HashMap<>();
|
||||
while (rs.next())
|
||||
retMap.put(PollSystem.getAnswer(rs.getInt("Answer")-1), rs.getInt("Times"));
|
||||
return retMap;
|
||||
}, PollSystem.getQuestion());
|
||||
}
|
||||
|
||||
public boolean hasAnswered(){
|
||||
return answer != 0;
|
||||
}
|
||||
|
||||
public void setAnswer(int answer){
|
||||
this.answer = answer;
|
||||
insert.update(userID, question, answer);
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
public class SWException {
|
||||
private SWException(){}
|
||||
|
||||
private static final Statement insert = new Statement("INSERT INTO Exception (server, message, stacktrace) VALUES (?, ?, ?)");
|
||||
|
||||
public static void log(String server, String message, String stacktrace){
|
||||
insert.update(server, message, stacktrace);
|
||||
}
|
||||
}
|
@ -19,7 +19,9 @@
|
||||
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.Season;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import static de.steamwar.bungeecore.sql.UserElo.ELO_DEFAULT;
|
||||
|
||||
public class SchemElo {
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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.bungeecore.sql;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class Season {
|
||||
private Season() {}
|
||||
|
||||
public static int getSeason() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int yearIndex = calendar.get(Calendar.MONTH) / 4;
|
||||
return (calendar.get(Calendar.YEAR) * 3 + yearIndex);
|
||||
}
|
||||
|
||||
public static String getSeasonStart() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) / 4 * 3 + 1) + "-1";
|
||||
}
|
||||
|
||||
public static String convertSeasonToString(int season){
|
||||
if (season == -1) return "";
|
||||
int yearSeason = season % 3;
|
||||
int year = (season - yearSeason) / 3;
|
||||
return String.format("%d-%d", year, yearSeason);
|
||||
}
|
||||
|
||||
public static int convertSeasonToNumber(String season){
|
||||
if (season.isEmpty()) return -1;
|
||||
String[] split = season.split("-");
|
||||
try {
|
||||
return Integer.parseInt(split[0]) * 3 + Integer.parseInt(split[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class Session {
|
||||
|
||||
private static final Statement insert = new Statement("INSERT INTO Session (UserID, StartTime, EndTime) VALUES (?, ?, NOW())");
|
||||
|
||||
private Session(){}
|
||||
|
||||
public static void insertSession(int userID, Timestamp startTime){
|
||||
insert.update(userID, startTime);
|
||||
}
|
||||
}
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import com.google.gson.JsonParser;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
@ -28,6 +27,9 @@ import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.bungeecore.network.NetworkSender;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.network.packets.server.LocaleInvalidationPacket;
|
||||
import de.steamwar.sql.BannedUserIPs;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -350,7 +352,7 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public void updateBanIP(String ip) {
|
||||
BannedUserIPs.banIP(this, ip);
|
||||
BannedUserIPs.banIP(id, ip);
|
||||
}
|
||||
|
||||
public double getOnlinetime() {
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.TeamTeilnahme;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class TeamTeilnahme {
|
||||
private TeamTeilnahme(){}
|
||||
|
||||
private static final Statement insert = new Statement("INSERT INTO TeamTeilnahme (TeamID, EventID) VALUES (?, ?)");
|
||||
private static final Statement delete = new Statement("DELETE FROM TeamTeilnahme WHERE TeamID = ? AND EventID = ?");
|
||||
private static final Statement deleteFuture = new Statement("DELETE t FROM TeamTeilnahme t INNER JOIN Event e ON t.EventID = e.EventID WHERE t.TeamID = ? AND e.Start > NOW()");
|
||||
private static final Statement byEventTeam = new Statement("SELECT * FROM TeamTeilnahme WHERE TeamID = ? AND EventID = ?");
|
||||
private static final Statement byEvent = new Statement("SELECT * FROM TeamTeilnahme WHERE EventID = ?");
|
||||
private static final Statement byTeam = new Statement("SELECT * FROM TeamTeilnahme WHERE TeamID = ?");
|
||||
|
||||
public static void teilnehmen(int teamID, int eventID){
|
||||
insert.update(teamID, eventID);
|
||||
}
|
||||
|
||||
public static void notTeilnehmen(int teamID, int eventID){
|
||||
delete.update(teamID, eventID);
|
||||
}
|
||||
|
||||
public static boolean nimmtTeil(int teamID, int eventID){
|
||||
return byEventTeam.select(ResultSet::next, teamID, eventID);
|
||||
}
|
||||
|
||||
public static void deleteFuture(int teamID) {
|
||||
deleteFuture.update(teamID);
|
||||
}
|
||||
|
||||
public static Set<Team> getTeams(int eventID){
|
||||
return byEvent.select(rs -> {
|
||||
Set<Team> teams = new HashSet<>();
|
||||
while(rs.next())
|
||||
teams.add(Team.get(rs.getInt("TeamID")));
|
||||
return teams;
|
||||
}, eventID);
|
||||
}
|
||||
|
||||
public static Set<Event> getEvents(int teamID){
|
||||
return byTeam.select(rs -> {
|
||||
Set<Event> events = new HashSet<>();
|
||||
while(rs.next())
|
||||
events.add(Event.get(rs.getInt("EventID")));
|
||||
return events;
|
||||
}, teamID);
|
||||
}
|
||||
}
|
@ -19,29 +19,31 @@
|
||||
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Field;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import de.steamwar.sql.internal.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.ServerStarter;
|
||||
import de.steamwar.bungeecore.SubserverSystem;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class Tutorial {
|
||||
|
||||
private static final Table<Tutorial> table = new Table<>(Tutorial.class);
|
||||
private static final Statement release = table.update(Table.PRIMARY, "released");
|
||||
private static final Statement delete = table.delete(Table.PRIMARY);
|
||||
|
||||
private static final Statement by_popularity = new Statement("SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Released = ? GROUP BY t.TutorialID ORDER BY SUM(r.Stars) DESC LIMIT ?, ?");
|
||||
private static final Statement own = new Statement("SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Creator = ? GROUP BY t.TutorialID ORDER BY t.TutorialID ASC LIMIT ?, ?");
|
||||
private static final Statement by_creator_name = new Statement("SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Creator = ? AND t.Name = ? GROUP BY t.TutorialID");
|
||||
private static final Statement by_id = new Statement("SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.TutorialID = ? GROUP BY t.TutorialID");
|
||||
private static final Statement rate = new Statement("INSERT INTO TutorialRating (TutorialID, UserID, Stars) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Stars = VALUES(Stars)");
|
||||
private static final Statement create = new Statement("INSERT INTO Tutorial (Creator, Name, Item) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), Released = 0");
|
||||
private static final Statement release = new Statement("UPDATE Tutorial SET Released = 1 WHERE TutorialID = ?");
|
||||
private static final Statement delete = new Statement("DELETE FROM Tutorial WHERE TutorialID = ?");
|
||||
|
||||
public static List<Tutorial> getPage(int page, int elementsPerPage, boolean released) {
|
||||
List<Tutorial> tutorials = by_popularity.select(rs -> {
|
||||
@ -55,21 +57,21 @@ public class Tutorial {
|
||||
return tutorials;
|
||||
}
|
||||
|
||||
public static List<Tutorial> getOwn(SteamwarUser user, int page, int elementsPerPage) {
|
||||
public static List<Tutorial> getOwn(int user, int page, int elementsPerPage) {
|
||||
return own.select(rs -> {
|
||||
List<Tutorial> t = new ArrayList<>();
|
||||
while(rs.next())
|
||||
t.add(new Tutorial(rs));
|
||||
return t;
|
||||
}, user.getId(), page * elementsPerPage, elementsPerPage);
|
||||
}, user, page * elementsPerPage, elementsPerPage);
|
||||
}
|
||||
|
||||
public static Tutorial create(SteamwarUser creator, String name, String item) {
|
||||
create.update(creator.getId(), name, item);
|
||||
public static Tutorial create(int creator, String name, String item) {
|
||||
create.update(creator, name, item);
|
||||
return by_creator_name.select(rs -> {
|
||||
rs.next();
|
||||
return new Tutorial(rs);
|
||||
}, creator.getId(), name);
|
||||
}, creator, name);
|
||||
}
|
||||
|
||||
public static Tutorial get(int id) {
|
||||
@ -80,12 +82,23 @@ public class Tutorial {
|
||||
}, id);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Field(keys = {Table.PRIMARY}, autoincrement = true)
|
||||
private final int id;
|
||||
@Getter
|
||||
@Field(keys = {"CreatorName"})
|
||||
private final int creator;
|
||||
@Getter
|
||||
@Field(keys = {"CreatorName"})
|
||||
private final String name;
|
||||
@Getter
|
||||
@Field(def = "'BOOK'")
|
||||
private final String item;
|
||||
private final double stars;
|
||||
@Getter
|
||||
@Field(def = "0")
|
||||
private final boolean released;
|
||||
@Getter
|
||||
private final double stars;
|
||||
|
||||
public Tutorial(ResultSet rs) throws SQLException {
|
||||
this.id = rs.getInt("TutorialID");
|
||||
@ -96,44 +109,15 @@ public class Tutorial {
|
||||
this.stars = rs.getDouble("Stars");
|
||||
}
|
||||
|
||||
public SteamwarUser creator() {
|
||||
return SteamwarUser.get(creator);
|
||||
}
|
||||
|
||||
public double stars() {
|
||||
return stars;
|
||||
}
|
||||
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String item() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean released() {
|
||||
return released;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
release.update(id);
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
delete.update(id);
|
||||
SubserverSystem.deleteFolder(BungeeCore.local, world().getPath());
|
||||
}
|
||||
|
||||
public File world() {
|
||||
return new File(ServerStarter.TUTORIAL_PATH, String.valueOf(id));
|
||||
}
|
||||
|
||||
public void rate(SteamwarUser user, int rating) {
|
||||
rate.update(id, user.getId(), rating);
|
||||
public void rate(int user, int rating) {
|
||||
rate.update(id, user, rating);
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
|
||||
public class UserConfig {
|
||||
private UserConfig() {}
|
||||
|
||||
private static final Statement insert = new Statement("INSERT INTO UserConfig (User, Config, Value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE Value = VALUES(Value)");
|
||||
private static final Statement select = new Statement("SELECT Value FROM UserConfig WHERE User = ? AND Config = ?");
|
||||
private static final Statement delete = new Statement("DELETE FROM UserConfig WHERE User = ? AND Config = ?");
|
||||
|
||||
public static String getConfig(int userID, String config) {
|
||||
return select.select(rs -> {
|
||||
if(rs.next())
|
||||
return rs.getString("Value");
|
||||
return null;
|
||||
}, userID, config);
|
||||
}
|
||||
|
||||
public static void updateUserConfig(int userID, String config, String value) {
|
||||
if(value == null) {
|
||||
delete.update(userID, config);
|
||||
return;
|
||||
}
|
||||
|
||||
insert.update(userID, config, value);
|
||||
}
|
||||
}
|
@ -19,9 +19,10 @@
|
||||
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import de.steamwar.bungeecore.ArenaMode;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.sql.Season;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
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.bungeecore.sql;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum UserGroup {
|
||||
|
||||
Admin("§4", "§e", "Admin", true, true, true, true),
|
||||
Developer("§3", "§f", "Dev", true, true, true, true),
|
||||
Moderator("§c", "§f", "Mod", true, true, true, true),
|
||||
Supporter("§9", "§f", "Sup", false, true, true, true),
|
||||
Builder("§2", "§f", "Arch", false, true, false, true),
|
||||
YouTuber("§5", "§f", "YT", false, false, false, true),
|
||||
Member("§7", "§7", "", false, false, false, false);
|
||||
|
||||
private final String colorCode;
|
||||
private final String chatColorCode;
|
||||
private final String chatPrefix;
|
||||
private final boolean adminGroup;
|
||||
private final boolean teamGroup;
|
||||
private final boolean checkSchematics;
|
||||
private final boolean privilegedMods;
|
||||
|
||||
UserGroup(String colorCode, String chatColorCode, String chatPrefix, boolean adminGroup, boolean teamGroup, boolean checkSchematics, boolean privilegedMods) {
|
||||
this.colorCode = colorCode;
|
||||
this.chatColorCode = chatColorCode;
|
||||
this.chatPrefix = chatPrefix;
|
||||
this.adminGroup = adminGroup;
|
||||
this.teamGroup = teamGroup;
|
||||
this.checkSchematics = checkSchematics;
|
||||
this.privilegedMods = privilegedMods;
|
||||
}
|
||||
|
||||
public String getColorCode() {
|
||||
return colorCode;
|
||||
}
|
||||
|
||||
public boolean isAdminGroup() {
|
||||
return adminGroup;
|
||||
}
|
||||
|
||||
public boolean isTeamGroup() {
|
||||
return teamGroup;
|
||||
}
|
||||
|
||||
public boolean isCheckSchematics() {
|
||||
return checkSchematics;
|
||||
}
|
||||
|
||||
public boolean privilegedMods() {
|
||||
return privilegedMods;
|
||||
}
|
||||
|
||||
public String getChatColorCode() {
|
||||
return chatColorCode;
|
||||
}
|
||||
|
||||
public static UserGroup getUsergroup(String name) {
|
||||
return Arrays.stream(UserGroup.values()).filter(userGroup -> userGroup.name().equalsIgnoreCase(name)).collect(Collectors.toList()).get(0);
|
||||
}
|
||||
|
||||
public String getChatPrefix() {
|
||||
return chatPrefix;
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bungeecore.tablist;
|
||||
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.UserGroup;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
54
src/de/steamwar/bungeecore/util/BauLock.java
Normale Datei
54
src/de/steamwar/bungeecore/util/BauLock.java
Normale Datei
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.bungeecore.util;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
@UtilityClass
|
||||
public class BauLock {
|
||||
|
||||
private static final String BAU_LOCK_CONFIG_NAME = "baulockstate";
|
||||
public static void setLocked(ProxiedPlayer p, BauLockState state) {
|
||||
SteamwarUser owner = SteamwarUser.get(p.getUniqueId());
|
||||
UserConfig.updatePlayerConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name());
|
||||
Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer());
|
||||
}
|
||||
|
||||
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||
if (owner.getId() == target.getId())
|
||||
return false;
|
||||
|
||||
String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME);
|
||||
switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) {
|
||||
case NOBODY:
|
||||
return true;
|
||||
case TEAM:
|
||||
return owner.getTeam() != target.getTeam();
|
||||
case OPEN:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
27
src/de/steamwar/bungeecore/util/BauLockState.java
Normale Datei
27
src/de/steamwar/bungeecore/util/BauLockState.java
Normale Datei
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.bungeecore.util;
|
||||
|
||||
public enum BauLockState {
|
||||
|
||||
NOBODY, // Locks the build server for all users
|
||||
TEAM, //opens the build server only for every added user which is in the same team as the buildOwner
|
||||
OPEN //unlocks the build server for all users
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren