Archiviert
1
0

Remove bau passthrough

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-05-29 17:39:06 +02:00
Ursprung 0e0a3606ce
Commit f8618a7a82
5 geänderte Dateien mit 93 neuen und 57 gelöschten Zeilen

Datei anzeigen

@ -123,6 +123,7 @@ public class BungeeCore extends Plugin {
new ResourcereloadCommand();
if(!EVENT_MODE){
new BauCommand();
new WebregisterCommand();
new FightCommand();
new ChallengeCommand();

Datei anzeigen

@ -20,38 +20,38 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.comms.packets.BaumemberUpdatePacket;
import de.steamwar.bungeecore.inventory.SWInventory;
import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.bungeecore.sql.BauweltMember;
import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ChatEvent;
public class BauCommand {
public class BauCommand extends BasicCommand {
private BauCommand(){}
public BauCommand(){
super("bau", null, "b", "gs");
}
public static void onBau(ChatEvent e, String[] command){
if(BungeeCore.EVENT_MODE)
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer p = (ProxiedPlayer) e.getSender();
Subserver server = Subserver.getSubserver(p);
Bauserver bau = (server != null && server.getType() == Servertype.BAUSERVER) ? (Bauserver)server : null;
boolean ownBau = bau != null && bau.getOwner().equals(p.getUniqueId());
e.setCancelled(true);
BungeeCore.log(p, e.getMessage());
ProxiedPlayer p = (ProxiedPlayer) sender;
if(command.length == 1){
if(bau15(p, command, 1))
if(args.length == 0){
if(bau15(p, args, 0))
SubserverSystem.sendToBau15(p, p.getUniqueId());
else
SubserverSystem.sendToBauServer(p, p.getUniqueId());
return;
}
switch(command[1].toLowerCase()){
switch(args[0].toLowerCase()){
case "ws":
case "warship":
case "12":
@ -72,52 +72,44 @@ public class BauCommand {
SubserverSystem.sendToBau15paper(p, p.getUniqueId());
break;
case "addmember":
addmember(p, command);
addmember(p, args);
break;
case "tp":
case "teleport":
teleport(p, command);
teleport(p, args);
break;
case "info":
if (bau != null) {
e.setCancelled(false);
}
p.chat("/bauinfo");
break;
case "togglewe":
if(ownBau && command.length > 2)
e.setCancelled(false);
else
togglewe(p, command);
togglewe(p, args);
break;
case "toggleworld":
if(ownBau && command.length > 2)
e.setCancelled(false);
else
toggleworld(p, command);
toggleworld(p, args);
break;
case "delmember":
delmember(p, command);
delmember(p, args);
break;
case "resetall":
case "delete":
delete(p, command);
delete(p, args);
break;
case "testarena":
case "test":
testarena(p, command);
testarena(p, args);
break;
default:
HelpCommand.sendBauHelp(p);
}
}
private static void addmember(ProxiedPlayer p, String[] command){
if (command.length == 2) {
private static void addmember(ProxiedPlayer p, String[] args){
if (args.length == 1) {
Message.send("BAU_ADDMEMBER_USAGE", p);
return;
}
SteamwarUser target = SteamwarUser.get(command[2]);
SteamwarUser target = SteamwarUser.get(args[1]);
if (target == null) {
Message.send("UNKNOWN_PLAYER", p);
return;
@ -137,13 +129,13 @@ public class BauCommand {
Message.send("BAU_ADDMEMBER_ADDED_TARGET", z, p.getName());
}
private static void teleport(ProxiedPlayer p, String[] command){
if (command.length == 2) {
private static void teleport(ProxiedPlayer p, String[] args){
if (args.length == 1) {
Message.send("BAU_TP_USAGE", p);
return;
}
SteamwarUser worldOwner = SteamwarUser.get(command[2]);
SteamwarUser worldOwner = SteamwarUser.get(args[1]);
if (worldOwner == null) {
Message.send("UNKNOWN_PLAYER", p);
return;
@ -153,7 +145,7 @@ public class BauCommand {
return;
}
if(bau15(p, command, 3))
if(bau15(p, args, 2))
SubserverSystem.sendToBau15(p, worldOwner.getUuid());
else
SubserverSystem.sendToBauServer(p, worldOwner.getUuid());
@ -183,31 +175,43 @@ public class BauCommand {
}
}
private static void togglewe(ProxiedPlayer p, String[] command){
BauweltMember target = toggle(p, command, "togglewe");
private static void togglewe(ProxiedPlayer p, String[] args){
BauweltMember target = toggle(p, args, "togglewe");
if(target == null)
return;
target.setWorldEdit(!target.isWorldEdit());
clearMembercache(p);
isAllowedTo(target.isWorldEdit(), p, target, "WorldEdit verwenden");
}
private static void toggleworld(ProxiedPlayer p, String[] command){
BauweltMember target = toggle(p, command, "toggleworld");
private static void toggleworld(ProxiedPlayer p, String[] args){
BauweltMember target = toggle(p, args, "toggleworld");
if(target == null)
return;
target.setWorld(!target.isWorld());
clearMembercache(p);
isAllowedTo(target.isWorld(), p, target, "Einstellungen vornehmen");
}
private static void delmember(ProxiedPlayer p, String[] command){
if (command.length == 2) {
private static void clearMembercache(ProxiedPlayer p){
for(ServerInfo info : ProxyServer.getInstance().getServers().values()){
Subserver server = Subserver.getSubserver(info);
if(server != null && server.getType() == Servertype.BAUSERVER && ((Bauserver)server).getOwner().equals(p.getUniqueId())){
info.getPlayers().stream().findAny().ifPresent(player -> new BaumemberUpdatePacket().send(player));
break;
}
}
}
private static void delmember(ProxiedPlayer p, String[] args){
if (args.length == 1) {
Message.send("BAU_DELMEMBER_USAGE", p);
return;
}
BauweltMember target = member(p, SteamwarUser.get(command[2]));
BauweltMember target = member(p, SteamwarUser.get(args[1]));
if(target == null)
return;
@ -228,13 +232,13 @@ public class BauCommand {
Message.send("BAU_DELMEMBER_DELETED", p);
}
private static void delete(ProxiedPlayer p, String[] command){
private static void delete(ProxiedPlayer p, String[] args){
SWInventory inventory = new SWInventory(p, 9, Message.parse("BAU_DELETE_GUI_NAME", p));
inventory.addItem(8, new SWItem(Message.parse("BAU_DELETE_GUI_CANCEL", p), 1), click ->
inventory.close()
);
inventory.addItem(0, new SWItem(Message.parse("BAU_DELETE_GUI_DELETE", p), 10), click -> {
if(bau15(p, command, 2)){
if(bau15(p, args, 1)){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
deleteWorld(p, BungeeCore.USERWORLDS15 + user.getId());
}else{
@ -275,8 +279,8 @@ public class BauCommand {
}
}
private static void testarena(ProxiedPlayer p, String[] command){
FightCommand.createArena(p, "/bau testarena ", command, 2, false, (player, mode, map) -> ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
private static void testarena(ProxiedPlayer p, String[] args){
FightCommand.createArena(p, "/bau testarena ", args, 1, false, (player, mode, map) -> ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
stopBauserver(p);
SubserverSystem.startTestServer(p, mode, map, 0, 0);
}));
@ -296,13 +300,13 @@ public class BauCommand {
return target;
}
private static BauweltMember toggle(ProxiedPlayer p, String[] command, String subcommand){
if (command.length == 2) {
private static BauweltMember toggle(ProxiedPlayer p, String[] args, String subcommand){
if (args.length == 1) {
Message.send("BAU_MEMBER_TOGGLE_USAGE", p, subcommand);
return null;
}
SteamwarUser member = SteamwarUser.get(command[2]);
SteamwarUser member = SteamwarUser.get(args[1]);
return member(p, member);
}

Datei anzeigen

@ -25,6 +25,7 @@ public class PacketIdManager {
public static final byte PING_PACKET = 0x01;
public static final byte TABLIST_NAME = 0x02;
public static final byte PREPARE_SCHEM = 0x03;
public static final byte BAUMEMBER_UPDATE = 0x04;
//0x1(X) Bungee Inventory
public static final byte INVENTORY_PACKET = 0x10;

Datei anzeigen

@ -0,0 +1,36 @@
/*
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.comms.packets;
import com.google.common.io.ByteArrayDataOutput;
import de.steamwar.bungeecore.comms.BungeePacket;
import de.steamwar.bungeecore.comms.PacketIdManager;
public class BaumemberUpdatePacket extends BungeePacket {
@Override
public int getId() {
return PacketIdManager.BAUMEMBER_UPDATE;
}
@Override
public void writeVars(ByteArrayDataOutput byteArrayDataOutput) {
// empty
}
}

Datei anzeigen

@ -23,7 +23,6 @@ import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.commands.BauCommand;
import de.steamwar.bungeecore.commands.TpCommand;
import de.steamwar.bungeecore.comms.packets.PingPacket;
import de.steamwar.bungeecore.sql.SteamwarUser;
@ -77,11 +76,6 @@ public class ChatListener extends BasicListener {
}
switch(command[0].toLowerCase()){
case "/bau":
case "/b":
case "/gs":
BauCommand.onBau(e, command);
break;
case "/bc":
case "/bauchat":
case "/local":