Removing Bauwelt
Dieser Commit ist enthalten in:
Ursprung
d1f2a195f3
Commit
1ad95dd80d
@ -1,7 +1,6 @@
|
|||||||
package de.steamwar.bungeecore;
|
package de.steamwar.bungeecore;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.commands.EventCommand;
|
import de.steamwar.bungeecore.commands.EventCommand;
|
||||||
import de.steamwar.bungeecore.sql.Bauwelt;
|
|
||||||
import de.steamwar.bungeecore.sql.EventFight;
|
import de.steamwar.bungeecore.sql.EventFight;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
@ -73,8 +72,6 @@ public class SubserverSystem {
|
|||||||
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
|
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
if(Bauwelt.getBauwelt(owner) == null)
|
|
||||||
new Bauwelt(owner, false, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(owner);
|
SteamwarUser user = SteamwarUser.get(owner);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package de.steamwar.bungeecore.commands;
|
package de.steamwar.bungeecore.commands;
|
||||||
|
|
||||||
import de.steamwar.bungeecore.*;
|
import de.steamwar.bungeecore.*;
|
||||||
import de.steamwar.bungeecore.sql.Bauwelt;
|
|
||||||
import de.steamwar.bungeecore.sql.BauweltMember;
|
import de.steamwar.bungeecore.sql.BauweltMember;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
@ -72,10 +71,7 @@ public class BauCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addmember(ProxiedPlayer p, String[] command){
|
private static void addmember(ProxiedPlayer p, String[] command){
|
||||||
if (Bauwelt.getBauwelt(p.getUniqueId()) == null){
|
if (command.length == 2) {
|
||||||
BungeeCore.send(p,BungeeCore.CHAT_PREFIX + "§cDu hast keine Bauwelt");
|
|
||||||
return;
|
|
||||||
}else if (command.length == 2) {
|
|
||||||
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau addmember <Spieler>");
|
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau addmember <Spieler>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
package de.steamwar.bungeecore.sql;
|
|
||||||
|
|
||||||
|
|
||||||
import de.steamwar.bungeecore.BungeeCore;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Bauwelt {
|
|
||||||
|
|
||||||
private final int userID;
|
|
||||||
private boolean tntDmg;
|
|
||||||
private boolean fireDmg;
|
|
||||||
|
|
||||||
private Bauwelt(int userID, boolean tntDmg, boolean fireDmg, boolean updateDB){
|
|
||||||
this.userID = userID;
|
|
||||||
this.tntDmg = tntDmg;
|
|
||||||
this.fireDmg = fireDmg;
|
|
||||||
if(updateDB)
|
|
||||||
updateDB();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bauwelt(int userID, boolean tntDmg, boolean fireDmg){
|
|
||||||
this(userID, tntDmg, fireDmg, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bauwelt(UUID userID, boolean tntDmg, boolean fireDmg){
|
|
||||||
this(SteamwarUser.get(userID).getId(), tntDmg, fireDmg);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDB(){
|
|
||||||
SQL.update("INSERT INTO Bauwelt" +
|
|
||||||
" (UserID, TNTDmg, FireDmg)" +
|
|
||||||
" VALUES" +
|
|
||||||
" ('" + userID + "', '" + SQL.booleanToInt(tntDmg) + "', '" + SQL.booleanToInt(fireDmg) + "')" +
|
|
||||||
" ON DUPLICATE KEY UPDATE" +
|
|
||||||
" TNTDmg = VALUES(TNTDmg), FireDmg = VALUES(FireDmg)");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Bauwelt getBauwelt(UUID user){
|
|
||||||
return getBauwelt(SteamwarUser.get(user).getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Bauwelt getBauwelt(int userId){
|
|
||||||
ResultSet bauwelt = SQL.select("SELECT * FROM Bauwelt WHERE UserID = '" + userId + "'");
|
|
||||||
try {
|
|
||||||
if(bauwelt == null || !bauwelt.next()){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean tntDmg = bauwelt.getBoolean("TNTDmg");
|
|
||||||
boolean fireDmg = bauwelt.getBoolean("FireDmg");
|
|
||||||
return new Bauwelt(userId, tntDmg, fireDmg, false);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
BungeeCore.log("Could not get Bauwelt", e);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getUserID() {
|
|
||||||
return userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUUID(){
|
|
||||||
return SteamwarUser.get(userID).getUuid();
|
|
||||||
}
|
|
||||||
}
|
|
In neuem Issue referenzieren
Einen Benutzer sperren