SteamWar/BungeeCore
Archiviert
13
2

Adding TS3-Verifier

Dieser Commit ist enthalten in:
Lixfel 2020-01-18 08:13:48 +01:00
Ursprung 0ee13b11fe
Commit 3671d1d38c
39 geänderte Dateien mit 608 neuen und 314 gelöschten Zeilen

Datei anzeigen

@ -10,9 +10,9 @@ public class ArenaMode {
private static Map<String, ArenaMode> byInternal = new HashMap<>();
private static Random random = new Random();
static void init(Configuration config){
for(String internalName : config.getKeys()){
new ArenaMode(internalName, config.getSection(internalName));
static void init(){
for(String internalName : Config.GAMES.getKeys()){
new ArenaMode(internalName, Config.GAMES.getSection(internalName));
}
}

Datei anzeigen

@ -6,21 +6,16 @@ import java.util.concurrent.TimeUnit;
class Broadcaster {
private static String [] broadCastMsgs;
private int lastBroadCast = 0;
Broadcaster(){
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
if(!ProxyServer.getInstance().getPlayers().isEmpty())
BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + broadCastMsgs[lastBroadCast]);
BungeeCore.broadcast(Config.CHAT_PREFIX + Config.BROADCASTS[lastBroadCast]);
lastBroadCast++;
if(lastBroadCast == broadCastMsgs.length){
if(lastBroadCast == Config.BROADCASTS.length){
lastBroadCast = 0;
}
}, 10, 10, TimeUnit.MINUTES);
}
static void setBroadCastMsgs(String[] broadCastMsgs) {
Broadcaster.broadCastMsgs = broadCastMsgs;
}
}

Datei anzeigen

@ -7,6 +7,7 @@ import de.steamwar.bungeecore.listeners.mods.LabyMod;
import de.steamwar.bungeecore.sql.SQL;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team;
import de.steamwar.bungeecore.ts3.TS3Handler;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -17,12 +18,7 @@ import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -31,17 +27,6 @@ import java.util.logging.Level;
public class BungeeCore extends Plugin {
public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e";
public static final String TEAMCHAT_PREFIX = "§8TC §e";
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy");
public static String CHAT_PREFIX;
public static String WORLD_FOLDER;
public static String BAUWELT_PROTOTYP;
public static String LOBBY_SERVER;
public static String USERWORLDS15;
public static String BAUWELT15;
private static BungeeCore instance;
public static final Map<String, String> serverPermissions = new HashMap<>();
@ -50,7 +35,9 @@ public class BungeeCore extends Plugin {
@Override
public void onEnable(){
setInstance(this);
loadConfig();
Persistent.setChatPrefix(Config.CHAT_PREFIX);
Persistent.setLobbyServer(Config.LOBBY_SERVER);
SQL.connect();
new ConnectionListener();
new Forge();
@ -58,6 +45,13 @@ public class BungeeCore extends Plugin {
new ChatListener();
new BanListener();
new EventStarter();
new Broadcaster();
new SessionManager();
new TS3Handler();
PollSystem.init();
ArenaMode.init();
commands.put("/b", null);
commands.put("/gs", null);
commands.put("/bau", null);
@ -88,19 +82,30 @@ public class BungeeCore extends Plugin {
new EventRescheduleCommand();
new PollCommand();
new MuteCommand();
new EventStarter();
new Broadcaster();
new SessionManager();
new TSVerifyCommand();
getProxy().getScheduler().schedule(this, () -> {
SteamwarUser.clearCache();
Team.clearCache();
}, 1, 1, TimeUnit.HOURS);
for(final String serverName : Config.SERVERS.getKeys()){
final Configuration server = Config.SERVERS.getSection(serverName);
List<String> cmds = server.getStringList("commands");
BungeeCore.serverPermissions.put(serverName, "bungeecore.server." + server.getString("permission"));
String cmd = cmds.remove(0);
new ServerSwitchCommand(
cmd,
serverName,
BungeeCore.serverPermissions.get(serverName),
cmds.toArray(new String[0])
);
}
}
@Override
public void onDisable(){
TS3Handler.close();
SQL.close();
}
@ -159,62 +164,6 @@ public class BungeeCore extends Plugin {
get().getLogger().log(Level.SEVERE, msg, e);
}
private static void loadConfig(){
Configuration config;
try{
if(!get().getDataFolder().exists() && !get().getDataFolder().mkdir())
throw new IOException();
File configFile = new File(get().getDataFolder().getPath(), "config.yml");
if(!configFile.exists()){
boolean created = configFile.createNewFile();
if(created)
ProxyServer.getInstance().stop("Config file not initialized");
else
ProxyServer.getInstance().stop("Could not save conig file");
return;
}
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
}catch(IOException e){
log("Could not save/load config.yml", e);
ProxyServer.getInstance().stop();
return;
}
CHAT_PREFIX = config.getString("prefix");
WORLD_FOLDER = config.getString("worldfolder");
BAUWELT_PROTOTYP = config.getString("bauweltprototyp");
LOBBY_SERVER = config.getString("lobbyserver");
USERWORLDS15 = config.getString("userworlds15");
BAUWELT15 = config.getString("bauwelt15");
Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1]));
PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers"));
Persistent.setChatPrefix(CHAT_PREFIX);
Persistent.setLobbyServer(LOBBY_SERVER);
SQL.connect(
config.getString("db.url"),
config.getString("db.weburl"),
config.getString("db.username"),
config.getString("db.password")
);
ArenaMode.init(config.getSection("games"));
final Configuration servers = config.getSection("servers");
for(final String serverName : servers.getKeys()){
final Configuration server = servers.getSection(serverName);
List<String> cmds = server.getStringList("commands");
serverPermissions.put(serverName, "bungeecore.server." + server.getString("permission"));
String cmd = cmds.remove(0);
new ServerSwitchCommand(
cmd,
serverName,
serverPermissions.get(serverName),
cmds.toArray(new String[0])
);
}
}
private static void setInstance(BungeeCore core){
instance = core;
}

Datei anzeigen

@ -0,0 +1,88 @@
package de.steamwar.bungeecore;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.util.List;
public class Config {
private Config(){}
public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e";
public static final String TEAMCHAT_PREFIX = "§8TC §e";
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy");
public static final String CHAT_PREFIX;
public static final String WORLD_FOLDER;
public static final String BAUWELT_PROTOTYP;
public static final String LOBBY_SERVER;
public static final String USERWORLDS15;
public static final String BAUWELT15;
public static final String[] BROADCASTS;
public static final String POLL_QUESTION;
public static final List<String> POLL_ANSWERS;
public static final String TS3_QUERY_USER;
public static final String TS3_QUERY_PASSWORD;
public static final String TS3_QUERY_NICKNAME;
public static final int TS3_QUERY_SERVERID;
public static final int TS3_QUERY_GROUPID;
public static final String DB_URL;
public static final String DB_WEBURL;
public static final String DB_USERNAME;
public static final String DB_PASSWORD;
public static final Configuration GAMES;
public static final Configuration SERVERS;
static {
Configuration config;
try{
if(!BungeeCore.get().getDataFolder().exists() && !BungeeCore.get().getDataFolder().mkdir())
throw new SecurityException();
File configFile = new File(BungeeCore.get().getDataFolder().getPath(), "config.yml");
if(!configFile.exists()){
configFile.createNewFile();
ProxyServer.getInstance().stop("Config file not initialized");
throw new SecurityException("Config file not initialized");
}
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
}catch(IOException e){
BungeeCore.log("Could not save/load config.yml", e);
ProxyServer.getInstance().stop();
throw new SecurityException();
}
CHAT_PREFIX = config.getString("prefix");
WORLD_FOLDER = config.getString("worldfolder");
BAUWELT_PROTOTYP = config.getString("bauweltprototyp");
LOBBY_SERVER = config.getString("lobbyserver");
USERWORLDS15 = config.getString("userworlds15");
BAUWELT15 = config.getString("bauwelt15");
BROADCASTS = config.getStringList("broadcasts").toArray(new String[1]);
POLL_QUESTION = config.getString("poll.question");
POLL_ANSWERS = config.getStringList("poll.answers");
TS3_QUERY_USER = config.getString("ts3query.user");
TS3_QUERY_PASSWORD = config.getString("ts3query.password");
TS3_QUERY_NICKNAME = config.getString("ts3query.nickname");
TS3_QUERY_SERVERID = config.getInt("ts3query.serverid");
TS3_QUERY_GROUPID = config.getInt("ts3query.groupid");
DB_URL = config.getString("db.url");
DB_WEBURL = config.getString("db.weburl");
DB_USERNAME = config.getString("db.username");
DB_PASSWORD = config.getString("db.password");
GAMES = config.getSection("games");
SERVERS = config.getSection("servers");
}
}

Datei anzeigen

@ -50,7 +50,7 @@ public class EventStarter implements Runnable {
eventServer.put(blue, subserver);
eventServer.put(red, subserver);
BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7Hier §eklicken §7für den Kampf §e" + blue.getTeamName() + " §8vs §e" + red.getTeamName(),
BungeeCore.broadcast(Config.CHAT_PREFIX + "§7Hier §eklicken §7für den Kampf §e" + blue.getTeamName() + " §8vs §e" + red.getTeamName(),
"§eEvent beitreten",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()));
}

Datei anzeigen

@ -25,7 +25,7 @@ public class SubserverSystem {
if(o == null)
return;
BungeeCore.send(o, BungeeCore.CHAT_PREFIX + "§e" + p.getName() + " §7möchte auf deine Bauwelt.");
BungeeCore.send(o, Config.CHAT_PREFIX + "§e" + p.getName() + " §7möchte auf deine Bauwelt.");
BungeeCore.send(o, "§7Klicke §ehier§7, wenn du das erlauben möchtest.",
"§e/bau addmember " + p.getName(),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau addmember " + p.getName()));
@ -158,7 +158,7 @@ public class SubserverSystem {
return;
SteamwarUser user = SteamwarUser.get(owner);
copyBauwelt(p, BungeeCore.BAUWELT_PROTOTYP, BungeeCore.WORLD_FOLDER + owner.toString());
copyBauwelt(p, Config.BAUWELT_PROTOTYP, Config.WORLD_FOLDER + owner.toString());
int port = freePort(4000);
//Generate launch command
@ -189,7 +189,7 @@ public class SubserverSystem {
return;
SteamwarUser user = SteamwarUser.get(owner);
copyBauwelt(p, BungeeCore.BAUWELT15, BungeeCore.USERWORLDS15 + user.getId());
copyBauwelt(p, Config.BAUWELT15, Config.USERWORLDS15 + user.getId());
int port = freePort(4000);
//Generate launch command
@ -235,11 +235,11 @@ public class SubserverSystem {
pr = pb.start();
pr.waitFor();
} catch (IOException e) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
throw new SecurityException("Could not create Bauwelt", e);
} catch (InterruptedException e){
BungeeCore.log("Could not create Bauwelt", e);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
Thread.currentThread().interrupt();
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
@ -13,12 +14,12 @@ public class AlertCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length == 0){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/alert [Nachricht]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "/alert [Nachricht]");
return;
}
StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append(BungeeCore.CHAT_PREFIX);
msgBuilder.append(Config.CHAT_PREFIX);
for (String arg : args){
msgBuilder.append(arg).append(" ");
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
@ -19,7 +20,7 @@ public class BanCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 3){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder perma] [Grund]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder perma] [Grund]");
return;
}
@ -36,7 +37,7 @@ public class BanCommand extends BasicCommand {
banReason.append(args[i]).append(" ");
}
String msg = banReason.toString();
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg);
BungeeCore.send(sender, Config.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg);
target.ban(banTime, msg);
}
@ -49,7 +50,7 @@ public class BanCommand extends BasicCommand {
Date parsedDate = dateFormat.parse(arg);
return new java.sql.Timestamp(parsedDate.getTime());
}catch(ParseException e){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUngültige Zeitangabe.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cUngültige Zeitangabe.");
return null;
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -36,7 +37,7 @@ abstract class BasicCommand extends Command implements TabExecutor {
protected SteamwarUser user(CommandSender sender, String arg){
SteamwarUser target = SteamwarUser.get(arg);
if(target == null)
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDer Spieler existiert nicht.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cDer Spieler existiert nicht.");
return target;
}
}

Datei anzeigen

@ -13,7 +13,7 @@ public class BauCommand {
private BauCommand(){}
private static final String UNKNOWN_PLAYER = BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler";
private static final String UNKNOWN_PLAYER = Config.CHAT_PREFIX + "§cUnbekannter Spieler";
public static void onBau(ChatEvent e, String[] command){
ProxiedPlayer p = (ProxiedPlayer) e.getSender();
@ -75,7 +75,7 @@ public class BauCommand {
private static void addmember(ProxiedPlayer p, String[] command){
if (command.length == 2) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau addmember <Spieler>");
BungeeCore.send(p, Config.CHAT_PREFIX + "/bau addmember <Spieler>");
return;
}
@ -84,21 +84,21 @@ public class BauCommand {
BungeeCore.send(p, UNKNOWN_PLAYER);
return;
}else if (BauweltMember.getBauMember(p.getUniqueId(), target.getUuid()) != null) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist bereits Mitglied auf deiner Welt");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDieser Spieler ist bereits Mitglied auf deiner Welt");
return;
}
new BauweltMember(p.getUniqueId(), target.getUuid(), true, false, false);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt");
BungeeCore.send(p, Config.CHAT_PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt");
ProxiedPlayer z = ProxyServer.getInstance().getPlayer(target.getUuid());
if(z != null)
BungeeCore.send(z, BungeeCore.CHAT_PREFIX + "§aDu wurdest zu der Welt von §6" + p.getName() + " §ahinzugefügt");
BungeeCore.send(z, Config.CHAT_PREFIX + "§aDu wurdest zu der Welt von §6" + p.getName() + " §ahinzugefügt");
}
private static void teleport(ProxiedPlayer p, String[] command){
if (command.length == 2) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau tp <Spieler>");
BungeeCore.send(p, Config.CHAT_PREFIX + "/bau tp <Spieler>");
return;
}
@ -108,7 +108,7 @@ public class BauCommand {
return;
}else if (!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null){
SubserverSystem.sendDeniedMessage(p, worldOwner.getUuid());
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu darfst dich nicht auf diese Welt teleportieren");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDu darfst dich nicht auf diese Welt teleportieren");
return;
}
SubserverSystem.sendToBauServer(p, worldOwner.getUuid());
@ -143,7 +143,7 @@ public class BauCommand {
private static void delmember(ProxiedPlayer p, String[] command){
if (command.length == 2) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau delmember <Spieler>");
BungeeCore.send(p, Config.CHAT_PREFIX + "/bau delmember <Spieler>");
return;
}
@ -154,16 +154,16 @@ public class BauCommand {
target.remove();
ProxiedPlayer z = ProxyServer.getInstance().getPlayer(SteamwarUser.get(target.getMemberID()).getUuid());
if(z != null){
BungeeCore.send(z, BungeeCore.CHAT_PREFIX + "§cDu wurdest von der Welt von §6" + p.getName() + " §centfernt.");
BungeeCore.send(z, Config.CHAT_PREFIX + "§cDu wurdest von der Welt von §6" + p.getName() + " §centfernt.");
Subserver server = Subserver.getSubserver(z);
if(server != null && server.getType() == Servertype.BAUSERVER && ((Bauserver)server).getOwner().equals(p.getUniqueId()))
z.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LOBBY_SERVER));
z.connect(ProxyServer.getInstance().getServerInfo(Config.LOBBY_SERVER));
}
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Spieler wurde entfernt.");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDer Spieler wurde entfernt.");
}
private static void delete(ProxiedPlayer p){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt.");
BungeeCore.send(p, Config.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt.");
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
for (Subserver subserver : Subserver.getServerList()) {
if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) {
@ -171,20 +171,20 @@ public class BauCommand {
break;
}
}
File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString());
File directory = new File(Config.WORLD_FOLDER + p.getUniqueId().toString());
del(directory);
});
}
private static void testarena(ProxiedPlayer p, String[] command){
if (command.length == 2) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau testarena <Spielmodus>");
BungeeCore.send(p, Config.CHAT_PREFIX + "/bau testarena <Spielmodus>");
return;
}
ArenaMode mode = ArenaMode.getByChat(command[2]);
if(mode == null){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + command[2]);
BungeeCore.send(p, Config.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + command[2]);
return;
}
@ -207,7 +207,7 @@ public class BauCommand {
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), member.getUuid());
if (target == null) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt!");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt!");
return null;
}
return target;
@ -215,7 +215,7 @@ public class BauCommand {
private static BauweltMember toggle(ProxiedPlayer p, String[] command, String subcommand){
if (command.length == 2) {
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau " + subcommand + " <Spieler>");
BungeeCore.send(p, Config.CHAT_PREFIX + "/bau " + subcommand + " <Spieler>");
return null;
}
@ -228,12 +228,12 @@ public class BauCommand {
if(permission){
if(player != null)
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDu kannst nun auf der Welt von §e" + player.getName() + "§a " + what);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDer Spieler darf nun " + what);
BungeeCore.send(player, Config.CHAT_PREFIX + "§aDu kannst nun auf der Welt von §e" + player.getName() + "§a " + what);
BungeeCore.send(p, Config.CHAT_PREFIX + "§aDer Spieler darf nun " + what);
}else{
if(player != null)
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §e" + player.getName() + "§c " + what);
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Spieler darf nun nicht mehr " + what);
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §e" + player.getName() + "§c " + what);
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDer Spieler darf nun nicht mehr " + what);
}
}

Datei anzeigen

@ -19,7 +19,7 @@ public class ChallengeCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length != 2){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§echallenge §8[§7Spieler§8] §8[§7Spielmodus§8]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§echallenge §8[§7Spieler§8] §8[§7Spielmodus§8]");
return;
}
if(!(sender instanceof ProxiedPlayer)){
@ -30,25 +30,25 @@ public class ChallengeCommand extends BasicCommand {
Subserver subserver = Subserver.getSubserver(player);
if(subserver != null && subserver.getType() == Servertype.ARENA){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu befindest dich bereits in einer Arena.");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu befindest dich bereits in einer Arena.");
return;
}
ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]);
if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDer gewünschte Spieler ist nicht online.");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDer gewünschte Spieler ist nicht online.");
return;
}
subserver = Subserver.getSubserver(target);
if(subserver != null && subserver.getType() == Servertype.ARENA){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDer Herausgeforderte ist bereits in einer Arena.");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDer Herausgeforderte ist bereits in einer Arena.");
return;
}
ArenaMode mode = ArenaMode.getByChat(args[1]);
if(mode == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + args[1]);
BungeeCore.send(player, Config.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + args[1]);
return;
}
@ -63,7 +63,7 @@ public class ChallengeCommand extends BasicCommand {
arena.sendPlayer(player);
arena.sendPlayer(target);
BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§e" + mode.getDisplayName() + "§7-§eDuell§7: " + player.getName() + " vs " + target.getName(),
BungeeCore.broadcast(Config.CHAT_PREFIX + "§e" + mode.getDisplayName() + "§7-§eDuell§7: " + player.getName() + " vs " + target.getName(),
"§aZuschauen",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()));
}else{
@ -73,10 +73,10 @@ public class ChallengeCommand extends BasicCommand {
challenges.get(player).add(target);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast §e" + target.getName() + " §7zu einem §e" + mode.getDisplayName() + "-Kampf §7herausgefordert!");
BungeeCore.send(target, BungeeCore.CHAT_PREFIX + "§e" + player.getName() + " §7 hat dich zu einem §e" + mode.getDisplayName() + "-Kampf §7herausgefordert!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast §e" + target.getName() + " §7zu einem §e" + mode.getDisplayName() + "-Kampf §7herausgefordert!");
BungeeCore.send(target, Config.CHAT_PREFIX + "§e" + player.getName() + " §7 hat dich zu einem §e" + mode.getDisplayName() + "-Kampf §7herausgefordert!");
BungeeCore.send(target, BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um die Herausforderung anzunehmen",
BungeeCore.send(target, Config.CHAT_PREFIX + "§7Klicke §ehier§7, um die Herausforderung anzunehmen",
"§aHerausforderung annehmen",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge " + player.getName() + " " + mode.getChatName()));
}

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -15,7 +15,7 @@ public class DenyCommand extends BasicCommand {
public void execute(CommandSender sender, String[] args) {
if(sender instanceof ProxiedPlayer){
ProxiedPlayer player = (ProxiedPlayer) sender;
player.sendMessage(new TextComponent(BungeeCore.CHAT_PREFIX + "§cUnbekannter Befehl."));
player.sendMessage(new TextComponent(Config.CHAT_PREFIX + "§cUnbekannter Befehl."));
}
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.EventStarter;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.sql.Event;
@ -45,13 +46,13 @@ public class EventCommand extends BasicCommand {
Team team = Team.get(args[0]);
if(team == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Team gibt es nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieses Team gibt es nicht");
return;
}
Subserver eventArena = EventStarter.getEventServer().get(team);
if(eventArena == null || !Subserver.getServerList().contains(eventArena)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas Team kämpft derzeit nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDas Team kämpft derzeit nicht");
return;
}
@ -59,10 +60,10 @@ public class EventCommand extends BasicCommand {
}
private void noCurrentEvent(ProxiedPlayer player){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDerzeit findet kein Event statt");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDerzeit findet kein Event statt");
List<Event> coming = Event.getComing();
if(!coming.isEmpty()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§eKommende Events§8:");
BungeeCore.send(player, Config.CHAT_PREFIX + "§eKommende Events§8:");
for(Event e : coming){
BungeeCore.send(player, "§7" +
e.getStart().toLocalDateTime().format(DATE_FORMAT) +
@ -83,7 +84,7 @@ public class EventCommand extends BasicCommand {
}
private void eventOverview(ProxiedPlayer player, Event currentEvent){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren");
List<EventFight> fights = EventFight.getEvent(currentEvent.getEventID());
Instant now = Instant.now();

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.Event;
import de.steamwar.bungeecore.sql.EventFight;
import de.steamwar.bungeecore.sql.Team;
@ -25,7 +26,7 @@ public class EventRescheduleCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c/eventreschedule [Team1 (Blue)] [Team2 (Red)]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§c/eventreschedule [Team1 (Blue)] [Team2 (Red)]");
return;
}
@ -33,7 +34,7 @@ public class EventRescheduleCommand extends BasicCommand {
Team teamRed = Team.get(args[1]);
Event event = Event.get();
if(teamBlue == null || teamRed == null || event == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Team ist unbekannt / Derzeit kein Event");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cEin Team ist unbekannt / Derzeit kein Event");
return;
}
@ -46,13 +47,13 @@ public class EventRescheduleCommand extends BasicCommand {
continue;
if(fight.getTeamBlue() == teamBlue.getTeamId() && fight.getTeamRed() == teamRed.getTeamId()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aKampf startet in 30s");
BungeeCore.send(player, Config.CHAT_PREFIX + "§aKampf startet in 30s");
fight.reschedule();
EventFight.loadAllComingFights();
return;
}
}
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cKein Kampf zwischen den Teams gefunden");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cKein Kampf zwischen den Teams gefunden");
}
}

Datei anzeigen

@ -22,7 +22,7 @@ public class FightCommand extends BasicCommand {
String realMap = mode.hasMap(args[1].toLowerCase());
if(realMap != null)
return realMap;
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDie gewünschte Arena gibt es nicht.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cDie gewünschte Arena gibt es nicht.");
return null;
}else{
return mode.getRandomMap();
@ -32,12 +32,12 @@ public class FightCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length != 1 && args.length != 2){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§7Mit §e/fight §7kannst du einen neuen Kampf starten!");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§efight §8[§7Spielmodus§8] <§7Arena§8>");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§efight AirShip §8- §7Starte einen §eAirShip§8-§7Kampf§8!");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§efight WarShip §8- §7Starte einen §eWarShip§8-§7Kampf§8!");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§efight WarGear §8- §7Starte einen §eWarGear§8-§7Kampf§8!");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§efight MiniWarGear §8- §7Starte einen §eMiniWarGear§8-§7Kampf");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§7Mit §e/fight §7kannst du einen neuen Kampf starten!");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§efight §8[§7Spielmodus§8] <§7Arena§8>");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§efight AirShip §8- §7Starte einen §eAirShip§8-§7Kampf§8!");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§efight WarShip §8- §7Starte einen §eWarShip§8-§7Kampf§8!");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§efight WarGear §8- §7Starte einen §eWarGear§8-§7Kampf§8!");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§efight MiniWarGear §8- §7Starte einen §eMiniWarGear§8-§7Kampf");
return;
}
@ -46,14 +46,14 @@ public class FightCommand extends BasicCommand {
Subserver subserver = Subserver.getSubserver(player);
if(subserver != null && subserver.getType() == Servertype.ARENA){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDu befindest dich bereits in einer Arena.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cDu befindest dich bereits in einer Arena.");
return;
}
ArenaMode mode = ArenaMode.getByChat(args[0]);
if(mode == null){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + args[0]);
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + args[0]);
return;
}
@ -63,7 +63,7 @@ public class FightCommand extends BasicCommand {
Subserver arena = SubserverSystem.startArena(mode, map, 0, null, null, player.getUniqueId(), null);
arena.sendPlayer(player);
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + mode.getDisplayName() + " §7gegen §e" + player.getName() + " §7zu §7kämpfen!");
TextComponent tc = new TextComponent(Config.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + mode.getDisplayName() + " §7gegen §e" + player.getName() + " §7zu §7kämpfen!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aGegen §7" + player.getName() + " §ekämpfen").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()));
ProxyServer.getInstance().broadcast(tc);

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -16,42 +16,42 @@ public class HelpCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length != 1){
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Kehre von überall mit §8/§el §7zur Lobby zurück!");
TextComponent tc = new TextComponent(Config.CHAT_PREFIX + "§7Kehre von überall mit §8/§el §7zur Lobby zurück!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZurück zur Lobby").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Komme mit §8/§ebau §7auf den Bauserver!");
tc = new TextComponent(Config.CHAT_PREFIX + "§7Komme mit §8/§ebau §7auf den Bauserver!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZum Bauserver").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bauserver"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Erhalte mit §8/§ehelp bauserver §7Hilfe zum Bauserver!");
tc = new TextComponent(Config.CHAT_PREFIX + "§7Erhalte mit §8/§ehelp bauserver §7Hilfe zum Bauserver!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eHilfe zum Bauserver").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bauserver"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Starte mit §8/§efight §7einen neuen Kampf!");
tc = new TextComponent(Config.CHAT_PREFIX + "§7Starte mit §8/§efight §7einen neuen Kampf!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZum Kampfsystem").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/fight"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Tippe §8/§echallenge§7, um jemanden herauszufordern!");
tc = new TextComponent(Config.CHAT_PREFIX + "§7Tippe §8/§echallenge§7, um jemanden herauszufordern!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eHerausfordern").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§8/§eteam§7 für das Teamsystem!");
tc = new TextComponent(Config.CHAT_PREFIX + "§8/§eteam§7 für das Teamsystem!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eTeamverwaltung").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei!");
tc = new TextComponent(Config.CHAT_PREFIX + "§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eSpieler beitreten").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/join"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server!");
tc = new TextComponent(Config.CHAT_PREFIX + "§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eLokaler Chat").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/local"));
sender.sendMessage(tc);

