From 424bcc5d0534c050293114a79c1ea980ed2354e3 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 16 Aug 2016 16:41:29 +1000 Subject: [PATCH] Fix 1.8 tile sending --- .../fawe/bukkit/v1_8/BukkitQueue18R3.java | 9 ++++++ .../java/com/boydti/fawe/FaweVersion.java | 5 +++ .../java/com/boydti/fawe/command/Reload.java | 31 +++++++++++++++++-- .../fawe/object/exception/FaweException.java | 8 +++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java b/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java index e0a587ee..cd353030 100644 --- a/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java +++ b/bukkit18/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue18R3.java @@ -41,6 +41,7 @@ import net.minecraft.server.v1_8_R3.LongHashMap; import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.NibbleArray; +import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; import net.minecraft.server.v1_8_R3.PlayerChunkMap; import net.minecraft.server.v1_8_R3.ServerNBTManager; @@ -466,6 +467,14 @@ public class BukkitQueue18R3 extends BukkitQueue_0 entry : nmsChunk.getTileEntities().entrySet()) { + TileEntity tile = entry.getValue(); + Packet tilePacket = tile.getUpdatePacket(); + for (EntityPlayer player : players) { + player.playerConnection.sendPacket(tilePacket); + } + } } catch (Throwable e) { MainUtil.handleError(e); } diff --git a/core/src/main/java/com/boydti/fawe/FaweVersion.java b/core/src/main/java/com/boydti/fawe/FaweVersion.java index 555431af..56f6e218 100644 --- a/core/src/main/java/com/boydti/fawe/FaweVersion.java +++ b/core/src/main/java/com/boydti/fawe/FaweVersion.java @@ -12,4 +12,9 @@ public class FaweVersion { this.hash = Integer.parseInt(split[1], 16); this.build = Integer.parseInt(split[2]); } + + @Override + public String toString() { + return "FastAsyncWorldEdit-" + year + "." + month + "." + day + "-" + Integer.toHexString(hash) + "-" + build; + } } diff --git a/core/src/main/java/com/boydti/fawe/command/Reload.java b/core/src/main/java/com/boydti/fawe/command/Reload.java index 39990217..ba449a41 100644 --- a/core/src/main/java/com/boydti/fawe/command/Reload.java +++ b/core/src/main/java/com/boydti/fawe/command/Reload.java @@ -1,9 +1,12 @@ package com.boydti.fawe.command; import com.boydti.fawe.Fawe; +import com.boydti.fawe.FaweVersion; +import com.boydti.fawe.config.BBC; import com.boydti.fawe.object.FaweCommand; import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.util.MainUtil; +import java.util.Date; public class Reload extends FaweCommand { @@ -13,8 +16,30 @@ public class Reload extends FaweCommand { @Override public boolean execute(final FawePlayer player, final String... args) { - Fawe.get().setupConfigs(); - MainUtil.sendMessage(player, "Reloaded configuration"); - return true; + if (args.length != 1) { + BBC.COMMAND_SYNTAX.send(player, "/fawe [reload|version"); + return false; + } + switch (args[0].toLowerCase()) { + case "version": { + FaweVersion version = Fawe.get().getVersion(); + if (version == null) { + MainUtil.sendMessage(player, "No version information available."); + return false; + } + MainUtil.sendMessage(player, "Version Date: " + new Date(version.year, version.month, version.day).toLocaleString()); + MainUtil.sendMessage(player, "Version Commit: " + Integer.toHexString(version.hash)); + MainUtil.sendMessage(player, "Version Build: #" + version.build); + return true; + } + case "reload": { + Fawe.get().setupConfigs(); + MainUtil.sendMessage(player, "Reloaded (" + Fawe.get().getVersion() + ")."); + return true; + } + default: + BBC.COMMAND_SYNTAX.send(player, "/fawe [reload|version]"); + return false; + } } } diff --git a/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java b/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java index 461d4c69..df207c48 100644 --- a/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java +++ b/core/src/main/java/com/boydti/fawe/object/exception/FaweException.java @@ -25,12 +25,20 @@ public class FaweException extends RuntimeException { return get(cause); } + /** + * This exception is thrown when a chunk fails to load in time + * - Chunks are loaded on the main thread to be accessed async + */ public static class FaweChunkLoadException extends FaweException { public FaweChunkLoadException() { super(BBC.WORLDEDIT_FAILED_LOAD_CHUNK); } } + /** + * Faster exception throwing if you don't fill the stacktrace + * @return + */ @Override public Throwable fillInStackTrace() { return this;