mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-01 22:22:10 +00:00
,
This commit is contained in:
1 parent
d6143dc6ba
commit
e550160cf6
9 files changed
+35
-8
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -59,6 +59,7 @@ public class ExplosiveProjectile implements CrunchProjectile {
|
||||
World world = entity.getLocation().getWorld();
|
||||
Entity tnt = world.spawnEntity(loc, EntityType.SNOWBALL);
|
||||
Snowball ball = (Snowball) tnt;
|
||||
|
||||
ball.setShooter(player);
|
||||
ClickHandler.projectiles.put(tnt.getUniqueId(), this);
|
||||
|
||||
|
||||
@@ -377,12 +377,16 @@ public class ClickHandler implements Listener {
|
||||
|
||||
ent.teleport(loc);
|
||||
}
|
||||
|
||||
NamespacedKey key = new NamespacedKey(CrunchSiegeCore.plugin, "cannons");
|
||||
@EventHandler
|
||||
public void DeathEvent(EntityDeathEvent event) {
|
||||
Boolean removeStands = false;
|
||||
List<ItemStack> items = event.getDrops();
|
||||
if (event.getEntity() instanceof ArmorStand) {
|
||||
if (event.getEntity().getPersistentDataContainer().has(key, PersistentDataType.STRING)) {
|
||||
Entity base = Bukkit.getEntity(UUID.fromString(event.getEntity().getPersistentDataContainer().get(key, PersistentDataType.STRING)));
|
||||
base.remove();
|
||||
}
|
||||
if (CrunchSiegeCore.equipment.containsKey(event.getEntity().getUniqueId())) {
|
||||
removeStands = true;
|
||||
}
|
||||
@@ -553,7 +557,7 @@ public class ClickHandler implements Listener {
|
||||
if (entity.getType() == EntityType.ARMOR_STAND){
|
||||
TakeControl(player, entity);
|
||||
if (CrunchSiegeCore.equipment.containsKey(entity.getUniqueId())) {
|
||||
if (itemInHand.getType() == Material.COMPASS) {
|
||||
if (itemInHand.getType() == Material.RECOVERY_COMPASS) {
|
||||
if (player.isSneaking()) {
|
||||
DoAimDown(entity, 1, player);
|
||||
}
|
||||
@@ -569,10 +573,12 @@ public class ClickHandler implements Listener {
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
if (stand.isInvisible()) {
|
||||
stand.setInvisible(false);
|
||||
player.sendMessage("Equipment is now breakable");
|
||||
}
|
||||
else{
|
||||
if (equipment.AllowInvisibleStand) {
|
||||
stand.setInvisible(true);
|
||||
player.sendMessage("Equipment is no longer breakable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
@@ -44,6 +45,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@@ -299,7 +301,7 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
public static Boolean CreateTrebuchet(Player player, int CustomModelData, Location l) {
|
||||
//l.setY(l.getY() - 1);
|
||||
l.add(0.5, 0, 0.5);
|
||||
|
||||
NamespacedKey key = new NamespacedKey(CrunchSiegeCore.plugin, "cannons");
|
||||
SiegeEquipment equip = CreateClone(CustomModelData);
|
||||
if (equip == null || !equip.Enabled) {
|
||||
return false;
|
||||
@@ -313,14 +315,18 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
|
||||
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
String id = "";
|
||||
equip.AmmoHolder = new EquipmentMagazine();
|
||||
if (equip.HaseBaseStand) {
|
||||
|
||||
|
||||
Location l2 = l;
|
||||
l2.setY(l.getY() + equip.BaseStandOffset);
|
||||
Entity entity3 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
|
||||
LivingEntity ent = (LivingEntity) entity3;
|
||||
ArmorStand stand = (ArmorStand) ent;
|
||||
id = entity3.getUniqueId().toString();
|
||||
meta.setCustomModelData(equip.BaseStandModelNumber);
|
||||
stand.addEquipmentLock(EquipmentSlot.HEAD, LockType.REMOVING_OR_CHANGING);
|
||||
stand.addEquipmentLock(EquipmentSlot.LEGS, LockType.ADDING_OR_CHANGING);
|
||||
@@ -336,6 +342,9 @@ public class CrunchSiegeCore extends JavaPlugin {
|
||||
}
|
||||
l.setY(l.getY() + equip.PlacementOffsetY);
|
||||
Entity entity2 = player.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
|
||||
if (id != "") {
|
||||
entity2.getPersistentDataContainer().set(key, PersistentDataType.STRING, id);
|
||||
}
|
||||
meta.setCustomModelData(equip.ReadyModelNumber);
|
||||
meta.setDisplayName("§e" + equip.EquipmentName +" spawn item");
|
||||
List<String> Lore = new ArrayList<String>();
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package siegeCore;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
@@ -14,11 +17,13 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class RotationHandler implements Listener {
|
||||
NamespacedKey key = new NamespacedKey(CrunchSiegeCore.plugin, "cannons");
|
||||
@EventHandler
|
||||
public void playerMove(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
@@ -42,11 +47,17 @@ public class RotationHandler implements Listener {
|
||||
Location loc = ent.getLocation();
|
||||
|
||||
if (equipment.RotateSideways) {
|
||||
|
||||
|
||||
Location direction = player.getLocation().add(player.getLocation().getDirection().multiply(50));
|
||||
Location direction = player.getLocation().add(player.getLocation().getDirection().multiply(50));
|
||||
|
||||
Vector dirBetweenLocations = direction.toVector().subtract(loc.toVector());
|
||||
Vector dirBetweenLocations = direction.toVector().subtract(loc.toVector());
|
||||
if (ent.getPersistentDataContainer().has(key, PersistentDataType.STRING)) {
|
||||
Entity base = Bukkit.getEntity(UUID.fromString(ent.getPersistentDataContainer().get(key, PersistentDataType.STRING)));
|
||||
Location baseloc = base.getLocation();
|
||||
baseloc.setDirection(dirBetweenLocations);
|
||||
base.teleport(baseloc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
loc.setDirection(dirBetweenLocations);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user