SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'master' into liteloader

# Conflicts:
#	src/de/steamwar/bungeecore/commands/FightCommand.java
Dieser Commit ist enthalten in:
Chaoscaot 2020-10-30 22:12:37 +01:00
Commit f411bc5d77
17 geänderte Dateien mit 147 neuen und 39 gelöschten Zeilen

Datei anzeigen

@ -62,6 +62,7 @@ public class BungeeCore extends Plugin {
public static String LOBBY_SERVER; public static String LOBBY_SERVER;
public static String USERWORLDS15; public static String USERWORLDS15;
public static String BAUWELT15; public static String BAUWELT15;
public static boolean EVENT_MODE;
private static BungeeCore instance; private static BungeeCore instance;
@ -97,17 +98,14 @@ public class BungeeCore extends Plugin {
new MsgCommand(); new MsgCommand();
new RCommand(); new RCommand();
new PingCommand(); new PingCommand();
new WebregisterCommand();
new AlertCommand(); new AlertCommand();
new KickCommand(); new KickCommand();
new JoinmeCommand(); new JoinmeCommand();
new TpCommand(); new TpCommand();
new FightCommand();
new HelpCommand(); new HelpCommand();
new BanCommand(); new BanCommand();
new UnbanCommand(); new UnbanCommand();
new DenyCommand("watchcat", "wc"); new DenyCommand("watchcat", "wc");
new ChallengeCommand();
new TeamCommand(); new TeamCommand();
new ServerTeamchatCommand(); new ServerTeamchatCommand();
new EventCommand(); new EventCommand();
@ -118,18 +116,26 @@ public class BungeeCore extends Plugin {
new BugCommand(); new BugCommand();
new WhoisCommand(); new WhoisCommand();
new RegelnCommand(); new RegelnCommand();
new HistoricCommand();
new CheckCommand();
new RankedCommand();
new RankCommand(); new RankCommand();
new IgnoreCommand(); new IgnoreCommand();
new UnIgnoreCommand(); new UnIgnoreCommand();
new EventStarter(); if(!EVENT_MODE){
new WebregisterCommand();
new FightCommand();
new ChallengeCommand();
new HistoricCommand();
new CheckCommand();
new RankedCommand();
new Broadcaster(); new Broadcaster();
}else{
new EventModeListener();
}
new EventStarter();
new SessionManager(); new SessionManager();
new SpigotReceiver(); new SpigotReceiver();
new TablistManager(); new TablistManager();
getProxy().getScheduler().schedule(this, () -> { getProxy().getScheduler().schedule(this, () -> {
@ -226,6 +232,7 @@ public class BungeeCore extends Plugin {
LOBBY_SERVER = config.getString("lobbyserver"); LOBBY_SERVER = config.getString("lobbyserver");
USERWORLDS15 = config.getString("userworlds15"); USERWORLDS15 = config.getString("userworlds15");
BAUWELT15 = config.getString("bauwelt15"); BAUWELT15 = config.getString("bauwelt15");
EVENT_MODE = config.getBoolean("eventmode");
Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1])); Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1]));
PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers")); PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers"));
CheckCommand.loadCheckQuestions(config.getSection("checkquestions")); CheckCommand.loadCheckQuestions(config.getSection("checkquestions"));

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bungeecore; package de.steamwar.bungeecore;
import de.steamwar.bungeecore.sql.Event;
import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.EventFight;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.Team;
@ -58,6 +59,9 @@ public class EventStarter implements Runnable {
EventFight next; EventFight next;
while((next = nextFight(fights)) != null){ while((next = nextFight(fights)) != null){
if(!BungeeCore.EVENT_MODE && Event.get(next.getEventID()).spectateSystem())
break; //Don't start EventServer if not the event bungee
Team blue = Team.get(next.getTeamBlue()); Team blue = Team.get(next.getTeamBlue());
Team red = Team.get(next.getTeamRed()); Team red = Team.get(next.getTeamRed());
String serverName = blue.getTeamKuerzel() + " vs " + red.getTeamKuerzel(); String serverName = blue.getTeamKuerzel() + " vs " + red.getTeamKuerzel();

Datei anzeigen

@ -41,6 +41,15 @@ public class SubserverSystem {
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 int firstArenaPort;
static {
if(BungeeCore.EVENT_MODE)
firstArenaPort = 6000;
else
firstArenaPort = 2500;
}
/** /**
* This function starts every arena (even test- and eventarenas). * This function starts every arena (even test- and eventarenas).
* *
@ -80,10 +89,14 @@ public class SubserverSystem {
*/ */
public static Subserver startArena(ArenaMode modus, String map, int eventFightID, int checkSchemID, String serverName, String mapName, UUID player1, UUID player2, boolean ranked){ public static Subserver startArena(ArenaMode modus, String map, int eventFightID, int checkSchemID, String serverName, String mapName, UUID player1, UUID player2, boolean ranked){
//Generate missing parameters //Generate missing parameters
int port = freePort(2500); int port = freePort(firstArenaPort);
if(serverName == null) if(serverName == null){
serverName = modus.getDisplayName() + (port - 2500); if(ranked)
serverName = "Ranked" + (port - firstArenaPort);
else
serverName = modus.getDisplayName() + (port - firstArenaPort);
}
if(mapName == null) if(mapName == null)
mapName = serverName; mapName = serverName;

Datei anzeigen

@ -38,7 +38,7 @@ public class BanCommand extends BasicCommand {
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
if(args.length < 3){ if(args.length < 3){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder perma] [Grund]"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]");
return; return;
} }
@ -63,14 +63,20 @@ public class BanCommand extends BasicCommand {
if(arg.equalsIgnoreCase("perma")) { if(arg.equalsIgnoreCase("perma")) {
return Timestamp.from(Instant.ofEpochSecond(946674800)); return Timestamp.from(Instant.ofEpochSecond(946674800));
}else{ }else{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH:mm");
try{ try{
Date parsedDate = dateFormat.parse(arg); Date parsedDate = dateFormat.parse(arg);
return new java.sql.Timestamp(parsedDate.getTime()); return new java.sql.Timestamp(parsedDate.getTime());
}catch(ParseException e){ }catch(ParseException e){
dateFormat = new SimpleDateFormat("dd.MM.yyyy");
try{
Date parsedDate = dateFormat.parse(arg.split("_")[0]);
return new java.sql.Timestamp(parsedDate.getTime());
}catch(ParseException exception){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUngültige Zeitangabe."); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUngültige Zeitangabe.");
return null; return null;
} }
} }
} }
} }
}

Datei anzeigen

@ -37,6 +37,9 @@ public class BauCommand {
private static final String UNKNOWN_PLAYER = BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler"; private static final String UNKNOWN_PLAYER = BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler";
public static void onBau(ChatEvent e, String[] command){ public static void onBau(ChatEvent e, String[] command){
if(BungeeCore.EVENT_MODE)
return;
ProxiedPlayer p = (ProxiedPlayer) e.getSender(); ProxiedPlayer p = (ProxiedPlayer) e.getSender();
Subserver server = Subserver.getSubserver(p); Subserver server = Subserver.getSubserver(p);
Bauserver bau = (server != null && server.getType() == Servertype.BAUSERVER) ? (Bauserver)server : null; Bauserver bau = (server != null && server.getType() == Servertype.BAUSERVER) ? (Bauserver)server : null;

Datei anzeigen

@ -34,7 +34,7 @@ public class MuteCommand extends BasicCommand {
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
if(args.length < 3){ if(args.length < 3){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder perma] [Grund]"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]");
return; return;
} }

Datei anzeigen

@ -165,12 +165,11 @@ public class RankedCommand extends BasicCommand {
removeFromAll(wp1.player); removeFromAll(wp1.player);
removeFromAll(wp2.player); removeFromAll(wp2.player);
String serverName = wp1.player.getName() + " vs " + wp2.player.getName(); Subserver arena = SubserverSystem.startArena(mode, mode.getRandomMap(), 0, 0, null, null, wp1.player.getUniqueId(), wp2.player.getUniqueId(), true);
Subserver arena = SubserverSystem.startArena(mode, mode.getRandomMap(), 0, 0, serverName, serverName.replace(' ', '_'), wp1.player.getUniqueId(), wp2.player.getUniqueId(), true);
arena.sendPlayer(wp1.player); arena.sendPlayer(wp1.player);
arena.sendPlayer(wp2.player); arena.sendPlayer(wp2.player);
BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7" + mode.getDisplayName() + "§8-§7Ranglistenspiel§8: §e" + serverName, BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7" + mode.getDisplayName() + "§8-§7Ranglistenspiel§8: §e" + wp1.player.getName() + " vs " + wp2.player.getName(),
"§aZuschauen", "§aZuschauen",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + wp1.player.getName())); new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + wp1.player.getName()));
} }

