getConfig().getStringList();
element1:
souselement: machin
valeur: 152
for(String s : getConfig().getStringList("Bases")){
//quelque chose...
}
for(String s : getConfig().getConfigurationSection("Bases").getValues(false).keySet()){
public static HashMap<String, LocSaver> getRegions(){
return bases;
}
public LocationManager(){}
private static HashMap<String, LocSaver> bases = null;
if(bases == null || bases.size() == 0){
bases = new HashMap<>();
}
private static HashMap<String, LocSaver> bases = null;
private String name;
public LocationManager(String name){
this.name = name;
}
public void add(String worldname, int x1, int x2, int z1, int z2){
if(bases == null || bases.size() == 0){
bases = new HashMap<>();
}
bases.put(name, new LocSaver(worldname, x1, x2, z1, z2));
System.out.println(bases);
}
public LocSaver get(){
if(bases.containsKey(name)){
return bases.get(name);
}
return null;
}
public static HashMap<String, LocSaver> getRegions(){
return bases;
}
[13:27:41 INFO]: [FallenKingdoms] Enabling FallenKingdoms v1.1.0
[13:27:41 ERROR]: Error occurred while enabling FallenKingdoms v1.1.0 (Is it up to date?)
java.lang.IllegalArgumentException: Name cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.craftbukkit.v1_10_R1.CraftServer.getWorld(CraftServer.java:1023) ~[spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.Bukkit.getWorld(Bukkit.java:500) ~[spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at fr.alexfatta.fallenkingdoms.main.onEnable(main.java:69) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) ~[spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugin(CraftServer.java:362) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at org.bukkit.craftbukkit.v1_10_R1.CraftServer.enablePlugins(CraftServer.java:322) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at net.minecraft.server.v1_10_R1.MinecraftServer.t(MinecraftServer.java:416) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at net.minecraft.server.v1_10_R1.MinecraftServer.l(MinecraftServer.java:381) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at net.minecraft.server.v1_10_R1.MinecraftServer.a(MinecraftServer.java:336) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:270) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:539) [spigot_1.10.jar:git-Spigot-6016ac7-10c10b3]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
final File file = new File(getDataFolder(), "bases.yml");
final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
private static String gamePrefix = ChatColor.GRAY + "[" + ChatColor.RED + "FallenKingdoms" + ChatColor.GRAY + "] ";
private static String argument = ChatColor.RED + "Erreur : ce n'est pas le bon argument !";
@Override
public void onEnable() {
saveDefaultConfig();
PluginFile();
setInt();
Bukkit.getServer().getPluginManager().registerEvents(new playerJoinListener(), this);
Bukkit.getServer().getPluginManager().registerEvents(new BlockPlaceManager(), this);
Bukkit.getServer().getPluginManager().registerEvents(this, this);
for (String s : configuration.getConfigurationSection("Bases").getValues(false).keySet()) {
if (s != null) {
new LocationManager(s).add(Bukkit.getWorld(getConfig().getString("Bases."+s+".world")), getConfig().getInt("Bases."+s+".x1"),
getConfig().getInt("Bases."+s+".x2"), getConfig().getInt("Bases."+s+".z1"), getConfig().getInt("Bases."+s+".z2"));
}
}
System.out.println(LocationManager.getRegions());
getCommand("fkstart").setExecutor(new FkStart());
getCommand("fkstop").setExecutor(new FkStop());
getCommand("fkpause").setExecutor(new FkPause());
getCommand("fkplay").setExecutor(new FkPlay());
getCommand("fkhelp").setExecutor(new FkHelp());
getCommand("fkbase").setExecutor(new FkBase(this));
INSTANCE = this;
getLogger().info("Plugin de FallenKingdoms actif !");
}
at fr.alexfatta.fallenkingdoms.main.onEnable(main.java:69) ~[?:?]
new LocationManager(s).add(Bukkit.getWorld(getConfig().getString("Bases."+s+".world")), getConfig().getInt("Bases."+s+".x1"), getConfig().getInt("Bases."+s+".x2"), getConfig().getInt("Bases."+s+".z1"), getConfig().getInt("Bases."+s+".z2"));
Oui pardon je ne l'ai pas précisé mais oui c'est celle-ciSalut,
comme indiqué le nom est null, la ligne de ton erreur est celle ci :
Étant que je n'ait pas les numéro de ligne, je ne peut voir laquelle c'est, mais je suppose que c'est celle ci :
Possible de me le confirmer ?
if ((s != null) && (Bukkit.getWorld(getConfig().getString("Bases."+s+".world")) != null)) {
Trop, malheureusement.Combien de fois j'ai dit ça dans ce topic xDD
final File file = new File(getDataFolder(), "bases.yml");
final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(file);
@Override
public void onEnable() {
saveDefaultConfig();
PluginFile();
setInt();
Bukkit.getServer().getPluginManager().registerEvents(new playerJoinListener(), this);
Bukkit.getServer().getPluginManager().registerEvents(new BlockPlaceManager(), this);
Bukkit.getServer().getPluginManager().registerEvents(this, this);
for (String s : configuration.getConfigurationSection("Bases").getValues(false).keySet()) {
System.out.println(s);
if ((s != null) && (Bukkit.getWorld(configuration.getString("Bases."+s+".world")) != null)) {
new LocationManager(s).add(Bukkit.getWorld(configuration.getString("Bases."+s+".world")), configuration.getInt("Bases."+s+".x1"),
configuration.getInt("Bases."+s+".x2"), configuration.getInt("Bases."+s+".z1"), configuration.getInt("Bases."+s+".z2"));
}
}
System.out.println(LocationManager.getRegions());
getCommand("fkstart").setExecutor(new FkStart());
getCommand("fkstop").setExecutor(new FkStop());
getCommand("fkpause").setExecutor(new FkPause());
getCommand("fkplay").setExecutor(new FkPlay());
getCommand("fkhelp").setExecutor(new FkHelp());
getCommand("fkbase").setExecutor(new FkBase(this));
INSTANCE = this;
getLogger().info("Plugin de FallenKingdoms actif !");
}
[12:35:28 INFO]: [FallenKingdoms] Enabling FallenKingdoms v1.1.0
[12:35:28 INFO]: rouge
[12:35:28 INFO]: {rouge=fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1}
[12:35:28 INFO]: orange
[12:35:28 INFO]: {orange=fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@100ea8ce, rouge=fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1}
[12:35:28 INFO]: {orange=fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@100ea8ce, rouge=fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1}
[12:35:28 INFO]: [FallenKingdoms] Plugin de FallenKingdoms actif !
[12:35:28 INFO]: Server permissions file permissions.yml is empty, ignoring it
[12:35:28 INFO]: Done (5,383s)! For help, type "help" or "?"
[12:40:47 INFO]: GRASS
[12:40:47 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@100ea8ce
[12:40:47 INFO]: Location{world=CraftWorld{name=world},x=192.0,y=0.0,z=322.0,pitch=0.0,yaw=0.0}
[12:40:47 INFO]: Location{world=CraftWorld{name=world},x=222.0,y=0.0,z=352.0,pitch=0.0,yaw=0.0}
[12:40:48 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1
[12:40:48 INFO]: Location{world=CraftWorld{name=world},x=186.0,y=0.0,z=273.0,pitch=0.0,yaw=0.0}
[12:40:48 INFO]: Location{world=CraftWorld{name=world},x=216.0,y=0.0,z=303.0,pitch=0.0,yaw=0.0}
[12:40:53 INFO]: GRASS
[12:40:53 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@100ea8ce
[12:40:53 INFO]: Location{world=CraftWorld{name=world},x=192.0,y=0.0,z=322.0,pitch=0.0,yaw=0.0}
[12:40:53 INFO]: Location{world=CraftWorld{name=world},x=222.0,y=0.0,z=352.0,pitch=0.0,yaw=0.0}
[12:40:53 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1
[12:40:53 INFO]: Location{world=CraftWorld{name=world},x=186.0,y=0.0,z=273.0,pitch=0.0,yaw=0.0}
[12:40:53 INFO]: Location{world=CraftWorld{name=world},x=216.0,y=0.0,z=303.0,pitch=0.0,yaw=0.0}
[12:41:07 INFO]: GRASS
[12:41:07 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@100ea8ce
[12:41:07 INFO]: Location{world=CraftWorld{name=world},x=192.0,y=0.0,z=322.0,pitch=0.0,yaw=0.0}
[12:41:07 INFO]: Location{world=CraftWorld{name=world},x=222.0,y=0.0,z=352.0,pitch=0.0,yaw=0.0}
[12:41:07 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1
[12:41:07 INFO]: Location{world=CraftWorld{name=world},x=186.0,y=0.0,z=273.0,pitch=0.0,yaw=0.0}
[12:41:07 INFO]: Location{world=CraftWorld{name=world},x=216.0,y=0.0,z=303.0,pitch=0.0,yaw=0.0}
[12:41:20 INFO]: GRASS
[12:41:20 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@100ea8ce
[12:41:20 INFO]: Location{world=CraftWorld{name=world},x=192.0,y=0.0,z=322.0,pitch=0.0,yaw=0.0}
[12:41:20 INFO]: Location{world=CraftWorld{name=world},x=222.0,y=0.0,z=352.0,pitch=0.0,yaw=0.0}
[12:41:20 INFO]: fr.alexfatta.fallenkingdoms.getDataBases.LocSaver@69740ea1
[12:41:20 INFO]: Location{world=CraftWorld{name=world},x=186.0,y=0.0,z=273.0,pitch=0.0,yaw=0.0}
[12:41:20 INFO]: Location{world=CraftWorld{name=world},x=216.0,y=0.0,z=303.0,pitch=0.0,yaw=0.0}
Ça c'est ton soucis, j’étaie pas censé le savoir XDDDDepuis le début on dit que les données sont dans le fichier bases.yml. Or le getConfig() c'est pour le config.yml xDD
D'accord, fait signe quand tu as des nouvellesBon du coup le code ne fonctionne pas. Enfin si mais non x) Il detecte bien que je pose un bloc mais les région ne fonctionne pas, il ne me pose pas bon block que je sois dans une région ou non. Donc je vais faire des tests et regarder encore la vidéo que tu as envoyé @DiscowZombie.