GunnersCore Updated

This commit is contained in:
C_Corp2002 authored and GitHub committed 2023-09-28 16:37:21 -07:00
1 parent 39008a88b2
commit fd5281ecc3
5 files changed
+23 -19

No files matched your search

@@ -158,6 +158,8 @@ public class ClickHandler implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void BlockPlaceEvent(org.bukkit.event.block.BlockPlaceEvent event) {
Player thePlayer = event.getPlayer();
if (event.isCancelled())
return;
if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.CARVED_PUMPKIN) {
ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
if (item.getItemMeta() != null && item.getItemMeta().hasCustomModelData()) {
@@ -179,7 +181,6 @@ public class ClickHandler implements Listener {
public void Shoot(Entity player, long delay) {
float actualDelay = delay;
Boolean FirstShot = true;
if (GunnersCore.TrackedStands.get(player.getUniqueId()) == null) {
for (Entity ent : player.getNearbyEntities(5, 5, 5)) {
if(ent instanceof ArmorStand) {
@@ -192,8 +193,8 @@ public class ClickHandler implements Listener {
}
if (GunnersCore.TrackedStands.get(player.getUniqueId()) == null)
return;
int counter = 0;
for (Entity ent : GunnersCore.TrackedStands.get(player.getUniqueId())){
if (ent == null || ent.isDead()) {
continue;
}
@@ -202,8 +203,10 @@ public class ClickHandler implements Listener {
continue;
}
GunnerEquipment siege = GunnersCore.equipment.get(ent.getUniqueId());
if (counter > 4)
continue;
if (siege.isLoaded()) {
counter++;
if (player instanceof Player) {
siege.Fire(player, actualDelay,0);
actualDelay += delay;
@@ -260,7 +263,7 @@ public class ClickHandler implements Listener {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (ItemInHand.getType() != Material.BOOK) {
if (ItemInHand.getType() != Material.COMPASS) {
return;
}
if (!player.isSneaking())
@@ -61,7 +61,7 @@ public class GunnerEquipment implements Cloneable {
public Boolean RotateStandHead = true;
public Boolean HasFired = false;
public Boolean HasReloaded = false;
public Boolean AllowInvisibleStand = true;
public Boolean AllowInvisibleStand = false;
public Boolean HaseBaseStand = false;
public double BaseStandOffset = 0;
public int BaseStandModelNumber = 147;
@@ -185,7 +185,6 @@ public class GunnersCore extends JavaPlugin {
// TODO Auto-generated catch block
}
return null;
}
@@ -333,7 +332,7 @@ public class GunnersCore extends JavaPlugin {
// pig.SoundType = Sound.ITEM_CROSSBOW_SHOOT;
// pig.ParticleType = Particle.GLOW;
// equip.Projectiles.put(Material.PORKCHOP, pig);
// equip.Projectiles.put(Material.BONE, new PotionProjectile());
// equip.Projectiles.put(Material.BONE, new PotionProjectile());
}
@@ -346,6 +345,7 @@ public class GunnersCore extends JavaPlugin {
return false;
}
l.setY(l.getY() + 1);
int maxNearby = 0;
l.setDirection(player.getFacing().getDirection());
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
@@ -353,7 +353,6 @@ public class GunnersCore extends JavaPlugin {
String id = "";
equip.AmmoHolder = new EquipmentMagazine();
if (equip.HaseBaseStand) {
Location l2 = l;
l2.setY(l.getY() + equip.BaseStandOffset);
@@ -396,6 +395,14 @@ public class GunnersCore extends JavaPlugin {
LivingEntity ent = (LivingEntity) entity2;
ArmorStand stand = (ArmorStand) ent;
equip.Entity = entity2;
for (Entity le : l.getNearbyEntities(5, 5, 5)) {
if (maxNearby >= 4) {
ent.damage(100.0d,player);
return false;
}
if (le instanceof ArmorStand)
maxNearby++;
}
equip.EntityId = entity2.getUniqueId();
stand.addEquipmentLock(EquipmentSlot.HEAD, LockType.REMOVING_OR_CHANGING);
@@ -32,7 +32,7 @@ public class PotionProjectile implements GunnersProjectile {
@Override
public void Shoot(Entity player, Entity entity, Location loc, Float velocity) {
// TODO Auto-generated method stub
//TODO Auto-generated method stub
int baseDelay = 0;
for (int i = 0; i < EntityCount; i++) {
if (DelayedFire) {
@@ -43,10 +43,8 @@ public class PotionProjectile implements GunnersProjectile {
}, (long) baseDelay);
}
else {
CreateEntity(entity, loc, velocity);
}
// }
}
}
@@ -56,8 +54,7 @@ public class PotionProjectile implements GunnersProjectile {
Entity arrow = world.spawnEntity(loc, EntityType.SPLASH_POTION);
if (Inaccuracy != 0f) {
arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise())
.subtract(Randomise()));
arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()).subtract(Randomise()));
}
else {
arrow.setVelocity(loc.getDirection().multiply(velocity));
@@ -31,7 +31,7 @@ public class RotationHandler implements Listener {
if (GunnersCore.TrackedStands.containsKey(player.getUniqueId())) {
ItemStack itemInHand = player.getInventory().getItemInMainHand();
if (itemInHand != null) {
if (itemInHand.getType() != Material.BOOK) {
if (itemInHand.getType() != Material.COMPASS) {
// TrackedStands.remove(player.getUniqueId());
return;
@@ -58,12 +58,9 @@ public class RotationHandler implements Listener {
baseloc.setDirection(dirBetweenLocations);
base.teleport(baseloc);
}
loc.setDirection(dirBetweenLocations);
loc.setDirection(dirBetweenLocations);
}
// loc.setYaw(player.getLocation().getYaw());
//loc.setYaw(player.getLocation().getYaw());
//loc.setPitch(player.getLocation().getPitch());