Only eliminated players are guardians. Broken blocks/mobs go directly into inventory.
This commit is contained in:
parent
b40f018ee2
commit
aaf1fd42f3
@ -41,7 +41,6 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
|
|||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -458,45 +457,13 @@ public class SpeedBuilders extends SoloGame
|
|||||||
if (i >= WorldData.GetDataLocs("YELLOW").size())
|
if (i >= WorldData.GetDataLocs("YELLOW").size())
|
||||||
{
|
{
|
||||||
GetTeamList().get(0).RemovePlayer(players.get(i));
|
GetTeamList().get(0).RemovePlayer(players.get(i));
|
||||||
|
Manager.addSpectator(players.get(i), true);
|
||||||
moveToGuardians(players.get(i), false);
|
|
||||||
|
|
||||||
players.get(i).teleport(GetSpectatorLocation());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
|
||||||
{
|
|
||||||
//Not on a team will become a spec
|
|
||||||
if (!IsAlive(player))
|
|
||||||
{
|
|
||||||
moveToGuardians(player, false);
|
|
||||||
|
|
||||||
player.teleport(GetSpectatorLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player player : GetTeamList().get(1).GetPlayers(false))
|
|
||||||
{
|
|
||||||
//Reapply disguise 5 ticks later
|
|
||||||
Manager.runSyncLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
DisguiseGuardian disguise = new DisguiseGuardian(player);
|
|
||||||
disguise.setName(C.cGray + player.getName());
|
|
||||||
disguise.setCustomNameVisible(true);
|
|
||||||
|
|
||||||
Manager.GetDisguise().disguise(disguise);
|
|
||||||
|
|
||||||
player.setAllowFlight(true);
|
|
||||||
player.setFlying(true);
|
|
||||||
}
|
|
||||||
}, 5);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLive(GameStateChangeEvent event)
|
public void onLive(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
@ -1645,34 +1612,6 @@ public class SpeedBuilders extends SoloGame
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add to guardians before arcade manager adds to spectator to trick it into thinking the player is "alive"
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
|
||||||
public void joinAddGuardian(PlayerJoinEvent event)
|
|
||||||
{
|
|
||||||
if (!InProgress())
|
|
||||||
return;
|
|
||||||
|
|
||||||
moveToGuardians(event.getPlayer(), false);
|
|
||||||
event.getPlayer().teleport(GetSpectatorLocation());
|
|
||||||
|
|
||||||
//We need to disguise a tick after
|
|
||||||
Manager.runSyncLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
DisguiseGuardian disguise = new DisguiseGuardian(event.getPlayer());
|
|
||||||
disguise.setName(C.cGray + event.getPlayer().getName());
|
|
||||||
disguise.setCustomNameVisible(true);
|
|
||||||
|
|
||||||
Manager.GetDisguise().disguise(disguise);
|
|
||||||
|
|
||||||
event.getPlayer().setAllowFlight(true);
|
|
||||||
event.getPlayer().setFlying(true);
|
|
||||||
}
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void setNextBuild(PlayerCommandPreprocessEvent event)
|
public void setNextBuild(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
@ -1853,7 +1792,7 @@ public class SpeedBuilders extends SoloGame
|
|||||||
|
|
||||||
for (Player player : playersDead)
|
for (Player player : playersDead)
|
||||||
{
|
{
|
||||||
Scoreboard.Write(C.cGray + player.getName());
|
Scoreboard.Write(C.cDGray + player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
|
@ -2,14 +2,6 @@ package nautilus.game.arcade.game.games.speedbuilders.data;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import mineplex.core.common.util.MapUtil;
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.hologram.Hologram;
|
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -17,11 +9,19 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.Bed;
|
import org.bukkit.material.Bed;
|
||||||
import org.bukkit.material.Door;
|
import org.bukkit.material.Door;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.MapUtil;
|
||||||
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.hologram.Hologram;
|
||||||
|
|
||||||
public class DemolitionData
|
public class DemolitionData
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -170,9 +170,7 @@ public class DemolitionData
|
|||||||
|
|
||||||
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
|
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
|
||||||
{
|
{
|
||||||
Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack);
|
UtilInv.insert(Parent.Player, itemStack);
|
||||||
|
|
||||||
Parent.DroppedItems.put(item, System.currentTimeMillis());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Destroy the other part
|
//Destroy the other part
|
||||||
@ -210,9 +208,7 @@ public class DemolitionData
|
|||||||
{
|
{
|
||||||
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
|
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
|
||||||
|
|
||||||
Item item = entity.getWorld().dropItem(entity.getLocation().add(0, 1, 0), spawnEgg);
|
UtilInv.insert(Parent.Player, spawnEgg);
|
||||||
|
|
||||||
Parent.DroppedItems.put(item, System.currentTimeMillis());
|
|
||||||
|
|
||||||
entity.remove();
|
entity.remove();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user