use of java.lang.reflect.Constructor in project SpaciousLib by anhcraft.
the class ItemsNBT method setFloat.
public ItemStack setFloat(String name, float value) {
try {
Class<?> e = Class.forName("org.anhcraft.spaciouslib.Inventory.ItemNBT.NBTCompound_" + GameVersion.getVersion().toString().replace("v", ""));
Constructor c = e.getConstructor();
NBTCompoundWarpper i = (NBTCompoundWarpper) c.newInstance();
i.importFromItem(item);
i.set(name, value);
return i.exportToItem(item);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException x) {
x.printStackTrace();
return null;
}
}
use of java.lang.reflect.Constructor in project SpaciousLib by anhcraft.
the class ActionBar method send.
@Override
public void send(World world, String text) {
try {
Class e = Class.forName("org.anhcraft.spaciouslib.Server.ActionBar.ActionBar_" + GameVersion.getVersion().toString().replace("v", ""));
Constructor c = e.getConstructor();
ActionBarWarpper i = (ActionBarWarpper) c.newInstance();
i.send(world, text);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException x) {
x.printStackTrace();
}
}
use of java.lang.reflect.Constructor in project SpaciousLib by anhcraft.
the class Title method sendTitle.
@Override
public void sendTitle(Player player, String text, int fadeIn, int stay, int fadeOut) {
try {
Class e = Class.forName("org.anhcraft.spaciouslib.Server.Title.Title_" + GameVersion.getVersion().toString().replace("v", ""));
Constructor c = e.getConstructor();
TitleWarpper i = (TitleWarpper) c.newInstance();
i.sendTitle(player, text, fadeIn, stay, fadeOut);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException x) {
x.printStackTrace();
}
}
use of java.lang.reflect.Constructor in project SpaciousLib by anhcraft.
the class Title method sendSubTitle.
@Override
public void sendSubTitle(World world, String text, int fadeIn, int stay, int fadeOut) {
try {
Class e = Class.forName("org.anhcraft.spaciouslib.Server.Title.Title_" + GameVersion.getVersion().toString().replace("v", ""));
Constructor c = e.getConstructor();
TitleWarpper i = (TitleWarpper) c.newInstance();
i.sendSubTitle(world, text, fadeIn, stay, fadeOut);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException x) {
x.printStackTrace();
}
}
use of java.lang.reflect.Constructor in project SpaciousLib by anhcraft.
the class Title method sendTitle.
@Override
public void sendTitle(World world, String text, int fadeIn, int stay, int fadeOut) {
try {
Class e = Class.forName("org.anhcraft.spaciouslib.Server.Title.Title_" + GameVersion.getVersion().toString().replace("v", ""));
Constructor c = e.getConstructor();
TitleWarpper i = (TitleWarpper) c.newInstance();
i.sendTitle(world, text, fadeIn, stay, fadeOut);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException x) {
x.printStackTrace();
}
}
Aggregations