Changed to items...

This commit is contained in:
LCastr0 2017-04-29 01:03:30 -03:00
parent 146274001f
commit 1879a92261
1 changed files with 15 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
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.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
@ -74,7 +77,7 @@ public class CastleManager extends MiniPlugin
private Map<Player, King> _kings = 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)
{
@ -261,13 +264,13 @@ public class CastleManager extends MiniPlugin
if (!isThrone)
return;
Location arrowLoc = _throneLocations[0].clone().add(0.5, 0.5, 0.5);
ArmorStand armorStand = arrowLoc.getWorld().spawn(arrowLoc, ArmorStand.class);
armorStand.setGravity(false);
armorStand.setVisible(false);
armorStand.setSmall(true);
_armorStand = armorStand;
_armorStand.setPassenger(player);
Location loc = _throneLocations[0].clone().add(0.5, 0, 0.5);
loc.setYaw(90);
loc.setPitch(0);
Item item = loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WOOL, 1, (byte) 14));
item.setPickupDelay(Integer.MAX_VALUE);
item.setVelocity(new Vector().zero());
item.setPassenger(player);
}
/**
@ -280,14 +283,14 @@ public class CastleManager extends MiniPlugin
if (!(event.getVehicle() instanceof ArmorStand))
return;
if (_armorStand == null)
if (_item == null)
return;
if (!event.getVehicle().equals(_armorStand))
if (!event.getVehicle().equals(_item))
return;
_armorStand.remove();
_armorStand = null;
_item.remove();
_item = null;
}
/**