Bugfixes
Dieser Commit ist enthalten in:
Ursprung
4da002788d
Commit
c1a4a91bb9
@ -17,47 +17,77 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
SCHEM_SELECTOR_TITLE={0} auswählen: {1}
|
||||
SCHEM_SELECTOR_BACK=§eZurück
|
||||
SCHEM_SELECTOR_DIR=§9Ordner
|
||||
SCHEM_SELECTOR_RANK=§8Rang {0}
|
||||
SCHEM_SELECTOR_OWN=§7Eigene Schematics
|
||||
SCHEM_SELECTOR_PUB=§7Public Schematics
|
||||
SCHEM_SELECTOR_SEL_DIR=§7Ordner auswählen
|
||||
SCHEM_SELECTOR_NEW_DIR=§7Neuer Ordner
|
||||
SCHEM_SELECTOR_FILTER=§7Filter
|
||||
SCHEM_SELECTOR_SORTING=§7Sortierung
|
||||
SCHEM_SELECTOR_SORTING_CURRENT=§7Aktuell: §e{0}
|
||||
SCHEM_SELECTOR_TITLE={0} ausw<EFBFBD>hlen: {1}
|
||||
SCHEM_SELECTOR_BACK=<EFBFBD>eZur<EFBFBD>ck
|
||||
SCHEM_SELECTOR_DIR=<EFBFBD>9Ordner
|
||||
SCHEM_SELECTOR_RANK=<EFBFBD>8Rang {0}
|
||||
SCHEM_SELECTOR_OWN=<EFBFBD>7Eigene Schematics
|
||||
SCHEM_SELECTOR_PUB=<EFBFBD>7Public Schematics
|
||||
SCHEM_SELECTOR_SEL_DIR=<EFBFBD>7Ordner ausw<73>hlen
|
||||
SCHEM_SELECTOR_NEW_DIR=<EFBFBD>7Neuer Ordner
|
||||
SCHEM_SELECTOR_FILTER=<EFBFBD>7Filter
|
||||
SCHEM_SELECTOR_SORTING=<EFBFBD>7Sortierung
|
||||
SCHEM_SELECTOR_SORTING_CURRENT=<EFBFBD>7Aktuell: <20>e{0}
|
||||
SCHEM_SELECTOR_SORTING_NAME=Name
|
||||
SCHEM_SELECTOR_SORTING_TYPE=Schematic-Typ
|
||||
SCHEM_SELECTOR_SORTING_UPDATE=Letztes Update
|
||||
SCHEM_SELECTOR_SORTING_DIRECTION=§7Richtung: §e{0}
|
||||
SCHEM_SELECTOR_SORTING_DIRECTION=<EFBFBD>7Richtung: <20>e{0}
|
||||
SCHEM_SELECTOR_SORTING_ASC=Aufsteigend
|
||||
SCHEM_SELECTOR_SORTING_DSC=Absteigend
|
||||
|
||||
SCHEM_SELECTOR_ITEM_NAME=§e{0}
|
||||
SCHEM_SELECTOR_ITEM_NAME_FILTER=§7{0}
|
||||
SCHEM_SELECTOR_ITEM_REPLACE=§e{0}§7
|
||||
SCHEM_SELECTOR_ITEM_LORE_TYPE=§7{0}
|
||||
SCHEM_SELECTOR_ITEM_NAME=<EFBFBD>e{0}
|
||||
SCHEM_SELECTOR_ITEM_NAME_FILTER=<EFBFBD>7{0}
|
||||
SCHEM_SELECTOR_ITEM_REPLACE=<EFBFBD>e{0}<7D>7
|
||||
SCHEM_SELECTOR_ITEM_LORE_TYPE=<EFBFBD>7{0}
|
||||
|
||||
SCHEM_SELECTOR_CREATE_DIR_TITLE=Ordner erstellen
|
||||
|
||||
SCHEM_SELECTOR_FILTER_TITLE=Filter
|
||||
SCHEM_SELECTOR_FILTER_ENTER_NAME=Name eingeben
|
||||
SCHEM_SELECTOR_FILTER_NAME=§7Nach Namen suchen...
|
||||
SCHEM_SELECTOR_FILTER_NAME_SEARCH=§7Suchbegriff: §e{0}
|
||||
SCHEM_SELECTOR_FILTER_NAME=<EFBFBD>7Nach Namen suchen...
|
||||
SCHEM_SELECTOR_FILTER_NAME_SEARCH=<EFBFBD>7Suchbegriff: <20>e{0}
|
||||
SCHEM_SELECTOR_FILTER_ENTER_OWNER=Besitzer eingeben
|
||||
SCHEM_SELECTOR_FILTER_OWNER=§7Nach Besitzer suchen...
|
||||
SCHEM_SELECTOR_FILTER_OWNER_SEARCH=§7Besitzer: §e{0}
|
||||
SCHEM_SELECTOR_FILTER_SEL_TYPE=Typ wählen...
|
||||
SCHEM_SELECTOR_FILTER_TYPE=§7Nach Typ filtern...
|
||||
SCHEM_SELECTOR_FILTER_TYPE_SEARCH=§7Typ: §e{0}
|
||||
SCHEM_SELECTOR_FILTER_MAT=§7Nach Item filtern...
|
||||
SCHEM_SELECTOR_FILTER_MAT_SEARCH=§7Item: §e{0}
|
||||
SCHEM_SELECTOR_CANCEL=§eAbbrechen
|
||||
SCHEM_SELECTOR_GO=§eSuchen...
|
||||
SCHEM_SELECTOR_FILTER_OWNER=<EFBFBD>7Nach Besitzer suchen...
|
||||
SCHEM_SELECTOR_FILTER_OWNER_SEARCH=<EFBFBD>7Besitzer: <20>e{0}
|
||||
SCHEM_SELECTOR_FILTER_SEL_TYPE=Typ w<EFBFBD>hlen...
|
||||
SCHEM_SELECTOR_FILTER_TYPE=<EFBFBD>7Nach Typ filtern...
|
||||
SCHEM_SELECTOR_FILTER_TYPE_SEARCH=<EFBFBD>7Typ: <20>e{0}
|
||||
SCHEM_SELECTOR_FILTER_MAT=<EFBFBD>7Nach Item filtern...
|
||||
SCHEM_SELECTOR_FILTER_MAT_SEARCH=<EFBFBD>7Item: <20>e{0}
|
||||
SCHEM_SELECTOR_CANCEL=<EFBFBD>eAbbrechen
|
||||
SCHEM_SELECTOR_GO=<EFBFBD>eSuchen...
|
||||
SCHEM_SELECTOR_SCHEMATIC=Schematic
|
||||
SCHEM_SELECTOR_DIRECTORY=Ordner
|
||||
SCHEM_SELECTOR_SCHEMATIC_NODE=Schematic/Ordner
|
||||
|
||||
MATERIAL_SELECTOR_TITLE=Material auswählen
|
||||
MATERIAL_SELECTOR_TITLE=Material ausw<73>hlen
|
||||
|
||||
BAN_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgebannt§8. §7Grund§8: §f{4}
|
||||
BAN_PERMA=§7Du bist §epermanent §e§lgebannt§8. §7Grund§8: §e{0}
|
||||
BAN_UNTIL=§7Du bist §ebis zum {0} §e§lgebannt§8. §7Grund§8: §e{1}
|
||||
UNBAN_ERROR=§cDer Spieler ist nicht gebannt.
|
||||
UNBAN=§7Du hast §e{0} §e§lentbannt.
|
||||
|
||||
MUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4}
|
||||
MUTE_PERMA=§7Du bist §epermanent §e§lgemuted§8. §7Grund§8: §e{0}
|
||||
MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1}
|
||||
UNMUTE_ERROR=§cDer Spieler ist nicht gemuted.
|
||||
UNMUTE=§7Du hast §e{0} §e§lentmuted.
|
||||
|
||||
NOSCHEMSHARING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicverteilen ausgeschlossen§8. §7Grund§8: §f{4}
|
||||
NOSCHEMSHARING_PERMA=§7Du bist §epermanent §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0}
|
||||
NOSCHEMSHARING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lVerteilen von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1}
|
||||
UNNOSCHEMSHARING_ERROR=§cDer Spieler ist nicht vom Verteilen von Schematics ausgeschlossen.
|
||||
UNNOSCHEMSHARING=§e{0} §7darf nun wieder §e§lSchematics verteilen§8.
|
||||
|
||||
NOSCHEMSUBMITTING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematiceinsenden ausgeschlossen§8. §7Grund§8: §f{4}
|
||||
NOSCHEMSUBMITTING_PERMA=§7Du bist §epermanent §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{0}
|
||||
NOSCHEMSUBMITTING_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lEinsenden von Schematics§7 ausgeschlossen§8. §7Grund§8: §e{1}
|
||||
UNNOSCHEMSUBMITTING_ERROR=§cDer Spieler ist nicht vom Einsenden von Schematics ausgeschlossen.
|
||||
UNNOSCHEMSUBMITTING=§e{0} §7darf nun wieder §e§lSchematis einsenden§8.
|
||||
|
||||
NODEVSERVER_TEAM={0} §e{1} §7hat §e{2} §7mit Grund §f{4}§7 zu generft und hat daher §e§lDevserververbot §7erhalten§8, §e{3}
|
||||
NODEVSERVER_PERMA=§7Du bist §epermanent §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{0}
|
||||
NODEVSERVER_UNTIL=§7Du bist §ebis zum {0} §7vom §e§lDevserver §7ausgeschlossen§8. §7Grund§8: §e{1}
|
||||
UNNODEVSERVER_ERROR=§cDer Spieler ist nicht vom Devserver ausgeschlossen.
|
||||
UNNODEVSERVER=§e{0} §7darf nun wieder dem §e§lDevserver beitreten§8.
|
@ -30,10 +30,10 @@ import java.util.*;
|
||||
|
||||
public class Punishment {
|
||||
|
||||
private static final Statement getPunishment = new Statement("SELECT * FROM Punishments WHERE UserId = ? AND Type = ? ORDER BY PunishmentId DESC LIMIT 1");
|
||||
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 insert = new Statement("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
private static final SQL.Statement getPunishment = new SQL.Statement("SELECT * FROM Punishments WHERE UserId = ? AND Type = ? ORDER BY PunishmentId DESC LIMIT 1");
|
||||
private static final SQL.Statement getPunishments = new SQL.Statement("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) FROM Punishments WHERE UserId = ? GROUP BY Type)");
|
||||
private static final SQL.Statement getAllPunishments = new SQL.Statement("SELECT * FROM Punishments WHERE UserId = ? ORDER BY `PunishmentId` DESC");
|
||||
private static final SQL.Statement insert = new SQL.Statement("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
|
||||
public static Punishment getPunishmentOfPlayer(int user, PunishmentType type) {
|
||||
return getPunishment.select(rs -> {
|
||||
|
@ -1,130 +0,0 @@
|
||||
package de.steamwar.sql;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Statement {
|
||||
|
||||
private static final List<Statement> statements = new ArrayList<>();
|
||||
|
||||
private static Connection con;
|
||||
private static String url;
|
||||
private static String user;
|
||||
private static String password;
|
||||
|
||||
public static void connect(String url, String user, String password) {
|
||||
Statement.url = url;
|
||||
Statement.user = user;
|
||||
Statement.password = password;
|
||||
try {
|
||||
con = DriverManager.getConnection(url + "?autoReconnect=true&useServerPrepStmts=true", user, password);
|
||||
} catch (SQLException e) {
|
||||
throw new SecurityException("Could not start SQL-Connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void reset() {
|
||||
close();
|
||||
connect(url, user, password);
|
||||
try {
|
||||
for (Statement statement : statements) {
|
||||
statement.init();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new SecurityException("Could not reprepare SQL statements", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void close() {
|
||||
synchronized (statements) {
|
||||
for (Statement statement : statements) {
|
||||
try {
|
||||
statement.st.close();
|
||||
} catch (SQLException e) {
|
||||
Core.getInstance().getLogger().log(Level.INFO, "Could not close statement", e);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
Core.getInstance().getLogger().log(Level.INFO, "Could not close SQL connection", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean connectionStable() {
|
||||
try {
|
||||
return !con.isClosed();
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private final String sql;
|
||||
private PreparedStatement st;
|
||||
|
||||
public Statement(String sql) {
|
||||
this.sql = sql;
|
||||
statements.add(this);
|
||||
try {
|
||||
init();
|
||||
} catch (SQLException e) {
|
||||
throw new SecurityException("Could not init SQL statement", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void init() throws SQLException {
|
||||
st = con.prepareStatement(sql);
|
||||
}
|
||||
|
||||
public <T> T select(ResultSetUser<T> user, Object... objects) {
|
||||
synchronized (statements) {
|
||||
return prepare(() -> {
|
||||
ResultSet rs = st.executeQuery();
|
||||
T result = user.use(rs);
|
||||
rs.close();
|
||||
return result;
|
||||
}, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Object... objects) {
|
||||
synchronized (statements) {
|
||||
prepare(st::executeUpdate, objects);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T prepare(SQLRunnable<T> runnable, Object... objects) {
|
||||
try {
|
||||
setObjects(objects);
|
||||
return runnable.run();
|
||||
} catch (SQLException e) {
|
||||
reset();
|
||||
throw new SecurityException("Could not execute SQL statement", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setObjects(Object... objects) throws SQLException {
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
st.setObject(i + 1, objects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ResultSetUser<T> {
|
||||
T use(ResultSet rs) throws SQLException;
|
||||
}
|
||||
|
||||
private interface SQLRunnable<T> {
|
||||
T run() throws SQLException;
|
||||
}
|
||||
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren