• Es freut uns dass du in unser Minecraft Forum gefunden hast. Hier kannst du mit über 130.000 Minecraft Fans über Minecraft diskutieren, Fragen stellen und anderen helfen. In diesem Minecraft Forum kannst du auch nach Teammitgliedern, Administratoren, Moderatoren , Supporter oder Sponsoren suchen. Gerne kannst du im Offtopic Bereich unseres Minecraft Forums auch über nicht Minecraft spezifische Themen reden. Wir hoffen dir gefällt es in unserem Minecraft Forum!

Scoreboard Problem

xxProgramerx

Minecrafter
Registriert
16 März 2014
Beiträge
26
Diamanten
0
hey leute..

Ich bin immer noch an meine ffa plugin zugange! Nun bei dem Scoreboard! Mein Problem ist das alle spieler das selbe SCoreboard haben! Ich weiß aber nicht wieso?!
Hier der Code
Code:
package ScoreboardPack;

import java.io.File;
import java.io.IOException;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;

public class ScoreboardAdder {
	
	public static ScoreboardManager sm = Bukkit.getServer().getScoreboardManager();
	public static Scoreboard board = sm.getNewScoreboard();
	
	public static Objective score = board.registerNewObjective("aaa", "bbb");
	
	public static void CreateScoreboard(Player player){
		

		score.setDisplayName("§6[MAPvP]");
		score.setDisplaySlot(DisplaySlot.SIDEBAR);
		
		Score kills = score.getScore(Bukkit.getOfflinePlayer("Kills:"));
		Score deaths = score.getScore(Bukkit.getOfflinePlayer("Tode:"));
		Score Level = score.getScore(Bukkit.getOfflinePlayer("Level:"));
		Score Rang = score.getScore(Bukkit.getOfflinePlayer("Rang:"));
		Score Punkte = score.getScore(Bukkit.getOfflinePlayer("Punkte:"));
		
	
		kills.setScore(ScoreboardAdder.getKills(player));
		deaths.setScore(ScoreboardAdder.getDeaths(player));
		Level.setScore(player.getLevel());
		Rang.setScore(1);
		Punkte.setScore(ScoreboardAdder.getPunkte(player));
		
		player.setScoreboard(board);
		
	}
	
	public static int getKills(Player p){
		File kills = new File("plugins/MAPvp/", "Scoreboardstats.yml");
		FileConfiguration stats = YamlConfiguration.loadConfiguration(kills);
		int back = stats.getInt(p.getName() + ".Kills");
		return back;
		
	}

	public static int getDeaths(Player p){
		File kills = new File("plugins/MAPvp/", "Scoreboardstats.yml");
		FileConfiguration stats = YamlConfiguration.loadConfiguration(kills);
		int back = stats.getInt(p.getName() + ".Deaths");
		return back;
		
	}
	public static int getPunkte(Player p){
		File kills = new File("plugins/MAPvp/", "Scoreboardstats.yml");
		FileConfiguration stats = YamlConfiguration.loadConfiguration(kills);
		int back = stats.getInt(p.getName() + ".Punkte");
		return back;
		
	}
	public static void addKill(Player p) throws IOException{
		File kills = new File("plugins/MAPvp/", "Scoreboardstats.yml");
		FileConfiguration stats = YamlConfiguration.loadConfiguration(kills);
		int killint = stats.getInt(p.getName() + ".Kills");
		stats.set(p.getName() + ".Kills", killint+1);
		stats.save(kills);
	}
public static void addDeath(Player p) throws IOException{
	File kills = new File("plugins/MAPvp/", "Scoreboardstats.yml");
	FileConfiguration stats = YamlConfiguration.loadConfiguration(kills);
	int deathsint = stats.getInt(p.getName() + ".Deaths");
	stats.set(p.getName() + ".Deaths", deathsint+1);
	stats.save(kills);
		
	}
public static void addPunkte(Player p) throws IOException{
	File kills = new File("plugins/MAPvp/", "Scoreboardstats.yml");
	FileConfiguration stats = YamlConfiguration.loadConfiguration(kills);
	int punkteint = stats.getInt(p.getName() + ".Punkte");
	stats.set(p.getName() + ".Punkte", punkteint+1);
	stats.save(kills);
	
}
public static void Remove(Player p){
	board.clearSlot(DisplaySlot.SIDEBAR);
		
}
}
Ich hoffe mir kann jemand weiterhelfen und mir den Fehler nenen! PS: Das Scoreboard erstelle ich in einer Exterenen Klasse! Also in der SignJoin Klasse!

MFG
 
Oben