diff --git a/README.md b/README.md index 3509f83..6315dfa 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ com.github.Be4rJP Parallel - v1.0.8 + v1.0.9 provided ``` diff --git a/pom.xml b/pom.xml index 277ea15..be5c385 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ be4rjp Parallel - 1.0.8 + 1.0.9 jar Parallel diff --git a/src/main/java/be4rjp/parallel/Config.java b/src/main/java/be4rjp/parallel/Config.java index 36a4024..5ba665e 100644 --- a/src/main/java/be4rjp/parallel/Config.java +++ b/src/main/java/be4rjp/parallel/Config.java @@ -8,8 +8,12 @@ public class Config { private static WorkType workType = WorkType.NORMAL; + private static boolean performanceMode = false; + public static WorkType getWorkType() {return workType;} + public static boolean isPerformanceMode() {return performanceMode;} + public static void load(){ File file = new File("plugins/Parallel", "config.yml"); file.getParentFile().mkdirs(); @@ -22,6 +26,7 @@ public static void load(){ YamlConfiguration yml = YamlConfiguration.loadConfiguration(file); if(yml.contains("work-type")) workType = WorkType.valueOf(yml.getString("work-type")); + if(yml.contains("performance-mode")) performanceMode = yml.getBoolean("performance-mode"); } public enum WorkType{ diff --git a/src/main/java/be4rjp/parallel/Parallel.java b/src/main/java/be4rjp/parallel/Parallel.java index b00830d..c18f0ae 100644 --- a/src/main/java/be4rjp/parallel/Parallel.java +++ b/src/main/java/be4rjp/parallel/Parallel.java @@ -4,6 +4,7 @@ import be4rjp.parallel.command.parallelCommandExecutor; import be4rjp.parallel.structure.ParallelStructure; import be4rjp.parallel.structure.StructureData; +import org.bukkit.Bukkit; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -25,10 +26,12 @@ public void onEnable() { pluginManager.registerEvents(new EventListener(), this); - //Register command executors - getLogger().info("Registering command executors..."); - getCommand("parallel").setExecutor(new parallelCommandExecutor()); - getCommand("parallel").setTabCompleter(new parallelCommandExecutor()); + if(Bukkit.getPluginManager().getPlugin("WorldEdit") != null) { + //Register command executors + getLogger().info("Registering command executors..."); + getCommand("parallel").setExecutor(new parallelCommandExecutor()); + getCommand("parallel").setTabCompleter(new parallelCommandExecutor()); + } //For cinema4c extensions diff --git a/src/main/java/be4rjp/parallel/nms/manager/ChunkPacketManager.java b/src/main/java/be4rjp/parallel/nms/manager/ChunkPacketManager.java index 3102ecf..f5fe852 100644 --- a/src/main/java/be4rjp/parallel/nms/manager/ChunkPacketManager.java +++ b/src/main/java/be4rjp/parallel/nms/manager/ChunkPacketManager.java @@ -1,5 +1,6 @@ package be4rjp.parallel.nms.manager; +import be4rjp.parallel.Config; import be4rjp.parallel.ParallelWorld; import be4rjp.parallel.nms.NMSUtil; import be4rjp.parallel.nms.PacketHandler; @@ -78,7 +79,7 @@ public void run() { ChunkLocation chunkLocation = new ChunkLocation(player.getWorld(), chunkPosition.x << 4, chunkPosition.z << 4); Object editedPacket = parallelWorld.getEditedPacketForChunkMap().get(chunkLocation); - if(editedPacket != null){ + if(editedPacket != null && Config.isPerformanceMode()){ packetHandler.doWrite(channelHandlerContext, editedPacket, channelPromise); return; } diff --git a/src/main/java/be4rjp/parallel/nms/manager/LightUpdatePacketManager.java b/src/main/java/be4rjp/parallel/nms/manager/LightUpdatePacketManager.java index c78a241..509f479 100644 --- a/src/main/java/be4rjp/parallel/nms/manager/LightUpdatePacketManager.java +++ b/src/main/java/be4rjp/parallel/nms/manager/LightUpdatePacketManager.java @@ -1,5 +1,6 @@ package be4rjp.parallel.nms.manager; +import be4rjp.parallel.Config; import be4rjp.parallel.ParallelWorld; import be4rjp.parallel.nms.NMSUtil; import be4rjp.parallel.nms.PacketHandler; @@ -119,7 +120,7 @@ public void run() { ChunkLocation chunkLocation = new ChunkLocation(player.getWorld(), chunkPosition.x << 4, chunkPosition.z << 4); Object editedPacket = parallelWorld.getEditedPacketForLightMap().get(chunkLocation); - if(editedPacket != null){ + if(editedPacket != null && Config.isPerformanceMode()){ packetHandler.doWrite(channelHandlerContext, editedPacket, channelPromise); return; } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f8b057f..6e40ff1 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -3,4 +3,10 @@ # NORMAL or ONLY_ONE # ONLY_ONEに設定した場合は全てのプレイヤーに対して同じParallelWorldが使われるようになります -work-type: NORMAL \ No newline at end of file +work-type: NORMAL + + +# パフォーマンスモードを使用するかどうかの設定 +# このプラグイン以外でブロックの設置が行われる可能性のある場合は false 推奨 + +performance-mode: false \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c21918d..1c613c8 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -2,8 +2,7 @@ name: Parallel version: ${project.version} main: be4rjp.parallel.Parallel api-version: 1.15 -softdepend: [Multiverse-Core, Cinema4C] -depend: [WorldEdit] +softdepend: [WorldEdit, Multiverse-Core, Cinema4C] #-------------------------------------- commands: parallel: