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
+44 -27

No files matched your search

@@ -135,7 +135,7 @@ public class SiegeEngine implements Cloneable {
nextShotTime = System.currentTimeMillis();
// PLACEHOLDER. SHOULD BE WE-WRITTEN
EntityProjectile defaultProj = new EntityProjectile(new ItemStack(Material.GRASS_BLOCK));
defaultProj.entityCount = 2;
defaultProj.projectileCount = 2;
defaultProj.entityType = EntityType.SNOWBALL;
defaultProj.particleType = Particle.WHITE_ASH;
defaultProj.soundType = Sound.ENTITY_BLAZE_SHOOT;
@@ -97,11 +97,13 @@ public class SiegeEnginesCommand {
definedSiegeEngines.clear();
addDefaults();
for (SiegeEngine i : definedSiegeEngines.values()) {
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());
for (ItemStack proj : i.getProjectiles().keySet()) {
sender.sendMessage(ColorParser.of("<yellow>SiegeEngine Projectile ItemStacks : %s".formatted(proj)).build());
}
if (Config.doDebug) {
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());
for (ItemStack proj : i.getProjectiles().keySet()) {
sender.sendMessage(ColorParser.of("<yellow>SiegeEngine Projectile ItemStacks : %s".formatted(proj)).build());
}
}
}
sender.sendMessage(ColorParser.of("<yellow>SiegeEngine configs reloaded").build());
}
@@ -284,7 +284,7 @@ public class Config {
Material.getMaterial(config.getString("Projectiles." + projectileName + ".AmmoItem"))));
entityProjectile.inaccuracy = (float) config
.getDouble("Projectiles." + projectileName + ".Inaccuracy");
entityProjectile.entityCount = config.getInt("Projectiles." + projectileName + ".EntityCount");
entityProjectile.projectileCount = config.getInt("Projectiles." + projectileName + ".EntityCount");
entityProjectile.entityType = EntityType
.valueOf(config.getString("Projectiles." + projectileName + ".EntityType"));
entityProjectile.soundType = Sound
@@ -301,7 +301,7 @@ public class Config {
FireworkProjectile fireworkProjectile = new FireworkProjectile(SiegeEnginesUtil.DEFAULT_ROCKET);
fireworkProjectile.inaccuracy = (float) config
.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");
if (fireworkProjectile.delayTime <= 0) {
fireworkProjectile.delayedFire = false;
@@ -317,7 +317,7 @@ public class Config {
Material.getMaterial(config.getString("Projectiles." + projectileName + ".AmmoItem"))));
potionProjectile.inaccuracy = (float) config
.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");
if (potionProjectile.delayTime <= 0) {
potionProjectile.delayedFire = false;
@@ -17,7 +17,7 @@ import org.bukkit.util.Vector;
public class EntityProjectile extends SiegeEngineProjectile {
// Defaults
public int entityCount = 20;
public int projectileCount = 20;
public int arrowOnlyDamage = 6;
public Boolean delayedFire = false;
public int delayTime = 6;
@@ -40,7 +40,7 @@ public class EntityProjectile extends SiegeEngineProjectile {
public void Shoot(Entity player, Entity entity, Location FireLocation, Float velocity) {
playSound = true;
int baseDelay = 0;
for (int i = 0; i < entityCount; i++) {
for (int i = 0; i < projectileCount; i++) {
if (delayedFire) {
baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
@@ -18,7 +18,7 @@ import org.bukkit.util.Vector;
public class FireworkProjectile extends SiegeEngineProjectile {
// Defaults
public int entityCount = 1;
public int projectileCount = 1;
public Boolean delayedFire = true;
public int delayTime = 6;
public EntityType entityType = EntityType.FIREWORK;
@@ -36,7 +36,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
public static FireworkProjectile getDefaultRocketShot(ItemStack rocketItem) {
FireworkProjectile fireProj = new FireworkProjectile(rocketItem);
fireProj.entityCount = 1;
fireProj.projectileCount = 1;
fireProj.entityType = EntityType.FIREWORK;
fireProj.particleType = Particle.WHITE_ASH;
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) {
playSound = true;
int baseDelay = 0;
for (int i = 0; i < entityCount; i++) {
for (int i = 0; i < projectileCount; i++) {
if (delayedFire) {
baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
@@ -5,7 +5,6 @@ import com.github.alathra.siegeengines.Util.SiegeEnginesUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.World;
@@ -14,13 +13,11 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
public class PotionProjectile extends SiegeEngineProjectile {
public int entityCount = 3;
public int projectileCount = 3;
public Boolean delayedFire = false;
public int delayTime = 6;
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) {
//TODO Auto-generated method stub
int baseDelay = 0;
for (int i = 0; i < entityCount; i++) {
for (int i = 0; i < projectileCount; i++) {
if (delayedFire) {
baseDelay += delayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
+26 -8
View File
@@ -49,9 +49,24 @@ DisabledWorlds:
- 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:
StoneShot:
ProjectileType: EXPLOSIVE
@@ -80,7 +95,7 @@ Projectiles:
ScatterShot:
ProjectileType: ENTITY
Inaccuracy: 0.365
EntityCount: 24
ProjectileCount: 24
VelocityFactor: 1.0
EntityType: ARROW
ArrowDamageFactor: 1.0
@@ -89,7 +104,7 @@ Projectiles:
BallistaBoltShot:
ProjectileType: ENTITY
Inaccuracy: 0.0125
EntityCount: 1
ProjectileCount: 1
VelocityFactor: 0.5
EntityType: ARROW
ArrowDamageFactor: 1.0
@@ -98,7 +113,7 @@ Projectiles:
DragonsBreath:
ProjectileType: ENTITY
Inaccuracy: 0.65
EntityCount: 3
ProjectileCount: 3
VelocityFactor: 1.125
EntityType: DRAGON_FIREBALL
AmmoItem: DRAGON_BREATH
@@ -106,7 +121,7 @@ Projectiles:
FireShot:
ProjectileType: ENTITY
Inaccuracy: 0.475
EntityCount: 8
ProjectileCount: 8
VelocityFactor: 1.0
EntityType: SMALL_FIREBALL
AmmoItem: MAGMA_BLOCK
@@ -114,18 +129,21 @@ Projectiles:
FireworkShot:
ProjectileType: FIREWORK
Inaccuracy: 0.125
EntityCount: 1
ProjectileCount: 1
VelocityFactor: 0.5
Delay: 5
SplashPotionProjectile:
ProjectileType: POTION
Inaccuracy: 0.0125
EntityCount: 1
ProjectileCount: 1
VelocityFactor: 0.5
ArrowDamageFactor: 1.0
AmmoItem: SPLASH_POTION
FireSound: ITEM_CROSSBOW_SHOOT
# ======================================
# | Siege Engines |
# ======================================
SiegeEngines:
Trebuchet:
Health: 8