Fix borders
This commit is contained in:
parent
55f97ef984
commit
5d671d3300
|
@ -143,12 +143,13 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
private int _chestRefillTime = 60 * 7;
|
private int _chestRefillTime = 60 * 7;
|
||||||
|
|
||||||
public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
|
public SurvivalGames(ArcadeManager manager, GameType type,
|
||||||
|
String[] description)
|
||||||
{
|
{
|
||||||
super(manager, type,
|
super(manager, type,
|
||||||
|
|
||||||
new Kit[]
|
new Kit[]
|
||||||
{
|
{
|
||||||
new KitAxeman(manager),
|
new KitAxeman(manager),
|
||||||
|
|
||||||
// new KitLooter(manager),
|
// new KitLooter(manager),
|
||||||
|
@ -170,16 +171,16 @@ public abstract class SurvivalGames extends Game
|
||||||
new KitBarbarian(manager),
|
new KitBarbarian(manager),
|
||||||
|
|
||||||
new KitHorseman(manager),
|
new KitHorseman(manager),
|
||||||
}, description);
|
}, description);
|
||||||
|
|
||||||
_help = new String[]
|
_help = new String[]
|
||||||
{
|
{
|
||||||
C.cGreen + "Use a Compass to find and kill enemies!",
|
C.cGreen + "Use a Compass to find and kill enemies!",
|
||||||
|
|
||||||
C.cGreen + "You lose Speed 2 at start of game if you attack.",
|
C.cGreen + "You lose Speed 2 at start of game if you attack.",
|
||||||
|
|
||||||
C.cAqua + "Avoid enemies who have better gear than you!"
|
C.cAqua + "Avoid enemies who have better gear than you!"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Manager.GetAntiStack().SetEnabled(false);
|
// Manager.GetAntiStack().SetEnabled(false);
|
||||||
|
|
||||||
|
@ -219,7 +220,6 @@ public abstract class SurvivalGames extends Game
|
||||||
BlockBreakAllow.add(Material.WEB.getId()); // Web
|
BlockBreakAllow.add(Material.WEB.getId()); // Web
|
||||||
BlockPlaceAllow.add(Material.WEB.getId());
|
BlockPlaceAllow.add(Material.WEB.getId());
|
||||||
|
|
||||||
|
|
||||||
BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves
|
BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves
|
||||||
BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves
|
BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves
|
||||||
|
|
||||||
|
@ -240,14 +240,17 @@ public abstract class SurvivalGames extends Game
|
||||||
BlockBreakAllow.add(Material.VINE.getId());
|
BlockBreakAllow.add(Material.VINE.getId());
|
||||||
BlockBreakAllow.add(Material.WATER_LILY.getId());
|
BlockBreakAllow.add(Material.WATER_LILY.getId());
|
||||||
|
|
||||||
// Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened");
|
// Manager.GetStatsManager().addTable(GetName(), "kills", "deaths",
|
||||||
|
// "chestsOpened");
|
||||||
|
|
||||||
setupLoot();
|
setupLoot();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
_packetTeam = Class.forName("org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam").getDeclaredField("team");
|
_packetTeam = Class.forName(
|
||||||
|
"org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam")
|
||||||
|
.getDeclaredField("team");
|
||||||
_packetTeam.setAccessible(true);
|
_packetTeam.setAccessible(true);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -255,8 +258,10 @@ public abstract class SurvivalGames extends Game
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), new KillsWithinTimeLimitStatTracker(this, 3, 60,
|
registerStatTrackers(new WinWithoutWearingArmorStatTracker(this),
|
||||||
"Bloodlust"), new FirstSupplyDropOpenStatTracker(this), new SimultaneousSkeletonStatTracker(this, 5));
|
new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"),
|
||||||
|
new FirstSupplyDropOpenStatTracker(this),
|
||||||
|
new SimultaneousSkeletonStatTracker(this, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -266,7 +271,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (_placedBlocks.remove(block.getLocation()))
|
if (_placedBlocks.remove(block.getLocation()))
|
||||||
{
|
{
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND,
|
||||||
|
block.getType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -346,7 +352,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
player.playSound(player.getEyeLocation(), Sound.IRONGOLEM_DEATH, 1000, 0);
|
player.playSound(player.getEyeLocation(),
|
||||||
|
Sound.IRONGOLEM_DEATH, 1000, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
refillChests();
|
refillChests();
|
||||||
|
@ -370,14 +377,17 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (_chestRefillTime >= 60)
|
if (_chestRefillTime >= 60)
|
||||||
{
|
{
|
||||||
time = (_chestRefillTime / 60) + " minute" + (_chestRefillTime > 60 ? "s" : "");
|
time = (_chestRefillTime / 60) + " minute"
|
||||||
|
+ (_chestRefillTime > 60 ? "s" : "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
time = _chestRefillTime + " second" + (_chestRefillTime != 1 ? "s" : "");
|
time = _chestRefillTime + " second"
|
||||||
|
+ (_chestRefillTime != 1 ? "s" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Announce(C.cGold + C.Bold + "The chests will be refilled in " + time, false);
|
Announce(C.cGold + C.Bold + "The chests will be refilled in "
|
||||||
|
+ time, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -403,13 +413,16 @@ public abstract class SurvivalGames extends Game
|
||||||
while (done < 40)
|
while (done < 40)
|
||||||
{
|
{
|
||||||
|
|
||||||
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff),
|
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX
|
||||||
WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
+ UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff),
|
||||||
|
ignore);
|
||||||
|
|
||||||
if (!UtilBlock.airFoliage(block) || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
if (!UtilBlock.airFoliage(block)
|
||||||
|
|| !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
block.setTypeIdAndData(Material.CHEST.getId(), (byte) UtilMath.r(4), true);
|
block.setTypeIdAndData(Material.CHEST.getId(),
|
||||||
|
(byte) UtilMath.r(4), true);
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +464,8 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
for (int z = -1; z <= 1; z++)
|
for (int z = -1; z <= 1; z++)
|
||||||
{
|
{
|
||||||
Block b = event.getVehicle().getLocation().add(x, y, z).getBlock();
|
Block b = event.getVehicle().getLocation().add(x, y, z)
|
||||||
|
.getBlock();
|
||||||
|
|
||||||
if (b.isLiquid())
|
if (b.isLiquid())
|
||||||
{
|
{
|
||||||
|
@ -517,29 +531,34 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (!IsAlive(event.getPlayer()))
|
if (!IsAlive(event.getPlayer()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You are not in the game."));
|
UtilPlayer.message(event.getPlayer(),
|
||||||
|
F.main("Game", "You are not in the game."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsLive() || _deathMatchTime <= 60)
|
if (!IsLive() || _deathMatchTime <= 60)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now."));
|
UtilPlayer.message(event.getPlayer(),
|
||||||
|
F.main("Game", "Deathmatch cannot be started now."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_secondsSinceStart < 5 * 60 || GetPlayers(true).size() > 4)
|
if (_secondsSinceStart < 5 * 60 || GetPlayers(true).size() > 4)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now."));
|
UtilPlayer.message(event.getPlayer(),
|
||||||
|
F.main("Game", "Deathmatch cannot be started now."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Announce(C.cGreen + C.Bold + event.getPlayer().getName() + " has initiated Deathmatch!");
|
Announce(C.cGreen + C.Bold + event.getPlayer().getName()
|
||||||
|
+ " has initiated Deathmatch!");
|
||||||
Announce(C.cGreen + C.Bold + "Deathmatch starting in 60 seconds...");
|
Announce(C.cGreen + C.Bold + "Deathmatch starting in 60 seconds...");
|
||||||
|
|
||||||
_deathMatchTime = 60;
|
_deathMatchTime = 60;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
|
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f,
|
||||||
|
1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deathmatchSecond()
|
public void deathmatchSecond()
|
||||||
|
@ -552,8 +571,9 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
{
|
{
|
||||||
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 1, false, true, true, "Game End",
|
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||||
"Game End Damage");
|
DamageCause.CUSTOM, 1, false, true, true,
|
||||||
|
"Game End", "Game End Damage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,16 +584,21 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (_deathMatchTime > 0 && _deathMatchTime <= 60)
|
if (_deathMatchTime > 0 && _deathMatchTime <= 60)
|
||||||
{
|
{
|
||||||
if (_deathMatchTime % 30 == 0 || _deathMatchTime == 15 || _deathMatchTime == 10
|
if (_deathMatchTime % 30 == 0
|
||||||
|| (_deathMatchTeleported ? _deathMatchTime <= 10 : _deathMatchTime <= 5))
|
|| _deathMatchTime == 15
|
||||||
|
|| _deathMatchTime == 10
|
||||||
|
|| (_deathMatchTeleported ? _deathMatchTime <= 10
|
||||||
|
: _deathMatchTime <= 5))
|
||||||
{
|
{
|
||||||
if (_deathMatchTeleported && _deathMatchTime <= 10)
|
if (_deathMatchTeleported && _deathMatchTime <= 10)
|
||||||
{
|
{
|
||||||
Announce(C.cRed + C.Bold + "Deathmatch in " + _deathMatchTime + "...");
|
Announce(C.cRed + C.Bold + "Deathmatch in "
|
||||||
|
+ _deathMatchTime + "...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Announce(C.cGreen + C.Bold + "Deathmatch starting in " + _deathMatchTime + " seconds...");
|
Announce(C.cGreen + C.Bold + "Deathmatch starting in "
|
||||||
|
+ _deathMatchTime + " seconds...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,7 +616,8 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
Announce(C.cRed + C.Bold + "Deathmatch has begun!", false);
|
Announce(C.cRed + C.Bold + "Deathmatch has begun!", false);
|
||||||
|
|
||||||
_spawn.getWorld().playSound(_spawn, Sound.WITHER_DEATH, 1000, 0);
|
_spawn.getWorld()
|
||||||
|
.playSound(_spawn, Sound.WITHER_DEATH, 1000, 0);
|
||||||
|
|
||||||
refillChests();
|
refillChests();
|
||||||
}
|
}
|
||||||
|
@ -614,7 +640,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
for (double border : buildBorders((2 * 30) - 15, 30.5, 7.5))
|
for (double border : buildBorders((2 * 30) - 15, 30.5, 7.5))
|
||||||
{
|
{
|
||||||
_borderPositions.put(_secondsSinceStart + 60 + (i++ * 2), border);
|
_borderPositions.put(_secondsSinceStart + 60 + (i++ * 2),
|
||||||
|
border);
|
||||||
}
|
}
|
||||||
|
|
||||||
setBorder();
|
setBorder();
|
||||||
|
@ -635,7 +662,8 @@ public abstract class SurvivalGames extends Game
|
||||||
if (_informedDeathmatchCommand)
|
if (_informedDeathmatchCommand)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold + "/dm" + C.cGreen + C.Bold + " to start Deathmatch!");
|
Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold
|
||||||
|
+ "/dm" + C.cGreen + C.Bold + " to start Deathmatch!");
|
||||||
|
|
||||||
_informedDeathmatchCommand = true;
|
_informedDeathmatchCommand = true;
|
||||||
}
|
}
|
||||||
|
@ -650,7 +678,8 @@ public abstract class SurvivalGames extends Game
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SnowballEggsDamage(CustomDamageEvent event)
|
public void SnowballEggsDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetProjectile() instanceof Snowball || event.GetProjectile() instanceof Egg)
|
if (event.GetProjectile() instanceof Snowball
|
||||||
|
|| event.GetProjectile() instanceof Egg)
|
||||||
{
|
{
|
||||||
event.AddMod("Projectile", "Projectile", 0.01, false);
|
event.AddMod("Projectile", "Projectile", 0.01, false);
|
||||||
}
|
}
|
||||||
|
@ -692,7 +721,8 @@ public abstract class SurvivalGames extends Game
|
||||||
if (Math.random() > 0.95)
|
if (Math.random() > 0.95)
|
||||||
items++;
|
items++;
|
||||||
|
|
||||||
boolean spawnChest = _chestRefillTime > 0 && UtilMath.offset(chest.getLocation(), _spawn) < 8;
|
boolean spawnChest = _chestRefillTime > 0
|
||||||
|
&& UtilMath.offset(chest.getLocation(), _spawn) < 8;
|
||||||
|
|
||||||
if (spawnChest)
|
if (spawnChest)
|
||||||
items += 3;
|
items += 3;
|
||||||
|
@ -738,7 +768,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (_supplyCrates.contains(block))
|
if (_supplyCrates.contains(block))
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(looter, block));
|
Bukkit.getPluginManager().callEvent(
|
||||||
|
new SupplyChestOpenEvent(looter, block));
|
||||||
}
|
}
|
||||||
|
|
||||||
_supplyCrates.remove(block);
|
_supplyCrates.remove(block);
|
||||||
|
@ -757,11 +788,11 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
if (assist)
|
if (assist)
|
||||||
return 3;
|
return 3;
|
||||||
else
|
else return 12;
|
||||||
return 12;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an item spawns and no one is there to see it, does it really spawn? No.
|
// If an item spawns and no one is there to see it, does it really spawn?
|
||||||
|
// No.
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ItemSpawn(ItemSpawnEvent event)
|
public void ItemSpawn(ItemSpawnEvent event)
|
||||||
{
|
{
|
||||||
|
@ -831,11 +862,14 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
for (Location loc : GetTeamList().get(0).GetSpawns())
|
for (Location loc : GetTeamList().get(0).GetSpawns())
|
||||||
{
|
{
|
||||||
Firework firework = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
|
Firework firework = (Firework) loc.getWorld().spawnEntity(
|
||||||
|
loc, EntityType.FIREWORK);
|
||||||
|
|
||||||
FireworkMeta meta = firework.getFireworkMeta();
|
FireworkMeta meta = firework.getFireworkMeta();
|
||||||
|
|
||||||
meta.addEffect(FireworkEffect.builder().withColor(Color.AQUA).with(Type.BALL).withTrail().build());
|
meta.addEffect(FireworkEffect.builder()
|
||||||
|
.withColor(Color.AQUA).with(Type.BALL).withTrail()
|
||||||
|
.build());
|
||||||
|
|
||||||
firework.setFireworkMeta(meta);
|
firework.setFireworkMeta(meta);
|
||||||
}
|
}
|
||||||
|
@ -869,7 +903,6 @@ public abstract class SurvivalGames extends Game
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -910,7 +943,8 @@ public abstract class SurvivalGames extends Game
|
||||||
if (item == null || item.getType() != Material.COMPASS)
|
if (item == null || item.getType() != Material.COMPASS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int uses = Integer.parseInt(ChatColor.stripColor(item.getItemMeta().getLore().get(0)).replaceAll("\\D+", ""));
|
int uses = Integer.parseInt(ChatColor.stripColor(
|
||||||
|
item.getItemMeta().getLore().get(0)).replaceAll("\\D+", ""));
|
||||||
|
|
||||||
if (uses > 0)
|
if (uses > 0)
|
||||||
{
|
{
|
||||||
|
@ -923,9 +957,11 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
if (alive != player)
|
if (alive != player)
|
||||||
{
|
{
|
||||||
double distance = alive.getLocation().distance(player.getLocation());
|
double distance = alive.getLocation().distance(
|
||||||
|
player.getLocation());
|
||||||
|
|
||||||
if (distance > 10 && (closestPlayer == null || distance < closestDistance))
|
if (distance > 10
|
||||||
|
&& (closestPlayer == null || distance < closestDistance))
|
||||||
{
|
{
|
||||||
closestDistance = distance;
|
closestDistance = distance;
|
||||||
closestPlayer = alive;
|
closestPlayer = alive;
|
||||||
|
@ -940,29 +976,36 @@ public abstract class SurvivalGames extends Game
|
||||||
player.setCompassTarget(closestPlayer.getLocation());
|
player.setCompassTarget(closestPlayer.getLocation());
|
||||||
player.setItemInHand(buildCompass(uses));
|
player.setItemInHand(buildCompass(uses));
|
||||||
|
|
||||||
player.sendMessage(F.main("Compass", "Located " + closestPlayer.getName() + " " + (int) closestDistance
|
player.sendMessage(F.main("Compass",
|
||||||
+ " blocks away"));
|
"Located " + closestPlayer.getName() + " "
|
||||||
|
+ (int) closestDistance + " blocks away"));
|
||||||
|
|
||||||
if (uses >= 1)
|
if (uses >= 1)
|
||||||
{
|
{
|
||||||
player.sendMessage(F.main("Compass", uses + " use" + (uses > 1 ? "s" : "") + " of the compass remaining."));
|
player.sendMessage(F.main("Compass", uses + " use"
|
||||||
|
+ (uses > 1 ? "s" : "")
|
||||||
|
+ " of the compass remaining."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage(F.main("Compass", "No remaining uses! Next use will break it!"));
|
player.sendMessage(F.main("Compass",
|
||||||
|
"No remaining uses! Next use will break it!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage(F.main("Compass", "Can't find anyone! Pointing to spawn!"));
|
player.sendMessage(F.main("Compass",
|
||||||
|
"Can't find anyone! Pointing to spawn!"));
|
||||||
player.setCompassTarget(_spawn);
|
player.setCompassTarget(_spawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage(F.main("Compass", "The compass breaks! No remaining uses!"));
|
player.sendMessage(F.main("Compass",
|
||||||
|
"The compass breaks! No remaining uses!"));
|
||||||
|
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 5);
|
player.getWorld().playSound(player.getLocation(), Sound.ITEM_BREAK,
|
||||||
|
1, 5);
|
||||||
|
|
||||||
player.setItemInHand(new ItemStack(Material.AIR));
|
player.setItemInHand(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
|
@ -991,8 +1034,10 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
DoubleChest doubleChest = (DoubleChest) state;
|
DoubleChest doubleChest = (DoubleChest) state;
|
||||||
|
|
||||||
fillChest(event.getPlayer(), ((Chest) doubleChest.getLeftSide()).getBlock());
|
fillChest(event.getPlayer(),
|
||||||
fillChest(event.getPlayer(), ((Chest) doubleChest.getRightSide()).getBlock());
|
((Chest) doubleChest.getLeftSide()).getBlock());
|
||||||
|
fillChest(event.getPlayer(),
|
||||||
|
((Chest) doubleChest.getRightSide()).getBlock());
|
||||||
}
|
}
|
||||||
else if (state instanceof Chest)
|
else if (state instanceof Chest)
|
||||||
{
|
{
|
||||||
|
@ -1012,7 +1057,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (random == 0)
|
if (random == 0)
|
||||||
{
|
{
|
||||||
inv.setFuel(new ItemStack(Material.STICK, new Random().nextInt(2) + 1));
|
inv.setFuel(new ItemStack(Material.STICK, new Random()
|
||||||
|
.nextInt(2) + 1));
|
||||||
}
|
}
|
||||||
else if (random <= 3)
|
else if (random <= 3)
|
||||||
{
|
{
|
||||||
|
@ -1053,35 +1099,42 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
double border = (_previousBorder - 0.3D) + distanceMovedSince;
|
double border = (_previousBorder - 0.3D) + distanceMovedSince;
|
||||||
|
|
||||||
//24 @ 100+ reduced to 0 at 32-
|
// 24 @ 100+ reduced to 0 at 32-
|
||||||
double borderAttackDist = Math.max(8, (Math.min(100, border) - 28d) / 3d);
|
double borderAttackDist = Math.max(8,
|
||||||
|
(Math.min(100, border) - 28d) / 3d);
|
||||||
double borderCheckDist = borderAttackDist + 6;
|
double borderCheckDist = borderAttackDist + 6;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
|
|
||||||
//Bump Players Back In
|
// Bump Players Back In
|
||||||
if (loc.getX() > _spawn.getX() + border ||
|
if (loc.getX() > _spawn.getX() + border
|
||||||
loc.getX() < _spawn.getX() - border ||
|
|| loc.getX() < _spawn.getX() - border
|
||||||
loc.getZ() > _spawn.getZ() + border ||
|
|| loc.getZ() > _spawn.getZ() + border
|
||||||
loc.getZ() < _spawn.getZ() - border)
|
|| loc.getZ() < _spawn.getZ() - border)
|
||||||
{
|
{
|
||||||
if (Recharge.Instance.use(player, "Hit by Border", 1000, false, false))
|
if (Recharge.Instance.use(player, "Hit by Border", 1000, false,
|
||||||
|
false))
|
||||||
{
|
{
|
||||||
Entity bottom = player;
|
Entity bottom = player;
|
||||||
while (bottom.getVehicle() != null)
|
while (bottom.getVehicle() != null)
|
||||||
bottom = bottom.getVehicle();
|
bottom = bottom.getVehicle();
|
||||||
|
|
||||||
UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true);
|
UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc,
|
||||||
|
GetSpectatorLocation()), 1.2, true, 0.4, 0, 10,
|
||||||
|
true);
|
||||||
|
|
||||||
if (Manager.IsAlive(player))
|
if (Manager.IsAlive(player))
|
||||||
{
|
{
|
||||||
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 10, false, false, false, "Nether Field",
|
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||||
"Vaporize");
|
DamageCause.CUSTOM, 10, false, false, false,
|
||||||
|
"Nether Field", "Vaporize");
|
||||||
|
|
||||||
player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f);
|
player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f,
|
||||||
player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f);
|
1f);
|
||||||
|
player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f,
|
||||||
|
1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1089,26 +1142,26 @@ public abstract class SurvivalGames extends Game
|
||||||
if (border < 32)
|
if (border < 32)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Attack Players who are nearby
|
// Attack Players who are nearby
|
||||||
boolean isX = true;
|
boolean isX = true;
|
||||||
Location attackSource = null;
|
Location attackSource = null;
|
||||||
if (loc.getX() > _spawn.getX() + (border-borderCheckDist))
|
if (loc.getX() > _spawn.getX() + (border - borderCheckDist))
|
||||||
{
|
{
|
||||||
attackSource = player.getLocation();
|
attackSource = player.getLocation();
|
||||||
attackSource.setX(_spawn.getX() + border);
|
attackSource.setX(_spawn.getX() + border);
|
||||||
}
|
}
|
||||||
else if (loc.getX() < _spawn.getX() - (border-borderCheckDist))
|
else if (loc.getX() < _spawn.getX() - (border - borderCheckDist))
|
||||||
{
|
{
|
||||||
attackSource = player.getLocation();
|
attackSource = player.getLocation();
|
||||||
attackSource.setX(_spawn.getX() - border);
|
attackSource.setX(_spawn.getX() - border);
|
||||||
}
|
}
|
||||||
else if (loc.getZ() > _spawn.getZ() + (border-borderCheckDist))
|
else if (loc.getZ() > _spawn.getZ() + (border - borderCheckDist))
|
||||||
{
|
{
|
||||||
attackSource = player.getLocation();
|
attackSource = player.getLocation();
|
||||||
attackSource.setZ(_spawn.getZ() + border);
|
attackSource.setZ(_spawn.getZ() + border);
|
||||||
isX = false;
|
isX = false;
|
||||||
}
|
}
|
||||||
else if (loc.getZ() < _spawn.getZ() - (border-borderCheckDist))
|
else if (loc.getZ() < _spawn.getZ() - (border - borderCheckDist))
|
||||||
{
|
{
|
||||||
attackSource = player.getLocation();
|
attackSource = player.getLocation();
|
||||||
attackSource.setZ(_spawn.getZ() - border);
|
attackSource.setZ(_spawn.getZ() - border);
|
||||||
|
@ -1117,50 +1170,67 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (attackSource != null)
|
if (attackSource != null)
|
||||||
{
|
{
|
||||||
double dist = UtilMath.offset(player.getLocation(), attackSource);
|
double dist = UtilMath.offset(player.getLocation(),
|
||||||
|
attackSource);
|
||||||
|
|
||||||
double scale = 1 - (dist / borderAttackDist);
|
double scale = 1 - (dist / borderAttackDist);
|
||||||
|
|
||||||
player.playSound(player.getLocation().add(UtilAlg.getTrajectory(player.getLocation(), attackSource).multiply(8)),
|
player.playSound(
|
||||||
Sound.PORTAL, (float)(1 - (dist / borderCheckDist)) * 2, 2f);
|
player.getLocation().add(
|
||||||
|
UtilAlg.getTrajectory(player.getLocation(),
|
||||||
|
attackSource).multiply(8)),
|
||||||
|
Sound.PORTAL,
|
||||||
|
(float) (1 - (dist / borderCheckDist)) * 2, 2f);
|
||||||
|
|
||||||
if (!Manager.IsAlive(player))
|
if (!Manager.IsAlive(player))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Shoot more frequently when they get closer
|
// Shoot more frequently when they get closer
|
||||||
if (dist < borderAttackDist && Math.random() < scale)
|
if (dist < borderAttackDist && Math.random() < scale)
|
||||||
{
|
{
|
||||||
//Spawn Fireball
|
// Spawn Fireball
|
||||||
Location spawn = attackSource.clone();
|
Location spawn = attackSource.clone();
|
||||||
spawn.add(isX ? 0 : (Math.random()-0.5)*12, 4 + Math.random() * 2 + (Math.random() * 12 * scale), isX ? (Math.random()-0.5)*12 : 0);
|
spawn.add(isX ? 0 : (Math.random() - 0.5) * 12,
|
||||||
|
4 + Math.random() * 2
|
||||||
|
+ (Math.random() * 12 * scale),
|
||||||
|
isX ? (Math.random() - 0.5) * 12 : 0);
|
||||||
|
|
||||||
//Raytrace back
|
// Raytrace back
|
||||||
double maxBack = 8;
|
double maxBack = 8;
|
||||||
double back = 0;
|
double back = 0;
|
||||||
while (spawn.getBlock().getType() == Material.AIR && back < maxBack)
|
while (spawn.getBlock().getType() == Material.AIR
|
||||||
|
&& back < maxBack)
|
||||||
{
|
{
|
||||||
spawn.subtract(UtilAlg.getTrajectory(spawn, player.getLocation()).multiply(0.2));
|
spawn.subtract(UtilAlg.getTrajectory(spawn,
|
||||||
|
player.getLocation()).multiply(0.2));
|
||||||
back += 0.1;
|
back += 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Move out of block
|
// Move out of block
|
||||||
spawn.add(UtilAlg.getTrajectory(spawn, player.getLocation()).multiply(Math.min(back, 1)));
|
spawn.add(UtilAlg
|
||||||
|
.getTrajectory(spawn, player.getLocation())
|
||||||
|
.multiply(Math.min(back, 1)));
|
||||||
|
|
||||||
|
Fireball ball = player.getWorld().spawn(spawn,
|
||||||
|
Fireball.class);
|
||||||
|
|
||||||
Fireball ball = player.getWorld().spawn(spawn, Fireball.class);
|
// Trajectory
|
||||||
|
Vector traj = UtilAlg.getTrajectory(spawn,
|
||||||
|
player.getLocation());
|
||||||
|
traj.add(new Vector((Math.random() - 0.5) * 0.2, (Math
|
||||||
|
.random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2));
|
||||||
|
|
||||||
//Trajectory
|
EntityLargeFireball eFireball = ((CraftLargeFireball) ball)
|
||||||
Vector traj = UtilAlg.getTrajectory(spawn, player.getLocation());
|
.getHandle();
|
||||||
traj.add(new Vector((Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2));
|
|
||||||
|
|
||||||
EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle();
|
|
||||||
eFireball.dirX = traj.getX() * 0.1;
|
eFireball.dirX = traj.getX() * 0.1;
|
||||||
eFireball.dirY = traj.getY() * 0.1;
|
eFireball.dirY = traj.getY() * 0.1;
|
||||||
eFireball.dirZ = traj.getZ() * 0.1;
|
eFireball.dirZ = traj.getZ() * 0.1;
|
||||||
|
|
||||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, spawn, 0, 0, 0, 0, 1,
|
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE,
|
||||||
ViewDist.MAX, UtilServer.getPlayers());
|
spawn, 0, 0, 0, 0, 1, ViewDist.MAX,
|
||||||
player.getWorld().playSound(attackSource, Sound.GHAST_FIREBALL, 2f, 2f);
|
UtilServer.getPlayers());
|
||||||
|
player.getWorld().playSound(attackSource,
|
||||||
|
Sound.GHAST_FIREBALL, 2f, 2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1175,18 +1245,24 @@ public abstract class SurvivalGames extends Game
|
||||||
if (!(event.getEntity() instanceof Fireball))
|
if (!(event.getEntity() instanceof Fireball))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Collection<Block> blocks = UtilBlock.getInRadius(event.getEntity().getLocation(), 2.4).keySet();
|
Collection<Block> blocks = UtilBlock.getInRadius(
|
||||||
|
event.getEntity().getLocation(), 2.4).keySet();
|
||||||
|
|
||||||
Manager.GetExplosion().BlockExplosion(blocks, event.getEntity().getLocation(), false);
|
Manager.GetExplosion().BlockExplosion(blocks,
|
||||||
|
event.getEntity().getLocation(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStableBlock(Block block)
|
public boolean isStableBlock(Block block)
|
||||||
{
|
{
|
||||||
int sides = 0;
|
int sides = 0;
|
||||||
if (UtilBlock.solid(block.getRelative(BlockFace.NORTH))) sides++;
|
if (UtilBlock.solid(block.getRelative(BlockFace.NORTH)))
|
||||||
if (UtilBlock.solid(block.getRelative(BlockFace.EAST))) sides++;
|
sides++;
|
||||||
if (UtilBlock.solid(block.getRelative(BlockFace.SOUTH))) sides++;
|
if (UtilBlock.solid(block.getRelative(BlockFace.EAST)))
|
||||||
if (UtilBlock.solid(block.getRelative(BlockFace.WEST))) sides++;
|
sides++;
|
||||||
|
if (UtilBlock.solid(block.getRelative(BlockFace.SOUTH)))
|
||||||
|
sides++;
|
||||||
|
if (UtilBlock.solid(block.getRelative(BlockFace.WEST)))
|
||||||
|
sides++;
|
||||||
|
|
||||||
return sides >= 3;
|
return sides >= 3;
|
||||||
}
|
}
|
||||||
|
@ -1205,7 +1281,8 @@ public abstract class SurvivalGames extends Game
|
||||||
event.AddKnockback("Fireball", 2);
|
event.AddKnockback("Fireball", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Double> buildBorders(int seconds, double border, double leaveRemaining)
|
private ArrayList<Double> buildBorders(int seconds, double border,
|
||||||
|
double leaveRemaining)
|
||||||
{
|
{
|
||||||
|
|
||||||
double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50);
|
double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50);
|
||||||
|
@ -1214,7 +1291,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
for (int i = 0; i <= seconds; i++)
|
for (int i = 0; i <= seconds; i++)
|
||||||
{
|
{
|
||||||
borders.add(border - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber)));
|
borders.add(border
|
||||||
|
- ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return borders;
|
return borders;
|
||||||
|
@ -1263,7 +1341,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
Player player = (Player) event.GetEvent().getEntity();
|
Player player = (Player) event.GetEvent().getEntity();
|
||||||
|
|
||||||
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BALL_LARGE).trail(false)
|
FireworkEffect effect = FireworkEffect.builder().flicker(false)
|
||||||
|
.withColor(Color.RED).with(Type.BALL_LARGE).trail(false)
|
||||||
.build();
|
.build();
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
UtilFirework.launchFirework(player.getLocation(), effect, null, 3);
|
UtilFirework.launchFirework(player.getLocation(), effect, null, 3);
|
||||||
|
@ -1273,20 +1352,22 @@ public abstract class SurvivalGames extends Game
|
||||||
public void killLevelReward(CombatDeathEvent event)
|
public void killLevelReward(CombatDeathEvent event)
|
||||||
{
|
{
|
||||||
Game game = Manager.GetGame();
|
Game game = Manager.GetGame();
|
||||||
if (game == null) return;
|
if (game == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player killed = (Player)event.GetEvent().getEntity();
|
Player killed = (Player) event.GetEvent().getEntity();
|
||||||
|
|
||||||
if (event.GetLog().GetKiller() != null)
|
if (event.GetLog().GetKiller() != null)
|
||||||
{
|
{
|
||||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller()
|
||||||
|
.GetName());
|
||||||
|
|
||||||
if (killer != null && !killer.equals(killed))
|
if (killer != null && !killer.equals(killed))
|
||||||
{
|
{
|
||||||
//Kill
|
// Kill
|
||||||
killer.giveExpLevels(2);
|
killer.giveExpLevels(2);
|
||||||
|
|
||||||
killer.playSound(killer.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
killer.playSound(killer.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||||
|
@ -1295,12 +1376,13 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
for (CombatComponent log : event.GetLog().GetAttackers())
|
for (CombatComponent log : event.GetLog().GetAttackers())
|
||||||
{
|
{
|
||||||
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
|
if (event.GetLog().GetKiller() != null
|
||||||
|
&& log.equals(event.GetLog().GetKiller()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Player assist = UtilPlayer.searchExact(log.GetName());
|
Player assist = UtilPlayer.searchExact(log.GetName());
|
||||||
|
|
||||||
//Assist
|
// Assist
|
||||||
if (assist != null)
|
if (assist != null)
|
||||||
{
|
{
|
||||||
assist.giveExpLevels(1);
|
assist.giveExpLevels(1);
|
||||||
|
@ -1319,7 +1401,8 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
Material type = result.getType();
|
Material type = result.getType();
|
||||||
|
|
||||||
if (type == Material.BUCKET || type == Material.GOLDEN_APPLE || type == Material.FLINT_AND_STEEL || type.isBlock())
|
if (type == Material.BUCKET || type == Material.GOLDEN_APPLE
|
||||||
|
|| type == Material.FLINT_AND_STEEL || type.isBlock())
|
||||||
{
|
{
|
||||||
event.getInventory().setResult(new ItemStack(Material.AIR));
|
event.getInventory().setResult(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
|
@ -1332,7 +1415,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
_lootedBlocks.clear();
|
_lootedBlocks.clear();
|
||||||
|
|
||||||
WorldServer world = list.isEmpty() ? null : ((CraftWorld) list.get(0).getWorld()).getHandle();
|
WorldServer world = list.isEmpty() ? null : ((CraftWorld) list.get(0)
|
||||||
|
.getWorld()).getHandle();
|
||||||
|
|
||||||
for (Location loc : list)
|
for (Location loc : list)
|
||||||
{
|
{
|
||||||
|
@ -1353,7 +1437,8 @@ public abstract class SurvivalGames extends Game
|
||||||
if (_landedCrates.contains(loc))
|
if (_landedCrates.contains(loc))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fillChest((Player) holder.getInventory().getViewers().get(0), block);
|
fillChest((Player) holder.getInventory().getViewers()
|
||||||
|
.get(0), block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1382,7 +1467,7 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
WorldBorder border = new WorldBorder();
|
WorldBorder border = new WorldBorder();
|
||||||
|
|
||||||
border.transitionSizeBetween(_currentBorder * 2, _previousBorder * 2,
|
border.transitionSizeBetween(_previousBorder * 2, _currentBorder * 2,
|
||||||
_currentBorder != _previousBorder ? 1000 : 0);
|
_currentBorder != _previousBorder ? 1000 : 0);
|
||||||
|
|
||||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||||
|
@ -1402,15 +1487,14 @@ public abstract class SurvivalGames extends Game
|
||||||
WorldBorder border = new WorldBorder();
|
WorldBorder border = new WorldBorder();
|
||||||
|
|
||||||
border.transitionSizeBetween(
|
border.transitionSizeBetween(
|
||||||
_currentBorder * 2,
|
|
||||||
_previousBorder * 2,
|
_previousBorder * 2,
|
||||||
|
_currentBorder * 2,
|
||||||
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
|
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
|
||||||
(System.currentTimeMillis() - _borderStartedMoving))
|
(System.currentTimeMillis() - _borderStartedMoving))
|
||||||
: 0);
|
: 0);
|
||||||
border.setCenter(_spawn.getX(), _spawn.getZ());
|
border.setCenter(_spawn.getX(), _spawn.getZ());
|
||||||
border.setWarningDistance(-10);
|
border.setWarningDistance(-10);
|
||||||
border.setWarningTime(-10);
|
border.setWarningTime(-10);
|
||||||
border.a(29999984);
|
|
||||||
|
|
||||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||||
EnumWorldBorderAction.INITIALIZE);
|
EnumWorldBorderAction.INITIALIZE);
|
||||||
|
@ -1524,7 +1608,8 @@ public abstract class SurvivalGames extends Game
|
||||||
_baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
|
_baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
|
||||||
_baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
|
_baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
|
||||||
_baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20));
|
_baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20));
|
||||||
_baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
|
_baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(
|
||||||
|
Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15));
|
||||||
_spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
|
_spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
|
||||||
|
|
||||||
_spawnLoot.cloneLoot(_baseLoot);
|
_spawnLoot.cloneLoot(_baseLoot);
|
||||||
|
@ -1574,7 +1659,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
// Cooked furnace
|
// Cooked furnace
|
||||||
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
|
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
|
||||||
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
|
_cookedFurnace
|
||||||
|
.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
|
||||||
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
|
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
|
||||||
_cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
|
_cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
|
||||||
_cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
|
_cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
|
||||||
|
@ -1620,8 +1706,14 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), Sound.DONKEY_DEATH, 0.8F, 0);
|
player.playSound(player.getLocation(), Sound.DONKEY_DEATH, 0.8F, 0);
|
||||||
|
|
||||||
Manager.GetCondition().Factory().Speed("Start Speed", player, player, 30, 1, false, false, false);
|
Manager.GetCondition()
|
||||||
Manager.GetCondition().Factory().HealthBoost("Start Health", player, player, 30, 1, false, false, false);
|
.Factory()
|
||||||
|
.Speed("Start Speed", player, player, 30, 1, false, false,
|
||||||
|
false);
|
||||||
|
Manager.GetCondition()
|
||||||
|
.Factory()
|
||||||
|
.HealthBoost("Start Health", player, player, 30, 1, false,
|
||||||
|
false, false);
|
||||||
|
|
||||||
player.setHealth(player.getMaxHealth());
|
player.setHealth(player.getMaxHealth());
|
||||||
|
|
||||||
|
@ -1653,21 +1745,27 @@ public abstract class SurvivalGames extends Game
|
||||||
if (_supplyLocations.isEmpty())
|
if (_supplyLocations.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_supplyCurrent = _supplyLocations.remove(UtilMath.r(_supplyLocations.size()));
|
_supplyCurrent = _supplyLocations.remove(UtilMath
|
||||||
|
.r(_supplyLocations.size()));
|
||||||
|
|
||||||
// Remove Prior
|
// Remove Prior
|
||||||
_supplyCrates.remove(_supplyCurrent.getBlock().getRelative(BlockFace.UP));
|
_supplyCrates.remove(_supplyCurrent.getBlock().getRelative(
|
||||||
_supplyCurrent.getBlock().getRelative(BlockFace.UP).setType(Material.AIR);
|
BlockFace.UP));
|
||||||
|
_supplyCurrent.getBlock().getRelative(BlockFace.UP)
|
||||||
|
.setType(Material.AIR);
|
||||||
|
|
||||||
// Create New
|
// Create New
|
||||||
_supplyCurrent.getBlock().setType(Material.BEACON);
|
_supplyCurrent.getBlock().setType(Material.BEACON);
|
||||||
for (int x = -1; x <= 1; x++)
|
for (int x = -1; x <= 1; x++)
|
||||||
for (int z = -1; z <= 1; z++)
|
for (int z = -1; z <= 1; z++)
|
||||||
_supplyCurrent.getBlock().getRelative(x, -1, z).setType(Material.IRON_BLOCK);
|
_supplyCurrent.getBlock().getRelative(x, -1, z)
|
||||||
|
.setType(Material.IRON_BLOCK);
|
||||||
|
|
||||||
// Announce
|
// Announce
|
||||||
Announce(C.cYellow + C.Bold + "Supply Drop Incoming (" + ChatColor.RESET
|
Announce(C.cYellow + C.Bold + "Supply Drop Incoming ("
|
||||||
+ UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow + C.Bold + ")");
|
+ ChatColor.RESET
|
||||||
|
+ UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow
|
||||||
|
+ C.Bold + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1680,22 +1778,25 @@ public abstract class SurvivalGames extends Game
|
||||||
_supplyEffect.setY(250);
|
_supplyEffect.setY(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BURST)
|
FireworkEffect effect = FireworkEffect.builder().flicker(false)
|
||||||
.trail(false).build();
|
.withColor(Color.YELLOW).with(Type.BURST).trail(false)
|
||||||
|
.build();
|
||||||
UtilFirework.playFirework(_supplyEffect, effect);
|
UtilFirework.playFirework(_supplyEffect, effect);
|
||||||
|
|
||||||
_supplyEffect.setY(_supplyEffect.getY() - 2);
|
_supplyEffect.setY(_supplyEffect.getY() - 2);
|
||||||
|
|
||||||
if (UtilMath.offset(_supplyEffect, _supplyCurrent) < 2)
|
if (UtilMath.offset(_supplyEffect, _supplyCurrent) < 2)
|
||||||
{
|
{
|
||||||
effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL_LARGE).trail(true)
|
effect = FireworkEffect.builder().flicker(false)
|
||||||
.build();
|
.withColor(Color.YELLOW).with(Type.BALL_LARGE)
|
||||||
|
.trail(true).build();
|
||||||
UtilFirework.playFirework(_supplyEffect, effect);
|
UtilFirework.playFirework(_supplyEffect, effect);
|
||||||
|
|
||||||
// Create Chest
|
// Create Chest
|
||||||
_supplyCurrent.getBlock().setType(Material.GLASS);
|
_supplyCurrent.getBlock().setType(Material.GLASS);
|
||||||
|
|
||||||
Block block = _supplyCurrent.getBlock().getRelative(BlockFace.UP);
|
Block block = _supplyCurrent.getBlock().getRelative(
|
||||||
|
BlockFace.UP);
|
||||||
block.setType(Material.CHEST);
|
block.setType(Material.CHEST);
|
||||||
_landedCrates.add(block.getLocation());
|
_landedCrates.add(block.getLocation());
|
||||||
_supplyCrates.add(block);
|
_supplyCrates.add(block);
|
||||||
|
@ -1733,8 +1834,9 @@ public abstract class SurvivalGames extends Game
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation().add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1,
|
UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation()
|
||||||
ViewDist.LONG, UtilServer.getPlayers());
|
.add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1, ViewDist.LONG,
|
||||||
|
UtilServer.getPlayers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,13 +1858,21 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
Player player = _tntMap.remove(event.getEntity());
|
Player player = _tntMap.remove(event.getEntity());
|
||||||
|
|
||||||
/*CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), event.getEntity().getLocation(),
|
/*
|
||||||
((TNTPrimed) event.getEntity()).getYield(), "Throwing TNT");
|
* CustomExplosion explosion = new
|
||||||
|
* CustomExplosion(getArcadeManager().GetDamage(),
|
||||||
|
* event.getEntity().getLocation(), ((TNTPrimed)
|
||||||
|
* event.getEntity()).getYield(), "Throwing TNT");
|
||||||
|
*
|
||||||
|
* explosion.setPlayer(player, true);
|
||||||
|
*/
|
||||||
|
|
||||||
explosion.setPlayer(player, true);*/
|
for (Player other : UtilPlayer.getNearby(event.getEntity()
|
||||||
|
.getLocation(), 14))
|
||||||
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
|
Manager.GetCondition()
|
||||||
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
|
.Factory()
|
||||||
|
.Explosion("Throwing TNT", other, player, 50, 0.1, false,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -1783,26 +1893,35 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (!Recharge.Instance.use(player, "Throw TNT", 0, true, false))
|
if (!Recharge.Instance.use(player, "Throw TNT", 0, true, false))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " yet."));
|
UtilPlayer.message(
|
||||||
|
event.getPlayer(),
|
||||||
|
F.main(GetName(), "You cannot use " + F.item("Throw TNT")
|
||||||
|
+ " yet."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Manager.GetGame().CanThrowTNT(player.getLocation()))
|
if (!Manager.GetGame().CanThrowTNT(player.getLocation()))
|
||||||
{
|
{
|
||||||
// Inform
|
// Inform
|
||||||
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " here."));
|
UtilPlayer.message(
|
||||||
|
event.getPlayer(),
|
||||||
|
F.main(GetName(), "You cannot use " + F.item("Throw TNT")
|
||||||
|
+ " here."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilInv.remove(player, Material.TNT, (byte) 0, 1);
|
UtilInv.remove(player, Material.TNT, (byte) 0, 1);
|
||||||
UtilInv.Update(player);
|
UtilInv.Update(player);
|
||||||
|
|
||||||
TNTPrimed tnt = player.getWorld()
|
TNTPrimed tnt = player.getWorld().spawn(
|
||||||
.spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
player.getEyeLocation()
|
||||||
|
.add(player.getLocation().getDirection()),
|
||||||
|
TNTPrimed.class);
|
||||||
|
|
||||||
tnt.setFuseTicks(60);
|
tnt.setFuseTicks(60);
|
||||||
|
|
||||||
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false);
|
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5,
|
||||||
|
false, 0, 0.1, 10, false);
|
||||||
|
|
||||||
_tntMap.put(tnt, player);
|
_tntMap.put(tnt, player);
|
||||||
}
|
}
|
||||||
|
@ -1817,11 +1936,13 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (event.GetLog().GetKiller() != null)
|
if (event.GetLog().GetKiller() != null)
|
||||||
{
|
{
|
||||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller()
|
||||||
|
.GetName());
|
||||||
|
|
||||||
if (killer != null && !killer.equals(killed))
|
if (killer != null && !killer.equals(killed))
|
||||||
{
|
{
|
||||||
// Manager.GetStatsManager().addStat(killer, GetName(), "kills", 1);
|
// Manager.GetStatsManager().addStat(killer, GetName(), "kills",
|
||||||
|
// 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1829,7 +1950,8 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
if (killed != null)
|
if (killed != null)
|
||||||
{
|
{
|
||||||
// Manager.GetStatsManager().addStat(killed, GetName(), "deaths", 1);
|
// Manager.GetStatsManager().addStat(killed, GetName(),
|
||||||
|
// "deaths", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1843,7 +1965,8 @@ public abstract class SurvivalGames extends Game
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ArrayList<Player> alivePlayers = new ArrayList<Player>(_hiddenNames.keySet());
|
ArrayList<Player> alivePlayers = new ArrayList<Player>(
|
||||||
|
_hiddenNames.keySet());
|
||||||
HashMap<Player, HashMap<Player, Boolean>> checkedPlayers = new HashMap<Player, HashMap<Player, Boolean>>();
|
HashMap<Player, HashMap<Player, Boolean>> checkedPlayers = new HashMap<Player, HashMap<Player, Boolean>>();
|
||||||
|
|
||||||
for (Player target : alivePlayers)
|
for (Player target : alivePlayers)
|
||||||
|
@ -1853,7 +1976,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ScoreboardTeam nmsTeam = (ScoreboardTeam) _packetTeam.get(target.getScoreboard().getTeam(target.getName()));
|
ScoreboardTeam nmsTeam = (ScoreboardTeam) _packetTeam
|
||||||
|
.get(target.getScoreboard().getTeam(target.getName()));
|
||||||
|
|
||||||
packet = new PacketPlayOutScoreboardTeam(nmsTeam, 2);
|
packet = new PacketPlayOutScoreboardTeam(nmsTeam, 2);
|
||||||
}
|
}
|
||||||
|
@ -1868,9 +1992,11 @@ public abstract class SurvivalGames extends Game
|
||||||
{
|
{
|
||||||
boolean hideName = false;
|
boolean hideName = false;
|
||||||
|
|
||||||
if (!checkedPlayers.containsKey(target) || !checkedPlayers.get(target).containsKey(player))
|
if (!checkedPlayers.containsKey(target)
|
||||||
|
|| !checkedPlayers.get(target).containsKey(player))
|
||||||
{
|
{
|
||||||
if (player.getLocation().distance(target.getLocation()) > (GetKit(target) instanceof KitAssassin ? 8 : 24))
|
if (player.getLocation().distance(target.getLocation()) > (GetKit(target) instanceof KitAssassin ? 8
|
||||||
|
: 24))
|
||||||
{
|
{
|
||||||
hideName = true;
|
hideName = true;
|
||||||
}
|
}
|
||||||
|
@ -1881,9 +2007,9 @@ public abstract class SurvivalGames extends Game
|
||||||
}
|
}
|
||||||
|
|
||||||
Player[] players = new Player[]
|
Player[] players = new Player[]
|
||||||
{
|
{
|
||||||
target, player
|
target, player
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(GetKit(player) instanceof KitAssassin || GetKit(target) instanceof KitAssassin))
|
if (!(GetKit(player) instanceof KitAssassin || GetKit(target) instanceof KitAssassin))
|
||||||
{
|
{
|
||||||
|
@ -1894,7 +2020,8 @@ public abstract class SurvivalGames extends Game
|
||||||
|
|
||||||
if (!checkedPlayers.containsKey(p1))
|
if (!checkedPlayers.containsKey(p1))
|
||||||
{
|
{
|
||||||
checkedPlayers.put(p1, new HashMap<Player, Boolean>());
|
checkedPlayers.put(p1,
|
||||||
|
new HashMap<Player, Boolean>());
|
||||||
}
|
}
|
||||||
|
|
||||||
checkedPlayers.get(p1).put(p2, hideName);
|
checkedPlayers.get(p1).put(p2, hideName);
|
||||||
|
@ -1907,7 +2034,8 @@ public abstract class SurvivalGames extends Game
|
||||||
}
|
}
|
||||||
|
|
||||||
// If hiddenNames conta
|
// If hiddenNames conta
|
||||||
if (hideName != _hiddenNames.get(player).contains(target.getName()))
|
if (hideName != _hiddenNames.get(player).contains(
|
||||||
|
target.getName()))
|
||||||
{
|
{
|
||||||
if (!hideName)
|
if (!hideName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -281,7 +281,7 @@ public class UHC extends TeamGame
|
||||||
{
|
{
|
||||||
WorldBorder border = new WorldBorder();
|
WorldBorder border = new WorldBorder();
|
||||||
|
|
||||||
border.transitionSizeBetween(_currentBorder * 2, _previousBorder * 2,
|
border.transitionSizeBetween(_previousBorder * 2, _currentBorder * 2,
|
||||||
_currentBorder != _previousBorder ? 1000 : 0);
|
_currentBorder != _previousBorder ? 1000 : 0);
|
||||||
|
|
||||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||||
|
@ -376,14 +376,13 @@ public class UHC extends TeamGame
|
||||||
WorldBorder border = new WorldBorder();
|
WorldBorder border = new WorldBorder();
|
||||||
|
|
||||||
border.transitionSizeBetween(
|
border.transitionSizeBetween(
|
||||||
_currentBorder * 2,
|
|
||||||
_previousBorder * 2,
|
_previousBorder * 2,
|
||||||
|
_currentBorder * 2,
|
||||||
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
|
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
|
||||||
(System.currentTimeMillis() - _borderStartedMoving))
|
(System.currentTimeMillis() - _borderStartedMoving))
|
||||||
: 0);
|
: 0);
|
||||||
border.setWarningDistance(-10);
|
border.setWarningDistance(-10);
|
||||||
border.setWarningTime(-10);
|
border.setWarningTime(-10);
|
||||||
border.a(29999984);
|
|
||||||
|
|
||||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||||
EnumWorldBorderAction.INITIALIZE);
|
EnumWorldBorderAction.INITIALIZE);
|
||||||
|
|
Loading…
Reference in New Issue