Datei anzeigen

@ -264,6 +264,11 @@ public class TeamCommand extends BasicCommand {
return; return;
} }
if (team.getTeamLeader() == target.getId()) {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cLeader entfernen sich nicht selbst");
return;
}
if(teamInvitations.containsKey(target.getId())){ if(teamInvitations.containsKey(target.getId())){
if(teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())){ if(teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Die Einladung wurde zurückgezogen"); BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Die Einladung wurde zurückgezogen");

Datei anzeigen

@ -59,7 +59,7 @@ public class WebregisterCommand extends BasicCommand {
break; break;
case "email_exists": case "email_exists":
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDie E-Mail hast du bereits für einen anderen Account verwendet..."); BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDie E-Mail hast du bereits für einen anderen Account verwendet...");
SWException.log("Bungee", "Duplicate E-Mail", player.getName() + " " + args[0]); // SWException.log("Bungee", "Duplicate E-Mail", player.getName() + " " + args[0]);
break; break;
case "invalid_email": case "invalid_email":
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c[E-Mail], nicht [Freitext]!"); BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c[E-Mail], nicht [Freitext]!");

Datei anzeigen

@ -20,11 +20,14 @@
package de.steamwar.bungeecore.comms; package de.steamwar.bungeecore.comms;
public class PacketIdManager { public class PacketIdManager {
private PacketIdManager(){}
//0x0(X) Standalone Packets //0x0(X) Standalone Packets
public final static byte PING_PACKET = 0x01; public static final byte PING_PACKET = 0x01;
public static final byte TABLIST_NAME = 0x02;
//0x1(X) Bungee Inventory //0x1(X) Bungee Inventory
public final static byte INVENTORY_PACKET = 0x10; public static final byte INVENTORY_PACKET = 0x10;
public final static byte INVENTORY_CALLBACK_PACKET = 0x11; public static final byte INVENTORY_CALLBACK_PACKET = 0x11;
public final static byte INVENTORY_CLOSE_PACKET = 0x12; public static final byte INVENTORY_CLOSE_PACKET = 0x12;
} }

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bungeecore.comms;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import de.steamwar.bungeecore.comms.handlers.InventoryCallbackHandler; import de.steamwar.bungeecore.comms.handlers.InventoryCallbackHandler;
import de.steamwar.bungeecore.comms.handlers.TablistNameHandler;
import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
@ -53,5 +54,6 @@ public class SpigotReceiver extends BasicListener {
static { static {
registerHandler(PacketIdManager.INVENTORY_CALLBACK_PACKET, new InventoryCallbackHandler()); registerHandler(PacketIdManager.INVENTORY_CALLBACK_PACKET, new InventoryCallbackHandler());
registerHandler(PacketIdManager.TABLIST_NAME, new TablistNameHandler());
} }
} }

