3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-28 20:40:12 +01:00

Fix glitches when moving ArmorStands in 1.8.8

Dieser Commit ist enthalten in:
Steven 2015-10-07 23:27:11 +08:00
Ursprung a38b9a85ec
Commit 9d40b9c2c1
2 geänderte Dateien mit 22 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -170,6 +170,7 @@ public class MainListener implements Listener {
} }
} }
@SuppressWarnings("deprecation")
@EventHandler @EventHandler
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
if (ArmorStandTool.isTool(event.getItemInHand())) { if (ArmorStandTool.isTool(event.getItemInHand())) {
@ -280,7 +281,7 @@ public class MainListener implements Listener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player p = event.getPlayer(); final Player p = event.getPlayer();
if(plugin.carryingArmorStand.containsKey(p.getUniqueId())) { if(plugin.carryingArmorStand.containsKey(p.getUniqueId())) {
if (plugin.playerHasPermission(p, plugin.carryingArmorStand.get(p.getUniqueId()).getLocation().getBlock(), null)) { if (plugin.playerHasPermission(p, plugin.carryingArmorStand.get(p.getUniqueId()).getLocation().getBlock(), null)) {
plugin.carryingArmorStand.remove(p.getUniqueId()); plugin.carryingArmorStand.remove(p.getUniqueId());
@ -306,8 +307,13 @@ public class MainListener implements Listener {
Location l = Utils.getLocationFacing(p.getLocation()); Location l = Utils.getLocationFacing(p.getLocation());
plugin.pickUpArmorStand(spawnArmorStand(l), p, true); plugin.pickUpArmorStand(spawnArmorStand(l), p, true);
Utils.actionBarMsg(p, ChatColor.GREEN + Config.carrying); Utils.actionBarMsg(p, ChatColor.GREEN + Config.carrying);
p.updateInventory();
} }
new BukkitRunnable() {
@Override
public void run() {
p.updateInventory();
}
}.runTaskLater(plugin, 1L);
} }
@EventHandler @EventHandler
@ -471,4 +477,16 @@ public class MainListener implements Listener {
return null; return null;
} }
// Give all permissions to all players - for testing only
/*@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
PermissionAttachment attachment = p.addAttachment(plugin);
attachment.setPermission("astools.command", true);
attachment.setPermission("astools.use", true);
attachment.setPermission("astools.clone", true);
attachment.setPermission("astools.reload", true);
attachment.setPermission("astools.cmdblock", true);
}*/
} }

Datei anzeigen

@ -54,7 +54,8 @@ class Utils {
return false; return false;
} }
static Location getLocationFacing(Location l) { static Location getLocationFacing(Location loc) {
Location l = loc.clone();
Vector v = l.getDirection(); Vector v = l.getDirection();
v.setY(0); v.setY(0);
v.multiply(3); v.multiply(3);