mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-12-01 13:13:21 +01:00
Removed world loading bug
Removed WorldEdit version incompatibility
This commit is contained in:
parent
0d5364a041
commit
bb316449df
27
pom.xml
27
pom.xml
@ -19,11 +19,6 @@
|
|||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
|
||||||
<version>2.6</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</reporting>
|
</reporting>
|
||||||
|
|
||||||
@ -80,7 +75,7 @@
|
|||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>we-repo</id>
|
<id>we-repo</id>
|
||||||
<url>>http://maven.sk89q.com/repo/</url>
|
<url>http://maven.sk89q.com/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!--Repo for CommandFramework-->
|
<!--Repo for CommandFramework-->
|
||||||
<repository>
|
<repository>
|
||||||
@ -132,14 +127,7 @@
|
|||||||
<!--
|
<!--
|
||||||
AsyncWorld is not in the api so I have to use a local file
|
AsyncWorld is not in the api so I have to use a local file
|
||||||
Issue: https://github.com/boy0001/FastAsyncWorldedit/issues/1060
|
Issue: https://github.com/boy0001/FastAsyncWorldedit/issues/1060
|
||||||
<dependency>
|
|
||||||
<groupId>com.boydti</groupId>
|
|
||||||
<artifactId>fawe-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>latest</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk98q.worldedit</groupId>
|
<groupId>com.sk98q.worldedit</groupId>
|
||||||
<artifactId>FastAsnycWorldEdit</artifactId>
|
<artifactId>FastAsnycWorldEdit</artifactId>
|
||||||
@ -149,9 +137,16 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
<artifactId>worldedit</artifactId>
|
<artifactId>worldedit-core</artifactId>
|
||||||
<version>6.0.0-SNAPSHOT</version>
|
<version>7.0.0-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
|
<artifactId>worldedit-bukkit</artifactId>
|
||||||
|
<version>7.0.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package de.butzlabben.world.listener;
|
package de.butzlabben.world.listener;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
|
import com.sk89q.worldedit.extension.platform.CommandManager;
|
||||||
import de.butzlabben.world.config.MessageConfig;
|
import de.butzlabben.world.config.MessageConfig;
|
||||||
import de.butzlabben.world.config.WorldConfig;
|
import de.butzlabben.world.config.WorldConfig;
|
||||||
import de.butzlabben.world.config.WorldPerm;
|
import de.butzlabben.world.config.WorldPerm;
|
||||||
import de.butzlabben.world.wrapper.WorldPlayer;
|
import de.butzlabben.world.wrapper.WorldPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -33,11 +35,14 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWorldEditCommand(String command) {
|
private boolean isWorldEditCommand(String command) {
|
||||||
|
WorldEditPlugin plugin = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||||
|
// WorldEdit plugin not foung
|
||||||
|
if(plugin == null)
|
||||||
|
return false;
|
||||||
if (command.startsWith("/")) {
|
if (command.startsWith("/")) {
|
||||||
command = command.replaceFirst("/", "");
|
command = command.replaceFirst("/", "");
|
||||||
}
|
}
|
||||||
command = command.toLowerCase();
|
|
||||||
return ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")).getWorldEdit().getPlatformManager()
|
return plugin.getCommand(command) != null;
|
||||||
.getCommandManager().getDispatcher().get(command) != null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,20 +193,21 @@ public class SystemWorld {
|
|||||||
// Move World into Server dir
|
// Move World into Server dir
|
||||||
String worlddir = PluginConfig.getWorlddir();
|
String worlddir = PluginConfig.getWorlddir();
|
||||||
File world = new File(worlddir + "/" + worldname);
|
File world = new File(worlddir + "/" + worldname);
|
||||||
if (!world.exists()) {
|
|
||||||
world = new File(Bukkit.getWorldContainer(), worldname);
|
if (world.exists()) {
|
||||||
} else {
|
// Check for duplicated worlds
|
||||||
if (new File(Bukkit.getWorldContainer(), worldname).exists()
|
File propablyExistingWorld = new File(Bukkit.getWorldContainer(), worldname);
|
||||||
&& new File(PluginConfig.getWorlddir() + "/" + worldname).exists()) {
|
if (propablyExistingWorld.exists()) {
|
||||||
System.err.println("World " + worldname + " exists twice!");
|
System.err.println("World " + worldname + " existed twice!");
|
||||||
// try {
|
try {
|
||||||
// FileUtils.deleteDirectory(new
|
FileUtils.deleteDirectory(propablyExistingWorld);
|
||||||
// File(Bukkit.getWorldContainer(), worldname));
|
} catch (IOException e) {
|
||||||
// } catch (IOException e) {
|
p.sendMessage(MessageConfig.getUnknownError());
|
||||||
// p.sendMessage(PluginConfig.getPrefix() + "§cError");
|
e.printStackTrace();
|
||||||
// e.printStackTrace();
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Move world if exists
|
||||||
try {
|
try {
|
||||||
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
FileUtils.moveDirectoryToDirectory(world, Bukkit.getWorldContainer(), false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -216,6 +217,7 @@ public class SystemWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for old named worlds
|
||||||
if (worldname.charAt(worldname.length() - 37) == ' ') {
|
if (worldname.charAt(worldname.length() - 37) == ' ') {
|
||||||
StringBuilder myName = new StringBuilder(worldname);
|
StringBuilder myName = new StringBuilder(worldname);
|
||||||
myName.setCharAt(worldname.length() - 37, '-');
|
myName.setCharAt(worldname.length() - 37, '-');
|
||||||
@ -223,6 +225,7 @@ public class SystemWorld {
|
|||||||
worldname = myName.toString();
|
worldname = myName.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WorldCreator creator = new WorldCreator(worldname);
|
WorldCreator creator = new WorldCreator(worldname);
|
||||||
|
|
||||||
String templateKey = WorldConfig.getWorldConfig(worldname).getTemplateKey();
|
String templateKey = WorldConfig.getWorldConfig(worldname).getTemplateKey();
|
||||||
|
Loading…
Reference in New Issue
Block a user