mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-03 14:38:53 +00:00
.
This commit is contained in:
1 parent
9dbb1cd17f
commit
a7cf287a20
5 files changed
+37
-3
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.block.SignChangeEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
@@ -60,6 +61,25 @@ public class ClickHandler implements Listener {
|
|||||||
public float MinDelay = 5;
|
public float MinDelay = 5;
|
||||||
|
|
||||||
public static HashMap<UUID, ExplosiveProjectile> projectiles = new HashMap<UUID, ExplosiveProjectile>();
|
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
|
@EventHandler
|
||||||
public void onHit(ProjectileHitEvent event) {
|
public void onHit(ProjectileHitEvent event) {
|
||||||
@@ -528,7 +548,7 @@ public class ClickHandler implements Listener {
|
|||||||
if (entity.getType() == EntityType.ARMOR_STAND){
|
if (entity.getType() == EntityType.ARMOR_STAND){
|
||||||
TakeControl(player, entity);
|
TakeControl(player, entity);
|
||||||
if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) {
|
if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) {
|
||||||
if (itemInHand == null || itemInHand.getType() == Material.AIR) {
|
if (itemInHand.getType() == Material.COMPASS) {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
DoAimDown(entity, 1, player);
|
DoAimDown(entity, 1, player);
|
||||||
}
|
}
|
||||||
@@ -537,7 +557,19 @@ public class ClickHandler implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SiegeEquipment equipment = CrunchSiegeCore.equipment.get(entity.getUniqueId());
|
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 (itemInHand.getType().equals(equipment.FuelMaterial)) {
|
||||||
if (!equipment.LoadFuel(player)) {
|
if (!equipment.LoadFuel(player)) {
|
||||||
player.sendMessage("Could not load powder.");
|
player.sendMessage("Could not load powder.");
|
||||||
|
|||||||
@@ -153,7 +153,9 @@ public class CrunchSiegeCore extends JavaPlugin {
|
|||||||
meta.setCustomModelData(i.ReadyModelNumber);
|
meta.setCustomModelData(i.ReadyModelNumber);
|
||||||
meta.setDisplayName("§e" + i.EquipmentName +" spawn item");
|
meta.setDisplayName("§e" + i.EquipmentName +" spawn item");
|
||||||
List<String> Lore = new ArrayList<String>();
|
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);
|
meta.setLore(Lore);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
player.getInventory().addItem(item);
|
player.getInventory().addItem(item);
|
||||||
@@ -332,7 +334,7 @@ public class CrunchSiegeCore extends JavaPlugin {
|
|||||||
stand.setBasePlate(false);
|
stand.setBasePlate(false);
|
||||||
ent.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 2000000, 1));
|
ent.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 2000000, 1));
|
||||||
// stand.setSmall(true);
|
// stand.setSmall(true);
|
||||||
stand.setVisible(true);
|
stand.setInvisible(true);
|
||||||
stand.setGravity(false);
|
stand.setGravity(false);
|
||||||
//stand.setSmall(true);
|
//stand.setSmall(true);
|
||||||
ent.getEquipment().setHelmet(item);
|
ent.getEquipment().setHelmet(item);
|
||||||
|
|||||||
Reference in new issue
Block a user