Fixed for Spigot, added error reporting

This commit is contained in:
Norbi Peti 2018-01-08 21:48:45 +01:00
parent e25b3740b6
commit 509fe99294
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 77 additions and 73 deletions

12
pom.xml
View file

@ -40,15 +40,21 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.spigotmc</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>spigot</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>ButtonCore</artifactId>
<version>master-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>

View file

@ -11,22 +11,20 @@ import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkPopulateEvent; import org.bukkit.event.world.ChunkPopulateEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.TBMCCoreAPI;
import net.minecraft.server.v1_12_R1.ChunkRegionLoader; import net.minecraft.server.v1_12_R1.ChunkRegionLoader;
import net.minecraft.server.v1_12_R1.ExceptionWorldConflict; import net.minecraft.server.v1_12_R1.ExceptionWorldConflict;
public class Main extends JavaPlugin implements Listener public class Main extends JavaPlugin implements Listener {
{ public void onEnable() {
public void onEnable() TBMCCoreAPI.RegisterEventsForExceptions(this, this);
{
getServer().getPluginManager().registerEvents(this, this);
} }
/*------------------------------------------------------------*/ /*------------------------------------------------------------*/
private final ChunkRegionLoader chunkRegionLoader = private final ChunkRegionLoader chunkRegionLoader =
new ChunkRegionLoader(this.getDataFolder(), ((CraftServer) Bukkit.getServer()) new ChunkRegionLoader(this.getDataFolder(),
.getServer() ((CraftServer) Bukkit.getServer()).getServer().dataConverterManager);
.dataConverterManager);
/*------------------------------------------------------------*/ /*------------------------------------------------------------*/
@ -36,6 +34,6 @@ public class Main extends JavaPlugin implements Listener
{ {
if (event.getWorld().getName().equals("world")) if (event.getWorld().getName().equals("world"))
chunkRegionLoader.saveChunk(((CraftWorld) event.getWorld()).getHandle(), chunkRegionLoader.saveChunk(((CraftWorld) event.getWorld()).getHandle(),
((CraftChunk) event.getChunk()).getHandle()); ((CraftChunk) event.getChunk()).getHandle(), false);
} }
} }