geforkt von SteamWar/BungeeCore
1.18 Bau
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
d2d8e8af6d
Commit
bc8db04edf
@ -26,6 +26,7 @@ public class ServerStarter {
|
|||||||
private static final String EVENT_PATH = BACKBONE + "event/";
|
private static final String EVENT_PATH = BACKBONE + "event/";
|
||||||
public static final String TEMP_WORLD_PATH = BACKBONE + "arenaserver/";
|
public static final String TEMP_WORLD_PATH = BACKBONE + "arenaserver/";
|
||||||
public static final String TUTORIAL_PATH = BACKBONE + "tutorials/";
|
public static final String TUTORIAL_PATH = BACKBONE + "tutorials/";
|
||||||
|
public static final String WORLDS18_PATH = BACKBONE + "userworlds18/";
|
||||||
|
|
||||||
private File directory = null;
|
private File directory = null;
|
||||||
private String worldDir = null;
|
private String worldDir = null;
|
||||||
@ -100,6 +101,14 @@ public class ServerStarter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServerStarter build18(UUID owner) {
|
||||||
|
directory = new File(SERVER_PATH, "Bau18");
|
||||||
|
worldDir = WORLDS18_PATH;
|
||||||
|
worldName = String.valueOf(SteamwarUser.get(owner).getId());
|
||||||
|
buildWithWorld(owner, new File(directory, "Bauwelt").getPath());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ServerStarter build15(UUID owner) {
|
public ServerStarter build15(UUID owner) {
|
||||||
directory = new File(SERVER_PATH, "Bau15");
|
directory = new File(SERVER_PATH, "Bau15");
|
||||||
worldDir = BungeeCore.USERWORLDS15;
|
worldDir = BungeeCore.USERWORLDS15;
|
||||||
|
@ -33,7 +33,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|||||||
public class BauCommand extends BasicCommand {
|
public class BauCommand extends BasicCommand {
|
||||||
|
|
||||||
public BauCommand(){
|
public BauCommand(){
|
||||||
super("bau", null, "b", "gs");
|
super("bau", null, "b", "build", "gs");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,58 +44,44 @@ public class BauCommand extends BasicCommand {
|
|||||||
|
|
||||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
ProxiedPlayer p = (ProxiedPlayer) sender;
|
||||||
|
|
||||||
if(args.length == 0){
|
versionSelector(p, args, 0,
|
||||||
(bau15(p, args, 0) ? new ServerStarter().build15(p.getUniqueId()) : new ServerStarter().build12(p.getUniqueId())).send(p).start();
|
() -> new ServerStarter().build18(p.getUniqueId()).send(p).start(),
|
||||||
return;
|
() -> new ServerStarter().build15(p.getUniqueId()).send(p).start(),
|
||||||
}
|
() -> new ServerStarter().build12(p.getUniqueId()).send(p).start(),
|
||||||
|
() -> {
|
||||||
switch(args[0].toLowerCase()){
|
switch (args[0].toLowerCase()) {
|
||||||
case "12":
|
case "addmember":
|
||||||
case "1.12":
|
addmember(p, args);
|
||||||
new ServerStarter().build12(p.getUniqueId()).send(p).start();
|
break;
|
||||||
break;
|
case "tp":
|
||||||
case "ws":
|
case "teleport":
|
||||||
case "warship":
|
teleport(p, args);
|
||||||
case "as":
|
break;
|
||||||
case "airship":
|
case "info":
|
||||||
case "mwg":
|
p.chat("/bauinfo");
|
||||||
case "miniwargear":
|
break;
|
||||||
case "wg":
|
case "togglewe":
|
||||||
case "wargear":
|
togglewe(p, args);
|
||||||
case "15":
|
break;
|
||||||
case "1.15":
|
case "toggleworld":
|
||||||
new ServerStarter().build15(p.getUniqueId()).send(p).start();
|
toggleworld(p, args);
|
||||||
break;
|
break;
|
||||||
case "addmember":
|
case "delmember":
|
||||||
addmember(p, args);
|
delmember(p, args);
|
||||||
break;
|
break;
|
||||||
case "tp":
|
case "resetall":
|
||||||
case "teleport":
|
case "delete":
|
||||||
teleport(p, args);
|
delete(p, args);
|
||||||
break;
|
break;
|
||||||
case "info":
|
case "testarena":
|
||||||
p.chat("/bauinfo");
|
case "test":
|
||||||
break;
|
testarena(p, args);
|
||||||
case "togglewe":
|
break;
|
||||||
togglewe(p, args);
|
default:
|
||||||
break;
|
HelpCommand.sendBauHelp(p);
|
||||||
case "toggleworld":
|
}
|
||||||
toggleworld(p, args);
|
}
|
||||||
break;
|
);
|
||||||
case "delmember":
|
|
||||||
delmember(p, args);
|
|
||||||
break;
|
|
||||||
case "resetall":
|
|
||||||
case "delete":
|
|
||||||
delete(p, args);
|
|
||||||
break;
|
|
||||||
case "testarena":
|
|
||||||
case "test":
|
|
||||||
testarena(p, args);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
HelpCommand.sendBauHelp(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addmember(ProxiedPlayer p, String[] args){
|
private static void addmember(ProxiedPlayer p, String[] args){
|
||||||
@ -140,19 +126,31 @@ public class BauCommand extends BasicCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(bau15(p, args, 2) ? new ServerStarter().build15(worldOwner.getUuid()) : new ServerStarter().build12(worldOwner.getUuid())).send(p).start();
|
versionSelector(p, args, 2,
|
||||||
|
() -> new ServerStarter().build18(worldOwner.getUuid()).send(p).start(),
|
||||||
|
() -> new ServerStarter().build15(worldOwner.getUuid()).send(p).start(),
|
||||||
|
() -> new ServerStarter().build12(worldOwner.getUuid()).send(p).start(),
|
||||||
|
() -> HelpCommand.sendBauHelp(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean bau15(ProxiedPlayer p, String[] args, int pos){
|
private static void versionSelector(ProxiedPlayer p, String[] args, int pos, Runnable run18, Runnable run15, Runnable run12, Runnable runElse) {
|
||||||
if(args.length <= pos)
|
if(args.length <= pos) {
|
||||||
return p.getPendingConnection().getVersion() > 340; // Version > 1.12.2
|
int version = p.getPendingConnection().getVersion();
|
||||||
|
if(version > 340) { // Version > 1.12.2
|
||||||
|
run15.run();
|
||||||
|
} else {
|
||||||
|
run12.run();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(args[pos].toLowerCase()){
|
switch (args[pos].toLowerCase()) {
|
||||||
|
case "18":
|
||||||
|
case "1.18":
|
||||||
|
run18.run();
|
||||||
|
break;
|
||||||
case "ws":
|
case "ws":
|
||||||
case "warship":
|
case "warship":
|
||||||
case "12":
|
|
||||||
case "1.12":
|
|
||||||
return false;
|
|
||||||
case "as":
|
case "as":
|
||||||
case "airship":
|
case "airship":
|
||||||
case "mwg":
|
case "mwg":
|
||||||
@ -161,9 +159,14 @@ public class BauCommand extends BasicCommand {
|
|||||||
case "wargear":
|
case "wargear":
|
||||||
case "15":
|
case "15":
|
||||||
case "1.15":
|
case "1.15":
|
||||||
return true;
|
run15.run();
|
||||||
|
break;
|
||||||
|
case "12":
|
||||||
|
case "1.12":
|
||||||
|
run12.run();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return p.getPendingConnection().getVersion() > 340; // Version > 1.12.2
|
runElse.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,18 +228,22 @@ public class BauCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void delete(ProxiedPlayer p, String[] args){
|
private static void delete(ProxiedPlayer p, String[] args){
|
||||||
|
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||||
|
versionSelector(p, args, 1,
|
||||||
|
() -> deleteConfirmation(p, () -> deleteWorld(p, ServerStarter.WORLDS18_PATH + user.getId())),
|
||||||
|
() -> deleteConfirmation(p, () -> deleteWorld(p, BungeeCore.USERWORLDS15 + user.getId())),
|
||||||
|
() -> deleteConfirmation(p, () -> deleteWorld(p, BungeeCore.WORLD_FOLDER + p.getUniqueId().toString())),
|
||||||
|
() -> HelpCommand.sendBauHelp(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void deleteConfirmation(ProxiedPlayer p, Runnable worldDeletion) {
|
||||||
SWInventory inventory = new SWInventory(p, 9, Message.parse("BAU_DELETE_GUI_NAME", p));
|
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.addItem(8, new SWItem(Message.parse("BAU_DELETE_GUI_CANCEL", p), 1), click ->
|
||||||
inventory.close()
|
inventory.close()
|
||||||
|
);
|
||||||
|
inventory.addItem(0, new SWItem(Message.parse("BAU_DELETE_GUI_DELETE", p), 10), click ->
|
||||||
|
worldDeletion.run()
|
||||||
);
|
);
|
||||||
inventory.addItem(0, new SWItem(Message.parse("BAU_DELETE_GUI_DELETE", p), 10), click -> {
|
|
||||||
if(bau15(p, args, 1)){
|
|
||||||
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
|
||||||
deleteWorld(p, BungeeCore.USERWORLDS15 + user.getId());
|
|
||||||
}else{
|
|
||||||
deleteWorld(p, BungeeCore.WORLD_FOLDER + p.getUniqueId().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
inventory.open();
|
inventory.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren