Bc (untested) + Ban fix
Dieser Commit ist enthalten in:
Ursprung
510114e53c
Commit
727a96d41a
@ -15,6 +15,7 @@ import java.io.IOException;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class BungeeCore extends Plugin {
|
public class BungeeCore extends Plugin {
|
||||||
@ -25,6 +26,8 @@ public class BungeeCore extends Plugin {
|
|||||||
public static final String TeamchatPrefix = "§4T§7c§r §e";
|
public static final String TeamchatPrefix = "§4T§7c§r §e";
|
||||||
public static final DateTimeFormatter DateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
public static final DateTimeFormatter DateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy");
|
||||||
public static String LobbyServer;
|
public static String LobbyServer;
|
||||||
|
public static String [] BroadCastMsgs;
|
||||||
|
public static int LastBroadCast = 0;
|
||||||
public static final HashMap<String, String> serverPermissions = new HashMap<>();
|
public static final HashMap<String, String> serverPermissions = new HashMap<>();
|
||||||
public static final HashMap<String, String> commands = new HashMap<>();
|
public static final HashMap<String, String> commands = new HashMap<>();
|
||||||
|
|
||||||
@ -45,8 +48,10 @@ public class BungeeCore extends Plugin {
|
|||||||
config.set("db.weburl", "jdbc:mysql://127.0.0.1:3306/Website");
|
config.set("db.weburl", "jdbc:mysql://127.0.0.1:3306/Website");
|
||||||
config.set("db.username", "root");
|
config.set("db.username", "root");
|
||||||
config.set("db.password", "$password");
|
config.set("db.password", "$password");
|
||||||
String [] cmds = {"l", "hub", "lobby"};
|
String [] cmd = {"l", "hub", "lobby"};
|
||||||
config.set("servers.HunjyLobby.commands", cmds);
|
config.set("servers.HunjyLobby.commands", cmd);
|
||||||
|
String [] bcs = {"Standardmitteilung!"};
|
||||||
|
config.set("broadcasts", bcs);
|
||||||
config.set("servers.HunjyLobby.permission", "bungeecore.server.user");
|
config.set("servers.HunjyLobby.permission", "bungeecore.server.user");
|
||||||
ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, configFile);
|
ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, configFile);
|
||||||
}
|
}
|
||||||
@ -92,9 +97,18 @@ public class BungeeCore extends Plugin {
|
|||||||
addCmd(new AlertCommand());
|
addCmd(new AlertCommand());
|
||||||
addCmd(new KickCommand());
|
addCmd(new KickCommand());
|
||||||
addCmd(new JoinmeCommand());
|
addCmd(new JoinmeCommand());
|
||||||
//addCmd(new FightCommand());
|
addCmd(new FightCommand());
|
||||||
addCmd(new HelpCommand());
|
addCmd(new HelpCommand());
|
||||||
addCmd(new BanCommand());
|
addCmd(new BanCommand());
|
||||||
|
|
||||||
|
BroadCastMsgs = config.getStringList("broadcasts").toArray(new String[1]);
|
||||||
|
getProxy().getScheduler().schedule(this, () -> {
|
||||||
|
getProxy().broadcast(ChatPrefix + BroadCastMsgs[LastBroadCast]);
|
||||||
|
LastBroadCast++;
|
||||||
|
if(LastBroadCast == BroadCastMsgs.length){
|
||||||
|
LastBroadCast = 0;
|
||||||
|
}
|
||||||
|
}, 5, 5, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,7 +57,11 @@ public class BanCommand extends Command {
|
|||||||
msgBuilder.append(msg);
|
msgBuilder.append(msg);
|
||||||
sender.sendMessage(BungeeCore.ChatPrefix + "Du hast " + target.UserName + " gebannt. Grund: §c" + msg);
|
sender.sendMessage(BungeeCore.ChatPrefix + "Du hast " + target.UserName + " gebannt. Grund: §c" + msg);
|
||||||
ProxiedPlayer targetPlayer = ProxyServer.getInstance().getPlayer(target.UUID);
|
ProxiedPlayer targetPlayer = ProxyServer.getInstance().getPlayer(target.UUID);
|
||||||
target.banPlayer(targetPlayer.getAddress().getAddress().getHostAddress(), banTime, msg);
|
if(targetPlayer != null){
|
||||||
targetPlayer.disconnect(msgBuilder.toString());
|
target.banPlayer(targetPlayer.getAddress().getAddress().getHostAddress(), banTime, msg);
|
||||||
|
targetPlayer.disconnect(msgBuilder.toString());
|
||||||
|
}else{
|
||||||
|
target.banPlayer(null, banTime, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
public class FightCommand extends Command {
|
public class FightCommand extends Command {
|
||||||
|
|
||||||
public FightCommand() {
|
public FightCommand() {
|
||||||
super("fight", "");
|
super("fight", "bungeecore.joinme");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,6 +114,7 @@ public class WarkingUser {
|
|||||||
|
|
||||||
public void banPlayer(String ip, Timestamp time, String banReason){
|
public void banPlayer(String ip, Timestamp time, String banReason){
|
||||||
sql.update("UPDATE UserData SET BanTime = '" + time.toString() + "', BanReason = '" + banReason + "' WHERE UUID = '" + UUID.toString() + "'");
|
sql.update("UPDATE UserData SET BanTime = '" + time.toString() + "', BanReason = '" + banReason + "' WHERE UUID = '" + UUID.toString() + "'");
|
||||||
updateBanIP(ip);
|
if(ip != null)
|
||||||
|
updateBanIP(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren