mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-02 22:23:08 +00:00
Sync with Local
This commit is contained in:
1 parent
5f0546f9f1
commit
d7da47683d
3 files changed
+377
-351
No files matched your search
@@ -303,13 +303,12 @@ public class SiegeEngines extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
l.setY(l.getY() + 1);
|
l.setY(l.getY() + 1);
|
||||||
int maxNearby = 0;
|
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);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
String id = "";
|
String id = "";
|
||||||
equip.AmmoHolder = new EquipmentMagazine();
|
equip.AmmoHolder = new EquipmentMagazine();
|
||||||
if (equip.HaseBaseStand) {
|
if (equip.HasBaseStand) {
|
||||||
|
|
||||||
Location l2 = l;
|
Location l2 = l;
|
||||||
l2.setY(l.getY() + equip.BaseStandOffset);
|
l2.setY(l.getY() + equip.BaseStandOffset);
|
||||||
@@ -352,14 +351,6 @@ public class SiegeEngines 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);
|
||||||
@@ -371,12 +362,9 @@ public class SiegeEngines extends JavaPlugin {
|
|||||||
stand.addEquipmentLock(EquipmentSlot.HAND, LockType.REMOVING_OR_CHANGING);
|
stand.addEquipmentLock(EquipmentSlot.HAND, LockType.REMOVING_OR_CHANGING);
|
||||||
stand.addEquipmentLock(EquipmentSlot.OFF_HAND, LockType.REMOVING_OR_CHANGING);
|
stand.addEquipmentLock(EquipmentSlot.OFF_HAND, LockType.REMOVING_OR_CHANGING);
|
||||||
stand.setInvisible(equip.AllowInvisibleStand);
|
stand.setInvisible(equip.AllowInvisibleStand);
|
||||||
stand.setBasePlate(false);
|
stand.setBasePlate(true);
|
||||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 2000000, 1));
|
|
||||||
// stand.setSmall(true);
|
|
||||||
|
|
||||||
stand.setGravity(false);
|
stand.setGravity(false);
|
||||||
//stand.setSmall(true);
|
|
||||||
ent.getEquipment().setHelmet(item);
|
ent.getEquipment().setHelmet(item);
|
||||||
if (TrackedStands.containsKey(player.getUniqueId())) {
|
if (TrackedStands.containsKey(player.getUniqueId())) {
|
||||||
List<Entity> entities = TrackedStands.get(player.getUniqueId());
|
List<Entity> entities = TrackedStands.get(player.getUniqueId());
|
||||||
|
|||||||
@@ -1,284 +1,293 @@
|
|||||||
package com.github.alathra.siegeengines;
|
package com.github.alathra.siegeengines;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.github.alathra.siegeengines.projectile.GunnersProjectile;
|
import com.github.alathra.siegeengines.projectile.GunnersProjectile;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
//import GunnersProjectiles.GunnersProjectile;
|
//import GunnersProjectiles.GunnersProjectile;
|
||||||
//import GunnersProjectiles.ExplosiveProjectile;
|
//import GunnersProjectiles.ExplosiveProjectile;
|
||||||
//import me.libraryaddict.disguise.DisguiseAPI;
|
//import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
//import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
//import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
//import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
//import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||||
|
|
||||||
public class SiegeEquipment implements Cloneable {
|
public class SiegeEquipment implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SiegeEquipment clone() throws CloneNotSupportedException {
|
public SiegeEquipment clone() throws CloneNotSupportedException {
|
||||||
return (SiegeEquipment) super.clone();
|
return (SiegeEquipment) super.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(String EquipmentId) {
|
public boolean equals(String EquipmentId) {
|
||||||
return this.EquipmentId.equals(EquipmentId);
|
return this.EquipmentId.equals(EquipmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean Enabled = true;
|
public Boolean Enabled = true;
|
||||||
public UUID EntityId;
|
public UUID EntityId;
|
||||||
public Entity Entity;
|
public Entity Entity;
|
||||||
public Integer shotAmount = 1;
|
public Integer shotAmount = 1;
|
||||||
|
|
||||||
public HashMap<ItemStack, GunnersProjectile> Projectiles = new HashMap<ItemStack, GunnersProjectile>();
|
public HashMap<ItemStack, GunnersProjectile> Projectiles = new HashMap<ItemStack, GunnersProjectile>();
|
||||||
|
|
||||||
public String WorldName;
|
public String WorldName;
|
||||||
public String EquipmentName = "Peckle Gun";
|
public String EquipmentName = "Peckle Gun";
|
||||||
public String EquipmentId = this.EquipmentName.replaceAll(" ", "_").toLowerCase();
|
public String EquipmentId = this.EquipmentName.replaceAll(" ", "_").toLowerCase();
|
||||||
public int XOffset = 7;
|
public int XOffset = 2;
|
||||||
public int YOffset = 0;
|
public int YOffset = 0;
|
||||||
public int PitchOffset = 0;
|
public int PitchOffset = 0;
|
||||||
public int MaxFuel = 5;
|
public int MaxFuel = 5;
|
||||||
public double PlacementOffsetY = 0;
|
public double PlacementOffsetY = 0;
|
||||||
public float VelocityPerFuel = 1.75f;
|
public float VelocityPerFuel = 1.0125f;
|
||||||
public ItemStack FuelMaterial = new ItemStack(Material.GUNPOWDER);
|
public ItemStack FuelMaterial = new ItemStack(Material.GUNPOWDER);
|
||||||
public long NextShotTime = System.currentTimeMillis();
|
public long NextShotTime = System.currentTimeMillis();
|
||||||
|
|
||||||
public int MillisecondsBetweenFiringStages;
|
public int MillisecondsBetweenFiringStages;
|
||||||
public int MillisecondsBetweenReloadingStages;
|
public int MillisecondsBetweenReloadingStages;
|
||||||
|
|
||||||
public int MillisecondsToLoad;
|
public int MillisecondsToLoad;
|
||||||
public int ModelNumberToFireAt;
|
public int ModelNumberToFireAt;
|
||||||
public Boolean CycleThroughModelsBeforeFiring = false;
|
public Boolean CycleThroughModelsBeforeFiring = false;
|
||||||
public Boolean RotateSideways = false;
|
public Boolean RotateSideways = false;
|
||||||
public Boolean RotateUpDown = true;
|
public Boolean RotateUpDown = true;
|
||||||
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 = false;
|
public Boolean AllowInvisibleStand = false;
|
||||||
public Boolean HaseBaseStand = false;
|
public Boolean HasBaseStand = false;
|
||||||
public double BaseStandOffset = 0;
|
public double BaseStandOffset = 0;
|
||||||
public int BaseStandModelNumber = 147;
|
public int BaseStandModelNumber = 147;
|
||||||
public int TaskNumber;
|
public int TaskNumber;
|
||||||
|
|
||||||
public int ReadyModelNumber;
|
public int ReadyModelNumber;
|
||||||
|
|
||||||
public int NextModelNumber = 0;
|
public int NextModelNumber = 0;
|
||||||
|
|
||||||
public List<Integer> FiringModelNumbers = new ArrayList<Integer>();
|
public List<Integer> FiringModelNumbers = new ArrayList<Integer>();
|
||||||
|
|
||||||
public EquipmentMagazine AmmoHolder = new EquipmentMagazine();
|
public EquipmentMagazine AmmoHolder = new EquipmentMagazine();
|
||||||
|
|
||||||
public Boolean isLoaded() {
|
public Boolean isLoaded() {
|
||||||
if (this.MaxFuel <= 0 && AmmoHolder.LoadedProjectile >= 1)
|
if (this.MaxFuel <= 0 && AmmoHolder.LoadedProjectile >= 1)
|
||||||
return true;
|
return true;
|
||||||
return (AmmoHolder.LoadedFuel > 0 && AmmoHolder.LoadedProjectile >= 1);
|
return (AmmoHolder.LoadedFuel > 0 && AmmoHolder.LoadedProjectile >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean CanLoadFuel() {
|
public Boolean CanLoadFuel() {
|
||||||
return AmmoHolder.LoadedFuel < MaxFuel;
|
return AmmoHolder.LoadedFuel < MaxFuel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean LoadFuel(Entity player) {
|
public Boolean LoadFuel(Entity player) {
|
||||||
ItemStack fuelItem = this.FuelMaterial;
|
ItemStack fuelItem = this.FuelMaterial;
|
||||||
if (this.AmmoHolder.LoadedFuel == this.MaxFuel) {
|
if (this.AmmoHolder.LoadedFuel == this.MaxFuel) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(player instanceof Player)) {
|
if (!(player instanceof Player)) {
|
||||||
this.AmmoHolder.LoadedFuel = this.MaxFuel;
|
this.AmmoHolder.LoadedFuel = this.MaxFuel;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (((Player) player).getInventory().containsAtLeast(fuelItem, 1) || fuelItem.getType() == Material.AIR) {
|
if (((Player) player).getInventory().containsAtLeast(fuelItem, 1) || fuelItem.getType() == Material.AIR) {
|
||||||
if (CanLoadFuel()) {
|
if (CanLoadFuel()) {
|
||||||
this.AmmoHolder.LoadedFuel += 1;
|
this.AmmoHolder.LoadedFuel += 1;
|
||||||
SaveState();
|
//SaveState();
|
||||||
((Player) player).getInventory().removeItem(fuelItem);
|
((Player) player).getInventory().removeItem(fuelItem);
|
||||||
((Player) player).sendMessage("§eLoaded " + this.AmmoHolder.LoadedFuel + "/" + this.MaxFuel);
|
((Player) player).sendMessage("§eLoaded " + this.AmmoHolder.LoadedFuel + "/" + this.MaxFuel);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean LoadProjectile(Entity player, ItemStack itemInHand) {
|
public Boolean LoadProjectile(Entity player, ItemStack itemInHand) {
|
||||||
if (itemInHand.getAmount() <= 0) {
|
if (itemInHand.getAmount() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(player instanceof Player)) {
|
if (!(player instanceof Player)) {
|
||||||
this.AmmoHolder.LoadedProjectile = 1;
|
this.AmmoHolder.LoadedProjectile = 1;
|
||||||
this.AmmoHolder.LoadedFuel = this.MaxFuel;
|
this.AmmoHolder.LoadedFuel = this.MaxFuel;
|
||||||
this.AmmoHolder.MaterialName = itemInHand;
|
this.AmmoHolder.MaterialName = itemInHand;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this.Projectiles.containsKey(itemInHand.getType()) && this.AmmoHolder.LoadedProjectile == 0) {
|
if (this.Projectiles.containsKey(itemInHand.getType()) && this.AmmoHolder.LoadedProjectile == 0) {
|
||||||
this.AmmoHolder.LoadedProjectile = 1;
|
this.AmmoHolder.LoadedProjectile = 1;
|
||||||
this.AmmoHolder.MaterialName = itemInHand;
|
this.AmmoHolder.MaterialName = itemInHand;
|
||||||
((Player) player).sendMessage("§eAdding Ammo to Weapon");
|
((Player) player).sendMessage("§eAdding Ammunition to Weapon");
|
||||||
itemInHand.setAmount(itemInHand.getAmount() - 1);
|
itemInHand.setAmount(itemInHand.getAmount() - 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveState() {
|
//public void SaveState() {
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
public Location GetFireLocation(LivingEntity living) {
|
public Location GetFireLocation(LivingEntity living) {
|
||||||
Location loc = living.getEyeLocation();
|
if (living == null)
|
||||||
Vector direction = living.getLocation().getDirection().multiply(XOffset);
|
return null;
|
||||||
loc.add(direction);
|
Location loc = living.getEyeLocation();
|
||||||
if (this.YOffset > 0) {
|
Vector direction = living.getLocation().getDirection().multiply(XOffset);
|
||||||
loc.setY(loc.getY() + this.YOffset);
|
loc.add(direction);
|
||||||
} else {
|
if (this.YOffset > 0) {
|
||||||
loc.setY(loc.getY() - this.YOffset);
|
loc.setY(loc.getY() + this.YOffset);
|
||||||
}
|
} else {
|
||||||
loc.setPitch(loc.getPitch() + this.PitchOffset);
|
loc.setY(loc.getY() - this.YOffset);
|
||||||
return loc;
|
}
|
||||||
}
|
loc.setPitch(loc.getPitch() + this.PitchOffset);
|
||||||
|
return loc;
|
||||||
public void ShowFireLocation(Entity player) {
|
}
|
||||||
LivingEntity living = (LivingEntity) this.Entity;
|
|
||||||
if (player instanceof Player) {
|
public void ShowFireLocation(Entity player) {
|
||||||
if (living != null) {
|
LivingEntity living = (LivingEntity) this.Entity;
|
||||||
Location origin = this.GetFireLocation(living);
|
if (player instanceof Player) {
|
||||||
Vector direction = origin.getDirection();
|
if (living != null) {
|
||||||
direction.multiply(5 /* the range */);
|
Location origin = this.GetFireLocation(living);
|
||||||
Location destination = origin.clone().add(direction);
|
Vector direction = origin.getDirection();
|
||||||
|
direction.multiply(5 /* the range */);
|
||||||
direction.normalize();
|
Location destination = origin.clone().add(direction);
|
||||||
for (int i = 0; i < 3 /* range */; i += 1) {
|
|
||||||
Location spawn = origin.add(direction);
|
direction.normalize();
|
||||||
((Player) player).spawnParticle(Particle.CLOUD, spawn, 1, 0, 0, 0, 0);
|
for (int i = 0; i < 3 /* range */; i += 1) {
|
||||||
}
|
Location spawn = origin.add(direction);
|
||||||
}
|
((Player) player).spawnParticle(Particle.CLOUD, spawn, 1, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void Fire(Entity player, float delay, Integer amount) {
|
}
|
||||||
if (amount == null || amount == 0)
|
|
||||||
amount = this.shotAmount;
|
public void Fire(Entity player, float delay, Integer amount) {
|
||||||
this.shotAmount = amount;
|
if (amount == null || amount == 0)
|
||||||
if (System.currentTimeMillis() < this.NextShotTime) {
|
amount = this.shotAmount;
|
||||||
return;
|
this.shotAmount = amount;
|
||||||
}
|
if (System.currentTimeMillis() < this.NextShotTime) {
|
||||||
if (this.AmmoHolder.LoadedFuel <= 0)
|
return;
|
||||||
this.AmmoHolder.LoadedFuel = 3;
|
}
|
||||||
float loadedFuel = this.AmmoHolder.LoadedFuel;
|
if (this.AmmoHolder.LoadedFuel <= 0)
|
||||||
ItemStack LoadedProjectile = this.AmmoHolder.MaterialName;
|
this.AmmoHolder.LoadedFuel = 0;
|
||||||
|
float loadedFuel = this.AmmoHolder.LoadedFuel;
|
||||||
|
ItemStack LoadedProjectile = this.AmmoHolder.MaterialName;
|
||||||
LivingEntity living = (LivingEntity) Entity;
|
|
||||||
if (living == null || living.getEquipment() == null || living.getEquipment().getHelmet() == null || living.getEquipment().getHelmet().getItemMeta() == null) {
|
|
||||||
return;
|
LivingEntity living = (LivingEntity) this.Entity;
|
||||||
}
|
if (living == null || living.getEquipment() == null || living.getEquipment().getHelmet() == null || living.getEquipment().getHelmet().getItemMeta() == null) {
|
||||||
|
return;
|
||||||
if (living.getEquipment().getHelmet().getItemMeta().getCustomModelData() != this.ReadyModelNumber) {
|
}
|
||||||
if (player instanceof Player) {
|
|
||||||
((Player) player).sendMessage("§eCannot fire yet!");
|
if (living.getEquipment().getHelmet().getItemMeta().getCustomModelData() != this.ReadyModelNumber) {
|
||||||
}
|
if (player instanceof Player) {
|
||||||
return;
|
((Player) player).sendMessage("§eCannot fire yet!");
|
||||||
}
|
}
|
||||||
this.AmmoHolder.LoadedFuel = 0;
|
return;
|
||||||
this.AmmoHolder.LoadedProjectile = 0;
|
}
|
||||||
this.AmmoHolder.MaterialName = new ItemStack(Material.AIR, 1);
|
this.AmmoHolder.LoadedFuel = 0;
|
||||||
|
this.AmmoHolder.LoadedProjectile = 0;
|
||||||
this.WorldName = Entity.getWorld().getName();
|
this.AmmoHolder.MaterialName = new ItemStack(Material.AIR, 1);
|
||||||
this.NextShotTime = System.currentTimeMillis() + 1000;
|
|
||||||
//for (int i = 0; i <= this.shotAmount /* range */; i += 1) {
|
this.WorldName = Entity.getWorld().getName();
|
||||||
if (living == null || living.isDead()) {
|
this.NextShotTime = System.currentTimeMillis() + 1000;
|
||||||
return;
|
//for (int i = 0; i <= this.shotAmount /* range */; i += 1) {
|
||||||
}
|
if (living == null || living.isDead()) {
|
||||||
if (this.CycleThroughModelsBeforeFiring) {
|
return;
|
||||||
|
}
|
||||||
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SiegeEngines.plugin, () -> {
|
if (this.CycleThroughModelsBeforeFiring) {
|
||||||
if (living == null || living.isDead()) {
|
|
||||||
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SiegeEngines.plugin, () -> {
|
||||||
return;
|
if (living == null || living.isDead()) {
|
||||||
}
|
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
||||||
|
return;
|
||||||
if (this.HasFired) {
|
}
|
||||||
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
|
||||||
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SiegeEngines.plugin, () -> {
|
if (this.HasFired) {
|
||||||
if (living == null || living.isDead()) {
|
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
||||||
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SiegeEngines.plugin, () -> {
|
||||||
return;
|
if (living == null || living.isDead()) {
|
||||||
}
|
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
||||||
// player.sendMessage("§etask");
|
return;
|
||||||
if (this.HasReloaded) {
|
}
|
||||||
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
// player.sendMessage("§etask");
|
||||||
this.HasReloaded = false;
|
if (this.HasReloaded) {
|
||||||
this.HasFired = false;
|
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
||||||
this.NextModelNumber = 0;
|
this.HasReloaded = false;
|
||||||
SiegeEngines.UpdateEntityIdModel(this.Entity, this.ReadyModelNumber, this.WorldName);
|
this.HasFired = false;
|
||||||
this.TaskNumber = 0;
|
this.NextModelNumber = 0;
|
||||||
} else {
|
SiegeEngines.UpdateEntityIdModel(this.Entity, this.ReadyModelNumber, this.WorldName);
|
||||||
//firing stages
|
this.TaskNumber = 0;
|
||||||
if (this.NextModelNumber - 1 <= this.FiringModelNumbers.size() && this.NextModelNumber - 1 >= 0) {
|
} else {
|
||||||
int modelData = this.FiringModelNumbers.get(this.NextModelNumber - 1);
|
//firing stages
|
||||||
// player.sendMessage("§e" + modelData);
|
if (this.NextModelNumber - 1 <= this.FiringModelNumbers.size() && this.NextModelNumber - 1 >= 0) {
|
||||||
SiegeEngines.UpdateEntityIdModel(this.Entity, modelData, this.WorldName);
|
int modelData = this.FiringModelNumbers.get(this.NextModelNumber - 1);
|
||||||
this.NextModelNumber -= 1;
|
// player.sendMessage("§e" + modelData);
|
||||||
|
SiegeEngines.UpdateEntityIdModel(this.Entity, modelData, this.WorldName);
|
||||||
} else {
|
this.NextModelNumber -= 1;
|
||||||
// plugin.getLogger().log(Level.INFO, "its reloaded");
|
|
||||||
this.HasReloaded = true;
|
} else {
|
||||||
}
|
// plugin.getLogger().log(Level.INFO, "its reloaded");
|
||||||
}
|
this.HasReloaded = true;
|
||||||
}, 0, this.MillisecondsBetweenReloadingStages);
|
}
|
||||||
|
}
|
||||||
} else {
|
}, 0, this.MillisecondsBetweenReloadingStages);
|
||||||
//firing stages
|
|
||||||
if (this.NextModelNumber < this.FiringModelNumbers.size()) {
|
} else {
|
||||||
|
//firing stages
|
||||||
int modelData = this.FiringModelNumbers.get(this.NextModelNumber);
|
if (this.NextModelNumber < this.FiringModelNumbers.size()) {
|
||||||
// player.sendMessage("§e" + modelData);
|
|
||||||
SiegeEngines.UpdateEntityIdModel(this.Entity, modelData, this.WorldName);
|
int modelData = this.FiringModelNumbers.get(this.NextModelNumber);
|
||||||
if (modelData == this.ModelNumberToFireAt) {
|
// player.sendMessage("§e" + modelData);
|
||||||
// player.sendMessage("§efiring" + modelData);
|
SiegeEngines.UpdateEntityIdModel(this.Entity, modelData, this.WorldName);
|
||||||
Projectiles.get(LoadedProjectile).Shoot(player, this.Entity, this.GetFireLocation(living), loadedFuel * this.VelocityPerFuel);
|
if (modelData == this.ModelNumberToFireAt) {
|
||||||
}
|
// player.sendMessage("§efiring" + modelData);
|
||||||
this.NextModelNumber += 1;
|
if (LoadedProjectile == null) return;
|
||||||
|
if (LoadedProjectile.getType() == Material.AIR) return;
|
||||||
} else {
|
GunnersProjectile projType = Projectiles.get(LoadedProjectile);
|
||||||
this.HasFired = true;
|
if (projType == null) return;
|
||||||
|
projType.Shoot(player, this.Entity, this.GetFireLocation(living), loadedFuel * this.VelocityPerFuel);
|
||||||
}
|
}
|
||||||
}
|
this.NextModelNumber += 1;
|
||||||
}, 0, this.MillisecondsBetweenFiringStages);
|
|
||||||
} else {
|
} else {
|
||||||
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.plugin, () -> {
|
this.HasFired = true;
|
||||||
//player.sendMessage("§etask");
|
|
||||||
if (living == null || living.isDead()) {
|
}
|
||||||
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
}
|
||||||
return;
|
}, 0, this.MillisecondsBetweenFiringStages);
|
||||||
}
|
} else {
|
||||||
|
this.TaskNumber = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.plugin, () -> {
|
||||||
Location loc = living.getEyeLocation();
|
//player.sendMessage("§etask");
|
||||||
Vector direction = Entity.getLocation().getDirection().multiply(XOffset);
|
if (living == null || living.isDead()) {
|
||||||
|
Bukkit.getServer().getScheduler().cancelTask(this.TaskNumber);
|
||||||
loc.add(direction);
|
return;
|
||||||
|
}
|
||||||
this.NextModelNumber = 0;
|
|
||||||
|
Location loc = living.getEyeLocation();
|
||||||
Projectiles.get(LoadedProjectile).Shoot(player, this.Entity, this.GetFireLocation(living), loadedFuel * this.VelocityPerFuel);
|
Vector direction = Entity.getLocation().getDirection().multiply(XOffset);
|
||||||
}, (long) delay);
|
|
||||||
|
loc.add(direction);
|
||||||
}
|
|
||||||
}
|
this.NextModelNumber = 0;
|
||||||
//}
|
if (LoadedProjectile == null) return;
|
||||||
|
if (LoadedProjectile.getType() == Material.AIR) return;
|
||||||
}
|
GunnersProjectile projType = Projectiles.get(LoadedProjectile);
|
||||||
|
if (projType == null) return;
|
||||||
|
projType.Shoot(player, this.Entity, this.GetFireLocation(living), loadedFuel * this.VelocityPerFuel);
|
||||||
|
}, (long) delay);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -151,6 +151,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.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.CARVED_PUMPKIN) {
|
if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.CARVED_PUMPKIN) {
|
||||||
@@ -195,7 +197,8 @@ public class ClickHandler implements Listener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double distance = player.getLocation().distance(ent.getLocation());
|
double distance = player.getLocation().distance(ent.getLocation());
|
||||||
if (distance >= 64) {
|
if (distance >= 32) {
|
||||||
|
SiegeEngines.TrackedStands.get(player.getUniqueId()).remove(ent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SiegeEquipment siege = SiegeEngines.equipment.get(ent.getUniqueId());
|
SiegeEquipment siege = SiegeEngines.equipment.get(ent.getUniqueId());
|
||||||
@@ -244,14 +247,16 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasItem(Inventory inv, ItemStack m) {
|
public static boolean hasItem(Inventory inv, ItemStack m) {
|
||||||
ItemStack[] contents = inv.getStorageContents();
|
//ItemStack[] contents = inv.getStorageContents();
|
||||||
for(int i = 0; i < contents.length; i++) {
|
/*for(int i = 0; i < contents.length; i++) {
|
||||||
if(contents[i] == null) continue;
|
if(contents[i] == null) continue;
|
||||||
if(contents[i].isSimilar(m)) {
|
if(contents[i].isSimilar(m)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
return false;
|
//m.setAmount(1);
|
||||||
|
return inv.containsAtLeast(m,m.getAmount());
|
||||||
|
//return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -279,7 +284,11 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
List<Entity> entities = SiegeEngines.TrackedStands.get(player.getUniqueId());
|
List<Entity> entities = SiegeEngines.TrackedStands.get(player.getUniqueId());
|
||||||
|
if (entities == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (Entity entity : entities) {
|
for (Entity entity : entities) {
|
||||||
|
|
||||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||||
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
||||||
if (equip != null && equip.Enabled && !(entity.isDead())) {
|
if (equip != null && equip.Enabled && !(entity.isDead())) {
|
||||||
@@ -287,12 +296,17 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (SiegeEngines.TrackedStands.containsKey(player.getUniqueId())) {
|
if (SiegeEngines.TrackedStands.containsKey(player.getUniqueId())) {
|
||||||
List<Entity> entities = SiegeEngines.TrackedStands.get(player.getUniqueId());
|
List<Entity> entities = SiegeEngines.TrackedStands.get(player.getUniqueId());
|
||||||
|
if (entities == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
player.sendMessage("§eReloading Ammunition");
|
player.sendMessage("§eReloading Ammunition");
|
||||||
|
boolean foundAmmo = false;
|
||||||
for (Entity entity : entities) {
|
for (Entity entity : entities) {
|
||||||
boolean foundAmmo = false;
|
foundAmmo = false;
|
||||||
if ((entity.isDead())) continue;
|
if ((entity.isDead())) continue;
|
||||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||||
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
||||||
@@ -306,7 +320,7 @@ public class ClickHandler implements Listener {
|
|||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem((Inventory)state.getInventory(),stack))
|
if (!hasItem((Inventory)state.getInventory(),stack))
|
||||||
continue;
|
continue;
|
||||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
equip.AmmoHolder.LoadedProjectile = 1;
|
equip.AmmoHolder.LoadedProjectile = 1;
|
||||||
@@ -316,7 +330,7 @@ public class ClickHandler implements Listener {
|
|||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
}
|
}
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
break;
|
||||||
if (entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.CHEST) {
|
if (entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.CHEST) {
|
||||||
Block inv = entity.getLocation().getBlock().getRelative(0, -1, 0);
|
Block inv = entity.getLocation().getBlock().getRelative(0, -1, 0);
|
||||||
Container state = ((Container) inv.getState());
|
Container state = ((Container) inv.getState());
|
||||||
@@ -324,7 +338,7 @@ public class ClickHandler implements Listener {
|
|||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem((Inventory)state.getInventory(),stack))
|
if (!hasItem((Inventory)state.getInventory(),stack))
|
||||||
continue;
|
continue;
|
||||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
equip.AmmoHolder.LoadedProjectile = 1;
|
equip.AmmoHolder.LoadedProjectile = 1;
|
||||||
@@ -334,7 +348,7 @@ public class ClickHandler implements Listener {
|
|||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
}
|
}
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
break;
|
||||||
if (entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.CHEST) {
|
if (entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.CHEST) {
|
||||||
Block inv = entity.getLocation().getBlock().getRelative(0, 1, 0);
|
Block inv = entity.getLocation().getBlock().getRelative(0, 1, 0);
|
||||||
Container state = ((Container) inv.getState());
|
Container state = ((Container) inv.getState());
|
||||||
@@ -342,7 +356,7 @@ public class ClickHandler implements Listener {
|
|||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem((Inventory)state.getInventory(),stack))
|
if (!hasItem((Inventory)state.getInventory(),stack))
|
||||||
continue;
|
continue;
|
||||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
equip.AmmoHolder.LoadedProjectile = 1;
|
equip.AmmoHolder.LoadedProjectile = 1;
|
||||||
@@ -352,72 +366,50 @@ public class ClickHandler implements Listener {
|
|||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
}
|
}
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
break;
|
||||||
if (!player.isSneaking())
|
if (!player.isSneaking())
|
||||||
return;
|
break;
|
||||||
if (!foundAmmo) {
|
if (!foundAmmo) {
|
||||||
for (ItemStack inventoryItem : event.getPlayer().getInventory().getContents()) {
|
for (ItemStack inventoryItem : event.getPlayer().getInventory().getContents()) {
|
||||||
for (ItemStack stack : equip.Projectiles.keySet()) {
|
for (ItemStack stack : equip.Projectiles.keySet()) {
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem(event.getPlayer().getInventory(),stack))
|
if (!hasItem(event.getPlayer().getInventory(),stack))
|
||||||
continue;
|
continue;
|
||||||
if (stack.isSimilar(inventoryItem) && equip.AmmoHolder.LoadedProjectile == 0) {
|
if (stack.isSimilar(inventoryItem) && equip.AmmoHolder.LoadedProjectile == 0) {
|
||||||
equip.AmmoHolder.LoadedProjectile = 1;
|
equip.AmmoHolder.LoadedProjectile = 1;
|
||||||
equip.AmmoHolder.MaterialName = stack;
|
equip.AmmoHolder.MaterialName = stack;
|
||||||
inventoryItem.setAmount(inventoryItem.getAmount() - 1);
|
inventoryItem.setAmount(inventoryItem.getAmount() - 1);
|
||||||
foundAmmo = true;
|
foundAmmo = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!foundAmmo) {
|
||||||
|
event.getPlayer().sendMessage("§eCould not load Ammunition.");
|
||||||
|
}
|
||||||
player.sendMessage("§eReloading Propellant");
|
player.sendMessage("§eReloading Propellant");
|
||||||
for (Entity entity : entities) {
|
for (Entity entity : entities) {
|
||||||
boolean foundAmmo = false;
|
foundAmmo = false;
|
||||||
if ((entity.isDead())) continue;
|
if ((entity.isDead())) continue;
|
||||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||||
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
||||||
if (equip == null || !equip.Enabled) {
|
if (equip == null || !equip.Enabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ItemStack stack = equip.FuelMaterial;
|
||||||
if (entity.getLocation().getBlock().getType() == Material.BARREL || entity.getLocation().getBlock().getType() == Material.CHEST) {
|
if (entity.getLocation().getBlock().getType() == Material.BARREL || entity.getLocation().getBlock().getType() == Material.CHEST) {
|
||||||
Block inv = entity.getLocation().getBlock();
|
Block inv = entity.getLocation().getBlock();
|
||||||
Container state = ((Container) inv.getState());
|
Container state = ((Container) inv.getState());
|
||||||
ItemStack stack = equip.FuelMaterial;
|
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem((Inventory)state.getInventory(),stack))
|
if (!hasItem((Inventory)state.getInventory(),stack))
|
||||||
continue;
|
|
||||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
|
||||||
//state.update(true,true);
|
|
||||||
equip.AmmoHolder.LoadedFuel += 1;
|
|
||||||
foundAmmo = true;
|
|
||||||
//state.update(true,true);
|
|
||||||
}
|
|
||||||
if (entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.CHEST) {
|
|
||||||
Block inv = entity.getLocation().getBlock().getRelative(0, -1, 0);;
|
|
||||||
Container state = ((Container) inv.getState());
|
|
||||||
ItemStack stack = equip.FuelMaterial;
|
|
||||||
if (foundAmmo)
|
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem((Inventory)state.getInventory(),stack))
|
if (!equip.CanLoadFuel())
|
||||||
continue;
|
|
||||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
|
||||||
//state.update(true,true);
|
|
||||||
equip.AmmoHolder.LoadedFuel += 1;
|
|
||||||
foundAmmo = true;
|
|
||||||
//state.update(true,true);
|
|
||||||
}
|
|
||||||
if (entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.CHEST) {
|
|
||||||
Block inv = entity.getLocation().getBlock().getRelative(0, 1, 0);
|
|
||||||
Container state = ((Container) inv.getState());
|
|
||||||
ItemStack stack = equip.FuelMaterial;
|
|
||||||
if (foundAmmo)
|
|
||||||
continue;
|
continue;
|
||||||
if (!hasItem((Inventory)state.getInventory(),stack))
|
|
||||||
continue;
|
|
||||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
equip.AmmoHolder.LoadedFuel += 1;
|
equip.AmmoHolder.LoadedFuel += 1;
|
||||||
@@ -425,22 +417,59 @@ public class ClickHandler implements Listener {
|
|||||||
//state.update(true,true);
|
//state.update(true,true);
|
||||||
}
|
}
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
break;
|
||||||
|
if (entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, -1, 0).getType() == Material.CHEST) {
|
||||||
|
Block inv = entity.getLocation().getBlock().getRelative(0, -1, 0);;
|
||||||
|
Container state = ((Container) inv.getState());
|
||||||
|
if (foundAmmo)
|
||||||
|
continue;
|
||||||
|
if (!hasItem((Inventory)state.getInventory(),stack))
|
||||||
|
continue;
|
||||||
|
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||||
|
//state.update(true,true);
|
||||||
|
if (!equip.CanLoadFuel())
|
||||||
|
continue;
|
||||||
|
equip.AmmoHolder.LoadedFuel += 1;
|
||||||
|
foundAmmo = true;
|
||||||
|
//state.update(true,true);
|
||||||
|
}
|
||||||
|
if (foundAmmo)
|
||||||
|
break;
|
||||||
|
if (entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.BARREL || entity.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.CHEST) {
|
||||||
|
Block inv = entity.getLocation().getBlock().getRelative(0, 1, 0);
|
||||||
|
Container state = ((Container) inv.getState());
|
||||||
|
if (foundAmmo)
|
||||||
|
continue;
|
||||||
|
if (!hasItem((Inventory)state.getInventory(),stack))
|
||||||
|
continue;
|
||||||
|
if (!equip.CanLoadFuel())
|
||||||
|
continue;
|
||||||
|
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||||
|
//state.update(true,true);
|
||||||
|
equip.AmmoHolder.LoadedFuel += 1;
|
||||||
|
foundAmmo = true;
|
||||||
|
//state.update(true,true);
|
||||||
|
}
|
||||||
|
if (foundAmmo)
|
||||||
|
break;
|
||||||
if (!player.isSneaking())
|
if (!player.isSneaking())
|
||||||
return;
|
break;
|
||||||
if (!foundAmmo) {
|
if (!foundAmmo) {
|
||||||
for (ItemStack inventoryItem : event.getPlayer().getInventory().getContents()) {
|
if (hasItem((Inventory)event.getPlayer().getInventory(),stack)) {
|
||||||
if (foundAmmo)
|
if (foundAmmo)
|
||||||
continue;
|
break;
|
||||||
if (!equip.CanLoadFuel())
|
if (!equip.CanLoadFuel())
|
||||||
continue;
|
continue;
|
||||||
if (equip.FuelMaterial.isSimilar(inventoryItem)) {
|
equip.AmmoHolder.LoadedFuel += 1;
|
||||||
equip.AmmoHolder.LoadedFuel += 1;
|
stack.setAmount(1);
|
||||||
inventoryItem.setAmount(inventoryItem.getAmount() - 1);
|
event.getPlayer().getInventory().removeItem(stack);
|
||||||
foundAmmo = true;
|
foundAmmo = true;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!foundAmmo) {
|
||||||
|
event.getPlayer().sendMessage("§eCould not load Propellant.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -848,7 +877,7 @@ public class ClickHandler implements Listener {
|
|||||||
if (stack.isSimilar(itemInHand) && equipment.AmmoHolder.LoadedProjectile == 0) {
|
if (stack.isSimilar(itemInHand) && equipment.AmmoHolder.LoadedProjectile == 0) {
|
||||||
equipment.AmmoHolder.LoadedProjectile = 1;
|
equipment.AmmoHolder.LoadedProjectile = 1;
|
||||||
equipment.AmmoHolder.MaterialName = stack;
|
equipment.AmmoHolder.MaterialName = stack;
|
||||||
player.sendMessage("§eAdding Ammo to Weapon");
|
player.sendMessage("§eAdding Ammunition to Weapon");
|
||||||
itemInHand.setAmount(itemInHand.getAmount() - 1);
|
itemInHand.setAmount(itemInHand.getAmount() - 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user