SteamWar/BungeeCore
Archiviert
13
2

Merge remote-tracking branch 'origin/master' into packet-system

Dieser Commit ist enthalten in:
Chaoscaot 2020-09-23 19:36:14 +02:00
Commit 0da5db17fb
10 geänderte Dateien mit 354 neuen und 189 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,131 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bungeecore;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
public class Message {
private Message(){}
public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, Object... params){
return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, sender, params)));
}
public static String parsePrefixed(String message, CommandSender sender, Object... params){
return parse(message, true, sender, params);
}
public static String parse(String message, CommandSender sender, Object... params){
return parse(message, false, sender, params);
}
private static String parse(String message, boolean prefixed, CommandSender sender,Object... params){
Locale locale;
if(sender instanceof ProxiedPlayer)
locale = ((ProxiedPlayer)sender).getLocale();
else
locale = Locale.getDefault();
ResourceBundle resourceBundle = ResourceBundle.getBundle("de.steamwar.messages.BungeeCore", locale);
String pattern = "";
if(prefixed)
pattern = new String(((String)resourceBundle.getObject("PREFIX")).getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8) + " ";
pattern += new String(((String)resourceBundle.getObject(message)).getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
return new MessageFormat(pattern, locale).format(params);
}
public static void send(String message, CommandSender sender, Object... params){
send(message, true, sender, ChatMessageType.SYSTEM, null, null, params);
}
public static void sendPrefixless(String message, CommandSender sender, Object... params){
send(message, false, sender, ChatMessageType.SYSTEM, null, null, params);
}
public static void send(String message, CommandSender sender, ChatMessageType type, Object... params){
send(message, true, sender, type, null, null, params);
}
public static void sendPrefixless(String message, CommandSender sender, ChatMessageType type, Object... params){
send(message, false, sender, type, null, null, params);
}
public static void send(String message, CommandSender sender, String onHover, ClickEvent onClick, Object... params){
send(message, true, sender, ChatMessageType.SYSTEM, onHover, onClick, params);
}
public static void sendPrefixless(String message, CommandSender sender, String onHover, ClickEvent onClick, Object... params){
send(message, false, sender, ChatMessageType.SYSTEM, onHover, onClick, params);
}
public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, Object... params){
TextComponent msg = parseToComponent(message, prefixed, sender, params);
if(onHover != null)
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover)));
if(onClick != null)
msg.setClickEvent(onClick);
if(sender instanceof ProxiedPlayer)
((ProxiedPlayer)sender).sendMessage(type, msg);
else
sender.sendMessage(msg);
}
public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers())
send(message, player, parse(onHover, false, player), onClick, params);
}
public static void broadcast(String message, Object... params){
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers())
send(message, player, ChatMessageType.SYSTEM, params);
}
public static void chat(String message, Object... params){
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
Subserver server = Subserver.getSubserver(player);
if(server == null || server.getType() != Servertype.ARENA)
sendPrefixless(message, player, ChatMessageType.CHAT, params);
}
}
public static void team(String message, Object... params){
team(message, ChatMessageType.SYSTEM, params);
}
public static void team(String message, ChatMessageType type, Object... params){
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
if(player.getGroups().contains(ConnectionListener.TEAM_GROUP))
sendPrefixless(message, player, type, params);
}
}
}

Datei anzeigen

