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