Merge branch 'master' of ssh://dev.mineplex.com:7999/min/mineplex
This commit is contained in:
commit
e469c5705b
@ -14,6 +14,8 @@ import net.minecraft.server.v1_6_R3.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_6_R3.ChunkSection;
|
||||
import net.minecraft.server.v1_6_R3.IContainer;
|
||||
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_6_R3.Packet52MultiBlockChange;
|
||||
import net.minecraft.server.v1_6_R3.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_6_R3.RegionFile;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -188,9 +190,17 @@ public class MapUtil
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void SendChunkForPlayer(int x, int z, Player player)
|
||||
{
|
||||
System.out.println("Sending Chunk " + x + ", " + z);
|
||||
((CraftPlayer)player).getHandle().chunkCoordIntPairQueue.add(new ChunkCoordIntPair(x, z));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void SendMultiBlockForPlayer(int x, int z, short[] dirtyBlocks, int dirtyCount, World world, Player player)
|
||||
{
|
||||
System.out.println("Sending MultiBlockChunk " + x + ", " + z);
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet52MultiBlockChange(x, z, dirtyBlocks, dirtyCount, ((CraftWorld)world).getHandle()));
|
||||
}
|
||||
|
||||
public static void UnloadWorld(JavaPlugin plugin, World world)
|
||||
{
|
||||
world.setAutoSave(false);
|
||||
|
@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.hungergames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.PlayerChunkMap;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
|
||||
@ -10,6 +12,8 @@ public class ChunkChange
|
||||
public Chunk Chunk;
|
||||
public long Time;
|
||||
public ArrayList<BlockChange> Changes;
|
||||
public short[] DirtyBlocks = new short[64];
|
||||
public short DirtyCount = 0;
|
||||
|
||||
public ChunkChange(Location loc, int id, byte data)
|
||||
{
|
||||
@ -25,5 +29,24 @@ public class ChunkChange
|
||||
public void AddChange(Location loc, int id, byte data)
|
||||
{
|
||||
Changes.add(new BlockChange(loc, id, data));
|
||||
|
||||
if (DirtyCount < 63)
|
||||
{
|
||||
short short1 = (short)((loc.getBlockX() & 0xF) << 12 | (loc.getBlockZ() & 0xF) << 8 | loc.getBlockY());
|
||||
|
||||
for (int l = 0; l < DirtyCount; l++)
|
||||
{
|
||||
if (DirtyBlocks[l] == short1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DirtyBlocks[(DirtyCount++)] = short1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DirtyCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -412,9 +412,9 @@ public class HungerGames extends SoloGame
|
||||
for (int i = 0; i < 36; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_INGOT, 2));
|
||||
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.IRON_INGOT));
|
||||
for (int i = 0; i < 3; i++) _baseChestLoot.add(new ItemStack(Material.DIAMOND));
|
||||
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.STICK, 4));
|
||||
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FLINT, 3));
|
||||
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FEATHER, 3));
|
||||
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.STICK, 4));
|
||||
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.FLINT, 3));
|
||||
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.FEATHER, 3));
|
||||
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.BOAT));
|
||||
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FISHING_ROD));
|
||||
|
||||
@ -436,7 +436,8 @@ public class HungerGames extends SoloGame
|
||||
for (int i = 0; i < 27; i++) _superChestLoot.add(new ItemStack(Material.IRON_LEGGINGS));
|
||||
for (int i = 0; i < 30; i++) _superChestLoot.add(new ItemStack(Material.IRON_BOOTS));
|
||||
|
||||
for (int i = 0; i < 12; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_SWORD));
|
||||
for (int i = 0; i < 24; i++) _superChestLoot.add(new ItemStack(Material.IRON_SWORD));
|
||||
for (int i = 0; i < 8; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_SWORD));
|
||||
for (int i = 0; i < 16; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_AXE));
|
||||
}
|
||||
|
||||
@ -725,7 +726,7 @@ public class HungerGames extends SoloGame
|
||||
boolean added = false;
|
||||
for (ChunkChange change : _redChunks.get(player))
|
||||
{
|
||||
if (change.Chunk.equals(loc.getChunk()))
|
||||
if (change.Chunk.equals(loc.getChunk()) /* XXX && change.DirtyCount < 63*/)
|
||||
{
|
||||
change.AddChange(loc, id, data);
|
||||
added = true;
|
||||
@ -768,8 +769,11 @@ public class HungerGames extends SoloGame
|
||||
|
||||
//change.Changes contains Location/Id/Data for all pending changes in this chunk
|
||||
|
||||
//XXX Simply replace this line with the the Multiblocks packet.
|
||||
MapUtil.SendChunkForPlayer(change.Chunk.getX(), change.Chunk.getZ(), player);
|
||||
//XXX Simply replace this line with the the Multiblocks packet.
|
||||
if (change.DirtyCount >= 63)
|
||||
MapUtil.SendChunkForPlayer(change.Chunk.getX(), change.Chunk.getZ(), player);
|
||||
else
|
||||
MapUtil.SendMultiBlockForPlayer(change.Chunk.getX(), change.Chunk.getZ(), change.DirtyBlocks, change.DirtyCount, change.Chunk.getWorld(), player);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user