Compatibility 1.7, fallbacks etc.
This commit is contained in:
parent
5daebc8e33
commit
b78417b48b
@ -22,7 +22,6 @@ public abstract class Engine implements Active, Listener, Runnable
|
|||||||
private static final transient Set<Engine> allInstances = new MassiveSet<>();
|
private static final transient Set<Engine> allInstances = new MassiveSet<>();
|
||||||
public static Set<Engine> getAllInstances() { return allInstances; }
|
public static Set<Engine> getAllInstances() { return allInstances; }
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// PLUGIN
|
// PLUGIN
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -117,7 +116,12 @@ public abstract class Engine implements Active, Listener, Runnable
|
|||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().registerEvents(this, this.getPlugin());
|
// Support without at load
|
||||||
|
MassivePlugin plugin = this.getPlugin();
|
||||||
|
if (plugin.isEnabled())
|
||||||
|
{
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, this.getPlugin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -135,13 +139,18 @@ public abstract class Engine implements Active, Listener, Runnable
|
|||||||
{
|
{
|
||||||
if (this.getPeriod() != null)
|
if (this.getPeriod() != null)
|
||||||
{
|
{
|
||||||
if (this.isSync())
|
// Support without at load
|
||||||
|
MassivePlugin plugin = this.getPlugin();
|
||||||
|
if (plugin.isEnabled())
|
||||||
{
|
{
|
||||||
this.task = Bukkit.getScheduler().runTaskTimer(this.getPlugin(), this, this.getDelay(), this.getPeriod());
|
if (this.isSync())
|
||||||
}
|
{
|
||||||
else
|
this.task = Bukkit.getScheduler().runTaskTimer(this.getPlugin(), this, this.getDelay(), this.getPeriod());
|
||||||
{
|
}
|
||||||
this.task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.getPlugin(), this, this.getDelay(), this.getPeriod());
|
else
|
||||||
|
{
|
||||||
|
this.task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.getPlugin(), this, this.getDelay(), this.getPeriod());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,17 +217,20 @@ public class MassiveCore extends MassivePlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE
|
// LOAD
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad()
|
public void onLoadInner()
|
||||||
{
|
{
|
||||||
super.onLoad();
|
|
||||||
// Attempting to fix a race condition within the class asynchronous class loader.
|
// Attempting to fix a race condition within the class asynchronous class loader.
|
||||||
System.out.println("TimeUnit.MILLIS_PER_MINUTE: " + TimeUnit.MILLIS_PER_MINUTE);
|
System.out.println("TimeUnit.MILLIS_PER_MINUTE: " + TimeUnit.MILLIS_PER_MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// ENABLE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnableInner()
|
public void onEnableInner()
|
||||||
{
|
{
|
||||||
@ -328,6 +331,10 @@ public class MassiveCore extends MassivePlugin
|
|||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, MassiveCoreTaskDeleteFiles.get());
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, MassiveCoreTaskDeleteFiles.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// DISABLE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
@ -36,19 +36,52 @@ public abstract class MassivePlugin extends JavaPlugin implements Listener, Name
|
|||||||
public boolean isVersionSynchronized() { return this.versionSynchronized; }
|
public boolean isVersionSynchronized() { return this.versionSynchronized; }
|
||||||
public void setVersionSynchronized(boolean versionSynchronized) { this.versionSynchronized = versionSynchronized; }
|
public void setVersionSynchronized(boolean versionSynchronized) { this.versionSynchronized = versionSynchronized; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// LOAD
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad()
|
||||||
|
{
|
||||||
|
this.onLoadPre();
|
||||||
|
this.onLoadInner();
|
||||||
|
this.onLoadPost();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadPre()
|
||||||
|
{
|
||||||
|
this.logPrefixColored = Txt.parse("<teal>[<aqua>%s %s<teal>] <i>", this.getDescription().getName(), this.getDescription().getVersion());
|
||||||
|
this.logPrefixPlain = ChatColor.stripColor(this.logPrefixColored);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadInner()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoadPost()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// ENABLE
|
// ENABLE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnable()
|
||||||
|
{
|
||||||
|
if ( ! this.onEnablePre()) return;
|
||||||
|
this.onEnableInner();
|
||||||
|
this.onEnablePost();
|
||||||
|
}
|
||||||
|
|
||||||
private long enableTime;
|
private long enableTime;
|
||||||
public long getEnableTime() { return this.enableTime; }
|
public long getEnableTime() { return this.enableTime; }
|
||||||
|
|
||||||
public boolean preEnable()
|
public boolean onEnablePre()
|
||||||
{
|
{
|
||||||
enableTime = System.currentTimeMillis();
|
this.enableTime = System.currentTimeMillis();
|
||||||
|
|
||||||
this.logPrefixColored = Txt.parse("<teal>[<aqua>%s %s<teal>] <i>", this.getDescription().getName(), this.getDescription().getVersion());
|
|
||||||
this.logPrefixPlain = ChatColor.stripColor(this.logPrefixColored);
|
|
||||||
|
|
||||||
log("=== ENABLE START ===");
|
log("=== ENABLE START ===");
|
||||||
|
|
||||||
@ -65,27 +98,6 @@ public abstract class MassivePlugin extends JavaPlugin implements Listener, Name
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postEnable()
|
|
||||||
{
|
|
||||||
// Metrics
|
|
||||||
if (MassiveCoreMConf.get().mcstatsEnabled)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MetricsLite metrics = new MetricsLite(this);
|
|
||||||
metrics.start();
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
String message = Txt.parse("<b>Metrics Initialization Failed :'(");
|
|
||||||
log(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
long ms = System.currentTimeMillis() - enableTime;
|
|
||||||
log(Txt.parse("=== ENABLE <g>COMPLETE <i>(Took <h>" + ms + "ms<i>) ==="));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkVersionSynchronization()
|
public void checkVersionSynchronization()
|
||||||
{
|
{
|
||||||
// If this plugin is version synchronized ...
|
// If this plugin is version synchronized ...
|
||||||
@ -121,21 +133,32 @@ public abstract class MassivePlugin extends JavaPlugin implements Listener, Name
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
if ( ! this.preEnable()) return;
|
|
||||||
|
|
||||||
this.onEnableInner();
|
|
||||||
|
|
||||||
this.postEnable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onEnableInner()
|
public void onEnableInner()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onEnablePost()
|
||||||
|
{
|
||||||
|
// Metrics
|
||||||
|
if (MassiveCoreMConf.get().mcstatsEnabled)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MetricsLite metrics = new MetricsLite(this);
|
||||||
|
metrics.start();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
String message = Txt.parse("<b>Metrics Initialization Failed :'(");
|
||||||
|
log(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
long ms = System.currentTimeMillis() - this.enableTime;
|
||||||
|
log(Txt.parse("=== ENABLE <g>COMPLETE <i>(Took <h>" + ms + "ms<i>) ==="));
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// DISABLE
|
// DISABLE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -88,31 +88,42 @@ public class RegistryType
|
|||||||
|
|
||||||
public static Type<?> getType(Field field)
|
public static Type<?> getType(Field field)
|
||||||
{
|
{
|
||||||
EditorType annotation = field.getAnnotation(EditorType.class);
|
try
|
||||||
if (annotation != null)
|
|
||||||
{
|
{
|
||||||
Class<?> clazz = annotation.value();
|
EditorType annotation = field.getAnnotation(EditorType.class);
|
||||||
if (clazz == void.class) clazz = getType(field.getGenericType()).getClass();
|
if (annotation != null)
|
||||||
return getType(clazz, annotation.fieldName());
|
{
|
||||||
|
Class<?> clazz = annotation.value();
|
||||||
|
if (clazz == void.class) clazz = getType(field.getGenericType()).getClass();
|
||||||
|
return getType(clazz, annotation.fieldName());
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorTypeList annList = field.getAnnotation(EditorTypeList.class);
|
||||||
|
if (annList != null)
|
||||||
|
{
|
||||||
|
return TypeList.get(getType(annList.value(), annList.fieldName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorTypeSet annSet = field.getAnnotation(EditorTypeSet.class);
|
||||||
|
if (annSet != null)
|
||||||
|
{
|
||||||
|
return TypeSet.get(getType(annSet.value(), annSet.fieldName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorTypeMap annMap = field.getAnnotation(EditorTypeMap.class);
|
||||||
|
if (annMap != null)
|
||||||
|
{
|
||||||
|
return TypeMap.get(getType(annMap.typeKey(), annMap.fieldNameKey()), getType(annMap.typeValue(), annMap.fieldNameValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
// This has to do with backwards compatibility (Usually 1.7).
|
||||||
|
// The EditorType annotations may trigger creation of type class instances.
|
||||||
|
// Those type classes may refer to Bukkit classes not present.
|
||||||
|
// This issue was first encountered for TypeDataItemStack.
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorTypeList annList = field.getAnnotation(EditorTypeList.class);
|
|
||||||
if (annList != null)
|
|
||||||
{
|
|
||||||
return TypeList.get(getType(annList.value(), annList.fieldName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorTypeSet annSet = field.getAnnotation(EditorTypeSet.class);
|
|
||||||
if (annSet != null)
|
|
||||||
{
|
|
||||||
return TypeSet.get(getType(annSet.value(), annSet.fieldName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorTypeMap annMap = field.getAnnotation(EditorTypeMap.class);
|
|
||||||
if (annMap != null)
|
|
||||||
{
|
|
||||||
return TypeMap.get(getType(annMap.typeKey(), annMap.fieldNameKey()), getType(annMap.typeValue(), annMap.fieldNameValue()));
|
|
||||||
}
|
|
||||||
return getType(field.getGenericType());
|
return getType(field.getGenericType());
|
||||||
}
|
}
|
||||||
private static Type<?> getType(Class<?> clazz, String fieldName)
|
private static Type<?> getType(Class<?> clazz, String fieldName)
|
||||||
@ -225,30 +236,10 @@ public class RegistryType
|
|||||||
register(TypeDestination.get());
|
register(TypeDestination.get());
|
||||||
register(TypeItemStack.get());
|
register(TypeItemStack.get());
|
||||||
|
|
||||||
// 1.7 Compat
|
register(TypeDataBannerPattern.get());
|
||||||
try
|
|
||||||
{
|
|
||||||
register(TypeDataBannerPattern.get());
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
register(TypeDataPotionEffect.get());
|
register(TypeDataPotionEffect.get());
|
||||||
register(TypeDataFireworkEffect.get());
|
register(TypeDataFireworkEffect.get());
|
||||||
|
register(TypeDataItemStack.get());
|
||||||
// 1.? Compat
|
|
||||||
// TODO: The annotations breaks with 1.7.
|
|
||||||
// TODO: Find a solution to dodge the converter annotation class inits.
|
|
||||||
try
|
|
||||||
{
|
|
||||||
register(TypeDataItemStack.get());
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
register(TypePermission.get());
|
register(TypePermission.get());
|
||||||
register(TypePotionEffectType.get());
|
register(TypePotionEffectType.get());
|
||||||
|
@ -47,25 +47,31 @@ public class DataBannerPattern implements Comparable<DataBannerPattern>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataBannerPattern(Pattern pattern)
|
// Minecraft 1.7 Compatibility
|
||||||
|
public DataBannerPattern(Object pattern)
|
||||||
{
|
{
|
||||||
this.write(pattern, false);
|
if ( ! (pattern instanceof Pattern)) throw new IllegalArgumentException("pattern");
|
||||||
|
this.write((Pattern)pattern, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// WRITE
|
// WRITE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void write(Pattern pattern, boolean a2b)
|
// Minecraft 1.7 Compatibility
|
||||||
|
public void write(Object pattern, boolean a2b)
|
||||||
{
|
{
|
||||||
WriterBannerPattern.get().write(this, pattern, a2b);
|
if ( ! (pattern instanceof Pattern)) throw new IllegalArgumentException("pattern");
|
||||||
|
WriterBannerPattern.get().write(this, (Pattern)pattern, a2b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// TO BUKKIT
|
// TO BUKKIT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public Pattern toBukkit()
|
// Minecraft 1.7 Compatibility
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T toBukkit()
|
||||||
{
|
{
|
||||||
// Create
|
// Create
|
||||||
Pattern ret = WriterBannerPattern.get().createOB();
|
Pattern ret = WriterBannerPattern.get().createOB();
|
||||||
@ -74,7 +80,7 @@ public class DataBannerPattern implements Comparable<DataBannerPattern>
|
|||||||
this.write(ret, true);
|
this.write(ret, true);
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return ret;
|
return (T) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -65,7 +65,7 @@ public class Mixin extends Engine
|
|||||||
// NOTE: This field must be set in the default constructor!
|
// NOTE: This field must be set in the default constructor!
|
||||||
private Boolean availableDefault = null;
|
private Boolean availableDefault = null;
|
||||||
public boolean isAvailableDefault() { return (this.availableDefault != null ? this.availableDefault : this.getDefault().getAlternatives().isEmpty()); }
|
public boolean isAvailableDefault() { return (this.availableDefault != null ? this.availableDefault : this.getDefault().getAlternatives().isEmpty()); }
|
||||||
public void setAvailableDefault(boolean availableDefault) { this.setAvailableDefault(availableDefault); }
|
public void setAvailableDefault(boolean availableDefault) { this.availableDefault = availableDefault; }
|
||||||
public boolean isAvailable() { return this.isAvailableDefault() || this.getInstance() != this.getDefault(); }
|
public boolean isAvailable() { return this.isAvailableDefault() || this.getInstance() != this.getDefault(); }
|
||||||
public void require() { if (this.isAvailable()) return; throw new IllegalStateException(this.getBaseName() + " is Required"); }
|
public void require() { if (this.isAvailable()) return; throw new IllegalStateException(this.getBaseName() + " is Required"); }
|
||||||
|
|
||||||
|
@ -127,10 +127,8 @@ public final class MsonEvent implements Serializable
|
|||||||
public static MsonEvent item(ItemStack item)
|
public static MsonEvent item(ItemStack item)
|
||||||
{
|
{
|
||||||
if (item == null) throw new NullPointerException("item");
|
if (item == null) throw new NullPointerException("item");
|
||||||
String nbtStringTooltip = null;
|
String value = NmsItemStackTooltip.get().getNbtStringTooltip(item);
|
||||||
NmsItemStackTooltip nms = NmsItemStackTooltip.get();
|
return MsonEvent.valueOf(MsonEventAction.SHOW_ITEM, value);
|
||||||
if (nms.isAvailable()) nbtStringTooltip = nms.getNbtStringTooltip(item);
|
|
||||||
return MsonEvent.valueOf(MsonEventAction.SHOW_ITEM, nbtStringTooltip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -84,4 +84,13 @@ public class NmsBasics extends Mixin
|
|||||||
throw this.notImplemented();
|
throw this.notImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// PING
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public int getPing(Player player)
|
||||||
|
{
|
||||||
|
throw this.notImplemented();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,10 @@ public class NmsBasics17R4P extends NmsBasics
|
|||||||
// net.minecraft.server.PlayerConnection#sendPacket(Packet)
|
// net.minecraft.server.PlayerConnection#sendPacket(Packet)
|
||||||
private Method methodPlayerConnectionsendPacket;
|
private Method methodPlayerConnectionsendPacket;
|
||||||
|
|
||||||
|
// PING
|
||||||
|
// net.minecraft.server.EntityPlayer#ping
|
||||||
|
private Field fieldNmsPlayerPing;
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// SETUP
|
// SETUP
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -107,6 +111,9 @@ public class NmsBasics17R4P extends NmsBasics
|
|||||||
this.classNmsPacket = PackageType.MINECRAFT_SERVER.getClass("Packet");
|
this.classNmsPacket = PackageType.MINECRAFT_SERVER.getClass("Packet");
|
||||||
this.classNmsPlayerConnection = PackageType.MINECRAFT_SERVER.getClass("PlayerConnection");
|
this.classNmsPlayerConnection = PackageType.MINECRAFT_SERVER.getClass("PlayerConnection");
|
||||||
this.methodPlayerConnectionsendPacket = ReflectionUtil.getMethod(this.classNmsPlayerConnection, "sendPacket", this.classNmsPacket);
|
this.methodPlayerConnectionsendPacket = ReflectionUtil.getMethod(this.classNmsPlayerConnection, "sendPacket", this.classNmsPacket);
|
||||||
|
|
||||||
|
// PING
|
||||||
|
this.fieldNmsPlayerPing = ReflectionUtil.getField(this.classNmsPlayer, "ping");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -170,4 +177,14 @@ public class NmsBasics17R4P extends NmsBasics
|
|||||||
ReflectionUtil.invokeMethod(this.methodPlayerConnectionsendPacket, connection, packet);
|
ReflectionUtil.invokeMethod(this.methodPlayerConnectionsendPacket, connection, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// PING
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public int getPing(Player player)
|
||||||
|
{
|
||||||
|
Object handle = this.getHandle(player);
|
||||||
|
return ReflectionUtil.getField(this.fieldNmsPlayerPing, handle);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@ public class NmsChat extends Mixin
|
|||||||
|
|
||||||
private static NmsChat d = new NmsChat().setAlternatives(
|
private static NmsChat d = new NmsChat().setAlternatives(
|
||||||
NmsChat18R2P.class,
|
NmsChat18R2P.class,
|
||||||
NmsChat18R1.class
|
NmsChat18R1.class,
|
||||||
|
NmsChatFallback.class
|
||||||
);
|
);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
12
src/com/massivecraft/massivecore/nms/NmsChatFallback.java
Normal file
12
src/com/massivecraft/massivecore/nms/NmsChatFallback.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package com.massivecraft.massivecore.nms;
|
||||||
|
|
||||||
|
public class NmsChatFallback extends NmsChat
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static NmsChatFallback i = new NmsChatFallback();
|
||||||
|
public static NmsChatFallback get() { return i; }
|
||||||
|
|
||||||
|
}
|
@ -11,7 +11,8 @@ public class NmsItemStackTooltip extends Mixin
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static NmsItemStackTooltip d = new NmsItemStackTooltip().setAlternatives(
|
private static NmsItemStackTooltip d = new NmsItemStackTooltip().setAlternatives(
|
||||||
NmsItemStackTooltip18R1P.class
|
NmsItemStackTooltip18R1P.class,
|
||||||
|
NmsItemStackTooltipFallback.class
|
||||||
);
|
);
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -27,7 +28,7 @@ public class NmsItemStackTooltip extends Mixin
|
|||||||
|
|
||||||
public String getNbtStringTooltip(ItemStack item)
|
public String getNbtStringTooltip(ItemStack item)
|
||||||
{
|
{
|
||||||
throw notImplemented();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.massivecraft.massivecore.nms;
|
||||||
|
|
||||||
|
public class NmsItemStackTooltipFallback extends NmsItemStackTooltip
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static NmsItemStackTooltipFallback i = new NmsItemStackTooltipFallback();
|
||||||
|
public static NmsItemStackTooltipFallback get () { return i; }
|
||||||
|
|
||||||
|
}
|
@ -154,7 +154,7 @@ public class ReflectionUtil
|
|||||||
public static <T> Constructor<T> getConstructor(Class<?> clazz, Class<?>... parameterTypes)
|
public static <T> Constructor<T> getConstructor(Class<?> clazz, Class<?>... parameterTypes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Constructor<T> ret = (Constructor<T>) clazz.getDeclaredConstructor(parameterTypes);
|
Constructor<T> ret = (Constructor<T>) clazz.getDeclaredConstructor(parameterTypes);
|
||||||
makeAccessible(ret);
|
makeAccessible(ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user