Datei anzeigen

@ -0,0 +1,17 @@
package de.steamwar.bungeecore.comms.handlers;
import com.google.common.io.ByteArrayDataInput;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.comms.SpigotHandler;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class TablistNameHandler implements SpigotHandler {
@Override
public void handle(ByteArrayDataInput byteArrayDataInput) {
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUuid());
Subserver.getSubserver(player).getTablistNames().put(player, byteArrayDataInput.readUTF());
}
}

Datei anzeigen

@ -0,0 +1,36 @@
package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.sql.Event;
import de.steamwar.bungeecore.sql.EventFight;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.TeamTeilnahme;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
public class EventModeListener extends BasicListener {
private static final BaseComponent[] nonParticipant = TextComponent.fromLegacyText("§cDu bist kein Eventteilnehmer.");
@EventHandler
public void onPostLogin(PostLoginEvent e) {
SteamwarUser user = SteamwarUser.get(e.getPlayer().getUniqueId());
Event event = Event.get();
if(event == null){
e.getPlayer().disconnect(nonParticipant);
return;
}
if(TeamTeilnahme.nimmtTeil(user.getTeam(), event.getEventID()))
return;
for(EventFight eventFight : EventFight.getEvent(event.getEventID())){
if(eventFight.getKampfleiter() == user.getId())
return;
}
e.getPlayer().disconnect(nonParticipant);
}
}

Datei anzeigen

