diff --git a/pom.xml b/pom.xml index b639489..9cb7306 100644 --- a/pom.xml +++ b/pom.xml @@ -34,9 +34,9 @@ - dev.folia - folia-api - 1.19.4-R0.1-SNAPSHOT + io.papermc.paper + paper-api + 1.20.2-R0.1-SNAPSHOT provided @@ -54,7 +54,7 @@ de.fanta.challenges Challenges - 1.19 + 0.0.1 provided @@ -75,12 +75,6 @@ provided - de.cubeside.CubesideNPCs - CubesideNPCs - 0.0.2-Challenge-Test - provided - - de.iani.cubeside PlayerUUIDCache 2.0.0-SNAPSHOT @@ -93,12 +87,6 @@ provided - fr.cleymax - signgui - 1.1.0 - provided - - de.tr7zw item-nbt-api-plugin 2.10.0-SNAPSHOT @@ -115,35 +103,15 @@ org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - ${project.groupId}.Challenges - - - - - - - - org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.3.0 ${project.artifactId} maven-compiler-plugin - 3.8.1 + 3.11.0 17 diff --git a/src/main/java/de/fanta/challengesjoinentities/Server.java b/src/main/java/de/fanta/challengesjoinentities/Server.java index 5b13d8d..9851819 100644 --- a/src/main/java/de/fanta/challengesjoinentities/Server.java +++ b/src/main/java/de/fanta/challengesjoinentities/Server.java @@ -125,7 +125,6 @@ public void load(Player p, String serverTypeDir, String targetDir, String ServerVersion) { plugin.getScheduler().runAsync(() -> { - //File serverFolder = new File("/home/minecraft/Server/" + this.dir); File serverFolder = new File(plugin.getServerFolderPath().toFile(), this.dir); File configs = new File(serverFolder, "/plugins/Challenges"); File end = new File(serverFolder, "/world_the_end"); @@ -133,7 +132,6 @@ File world = new File(serverFolder, "/world"); File mlgworld = new File(serverFolder, "/mlg_challenge"); File serverJar = new File(serverFolder, "/paper.jar"); - //File saveServerJar = new File("/home/minecraft/ServerJars/" + ServerVersion + "/paper.jar"); File saveServerJar = new File(plugin.getServerJarsPath().toFile(), ServerVersion + "/paper.jar"); File saveend; File savenether; @@ -142,25 +140,15 @@ if (!serverTypeDir.equals("Adventure-Maps")) { - /*saveend = new File("/home/minecraft/" + serverTypeDir + "/" + targetDir + "/world_the_end"); - savenether = new File("/home/minecraft/" + serverTypeDir + "/" + targetDir + "/world_nether"); - saveworld = new File("/home/minecraft/" + serverTypeDir + "/" + targetDir + "/world"); - saveconfigs = new File("/home/minecraft/" + serverTypeDir + "/" + targetDir + "/Challenges");*/ - saveend = new File(plugin.getChallengeSavePath().toFile(), targetDir + "/world_the_end"); savenether = new File(plugin.getChallengeSavePath().toFile(), targetDir + "/world_nether"); saveworld = new File(plugin.getChallengeSavePath().toFile(), targetDir + "/world"); saveconfigs = new File(plugin.getChallengeSavePath().toFile(), targetDir + "/Challenges"); } else { - /*saveend = new File("/home/storagebox/" + serverTypeDir + "/" + targetDir + "/world_the_end"); - savenether = new File("/home/storagebox/" + serverTypeDir + "/" + targetDir + "/world_nether"); - saveworld = new File("/home/storagebox/" + serverTypeDir + "/" + targetDir + "/world"); - saveconfigs = new File("/home/storagebox/" + serverTypeDir + "/" + targetDir + "/Challenges");*/ - - saveend = new File(plugin.getAdventureSavePath().toFile(), targetDir + "/world_the_end"); - savenether = new File(plugin.getAdventureSavePath().toFile(), targetDir + "/world_nether"); - saveworld = new File(plugin.getAdventureSavePath().toFile(), targetDir + "/world"); - saveconfigs = new File(plugin.getAdventureSavePath().toFile(), targetDir + "/Challenges"); + saveend = new File(plugin.getAdventureMapsPath().toFile(), targetDir + "/world_the_end"); + savenether = new File(plugin.getAdventureMapsPath().toFile(), targetDir + "/world_nether"); + saveworld = new File(plugin.getAdventureMapsPath().toFile(), targetDir + "/world"); + saveconfigs = new File(plugin.getAdventureMapsPath().toFile(), targetDir + "/Challenges"); } ChatUtil.sendNormalMessage(p, "Versuche Map zu laden!"); @@ -187,13 +175,8 @@ copyMap.put(savenether, nether); copyMap.put(saveend, end); moveFolderWithProgress(copyMap, p); - //FileUtils.copyFile(saveServerJar, serverJar); - //FileUtils.copyDirectory(saveconfigs, configs); - //FileUtils.copyDirectory(saveworld, world); - //FileUtils.copyDirectory(savenether, nether); - //FileUtils.copyDirectory(saveend, end); - //File serverConfigFile = new File("/home/minecraft/Server/" + this.dir + "/plugins/Challenges/serverconfig.yml"); + File serverConfigFile = new File(plugin.getServerFolderPath().toFile(), this.dir + "/plugins/Challenges/serverconfig.yml"); YamlConfiguration serverConfig = new YamlConfiguration(); serverConfig.load(serverConfigFile); @@ -320,7 +303,6 @@ e.printStackTrace(); } String configServerVersion = serverConfiguration.getString("serverversion"); - //File serverversionfolder = new File("/home/minecraft/ServerJars/" + configServerVersion); if (configServerVersion != null) { File serverversionfolder = new File(plugin.getServerJarsPath().toFile(), configServerVersion); if (serverversionfolder.isDirectory()) { diff --git a/src/main/java/de/fanta/challengesjoinentities/listeners/PlayerListener.java b/src/main/java/de/fanta/challengesjoinentities/listeners/PlayerListener.java index d840940..58aceec 100644 --- a/src/main/java/de/fanta/challengesjoinentities/listeners/PlayerListener.java +++ b/src/main/java/de/fanta/challengesjoinentities/listeners/PlayerListener.java @@ -6,8 +6,11 @@ import de.iani.cubesideutils.bukkit.plugin.api.UtilsApiBukkit; import de.iani.cubesideutils.plugin.api.PlayerData; import de.speedy64.globalport.GlobalApi; +import de.speedy64.globalport.data.GPLocation; +import de.speedy64.globalport.tabcomplete.GlobalPortLocationsTabComplete; import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.entity.Entity; @@ -26,6 +29,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.persistence.PersistentDataType; import org.bukkit.util.Vector; +import org.spigotmc.event.player.PlayerSpawnLocationEvent; import java.util.Collection; @@ -60,20 +64,23 @@ meta.getPersistentDataContainer().set(namespacedKey, PersistentDataType.STRING, "backitem"); itemStack.setItemMeta(meta); e.getPlayer().getInventory().setItem(8, itemStack); + } - + @EventHandler + public void onPlayerSpawn(PlayerSpawnLocationEvent e) { plugin.getScheduler().runDelayedOnEntity(e.getPlayer(), () -> { PlayerData data = UtilsApiBukkit.getInstance().getPlayerData(e.getPlayer()); if (data.getLastJoin() + (10 * 1000) > System.currentTimeMillis()) { String hosteName = CubesideUtilsBukkit.getInstance().getPlayerData(e.getPlayer()).getHostName().toLowerCase(); if (hosteName.startsWith("challenge")) { - GlobalApi.portOnlinePlayerToLocation(e.getPlayer().getName(), "challenge"); + Location location = GPLocation.getLocation("challenge").getLocation(); + e.getPlayer().teleportAsync(location); } else if (hosteName.startsWith("adventure")) { - GlobalApi.portOnlinePlayerToLocation(e.getPlayer().getName(), "adventure"); + Location location = GPLocation.getLocation("adventure").getLocation(); + e.getPlayer().teleportAsync(location); } } }, 1L); - } @EventHandler