Chunk stuff, leave on death in lobby

This commit is contained in:
Garbage Mule 2011-07-09 10:10:42 +02:00
parent 7fc43e45db
commit 24f4146010
3 changed files with 23 additions and 3 deletions

Binary file not shown.

View File

@ -264,6 +264,15 @@ public class Arena
if (!locations.containsKey(p))
locations.put(p,loc);
if (livePlayers.isEmpty())
{
Chunk chunk = world.getChunkAt(lobbyLoc);
if (!world.isChunkLoaded(chunk))
world.loadChunk(chunk);
else
world.refreshChunk(chunk.getX(), chunk.getZ());
}
MAUtils.sitPets(p);
livePlayers.add(p);
p.teleport(lobbyLoc);
@ -862,8 +871,6 @@ public class Arena
public void onEntityDeath(EntityDeathEvent event)
{
if (!running) return;
if (event.getEntity() instanceof Player)
{
Player p = (Player) event.getEntity();

View File

@ -6,6 +6,7 @@ import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Server;
@ -111,6 +112,18 @@ public class MACommands implements CommandExecutor
//
////////////////////////////////////////////////////////////////*/
if (base.equals("unchunk"))
{
Arena arena = am.getArenaWithName(arg1);
Chunk chunk = arena.world.getChunkAt(arena.lobbyLoc);
//arena.world.unloadChunk(chunk.getX(), chunk.getZ(), false, false);
arena.world.unloadChunk(arena.lobbyLoc.getBlockX(), arena.lobbyLoc.getBlockZ());
arena.world.unloadChunk(chunk.getX(), chunk.getZ());
System.out.println("Chunk: " + chunk.getX() + "," + chunk.getZ());
System.out.println("Lobby: " + arena.lobbyLoc.getBlockX() + "," + arena.lobbyLoc.getBlockZ());
return true;
}
/*
* Player join
*/