mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-22 18:46:45 +01:00
Chunk stuff, leave on death in lobby
This commit is contained in:
parent
7fc43e45db
commit
24f4146010
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -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);
|
||||
@ -861,9 +870,7 @@ public class Arena
|
||||
}
|
||||
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
{
|
||||
if (!running) return;
|
||||
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
Player p = (Player) event.getEntity();
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user