Fix even more bugs
This commit is contained in:
parent
8bddad44da
commit
5564dc7daf
@ -30,10 +30,7 @@ import nautilus.game.arcade.kit.perks.PerkDestructor;
|
|||||||
import nautilus.game.arcade.ore.OreHider;
|
import nautilus.game.arcade.ore.OreHider;
|
||||||
import nautilus.game.arcade.ore.OreObsfucation;
|
import nautilus.game.arcade.ore.OreObsfucation;
|
||||||
import nautilus.game.arcade.stats.*;
|
import nautilus.game.arcade.stats.*;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.*;
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
@ -74,11 +71,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
*/
|
*/
|
||||||
private static final long BRIDGE_TIME = TimeUnit.MINUTES.toMillis(10);
|
private static final long BRIDGE_TIME = TimeUnit.MINUTES.toMillis(10);
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of ticks after the prepare state that we wait before setting the world border for the players. Just to make sure they are in the correct world.
|
|
||||||
*/
|
|
||||||
private static final int WORLD_BORDER_PREPARE_TICKS = 20;
|
|
||||||
|
|
||||||
private static final String CUSTOM_BRIDGE_KEY = "TYPE";
|
private static final String CUSTOM_BRIDGE_KEY = "TYPE";
|
||||||
|
|
||||||
//Bridge
|
//Bridge
|
||||||
@ -113,6 +105,8 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
private boolean _tournament;
|
private boolean _tournament;
|
||||||
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
|
private HashMap<GameTeam, Integer> _tournamentKills = new HashMap<GameTeam, Integer>();
|
||||||
private long _tournamentKillMessageTimer = 0;
|
private long _tournamentKillMessageTimer = 0;
|
||||||
|
|
||||||
|
private final Map<GameTeam, Location> _averageSpawns = new HashMap<>();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Bridge(ArcadeManager manager)
|
public Bridge(ArcadeManager manager)
|
||||||
@ -145,7 +139,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
new KitApple(manager),
|
new KitApple(manager),
|
||||||
new KitBerserker(manager),
|
new KitBerserker(manager),
|
||||||
new KitBrawler(manager),
|
new KitBrawler(manager),
|
||||||
new KitMammoth(manager),
|
|
||||||
new KitArcher(manager),
|
new KitArcher(manager),
|
||||||
new KitMiner(manager),
|
new KitMiner(manager),
|
||||||
new KitBomber(manager),
|
new KitBomber(manager),
|
||||||
@ -225,25 +218,18 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
new CompassModule()
|
new CompassModule()
|
||||||
.setGiveCompassToAlive(true)
|
.setGiveCompassToAlive(true)
|
||||||
.register(this);
|
.register(this);
|
||||||
|
|
||||||
new WorldBorderModule().register(this);
|
|
||||||
|
|
||||||
// So that we can be 110% sure
|
// So that we can be 110% sure
|
||||||
for (Kit kit : GetKits())
|
for (Kit kit : GetKits())
|
||||||
{
|
{
|
||||||
if (kit instanceof KitDestructor)
|
if (kit instanceof KitDestructor)
|
||||||
{
|
{
|
||||||
for (Perk perk : kit.GetPerks())
|
((KitDestructor) kit).SetEnabled(false);
|
||||||
{
|
|
||||||
((PerkDestructor) perk).setEnabled(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registerDebugCommand(new DebugCommand("bridge", Rank.ADMIN)
|
registerDebugCommand(new DebugCommand("bridge", getArcadeManager().getGameCommandRank())
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -272,40 +258,15 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler
|
||||||
public void prepare(GameStateChangeEvent event)
|
public void prepare(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Prepare || !WorldData.GetCustomLocs("DISABLE_BORDER").isEmpty())
|
if (event.GetState() != GameState.Prepare)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Delay this so that we are 100% sure people are in the world.
|
Manager.runSyncLater(() -> _animation.onParse(), 10);
|
||||||
Manager.runSyncLater(() -> {
|
|
||||||
|
|
||||||
WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
|
||||||
|
|
||||||
// Here we do some calculations for per player world borders
|
|
||||||
for (GameTeam team : GetTeamList())
|
|
||||||
{
|
|
||||||
// Step 1 - Get the average location of the spawns, we assume this is generally in an OK position.
|
|
||||||
Location center = UtilAlg.getAverageLocation(team.GetSpawns());
|
|
||||||
// Step 1.5 - Move the location back a bit from the centre, this is usually because spawns are on the inside edge of the islands.
|
|
||||||
center.add(UtilAlg.getTrajectory(SpectatorSpawn, center).multiply(15));
|
|
||||||
|
|
||||||
// Step 2 - Calculate an estimate for the size of the border. We'll go with half but the setSize uses the radius so it works out the same to leave it like this
|
|
||||||
double distToCenter = UtilMath.offset2d(SpectatorSpawn, center) * 0.9;
|
|
||||||
|
|
||||||
// Step 3 - Send the setCenter and setSize packets to the team members
|
|
||||||
for (Player player : team.GetPlayers(true))
|
|
||||||
{
|
|
||||||
borderModule.setCenter(player, center);
|
|
||||||
borderModule.setSize(player, distToCenter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}, WORLD_BORDER_PREPARE_TICKS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@ -319,17 +280,13 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty())
|
||||||
{
|
{
|
||||||
WorldWaterDamage = 4;
|
WorldWaterDamage = 4;
|
||||||
}
|
|
||||||
|
|
||||||
if (WorldWaterDamage > 0)
|
|
||||||
{
|
|
||||||
String name = WorldData.MapName;
|
String name = WorldData.MapName;
|
||||||
|
|
||||||
if (name.equals("Volcanic Islands"))
|
if (name.equals("Volcanic Islands"))
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20);
|
UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20);
|
||||||
}
|
}
|
||||||
else if (WorldData.MapName.equals("Icelands"))
|
else if (name.equals("Icelands"))
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(C.cRed + "Warning", "Water is Freezing Cold", 10, 60, 20);
|
UtilTextMiddle.display(C.cRed + "Warning", "Water is Freezing Cold", 10, 60, 20);
|
||||||
}
|
}
|
||||||
@ -388,8 +345,6 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_animation.onParse();
|
|
||||||
|
|
||||||
ParseChests();
|
ParseChests();
|
||||||
|
|
||||||
ParseOre(WorldData.GetCustomLocs("73")); // Red
|
ParseOre(WorldData.GetCustomLocs("73")); // Red
|
||||||
@ -750,12 +705,12 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
{
|
{
|
||||||
_bridgesDown = true;
|
_bridgesDown = true;
|
||||||
|
|
||||||
WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
// WorldBorderModule borderModule = getModule(WorldBorderModule.class);
|
||||||
|
//
|
||||||
for (Player player : GetPlayers(true))
|
// for (Player player : GetPlayers(true))
|
||||||
{
|
// {
|
||||||
borderModule.setSize(player, 10000);
|
// borderModule.setSize(player, 10000);
|
||||||
}
|
// }
|
||||||
|
|
||||||
Manager.GetExplosion().SetLiquidDamage(true);
|
Manager.GetExplosion().SetLiquidDamage(true);
|
||||||
Announce(C.cRedB + "ALERT: " + C.Reset + C.Bold + "THE BRIDGES ARE SPAWNING!");
|
Announce(C.cRedB + "ALERT: " + C.Reset + C.Bold + "THE BRIDGES ARE SPAWNING!");
|
||||||
@ -1754,6 +1709,44 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void updateBorder(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FAST || _bridgesDown)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
|
{
|
||||||
|
List<Location> border = WorldData.GetCustomLocs("BORDER " + team.getDisplayName());
|
||||||
|
|
||||||
|
if (border.size() < 2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location one = border.get(0);
|
||||||
|
Location two = border.get(1);
|
||||||
|
Location average = _averageSpawns.computeIfAbsent(team, k -> UtilAlg.getAverageLocation(team.GetSpawns()));
|
||||||
|
|
||||||
|
one.setY(0);
|
||||||
|
two.setY(256);
|
||||||
|
|
||||||
|
for (Player player : team.GetPlayers(true))
|
||||||
|
{
|
||||||
|
Location location = player.getLocation();
|
||||||
|
|
||||||
|
if (!UtilAlg.inBoundingBox(location, one, two))
|
||||||
|
{
|
||||||
|
player.setVelocity(UtilAlg.getTrajectory(location, average).add(new Vector(0, 1, 0)));
|
||||||
|
player.sendMessage(C.cRedB + "STAY ON YOUR ISLAND!");
|
||||||
|
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0.5F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setBridgeTime(int time)
|
public void setBridgeTime(int time)
|
||||||
{
|
{
|
||||||
_bridgeTime = time;
|
_bridgeTime = time;
|
||||||
|
@ -179,6 +179,11 @@ public abstract class CustomBridgeAnimation extends BridgeAnimation
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Location location : locations)
|
||||||
|
{
|
||||||
|
location.getChunk().load();
|
||||||
|
}
|
||||||
|
|
||||||
for (Block block : UtilBlock.getInBoundingBox(locations.get(0), locations.get(1)))
|
for (Block block : UtilBlock.getInBoundingBox(locations.get(0), locations.get(1)))
|
||||||
{
|
{
|
||||||
if (!_blockIds.contains(block.getTypeId()) || _bridgeBlocks.containsKey(block))
|
if (!_blockIds.contains(block.getTypeId()) || _bridgeBlocks.containsKey(block))
|
||||||
|
@ -16,12 +16,12 @@ public class KitApple extends ProgressingKit
|
|||||||
private static final String[] DESCRIPTION = {
|
private static final String[] DESCRIPTION = {
|
||||||
"Possess the rare skill of finding apples frequently!",
|
"Possess the rare skill of finding apples frequently!",
|
||||||
"",
|
"",
|
||||||
receiveItem("apple", 1, 10, 0),
|
receiveItem("apple", 1, 17, 0),
|
||||||
click(true, "the apple to throw it")
|
click(true, "the apple to throw it")
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Perk[] PERKS = {
|
private static final Perk[] PERKS = {
|
||||||
new PerkApple(10000)
|
new PerkApple(17000)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);
|
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);
|
||||||
|
@ -22,12 +22,12 @@ public class KitArcher extends ProgressingKit
|
|||||||
"Highly trained with a bow, probably an elf or something...",
|
"Highly trained with a bow, probably an elf or something...",
|
||||||
" ",
|
" ",
|
||||||
"Begin the game with a Bow",
|
"Begin the game with a Bow",
|
||||||
receiveArrowString(1, 20, 3),
|
receiveArrowString(1, 20, 4),
|
||||||
"Charge Bow to use " + C.cGreen + "Barrage"
|
"Charge Bow to use " + C.cGreen + "Barrage"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Perk[] PERKS = {
|
private static final Perk[] PERKS = {
|
||||||
new PerkFletcher(20, 3, true),
|
new PerkFletcher(20, 4, true),
|
||||||
new PerkBarrage(5, 250, true, false),
|
new PerkBarrage(5, 250, true, false),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class KitBerserker extends ProgressingKit
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static final Perk[] PERKS = {
|
private static final Perk[] PERKS = {
|
||||||
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000),
|
new PerkLeap("Beserker Leap", 1.2, 1.2, 14000),
|
||||||
new PerkAxeman(),
|
new PerkAxeman(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ public class KitBomber extends ProgressingKit
|
|||||||
private static final String[] DESCRIPTION = {
|
private static final String[] DESCRIPTION = {
|
||||||
"Crazy bomb throwing guy.",
|
"Crazy bomb throwing guy.",
|
||||||
" ",
|
" ",
|
||||||
receiveItem("TNT", 1, 30, 2),
|
receiveItem("TNT", 1, 25, 2),
|
||||||
C.cYellow + "Click" + C.cWhite + " to throw TNT"
|
C.cYellow + "Click" + C.cWhite + " to throw TNT"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Perk[] PERKS = {
|
private static final Perk[] PERKS = {
|
||||||
new PerkBomber(30, 2, -1)
|
new PerkBomber(25, 2, -1)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final ItemStack IN_HAND = new ItemStack(Material.TNT);
|
private static final ItemStack IN_HAND = new ItemStack(Material.TNT);
|
||||||
|
@ -22,12 +22,12 @@ public class KitBrawler extends ProgressingKit
|
|||||||
"Begin with an Iron Sword",
|
"Begin with an Iron Sword",
|
||||||
"Take " + C.cGreen + "75%" + C.cWhite + " knockback",
|
"Take " + C.cGreen + "75%" + C.cWhite + " knockback",
|
||||||
"Deal " + C.cGreen + "125%" + C.cWhite + " knockback",
|
"Deal " + C.cGreen + "125%" + C.cWhite + " knockback",
|
||||||
"Take " + C.cGreen + "-1" + C.cWhite + " damage from all attacks"
|
"Take " + C.cGreen + "-0.5" + C.cWhite + " damage from all attacks"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final Perk[] PERKS = {
|
private static final Perk[] PERKS = {
|
||||||
new PerkMammoth(),
|
new PerkMammoth(),
|
||||||
new PerkIronSkin(1)
|
new PerkIronSkin(0.5)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final ItemStack[] PLAYER_ITEMS = {
|
private static final ItemStack[] PLAYER_ITEMS = {
|
||||||
|
@ -14,7 +14,7 @@ public class PerkMammoth extends Perk
|
|||||||
{
|
{
|
||||||
super("Mammoth", new String[]
|
super("Mammoth", new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Take 75% knockback and deal 125% knockback",
|
C.cGray + "Take 85% knockback and deal 115% knockback",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class PerkMammoth extends Perk
|
|||||||
if (!Kit.HasKit(damager))
|
if (!Kit.HasKit(damager))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.AddKnockback(GetName(), 1.25d);
|
event.AddKnockback(GetName(), 1.15d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
@ -45,6 +45,6 @@ public class PerkMammoth extends Perk
|
|||||||
if (!Kit.HasKit(damagee))
|
if (!Kit.HasKit(damagee))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.AddKnockback(GetName(), 0.75d);
|
event.AddKnockback(GetName(), 0.85d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user