Mr_Redstone19
Schafhirte
Hallo.
Ich habe eine Frage bezüglich dieses Codes (Codeausschnitt aus einem Alle gegen Alle Minigame mit Map und Kitwechsler):
Sobald die RandomMethode ausgeführt wurde, sieht es folgendermaßen aus (In der Config):
map:
forest: is
(Zum Beispiel)
Doch wenn man jetzt stirbt, dann wird man egal bei welchem Eintrag immer zu der Map "Lobby" teleportiert. Stimmt etwas an dem Code oben (Respawn-Methode) nicht?
Ich hoffe ihr könnt mir helfen. Ich weiß nämlich echt nicht mehr, was ich tun soll
Ich habe eine Frage bezüglich dieses Codes (Codeausschnitt aus einem Alle gegen Alle Minigame mit Map und Kitwechsler):
java:
File file2 = new File("plugins//Surf//map.yml");
YamlConfiguration cfg2 = YamlConfiguration.loadConfiguration(file2);
Random r = new Random();
int zufall = r.nextInt(2);
switch(zufall) {
case 0:
cfg2.set("map.forest", "is");
try {
cfg2.save(file2);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
break;
case 1:
cfg2.set("map.lobby", "is");
try {
cfg2.save(file2);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
break;
}
java:
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
File file2 = new File("plugins//Surf//map.yml");
YamlConfiguration cfg2 = YamlConfiguration.loadConfiguration(file2);
File file3 = new File("plugins//Surf//kit.yml");
YamlConfiguration cfg3 = YamlConfiguration.loadConfiguration(file3);
Player p = e.getPlayer();
if(cfg2.isSet("map.forest")) {
Location forest = new Location(p.getWorld(), 602, 76, -1247);
forest.setPitch(2f);
forest.setYaw(180f);
p.teleport(forest);
if(cfg3.isSet("kit.tank")) {
INVENTKITTank.setKitInv(p);
}else if(cfg3.isSet("kit.flamebow")) {
INVENTKITFlameBow.setKitInv(p);
}else if(cfg3.isSet("kit.hero")) {
INVENTKITHero.setKitInv(p);
}else if(cfg3.isSet("kit.knock")) {
INVENTKITKnock.setKitInv(p);
}else if(cfg3.isSet("kit.noob")) {
INVENTKITNoob.setKitInv(p);
}else if(cfg3.isSet("kit.opbow")) {
INVENTKITOPBow.setKitInv(p);
}
}else if(cfg2.isSet("map.lobby")){
Location lobby = new Location(p.getWorld(), 608.5, 68, -1369.5);
lobby.setPitch(2f);
lobby.setYaw(0f);
p.teleport(lobby);
if(cfg3.isSet("kit.tank")) {
INVENTKITTank.setKitInv(p);
}else if(cfg3.isSet("kit.flamebow")) {
INVENTKITFlameBow.setKitInv(p);
}else if(cfg3.isSet("kit.hero")) {
INVENTKITHero.setKitInv(p);
}else if(cfg3.isSet("kit.knock")) {
INVENTKITKnock.setKitInv(p);
}else if(cfg3.isSet("kit.noob")) {
INVENTKITNoob.setKitInv(p);
}else if(cfg3.isSet("kit.opbow")) {
INVENTKITOPBow.setKitInv(p);
}
}
}
Sobald die RandomMethode ausgeführt wurde, sieht es folgendermaßen aus (In der Config):
map:
forest: is
(Zum Beispiel)
Doch wenn man jetzt stirbt, dann wird man egal bei welchem Eintrag immer zu der Map "Lobby" teleportiert. Stimmt etwas an dem Code oben (Respawn-Methode) nicht?
Ich hoffe ihr könnt mir helfen. Ich weiß nämlich echt nicht mehr, was ich tun soll