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


Java FileConfiguration.addDefault方法代码示例

本文整理汇总了Java中org.bukkit.configuration.file.FileConfiguration.addDefault方法的典型用法代码示例。如果您正苦于以下问题:Java FileConfiguration.addDefault方法的具体用法?Java FileConfiguration.addDefault怎么用?Java FileConfiguration.addDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.configuration.file.FileConfiguration的用法示例。


在下文中一共展示了FileConfiguration.addDefault方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@Override
public void onEnable() {
       defaultConfig = getConfig();
       instance = this;

       FileConfiguration config = getConfig();
       config.addDefault(PROTECTION_KEY, false);
       config.addDefault(PLAYER_KICK_KEY, "Please verify that you're not a robot. Visit %s");
       config.addDefault(WHITELIST_KEY, new ArrayList<String>());

       config.addDefault(VERIFICATION_ROOT_KEY, "http://yourdomain.com/");
       config.addDefault(WIPE_KEY, "secret");

       config.options().copyDefaults(true);
       saveConfig();

       getServer().getPluginManager().registerEvents(new EventListener(), this);

       EventListener.protection = config.getBoolean(PROTECTION_KEY);
       EventListener.kickMessage = config.getString(PLAYER_KICK_KEY);

       this.getCommand("antibots").setExecutor(new CommandAntibots());

       getLogger().log(Level.INFO, "Plugin successfully enabled. Default protection is " + config.getBoolean(PROTECTION_KEY));
   }
 
开发者ID:pietrek777,项目名称:AntiBots,代码行数:26,代码来源:Main.java

示例2: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void onEnable()
{
    //ignore
    getLogger();
    String protocol;
    String name;
    String ip;
    int port;
    FileConfiguration config = getConfig();
    config.addDefault("settings.protocol", valueOf("TCP"));
    config.addDefault("settings.name", valueOf("minecraft"));
    config.addDefault("settings.ipaddress", valueOf("0.0.0.0"));
    config.addDefault("settings.port", 25565);
    config.options().copyDefaults(true);
    protocol = config.getString("settings.protocol");
    name = config.getString("settings.name");
    ip = config.getString("settings.ipaddress");
    port = config.getInt("settings.port");
    saveConfig();
    openPort(ip, port, name, protocol);
}
 
开发者ID:firestorm942,项目名称:upnp,代码行数:22,代码来源:autoupnp.java

示例3: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void onEnable()
/*    */   {
/* 12 */     System.out.println("Plugin enabled");
/*    */     
/* 14 */     FileConfiguration config = getConfig();
/* 15 */     saveDefaultConfig();
/* 16 */     config.addDefault("incorrect-usage", "&8[&3FlyCheck&8] &7Incorrect usage: &f/flycheck [player]");
/* 17 */     config.addDefault("not-online", "&8[&3FlyCheck&8] &7That player needs to be online to be checked!");
/* 18 */     config.addDefault("yes-access", "&8[&3FlyCheck&8] &f%player% &7has access to /fly!");
/* 19 */     config.addDefault("no-access", "&8[&3FlyCheck&8] &f%player% &7does not have access to /fly!");
/* 20 */     saveDefaultConfig();
/*    */   }
 
开发者ID:wmillerrules,项目名称:duccks,代码行数:13,代码来源:main.java

示例4: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void onEnable() {
	plugin = this;	
   	Bukkit.getServer().getLogger().info(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");	
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██╗   ██╗██╗  ████████╗██████╗  █████╗  ██████╗ ██████╗ ██████╗ ███████╗");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██║   ██║██║  ╚══██╔══╝██╔══██╗██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██║   ██║██║     ██║   ██████╔╝███████║██║     ██║   ██║██████╔╝█████╗  ");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██║   ██║██║     ██║   ██╔══██╗██╔══██║██║     ██║   ██║██╔══██╗██╔══╝  ");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "╚██████╔╝███████╗██║   ██║  ██║██║  ██║╚██████╗╚██████╔╝██║  ██║███████╗");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + " ╚═════╝ ╚══════╝╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "166" + ChatColor.YELLOW + "Commands have been loaded");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "205" + ChatColor.YELLOW + "Permissions have been loaded");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "ProtocalLib" + ChatColor.YELLOW + "has been Hooked");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "PlaceholderAPI" + ChatColor.YELLOW + "has been Hooked");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "Vault" + ChatColor.YELLOW + "has been Hooked");
    Bukkit.getServer().getLogger().info(ChatColor.GRAY + "[" + ChatColor.RED + "UltraCore v1" + ChatColor.GRAY + "]" + ChatColor.AQUA + " Has beeen Loaded and Enabled");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");
    Bukkit.getServer().getPluginManager().registerEvents(new Events(), this);
    getServer().getPluginManager().registerEvents(new TeleportMenu(), this);
    getServer().getPluginManager().registerEvents(new AdminMenu(), this);
	getCommand("core").setExecutor(new Core());
	getCommand("teleport").setExecutor(new Teleport());
	getCommand("tp").setExecutor(new TP());
	getCommand("tpo").setExecutor(new TPO());
	getCommand("tppos").setExecutor(new Tppos());
	getCommand("tphere").setExecutor(new Tphere());
	getCommand("tpa").setExecutor(new Tpa());
	getCommand("tpaccept").setExecutor(new Tpa());
	getCommand("tpdeny").setExecutor(new Tpa());
	File f = new File("plugins/UltraCore/", "messages.yml");
	FileConfiguration cfg = YamlConfiguration.loadConfiguration(f);
	cfg.set("this.is.the.file.structure", "this_is_the_string");
	try {
		cfg.save(f);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} 
	String s = cfg.getString("this.is.the.file.structure");
	final FileConfiguration config = this.getConfig();
	config.addDefault("toggle.freezetime", "false");
	config.addDefault("toggle.noweather", "false");
	config.addDefault("toggle.nopvp", "false");
	config.addDefault("toggle.joinandleave", "false");
	config.addDefault("toggle.spawn", "false");
	config.addDefault("toggle.motd", "false");
	config.addDefault("toggle.chat", "false");
	config.addDefault("toggle.tablist", "false");
	config.addDefault("toggle.firstjoinkit", "false");
	config.options().copyDefaults(true);
	saveConfig();
	Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
		 
		@Override
		public void run() {
			if (plugin.getConfig().getString("toggle.freezetime").equals(true)) {
				for(World w : Bukkit.getServer().getWorlds()){
					w.setTime(0L);
				}
			}
		}
	}, 0L, 10000L); 
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:65,代码来源:Main.java

