// Path: hook/manager/src/main/java/net/novucs/ftop/hook/event/FactionEconomyEvent.java
// public class FactionEconomyEvent extends EconomyEvent {
// 
//     private static final HandlerList handlers = new HandlerList();
//     private final String factionId;
// 
//     public FactionEconomyEvent(String factionId, double oldBalance, double newBalance) {
//         super(oldBalance, newBalance);
//         this.factionId = factionId;
//     }
// 
//     public String getFactionId() {
//         return factionId;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// }
// 
// Path: hook/manager/src/main/java/net/novucs/ftop/hook/event/PlayerEconomyEvent.java
// public class PlayerEconomyEvent extends EconomyEvent {
// 
//     private static final HandlerList handlers = new HandlerList();
//     private final Player player;
// 
//     public PlayerEconomyEvent(Player player, double oldBalance, double newBalance) {
//         super(oldBalance, newBalance);
//         this.player = player;
//     }
// 
//     public Player getPlayer() {
//         return player;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// }


import net.milkbowl.vault.economy.Economy;
import net.novucs.ftop.hook.event.FactionEconomyEvent;
import net.novucs.ftop.hook.event.PlayerEconomyEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.*;
            tickPlayers();
        }

        // Tick factions if enabled.
        if (factionEnabled) {
            tickFactions();
        }
    }

    private void tickPlayers() {
        Double oldBalance;
        Double newBalance;
        UUID playerId;

        // Iterate through every player on the server.
        for (Player player : plugin.getServer().getOnlinePlayers()) {
            // Get their previous and current balances.
            playerId = player.getUniqueId();
            oldBalance = playerBalances.get(playerId);
            newBalance = economy.getBalance(player);

            // Add new balance if player is not already added to the cache.
            if (oldBalance == null) {
                playerBalances.put(playerId, newBalance);
                continue;
            }

            // Call PlayerEconomyEvent if their balance has changed.
            if (oldBalance.doubleValue() != newBalance.doubleValue()) {
                playerBalances.put(playerId, newBalance);
// Path: hook/manager/src/main/java/net/novucs/ftop/hook/event/FactionEconomyEvent.java
// public class FactionEconomyEvent extends EconomyEvent {
// 
//     private static final HandlerList handlers = new HandlerList();
//     private final String factionId;
// 
//     public FactionEconomyEvent(String factionId, double oldBalance, double newBalance) {
//         super(oldBalance, newBalance);
//         this.factionId = factionId;
//     }
// 
//     public String getFactionId() {
//         return factionId;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// }
// 
// Path: hook/manager/src/main/java/net/novucs/ftop/hook/event/PlayerEconomyEvent.java
// public class PlayerEconomyEvent extends EconomyEvent {
// 
//     private static final HandlerList handlers = new HandlerList();
//     private final Player player;
// 
//     public PlayerEconomyEvent(Player player, double oldBalance, double newBalance) {
//         super(oldBalance, newBalance);
//         this.player = player;
//     }
// 
//     public Player getPlayer() {
//         return player;
//     }
// 
//     @Override
//     public HandlerList getHandlers() {
//         return handlers;
//     }
// 
//     public static HandlerList getHandlerList() {
//         return handlers;
//     }
// }


// Path: hook/vault/src/main/java/net/novucs/ftop/hook/VaultEconomyHook.java
import net.milkbowl.vault.economy.Economy;
import net.novucs.ftop.hook.event.FactionEconomyEvent;
import net.novucs.ftop.hook.event.PlayerEconomyEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.*;

            tickPlayers();
        }

        // Tick factions if enabled.
        if (factionEnabled) {
            tickFactions();
        }
    }

    private void tickPlayers() {
        Double oldBalance;
        Double newBalance;
        UUID playerId;

        // Iterate through every player on the server.
        for (Player player : plugin.getServer().getOnlinePlayers()) {
            // Get their previous and current balances.
            playerId = player.getUniqueId();
            oldBalance = playerBalances.get(playerId);
            newBalance = economy.getBalance(player);

            // Add new balance if player is not already added to the cache.
            if (oldBalance == null) {
                playerBalances.put(playerId, newBalance);
                continue;
            }

            // Call PlayerEconomyEvent if their balance has changed.
            if (oldBalance.doubleValue() != newBalance.doubleValue()) {
                playerBalances.put(playerId, newBalance);
                callEvent(new PlayerEconomyEvent(player, oldBalance, newBalance));