本文整理汇总了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));
}
示例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);
}
示例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();
/* */ }
示例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);
}
示例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);
}