@ -32,23 +32,13 @@ import java.util.*;
public class SubserverSystem { public class SubserverSystem {
private SubserverSystem(){} private SubserverSystem(){}
private static final String BACKBONE = "/home/minecraft/backbone/"; private static final String BACKBONE = "/home/minecraft/backbone/";
private static final List<String> JVM_ARGS = Arrays.asList("-Dlog4j.configurationFile=log4j2.xml", "-server", "-Xms128M", "-XX:ThreadPriorityPolicy=42", "-XX:+TieredCompilation", "-XX:TargetSurvivorRatio=90", "-XX:SurvivorRatio=8", "-XX:MaxTenuringThreshold=15", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseBiasedLocking", "-XX:UseSSE=3", "-XX:+UseCodeCacheFlushing", "-XX:+UseThreadPriorities", "-XX:+UseFastAccessorMethods", "-XX:+AggressiveOpts", "-XX:+ReduceSignalUsage", "-XX:+UseInterpreter", "-XX:+UseFastEmptyMethods", "-XX:+UseSharedSpaces", "-XX:AllocatePrefetchStyle=1", "-XX:+AlwaysCompileLoopMethods", "-XX:SharedReadOnlySize=30m", "-XX:+UseConcMarkSweepGC", "-XX:+RewriteFrequentPairs", "-XX:+OptimizeStringConcat", "-XX:+CMSCleanOnEnter", "-XX:+UseInlineCaches"); private static final List<String> JVM_ARGS = Arrays.asList("-Dlog4j.configurationFile=log4j2.xml", "-server", "-Xms128M", "-XX:+UseCompressedOops", "-XX:+TieredCompilation", "-XX:TargetSurvivorRatio=90", "-XX:SurvivorRatio=8", "-XX:MaxTenuringThreshold=15", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseBiasedLocking", "-XX:UseSSE=3", "-XX:+UseCodeCacheFlushing", "-XX:+UseThreadPriorities", "-XX:+AggressiveOpts", "-XX:+ReduceSignalUsage", "-XX:+UseInterpreter", "-XX:+UseSharedSpaces", "-XX:AllocatePrefetchStyle=1", "-XX:+AlwaysCompileLoopMethods", "-XX:+UseConcMarkSweepGC", "-XX:+RewriteFrequentPairs", "-XX:+OptimizeStringConcat", "-XX:+CMSCleanOnEnter", "-XX:+UseInlineCaches");
private static final List<String> JVM8_ARGS = Arrays.asList("-XX:ThreadPriorityPolicy=42", "-XX:SharedReadOnlySize=30m", "-XX:+UseFastEmptyMethods", "-XX:+UseFastAccessorMethods");
private static final String ARENA_PATH = BACKBONE + "arenaserver/"; private static final String ARENA_PATH = BACKBONE + "arenaserver/";
private static final String SERVER_PATH = BACKBONE + "server/"; private static final String SERVER_PATH = BACKBONE + "server/";
private static final String EVENT_PATH = BACKBONE + "event/"; private static final String EVENT_PATH = BACKBONE + "event/";
private static final String BINARY_PATH = "/binarys/";
public static void sendDeniedMessage(ProxiedPlayer p, UUID owner){
ProxiedPlayer o = ProxyServer.getInstance().getPlayer(owner);
if(o == null)
return;
BungeeCore.send(o, BungeeCore.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()));
}
/** /**
* This function starts every arena (even test- and eventarenas). * This function starts every arena (even test- and eventarenas).
@ -109,30 +99,18 @@ public class SubserverSystem {
throw new SecurityException("Could not copy folder", e); throw new SecurityException("Could not copy folder", e);
} }
//Generate launch command List<String> cmd = serverStartCommand(
List<String> cmd = new LinkedList<>(); modus.serverJar(),
cmd.add("java"); worldDir,
cmd.add("-DlogPath=" + mapName); mapName,
cmd.add("-DfightID=" + eventFightID); port,
if(player1 != null && eventFightID != -1) "2G",
cmd.add("-DblueLeader=" + player1.toString()); "logPath=" + mapName,
if(player2 != null) "fightID=" + eventFightID,
cmd.add("-DredLeader=" + player2.toString()); "ranked=" + ranked,
if(checkSchemID != 0) "checkSchemID=" + checkSchemID,
cmd.add("-DcheckSchemID=" + checkSchemID); player1 != null && eventFightID != -1 ? "blueLeader=" + player1.toString() : null,
if(ranked) player2 != null ? "redLeader=" + player2.toString() : null);
cmd.add("-Dranked=true");
cmd.add("-Xmx2G");
cmd.addAll(JVM_ARGS);
cmd.add("-jar");
cmd.add(BINARY_PATH + modus.serverJar());
cmd.add("--log-strip-color");
cmd.add("--world-dir");
cmd.add(worldDir);
cmd.add("--level-name");
cmd.add(mapName);
cmd.add("--port");
cmd.add(String.valueOf(port));
//Start server //Start server
ProcessBuilder process = new ProcessBuilder(cmd); ProcessBuilder process = new ProcessBuilder(cmd);
@ -164,10 +142,6 @@ public class SubserverSystem {
return startArena(modus, map, eventFightID, checkSchemID, serverName, mapName, player1, player2, false); return startArena(modus, map, eventFightID, checkSchemID, serverName, mapName, player1, player2, false);
} }
public static Subserver startArena(ArenaMode modus, String map){
return startArena(modus, map, 0, 0, null, null, null, null);
}
public static Subserver startEventArena(EventFight eventFight, String serverName){ public static Subserver startEventArena(EventFight eventFight, String serverName){
return startArena( return startArena(
eventFight.getSpielmodus(), eventFight.getSpielmodus(),
@ -180,7 +154,7 @@ public class SubserverSystem {
null); null);
} }
public static void sendToTestServer(ProxiedPlayer p, ArenaMode m, String map, int checkSchemId){ public static void startTestServer(ProxiedPlayer p, ArenaMode m, String map, int checkSchemId){
startArena(m, map, -1, checkSchemId, p.getName() + "s Bau", p.getName(), p.getUniqueId(), null).sendPlayer(p); startArena(m, map, -1, checkSchemId, p.getName() + "s Bau", p.getName(), p.getUniqueId(), null).sendPlayer(p);
} }
@ -189,24 +163,16 @@ public class SubserverSystem {
return; return;
SteamwarUser user = SteamwarUser.get(owner); SteamwarUser user = SteamwarUser.get(owner);
copyBauwelt(p, BungeeCore.BAUWELT_PROTOTYP, BungeeCore.WORLD_FOLDER + owner.toString()); copyBauweltIfRequired(p, BungeeCore.BAUWELT_PROTOTYP, BungeeCore.WORLD_FOLDER + owner.toString());
int port = freePort(4000); int port = freePort(4000);
//Generate launch command List<String> cmd = serverStartCommand(
List<String> cmd = new LinkedList<>(); "spigot-1.12.2.jar",
cmd.add("java"); "/home/minecraft/userworlds",
cmd.add("-DlogPath=" + owner.toString()); owner.toString(),
cmd.add("-Xmx256M"); port,
cmd.addAll(JVM_ARGS); "256M",
cmd.add("-jar"); "logPath=" + owner.toString());
cmd.add(BINARY_PATH + "spigot-1.12.2.jar");
cmd.add("--log-strip-color");
cmd.add("--world-dir");
cmd.add("/home/minecraft/userworlds");
cmd.add("--level-name");
cmd.add(owner.toString());
cmd.add("--port");
cmd.add(String.valueOf(port));
//Start server //Start server
ProcessBuilder process = new ProcessBuilder(cmd); ProcessBuilder process = new ProcessBuilder(cmd);
@ -220,24 +186,16 @@ public class SubserverSystem {
return; return;
SteamwarUser user = SteamwarUser.get(owner); SteamwarUser user = SteamwarUser.get(owner);
copyBauwelt(p, BungeeCore.BAUWELT15, BungeeCore.USERWORLDS15 + user.getId()); copyBauweltIfRequired(p, BungeeCore.BAUWELT15, BungeeCore.USERWORLDS15 + user.getId());
int port = freePort(4000); int port = freePort(4000);
//Generate launch command List<String> cmd = serverStartCommand(
List<String> cmd = new LinkedList<>(); "spigot-1.15.2.jar",
cmd.add("java"); "/home/minecraft/userworlds15",
cmd.add("-DlogPath=" + user.getId()); String.valueOf(user.getId()),
cmd.add("-Xmx512M"); port,
cmd.addAll(JVM_ARGS); "512M",
cmd.add("-jar"); "logPath=" + user.getId());
cmd.add(BINARY_PATH + "spigot-1.15.2.jar");
cmd.add("--log-strip-color");
cmd.add("--world-dir");
cmd.add("/home/minecraft/userworlds15");
cmd.add("--level-name");
cmd.add(String.valueOf(user.getId()));
cmd.add("--port");
cmd.add(String.valueOf(port));
//Start server //Start server
ProcessBuilder process = new ProcessBuilder(cmd); ProcessBuilder process = new ProcessBuilder(cmd);
@ -246,6 +204,45 @@ public class SubserverSystem {
new Bauserver(user.getUserName() + "s Bau", owner, port, process, () -> {}).sendPlayer(p); new Bauserver(user.getUserName() + "s Bau", owner, port, process, () -> {}).sendPlayer(p);
} }
public static void sendDeniedMessage(ProxiedPlayer p, UUID owner){
ProxiedPlayer o = ProxyServer.getInstance().getPlayer(owner);
if(o == null)
return;
BungeeCore.send(o, BungeeCore.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()));
}
private static List<String> serverStartCommand(String serverJar, String worldDir, String levelName, int port, String xmx, String... dParams){
List<String> cmd = new ArrayList<>();
boolean jdk11 = serverJar.contains("1.15.2");
if(jdk11)
cmd.add("/usr/lib/jvm/java-11-openjdk-amd64/bin/java");
else
cmd.add("java");
for(String param : dParams){
cmd.add("-D" + param);
}
cmd.add("-Xmx" + xmx);
cmd.addAll(JVM_ARGS);
if(!jdk11)
cmd.addAll(JVM8_ARGS);
cmd.add("-jar");
cmd.add("/binarys/" + serverJar);
cmd.add("--log-strip-color");
cmd.add("--world-dir");
cmd.add(worldDir);
cmd.add("--level-name");
cmd.add(levelName);
cmd.add("--port");
cmd.add(String.valueOf(port));
return cmd;
}
private static boolean bauRunning(ProxiedPlayer p, UUID owner){ private static boolean bauRunning(ProxiedPlayer p, UUID owner){
for(Subserver subserver : Subserver.getServerList()){ for(Subserver subserver : Subserver.getServerList()){
if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)){ if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)){
@ -256,7 +253,7 @@ public class SubserverSystem {
return false; return false;
} }
private static void copyBauwelt(ProxiedPlayer p, String sourcePath, String targetPath){ private static void copyBauweltIfRequired(ProxiedPlayer p, String sourcePath, String targetPath){
File w = new File(targetPath); File w = new File(targetPath);
if (!w.exists() || !w.isDirectory()){ if (!w.exists() || !w.isDirectory()){
try { try {

Datei anzeigen

@ -280,7 +280,7 @@ public class BauCommand {
break; break;
} }
} }
SubserverSystem.sendToTestServer(p, mode, map, 0); SubserverSystem.startTestServer(p, mode, map, 0);
})); }));
} }

Datei anzeigen

@ -232,7 +232,7 @@ public class CheckCommand extends BasicCommand {
} }
ArenaMode mode = ArenaMode.getByCheckSchemType(schematic.getSchemType().toDB()); ArenaMode mode = ArenaMode.getByCheckSchemType(schematic.getSchemType().toDB());
SubserverSystem.sendToTestServer(checker, mode, FightCommand.getMap(checker, mode, "Random"), schematic.getSchemID()); SubserverSystem.startTestServer(checker, mode, FightCommand.getMap(checker, mode, "Random"), schematic.getSchemID());
currentCheckers.put(checker.getUniqueId(), this); currentCheckers.put(checker.getUniqueId(), this);
currentSchems.put(schematic.getSchemID(), this); currentSchems.put(schematic.getSchemID(), this);
next(0); next(0);

Datei anzeigen

@ -58,7 +58,7 @@ public class FightCommand extends BasicCommand {
String realMap = mode.hasMap(arg.toLowerCase()); String realMap = mode.hasMap(arg.toLowerCase());
if(realMap != null) if(realMap != null)
return realMap; return realMap;
if(arg.equals("Random")) if(arg.equalsIgnoreCase("Random"))
return mode.getRandomMap(); return mode.getRandomMap();
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDie gewünschte Arena gibt es nicht."); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDie gewünschte Arena gibt es nicht.");

Datei anzeigen

@ -19,12 +19,10 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
public class HelpCommand extends BasicCommand { public class HelpCommand extends BasicCommand {
@ -35,115 +33,45 @@ public class HelpCommand extends BasicCommand {
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
if(args.length != 1){ if(args.length != 1){
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Kehre von überall mit §8/§el §7zur Lobby zurück!"); Message.send("HELP_LOBBY", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOBBY_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l"));
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZurück zur Lobby").create())); Message.send("HELP_BAU", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau"));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l")); Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bauserver"));
sender.sendMessage(tc); Message.send("HELP_FIGHT", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_FIGHT_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/fight"));
Message.send("HELP_CHALLENGE", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_CHALLENGE_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge"));
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Komme mit §8/§ebau §7auf den Bauserver!"); Message.send("HELP_HISTORIC", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_HISTORIC_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/historic"));
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZum Bauserver").create())); Message.send("HELP_TEAM", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_TEAM_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team"));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bauserver")); Message.send("HELP_JOIN", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_JOIN_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join"));
sender.sendMessage(tc); Message.send("HELP_LOCAL", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOCAL_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/local"));
tc = new TextComponent(BungeeCore.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.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.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 + "§7Starte mit §8/§ehistoric §7einen historischen Kampf!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eHistorische Kämpfe").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/historic"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.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.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.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eLokaler Chat").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/local"));
sender.sendMessage(tc);
}else if(args[0].equalsIgnoreCase("bauserver")){ }else if(args[0].equalsIgnoreCase("bauserver")){
sendBauHelp((ProxiedPlayer) sender); sendBauHelp((ProxiedPlayer) sender);
}else if(args[0].equalsIgnoreCase("bau")){ }else if(args[0].equalsIgnoreCase("bau")){
sender.sendMessage("§8/§etnt §8- §7(de)aktiviert Explosionsschaden"); Message.sendPrefixless("HELP_TNT", sender);
sender.sendMessage("§8/§efire §8- §7(de)aktiviert Feuerschaden"); Message.sendPrefixless("HELP_FIRE", sender);
sender.sendMessage("§8/§etestblock §8- §7Erneuert den nächsten Testblock"); Message.sendPrefixless("HELP_TESTBLOCK", sender);
sender.sendMessage("§8/§ereset §8- §7Setzt die derzeitige Region zurück"); Message.sendPrefixless("HELP_RESET", sender);
sender.sendMessage("§8/§espeed §8- §7Ändert deine Fluggeschwindigkeit"); Message.sendPrefixless("HELP_SPEED", sender);
sender.sendMessage("§8/§env §8- §7(de)aktiviert Nachtsicht"); Message.sendPrefixless("HELP_NV", sender);
sender.sendMessage("§8/§ewv §8- §7(de)aktiviert Unterwassersicht"); Message.sendPrefixless("HELP_WV", sender);
sender.sendMessage("§8/§etrace §8- §7Gibt einen Überblick über den TNT-Tracer"); Message.sendPrefixless("HELP_TRACE", sender);
sender.sendMessage("§8/§eloader §8- §7Nutze den automatischen Kanonenlader"); Message.sendPrefixless("HELP_LOADER", sender);
sender.sendMessage("§8/§eprotect §8- §7Schützt den Boden der (M)WG-Region"); Message.sendPrefixless("HELP_PROTECT", sender);
sender.sendMessage("§8/§efreeze §8- §7Unterbindet Blockupdates"); Message.sendPrefixless("HELP_FREEZE", sender);
sender.sendMessage("§8/§eskull §8- §7Gibt dir den Kopf eines Spielers"); Message.sendPrefixless("HELP_SKULL", sender);
sender.sendMessage("§8/§edebugstick §8- §7Gibt dir einen Debugstick (nur 1.15)"); Message.sendPrefixless("HELP_DEBUGSTICK", sender);
sender.sendMessage("§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver"); Message.sendPrefixless("HELP_BAUINFO", sender);
sender.sendMessage("§8/§ehelp bauserver §8- §7Hilfe zum Bauserver"); Message.sendPrefixless("HELP_BAUSERVER_SHORT", sender);
} }
} }
static void sendBauHelp(ProxiedPlayer p){ static void sendBauHelp(ProxiedPlayer p){
TextComponent tc = new TextComponent("§8/§ebau tp §8- §7Gehe auf Bauserver von Freunden!"); Message.send("HELP_BAU_TP", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TP_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau tp "));
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZu einem anderen Bauserver").create())); Message.send("HELP_BAU_ADDMEMBER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_ADDMEMBER_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau addmember "));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau tp ")); Message.send("HELP_BAU_DELMEMBER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_DELMEMBER_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delmember "));
p.sendMessage(tc); Message.send("HELP_BAU_TOGGLEBUILD", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TOGGLEBUILD_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau togglebuild "));
Message.send("HELP_BAU_TOGGLEWE", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TOGGLEWE_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau togglewe "));
tc = new TextComponent("§8/§ebau addmember §8- §7Fügt einen Freund hinzu"); Message.send("HELP_BAU_TOGGLEWORLD", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TOGGLEWORLD_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau toggleworld "));
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eFüge einen Freund hinzu").create())); Message.send("HELP_BAU_DELETE", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_DELETE_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delete "));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau addmember ")); Message.send("HELP_BAU_TESTARENA", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TESTARENA_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau testarena "));
p.sendMessage(tc); Message.send("HELP_BAU_BAU", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_BAU_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau"));
tc = new TextComponent("§8/§ebau delmember §8- §7Entfernt einen Spieler");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eEntfernt einen Spieler").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delmember "));
p.sendMessage(tc);
tc = new TextComponent("§8/§ebau togglebuild §8- §7Berechtigung zum Bauen, /tp, /gm");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eStellt Spielerberechtigungen ein").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau togglebuild "));
p.sendMessage(tc);
tc = new TextComponent("§8/§ebau togglewe §8- §7Berechtigung für WorldEdit, /testblock");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eStellt Spielerberechtigungen ein").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau togglewe "));
p.sendMessage(tc);
tc = new TextComponent("§8/§ebau toggleworld §8- §7/reset, /trace, /fire, /tnt");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eStellt Spielerberechtigungen ein").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau toggleworld "));
p.sendMessage(tc);
tc = new TextComponent("§8/§ebau delete §8- §7Setzt deine Bauwelt zurück");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eBauwelt zurücksetzen").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delete"));
p.sendMessage(tc);
tc = new TextComponent("§8/§ebau testarena §8- §7Starte eine Testarena");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eTestarena starten").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau testarena"));
p.sendMessage(tc);
tc = new TextComponent("§8/§ehelp bau §8- §7Hilfe zu nützlichen Werkzeugen");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eNützliche Zusatzfunktionen").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau"));
p.sendMessage(tc);
} }
} }

Datei anzeigen

@ -0,0 +1,38 @@
package de.steamwar.bungeecore.listeners.mods;
import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
public class Badlion extends BasicListener {
@EventHandler
public void onPostLogin(PostLoginEvent event) {
/*
{
"Clear Glass":{"disabled":true},
"ClearWater":{"disabled":true},
"FOV Changer":{"disabled":true},
"Hitboxes":{"disabled":true},
"MiniMap":{"disabled":true},
"MLG Cobweb":{"disabled":true},
"Replay":{"disabled":true},
"Schematica":{"disabled":true},
"ToggleSneak":{"disabled":true},
"ToggleSprint":{"disabled":true}
}
*/
event.getPlayer().sendData("badlion:mods", ("{" +
"\"Clear Glass\":{\"disabled\":true}," +
"\"ClearWater\":{\"disabled\":true}," +
"\"FOV Changer\":{\"disabled\":true}," +
"\"Hitboxes\":{\"disabled\":true}," +
"\"MiniMap\":{\"disabled\":true}," +
"\"MLG Cobweb\":{\"disabled\":true}," +
"\"Replay\":{\"disabled\":true}," +
"\"Schematica\":{\"disabled\":true}," +
"\"ToggleSneak\":{\"disabled\":true}," +
"\"ToggleSprint\":{\"disabled\":true}" +
"}").getBytes());
}
}

