Added BungeeCore.properties message Added BungeeCore_de.properties message Added ServerStarter for the BuilderCloud
Dieser Commit ist enthalten in:
Ursprung
7e2f1f244d
Commit
229cf77035
@ -149,6 +149,7 @@ public class BungeeCore extends Plugin {
|
||||
new RankCommand();
|
||||
new LocalCommand();
|
||||
new SetLocaleCommand();
|
||||
new BuilderCloudCommand();
|
||||
|
||||
// Punishment Commands:
|
||||
new PunishmentCommand("ban", Punishment.PunishmentType.Ban);
|
||||
|
@ -28,6 +28,9 @@ public class ServerStarter {
|
||||
public static final String TUTORIAL_PATH = BACKBONE + "tutorials/";
|
||||
public static final String WORLDS19_PATH = BACKBONE + "userworlds19/";
|
||||
|
||||
public static final String BUILDER15_PATH = BACKBONE + "builder15/";
|
||||
public static final String BUILDER19_PATH = BACKBONE + "builder19/";
|
||||
|
||||
private File directory = null;
|
||||
private String worldDir = null;
|
||||
|
||||
@ -48,6 +51,14 @@ public class ServerStarter {
|
||||
private final Set<ProxiedPlayer> playersToSend = new HashSet<>();
|
||||
private final Map<String, String> arguments = new HashMap<>();
|
||||
|
||||
public ServerStarter builderCloud(String serverJar, String map) {
|
||||
this.serverJar = serverJar;
|
||||
this.worldName = map;
|
||||
|
||||
this.directory = new File(SERVER_PATH);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ServerStarter arena(ArenaMode mode, String map) {
|
||||
portrange = ARENA_PORTS;
|
||||
serverNameProvider = port -> mode.getDisplayName() + (port - portrange.start);
|
||||
@ -287,4 +298,4 @@ public class ServerStarter {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
72
src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java
Normale Datei
72
src/de/steamwar/bungeecore/commands/BuilderCloudCommand.java
Normale Datei
@ -0,0 +1,72 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.ServerStarter;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class BuilderCloudCommand extends SWCommand {
|
||||
|
||||
private final Map<String, String> versionMap = new HashMap<>();
|
||||
private final Map<String, String> pathMap = new HashMap<>();
|
||||
|
||||
public BuilderCloudCommand() {
|
||||
super("buildercloud", "bungeecore.server.team");
|
||||
|
||||
versionMap.put("1.19", "spigot-1.19.jar");
|
||||
versionMap.put("19", "spigot-1.19.jar");
|
||||
versionMap.put("1.15", "spigot-1.15.2.jar");
|
||||
versionMap.put("15", "spigot-1.15.2.jar");
|
||||
versionMap.put("1.15.2", "spigot-1.15.2.jar");
|
||||
|
||||
pathMap.put("19", ServerStarter.BUILDER19_PATH);
|
||||
pathMap.put("1.19", ServerStarter.BUILDER19_PATH);
|
||||
pathMap.put("15", ServerStarter.BUILDER15_PATH);
|
||||
pathMap.put("1.15", ServerStarter.BUILDER15_PATH);
|
||||
pathMap.put("1.15.2", ServerStarter.BUILDER15_PATH);
|
||||
}
|
||||
|
||||
// /buildercloud [version] [map]
|
||||
|
||||
@Register(description = "BUILDERCLOUD_USAGE")
|
||||
public void genericCommand(ProxiedPlayer player, @StaticValue({"19", "1.19", "15", "1.15.2", "1.15"}) @ErrorMessage("BUILDERCLOUD_VERSION") String version, File map) {
|
||||
String jar = this.versionMap.get(version);
|
||||
new ServerStarter().builderCloud(jar, map.getName()).start();
|
||||
}
|
||||
|
||||
@Cached(global = true)
|
||||
@ClassMapper(value = File.class, local = true)
|
||||
private TypeMapper<File> mapTypeMapper() {
|
||||
|
||||
return new TypeMapper<File>() {
|
||||
@Override
|
||||
public File map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
String folder = pathMap.get(previousArguments[previousArguments.length - 1]);
|
||||
|
||||
if(folder == null)
|
||||
return null;
|
||||
|
||||
File map = new File(folder, s);
|
||||
if(!map.exists() || !map.isDirectory())
|
||||
return null;
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender sender, String[] previousArguments, String s) {
|
||||
String folder = pathMap.get(previousArguments[previousArguments.length - 1]);
|
||||
|
||||
if(folder == null)
|
||||
return null;
|
||||
|
||||
return Arrays.asList(Objects.requireNonNull(new File(folder).list()));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -631,4 +631,8 @@ FIGHT_MERGE_OFFLINE=§7The proposed arena has been terminated in the meantime, a
|
||||
FIGHT_MERGE_INFO=§e{0}§8: §e{1}
|
||||
|
||||
#Locale Locking
|
||||
LOCK_LOCALE_CHANGED=§aLanguage saved
|
||||
LOCK_LOCALE_CHANGED=§aLanguage saved
|
||||
|
||||
#Builder Cloud
|
||||
BUILDERCLOUD_USAGE=§8/§7buildercloud §8[§eversion§8] §8[§emap§8]
|
||||
BUILDERCLOUD_VERSION=§cUnknown version.
|
@ -609,4 +609,8 @@ FIGHT_MERGE_INFO_LORE_1=§8Von: §e{0}
|
||||
FIGHT_MERGE_OFFLINE=§7Die vorgeschlagene Arena wurde in der Zwischenzeit beendet, es wird eine neue Arena gestartet.
|
||||
|
||||
#Locale Locking
|
||||
LOCK_LOCALE_CHANGED=§aSprache gespeichert
|
||||
LOCK_LOCALE_CHANGED=§aSprache gespeichert
|
||||
|
||||
#Builder Cloud
|
||||
BUILDERCLOUD_USAGE=§8/§7buildercloud §8[§eVersion§8] §8[§eWelt§8]
|
||||
BUILDERCLOUD_VERSION=§cUnbekannte Version.
|
In neuem Issue referenzieren
Einen Benutzer sperren