mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-01 22:22:10 +00:00
.
This commit is contained in:
1 parent
9dbb1cd17f
commit
a7cf287a20
5 files changed
+43
-9
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -34,6 +34,7 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
@@ -60,6 +61,25 @@ public class ClickHandler implements Listener {
|
||||
public float MinDelay = 5;
|
||||
|
||||
public static HashMap<UUID, ExplosiveProjectile> projectiles = new HashMap<UUID, ExplosiveProjectile>();
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
for (Entity entity : e.getEntity().getNearbyEntities(e.getYield() + 1, e.getYield()+ 1, e.getYield()+ 1)) {
|
||||
if(entity instanceof ArmorStand) {
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
if (CrunchSiegeCore.towny != null) {
|
||||
TownBlock block = TownyAPI.getInstance().getTownBlock(stand.getLocation());
|
||||
if (block != null) {
|
||||
if (block.hasTown()) {
|
||||
if (!block.getTownBlockOwner().getPermissions().explosion) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stand.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHit(ProjectileHitEvent event) {
|
||||
@@ -70,9 +90,9 @@ public class ClickHandler implements Listener {
|
||||
World world = event.getEntity().getWorld();
|
||||
// world.createExplosion(loc, proj.Radius, proj.DoFire);
|
||||
Entity tnt = event.getEntity().getWorld().spawnEntity(loc, EntityType.PRIMED_TNT);
|
||||
|
||||
|
||||
projectiles.remove(event.getEntity().getUniqueId());
|
||||
|
||||
|
||||
if (proj.PlaceBlocks) {
|
||||
TNTPrimed tntEnt = (TNTPrimed) tnt;
|
||||
tntEnt.setYield(0);
|
||||
@@ -100,7 +120,7 @@ public class ClickHandler implements Listener {
|
||||
tntEnt.setYield(proj.ExplodePower);
|
||||
tntEnt.setFuseTicks(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +351,7 @@ public class ClickHandler implements Listener {
|
||||
|
||||
ent.teleport(loc);
|
||||
}
|
||||
|
||||
|
||||
public void DoAimDown(Entity ent, float amount, Player player) {
|
||||
Location loc = ent.getLocation();
|
||||
ArmorStand stand = (ArmorStand) ent;
|
||||
@@ -352,7 +372,7 @@ public class ClickHandler implements Listener {
|
||||
|
||||
ent.teleport(loc);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void DeathEvent(EntityDeathEvent event) {
|
||||
Boolean removeStands = false;
|
||||
@@ -389,7 +409,7 @@ public class ClickHandler implements Listener {
|
||||
if (ent.isDead()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
DoAimDown(ent, amount, player);
|
||||
}
|
||||
}
|
||||
@@ -528,7 +548,7 @@ public class ClickHandler implements Listener {
|
||||
if (entity.getType() == EntityType.ARMOR_STAND){
|
||||
TakeControl(player, entity);
|
||||
if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) {
|
||||
if (itemInHand == null || itemInHand.getType() == Material.AIR) {
|
||||
if (itemInHand.getType() == Material.COMPASS) {
|
||||
if (player.isSneaking()) {
|
||||
DoAimDown(entity, 1, player);
|
||||
}
|
||||
@@ -537,7 +557,19 @@ public class ClickHandler implements Listener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SiegeEquipment equipment = CrunchSiegeCore.equipment.get(entity.getUniqueId());
|
||||
|
||||
if (itemInHand == null || itemInHand.getType() == Material.AIR) {
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
if (stand.isInvisible()) {
|
||||
stand.setInvisible(false);
|
||||
}
|
||||
else{
|
||||
stand.setInvisible(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (itemInHand.getType().equals(equipment.FuelMaterial)) {
|
||||
if (!equipment.LoadFuel(player)) {
|
||||
player.sendMessage("Could not load powder.");
|
||||
|
||||
@@ -153,7 +153,9 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
meta.setCustomModelData(i.ReadyModelNumber);
|
||||
meta.setDisplayName("§e" + i.EquipmentName +" spawn item");
|
||||
List<String> Lore = new ArrayList<String>();
|
||||
Lore.add("§ePlace as a block to spawn a " + i.EquipmentName + " or put on an armour stand.");
|
||||
Lore.add("§ePlace as a block to spawn a " + i.EquipmentName);
|
||||
Lore.add("§eor put on an armour stand.");
|
||||
Lore.add("§eRight click to toggle visibility of stand.");
|
||||
meta.setLore(Lore);
|
||||
item.setItemMeta(meta);
|
||||
player.getInventory().addItem(item);
|
||||
@@ -332,7 +334,7 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
stand.setBasePlate(false);
|
||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 2000000, 1));
|
||||
// stand.setSmall(true);
|
||||
stand.setVisible(true);
|
||||
stand.setInvisible(true);
|
||||
stand.setGravity(false);
|
||||
//stand.setSmall(true);
|
||||
ent.getEquipment().setHelmet(item);
|
||||
|
||||
Reference in new issue
Block a user