added a little msg for people in UHC, informing that it will start soon
This commit is contained in:
parent
75c07588a5
commit
e286bec777
@ -102,6 +102,8 @@ public class UHC extends TeamGame
|
||||
|
||||
private boolean xrayDebug = false;
|
||||
|
||||
private long lastInform = 0;
|
||||
|
||||
public UHC(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.UHC,
|
||||
@ -120,7 +122,7 @@ public class UHC extends TeamGame
|
||||
});
|
||||
|
||||
this.StrictAntiHack = true;
|
||||
|
||||
|
||||
this.GameTimeout = 10800000;
|
||||
|
||||
this.DamagePvP = false;
|
||||
@ -154,9 +156,9 @@ public class UHC extends TeamGame
|
||||
this.CompassGiveItem = false;
|
||||
|
||||
this.WorldBoundaryKill = false;
|
||||
|
||||
|
||||
this.TickPerTeleport = 3;
|
||||
|
||||
|
||||
this.GemBoosterEnabled = false;
|
||||
this.GemDoubleEnabled = false;
|
||||
this.GemHunterEnabled = false;
|
||||
@ -583,31 +585,31 @@ public class UHC extends TeamGame
|
||||
event.getDrops().add(ItemStackFactory.Instance.CreateStack(Material.GOLD_INGOT, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void PlayerQuitDropItems(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team == null) return;
|
||||
|
||||
|
||||
if (!IsAlive(player))
|
||||
return;
|
||||
|
||||
|
||||
if (!QuitOut)
|
||||
return;
|
||||
|
||||
//Drop Items
|
||||
UtilInv.drop(player, true);
|
||||
|
||||
|
||||
//Skull Drop
|
||||
ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)3, 1, team.GetColor() + player.getName() + "'s Head");
|
||||
|
||||
|
||||
SkullMeta meta = (SkullMeta)stack.getItemMeta();
|
||||
meta.setOwner(player.getName());
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
|
||||
event.getPlayer().getWorld().dropItemNaturally(player.getEyeLocation(), stack);
|
||||
}
|
||||
|
||||
@ -621,11 +623,11 @@ public class UHC extends TeamGame
|
||||
|
||||
//Skull Drop
|
||||
ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)3, 1, team.GetColor() + player.getName() + "'s Head");
|
||||
|
||||
|
||||
SkullMeta meta = (SkullMeta)stack.getItemMeta();
|
||||
meta.setOwner(player.getName());
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
|
||||
event.getDrops().add(stack);
|
||||
|
||||
//Lightning
|
||||
@ -896,16 +898,16 @@ public class UHC extends TeamGame
|
||||
if (event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void HeadPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.getItem().getItemStack().getType() == Material.SKULL_ITEM)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), " ");
|
||||
@ -915,7 +917,7 @@ public class UHC extends TeamGame
|
||||
UtilPlayer.message(event.getPlayer(), " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void HeadEat(PlayerInteractEvent event)
|
||||
@ -926,23 +928,23 @@ public class UHC extends TeamGame
|
||||
|
||||
(new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer());
|
||||
(new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer());
|
||||
|
||||
|
||||
event.getPlayer().setItemInHand(null);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void DamageHealCancel(EntityDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player)event.getEntity();
|
||||
player.removePotionEffect(PotionEffectType.REGENERATION);
|
||||
|
||||
|
||||
UtilPlayer.message(player, "You took damage and lost " + F.elem(C.cGreen + "Regeneration") + ChatColor.RESET + ".");
|
||||
}
|
||||
}*/
|
||||
@ -1238,11 +1240,11 @@ public class UHC extends TeamGame
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
|
||||
if (!_ended)
|
||||
if (_joinable)
|
||||
return;
|
||||
|
||||
|
||||
for (final Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
@ -1431,39 +1433,39 @@ public class UHC extends TeamGame
|
||||
private ArrayList<Block> findOres(Block source, int range)
|
||||
{
|
||||
ArrayList<Block> ores = new ArrayList<Block>();
|
||||
|
||||
|
||||
for (int x=-range ; x <= range ; x++)
|
||||
for (int z=-range ; z <= range ; z++)
|
||||
for (int y=-range ; y <= range ; y++)
|
||||
{
|
||||
Block block = source.getRelative(x, y, z);
|
||||
|
||||
|
||||
findOreFromBlock(ores, block);
|
||||
}
|
||||
|
||||
|
||||
if (xrayDebug)
|
||||
for (Block debug : ores)
|
||||
System.out.println("Found " + debug.getType() + " at " + UtilWorld.locToStrClean(debug.getLocation()));
|
||||
|
||||
|
||||
return ores;
|
||||
}
|
||||
|
||||
|
||||
public void findOreFromBlock(ArrayList<Block> ores, Block block)
|
||||
{
|
||||
if (ores.contains(block))
|
||||
return;
|
||||
|
||||
|
||||
if (isOre(block))
|
||||
{
|
||||
ores.add(block);
|
||||
|
||||
|
||||
for (Block neighbour : UtilBlock.getSurrounding(block, true))
|
||||
{
|
||||
findOreFromBlock(ores, neighbour);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isOre(Block block)
|
||||
{
|
||||
return (block.getType() == Material.IRON_ORE ||
|
||||
@ -1531,7 +1533,7 @@ public class UHC extends TeamGame
|
||||
|
||||
return veins;
|
||||
}
|
||||
|
||||
|
||||
private void removeNonAirVeins(ArrayList<ArrayList<Block>> oreVeins)
|
||||
{
|
||||
//Remove Non-Aired Veins
|
||||
@ -1578,4 +1580,14 @@ public class UHC extends TeamGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void informStartSoon()
|
||||
{
|
||||
if (UtilTime.elapsed(lastInform, 20000))
|
||||
{
|
||||
lastInform = System.currentTimeMillis();
|
||||
|
||||
Bukkit.broadcastMessage(C.cGray + "Countdown will start in " + UtilTime.MakeStr(150000 - (System.currentTimeMillis() - GetStateTime())) +"...");
|
||||
}
|
||||
}
|
||||
}
|
@ -29,6 +29,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -200,8 +201,13 @@ public class GameManager implements Listener
|
||||
public void StateCountdown(Game game, int timer, boolean force)
|
||||
{
|
||||
//Always give time to pick team.
|
||||
if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 120000 : 15000))
|
||||
if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 150000 : 15000))
|
||||
{
|
||||
if (game.GetType() == GameType.UHC)
|
||||
{
|
||||
((UHC)game).informStartSoon();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user