Changed to items...
This commit is contained in:
parent
146274001f
commit
1879a92261
@ -9,6 +9,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
@ -19,7 +20,9 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
@ -74,7 +77,7 @@ public class CastleManager extends MiniPlugin
|
|||||||
private Map<Player, King> _kings = new HashMap<>();
|
private Map<Player, King> _kings = new HashMap<>();
|
||||||
private Map<Player, Peasant> _peasants = new HashMap<>();
|
private Map<Player, Peasant> _peasants = new HashMap<>();
|
||||||
|
|
||||||
private ArmorStand _armorStand;
|
private Item _item;
|
||||||
|
|
||||||
public CastleManager(JavaPlugin plugin, CoreClientManager coreClientManager, HologramManager hologramManager, boolean isHub)
|
public CastleManager(JavaPlugin plugin, CoreClientManager coreClientManager, HologramManager hologramManager, boolean isHub)
|
||||||
{
|
{
|
||||||
@ -261,13 +264,13 @@ public class CastleManager extends MiniPlugin
|
|||||||
if (!isThrone)
|
if (!isThrone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Location arrowLoc = _throneLocations[0].clone().add(0.5, 0.5, 0.5);
|
Location loc = _throneLocations[0].clone().add(0.5, 0, 0.5);
|
||||||
ArmorStand armorStand = arrowLoc.getWorld().spawn(arrowLoc, ArmorStand.class);
|
loc.setYaw(90);
|
||||||
armorStand.setGravity(false);
|
loc.setPitch(0);
|
||||||
armorStand.setVisible(false);
|
Item item = loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WOOL, 1, (byte) 14));
|
||||||
armorStand.setSmall(true);
|
item.setPickupDelay(Integer.MAX_VALUE);
|
||||||
_armorStand = armorStand;
|
item.setVelocity(new Vector().zero());
|
||||||
_armorStand.setPassenger(player);
|
item.setPassenger(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,14 +283,14 @@ public class CastleManager extends MiniPlugin
|
|||||||
if (!(event.getVehicle() instanceof ArmorStand))
|
if (!(event.getVehicle() instanceof ArmorStand))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_armorStand == null)
|
if (_item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!event.getVehicle().equals(_armorStand))
|
if (!event.getVehicle().equals(_item))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_armorStand.remove();
|
_item.remove();
|
||||||
_armorStand = null;
|
_item = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user