Add punishment implementations
Dieser Commit ist enthalten in:
Ursprung
0b6b2c6b6b
Commit
bb9627b74c
@ -162,8 +162,10 @@ public class BungeeCore extends Plugin {
|
|||||||
Team.clearCache();
|
Team.clearCache();
|
||||||
}, 1, 1, TimeUnit.HOURS);
|
}, 1, 1, TimeUnit.HOURS);
|
||||||
|
|
||||||
|
if (SteamwarDiscordBotConfig.loaded) {
|
||||||
new SteamwarDiscordBot();
|
new SteamwarDiscordBot();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable(){
|
public void onDisable(){
|
||||||
@ -275,7 +277,9 @@ public class BungeeCore extends Plugin {
|
|||||||
);
|
);
|
||||||
|
|
||||||
ArenaMode.init(config.getSection("games"));
|
ArenaMode.init(config.getSection("games"));
|
||||||
|
if (config.getSection("discord") != null) {
|
||||||
SteamwarDiscordBotConfig.loadConfig(config.getSection("discord"));
|
SteamwarDiscordBotConfig.loadConfig(config.getSection("discord"));
|
||||||
|
}
|
||||||
|
|
||||||
final Configuration servers = config.getSection("servers");
|
final Configuration servers = config.getSection("servers");
|
||||||
for(final String serverName : servers.getKeys()){
|
for(final String serverName : servers.getKeys()){
|
||||||
|
@ -194,6 +194,9 @@ public abstract class Node {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not read cores of" + remote, e);
|
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not read cores of" + remote, e);
|
||||||
c = 1;
|
c = 1;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
BungeeCore.get().getLogger().log(Level.SEVERE, "Could not read cores of" + remote, e);
|
||||||
|
c = 1;
|
||||||
}
|
}
|
||||||
cores = c;
|
cores = c;
|
||||||
BungeeCore.get().getLogger().log(Level.INFO, "Adding node " + remote + " with " + cores + " cores.");
|
BungeeCore.get().getLogger().log(Level.INFO, "Adding node " + remote + " with " + cores + " cores.");
|
||||||
|
@ -29,6 +29,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class SteamwarDiscordBotConfig {
|
public class SteamwarDiscordBotConfig {
|
||||||
|
|
||||||
|
public static boolean loaded = false;
|
||||||
public static String TOKEN;
|
public static String TOKEN;
|
||||||
public static String GUILD;
|
public static String GUILD;
|
||||||
public static String ANNOUNCEMENTS_CHANNEL;
|
public static String ANNOUNCEMENTS_CHANNEL;
|
||||||
@ -110,5 +111,6 @@ public class SteamwarDiscordBotConfig {
|
|||||||
for (String type : ranksSections.getKeys()) {
|
for (String type : ranksSections.getKeys()) {
|
||||||
RANKS.put(UserGroup.getUsergroup(type), ranksSections.getString(type));
|
RANKS.put(UserGroup.getUsergroup(type), ranksSections.getString(type));
|
||||||
}
|
}
|
||||||
|
loaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import de.steamwar.bungeecore.comms.packets.BaumemberUpdatePacket;
|
|||||||
import de.steamwar.bungeecore.inventory.SWInventory;
|
import de.steamwar.bungeecore.inventory.SWInventory;
|
||||||
import de.steamwar.bungeecore.inventory.SWItem;
|
import de.steamwar.bungeecore.inventory.SWItem;
|
||||||
import de.steamwar.bungeecore.sql.BauweltMember;
|
import de.steamwar.bungeecore.sql.BauweltMember;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
@ -38,8 +39,15 @@ public class BauCommand extends BasicCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
if(!(sender instanceof ProxiedPlayer))
|
if(!(sender instanceof ProxiedPlayer)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(proxiedPlayer);
|
||||||
|
if (steamwarUser.isPunishedWithMessage(proxiedPlayer, Punishment.PunishmentType.AntiBauJoin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.*;
|
import de.steamwar.bungeecore.*;
|
||||||
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
|
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
|
||||||
import de.steamwar.bungeecore.sql.IgnoreSystem;
|
import de.steamwar.bungeecore.sql.IgnoreSystem;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
@ -39,6 +41,12 @@ public class ChallengeCommand extends BasicCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(proxiedPlayer);
|
||||||
|
if (steamwarUser.isPunishedWithMessage(proxiedPlayer, Punishment.PunishmentType.AntiFightJoin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(args.length < 1){
|
if(args.length < 1){
|
||||||
Message.send("CHALLENGE_USAGE", sender);
|
Message.send("CHALLENGE_USAGE", sender);
|
||||||
return;
|
return;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
package de.steamwar.bungeecore.commands;
|
package de.steamwar.bungeecore.commands;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
@ -45,6 +47,13 @@ public class DevCommand extends BasicCommand {
|
|||||||
if (!(sender instanceof ProxiedPlayer)) {
|
if (!(sender instanceof ProxiedPlayer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(proxiedPlayer);
|
||||||
|
if (steamwarUser.isPunishedWithMessage(proxiedPlayer, Punishment.PunishmentType.AntiBauJoin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String[] devServer = DevServerDir.list();
|
String[] devServer = DevServerDir.list();
|
||||||
if (devServer == null || devServer.length == 0) {
|
if (devServer == null || devServer.length == 0) {
|
||||||
Message.send("DEV_NO_SERVER", sender);
|
Message.send("DEV_NO_SERVER", sender);
|
||||||
|
@ -21,6 +21,8 @@ package de.steamwar.bungeecore.commands;
|
|||||||
|
|
||||||
import de.steamwar.bungeecore.*;
|
import de.steamwar.bungeecore.*;
|
||||||
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
|
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
@ -163,6 +165,12 @@ public class FightCommand extends BasicCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(proxiedPlayer);
|
||||||
|
if (steamwarUser.isPunishedWithMessage(proxiedPlayer, Punishment.PunishmentType.AntiFightJoin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> {
|
createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> {
|
||||||
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), null, false);
|
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), null, false);
|
||||||
arena.sendPlayer(player);
|
arena.sendPlayer(player);
|
||||||
|
@ -20,8 +20,11 @@
|
|||||||
package de.steamwar.bungeecore.commands;
|
package de.steamwar.bungeecore.commands;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.*;
|
import de.steamwar.bungeecore.*;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
@ -32,6 +35,12 @@ public class HistoricCommand extends BasicCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(proxiedPlayer);
|
||||||
|
if (steamwarUser.isPunishedWithMessage(proxiedPlayer, Punishment.PunishmentType.AntiFightJoin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> {
|
FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> {
|
||||||
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), null, false);
|
Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), null, false);
|
||||||
arena.sendPlayer(player);
|
arena.sendPlayer(player);
|
||||||
|
@ -49,8 +49,7 @@ public class MsgCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(player);
|
SteamwarUser user = SteamwarUser.get(player);
|
||||||
if (user.isPunished(Punishment.PunishmentType.Mute)) {
|
if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) {
|
||||||
sender.sendMessage(user.punishmentMessage(Punishment.PunishmentType.Mute, player));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.sql.Punishment;
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
@ -29,10 +30,12 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class PunishmentCommand {
|
public class PunishmentCommand {
|
||||||
|
|
||||||
public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) {
|
public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) {
|
||||||
|
BungeeCord.getInstance().getLogger().log(Level.INFO, "CMD: " + command + " " + punishmentType);
|
||||||
new BasicCommand(command, "bungeecore.ban") {
|
new BasicCommand(command, "bungeecore.ban") {
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
@ -45,8 +45,7 @@ public class RCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(player);
|
SteamwarUser user = SteamwarUser.get(player);
|
||||||
if (user.isPunished(Punishment.PunishmentType.Mute)) {
|
if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) {
|
||||||
sender.sendMessage(user.punishmentMessage(Punishment.PunishmentType.Mute, player));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
|
|||||||
|
|
||||||
import de.steamwar.bungeecore.*;
|
import de.steamwar.bungeecore.*;
|
||||||
import de.steamwar.bungeecore.sql.Elo;
|
import de.steamwar.bungeecore.sql.Elo;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
@ -49,11 +50,20 @@ public class RankedCommand extends BasicCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if(!(sender instanceof ProxiedPlayer)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProxiedPlayer proxiedPlayer = (ProxiedPlayer) sender;
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(proxiedPlayer);
|
||||||
|
if (steamwarUser.isPunishedWithMessage(proxiedPlayer, Punishment.PunishmentType.AntiFightJoin)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(args.length < 1){
|
if(args.length < 1){
|
||||||
getModes(sender, "/ranked ");
|
getModes(sender, "/ranked ");
|
||||||
return;
|
return;
|
||||||
}else if(!(sender instanceof ProxiedPlayer))
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
ArenaMode mode = FightCommand.getMode(sender, args[0]);
|
ArenaMode mode = FightCommand.getMode(sender, args[0]);
|
||||||
if(mode == null)
|
if(mode == null)
|
||||||
|
@ -145,8 +145,7 @@ public class ChatListener extends BasicListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(sender);
|
SteamwarUser user = SteamwarUser.get(sender);
|
||||||
if (user.isPunished(Punishment.PunishmentType.Mute)) {
|
if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) {
|
||||||
sender.sendMessage(user.punishmentMessage(Punishment.PunishmentType.Mute, sender));
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -224,8 +223,7 @@ public class ChatListener extends BasicListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(sender);
|
SteamwarUser user = SteamwarUser.get(sender);
|
||||||
if (user.isPunished(Punishment.PunishmentType.Mute)) {
|
if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) {
|
||||||
sender.sendMessage(user.punishmentMessage(Punishment.PunishmentType.Mute, sender));
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import de.steamwar.bungeecore.bot.util.DiscordRanks;
|
|||||||
import de.steamwar.bungeecore.commands.ChallengeCommand;
|
import de.steamwar.bungeecore.commands.ChallengeCommand;
|
||||||
import de.steamwar.bungeecore.commands.CheckCommand;
|
import de.steamwar.bungeecore.commands.CheckCommand;
|
||||||
import de.steamwar.bungeecore.commands.MsgCommand;
|
import de.steamwar.bungeecore.commands.MsgCommand;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import de.steamwar.bungeecore.sql.UserGroup;
|
import de.steamwar.bungeecore.sql.UserGroup;
|
||||||
import net.md_5.bungee.api.AbstractReconnectHandler;
|
import net.md_5.bungee.api.AbstractReconnectHandler;
|
||||||
@ -34,10 +35,7 @@ import net.md_5.bungee.api.ProxyServer;
|
|||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
import net.md_5.bungee.api.event.*;
|
||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
|
||||||
import net.md_5.bungee.api.event.ServerDisconnectEvent;
|
|
||||||
import net.md_5.bungee.api.event.ServerKickEvent;
|
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -144,4 +142,24 @@ public class ConnectionListener extends BasicListener {
|
|||||||
if(players.isEmpty() || (players.size() == 1 && players.contains(player)))
|
if(players.isEmpty() || (players.size() == 1 && players.contains(player)))
|
||||||
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), subserver::waitForTermination);
|
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), subserver::waitForTermination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onServerConnect(ServerConnectEvent e) {
|
||||||
|
ServerInfo server = e.getTarget();
|
||||||
|
Subserver subserver = Subserver.getSubserver(server);
|
||||||
|
if (subserver == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SteamwarUser steamwarUser = SteamwarUser.get(e.getPlayer());
|
||||||
|
|
||||||
|
if (subserver.getType() == Servertype.BAUSERVER) {
|
||||||
|
if (steamwarUser.isPunishedWithMessage(e.getPlayer(), Punishment.PunishmentType.AntiBauJoin)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (steamwarUser.isPunishedWithMessage(e.getPlayer(), Punishment.PunishmentType.AntiFightJoin)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ public class Punishment {
|
|||||||
private static final Statement getPunishments = new Statement("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) FROM Punishments WHERE UserId = ? GROUP BY Type)");
|
private static final Statement getPunishments = new Statement("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) FROM Punishments WHERE UserId = ? GROUP BY Type)");
|
||||||
private static final Statement getAllPunishments = new Statement("SELECT * FROM Punishments WHERE UserId = ? ORDER BY `PunishmentId` DESC");
|
private static final Statement getAllPunishments = new Statement("SELECT * FROM Punishments WHERE UserId = ? ORDER BY `PunishmentId` DESC");
|
||||||
private static final Statement insert = new Statement("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)");
|
private static final Statement insert = new Statement("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)");
|
||||||
private static final Statement update = new Statement("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?");
|
|
||||||
|
|
||||||
public static Punishment getPunishmentOfPlayer(int user, PunishmentType type) {
|
public static Punishment getPunishmentOfPlayer(int user, PunishmentType type) {
|
||||||
return getPunishment.select(rs -> {
|
return getPunishment.select(rs -> {
|
||||||
|
@ -267,6 +267,14 @@ public class SteamwarUser {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPunishedWithMessage(ProxiedPlayer player, Punishment.PunishmentType punishment) {
|
||||||
|
if (!isPunished(punishment)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.sendMessage(punishmentMessage(punishment, player));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) {
|
public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) {
|
||||||
punishments.remove(punishment);
|
punishments.remove(punishment);
|
||||||
punishments.put(punishment, Punishment.createPunishment(id, from, punishment, banReason, time, perma));
|
punishments.put(punishment, Punishment.createPunishment(id, from, punishment, banReason, time, perma));
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren