This commit is contained in:
TheCrunchy committed 2023-07-03 19:22:32 +01:00
1 parent c7587c7ea8
commit b159cd799e
12 files changed
+31 -18

No files matched your search

+1 -1
View File
@@ -8,6 +8,6 @@ import org.bukkit.entity.Player;
public interface CrunchProjectile {
public void Shoot(Player player, Entity entity, Location loc, Float velocity);
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity);
}
+11 -4
View File
@@ -9,6 +9,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -25,24 +26,30 @@ 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, Location loc, Float velocity) {
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity) {
int baseDelay = 0;
for (int i = 0; i < EntityCount; i++) {
if (DelayedFire) {
baseDelay += DelayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
CreateEntity(entity, loc, velocity);
CreateEntity(entity, XOffset, YOffset, velocity);
}, (long) baseDelay);
}
else {
CreateEntity(entity, loc, velocity);
CreateEntity(entity, XOffset, YOffset, velocity);
}
// }
}
}
private void CreateEntity(Entity entity, Location loc, Float velocity) {
private void CreateEntity(Entity entity, double XOffset, double YOffset, 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) {
+11 -5
View File
@@ -8,6 +8,7 @@ import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@@ -17,7 +18,7 @@ import siegeCore.CrunchSiegeCore;
public class ExplosiveProjectile implements CrunchProjectile {
public int Radius = 2;
public int ExplodePower = 2;
public float Inaccuracy = 0.4f;
public int ProjectilesCount = 1;
public Boolean DelayedFire = false;
@@ -25,24 +26,29 @@ 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, Location loc, Float velocity) {
public void Shoot(Player player, Entity entity, double XOffset, double YOffset, Float velocity) {
int baseDelay = 0;
for (int i = 0; i < ProjectilesCount; i++) {
if (DelayedFire) {
baseDelay += DelayTime;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CrunchSiegeCore.plugin, () -> {
CreateEntity(entity, loc, velocity);
CreateEntity(entity, XOffset, YOffset, velocity);
}, (long) baseDelay);
}
else {
CreateEntity(entity, loc, velocity);
CreateEntity(entity, XOffset, YOffset, velocity);
}
// }
}
}
private void CreateEntity(Entity entity, Location loc, Float velocity) {
private void CreateEntity(Entity entity, double XOffset, double YOffset, 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);