本文整理汇总了Java中com.dsh105.dshutils.logger.ConsoleLogger.log方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleLogger.log方法的具体用法?Java ConsoleLogger.log怎么用?Java ConsoleLogger.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dsh105.dshutils.logger.ConsoleLogger
的用法示例。
在下文中一共展示了ConsoleLogger.log方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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);
}
示例3: 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!");
}
}
示例4: 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();
}
}
示例5: 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;
}
示例6: 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;
}
示例7: 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);
}
示例8: 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();
}
}
示例9: 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());
}
示例10: 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);
}
示例11: 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;
}
}
示例12: 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);
}
}
示例13: 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;
}
}
示例14: getLocation
import com.dsh105.dshutils.logger.ConsoleLogger; //导入方法依赖的package包/类
public static Location getLocation(CommandSender sender, String[] args, int start) {
World world = (sender instanceof Player) ? ((Player) sender).getWorld() : (sender instanceof BlockCommandSender) ? ((BlockCommandSender) sender).getBlock().getWorld() : Bukkit.getWorlds().get(0);
int x;
int y;
int z;
if (args[start].equalsIgnoreCase("~") && sender instanceof BlockCommandSender) {
x = (int) ((BlockCommandSender) sender).getBlock().getLocation().getX();
} else if (args[start].equalsIgnoreCase("~") && sender instanceof Player) {
x = (int) ((Player) sender).getLocation().getX();
} else if (StringUtil.isInt(args[start])) {
x = Integer.parseInt(args[start]);
} else {
ConsoleLogger.log("" + start + " " + args[start]);
Lang.sendTo(sender, Lang.INT_ONLY_WITH_ARGS.toString().replace("%string%", args[start]).replace("%argNum%", start + ""));
return null;
}
start++;
if (args[start].equalsIgnoreCase("~") && sender instanceof BlockCommandSender) {
y = (int) ((BlockCommandSender) sender).getBlock().getLocation().getY();
} else if (args[start].equalsIgnoreCase("~") && sender instanceof Player) {
y = (int) ((Player) sender).getLocation().getY();
} else if (StringUtil.isInt(args[start])) {
y = Integer.parseInt(args[start]);
} else {
Lang.sendTo(sender, Lang.INT_ONLY_WITH_ARGS.toString().replace("%string%", args[start]).replace("%argNum%", start + ""));
return null;
}
start++;
if (args[start].equalsIgnoreCase("~") && sender instanceof BlockCommandSender) {
z = (int) ((BlockCommandSender) sender).getBlock().getLocation().getZ();
} else if (args[start].equalsIgnoreCase("~") && sender instanceof Player) {
z = (int) ((Player) sender).getLocation().getZ();
} else if (StringUtil.isInt(args[start])) {
z = Integer.parseInt(args[start]);
} else {
Lang.sendTo(sender, Lang.INT_ONLY_WITH_ARGS.toString().replace("%string%", args[start]).replace("%argNum%", start + ""));
return null;
}
return new Location(world, x, y, z);
}