Datei anzeigen

@ -30,6 +30,7 @@ import java.time.Instant;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.logging.Level;
class Utils { class Utils {
private Utils(){} private Utils(){}
@ -72,16 +73,20 @@ class Utils {
if(mods.size() == 1){ if(mods.size() == 1){
if(max == ModType.YELLOW) if(max == ModType.YELLOW)
player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können.")); player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können."));
else else{
user.ban(Timestamp.from(Instant.now().plus(1, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName()); user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName());
BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen des Mods " + mods.get(0).getModName() + " gebannt.");
}
}else{ }else{
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
mods.forEach(mod -> sb.append(mod.getModName()).append('\n')); mods.forEach(mod -> sb.append(mod.getModName()).append('\n'));
if(max == ModType.YELLOW) if(max == ModType.YELLOW)
player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können.")); player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können."));
else else{
user.ban(Timestamp.from(Instant.now().plus(1, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString()); user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString());
BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen der Mods " + sb.toString() + " gebannt.");
}
} }
return false; return false;

Datei anzeigen

@ -0,0 +1,55 @@
PREFIX=§eSteam§8War»
HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück!
HELP_LOBBY_HOVER=§eZurück zur Lobby
HELP_BAU=§7Komme mit §8/§ebau §7auf den Bauserver!
HELP_BAU_HOVER=§eZum Bauserver
HELP_BAUSERVER=§7Erhalte mit §8/§ehelp bauserver §7Hilfe zum Bauserver!
HELP_BAUSERVER_HOVER=§eHilfe zum Bauserver
HELP_FIGHT=§7Starte mit §8/§efight §7einen neuen Kampf!
HELP_FIGHT_HOVER=§eZum Kampfsystem
HELP_CHALLENGE=§7Tippe §8/§echallenge§7, um jemanden herauszufordern!
HELP_CHALLENGE_HOVER=§eHerausfordern
HELP_HISTORIC=§7Starte mit §8/§ehistoric §7einen historischen Kampf!
HELP_HISTORIC_HOVER=§eHistorische Kämpfe
HELP_TEAM=§8/§eteam§7 für das Teamsystem!
HELP_TEAM_HOVER=§eTeamverwaltung
HELP_JOIN=§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei!
HELP_JOIN_HOVER=§eSpieler beitreten
HELP_LOCAL=§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server!
HELP_LOCAL_HOVER=§eLokaler Chat
HELP_TNT=§8/§etnt §8- §7(de)aktiviert Explosionsschaden
HELP_FIRE=§8/§efire §8- §7(de)aktiviert Feuerschaden
HELP_TESTBLOCK=§8/§etestblock §8- §7Erneuert den nächsten Testblock
HELP_RESET=§8/§ereset §8- §7Setzt die derzeitige Region zurück
HELP_SPEED=§8/§espeed §8- §7Ändert deine Fluggeschwindigkeit
HELP_NV=§8/§env §8- §7(de)aktiviert Nachtsicht
HELP_WV=§8/§ewv §8- §7(de)aktiviert Unterwassersicht
HELP_TRACE=§8/§etrace §8- §7Gibt einen Überblick über den TNT-Tracer
HELP_LOADER=§8/§eloader §8- §7Nutze den automatischen Kanonenlader
HELP_PROTECT=§8/§eprotect §8- §7Schützt den Boden der (M)WG-Region
HELP_FREEZE=§8/§efreeze §8- §7Unterbindet Blockupdates
HELP_SKULL=§8/§eskull §8- §7Gibt dir den Kopf eines Spielers
HELP_DEBUGSTICK=§8/§edebugstick §8- §7Gibt dir einen Debugstick (nur 1.15)
HELP_BAUINFO=§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver
HELP_BAUSERVER_SHORT=§8/§ehelp bauserver §8- §7Hilfe zum Bauserver
HELP_BAU_TP=§8/§ebau tp §8- §7Gehe auf Bauserver von Freunden!
HELP_BAU_TP_HOVER=§eZu einem anderen Bauserver
HELP_BAU_ADDMEMBER=§8/§ebau addmember §8- §7Fügt einen Freund hinzu
HELP_BAU_ADDMEMBER_HOVER=§eFüge einen Freund hinzu
HELP_BAU_DELMEMBER=§8/§ebau delmember §8- §7Entfernt einen Spieler
HELP_BAU_DELMEMBER_HOVER=§eEntfernt einen Spieler
HELP_BAU_TOGGLEBUILD=§8/§ebau togglebuild §8- §7Berechtigung zum Bauen, /tp, /gm
HELP_BAU_TOGGLEBUILD_HOVER=§eStellt Spielerberechtigungen ein
HELP_BAU_TOGGLEWE=§8/§ebau togglewe §8- §7Berechtigung für WorldEdit, /testblock
HELP_BAU_TOGGLEWE_HOVER=§eStellt Spielerberechtigungen ein
HELP_BAU_TOGGLEWORLD=§8/§ebau toggleworld §8- §7/reset, /trace, /fire, /tnt
HELP_BAU_TOGGLEWORLD_HOVER=§eStellt Spielerberechtigungen ein
HELP_BAU_DELETE=§8/§ebau delete §8- §7Setzt deine Bauwelt zurück
HELP_BAU_DELETE_HOVER=§eBauwelt zurücksetzen
HELP_BAU_TESTARENA=§8/§ebau testarena §8- §7Starte eine Testarena
HELP_BAU_TESTARENA_HOVER=§eTestarena starten
HELP_BAU_BAU=§8/§ehelp bau §8- §7Hilfe zu nützlichen Werkzeugen
HELP_BAU_BAU_HOVER=§eNützliche Zusatzfunktionen

Datei anzeigen

@ -0,0 +1,11 @@
#HELP_LOBBY=§7Return with §8/§el §7to the lobby!
#HELP_LOBBY_HOVER=§eReturn to lobby
#HELP_BAU=§7Go with §8/§ebau §7on your building server!
#HELP_BAU_HOVER=§eTo the building server
#HELP_BAUSERVER=§7Get with §8/§ehelp bauserver §7help for your building server!
#HELP_BAUSERVER_HOVER=§eHelp for the building server
#HELP_FIGHT=§7Start with §8/§efight §7a new fight!
#HELP_FIGHT_HOVER=§eFight
#HELP_CHALLENGE=§7Type §8/§echallenge§7 to challenge somebody!
#HELP_CHALLENGE_HOVER=§eChallenge