• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Configuration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.canarymod.config.Configuration的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Configuration类属于net.canarymod.config包,在下文中一共展示了Configuration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getWorld

import net.canarymod.config.Configuration; //导入依赖的package包/类
@Override
public World getWorld(String world, DimensionType type, boolean autoload) {
    if (world == null || world.isEmpty()) {
        // assume that the world is the default world
        world = Configuration.getServerConfig().getDefaultWorldName();
    }
    final String worldId = world + "_" + type.getName();

    if (this.worldIsLoaded(worldId)) {
        return this.loadedWorlds.get(worldId);
    } else {
        if (this.worldExists(worldId) && autoload) {
            log.debug("World exists but is not loaded. Loading ...");
            return this.loadWorld(world, type);
        } else {
            if (autoload) {
                log.debug("World does not exist, we can autoload, will load!");
                this.createWorld(world, type);
                return this.loadedWorlds.get(worldId);
            } else {
                throw new UnknownWorldException("Tried to get a none existent world: " + world + " (" + type.toString() +
                        ") either use autoload or have it pre-created!");
            }
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:27,代码来源:NeptuneWorldManager.java


示例2: handleStringProperties

import net.canarymod.config.Configuration; //导入依赖的package包/类
@Redirect(method = "startServer", at = @At(value = "INVOKE",
        target = "Lnet/minecraft/server/dedicated/PropertyManager;"
                + "getStringProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"))
public String handleStringProperties(PropertyManager propertyManager, String key, String defaultValue) {
    if ("server-ip".equals(key)) {
        return Configuration.getServerConfig().getBindIp();
    } else if ("motd".equals(key)) {
        return Configuration.getServerConfig().getMotd();
    } else if ("level-name".equals(key)) {
        return Configuration.getServerConfig().getDefaultWorldName();
    } else if ("level-seed".equals(key)) {
        return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getWorldSeed();
    } else if ("level-type".equals(key)) {
        return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getWorldType().toString();
    } else if ("generator-type".equals(key)) {
        return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getGeneratorSettings();
    } else {
        return propertyManager.getStringProperty(key, defaultValue);
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:21,代码来源:MixinDedicatedServer.java


示例3: handleCommandExecution

import net.canarymod.config.Configuration; //导入依赖的package包/类
private int handleCommandExecution(ICommandManager commandManager, CommandBlockLogic commandBlockLogic, String commandStored) {
    final String[] args = commandStored.split(" ");
    String commandName = args[0];
    if (commandName.startsWith("/")) {
        commandName = commandName.substring(1);
    }

    CommandBlockCommandHook commandHook = (CommandBlockCommandHook) new CommandBlockCommandHook(
            (net.canarymod.api.CommandBlockLogic) commandBlockLogic, args).call();

    if (!commandHook.isCanceled()
            && (Configuration.getServerConfig().isCommandBlockOpped()
            || ((net.canarymod.api.CommandBlockLogic) commandBlockLogic).hasPermission("canary.command." + commandName))) {
        int result = commandManager.executeCommand(commandBlockLogic, commandStored);
        if (result == 0) {
            // Minecraft found no command, now its our turn
            Canary.getServer().consoleCommand(commandStored, (net.canarymod.api.CommandBlockLogic) commandBlockLogic);
        }
        return result;
    }

    return 0;
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:24,代码来源:MixinCommandBlockLogic.java


示例4: createWorld

import net.canarymod.config.Configuration; //导入依赖的package包/类
@Override
public boolean createWorld(String name, long seed, DimensionType dimensionType, WorldType worldType) {
    WorldConfiguration worldConfiguration = WorldConfiguration.create(name, dimensionType);

    if (worldConfiguration == null) {
        log.debug("World configuration already exists for " + name + "_" + dimensionType.getName());
        worldConfiguration = Configuration.getWorldConfig(name + "_" + dimensionType.getName());
    } else {
        log.debug("Updating world configuration for " + name + "_" + dimensionType.getName());
        worldConfiguration.getFile().setLong("world-seed", seed);
        worldConfiguration.getFile().setString("world-type", worldType.toString());
    }

    return this.createWorld(worldConfiguration);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:16,代码来源:NeptuneWorldManager.java


示例5: onConstruction

import net.canarymod.config.Configuration; //导入依赖的package包/类
@Inject(method = "<init>*", at = @At("RETURN"))
private void onConstruction(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn,
        CallbackInfo ci) {
    // Get the world configuration
    this.worldConfig = Configuration.getWorldConfig(this.getFqName());

    // Register ths ChunkGC task
    Canary.getServer().addSynchronousTask(new ChunkGCTask((WorldServer) (Object) this));
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:10,代码来源:MixinWorldServer_Performance.java


示例6: updateTask

import net.canarymod.config.Configuration; //导入依赖的package包/类
/**
 * @author jamierocks - 18th August 2017
 * @reason Fire hook + check blocks from config
 */
@Overwrite
public void updateTask() {
    final Random random = this.enderman.getRNG();
    final World world = this.enderman.worldObj;
    final int x = MathHelper.floor_double(this.enderman.posX - 2.0D + random.nextDouble() * 4.0D);
    final int y = MathHelper.floor_double(this.enderman.posY + random.nextDouble() * 3.0D);
    final int z = MathHelper.floor_double(this.enderman.posZ - 2.0D + random.nextDouble() * 4.0D);
    final BlockPos blockpos = new BlockPos(x, y, z);
    final IBlockState iblockstate = world.getBlockState(blockpos);
    final Block block = iblockstate.getBlock();

    //if (EntityEnderman.carriableBlocks.contains(block)) {
    //    this.enderman.setHeldBlockState(iblockstate);
    //    world.setBlockState(blockpos, Blocks.air.getDefaultState());
    //}

    // Neptune: Use world config to get carriable blocks
    if (Arrays.stream(Configuration.getWorldConfig(((net.canarymod.api.world.World) world).getFqName()).getEnderBlocks())
            .anyMatch(id -> id == Block.getIdFromBlock(block))) {
        // Neptune: Fire hook
        final EndermanPickupBlockHook hook = new EndermanPickupBlockHook((Enderman) this.enderman, (net.canarymod.api.world.blocks.Block) iblockstate);
        if (!hook.call().isCanceled()) {
            this.enderman.setHeldBlockState(iblockstate);
            world.setBlockState(blockpos, Blocks.air.getDefaultState());
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:32,代码来源:MixinEntityEndermanAITakeBlock.java


示例7: processChatMessage

import net.canarymod.config.Configuration; //导入依赖的package包/类
/**
 * @author jamierocks - 1st September 2016
 * @reason Overwrite to pass chat to Canary.
 */
@Overwrite
public void processChatMessage(C01PacketChatMessage packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayServer) (Object) this, this.playerEntity.getServerForPlayer());

    if (this.playerEntity.getChatVisibility() == EntityPlayer.EnumChatVisibility.HIDDEN) {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend");
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
        this.sendPacket(new S02PacketChat(chatcomponenttranslation));
        return;
    }

    this.chatSpamThresholdCount += 20;

    final boolean op = Canary.ops().isOpped((PlayerReference) this.playerEntity);
    final boolean ignore = ((Player) this.playerEntity).canIgnoreRestrictions();
    final String spamProtectionLevel = Configuration.getServerConfig().getSpamProtectionLevel();

    if (spamProtectionLevel.equalsIgnoreCase("all") || (spamProtectionLevel.equalsIgnoreCase("default") && !(op || ignore))) {
        if (this.chatSpamThresholdCount > 200) {
            this.kickPlayerFromServer("disconnect.spam");
            return;
        }
    }
    this.playerEntity.markPlayerActive();
    ((Player) this.playerEntity).chat(packetIn.getMessage());
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:31,代码来源:MixinNetHandlerPlayServer.java


示例8: handleBooleanProperties

import net.canarymod.config.Configuration; //导入依赖的package包/类
@Redirect(method = "startServer", at = @At(value = "INVOKE",
        target = "Lnet/minecraft/server/dedicated/PropertyManager;"
                + "getBooleanProperty(Ljava/lang/String;Z)Z"))
public boolean handleBooleanProperties(PropertyManager propertyManager, String key, boolean defaultValue) {
    if ("online-mode".equals(key)) {
        return Configuration.getServerConfig().isOnlineMode();
    } else {
        return propertyManager.getBooleanProperty(key, defaultValue);
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:11,代码来源:MixinDedicatedServer.java


示例9: addServerStatsToSnooper

import net.canarymod.config.Configuration; //导入依赖的package包/类
/**
 * @author jamierocks - 26th April 2016
 * @reason Overwrite to use Canary's {@link Configuration} rather than the original server.properties
 */
@Overwrite
public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) {
    playerSnooper.addClientStat("whitelist_enabled", Configuration.getServerConfig().isWhitelistEnabled());
    playerSnooper.addClientStat("whitelist_count", Canary.whitelist().getSize());
    super.addServerStatsToSnooper(playerSnooper);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:11,代码来源:MixinDedicatedServer.java


示例10: getServerIP

import net.canarymod.config.Configuration; //导入依赖的package包/类
@Override
public String getServerIP() {
    return Configuration.getServerConfig().getBindIp();
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:5,代码来源:DynmapPlugin.java


示例11: getWorldConfiguration

import net.canarymod.config.Configuration; //导入依赖的package包/类
protected WorldConfiguration getWorldConfiguration() {
    return Configuration.getWorldConfig(getHandle().getFqName());
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryWorld.java


示例12: getAllowEnd

import net.canarymod.config.Configuration; //导入依赖的package包/类
public boolean getAllowEnd() {
    // TODO MW support -.-
    return Configuration.getWorldConfig(getHandle().getDefaultWorldName()).isEndAllowed();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:5,代码来源:CanaryServer.java


示例13: getAllowNether

import net.canarymod.config.Configuration; //导入依赖的package包/类
public boolean getAllowNether() {
    // TODO MW support -.-
    return Configuration.getWorldConfig(getHandle().getDefaultWorldName()).isNetherAllowed();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:5,代码来源:CanaryServer.java


示例14: getGenerateStructures

import net.canarymod.config.Configuration; //导入依赖的package包/类
public boolean getGenerateStructures() {
    // TODO MW support -.-
    return Configuration.getWorldConfig(getHandle().getDefaultWorldName()).generatesStructures();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:5,代码来源:CanaryServer.java


示例15: getIdleTimeout

import net.canarymod.config.Configuration; //导入依赖的package包/类
public int getIdleTimeout() {
    return Configuration.getServerConfig().getPlayerIdleTimeout();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryServer.java


示例16: setIdleTimeout

import net.canarymod.config.Configuration; //导入依赖的package包/类
public void setIdleTimeout(int threshold) {
    Configuration.getServerConfig().setPlayerIdleTimeout(threshold);
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryServer.java


示例17: getIp

import net.canarymod.config.Configuration; //导入依赖的package包/类
public String getIp() {
    return Configuration.getServerConfig().getBindIp();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryServer.java


示例18: getMaxPlayers

import net.canarymod.config.Configuration; //导入依赖的package包/类
public int getMaxPlayers() {
    return Configuration.getServerConfig().getMaxPlayers();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryServer.java


示例19: getMotd

import net.canarymod.config.Configuration; //导入依赖的package包/类
public String getMotd() {
    return Configuration.getServerConfig().getMotd();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryServer.java


示例20: getOnlineMode

import net.canarymod.config.Configuration; //导入依赖的package包/类
public boolean getOnlineMode() {
    return Configuration.getServerConfig().isOnlineMode();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:4,代码来源:CanaryServer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DOMForestScanner类代码示例发布时间:2022-05-23
下一篇:
Java IBroadcastStream类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap