diff --git a/Makefile b/Makefile index 86da2e6..60d9b5b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -JFLAGS = -g -d bin -classpath "libs/craftbukkit1.4.7.jar:libs/craftbukkit1.5.2.jar:libs/craftbukkit1.5_R2.jar:libs/craftbukkit1.6.1.jar:libs/craftbukkit1.6.2.jar:libs/jcsv-1.4.0.jar:libs/craftbukkit-1.6.4.jar:libs/craftbukkit1.7.2.jar:libs/craftbukkit-1.7.9.jar:libs/craftbukkit-1.7.5.jar:libs/worldedit-5.6.2.jar:bin" +JFLAGS = -g -d bin -classpath "libs/craftbukkit1.4.7.jar:libs/craftbukkit1.5.2.jar:libs/craftbukkit1.5_R2.jar:libs/craftbukkit1.6.1.jar:libs/craftbukkit1.6.2.jar:libs/jcsv-1.4.0.jar:libs/craftbukkit-1.6.4.jar:libs/craftbukkit1.7.2.jar:libs/craftbukkit-1.7.9.jar:libs/craftbukkit-1.7.5.jar:libs/craftbukkit-1.7.10.jar:libs/worldedit-5.6.2.jar:bin" JC = javac JAR = jar JARFLAGS = cf GriefLog.jar -C bin diff --git a/libs/craftbukkit-1.7.10.jar b/libs/craftbukkit-1.7.10.jar new file mode 100644 index 0000000..9bbf081 Binary files /dev/null and b/libs/craftbukkit-1.7.10.jar differ diff --git a/sourcefiles b/sourcefiles index 77646fa..7c33162 100644 --- a/sourcefiles +++ b/sourcefiles @@ -18,6 +18,8 @@ src/tk/blackwolf12333/grieflog/compatibility/v1_5_R3/ChangesSender.java src/tk/blackwolf12333/grieflog/compatibility/FastBlockSetterInterface.java src/tk/blackwolf12333/grieflog/compatibility/v1_7_R1/FastBlockSetter.java src/tk/blackwolf12333/grieflog/compatibility/v1_7_R1/ChangesSender.java +src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/FastBlockSetter.java +src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/ChangesSender.java src/tk/blackwolf12333/grieflog/compatibility/v1_5_R2/FastBlockSetter.java src/tk/blackwolf12333/grieflog/compatibility/v1_5_R2/ChangesSender.java src/tk/blackwolf12333/grieflog/compatibility/ChangesSenderInterface.java diff --git a/src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/ChangesSender.java b/src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/ChangesSender.java new file mode 100644 index 0000000..5f18143 --- /dev/null +++ b/src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/ChangesSender.java @@ -0,0 +1,35 @@ +package tk.blackwolf12333.grieflog.compatibility.v1_7_R4; + +import java.util.HashSet; + +import org.bukkit.Chunk; +import org.bukkit.entity.Player; + +import tk.blackwolf12333.grieflog.rollback.SendChangesTask; +import tk.blackwolf12333.grieflog.compatibility.ChangesSenderInterface; + +public class ChangesSender implements ChangesSenderInterface { + @SuppressWarnings("unchecked") + @Override + public void sendChanges(SendChangesTask task, HashSet chunks) { + HashSet pairs = new HashSet(); + for (Chunk c : chunks) { + pairs.add(new net.minecraft.server.v1_7_R4.ChunkCoordIntPair(c.getX(), c.getZ())); + } + + for (Player p : task.getPlayers()) { + HashSet queued = new HashSet(); + if (p != null) { + net.minecraft.server.v1_7_R4.EntityPlayer ep = ((org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer) p).getHandle(); + for (Object o : ep.chunkCoordIntPairQueue) { + queued.add((net.minecraft.server.v1_7_R4.ChunkCoordIntPair) o); + } + for (net.minecraft.server.v1_7_R4.ChunkCoordIntPair pair : pairs) { + if (!queued.contains(pair)) { + ep.chunkCoordIntPairQueue.add(pair); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/FastBlockSetter.java b/src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/FastBlockSetter.java new file mode 100644 index 0000000..6f6b48b --- /dev/null +++ b/src/tk/blackwolf12333/grieflog/compatibility/v1_7_R4/FastBlockSetter.java @@ -0,0 +1,36 @@ +package tk.blackwolf12333.grieflog.compatibility.v1_7_R4; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.Material; + +import tk.blackwolf12333.grieflog.compatibility.FastBlockSetterInterface; + +public class FastBlockSetter implements FastBlockSetterInterface { + @Override + public void setBlockFast(int x, int y, int z, String world, int typeID, byte data) { + Chunk c = Bukkit.getWorld(world).getChunkAt(x >> 4, z >> 4); + net.minecraft.server.v1_7_R4.Chunk chunk = ((org.bukkit.craftbukkit.v1_7_R4.CraftChunk) c).getHandle(); + net.minecraft.server.v1_7_R4.Block block = this.getBlockType(typeID); + chunk.a(x & 15, y, z & 15, block, data); // sets the block at (x,y,z) + } + + private net.minecraft.server.v1_7_R4.Block getBlockType(int typeID) { + for(Material m : Material.values()) { + if(m.getId() == typeID) { + try { + return (net.minecraft.server.v1_7_R4.Block) net.minecraft.server.v1_7_R4.Blocks.class.getDeclaredField(m.toString()).get(null); + } catch (SecurityException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + return net.minecraft.server.v1_7_R4.Blocks.AIR; + } +} \ No newline at end of file diff --git a/src/tk/blackwolf12333/grieflog/data/block/BlockWorldEditChangeData.java b/src/tk/blackwolf12333/grieflog/data/block/BlockWorldEditChangeData.java index 0c449b5..36fd60e 100644 --- a/src/tk/blackwolf12333/grieflog/data/block/BlockWorldEditChangeData.java +++ b/src/tk/blackwolf12333/grieflog/data/block/BlockWorldEditChangeData.java @@ -80,7 +80,7 @@ public void undo(Undo undo) { @Override public String toString() { - if(time != null) { // this is only used after searching, I think + if(time != null) { return this.time + " " + this.event + " By: " + this.playerName + " from: " + this.blockType + ":" + this.blockData + " to: " + this.changedTo + ":" + this.changedToData + " at: " + this.xyz + " in: " + this.worldName; } return " " + this.event + " By: " + this.playerName + ":" + playerUUID.toString() + " from: " + this.blockType + ":" + this.blockData + " to: " + this.changedTo + ":" + this.changedToData + " at: " + this.xyz + " in: " + this.worldName; diff --git a/src/tk/blackwolf12333/grieflog/utils/searching/ArgumentParser.java b/src/tk/blackwolf12333/grieflog/utils/searching/ArgumentParser.java index 7841064..dad833d 100644 --- a/src/tk/blackwolf12333/grieflog/utils/searching/ArgumentParser.java +++ b/src/tk/blackwolf12333/grieflog/utils/searching/ArgumentParser.java @@ -87,7 +87,7 @@ public void parse(ArrayList args) throws GriefLogException { public void checkArgument(char identifier, String arg) { switch(identifier) { case 'p': - player = UUID.fromString(UUIDApi.getUUIDAsString(arg)); + player = UUIDApi.getUUID(arg); break; case 'e': event = getEventFromAlias(arg);