diff --git a/pom.xml b/pom.xml
index 488bea1..f5b2dfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
de.fanta.challenges
ChallengesJoinEntities
- 1.19.2
+ 0.0.1
UTF-8
UTF-8
@@ -138,7 +138,7 @@
maven-jar-plugin
3.2.0
- ${project.artifactId}-${project.version}
+ ${project.artifactId}
diff --git a/src/main/java/de/fanta/challengesjoinentities/ChallengesJoinEntities.java b/src/main/java/de/fanta/challengesjoinentities/ChallengesJoinEntities.java
index 5fcf289..8593018 100644
--- a/src/main/java/de/fanta/challengesjoinentities/ChallengesJoinEntities.java
+++ b/src/main/java/de/fanta/challengesjoinentities/ChallengesJoinEntities.java
@@ -11,6 +11,7 @@
import de.fanta.challengesjoinentities.commands.AdventureCommand.AdventureLoadCommand;
import de.fanta.challengesjoinentities.commands.AdventureCommand.AdventureLoadMapIconsCommand;
import de.fanta.challengesjoinentities.commands.AdventureCommand.AdventureMapsCommand;
+import de.fanta.challengesjoinentities.commands.AdventureCommand.AdventureStartEventServerCommand;
import de.fanta.challengesjoinentities.commands.AdventureCommand.AdventureTempCommand;
import de.fanta.challengesjoinentities.commands.AdventureCommand.AdventureTestMapCommand;
import de.fanta.challengesjoinentities.commands.AdventureCommand.ChallengeClearSavesCommand;
@@ -47,8 +48,10 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Nullable;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -78,12 +81,14 @@
private CubesideStatisticsAPI cubesideStatistics;
private Statistics statistics;
private static SignManager signManager;
+ private final List eventServerPlayerList;
public ChallengesJoinEntities() {
this.entityData = new HashMap<>();
this.entityServerMapping = new HashMap<>();
this.availableServers = new HashSet<>();
+ this.eventServerPlayerList = new ArrayList<>();
}
public static ChallengesJoinEntities getPlugin() {
@@ -135,6 +140,7 @@
adventurerouter.addCommandMapping(new AdventureLoadMapIconsCommand(this), "loadmapicons");
adventurerouter.addCommandMapping(new AdventureClearSavesCommand(), "clearoldsaves");
adventurerouter.addCommandMapping(new AdventureTempCommand(this), "temp");
+ adventurerouter.addCommandMapping(new AdventureStartEventServerCommand(this), "starteventserver");
Bukkit.getPluginManager().registerEvents(new EntityListener(this), this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
@@ -396,4 +402,8 @@
public SignManager getSignManager() {
return signManager;
}
+
+ public List getEventServerPlayerList() {
+ return eventServerPlayerList;
+ }
}
diff --git a/src/main/java/de/fanta/challengesjoinentities/Server.java b/src/main/java/de/fanta/challengesjoinentities/Server.java
index e8aadf6..0a08a95 100644
--- a/src/main/java/de/fanta/challengesjoinentities/Server.java
+++ b/src/main/java/de/fanta/challengesjoinentities/Server.java
@@ -194,10 +194,18 @@
public void start(Player player) {
ProcessBuilder processBuilder = new ProcessBuilder();
- processBuilder.command("screen", "-AmdS", player.getName(), "./start.sh").directory(new File("/home/minecraft/Server/" + this.dir));
+ boolean eventServer = false;
+ if (this.serverType == ServerType.ADVENTURE && plugin.getEventServerPlayerList().contains(player.getUniqueId())) {
+ processBuilder.command("screen", "-AmdS", player.getName(), "./event.sh").directory(new File("/home/minecraft/Server/" + this.dir));
+ plugin.getEventServerPlayerList().remove(player.getUniqueId());
+ eventServer = true;
+ } else {
+ processBuilder.command("screen", "-AmdS", player.getName(), "./start.sh").directory(new File("/home/minecraft/Server/" + this.dir));
+ }
+
try {
processBuilder.start();
- Bukkit.getLogger().info(this.serverType.toString().toLowerCase() + " Server: " + getServerfromPlayer(player).gPLocation + " wurde von " + player.getName() + " gestartet!");
+ Bukkit.getLogger().info(this.serverType.toString().toLowerCase() + (eventServer ? " Event Server: " : " Server") + getServerfromPlayer(player).gPLocation + " wurde von " + player.getName() + " gestartet!");
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureStartEventServerCommand.java b/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureStartEventServerCommand.java
new file mode 100644
index 0000000..18513e1
--- /dev/null
+++ b/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureStartEventServerCommand.java
@@ -0,0 +1,34 @@
+package de.fanta.challengesjoinentities.commands.AdventureCommand;
+
+import de.fanta.challengesjoinentities.ChallengesJoinEntities;
+import de.fanta.challengesjoinentities.ChatUtil;
+import de.fanta.challengesjoinentities.adventure.ui.CategoryUI;
+import de.iani.cubesideutils.bukkit.commands.SubCommand;
+import de.iani.cubesideutils.commands.ArgsParser;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class AdventureStartEventServerCommand extends SubCommand {
+ private final ChallengesJoinEntities plugin;
+
+ public AdventureStartEventServerCommand(ChallengesJoinEntities plugin) {
+ this.plugin = plugin;
+ }
+
+ public boolean onCommand(CommandSender sender, Command command, String alias, String commandString, ArgsParser args) {
+ if (!(sender instanceof Player p)) {
+ ChatUtil.sendErrorMessage(sender, "Du musst ein Spieler sein!");
+ return true;
+ }
+
+ plugin.getEventServerPlayerList().add(p.getUniqueId());
+ ChatUtil.sendNormalMessage(p, "Der nächste Adventure Server, denn du startest, wird als Event Server gestartet und hat somit mehr Leistung.");
+ return true;
+ }
+
+ @Override
+ public String getRequiredPermission() {
+ return "challenges.event";
+ }
+}