当前位置: 首页>>代码示例>>Java>>正文


Java ConsoleLogger类代码示例

本文整理汇总了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.");
                }
            }
        });
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:19,代码来源:SparkTrailPlugin.java

示例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;
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:19,代码来源:ReflectionUtil.java

示例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);
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:8,代码来源:CBClassTemplate.java

示例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!");
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:9,代码来源:SafeConstructor.java

示例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();
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:10,代码来源:SafeField.java

示例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;
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:16,代码来源:SafeField.java

示例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;
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:14,代码来源:SafeField.java

示例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);
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:8,代码来源:ClassTemplate.java

示例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();
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:10,代码来源:SafeMethod.java

示例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());
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:12,代码来源:SafeMethod.java

示例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);
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:8,代码来源:NMSClassTemplate.java

示例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;
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:13,代码来源:ReflectionUtil.java

示例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);
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:8,代码来源:ReflectionUtil.java

示例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;
    }
}
 
开发者ID:DSH105,项目名称:SparkTrail,代码行数:13,代码来源:ReflectionUtil.java

示例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();
}
 
开发者ID:DSH105,项目名称:DSHUtils,代码行数:8,代码来源:DSHPlugin.java


注:本文中的com.dsh105.dshutils.logger.ConsoleLogger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。