示例5: onEnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void onEnable() {
    plugin = this;
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██╗   ██╗██╗  ████████╗██████╗  █████╗  ██████╗ ██████╗ ██████╗ ███████╗");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██║   ██║██║  ╚��██╔���██╔��██╗██╔��██╗██╔�����██╔���██╗██╔��██╗██╔�����");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██║   ██║██║     ██║   ██████╔�███████║██║     ██║   ██║██████╔�█████╗  ");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "██║   ██║██║     ██║   ██╔��██╗██╔��██║██║     ██║   ██║██╔��██╗██╔���  ");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + "╚██████╔�███████╗██║   ██║  ██║██║  ██║╚██████╗╚██████╔�██║  ██║███████╗");
    Bukkit.getServer().getLogger().info(ChatColor.YELLOW + " ╚������ ╚�������╚��   ╚��  ╚��╚��  ╚�� ╚������ ╚������ ╚��  ╚��╚�������");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "166" + ChatColor.YELLOW + "Commands have been loaded");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "205" + ChatColor.YELLOW + "Permissions have been loaded");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "ProtocalLib" + ChatColor.YELLOW + "has been Hooked");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "PlaceholderAPI" + ChatColor.YELLOW + "has been Hooked");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "Vault" + ChatColor.YELLOW + "has been Hooked");
    Bukkit.getServer().getLogger().info(ChatColor.GRAY + "[" + ChatColor.RED + "UltraCore v1" + ChatColor.GRAY + "]" + ChatColor.AQUA + " Has beeen Loaded and Enabled");
    Bukkit.getServer().getLogger().info(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "--------------------------------------------------");
    Bukkit.getServer().getPluginManager().registerEvents(new Events(), this);
    getServer().getPluginManager().registerEvents(new TeleportMenu(), this);
    getServer().getPluginManager().registerEvents(new AdminMenu(), this);
    getServer().getPluginCommand("tpa").setExecutor(new Tpa());
    Tpa tpa = new Tpa ();
    getCommand("tpaccept").setExecutor(tpa);
    getCommand("tpdeny").setExecutor(tpa);
    getCommand("core").setExecutor(new Core());
    getCommand("teleport").setExecutor(new Teleport());
    getCommand("tp").setExecutor(new TP());
    getCommand("tpo").setExecutor(new TPO());
    getCommand("tppos").setExecutor(new Tppos());
    getCommand("tphere").setExecutor(new Tphere());
    getCommand("setspawn").setExecutor(new Spawn());
    getCommand("spawn").setExecutor(new Spawn());
    File f = new File("plugins/UltraCore/", "messages.yml");
    FileConfiguration cfg = YamlConfiguration.loadConfiguration(f);
    cfg.set("this.is.the.file.structure", "this_is_the_string");
    try {
        cfg.save(f);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    String s = cfg.getString("this.is.the.file.structure");
    final FileConfiguration config = this.getConfig();
    config.addDefault("toggle.freezetime", "false");
    config.addDefault("toggle.noweather", "false");
    config.addDefault("toggle.nopvp", "false");
    config.addDefault("toggle.joinandleave", "false");
    config.addDefault("toggle.spawn", "false");
    config.addDefault("toggle.motd", "false");
    config.addDefault("toggle.chat", "false");
    config.addDefault("toggle.tablist", "false");
    config.addDefault("toggle.firstjoinkit", "false");
    config.options().copyDefaults(true);
    saveConfig();
    Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {

        @Override
        public void run() {
            if (plugin.getConfig().getString("toggle.freezetime").equals(true)) {
                for (World w : Bukkit.getServer().getWorlds()) {
                    w.setTime(0L);
                }
            }
        }
    }, 0L, 10000L);
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:68,代码来源:Main.java


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