mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-13 21:08:34 +00:00
Eliminated the need to add commands to the plugin.yml file.
Now all command configuration is handled by annotations in the command classes themselves.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
@ -984,4 +985,28 @@ public class TFM_Util
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
//getField: Borrowed from WorldEdit
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getField(Object from, String name)
|
||||
{
|
||||
Class<?> checkClass = from.getClass();
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = checkClass.getDeclaredField(name);
|
||||
field.setAccessible(true);
|
||||
return (T) field.get(from);
|
||||
}
|
||||
catch (NoSuchFieldException ex)
|
||||
{
|
||||
}
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user