mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 14:38:53 +00:00
Added Engine-Health Configuration
This commit is contained in:
1 parent
2a8f69697c
commit
64358e9b80
5 files changed
+29
-13
No files matched your search
@@ -48,7 +48,7 @@ public class SiegeEngine implements Cloneable {
|
|||||||
private int maxFuel;
|
private int maxFuel;
|
||||||
private double placementOffsetY;
|
private double placementOffsetY;
|
||||||
private float velocityPerFuel;
|
private float velocityPerFuel;
|
||||||
|
private double baseHealth = 5.0d;
|
||||||
// Firing variables
|
// Firing variables
|
||||||
private int shotAmount;
|
private int shotAmount;
|
||||||
private long nextShotTime; // Internal
|
private long nextShotTime; // Internal
|
||||||
@@ -469,10 +469,12 @@ public class SiegeEngine implements Cloneable {
|
|||||||
}*/
|
}*/
|
||||||
for (Entity enti : l.getWorld().getNearbyEntities(l,2.5d,2.5d,2.5d)) {
|
for (Entity enti : l.getWorld().getNearbyEntities(l,2.5d,2.5d,2.5d)) {
|
||||||
if (SiegeEngines.activeSiegeEngines.keySet().contains(enti.getUniqueId())) {
|
if (SiegeEngines.activeSiegeEngines.keySet().contains(enti.getUniqueId())) {
|
||||||
ent.damage(20.0d, player);
|
ent.setHealth(0.0d);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stand.setMaxHealth(baseHealth);
|
||||||
|
stand.setHealth(baseHealth);
|
||||||
SiegeEngines.activeSiegeEngines.put(stand.getUniqueId(), this);
|
SiegeEngines.activeSiegeEngines.put(stand.getUniqueId(), this);
|
||||||
ClickHandler.TakeControl(player,stand);
|
ClickHandler.TakeControl(player,stand);
|
||||||
if (mount != null && !(mount.isDead())) {
|
if (mount != null && !(mount.isDead())) {
|
||||||
@@ -530,6 +532,14 @@ public class SiegeEngine implements Cloneable {
|
|||||||
this.worldName = worldName;
|
this.worldName = worldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getHealth() {
|
||||||
|
return baseHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHealth(double health) {
|
||||||
|
this.baseHealth = health;
|
||||||
|
}
|
||||||
|
|
||||||
public Entity getEntity() {
|
public Entity getEntity() {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class Config {
|
|||||||
public static float trebuchetVelocityPerFuel = 0.3f;
|
public static float trebuchetVelocityPerFuel = 0.3f;
|
||||||
public static int trebuchetMaxFuel = 3;
|
public static int trebuchetMaxFuel = 3;
|
||||||
public static Material trebuchetFuelItem = Material.STRING;
|
public static Material trebuchetFuelItem = Material.STRING;
|
||||||
|
public static double trebuchetHealth = 8d;
|
||||||
public static boolean trebuchetCanMount = false;
|
public static boolean trebuchetCanMount = false;
|
||||||
public static HashMap<ItemStack, SiegeEngineProjectile> trebuchetProjectiles = new HashMap<>();
|
public static HashMap<ItemStack, SiegeEngineProjectile> trebuchetProjectiles = new HashMap<>();
|
||||||
public static String trebuchetItemName = "&e&oTrebuchet";
|
public static String trebuchetItemName = "&e&oTrebuchet";
|
||||||
@@ -54,6 +55,7 @@ public class Config {
|
|||||||
|
|
||||||
public static int ballistaShotAmount = 1;
|
public static int ballistaShotAmount = 1;
|
||||||
public static float ballistaVelocityPerFuel = 0.925f;
|
public static float ballistaVelocityPerFuel = 0.925f;
|
||||||
|
public static double ballistaHealth = 5d;
|
||||||
public static int ballistaMaxFuel = 4;
|
public static int ballistaMaxFuel = 4;
|
||||||
public static Material ballistaFuelItem = Material.STRING;
|
public static Material ballistaFuelItem = Material.STRING;
|
||||||
public static boolean ballistaCanMount = false;
|
public static boolean ballistaCanMount = false;
|
||||||
@@ -63,6 +65,7 @@ public class Config {
|
|||||||
|
|
||||||
public static int swivelCannonShotAmount = 1;
|
public static int swivelCannonShotAmount = 1;
|
||||||
public static float swivelCannonVelocityPerFuel = 1.0125f;
|
public static float swivelCannonVelocityPerFuel = 1.0125f;
|
||||||
|
public static double swivelCannonHealth = 15d;
|
||||||
public static int swivelCannonMaxFuel = 5;
|
public static int swivelCannonMaxFuel = 5;
|
||||||
public static Material swivelCannonFuelItem = Material.GUNPOWDER;
|
public static Material swivelCannonFuelItem = Material.GUNPOWDER;
|
||||||
public static boolean swivelCannonCanMount = false;
|
public static boolean swivelCannonCanMount = false;
|
||||||
@@ -72,6 +75,7 @@ public class Config {
|
|||||||
|
|
||||||
public static int breachCannonShotAmount = 1;
|
public static int breachCannonShotAmount = 1;
|
||||||
public static float breachCannonVelocityPerFuel = 1.075f;
|
public static float breachCannonVelocityPerFuel = 1.075f;
|
||||||
|
public static double breachCannonHealth = 25d;
|
||||||
public static int breachCannonMaxFuel = 4;
|
public static int breachCannonMaxFuel = 4;
|
||||||
public static Material breachCannonFuelItem = Material.GUNPOWDER;
|
public static Material breachCannonFuelItem = Material.GUNPOWDER;
|
||||||
public static boolean breachCannonCanMount = false;
|
public static boolean breachCannonCanMount = false;
|
||||||
@@ -110,6 +114,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadTrebuchetValues() {
|
private static void loadTrebuchetValues() {
|
||||||
|
trebuchetHealth = config.getDouble("SiegeEngines.Trebuchet.Health");
|
||||||
trebuchetShotAmount = config.getInt("SiegeEngines.Trebuchet.ShotAmount");
|
trebuchetShotAmount = config.getInt("SiegeEngines.Trebuchet.ShotAmount");
|
||||||
trebuchetVelocityPerFuel = (float) config.getDouble("SiegeEngines.Trebuchet.VelocityPerFuel");
|
trebuchetVelocityPerFuel = (float) config.getDouble("SiegeEngines.Trebuchet.VelocityPerFuel");
|
||||||
trebuchetMaxFuel = config.getInt("SiegeEngines.Trebuchet.MaxFuel");
|
trebuchetMaxFuel = config.getInt("SiegeEngines.Trebuchet.MaxFuel");
|
||||||
@@ -135,6 +140,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadBallistaValues() {
|
private static void loadBallistaValues() {
|
||||||
|
ballistaHealth = config.getDouble("SiegeEngines.Ballista.Health");
|
||||||
ballistaShotAmount = config.getInt("SiegeEngines.Ballista.ShotAmount");
|
ballistaShotAmount = config.getInt("SiegeEngines.Ballista.ShotAmount");
|
||||||
ballistaVelocityPerFuel = (float) config.getDouble("SiegeEngines.Ballista.VelocityPerFuel");
|
ballistaVelocityPerFuel = (float) config.getDouble("SiegeEngines.Ballista.VelocityPerFuel");
|
||||||
ballistaMaxFuel = config.getInt("SiegeEngines.Ballista.MaxFuel");
|
ballistaMaxFuel = config.getInt("SiegeEngines.Ballista.MaxFuel");
|
||||||
@@ -161,6 +167,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadSwivelCannonValues() {
|
private static void loadSwivelCannonValues() {
|
||||||
|
swivelCannonHealth = config.getDouble("SiegeEngines.SwivelCannon.Health");
|
||||||
swivelCannonShotAmount = config.getInt("SiegeEngines.SwivelCannon.ShotAmount");
|
swivelCannonShotAmount = config.getInt("SiegeEngines.SwivelCannon.ShotAmount");
|
||||||
swivelCannonVelocityPerFuel = (float) config.getDouble("SiegeEngines.SwivelCannon.VelocityPerFuel");
|
swivelCannonVelocityPerFuel = (float) config.getDouble("SiegeEngines.SwivelCannon.VelocityPerFuel");
|
||||||
swivelCannonMaxFuel = config.getInt("SiegeEngines.SwivelCannon.MaxFuel");
|
swivelCannonMaxFuel = config.getInt("SiegeEngines.SwivelCannon.MaxFuel");
|
||||||
@@ -187,6 +194,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void loadBreachCannonValues() {
|
private static void loadBreachCannonValues() {
|
||||||
|
breachCannonHealth = config.getDouble("SiegeEngines.BreachCannon.Health");
|
||||||
breachCannonShotAmount = config.getInt("SiegeEngines.BreachCannon.ShotAmount");
|
breachCannonShotAmount = config.getInt("SiegeEngines.BreachCannon.ShotAmount");
|
||||||
breachCannonVelocityPerFuel = (float) config.getDouble("SiegeEngines.BreachCannon.VelocityPerFuel");
|
breachCannonVelocityPerFuel = (float) config.getDouble("SiegeEngines.BreachCannon.VelocityPerFuel");
|
||||||
breachCannonMaxFuel = config.getInt("SiegeEngines.BreachCannon.MaxFuel");
|
breachCannonMaxFuel = config.getInt("SiegeEngines.BreachCannon.MaxFuel");
|
||||||
|
|||||||
@@ -596,22 +596,16 @@ public class ClickHandler implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
|
||||||
public void onEngineDamage(EntityDamageEvent event) {
|
|
||||||
if (event.getEntity() instanceof ArmorStand) {
|
|
||||||
if (event.isCancelled()) return;
|
|
||||||
PlayerHandler.siegeEngineEntityDied(event.getEntity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onEngineDamage(EntityDamageByEntityEvent event) {
|
public void onEngineDamage(EntityDamageByEntityEvent event) {
|
||||||
if (event.getEntity() instanceof ArmorStand) {
|
if (event.getEntity() instanceof ArmorStand) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
if (event.getDamager() instanceof Player) {
|
if (event.getDamager() instanceof Player) {
|
||||||
PlayerHandler.siegeEngineEntityDied(event.getEntity());
|
PlayerHandler.siegeEngineEntityDied(event.getEntity());
|
||||||
|
event.setDamage(20);
|
||||||
|
} else {
|
||||||
|
event.setDamage(5);
|
||||||
}
|
}
|
||||||
event.setDamage(20);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class PlayerHandler implements Listener {
|
|||||||
}
|
}
|
||||||
SiegeEnginesLogger.debug("ENGINE DISABLED/DEAD "+entity.getUniqueId().toString());
|
SiegeEnginesLogger.debug("ENGINE DISABLED/DEAD "+entity.getUniqueId().toString());
|
||||||
}
|
}
|
||||||
Bukkit.getPlayer(uuid).sendMessage("§eSiegeEngine Destroyed!");
|
Bukkit.getPlayer(uuid).sendMessage("§eSiege Engine Destroyed!");
|
||||||
for (UUID eUuid : SiegeEngines.activeSiegeEngines.keySet()) {
|
for (UUID eUuid : SiegeEngines.activeSiegeEngines.keySet()) {
|
||||||
if (Bukkit.getEntity(eUuid) == null || Bukkit.getEntity(eUuid).isDead() || !Bukkit.getEntity(eUuid).isValid()) {
|
if (Bukkit.getEntity(eUuid) == null || Bukkit.getEntity(eUuid).isDead() || !Bukkit.getEntity(eUuid).isValid()) {
|
||||||
SiegeEngines.activeSiegeEngines.remove(eUuid);
|
SiegeEngines.activeSiegeEngines.remove(eUuid);
|
||||||
@@ -123,7 +123,7 @@ public class PlayerHandler implements Listener {
|
|||||||
SiegeEnginesLogger.debug("LEFT-OVER ENGINES? "+SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).toString());
|
SiegeEnginesLogger.debug("LEFT-OVER ENGINES? "+SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).toString());
|
||||||
}
|
}
|
||||||
list.clear();
|
list.clear();
|
||||||
player.sendMessage("§eReleased all SiegeEngines!");
|
player.sendMessage("§eReleased all Siege Engines!");
|
||||||
SiegeEngines.siegeEngineEntitiesPerPlayer.put(uuid,list);
|
SiegeEngines.siegeEngineEntitiesPerPlayer.put(uuid,list);
|
||||||
SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).clear();
|
SiegeEngines.siegeEngineEntitiesPerPlayer.get(uuid).clear();
|
||||||
SiegeEngines.siegeEngineEntitiesPerPlayer.remove(uuid);
|
SiegeEngines.siegeEngineEntitiesPerPlayer.remove(uuid);
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ Projectiles:
|
|||||||
|
|
||||||
SiegeEngines:
|
SiegeEngines:
|
||||||
Trebuchet:
|
Trebuchet:
|
||||||
|
Health: 8
|
||||||
ShotAmount: 1
|
ShotAmount: 1
|
||||||
VelocityPerFuel: 0.75
|
VelocityPerFuel: 0.75
|
||||||
MaxFuel: 3
|
MaxFuel: 3
|
||||||
@@ -128,6 +129,7 @@ SiegeEngines:
|
|||||||
- "&ePlace as a block to spawn a Trebuchet"
|
- "&ePlace as a block to spawn a Trebuchet"
|
||||||
CanMount: false
|
CanMount: false
|
||||||
Ballista:
|
Ballista:
|
||||||
|
Health: 5
|
||||||
ShotAmount: 1
|
ShotAmount: 1
|
||||||
VelocityPerFuel: 2.0
|
VelocityPerFuel: 2.0
|
||||||
MaxFuel: 2
|
MaxFuel: 2
|
||||||
@@ -142,6 +144,7 @@ SiegeEngines:
|
|||||||
- "&ePlace as a block to spawn a Ballista"
|
- "&ePlace as a block to spawn a Ballista"
|
||||||
CanMount: false
|
CanMount: false
|
||||||
SwivelCannon:
|
SwivelCannon:
|
||||||
|
Health: 15
|
||||||
ShotAmount: 1
|
ShotAmount: 1
|
||||||
VelocityPerFuel: 0.975
|
VelocityPerFuel: 0.975
|
||||||
MaxFuel: 5
|
MaxFuel: 5
|
||||||
@@ -157,6 +160,7 @@ SiegeEngines:
|
|||||||
- "&ePlace as a block to spawn a Swivel Cannon"
|
- "&ePlace as a block to spawn a Swivel Cannon"
|
||||||
CanMount: false
|
CanMount: false
|
||||||
BreachCannon:
|
BreachCannon:
|
||||||
|
Health: 25
|
||||||
ShotAmount: 1
|
ShotAmount: 1
|
||||||
VelocityPerFuel: 1.0625
|
VelocityPerFuel: 1.0625
|
||||||
MaxFuel: 4
|
MaxFuel: 4
|
||||||
|
|||||||
Reference in new issue
Block a user