fix: EntityCount -> ProjectileCount

This commit is contained in:
ShermansWorld committed 2024-04-06 13:33:45 -04:00
1 parent ade7852210
commit 63d6e722b5
7 files changed
+39 -22

No files matched your search

@@ -135,7 +135,7 @@ public class SiegeEngine implements Cloneable {
nextShotTime = System.currentTimeMillis(); nextShotTime = System.currentTimeMillis();
// PLACEHOLDER. SHOULD BE WE-WRITTEN // PLACEHOLDER. SHOULD BE WE-WRITTEN
EntityProjectile defaultProj = new EntityProjectile(new ItemStack(Material.GRASS_BLOCK)); EntityProjectile defaultProj = new EntityProjectile(new ItemStack(Material.GRASS_BLOCK));
defaultProj.entityCount = 2; defaultProj.projectileCount = 2;
defaultProj.entityType = EntityType.SNOWBALL; defaultProj.entityType = EntityType.SNOWBALL;
defaultProj.particleType = Particle.WHITE_ASH; defaultProj.particleType = Particle.WHITE_ASH;
defaultProj.soundType = Sound.ENTITY_BLAZE_SHOOT; defaultProj.soundType = Sound.ENTITY_BLAZE_SHOOT;
@@ -97,12 +97,14 @@ public class SiegeEnginesCommand {
definedSiegeEngines.clear(); definedSiegeEngines.clear();
addDefaults(); addDefaults();
for (SiegeEngine i : definedSiegeEngines.values()) { for (SiegeEngine i : definedSiegeEngines.values()) {
if (Config.doDebug) {
sender.sendMessage(ColorParser.of("<yellow>Enabled SiegeEngine : %s".formatted(i.getEngineName())).build()); sender.sendMessage(ColorParser.of("<yellow>Enabled SiegeEngine : %s".formatted(i.getEngineName())).build());
sender.sendMessage(ColorParser.of("<yellow>SiegeEngine Propellant/\"Fuel\" ItemStacks : %s".formatted(i.getFuelItem())).build()); sender.sendMessage(ColorParser.of("<yellow>SiegeEngine Propellant/\"Fuel\" ItemStacks : %s".formatted(i.getFuelItem())).build());
for (ItemStack proj : i.getProjectiles().keySet()) { for (ItemStack proj : i.getProjectiles().keySet()) {
sender.sendMessage(ColorParser.of("<yellow>SiegeEngine Projectile ItemStacks : %s".formatted(proj)).build()); sender.sendMessage(ColorParser.of("<yellow>SiegeEngine Projectile ItemStacks : %s".formatted(proj)).build());
} }
} }
}
sender.sendMessage(ColorParser.of("<yellow>SiegeEngine configs reloaded").build()); sender.sendMessage(ColorParser.of("<yellow>SiegeEngine configs reloaded").build());
} }
@@ -284,7 +284,7 @@ public class Config {
Material.getMaterial(config.getString("Projectiles." + projectileName + ".AmmoItem")))); Material.getMaterial(config.getString("Projectiles." + projectileName + ".AmmoItem"))));
entityProjectile.inaccuracy = (float) config entityProjectile.inaccuracy = (float) config
.getDouble("Projectiles." + projectileName + ".Inaccuracy"); .getDouble("Projectiles." + projectileName + ".Inaccuracy");
entityProjectile.entityCount = config.getInt("Projectiles." + projectileName + ".EntityCount"); entityProjectile.projectileCount = config.getInt("Projectiles." + projectileName + ".EntityCount");
entityProjectile.entityType = EntityType entityProjectile.entityType = EntityType
.valueOf(config.getString("Projectiles." + projectileName + ".EntityType")); .valueOf(config.getString("Projectiles." + projectileName + ".EntityType"));
entityProjectile.soundType = Sound entityProjectile.soundType = Sound
@@ -301,7 +301,7 @@ public class Config {
FireworkProjectile fireworkProjectile = new FireworkProjectile(SiegeEnginesUtil.DEFAULT_ROCKET); FireworkProjectile fireworkProjectile = new FireworkProjectile(SiegeEnginesUtil.DEFAULT_ROCKET);
fireworkProjectile.inaccuracy = (float) config fireworkProjectile.inaccuracy = (float) config
.getDouble("Projectiles." + projectileName + ".Inaccuracy"); .getDouble("Projectiles." + projectileName + ".Inaccuracy");
fireworkProjectile.entityCount = config.getInt("Projectiles." + projectileName + ".EntityCount"); fireworkProjectile.projectileCount = config.getInt("Projectiles." + projectileName + ".EntityCount");
fireworkProjectile.delayTime = config.getInt("Projectiles." + projectileName + ".EntityCount"); fireworkProjectile.delayTime = config.getInt("Projectiles." + projectileName + ".EntityCount");
if (fireworkProjectile.delayTime <= 0) { if (fireworkProjectile.delayTime <= 0) {
fireworkProjectile.delayedFire = false; fireworkProjectile.delayedFire = false;
@@ -317,7 +317,7 @@ public class Config {
Material.getMaterial(config.getString("Projectiles." + projectileName + ".AmmoItem")))); Material.getMaterial(config.getString("Projectiles." + projectileName + ".AmmoItem"))));
potionProjectile.inaccuracy = (float) config potionProjectile.inaccuracy = (float) config
.getDouble("Projectiles." + projectileName + ".Inaccuracy"); .getDouble("Projectiles." + projectileName + ".Inaccuracy");
potionProjectile.entityCount = config.getInt("Projectiles." + projectileName + ".EntityCount"); potionProjectile.projectileCount = config.getInt("Projectiles." + projectileName + ".EntityCount");
potionProjectile.delayTime = config.getInt("Projectiles." + projectileName + ".EntityCount"); potionProjectile.delayTime = config.getInt("Projectiles." + projectileName + ".EntityCount");
if (potionProjectile.delayTime <= 0) { if (potionProjectile.delayTime <= 0) {
potionProjectile.delayedFire = false; potionProjectile.delayedFire = false;
@@ -17,7 +17,7 @@ import org.bukkit.util.Vector;
public class EntityProjectile extends SiegeEngineProjectile { public class EntityProjectile extends SiegeEngineProjectile {
// Defaults // Defaults
public int entityCount = 20; public int projectileCount = 20;
public int arrowOnlyDamage = 6; public int arrowOnlyDamage = 6;
public Boolean delayedFire = false; public Boolean delayedFire = false;
public int delayTime = 6; public int delayTime = 6;
@@ -40,7 +40,7 @@ public class EntityProjectile extends SiegeEngineProjectile {
public void Shoot(Entity player, Entity entity, Location FireLocation, Float velocity) { public void Shoot(Entity player, Entity entity, Location FireLocation, Float velocity) {
playSound = true; playSound = true;
int baseDelay = 0; int baseDelay = 0;
for (int i = 0; i < entityCount; i++) { for (int i = 0; i < projectileCount; i++) {
if (delayedFire) { if (delayedFire) {
baseDelay += delayTime; baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
@@ -18,7 +18,7 @@ import org.bukkit.util.Vector;
public class FireworkProjectile extends SiegeEngineProjectile { public class FireworkProjectile extends SiegeEngineProjectile {
// Defaults // Defaults
public int entityCount = 1; public int projectileCount = 1;
public Boolean delayedFire = true; public Boolean delayedFire = true;
public int delayTime = 6; public int delayTime = 6;
public EntityType entityType = EntityType.FIREWORK; public EntityType entityType = EntityType.FIREWORK;
@@ -36,7 +36,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
public static FireworkProjectile getDefaultRocketShot(ItemStack rocketItem) { public static FireworkProjectile getDefaultRocketShot(ItemStack rocketItem) {
FireworkProjectile fireProj = new FireworkProjectile(rocketItem); FireworkProjectile fireProj = new FireworkProjectile(rocketItem);
fireProj.entityCount = 1; fireProj.projectileCount = 1;
fireProj.entityType = EntityType.FIREWORK; fireProj.entityType = EntityType.FIREWORK;
fireProj.particleType = Particle.WHITE_ASH; fireProj.particleType = Particle.WHITE_ASH;
fireProj.soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR; fireProj.soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
@@ -48,7 +48,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
public void Shoot(Entity player, Entity entity, Location FireLocation, Float velocity) { public void Shoot(Entity player, Entity entity, Location FireLocation, Float velocity) {
playSound = true; playSound = true;
int baseDelay = 0; int baseDelay = 0;
for (int i = 0; i < entityCount; i++) { for (int i = 0; i < projectileCount; i++) {
if (delayedFire) { if (delayedFire) {
baseDelay += delayTime; baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
@@ -5,7 +5,6 @@ import com.github.alathra.siegeengines.Util.SiegeEnginesUtil;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
@@ -14,13 +13,11 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class PotionProjectile extends SiegeEngineProjectile { public class PotionProjectile extends SiegeEngineProjectile {
public int entityCount = 3; public int projectileCount = 3;
public Boolean delayedFire = false; public Boolean delayedFire = false;
public int delayTime = 6; public int delayTime = 6;
public float inaccuracy = 0.1f; public float inaccuracy = 0.1f;
@@ -36,7 +33,7 @@ public class PotionProjectile extends SiegeEngineProjectile {
public void Shoot(Entity player, Entity entity, Location loc, Float velocity) { public void Shoot(Entity player, Entity entity, Location loc, Float velocity) {
//TODO Auto-generated method stub //TODO Auto-generated method stub
int baseDelay = 0; int baseDelay = 0;
for (int i = 0; i < entityCount; i++) { for (int i = 0; i < projectileCount; i++) {
if (delayedFire) { if (delayedFire) {
baseDelay += delayTime; baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
+26 -8
View File
@@ -49,9 +49,24 @@ DisabledWorlds:
- World-o_nether - World-o_nether
# ====================================== # ======================================
# | SiegeEngine Options | # | Projectiles |
# ====================================== # ======================================
# You can define as many projectiles as you want for use in Siege Engines
# === Notes on projectile config options ===
# ProjectileType: ENTITY, EXPLOSIVE, FIRWORK or POTION
# ExplodePower: Only used in "EXPLOSIVE" projectile types, defines explosion power
# Inaccuracy: A factor of ramdomness (spread) applied to the aimed vector
# ProjectileCount: How many individual projectile entities will be fired
# VelocityFactor: How fast the projectile(s) will move through the air
# AmmoType: The item that must be loaded into the Siege Engine to produce the projectile
# https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html
# FireSound: What sound the Siege Engine makes when the projectile is fired
# https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
# ArrowDamageFactor: A factor of arrow damage, only applies to ENTITY projectiles of type ARROW
Projectiles: Projectiles:
StoneShot: StoneShot:
ProjectileType: EXPLOSIVE ProjectileType: EXPLOSIVE
@@ -80,7 +95,7 @@ Projectiles:
ScatterShot: ScatterShot:
ProjectileType: ENTITY ProjectileType: ENTITY
Inaccuracy: 0.365 Inaccuracy: 0.365
EntityCount: 24 ProjectileCount: 24
VelocityFactor: 1.0 VelocityFactor: 1.0
EntityType: ARROW EntityType: ARROW
ArrowDamageFactor: 1.0 ArrowDamageFactor: 1.0
@@ -89,7 +104,7 @@ Projectiles:
BallistaBoltShot: BallistaBoltShot:
ProjectileType: ENTITY ProjectileType: ENTITY
Inaccuracy: 0.0125 Inaccuracy: 0.0125
EntityCount: 1 ProjectileCount: 1
VelocityFactor: 0.5 VelocityFactor: 0.5
EntityType: ARROW EntityType: ARROW
ArrowDamageFactor: 1.0 ArrowDamageFactor: 1.0
@@ -98,7 +113,7 @@ Projectiles:
DragonsBreath: DragonsBreath:
ProjectileType: ENTITY ProjectileType: ENTITY
Inaccuracy: 0.65 Inaccuracy: 0.65
EntityCount: 3 ProjectileCount: 3
VelocityFactor: 1.125 VelocityFactor: 1.125
EntityType: DRAGON_FIREBALL EntityType: DRAGON_FIREBALL
AmmoItem: DRAGON_BREATH AmmoItem: DRAGON_BREATH
@@ -106,7 +121,7 @@ Projectiles:
FireShot: FireShot:
ProjectileType: ENTITY ProjectileType: ENTITY
Inaccuracy: 0.475 Inaccuracy: 0.475
EntityCount: 8 ProjectileCount: 8
VelocityFactor: 1.0 VelocityFactor: 1.0
EntityType: SMALL_FIREBALL EntityType: SMALL_FIREBALL
AmmoItem: MAGMA_BLOCK AmmoItem: MAGMA_BLOCK
@@ -114,18 +129,21 @@ Projectiles:
FireworkShot: FireworkShot:
ProjectileType: FIREWORK ProjectileType: FIREWORK
Inaccuracy: 0.125 Inaccuracy: 0.125
EntityCount: 1 ProjectileCount: 1
VelocityFactor: 0.5 VelocityFactor: 0.5
Delay: 5 Delay: 5
SplashPotionProjectile: SplashPotionProjectile:
ProjectileType: POTION ProjectileType: POTION
Inaccuracy: 0.0125 Inaccuracy: 0.0125
EntityCount: 1 ProjectileCount: 1
VelocityFactor: 0.5 VelocityFactor: 0.5
ArrowDamageFactor: 1.0
AmmoItem: SPLASH_POTION AmmoItem: SPLASH_POTION
FireSound: ITEM_CROSSBOW_SHOOT FireSound: ITEM_CROSSBOW_SHOOT
# ======================================
# | Siege Engines |
# ======================================
SiegeEngines: SiegeEngines:
Trebuchet: Trebuchet:
Health: 8 Health: 8