This commit is contained in:
TheCrunchy committed 2023-07-15 12:06:35 +01:00
1 parent 8f467ba352
commit bd0ad436c8
17 files changed
+139 -64

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public interface CrunchProjectile {
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity);
public void Shoot(Player player, Entity entity, Location fireLocation, Float velocity);
public String ProjectileType = "Default";
}
+5 -7
View File
@@ -27,30 +27,28 @@ public class EntityProjectile implements CrunchProjectile{
public Particle ParticleType = Particle.EXPLOSION_LARGE;
public Sound SoundType = Sound.ENTITY_GENERIC_EXPLODE;
@Override
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity) {
public void Shoot(Player player, Entity entity, Location FireLocation, Float velocity) {
int baseDelay = 0;
for (int i = 0; i < EntityCount; i++) {
if (DelayedFire) {
baseDelay += DelayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
CreateEntity(entity, XOffset, YOffset, velocity);
CreateEntity(entity, FireLocation, velocity);
}, (long) baseDelay);
}
else {
CreateEntity(entity, XOffset, YOffset, velocity);
CreateEntity(entity, FireLocation, velocity);
}
// }
}
}
private void CreateEntity(Entity entity, double XOffset, double YOffset, Float velocity) {
private void CreateEntity(Entity entity, Location loc, Float velocity) {
World world = entity.getLocation().getWorld();
LivingEntity living = (LivingEntity) entity;
Location loc = living.getEyeLocation();
Vector direction = entity.getLocation().getDirection().multiply(XOffset);
loc.add(direction);
Entity arrow = world.spawnEntity(loc, EntityTyp);
if (Inaccuracy != 0f) {
@@ -27,29 +27,26 @@ public class ExplosiveProjectile implements CrunchProjectile {
public Particle ParticleType = Particle.EXPLOSION_LARGE;
public Sound SoundType = Sound.ENTITY_GENERIC_EXPLODE;
@Override
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity) {
public void Shoot(Player player, Entity entity, Location loc, Float velocity) {
int baseDelay = 0;
for (int i = 0; i < ProjectilesCount; i++) {
if (DelayedFire) {
baseDelay += DelayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
CreateEntity(entity, XOffset, YOffset, velocity);
CreateEntity(entity, loc, velocity);
}, (long) baseDelay);
}
else {
CreateEntity(entity, XOffset, YOffset, velocity);
CreateEntity(entity,loc, velocity);
}
// }
}
}
private void CreateEntity(Entity entity, double XOffset, double YOffset, Float velocity) {
private void CreateEntity(Entity entity, Location loc, Float velocity) {
LivingEntity living = (LivingEntity) entity;
Location loc = living.getEyeLocation();
Vector direction = entity.getLocation().getDirection().multiply(XOffset);
loc.add(direction);
World world = entity.getLocation().getWorld();
Entity tnt = world.spawnEntity(loc, EntityType.SNOWBALL);
ClickHandler.projectiles.put(tnt.getUniqueId(), this);
+4 -7
View File
@@ -32,7 +32,7 @@ public class PotionProjectile implements CrunchProjectile {
public Sound SoundType = Sound.ENTITY_GENERIC_EXPLODE;
@Override
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity) {
public void Shoot(Player player, Entity entity, Location loc, Float velocity) {
// TODO Auto-generated method stub
int baseDelay = 0;
for (int i = 0; i < EntityCount; i++) {
@@ -40,23 +40,20 @@ public class PotionProjectile implements CrunchProjectile {
baseDelay += DelayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
CreateEntity(entity, XOffset, YOffset, velocity);
CreateEntity(entity,loc, velocity);
}, (long) baseDelay);
}
else {
CreateEntity(entity, XOffset, YOffset, velocity);
CreateEntity(entity, loc, velocity);
}
// }
}
}
private void CreateEntity(Entity entity, double XOffset, double YOffset, Float velocity) {
private void CreateEntity(Entity entity, Location loc, Float velocity) {
World world = entity.getLocation().getWorld();
LivingEntity living = (LivingEntity) entity;
Location loc = living.getEyeLocation();
Vector direction = entity.getLocation().getDirection().multiply(XOffset);
loc.add(direction);
Entity arrow = world.spawnEntity(loc, EntityType.SPLASH_POTION);
if (Inaccuracy != 0f) {