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