3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-28 04:20:08 +01:00
Dieser Commit ist enthalten in:
Steven 2016-05-19 01:32:57 +08:00
Ursprung 86322971f7
Commit f13d121919
6 geänderte Dateien mit 23 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -26,13 +26,14 @@ public class Main extends JavaPlugin {
public final HashMap<UUID, ItemStack[]> savedInventories = new HashMap<UUID, ItemStack[]>();
private final EulerAngle zero = new EulerAngle(0D, 0D, 0D);
static String NMS_VERSION;
static boolean oneNine;
static boolean oneNine, oneNineFour;
@Override
public void onEnable() {
NMS_VERSION = getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
oneNine = NMS_VERSION.startsWith("v1_9");
getServer().getPluginManager().registerEvents(new MainListener(this), this);
oneNineFour = NMS_VERSION.startsWith("v1_9_R2");
getServer().getPluginManager().registerEvents(new MainListener(this), this);
CommandExecutor ce = new Commands(this);
getCommand("astools").setExecutor(ce);
Config.reload(this);
@ -183,7 +184,12 @@ public class Main extends JavaPlugin {
clone.setChestplate(as.getChestplate());
clone.setLeggings(as.getLeggings());
clone.setBoots(as.getBoots());
clone.setItemInHand(as.getItemInHand());
if(oneNine) {
clone.getEquipment().setItemInMainHand(as.getEquipment().getItemInMainHand());
clone.getEquipment().setItemInOffHand(as.getEquipment().getItemInOffHand());
} else {
clone.setItemInHand(as.getItemInHand());
}
clone.setHeadPose(as.getHeadPose());
clone.setBodyPose(as.getBodyPose());
clone.setLeftArmPose(as.getLeftArmPose());

Datei anzeigen

@ -332,10 +332,15 @@ public class MainListener implements Listener {
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if(event.getEntity() instanceof ArmorStand && event.getDamager() instanceof Player && ArmorStandTool.isHoldingTool((Player) event.getDamager())) {
event.setCancelled(true);
if (noCooldown(event.getDamager())) {
Utils.cycleInventory((Player) event.getDamager());
if(event.getEntity() instanceof ArmorStand) {
if(NBT.isInvulnerable((ArmorStand) event.getEntity())) {
event.setCancelled(true);
}
if(event.getDamager() instanceof Player && ArmorStandTool.isHoldingTool((Player) event.getDamager())) {
event.setCancelled(true);
if(noCooldown(event.getDamager())) {
Utils.cycleInventory((Player) event.getDamager());
}
}
}
}

Datei anzeigen

@ -24,7 +24,7 @@ class NBT {
if(Main.oneNine) {
Field f;
try {
f = nmsEntity.getClass().getDeclaredField("bz");
f = nmsEntity.getClass().getDeclaredField(Main.oneNineFour ? "bA" : "bz");
} catch (NoSuchFieldException e) {
e.printStackTrace();
return 0;
@ -49,7 +49,7 @@ class NBT {
if(Main.oneNine) {
Field f;
try {
f = nmsEntity.getClass().getDeclaredField("bz");
f = nmsEntity.getClass().getDeclaredField(Main.oneNineFour ? "bA" : "bz");
} catch (NoSuchFieldException e) {
e.printStackTrace();
return;

Datei anzeigen

@ -4,7 +4,7 @@
#
# Main Config
#
# File generated by: v2.1.2
# File generated by: v2.1.3
# (If this is not the version you are running, consider deleting this
# config to allow it to be re-created. There may be new config options)
#

Datei anzeigen

@ -4,7 +4,7 @@
#
# Language Config
#
# File generated by: v2.1.2
# File generated by: v2.1.3
# (If this is not the version you are running, consider deleting this
# config to allow it to be re-created. There may be new config options)
#

Datei anzeigen

@ -1,6 +1,6 @@
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
name: ArmorStandTools
version: 2.1.2
version: 2.1.3
author: St3venAU
description: Armor stand manipulation tools
softdepend: [WorldGuard, PlotSquared]