Fix 1.8 tile sending

This commit is contained in:
Jesse Boyd 2016-08-16 16:41:29 +10:00
parent ca12752b78
commit 424bcc5d05
4 changed files with 50 additions and 3 deletions

View File

@ -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<Chunk, ChunkSection[], ChunkS
for (EntityPlayer player : players) {
player.playerConnection.sendPacket(packet);
}
// Send tiles
for (Map.Entry<BlockPosition, TileEntity> 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);
}

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -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;