Counting error

Discussion in 'Spigot Plugin Development' started by JackboyPlay, Apr 21, 2017.

Thread Status:
Not open for further replies.
  1. Hello, if set the stats with the code, the startstats will be automaticly setted too, but why? I'm not setting the startstats again.
    PHP:

    private static HashMap<Player, Statistik> startstats = new HashMap<Player, Statistik>();
    private static HashMap<Player, Statistik> stats = new HashMap<Player, Statistik>();

    public static void onJoin(Player player) {
        startstats.put(player, new Statistik(0, 0, 0, 0, 0, 0));
        stats.put(player, new Statistik(0, 0, 0, 0, 0, 0));
    }

    public static void setStats(Player player, Statistik statistik){
            if(stats.containsKey(player)){
                Bukkit.getLogger().info("Stats: " + getStatistik(player).getKills());
                Bukkit.getLogger().info("Start: " + startstats.get(player).getKills());
                stats.remove(player);
            }
            stats.put(player, statistik);
            Bukkit.getLogger().info("Stats: " + getStatistik(player).getKills());
            Bukkit.getLogger().info("Start: " + startstats.get(player).getKills());
        }

    public static Statistik getStatistik(Player player){
            if(stats.containsKey(player)) return stats.get(player);
            return null;
        }

    public static void update(Player player){
        Statistik killer = StatsSystem.getStatistik(player);
        killer.setKills(killer.getKills() + 1);
        killer.setCoins(killer.getCoins() + StatsSystem.getCoinsProKill());
        killer.setPunkte(killer.getPunkte() + StatsSystem.getPunkteProKill());
        StatsSystem.setStats(player, killer);
    }
     
     
  2. What do the Bukkit.getLogger().info("") statements display when run?
     
Thread Status:
Not open for further replies.