use of org.bukkit.configuration.file.FileConfiguration in project Minigames by AddstarMC.
the class ScoreboardData method loadDisplays.
public void loadDisplays(MinigameSave save, Minigame mgm) {
FileConfiguration con = save.getConfig();
ConfigurationSection root = con.getConfigurationSection(mgm.getName(false) + ".scoreboards");
if (root == null) {
return;
}
for (String key : root.getKeys(false)) {
ConfigurationSection displayConf = root.getConfigurationSection(key);
ScoreboardDisplay display = ScoreboardDisplay.load(mgm, displayConf);
if (display != null) {
addDisplay(display);
}
}
}
use of org.bukkit.configuration.file.FileConfiguration in project Prism-Bukkit by prism.
the class RadiusParameter method defaultTo.
/**
*
*/
@Override
public void defaultTo(QueryParameters query, CommandSender sender) {
if (query.getProcessType().equals(PrismProcessType.DELETE))
return;
if (sender != null && sender instanceof Player) {
if (query.allowsNoRadius()) {
// We'll allow no radius.
} else {
final FileConfiguration config = Bukkit.getPluginManager().getPlugin("Prism").getConfig();
query.setRadius(config.getInt("prism.queries.default-radius"));
query.addDefaultUsed("r:" + query.getRadius());
}
}
}
use of org.bukkit.configuration.file.FileConfiguration in project Prism-Bukkit by prism.
the class SinceParameter method defaultTo.
/**
*
*/
@Override
public void defaultTo(QueryParameters query, CommandSender sender) {
if (query.getProcessType().equals(PrismProcessType.DELETE))
return;
if (!query.getFoundArgs().contains("before") && !query.getFoundArgs().contains("since")) {
final FileConfiguration config = Bukkit.getPluginManager().getPlugin("Prism").getConfig();
Long date = DateUtil.translateTimeStringToDate(config.getString("prism.queries.default-time-since"));
if (date == 0) {
Prism.log("Error - date range configuration for prism.time-since is not valid");
date = DateUtil.translateTimeStringToDate("3d");
}
query.setSinceTime(date);
query.addDefaultUsed("t:" + config.getString("prism.queries.default-time-since"));
}
}
use of org.bukkit.configuration.file.FileConfiguration in project AuthMeReloaded by AuthMe.
the class HelpMessagesConsistencyTest method shouldHaveIdenticalTexts.
@Test
public void shouldHaveIdenticalTexts() {
// given
CommandDescription description = getAuthMeRegisterDescription();
FileConfiguration configuration = YamlConfiguration.loadConfiguration(DEFAULT_MESSAGES_FILE);
final String path = "commands.authme.register.";
// when / then
assertThat(configuration.get(path + "description"), equalTo(description.getDescription()));
assertThat(configuration.get(path + "detailedDescription"), equalTo(description.getDetailedDescription()));
assertThat(configuration.get(path + "arg1.label"), equalTo(description.getArguments().get(0).getName()));
assertThat(configuration.get(path + "arg1.description"), equalTo(description.getArguments().get(0).getDescription()));
assertThat(configuration.get(path + "arg2.label"), equalTo(description.getArguments().get(1).getName()));
assertThat(configuration.get(path + "arg2.description"), equalTo(description.getArguments().get(1).getDescription()));
}
use of org.bukkit.configuration.file.FileConfiguration in project AuthMeReloaded by AuthMe.
the class HelpMessagesConsistencyTest method shouldOnlyHaveDescriptionForOneCommand.
/**
* Since CommandInitializer contains all descriptions for commands in English, the help_en.yml file
* only contains an entry for one command as to provide an example.
*/
@Test
public void shouldOnlyHaveDescriptionForOneCommand() {
// given
FileConfiguration configuration = YamlConfiguration.loadConfiguration(DEFAULT_MESSAGES_FILE);
// when
Object commands = configuration.get("commands");
// then
assertThat(commands, instanceOf(MemorySection.class));
assertThat(((MemorySection) commands).getKeys(false), contains("authme"));
}
Aggregations