Mirror von
https://github.com/St3venAU/ArmorStandTools.git
synchronisiert 2024-12-29 04:50:09 +01:00
v3.0.2 Workaround for spigot bug
Dieser Commit ist enthalten in:
Ursprung
edf2e3aed4
Commit
076fdfd829
@ -9,7 +9,7 @@ I wanted to create an armor stand for each kit in my mini-game, and I quickly be
|
|||||||
|
|
||||||
Compatibility
|
Compatibility
|
||||||
-------------
|
-------------
|
||||||
- Armor Stand Tools v3.0.0 - Spigot/CraftBukkit 1.13 only
|
- Armor Stand Tools v3.0.2 - Spigot/CraftBukkit 1.13 only
|
||||||
- Armor Stand Tools v2.4.3 - Spigot/CraftBukkit 1.8, 1.9, 1.10, 1.11, 1.12
|
- Armor Stand Tools v2.4.3 - Spigot/CraftBukkit 1.8, 1.9, 1.10, 1.11, 1.12
|
||||||
|
|
||||||
Features
|
Features
|
||||||
|
@ -79,7 +79,7 @@ public class Main extends JavaPlugin {
|
|||||||
getLogger().warning("Support for " + nmsVersion + " not found, trying " + usingVersion + ". Please check for possible updates to the plugin.");
|
getLogger().warning("Support for " + nmsVersion + " not found, trying " + usingVersion + ". Please check for possible updates to the plugin.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
nms = (NMS) Class.forName("com.gmail.St3venAU.plugins.ArmorStandTools.NMS_" + usingVersion).getConstructor(String.class).newInstance(nmsVersion);
|
nms = (NMS) Class.forName("com.gmail.St3venAU.plugins.ArmorStandTools.NMS_" + usingVersion).getConstructor(Main.class, String.class).newInstance(this, nmsVersion);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
getLogger().warning("An error occurred while attempting to load support for this version of Craftbukkit/Spigot. Loading plugin failed.");
|
getLogger().warning("An error occurred while attempting to load support for this version of Craftbukkit/Spigot. Loading plugin failed.");
|
||||||
|
@ -11,17 +11,21 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
abstract class NMS {
|
abstract class NMS {
|
||||||
|
|
||||||
|
private Main plugin;
|
||||||
|
|
||||||
private final String
|
private final String
|
||||||
nmsVersion,
|
nmsVersion,
|
||||||
disabledSlotsFieldName;
|
disabledSlotsFieldName;
|
||||||
|
|
||||||
NMS(String nmsVersion, String disabledSlotsFieldName) {
|
NMS(Main plugin, String nmsVersion, String disabledSlotsFieldName) {
|
||||||
|
this.plugin = plugin;
|
||||||
this.nmsVersion = nmsVersion;
|
this.nmsVersion = nmsVersion;
|
||||||
this.disabledSlotsFieldName = disabledSlotsFieldName;
|
this.disabledSlotsFieldName = disabledSlotsFieldName;
|
||||||
}
|
}
|
||||||
@ -39,7 +43,10 @@ abstract class NMS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void openSign(Player p, Block b) {
|
void openSign(final Player p, final Block b) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Object world = b.getWorld().getClass().getMethod("getHandle").invoke(b.getWorld());
|
Object world = b.getWorld().getClass().getMethod("getHandle").invoke(b.getWorld());
|
||||||
Object blockPos = getNMSClass("BlockPosition").getConstructor(int.class, int.class, int.class).newInstance(b.getX(), b.getY(), b.getZ());
|
Object blockPos = getNMSClass("BlockPosition").getConstructor(int.class, int.class, int.class).newInstance(b.getX(), b.getY(), b.getZ());
|
||||||
@ -50,6 +57,8 @@ abstract class NMS {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.runTaskLater(plugin, 2L);
|
||||||
|
}
|
||||||
|
|
||||||
boolean toggleSlotsDisabled(ArmorStand as) {
|
boolean toggleSlotsDisabled(ArmorStand as) {
|
||||||
boolean slotsDisabled = getDisabledSlots(as) == 0;
|
boolean slotsDisabled = getDisabledSlots(as) == 0;
|
||||||
@ -102,7 +111,7 @@ abstract class NMS {
|
|||||||
if(is == null) {
|
if(is == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
StringBuilder tags = new StringBuilder("");
|
StringBuilder tags = new StringBuilder();
|
||||||
if(is.getItemMeta() != null && is.getItemMeta() instanceof LeatherArmorMeta) {
|
if(is.getItemMeta() != null && is.getItemMeta() instanceof LeatherArmorMeta) {
|
||||||
LeatherArmorMeta armorMeta = (LeatherArmorMeta) is.getItemMeta();
|
LeatherArmorMeta armorMeta = (LeatherArmorMeta) is.getItemMeta();
|
||||||
tags.append("display:{color:");
|
tags.append("display:{color:");
|
||||||
|
@ -3,10 +3,11 @@ package com.gmail.St3venAU.plugins.ArmorStandTools;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
class NMS_v1_13_R1 extends NMS {
|
class NMS_v1_13_R1 extends NMS {
|
||||||
|
|
||||||
public NMS_v1_13_R1(String nmsVersion) {
|
public NMS_v1_13_R1(Main plugin, String nmsVersion) {
|
||||||
super(
|
super(
|
||||||
nmsVersion, // NMS Version
|
plugin,
|
||||||
"bH" // Disabled slots field name
|
nmsVersion,
|
||||||
|
"bH"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Main Config
|
# Main Config
|
||||||
#
|
#
|
||||||
# File generated by: v3.0.0
|
# File generated by: v3.0.2
|
||||||
# (If this is not the version you are running, consider deleting this
|
# (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)
|
# config to allow it to be re-created. There may be new config options)
|
||||||
#
|
#
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Language Config
|
# Language Config
|
||||||
#
|
#
|
||||||
# File generated by: v3.0.0
|
# File generated by: v3.0.2
|
||||||
# (If this is not the version you are running, consider deleting this
|
# (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)
|
# config to allow it to be re-created. There may be new config options)
|
||||||
#
|
#
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
|
main: com.gmail.St3venAU.plugins.ArmorStandTools.Main
|
||||||
name: ArmorStandTools
|
name: ArmorStandTools
|
||||||
version: 3.0.0
|
version: 3.0.2
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
author: St3venAU
|
author: St3venAU
|
||||||
description: Armor stand manipulation tools
|
description: Armor stand manipulation tools
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren