forked from SteamWar/SteamWar
Adapt to new server, unlock old versions again
This commit is contained in:
@@ -19,22 +19,15 @@
|
||||
|
||||
package de.steamwar.providers;
|
||||
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BauServerInfo {
|
||||
private static Integer bauOwner = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
bauOwner = Integer.parseInt(Bukkit.getWorlds().get(0).getName());
|
||||
} catch (NumberFormatException e) {
|
||||
try {
|
||||
bauOwner = SteamwarUser.get(UUID.fromString(Bukkit.getWorlds().get(0).getName())).getId();
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
}
|
||||
} catch (NumberFormatException ignored) {}
|
||||
}
|
||||
|
||||
public static Integer getOwnerId() {
|
||||
|
||||
@@ -37,11 +37,11 @@ if __name__ == "__main__":
|
||||
with open(configfile, 'r') as file:
|
||||
gamemode = yaml.load(file)
|
||||
|
||||
builderworld = path.expanduser(f'~/builder{version}/{worldname}')
|
||||
builderworld = path.expanduser(f'/worlds/builder{version}/{worldname}')
|
||||
arenaworld = f'/servers/{gamemode["Server"]["Folder"]}/arenas/{worldname}'
|
||||
|
||||
if path.exists(arenaworld):
|
||||
backupworld = path.expanduser(f'~/backup/arenas/{datetime.datetime.now()}-{worldname}-{version}.tar.xz')
|
||||
backupworld = path.expanduser(f'/mnt/storage/backup/arenas/{datetime.datetime.now()}-{worldname}-{version}.tar.xz')
|
||||
with tarfile.open(backupworld, 'w:xz') as tar:
|
||||
tar.add(arenaworld, arcname=worldname)
|
||||
|
||||
|
||||
@@ -46,13 +46,17 @@ public class ServerStarter {
|
||||
private static final Portrange ARENA_PORTS = VelocityCore.MAIN_SERVER ? new Portrange(3000, 3100) : (VelocityCore.get().getConfig().isEventmode() ? new Portrange(4000, 5000) : BAU_PORTS);
|
||||
|
||||
public static final String SERVER_PATH = "/servers/";
|
||||
private static final String USER_HOME = System.getProperty("user.home") + "/";
|
||||
private static final String EVENT_PATH = USER_HOME + "event/";
|
||||
public static final String TEMP_WORLD_PATH = USER_HOME + "arenaserver/";
|
||||
|
||||
public static final String TUTORIAL_PATH = "/worlds/tutorials/";
|
||||
public static final String WORLDS_BASE_PATH = "/worlds/userworlds";
|
||||
public static final String BUILDER_BASE_PATH = "/worlds/builder";
|
||||
private static final String TMP_DATA = System.getProperty("user.home") + "/";
|
||||
private static final String EVENT_PATH = TMP_DATA + "event/";
|
||||
public static final String TEMP_WORLD_PATH = TMP_DATA + "arenaserver/";
|
||||
|
||||
private static final String WORLDS_FOLDER = "/worlds";
|
||||
public static final String TUTORIAL_PATH = WORLDS_FOLDER + "/tutorials/";
|
||||
public static final String WORLDS_BASE_PATH = WORLDS_FOLDER + "/userworlds";
|
||||
public static final String BUILDER_BASE_PATH = WORLDS_FOLDER + "/builder";
|
||||
|
||||
private static final String WORLDS_STORAGE_BASE_PATH = "/mnt/storage/worlds/userworlds";
|
||||
|
||||
private File directory = null;
|
||||
private String worldDir = null;
|
||||
@@ -149,15 +153,21 @@ public class ServerStarter {
|
||||
this.version = version;
|
||||
directory = version.getServerDirectory("Bau");
|
||||
worldDir = version.getWorldFolder(WORLDS_BASE_PATH);
|
||||
worldName = version != ServerVersion.SPIGOT_12 ? String.valueOf(SteamwarUser.get(owner).getId()) : owner.toString();
|
||||
worldName = String.valueOf(SteamwarUser.get(owner).getId());
|
||||
checkpoint = true;
|
||||
|
||||
build(owner);
|
||||
|
||||
worldSetup = () -> {
|
||||
File world = new File(worldDir, worldName);
|
||||
if (!world.exists())
|
||||
if (!world.exists()) {
|
||||
File storage = new File(version.getWorldFolder(WORLDS_STORAGE_BASE_PATH), worldName);
|
||||
|
||||
if(storage.exists())
|
||||
node.execute("mv", storage.getPath(), world.getPath());
|
||||
else
|
||||
copyWorld(node, new File(directory, "Bauwelt").getPath(), world.getPath());
|
||||
}
|
||||
};
|
||||
|
||||
// Send players to existing server
|
||||
|
||||
@@ -65,7 +65,7 @@ public enum ServerVersion {
|
||||
chatMap.put("mwg", ServerVersion.PAPER_20);
|
||||
chatMap.put("miniwargear", ServerVersion.PAPER_20);
|
||||
|
||||
/*chatMap.put("19", ServerVersion.PAPER_19);
|
||||
chatMap.put("19", ServerVersion.PAPER_19);
|
||||
chatMap.put("1.19", ServerVersion.PAPER_19);
|
||||
chatMap.put("1.19.2", ServerVersion.PAPER_19);
|
||||
|
||||
@@ -75,7 +75,7 @@ public enum ServerVersion {
|
||||
|
||||
chatMap.put("12", ServerVersion.SPIGOT_12);
|
||||
chatMap.put("1.12", ServerVersion.SPIGOT_12);
|
||||
chatMap.put("1.12.2", ServerVersion.SPIGOT_12);*/
|
||||
chatMap.put("1.12.2", ServerVersion.SPIGOT_12);
|
||||
}
|
||||
|
||||
public static ServerVersion get(String chat) {
|
||||
|
||||
@@ -214,7 +214,7 @@ public class BauCommand extends SWCommand {
|
||||
public void delete(PlayerChatter sender, @OptionalValue(value = "", onlyUINIG = true) ServerVersion version) {
|
||||
SWInventory inventory = new SWInventory(sender, 9, new Message("BAU_DELETE_GUI_NAME"));
|
||||
inventory.addItem(0, new SWItem(new Message("BAU_DELETE_GUI_DELETE"), 10), click -> {
|
||||
String world = version.getWorldFolder(ServerStarter.WORLDS_BASE_PATH) + (version != ServerVersion.SPIGOT_12 ? sender.user().getId() : sender.user().getUUID().toString());
|
||||
String world = version.getWorldFolder(ServerStarter.WORLDS_BASE_PATH) + sender.user().getId();
|
||||
|
||||
VelocityCore.schedule(() -> {
|
||||
Bauserver subserver = Bauserver.get(sender.user().getUUID());
|
||||
|
||||
@@ -90,7 +90,7 @@ public class BuilderCloudCommand extends SWCommand {
|
||||
}
|
||||
|
||||
VelocityCore.schedule(() -> {
|
||||
VelocityCore.local.execute("/binarys/deployarena.py", arenaMode.getConfig(), Integer.toString(version.getVersionSuffix()), map);
|
||||
VelocityCore.local.execute("deployarena.py", arenaMode.getConfig(), Integer.toString(version.getVersionSuffix()), map);
|
||||
ArenaMode.init();
|
||||
sender.system("BUILDERCLOUD_DEPLOY_FINISHED");
|
||||
}).schedule();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
build:
|
||||
- "printenv"
|
||||
- "./gradlew build --no-daemon"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user