geforkt von SteamWar/BungeeCore
Reworked Ban and Mute
Dieser Commit ist enthalten in:
Ursprung
8c3df0e1dd
Commit
986b53fbf8
@ -54,7 +54,7 @@ public class BungeeCore extends Plugin {
|
|||||||
|
|
||||||
public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e";
|
public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e";
|
||||||
public static final String TEAMCHAT_PREFIX = "§8TC §e";
|
public static final String TEAMCHAT_PREFIX = "§8TC §e";
|
||||||
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy");
|
||||||
|
|
||||||
public static String CHAT_PREFIX;
|
public static String CHAT_PREFIX;
|
||||||
public static String WORLD_FOLDER;
|
public static String WORLD_FOLDER;
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.BungeeCore;
|
import de.steamwar.bungeecore.BungeeCore;
|
||||||
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.connection.ProxiedPlayer;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@ -56,12 +57,12 @@ public class BanCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
String msg = banReason.toString();
|
String msg = banReason.toString();
|
||||||
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg);
|
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg);
|
||||||
target.ban(banTime, msg);
|
target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Timestamp parseTime(CommandSender sender, String arg){
|
public static Timestamp parseTime(CommandSender sender, String arg){
|
||||||
if(arg.equalsIgnoreCase("perma")) {
|
if(arg.equalsIgnoreCase("perma")) {
|
||||||
return Timestamp.from(Instant.ofEpochSecond(946674800));
|
return Timestamp.from(Instant.ofEpochSecond(946684800));
|
||||||
}else{
|
}else{
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH:mm");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH:mm");
|
||||||
try{
|
try{
|
||||||
|
@ -24,6 +24,7 @@ import de.steamwar.bungeecore.sql.SteamwarUser;
|
|||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
public class MuteCommand extends BasicCommand {
|
public class MuteCommand extends BasicCommand {
|
||||||
|
|
||||||
@ -52,6 +53,6 @@ public class MuteCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
String msg = muteReason.toString();
|
String msg = muteReason.toString();
|
||||||
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg);
|
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg);
|
||||||
target.mute(muteTime, msg);
|
target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.BungeeCore;
|
import de.steamwar.bungeecore.BungeeCore;
|
||||||
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.connection.ProxiedPlayer;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -44,6 +45,6 @@ public class UnbanCommand extends BasicCommand {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt.");
|
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt.");
|
||||||
target.ban(Timestamp.from(new Date().toInstant()), "");
|
target.ban(Timestamp.from(new Date().toInstant()), "Unban", SteamwarUser.get(sender.getName()).getId(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.bungeecore.commands;
|
package de.steamwar.bungeecore.commands;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.BungeeCore;
|
import de.steamwar.bungeecore.BungeeCore;
|
||||||
|
import de.steamwar.bungeecore.sql.Punishment;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import de.steamwar.bungeecore.sql.Team;
|
import de.steamwar.bungeecore.sql.Team;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
@ -70,11 +71,10 @@ public class WhoisCommand extends BasicCommand {
|
|||||||
Team team = Team.get(user.getTeam());
|
Team team = Team.get(user.getTeam());
|
||||||
BungeeCore.send(player, "§7Team§8: §e" + team.getTeamName());
|
BungeeCore.send(player, "§7Team§8: §e" + team.getTeamName());
|
||||||
|
|
||||||
if(user.isBanned()){
|
BungeeCore.send(player, "§7Bestrafungen: ");
|
||||||
player.sendMessage(user.banMessage());
|
for (Punishment punishment : Punishment.getAllPunishmentsByPlayer(user.getId())) {
|
||||||
}
|
BungeeCore.send(player, "§7" + SteamwarUser.get(punishment.getPunisher()).getUserName() + "§8» §f§l" + punishment.getType().name() + ": §e"
|
||||||
if(user.isMuted()){
|
+ punishment.getStartTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " - " + (punishment.isPerma()?"Perma":punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " §c" + punishment.getReason());
|
||||||
player.sendMessage(user.muteMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,15 @@ public class BanListener extends BasicListener {
|
|||||||
|
|
||||||
List<BannedUserIPs> ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress());
|
List<BannedUserIPs> ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress());
|
||||||
if(!ips.isEmpty()){
|
if(!ips.isEmpty()){
|
||||||
|
if(ips.stream().anyMatch(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId())) {
|
||||||
|
ips.forEach(bannedUserIPs -> {
|
||||||
|
if(bannedUserIPs.getUserID() == user.getId())
|
||||||
|
bannedUserIPs.remove();
|
||||||
|
});
|
||||||
|
ips.removeIf(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId());
|
||||||
|
if(ips.isEmpty())
|
||||||
|
return;
|
||||||
|
}
|
||||||
StringBuilder potentialBan = new StringBuilder();
|
StringBuilder potentialBan = new StringBuilder();
|
||||||
potentialBan.append(BungeeCore.CHAT_PREFIX);
|
potentialBan.append(BungeeCore.CHAT_PREFIX);
|
||||||
potentialBan.append("§cMögliche Bannumgehung durch §r");
|
potentialBan.append("§cMögliche Bannumgehung durch §r");
|
||||||
|
@ -74,7 +74,7 @@ class Utils {
|
|||||||
if(max == ModType.YELLOW)
|
if(max == ModType.YELLOW)
|
||||||
player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können."));
|
player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können."));
|
||||||
else{
|
else{
|
||||||
user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName());
|
user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName(), 0, false);
|
||||||
BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen des Mods " + mods.get(0).getModName() + " gebannt.");
|
BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen des Mods " + mods.get(0).getModName() + " gebannt.");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -84,7 +84,7 @@ class Utils {
|
|||||||
if(max == ModType.YELLOW)
|
if(max == ModType.YELLOW)
|
||||||
player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können."));
|
player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können."));
|
||||||
else{
|
else{
|
||||||
user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString());
|
user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString(), 0, false);
|
||||||
BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen der Mods " + sb.toString() + " gebannt.");
|
BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen der Mods " + sb.toString() + " gebannt.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,4 +78,8 @@ public class BannedUserIPs {
|
|||||||
public java.sql.Timestamp getTimestamp() {
|
public java.sql.Timestamp getTimestamp() {
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void remove() {
|
||||||
|
SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", userID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
141
src/de/steamwar/bungeecore/sql/Punishment.java
Normale Datei
141
src/de/steamwar/bungeecore/sql/Punishment.java
Normale Datei
@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
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.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class Punishment {
|
||||||
|
|
||||||
|
public static Punishment getPunishmentByPlayer(int user, PunishmentType type) {
|
||||||
|
ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE `PunishmentId` IN (SELECT MAX(`PunishmentId`) FROM Punishments WHERE UserId = ? AND Type = ?)", user, type.toDb());
|
||||||
|
try {
|
||||||
|
if(!set.next())
|
||||||
|
return null;
|
||||||
|
return new Punishment(set);
|
||||||
|
} catch (SQLException throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
throw new SecurityException("Could not Load Punishments", throwable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<PunishmentType, Punishment> getPunishmentsByPlayer(int user) {
|
||||||
|
ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE `PunishmentId` IN (SELECT MAX(`PunishmentId`) FROM Punishments WHERE UserId = ? GROUP BY Type)", user);
|
||||||
|
try {
|
||||||
|
Map<PunishmentType, Punishment> punishmentMap = new HashMap<>();
|
||||||
|
while (set.next()) {
|
||||||
|
Punishment punishment = new Punishment(set);
|
||||||
|
punishmentMap.put(punishment.getType(), punishment);
|
||||||
|
}
|
||||||
|
return punishmentMap;
|
||||||
|
} catch (SQLException throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
throw new SecurityException("Could not Load Punishments", throwable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<Punishment> getAllPunishmentsByPlayer(int user) {
|
||||||
|
ResultSet set = SQL.select("SELECT * FROM Punishments WHERE UserId = ? ORDER BY `PunishmentId` DESC", user);
|
||||||
|
try {
|
||||||
|
Set<Punishment> punishments = new HashSet<>();
|
||||||
|
while (set.next()) {
|
||||||
|
punishments.add(new Punishment(set));
|
||||||
|
}
|
||||||
|
return punishments;
|
||||||
|
} catch (SQLException throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
throw new SecurityException("Could not Load all Punishments", throwable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Punishment createPunishment(int user, int executor, PunishmentType type, String reason, Timestamp endTime, Boolean perma) {
|
||||||
|
SQL.update("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)",
|
||||||
|
user, executor, type.toDb(), reason, endTime, perma);
|
||||||
|
return getPunishmentByPlayer(user, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Timestamp startTime;
|
||||||
|
private final Timestamp endTime;
|
||||||
|
private final PunishmentType type;
|
||||||
|
private final int user;
|
||||||
|
private final String reason;
|
||||||
|
private final int id;
|
||||||
|
private final int punisher;
|
||||||
|
private final boolean perma;
|
||||||
|
|
||||||
|
private Punishment(ResultSet set) throws SQLException {
|
||||||
|
id = set.getInt("PunishmentId");
|
||||||
|
user = set.getInt("UserId");
|
||||||
|
reason = set.getString("Reason");
|
||||||
|
type = PunishmentType.getTypeFromDB(set.getString("Type"));
|
||||||
|
startTime = set.getTimestamp("StartTime");
|
||||||
|
endTime = set.getTimestamp("EndTime");
|
||||||
|
punisher = set.getInt("Punisher");
|
||||||
|
perma = set.getBoolean("Perma");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Timestamp getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Timestamp getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PunishmentType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReason() {
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPunisher() {
|
||||||
|
return punisher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPerma() {
|
||||||
|
return perma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PunishmentType {
|
||||||
|
Ban,
|
||||||
|
Mute;
|
||||||
|
|
||||||
|
public String toDb() {
|
||||||
|
return name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PunishmentType getTypeFromDB(String str) {
|
||||||
|
return Arrays.stream(values()).filter(punishmentType -> punishmentType.name().equalsIgnoreCase(str)).collect(Collectors.toList()).get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -32,7 +32,6 @@ import java.net.UnknownHostException;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -43,16 +42,12 @@ public class SteamwarUser {
|
|||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private String userName;
|
private String userName;
|
||||||
private UserGroup userGroup;
|
private UserGroup userGroup;
|
||||||
private Timestamp banTime;
|
|
||||||
private String banReason;
|
|
||||||
private int team;
|
private int team;
|
||||||
private Timestamp muteTime;
|
private Map<Punishment.PunishmentType, Punishment> punishments;
|
||||||
private String muteReason;
|
|
||||||
|
|
||||||
private static final Map<String, SteamwarUser> usersByName = new HashMap<>();
|
private static final Map<String, SteamwarUser> usersByName = new HashMap<>();
|
||||||
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
|
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
|
||||||
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
|
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
|
||||||
private static final Timestamp PERMA_BAN = Timestamp.from(Instant.ofEpochSecond(946684800));
|
|
||||||
private static final InetAddress LIXFEL_DE;
|
private static final InetAddress LIXFEL_DE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -69,14 +64,11 @@ public class SteamwarUser {
|
|||||||
uuid = UUID.fromString(rs.getString("UUID"));
|
uuid = UUID.fromString(rs.getString("UUID"));
|
||||||
userName = rs.getString("UserName");
|
userName = rs.getString("UserName");
|
||||||
userGroup = UserGroup.getUsergroup(rs.getString("UserGroup"));
|
userGroup = UserGroup.getUsergroup(rs.getString("UserGroup"));
|
||||||
banTime = rs.getTimestamp("BanTime");
|
|
||||||
banReason = rs.getString("BanReason");
|
|
||||||
team = rs.getInt("Team");
|
team = rs.getInt("Team");
|
||||||
muteTime = rs.getTimestamp("MuteTime");
|
|
||||||
muteReason = rs.getString("MuteReason");
|
|
||||||
usersById.put(id, this);
|
usersById.put(id, this);
|
||||||
usersByName.put(userName.toLowerCase(), this);
|
usersByName.put(userName.toLowerCase(), this);
|
||||||
usersByUUID.put(uuid, this);
|
usersByUUID.put(uuid, this);
|
||||||
|
punishments = Punishment.getPunishmentsByPlayer(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SteamwarUser getOrCreate(PendingConnection connection){
|
public static SteamwarUser getOrCreate(PendingConnection connection){
|
||||||
@ -157,47 +149,32 @@ public class SteamwarUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBanned() {
|
public boolean isBanned() {
|
||||||
if (banTime == null) {
|
return punishments.containsKey(Punishment.PunishmentType.Ban) &&
|
||||||
return false;
|
(punishments.get(Punishment.PunishmentType.Ban).getEndTime().after(new Date()) || punishments.get(Punishment.PunishmentType.Ban).isPerma());
|
||||||
} else if (banTime.after(new Date()) || banTime.before(PERMA_BAN)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
SQL.update("UPDATE UserData SET BanTime = NULL, BanReason = '' WHERE id = ?", id);
|
|
||||||
SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", id);
|
|
||||||
banTime = null;
|
|
||||||
banReason = "";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMuted(){
|
public boolean isMuted(){
|
||||||
if(muteTime == null){
|
return punishments.containsKey(Punishment.PunishmentType.Mute) &&
|
||||||
return false;
|
(punishments.get(Punishment.PunishmentType.Mute).getEndTime().after(new Date()) || punishments.get(Punishment.PunishmentType.Mute).isPerma());
|
||||||
}else if(muteTime.after(new Date()) || muteTime.before(PERMA_BAN)){
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
SQL.update("UPDATE UserData SET MuteTime = NULL, MuteReason = '' WHERE id = ?", id);
|
|
||||||
muteTime = null;
|
|
||||||
muteReason = "";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent banMessage(){
|
public TextComponent banMessage(){
|
||||||
if (banTime.before(PERMA_BAN)) {
|
Punishment punishment = punishments.get(Punishment.PunishmentType.Ban);
|
||||||
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + banReason);
|
if (punishment.isPerma()) {
|
||||||
|
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + punishment.getReason());
|
||||||
} else {
|
} else {
|
||||||
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " +
|
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " +
|
||||||
banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + banReason);
|
punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + punishment.getReason());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent muteMessage(){
|
public TextComponent muteMessage(){
|
||||||
if (muteTime.before(PERMA_BAN)) {
|
Punishment punishment = punishments.get(Punishment.PunishmentType.Mute);
|
||||||
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + muteReason);
|
if (punishment.isPerma()) {
|
||||||
|
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + punishment.getReason());
|
||||||
} else {
|
} else {
|
||||||
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " +
|
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " +
|
||||||
muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + muteReason);
|
punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + punishment.getReason());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,10 +182,9 @@ public class SteamwarUser {
|
|||||||
BannedUserIPs.banIP(this, ip);
|
BannedUserIPs.banIP(this, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ban(Timestamp time, String banReason){
|
public void ban(Timestamp time, String banReason, int from, boolean perma){
|
||||||
SQL.update("UPDATE UserData SET BanTime = ?, BanReason = ? WHERE id = ?", time, banReason, id);
|
punishments.remove(Punishment.PunishmentType.Ban);
|
||||||
banTime = time;
|
punishments.put(Punishment.PunishmentType.Ban, Punishment.createPunishment(id, from, Punishment.PunishmentType.Ban, banReason, time, perma));
|
||||||
this.banReason = banReason;
|
|
||||||
|
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
|
||||||
if(player != null){
|
if(player != null){
|
||||||
@ -218,10 +194,9 @@ public class SteamwarUser {
|
|||||||
updateBanIP("");
|
updateBanIP("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mute(Timestamp time, String muteReason){
|
public void mute(Timestamp time, String muteReason, int from, boolean perma){
|
||||||
SQL.update("UPDATE UserData SET MuteTime = ?, MuteReason = ? WHERE id = ?", time, muteReason, id);
|
punishments.remove(Punishment.PunishmentType.Mute);
|
||||||
muteTime = time;
|
punishments.put(Punishment.PunishmentType.Mute, Punishment.createPunishment(id, from, Punishment.PunishmentType.Mute, muteReason, time, perma));
|
||||||
this.muteReason = muteReason;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SteamwarUser dbInit(ResultSet rs){
|
private static SteamwarUser dbInit(ResultSet rs){
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren