NameTagChanger.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:NameTagChanger 作者:
/**
 * Enables NameTagChanger and creates necessary packet handlers.
 * Is done automatically by the constructor, so only use this method
 * if the disable() method has previously been called.
 */
public void enable() {
    if (plugin == null) {
        return;
    }
    if (!ReflectUtil.isVersionHigherThan(1, 7, 10)) {
        printMessage("NameTagChanger has detected that you are running 1.7 or lower. This probably means that NameTagChanger will not work or throw errors, but you are still free to try and use it.\nIf you are not a developer, please consider contacting the developer of " + plugin.getName() + " and informing them about this message.");
    }
    ConfigurationSerialization.registerClass(Skin.class);
    Validate.isTrue(!enabled, "NameTagChanger is already enabled");
    if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
        packetHandler = new ProtocolLibPacketHandler(plugin);
    } else {
        packetHandler = new ChannelPacketHandler(plugin);
    }
    enabled = true;
    Metrics metrics = new Metrics(plugin);
    metrics.addCustomChart(new Metrics.SimplePie("packet_implementation", () -> packetHandler instanceof ProtocolLibPacketHandler ? "ProtocolLib" : "ChannelInjector"));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号