Datei anzeigen

@ -27,17 +27,17 @@ public class JoinmeCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender;
if (args.length == 0 && player.hasPermission("bungeecore.joinme")) {
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8!");
TextComponent tc = new TextComponent(Config.CHAT_PREFIX + "§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aSpieler folgen").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()));
ProxyServer.getInstance().broadcast(tc);
} else if (args.length == 1) {
ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]);
if(target == null || !target.isConnected()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist offline.");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler ist offline.");
return;
}else if(target.equals(player)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cSei eins mit dir selbst!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cSei eins mit dir selbst!");
return;
}
ServerInfo server = target.getServer().getInfo();
@ -55,18 +55,18 @@ public class JoinmeCommand extends BasicCommand {
subserver.sendPlayer(player);
} else {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE);
BungeeCore.send(player, Config.CHAT_PREFIX + DENY_MESSAGE);
}
}
}else if(serverPerm != null && !player.hasPermission(serverPerm)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE);
BungeeCore.send(player, Config.CHAT_PREFIX + DENY_MESSAGE);
}else if(serverPerm == null && !player.getGroups().contains("team")) {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE);
BungeeCore.send(player, Config.CHAT_PREFIX + DENY_MESSAGE);
}else{
player.connect(server);
}
} else {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7.");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7.");
}
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -16,27 +17,27 @@ public class KickCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length == 0){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/kick [Spieler] [Nachricht]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "/kick [Spieler] [Nachricht]");
return;
}
ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]);
if(target == null){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!");
return;
}
if(args.length == 1){
target.disconnect(BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu wurdest gekickt."));
target.disconnect(BungeeCore.stringToText(Config.CHAT_PREFIX + "§cDu wurdest gekickt."));
}else{
StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append(BungeeCore.CHAT_PREFIX).append("§c");
msgBuilder.append(Config.CHAT_PREFIX).append("§c");
for (int i = 1; i < args.length; i++){
msgBuilder.append(args[i]).append(" ");
}
target.disconnect(BungeeCore.stringToText(msgBuilder.toString()));
}
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Der Spieler " + target.getName() + " wurde gekickt.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "Der Spieler " + target.getName() + " wurde gekickt.");
}
@Override

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -23,7 +24,7 @@ public class MsgCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender;
if (args.length < 2) {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "/msg [Benutzer] [Nachricht]");
BungeeCore.send(player, Config.CHAT_PREFIX + "/msg [Benutzer] [Nachricht]");
return;
}
@ -35,13 +36,13 @@ public class MsgCommand extends BasicCommand {
ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]);
if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!");
return;
}else if(target.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler empfängt derzeit keine Chatnachrichten!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler empfängt derzeit keine Chatnachrichten!");
return;
}else if(target.equals(player)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cNachrichten an dich selbst hast du wirklich nicht nötig!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cNachrichten an dich selbst hast du wirklich nicht nötig!");
return;
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
@ -15,7 +16,7 @@ public class MuteCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 3){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder perma] [Grund]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder perma] [Grund]");
return;
}
@ -32,7 +33,7 @@ public class MuteCommand extends BasicCommand {
muteReason.append(args[i]).append(" ");
}
String msg = muteReason.toString();
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg);
BungeeCore.send(sender, Config.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg);
target.mute(muteTime, msg);
}
}

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -14,7 +14,7 @@ public class PingCommand extends BasicCommand {
public void execute(CommandSender sender, String[] args) {
if(sender instanceof ProxiedPlayer){
ProxiedPlayer player = (ProxiedPlayer) sender;
player.sendMessage(BungeeCore.CHAT_PREFIX + "§7Dein Ping beträgt §c" + player.getPing() + "§r§7 ms!");
player.sendMessage(Config.CHAT_PREFIX + "§7Dein Ping beträgt §c" + player.getPing() + "§r§7 ms!");
}
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.listeners.PollSystem;
import de.steamwar.bungeecore.sql.PollAnswer;
import de.steamwar.bungeecore.sql.SteamwarUser;
@ -33,18 +34,18 @@ public class PollCommand extends BasicCommand {
int answer;
try {
answer = Integer.parseUnsignedInt(args[0]);
if(answer < 1 || answer > PollSystem.answers())
if(answer < 1 || answer > Config.POLL_ANSWERS.size())
throw new NumberFormatException();
}catch(NumberFormatException e){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas ist keine Antwortmöglichkeit!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDas ist keine Antwortmöglichkeit!");
return;
}
PollAnswer pollAnswer = PollAnswer.get(SteamwarUser.get(player.getUniqueId()).getId());
if(pollAnswer.hasAnswered())
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDeine Antwort wurde aktualisiert");
BungeeCore.send(player, Config.CHAT_PREFIX + "§aDeine Antwort wurde aktualisiert");
else
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDeine Antwort wurde registriert");
BungeeCore.send(player, Config.CHAT_PREFIX + "§aDeine Antwort wurde registriert");
pollAnswer.setAnswer(answer);
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -16,7 +17,7 @@ public class RCommand extends BasicCommand {
if(sender instanceof ProxiedPlayer){
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length == 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "/r [Antwort]");
BungeeCore.send(player, Config.CHAT_PREFIX + "/r [Antwort]");
return;
}
@ -28,15 +29,15 @@ public class RCommand extends BasicCommand {
ProxiedPlayer target = MsgCommand.lastChats.get(player.getName().toLowerCase());
if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu hast bisher mit niemandem geschrieben!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu hast bisher mit niemandem geschrieben!");
return;
}
if(!target.isConnected()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!");
return;
}else if(target.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler empfängt derzeit keine Chatnachrichten!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler empfängt derzeit keine Chatnachrichten!");
return;
}

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -18,12 +18,12 @@ public class ServerTeamchatCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length == 0){
player.sendMessage(BungeeCore.CHAT_PREFIX + "/stc [Nachricht an das Team]");
player.sendMessage(Config.CHAT_PREFIX + "/stc [Nachricht an das Team]");
return;
}
StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append(BungeeCore.SERVER_TEAMCHAT_PREFIX).append(sender.getName()).append("» §r");
msgBuilder.append(Config.SERVER_TEAMCHAT_PREFIX).append(sender.getName()).append("» §r");
for (String arg : args){
msgBuilder.append(arg).append(" ");
}

Datei anzeigen

@ -0,0 +1,58 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.TS3;
import de.steamwar.bungeecore.ts3.TS3Handler;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class TSVerifyCommand extends BasicCommand {
public TSVerifyCommand() {
super("tsverify", null);
}
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length == 0){
help(player);
return;
}
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
switch(args[0].toLowerCase()){
case "accept":
String ts3Id = TS3Handler.getToVerify().get(user.getId());
if(ts3Id == null){
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu hast keine Verknüpfungsanfrage erhalten");
return;
}
TS3Handler.createConnection(player, user, ts3Id);
break;
case "deny":
TS3Handler.getToVerify().remove(user.getId());
BungeeCore.send(player, Config.CHAT_PREFIX + "§cTeamspeak-Verknüpfung abgelehnt");
break;
case "free":
TS3 connection = TS3.get(user.getId());
if(connection != null)
connection.free();
BungeeCore.send(player, Config.CHAT_PREFIX + "§aDeine Teamspeak-Verknüpfung wurde aufgehoben");
break;
default:
help(player);
}
}
private void help(ProxiedPlayer player){
BungeeCore.send(player, "§8/§etsverify accept §8- §7Verbindet deinen Minecraft-Account mit deinem TS3-Account");
BungeeCore.send(player, "§8/§etsverify deny §8- §7Lehnt eine Verknüpfung ab");
BungeeCore.send(player, "§8/§etsverify free §8- §7Entfernt deine bestehende Verbindung");
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.Event;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team;
@ -22,29 +23,29 @@ public class TeamCommand extends BasicCommand {
private static Map<SteamwarUser, List<Team>> invitations = new HashMap<>();
private void help(CommandSender sender){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§7Mit §e/team §7verwaltest du dein Team");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam list §8- §7Liste alle Teams auf");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam info §8- §7Informiere dich über ein Team");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§7Mit §e/team §7verwaltest du dein Team");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam list §8- §7Liste alle Teams auf");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam info §8- §7Informiere dich über ein Team");
if(!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer player = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(user.getTeam() == 0) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8- §7Erstelle dein eigenes Team");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8- §7Trete einem Team bei");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam create §8- §7Erstelle dein eigenes Team");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam join §8- §7Trete einem Team bei");
}else{
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteamchat §8- §7Sende Nachrichten an dein Team");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam event §8- §7Nehme an Events teil");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam leave §8- §7Verlasse dein Team");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteamchat §8- §7Sende Nachrichten an dein Team");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam event §8- §7Nehme an Events teil");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam leave §8- §7Verlasse dein Team");
Team team = Team.get(user.getTeam());
if(team.getTeamLeader() == user.getId()){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8- §7Lade jemanden in dein Team ein");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8- §7Entferne jemanden aus deinem Team");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8- §7Ändere deinen Teamnamen");
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam invite §8- §7Lade jemanden in dein Team ein");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam remove §8- §7Entferne jemanden aus deinem Team");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam changename §8- §7Ändere deinen Teamnamen");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader");
}
}
}
@ -107,7 +108,7 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length < 3){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8]");
return;
}
@ -119,7 +120,7 @@ public class TeamCommand extends BasicCommand {
Team.create(args[1], args[2], user.getId());
user.setTeam(Team.get(args[1]).getTeamId());
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Team §e" + args[2] + " §7gegründet!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast das Team §e" + args[2] + " §7gegründet!");
}
private void join(ProxiedPlayer player, SteamwarUser user, String[] args){
@ -130,7 +131,7 @@ public class TeamCommand extends BasicCommand {
return;
if(!invitations.containsKey(user)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast keine Einladungen erhalten.");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast keine Einladungen erhalten.");
return;
}
@ -141,7 +142,7 @@ public class TeamCommand extends BasicCommand {
t = invs.get(0);
}else{
if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8[§eTeam§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam join §8[§eTeam§8]");
StringBuilder sb = new StringBuilder().append("§7Du wurdest von diesen Teams eingeladen§8: §e");
for(Team inv : invs){
sb.append(inv.getTeamName()).append(" ");
@ -158,14 +159,14 @@ public class TeamCommand extends BasicCommand {
}
if(t == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cVon diesem Team wurdest du nicht eingeladen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cVon diesem Team wurdest du nicht eingeladen");
return;
}
}
user.setTeam(t.getTeamId());
invitations.remove(user);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du bist dem Team §e" + t.getTeamName() + " §7beigetreten!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du bist dem Team §e" + t.getTeamName() + " §7beigetreten!");
}
private void leave(ProxiedPlayer player, SteamwarUser user, Team team){
@ -173,7 +174,7 @@ public class TeamCommand extends BasicCommand {
return;
if(team.getTeamLeader() == user.getId() && team.size() > 1){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte ernenne zunächst ein anderes Teammitglied zum Leader");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cBitte ernenne zunächst ein anderes Teammitglied zum Leader");
return;
}
@ -183,7 +184,7 @@ public class TeamCommand extends BasicCommand {
team.disband();
}
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast dein Team verlassen!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast dein Team verlassen!");
}
@ -195,16 +196,16 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8[§eSpieler§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam invite §8[§eSpieler§8]");
return;
}
SteamwarUser target = SteamwarUser.get(args[1]);
if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht");
return;
}else if(target.getTeam() != 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist bereits in einem Team");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler ist bereits in einem Team");
return;
}
@ -212,16 +213,16 @@ public class TeamCommand extends BasicCommand {
invitations.put(target, new LinkedList<>());
if(invitations.get(target).contains(team)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu hast diesen Spieler bereits eingeladen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu hast diesen Spieler bereits eingeladen");
return;
}
invitations.get(target).add(team);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast §e" + args[1] + " §7in das Team eingeladen!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast §e" + args[1] + " §7in das Team eingeladen!");
ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid());
if(p != null)
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du wurdest in das Team §e" + team.getTeamName() + " §7eingeladen!");
BungeeCore.send(p, Config.CHAT_PREFIX + "§7Du wurdest in das Team §e" + team.getTeamName() + " §7eingeladen!");
}
private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -229,38 +230,38 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8[§eSpieler§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam remove §8[§eSpieler§8]");
return;
}
SteamwarUser target = SteamwarUser.get(args[1]);
if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht");
return;
}
if(invitations.containsKey(target)){
if(invitations.get(target).remove(team)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Die Einladung wurde zurückgezogen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Die Einladung wurde zurückgezogen");
if(invitations.get(target).isEmpty())
invitations.remove(target);
}else{
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat keine Einladung erhalten");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler hat keine Einladung erhalten");
}
return;
}
if(target.getTeam() != user.getTeam()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist nicht in deinem Team");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieser Spieler ist nicht in deinem Team");
return;
}
target.setTeam(0);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Der Spieler wurde aus dem Team entfernt");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Der Spieler wurde aus dem Team entfernt");
ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid());
if(p != null)
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu wurdest aus dem Team entfernt");
BungeeCore.send(p, Config.CHAT_PREFIX + "§cDu wurdest aus dem Team entfernt");
}
private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -271,7 +272,7 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8[§eTeamkürzel§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam changekuerzel §8[§eTeamkürzel§8]");
return;
}
@ -279,7 +280,7 @@ public class TeamCommand extends BasicCommand {
return;
team.setTeamKuerzel(args[1]);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Kürzel des Teams geändert!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast das Kürzel des Teams geändert!");
}
private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -290,7 +291,7 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8[§eTeamname§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam changename §8[§eTeamname§8]");
return;
}
@ -298,7 +299,7 @@ public class TeamCommand extends BasicCommand {
return;
team.setTeamName(args[1]);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Team umbenannt!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast das Team umbenannt!");
}
private void changeleader(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -309,35 +310,35 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte gib ein Teammitglied an");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cBitte gib ein Teammitglied an");
return;
}
SteamwarUser target = SteamwarUser.get(args[1]);
if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDen Spieler " + args[1] + " gibt es nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDen Spieler " + args[1] + " gibt es nicht");
return;
}
if(target.getTeam() != user.getTeam()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDer Spieler ist nicht in deinem Team");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDer Spieler ist nicht in deinem Team");
return;
}
team.setTeamLeader(target.getId());
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast den Spieler §e" + args[1] + " §7zum Leader gemacht!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Du hast den Spieler §e" + args[1] + " §7zum Leader gemacht!");
}
private void info(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
if(args.length == 1 && user.getTeam() == 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam info §8[§eTeamname§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam info §8[§eTeamname§8]");
return;
}else if(user.getTeam() == 0 || args.length == 2){
team = Team.get(args[1]);
}
if(team == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Team gibt es nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieses Team gibt es nicht");
return;
}
@ -367,7 +368,7 @@ public class TeamCommand extends BasicCommand {
}
private void list(ProxiedPlayer player){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7§lTeamliste");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7§lTeamliste");
List<Team> all = Team.getAll();
for(Team tm : all){
BungeeCore.send(player,
@ -382,10 +383,10 @@ public class TeamCommand extends BasicCommand {
return;
if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen");
Set<Event> events = TeamTeilnahme.getEvents(team.getTeamId());
if(!events.isEmpty()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Team nimmt an folgenden Events teil§8:");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Dein Team nimmt an folgenden Events teil§8:");
for(Event e : events)
BungeeCore.send(player, "§7" + e.getStart().toLocalDateTime().format(EventCommand.DATE_FORMAT) + "§8: §e" + e.getEventName());
}
@ -400,34 +401,34 @@ public class TeamCommand extends BasicCommand {
Event event = Event.get(args[1]);
if(event == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Event gibt es nicht");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieses Event gibt es nicht");
return;
}
if(Instant.now().isAfter(event.getEnd().toInstant())){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Event ist bereits vorbei");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDieses Event ist bereits vorbei");
return;
}
if(TeamTeilnahme.nimmtTeil(team.getTeamId(), event.getEventID())){
TeamTeilnahme.notTeilnehmen(team.getTeamId(), event.getEventID());
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Team nimmt nicht mehr am Event teil");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Dein Team nimmt nicht mehr am Event teil");
}else{
TeamTeilnahme.teilnehmen(team.getTeamId(), event.getEventID());
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Team nimmt nun am Event §e" + event.getEventName() + " §7 teil!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Dein Team nimmt nun am Event §e" + event.getEventName() + " §7 teil!");
BungeeCore.send(player, "§7Um die Teilnahme abzusagen, wiederhole den Befehl");
}
}
private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){
if(arg.length() < 4 || arg.length() > 15){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen");
return true;
}
Team t = Team.get(arg);
if(t != null && t.getTeamId() != team.getTeamId()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEs gibt bereits ein Team mit diesem Namen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cEs gibt bereits ein Team mit diesem Namen");
return true;
}
return false;
@ -435,13 +436,13 @@ public class TeamCommand extends BasicCommand {
private boolean checkTeamKuerzel(ProxiedPlayer player, Team team, String arg){
if(arg.length() < 2 || arg.length() > 4){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen");
return true;
}
Team t = Team.get(arg);
if(t != null && (team == null || t.getTeamId() != team.getTeamId())){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEs gibt bereits ein Team mit diesem Namen");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cEs gibt bereits ein Team mit diesem Namen");
return true;
}
return false;
@ -449,7 +450,7 @@ public class TeamCommand extends BasicCommand {
private boolean unwantedInTeam(ProxiedPlayer player, SteamwarUser user){
if(user.getTeam() != 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist bereits in einem Team");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu bist bereits in einem Team");
return true;
}
return false;
@ -457,7 +458,7 @@ public class TeamCommand extends BasicCommand {
private boolean notInTeam(ProxiedPlayer player, SteamwarUser user){
if(user.getTeam() == 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist in keinem Team");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu bist in keinem Team");
return true;
}
return false;
@ -467,7 +468,7 @@ public class TeamCommand extends BasicCommand {
if(notInTeam(player, user))
return true;
if(team.getTeamLeader() != user.getId()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist nicht der Teamleader");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu bist nicht der Teamleader");
return true;
}
return false;
@ -475,7 +476,7 @@ public class TeamCommand extends BasicCommand {
private boolean notDuringEvent(ProxiedPlayer player){
if(Event.get() != null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDies ist während eines Events nicht möglich");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDies ist während eines Events nicht möglich");
return true;
}
return false;

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ChatMessageType;
@ -21,17 +22,17 @@ public class TeamchatCommand extends BasicCommand {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(user.getTeam() == 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist in keinem Team");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDu bist in keinem Team");
return;
}
if(args.length == 0){
BungeeCore.send(player, BungeeCore.TEAMCHAT_PREFIX + "/teamchat [Nachricht an das Team]");
BungeeCore.send(player, Config.TEAMCHAT_PREFIX + "/teamchat [Nachricht an das Team]");
return;
}
StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append(BungeeCore.TEAMCHAT_PREFIX).append(sender.getName()).append("§8» §r");
msgBuilder.append(Config.TEAMCHAT_PREFIX).append(sender.getName()).append("§8» §r");
for (String arg : args){
msgBuilder.append(arg).append(" ");
}

Datei anzeigen

@ -34,7 +34,7 @@ public class TpCommand extends BasicCommand {
if(!(sender instanceof ProxiedPlayer))
return;
if(!onTp((ProxiedPlayer) sender, args))
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cKonnte das angegebene Ziel nicht finden.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cKonnte das angegebene Ziel nicht finden.");
}
@Override
@ -48,9 +48,9 @@ public class TpCommand extends BasicCommand {
private static boolean onTp(ProxiedPlayer player, String[] args){
if(args.length == 0){
if(Event.get() == null)
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§etp §8[§7Spieler§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§etp §8[§7Spieler§8]");
else
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§etp §8[§7Spieler §8oder §7Team§8]");
BungeeCore.send(player, Config.CHAT_PREFIX + "§8/§etp §8[§7Spieler §8oder §7Team§8]");
return true;
}
@ -106,13 +106,13 @@ public class TpCommand extends BasicCommand {
subserver.sendPlayer(player);
} else {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE);
BungeeCore.send(player, Config.CHAT_PREFIX + DENY_MESSAGE);
}
}
}else if(serverPerm != null && !player.hasPermission(serverPerm)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE);
BungeeCore.send(player, Config.CHAT_PREFIX + DENY_MESSAGE);
}else if(serverPerm == null && !player.getGroups().contains("team")) {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE);
BungeeCore.send(player, Config.CHAT_PREFIX + DENY_MESSAGE);
}else{
player.connect(server);
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
@ -16,7 +17,7 @@ public class UnbanCommand extends BasicCommand {
@Override
public void execute(CommandSender sender, String[] args) {
if(args.length < 1){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/unban [Spieler]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "/unban [Spieler]");
return;
}
@ -24,7 +25,7 @@ public class UnbanCommand extends BasicCommand {
if(target == null)
return;
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt.");
BungeeCore.send(sender, Config.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt.");
target.ban(Timestamp.from(new Date().toInstant()), "");
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -16,18 +17,18 @@ public class WebpwCommand extends BasicCommand {
if(sender instanceof ProxiedPlayer){
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "/webpw [Passwort] [Passwort wiederholen]");
BungeeCore.send(player, Config.CHAT_PREFIX + "/webpw [Passwort] [Passwort wiederholen]");
return;
}else if(!args[0].equals(args[1])){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDie Passwörter stimmen nicht überein!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDie Passwörter stimmen nicht überein!");
return;
}else if(args[0].length() < 6){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas Passwort muss mindestens 6 Zeichen lang sein!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§cDas Passwort muss mindestens 6 Zeichen lang sein!");
return;
}
SteamwarUser.get(player.getUniqueId()).setWebpw(args[0]);
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Webpasswort gesetzt!");
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Webpasswort gesetzt!");
}
}
}

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.BannedUserIPs;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.ProxyServer;
@ -29,7 +29,7 @@ public class BanListener extends BasicListener {
List<BannedUserIPs> ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress());
if(!ips.isEmpty()){
StringBuilder potentialBan = new StringBuilder();
potentialBan.append(BungeeCore.CHAT_PREFIX);
potentialBan.append(Config.CHAT_PREFIX);
potentialBan.append("§cMögliche Bannumgehung durch §r");
potentialBan.append(user.getUserName());
potentialBan.append("§c:");
@ -37,7 +37,7 @@ public class BanListener extends BasicListener {
for(BannedUserIPs banned : ips){
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
potentialBan.append(" §e");
potentialBan.append(banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT));
potentialBan.append(banned.getTimestamp().toLocalDateTime().format(Config.DATE_FORMAT));
potentialBan.append(" §c");
potentialBan.append(bannedUser.getUserName());
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.commands.BauCommand;
@ -38,7 +39,7 @@ public class ChatListener extends BasicListener {
String [] command = e.getMessage().split(" ");
if(command[0].contains(":")){
if(e.getSender() instanceof ProxiedPlayer)
BungeeCore.send((ProxiedPlayer) e.getSender(), BungeeCore.CHAT_PREFIX + "§cUnbekannter Befehl.");
BungeeCore.send((ProxiedPlayer) e.getSender(), Config.CHAT_PREFIX + "§cUnbekannter Befehl.");
e.setCancelled(true);
return;
}
@ -82,7 +83,7 @@ public class ChatListener extends BasicListener {
lixfelAlert(sender);
if(sender.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen!");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen!");
e.setCancelled(true);
return;
}
@ -138,7 +139,7 @@ public class ChatListener extends BasicListener {
ProxiedPlayer sender = (ProxiedPlayer) e.getSender();
BungeeCore.log(sender, e.getMessage());
if(command.length == 1){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§e" + command[0].substring(1) + " §8[§7Nachricht§8]");
BungeeCore.send(sender, Config.CHAT_PREFIX + "§8/§e" + command[0].substring(1) + " §8[§7Nachricht§8]");
e.setCancelled(true);
return;
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.commands.ChallengeCommand;
@ -79,7 +80,7 @@ public class ConnectionListener extends BasicListener {
if(subserver.getType() == Servertype.ARENA){
Iterator<ProxiedPlayer> it = subserver.getServer().getPlayers().iterator();
if(it.hasNext()){
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + subserver.getServer().getName() + " §7beizutreten");
TextComponent tc = new TextComponent(Config.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + subserver.getServer().getName() + " §7beizutreten");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eArena beitreten").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + it.next().getName()));
player.sendMessage(tc);
@ -88,7 +89,7 @@ public class ConnectionListener extends BasicListener {
}
if(player.getPendingConnection().getVersion() < 335 || player.getPendingConnection().getVersion() > 340){
player.sendMessage(BungeeCore.CHAT_PREFIX + "§cWir empfehlen die Minecraft-Version 1.12.2");
player.sendMessage(Config.CHAT_PREFIX + "§cWir empfehlen die Minecraft-Version 1.12.2");
}
}
@ -109,7 +110,7 @@ public class ConnectionListener extends BasicListener {
}
}
ServerInfo kickTo = ProxyServer.getInstance().getServerInfo(BungeeCore.LOBBY_SERVER);
ServerInfo kickTo = ProxyServer.getInstance().getServerInfo(Config.LOBBY_SERVER);
if (kickedFrom != null && kickedFrom.equals(kickTo)) {
return;

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.PollAnswer;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.chat.ClickEvent;
@ -8,17 +9,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
import java.util.List;
public class PollSystem extends BasicListener {
private static String question;
private static List<String> answers;
public static void init(String question, List<String> answers){
PollSystem.question = question;
PollSystem.answers = answers;
public static void init(){
if(noCurrentPoll())
return;
new PollSystem();
@ -37,26 +30,18 @@ public class PollSystem extends BasicListener {
}
public static void sendPoll(ProxiedPlayer player){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§e§lUmfrage");
BungeeCore.send(player, Config.CHAT_PREFIX + "§e§lUmfrage");
BungeeCore.send(player, "§7Klicke die Antwort an, die dir gefällt!");
BungeeCore.send(player, "§e" + question);
BungeeCore.send(player, "§e" + Config.POLL_QUESTION);
for(int i = 1; i <= answers.size(); i++){
BungeeCore.send(player, "§7" + answers.get(i-1),
"§e" + answers.get(i-1) + " §ewählen",
for(int i = 1; i <= Config.POLL_ANSWERS.size(); i++){
BungeeCore.send(player, "§7" + Config.POLL_ANSWERS.get(i-1),
"§e" + Config.POLL_ANSWERS.get(i-1) + " §ewählen",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + i));
}
}
public static boolean noCurrentPoll(){
return question == null || question.equals("");
}
public static String getQuestion() {
return question;
}
public static int answers(){
return answers.size();
return Config.POLL_QUESTION == null || Config.POLL_QUESTION.equals("");
}
}

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.sql;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.ProxyServer;
import java.sql.*;
@ -11,19 +12,11 @@ public class SQL {
private static Connection con;
private static Connection webcon;
private static String url;
private static String weburl;
private static String user;
private static String password;
public static void connect(String url, String weburl, String user, String password) {
SQL.url = url;
SQL.weburl = weburl;
SQL.user = user;
SQL.password = password;
public static void connect() {
try {
con = DriverManager.getConnection(url + "?autoreconnect=true", user, password);
webcon = DriverManager.getConnection(weburl + "?autoreconnect=true", user, password);
con = DriverManager.getConnection(Config.DB_URL + "?autoreconnect=true", Config.DB_USERNAME, Config.DB_PASSWORD);
webcon = DriverManager.getConnection(Config.DB_WEBURL + "?autoreconnect=true", Config.DB_USERNAME, Config.DB_PASSWORD);
}catch (SQLException e) {
ProxyServer.getInstance().stop();
throw new SecurityException("Could not start SQL-Exception", e);
@ -43,7 +36,7 @@ public class SQL {
private static void sqlException(){
close();
connect(url, weburl, user, password);
connect();
}
static void update(String qry) {

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bungeecore.sql;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
@ -158,19 +159,19 @@ public class SteamwarUser {
public TextComponent banMessage(){
if (banTime.before(PERMA_BAN)) {
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + banReason);
return BungeeCore.stringToText(Config.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + banReason);
} else {
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " +
banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + banReason);
return BungeeCore.stringToText(Config.CHAT_PREFIX + " Du bist bis zum " +
banTime.toLocalDateTime().format(Config.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + banReason);
}
}
public TextComponent muteMessage(){
if (muteTime.before(PERMA_BAN)) {
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + muteReason);
return BungeeCore.stringToText(Config.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + muteReason);
} else {
return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " +
muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + muteReason);
return BungeeCore.stringToText(Config.CHAT_PREFIX + " Du bist bis zum " +
muteTime.toLocalDateTime().format(Config.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + muteReason);
}
}

Datei anzeigen

@ -0,0 +1,56 @@
package de.steamwar.bungeecore.sql;
import java.sql.ResultSet;
import java.sql.SQLException;
public class TS3 {
private final int userID;
private final String ts3ID;
private TS3(int userID, String ts3ID){
this.userID = userID;
this.ts3ID = ts3ID;
}
private TS3(ResultSet rs) throws SQLException {
this(rs.getInt("UserID"), rs.getString("Ts3ID"));
}
public static TS3 get(String ts3ID){
return get(SQL.select("SELECT * FROM TS3 WHERE Ts3ID = " + SQL.disarmString(ts3ID)));
}
public static TS3 get(int userID){
return get(SQL.select("SELECT * FROM TS3 WHERE UserID = " + userID));
}
public static void create(int userID, String ts3ID){
SQL.update("INSERT INTO TS3" +
" (UserID, Ts3ID)" +
" VALUES" +
" ('" + userID + "', '" + SQL.disarmString(ts3ID) + "')");
}
public int getUserID() {
return userID;
}
public String getTs3ID() {
return ts3ID;
}
public void free(){
SQL.update("DELETE FROM TS3 WHERE UserID = " + userID);
}
private static TS3 get(ResultSet rs){
try {
if(!rs.next())
return null;
return new TS3(rs);
} catch(SQLException e){
throw new SecurityException("Could not get TS3", e);
}
}
}

Datei anzeigen

@ -0,0 +1,94 @@
package de.steamwar.bungeecore.ts3;
import com.github.theholywaffle.teamspeak3.api.event.*;
import com.github.theholywaffle.teamspeak3.api.wrapper.Client;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.TS3;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class QueryListener implements TS3Listener {
QueryListener(){}
@Override
public void onTextMessage(TextMessageEvent e) {
if(TS3.get(e.getInvokerUniqueId()) == null){
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(e.getMessage());
if(player == null){
TS3Handler.getApi().sendPrivateMessage(e.getInvokerId(), "Das ist nicht dein Minecraft-Name, bitte versuch es doch noch einmal. Oder bist du einfach gerade nicht online?");
return;
}
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
TS3Handler.getToVerify().put(user.getId(), e.getInvokerUniqueId());
TS3Handler.getApi().sendPrivateMessage(e.getInvokerId(), "Du kannst jetzt in Minecraft deinen Account bestätigen.");
Client client = TS3Handler.getApi().getClientInfo(e.getInvokerId());
BungeeCore.send(player, Config.CHAT_PREFIX + "§7Ist das dein TS3-Account§8? §e" + client.getNickname());
BungeeCore.send(player, "§aJa", "§8/§etsverify accept", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/verify accept"));
BungeeCore.send(player, "§cNein", "§8/§etsverify deny", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/verify deny"));
}else{
TS3Handler.getApi().sendPrivateMessage(e.getInvokerId(), "Dein Minecraft-Account ist bereits einem TS3-Account zugeordnet. Solltest du z.B. deinen PC gewechselt haben, gib in Minecraft /tsverify free ein, um die alte Verbindung zu lösen.");
}
}
@Override
public void onClientJoin(ClientJoinEvent e) {
if(TS3.get(e.getUniqueClientIdentifier()) == null){
TS3Handler.getApi().sendPrivateMessage(e.getInvokerId(), "Hallo, schreibst du mir bitte deinen Ingame-Minecraftnamen?");
}
}
@Override
public void onClientLeave(ClientLeaveEvent e) {
//unused
}
@Override
public void onServerEdit(ServerEditedEvent e) {
//unused
}
@Override
public void onChannelEdit(ChannelEditedEvent e) {
//unused
}
@Override
public void onChannelDescriptionChanged(ChannelDescriptionEditedEvent e) {
//unused
}
@Override
public void onClientMoved(ClientMovedEvent e) {
//unused
}
@Override
public void onChannelCreate(ChannelCreateEvent e) {
//unused
}
@Override
public void onChannelDeleted(ChannelDeletedEvent e) {
//unused
}
@Override
public void onChannelMoved(ChannelMovedEvent e) {
//unused
}
@Override
public void onChannelPasswordChanged(ChannelPasswordChangedEvent e) {
//unused
}
@Override
public void onPrivilegeKeyUsed(PrivilegeKeyUsedEvent e) {
//unused
}
}

Datei anzeigen

@ -0,0 +1,59 @@
package de.steamwar.bungeecore.ts3;
import com.github.theholywaffle.teamspeak3.TS3Api;
import com.github.theholywaffle.teamspeak3.TS3Config;
import com.github.theholywaffle.teamspeak3.TS3Query;
import com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException;
import com.github.theholywaffle.teamspeak3.api.wrapper.Client;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Config;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.TS3;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.HashMap;
import java.util.Map;
public class TS3Handler {
private static final Map<Integer, String> toVerify = new HashMap<>();
private static TS3Query query;
private static TS3Api api;
public TS3Handler(){
TS3Config cfg = new TS3Config();
cfg.setHost("127.0.0.1");
query = new TS3Query(cfg);
query.connect();
api = query.getApi();
api.login(Config.TS3_QUERY_USER, Config.TS3_QUERY_PASSWORD);
api.selectVirtualServerById(Config.TS3_QUERY_SERVERID);
api.setNickname(Config.TS3_QUERY_NICKNAME);
api.registerAllEvents();
api.addTS3Listeners(new QueryListener());
}
public static Map<Integer, String> getToVerify() {
return toVerify;
}
public static void close(){
query.exit();
}
static TS3Api getApi() {
return api;
}
public static void createConnection(ProxiedPlayer player, SteamwarUser user, String ts3Id){
TS3.create(user.getId(), ts3Id);
TS3Handler.getToVerify().remove(user.getId());
BungeeCore.send(player, Config.CHAT_PREFIX + "§aDeine Teamspeak-Verknüpfung wurde erfolgreich hergestellt");
try {
Client client = api.getClientByUId(ts3Id);
api.addClientToServerGroup(Config.TS3_QUERY_GROUPID, client.getDatabaseId());
}catch(TS3CommandFailedException e){
//ignored
}
}
}