本文整理汇总了Java中com.dsh105.dshutils.logger.ConsoleLogger类的典型用法代码示例。如果您正苦于以下问题:Java ConsoleLogger类的具体用法?Java ConsoleLogger怎么用?Java ConsoleLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConsoleLogger类属于com.dsh105.dshutils.logger包,在下文中一共展示了ConsoleLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkUpdates
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
protected void checkUpdates() {
if (this.getConfig(ConfigType.MAIN).getBoolean("checkForUpdates", true)) {
final File file = this.getFile();
final Updater.UpdateType updateType = this.getConfig(ConfigType.MAIN).getBoolean("autoUpdate", false) ? Updater.UpdateType.DEFAULT : Updater.UpdateType.NO_DOWNLOAD;
getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
@Override
public void run() {
Updater updater = new Updater(getInstance(), 47704, file, updateType, false);
update = updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE;
if (update) {
name = updater.getLatestName();
ConsoleLogger.log(ChatColor.GOLD + "An update is available: " + name);
ConsoleLogger.log(ChatColor.GOLD + "Type /stupdate to update.");
}
}
});
}
}
示例2: getField
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
/**
* Field stuff
*/
public static Field getField(Class<?> clazz, String fieldName) {
try {
Field field = clazz.getDeclaredField(fieldName);
if (!field.isAccessible()) {
field.setAccessible(true);
}
return field;
} catch (NoSuchFieldException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "No such field: " + fieldName + "!");
return null;
}
}
示例3: setCBClass
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
protected void setCBClass(String name) {
Class clazz = ReflectionUtil.getCBCClass(name);
if (clazz == null) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Failed to find a matching class with name: " + name);
}
setClass(clazz);
}
示例4: SafeConstructor
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
public SafeConstructor(Class<?> coreClass, Class<?>... params) {
try {
Constructor constructor = coreClass.getConstructor(params);
setConstructor(constructor);
} catch (NoSuchMethodException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "No such constructor!");
}
}
示例5: SafeField
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
public SafeField(Class<?> coreClass, String fieldName) {
try {
Field field = coreClass.getDeclaredField(fieldName);
setField(field);
} catch (NoSuchFieldException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Failed to find a matching field with name: " + fieldName);
e.printStackTrace();
}
}
示例6: set
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
@Override
public boolean set(Object instance, T value) {
if (!isStatic && instance == null) {
throw new UnsupportedOperationException("Non-static fields require a valid instance passed in!");
}
try {
this.field.set(instance, value);
return true;
} catch (IllegalAccessException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Failed to access field: " + toString());
e.printStackTrace();
}
return false;
}
示例7: get
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
@Override
public T get(Object instance) {
if (!isStatic && instance == null) {
throw new UnsupportedOperationException("Non-static fields require a valid instance passed in!");
}
try {
return (T) this.field.get(instance);
} catch (IllegalAccessException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Failed to access field: " + toString());
e.printStackTrace();
}
return null;
}
示例8: create
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
public static ClassTemplate<?> create(Class<?> type) {
if (type == null) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Cannot create a ClassTemplate with a null type!");
return null;
}
return new ClassTemplate(type);
}
示例9: SafeMethod
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
public SafeMethod(Class<?> coreClass, String methodname, Class<?>... params) {
try {
Method method = coreClass.getDeclaredMethod(methodname, params);
setMethod(method);
} catch (NoSuchMethodException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Failed to find a matching method with name: " + methodname);
e.printStackTrace();
}
}
示例10: setMethod
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
protected void setMethod(Method method) {
if (method == null) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Cannot create a SafeMethod with a null method!");
}
if (!method.isAccessible()) {
method.setAccessible(true);
}
this.method = method;
this.params = method.getParameterTypes();
this.isStatic = Modifier.isStatic(method.getModifiers());
}
示例11: setNMSClass
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
protected void setNMSClass(String name) {
Class clazz = ReflectionUtil.getNMSClass(name);
if (clazz == null) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Failed to find a matching class with name: " + name);
}
setClass(clazz);
}
示例12: getClass
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
/**
* Class stuff
*/
public static Class getClass(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Could not find class: " + name + "!");
return null;
}
}
示例13: setField
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
public static void setField(Class<?> clazz, String fieldName, Object instance, Object value) {
try {
getField(clazz, fieldName).set(instance, value);
} catch (IllegalAccessException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "Could not set new field value for: " + fieldName);
}
}
示例14: getMethod
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
/**
* Method stuff
*/
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... params) {
try {
return clazz.getDeclaredMethod(methodName, params);
} catch (NoSuchMethodException e) {
ConsoleLogger.log(Logger.LogLevel.WARNING, "No such method: " + methodName + "!");
return null;
}
}
示例15: onEnable
import com.dsh105.dshutils.logger.ConsoleLogger; //导入依赖的package包/类
@Override
public void onEnable() {
r = new Random();
INSTANCE = this;
this.configManager = new YAMLConfigManager(this);
ConsoleLogger.initiate();
}