@ -109,8 +109,6 @@ public class TablistManager extends BasicListener {
ServerInfo server = pserver.getInfo(); ServerInfo server = pserver.getInfo();
String serverName = server.getName(); String serverName = server.getName();
if(serverName.equals("Developer"))
continue;
Subserver subserver = Subserver.getSubserver(server); Subserver subserver = Subserver.getSubserver(server);
List<ProxiedPlayer> players; List<ProxiedPlayer> players;
@ -198,6 +196,13 @@ public class TablistManager extends BasicListener {
} }
private String getTablistName(ProxiedPlayer p, boolean sameServer) { private String getTablistName(ProxiedPlayer p, boolean sameServer) {
Subserver server = Subserver.getSubserver(p);
if(server != null){
String tablistName = server.getTablistNames().get(p);
if(tablistName != null)
return tablistName;
}
StringBuilder st = new StringBuilder(); StringBuilder st = new StringBuilder();
if (p.hasPermission("bungeecore.group.admin")) st.append("§4"); if (p.hasPermission("bungeecore.group.admin")) st.append("§4");
else if (p.hasPermission("bungeecore.group.developer")) st.append("§3"); else if (p.hasPermission("bungeecore.group.developer")) st.append("§3");

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.bungeecore.listeners.mods;
import de.steamwar.bungeecore.listeners.BasicListener; import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.protocol.packet.PluginMessage;
public class Badlion extends BasicListener { public class Badlion extends BasicListener {
@ -22,7 +23,7 @@ public class Badlion extends BasicListener {
"ToggleSprint":{"disabled":true} "ToggleSprint":{"disabled":true}
} }
*/ */
event.getPlayer().sendData("badlion:mods", ("{" + event.getPlayer().unsafe().sendPacket(new PluginMessage("badlion:mods", ("{" +
"\"Clear Glass\":{\"disabled\":true}," + "\"Clear Glass\":{\"disabled\":true}," +
"\"ClearWater\":{\"disabled\":true}," + "\"ClearWater\":{\"disabled\":true}," +
"\"FOV Changer\":{\"disabled\":true}," + "\"FOV Changer\":{\"disabled\":true}," +
@ -33,6 +34,6 @@ public class Badlion extends BasicListener {
"\"Schematica\":{\"disabled\":true}," + "\"Schematica\":{\"disabled\":true}," +
"\"ToggleSneak\":{\"disabled\":true}," + "\"ToggleSneak\":{\"disabled\":true}," +
"\"ToggleSprint\":{\"disabled\":true}" + "\"ToggleSprint\":{\"disabled\":true}" +
"}").getBytes()); "}").getBytes(), false));
} }
} }

Datei anzeigen

@ -36,6 +36,7 @@ public class Event {
private final Timestamp end; private final Timestamp end;
private final int maximumTeamMembers; private final int maximumTeamMembers;
private final boolean publicSchemsOnly; private final boolean publicSchemsOnly;
private final boolean spectateSystem;
private static Event current = null; private static Event current = null;
@ -46,6 +47,7 @@ public class Event {
this.end = rs.getTimestamp("End"); this.end = rs.getTimestamp("End");
this.maximumTeamMembers = rs.getInt("MaximumTeamMembers"); this.maximumTeamMembers = rs.getInt("MaximumTeamMembers");
this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly");
this.spectateSystem = rs.getBoolean("SpectateSystem");
} }
public static Event get(){ public static Event get(){
@ -128,4 +130,7 @@ public class Event {
public boolean publicSchemsOnly() { public boolean publicSchemsOnly() {
return publicSchemsOnly; return publicSchemsOnly;
} }
public boolean spectateSystem(){
return spectateSystem;
}
} }

Datei anzeigen

@ -43,8 +43,10 @@ public class Team {
teamKuerzel = kuerzel; teamKuerzel = kuerzel;
teamName = name; teamName = name;
teamLeader = leader; teamLeader = leader;
if (leader != 0) {
teamCache.add(this); teamCache.add(this);
} }
}
private Team(ResultSet rs) throws SQLException { private Team(ResultSet rs) throws SQLException {
this(rs.getInt("TeamID"), rs.getString("TeamKuerzel"), rs.getString("TeamName"), rs.getInt("TeamLeader")); this(rs.getInt("TeamID"), rs.getString("TeamKuerzel"), rs.getString("TeamName"), rs.getInt("TeamLeader"));