So, I have a plugin, it has boosters. A booster is what gives a server a privilege. One of my booster is a 3x bounty booster. What this does: If someone activates this booster, for a half-hour, for every kill you would get, the money you get is being multiplied by 3. The problem is, that this booster doesnt work for me. I've already done an other booster, which works almost fine, but this doesn't work at all. I'm including source codes. Firstly, this is a piece of the listener. This is, where all the stuff happens. The TripleBountyBooster object in this class, is created in this way: Code: public static TripleBountyBooster tbb = new TripleBountyBooster(Main.ins); Code: if (m.getConfig().getBoolean("random-reward") == false){ int money = getKillReward(); if (tbb.isEnabled){ money = money * 3; } if (victimmoney >= getKillReward()){ Main.economy.withdrawPlayer(victim, money); Main.economy.depositPlayer(killer, money); }else{ Main.economy.withdrawPlayer(victim, victimmoney); Main.economy.depositPlayer(killer, money); } victim.sendMessage(conv(getPrefix() + " " + getVictimText(killer, money))); killer.sendMessage(conv(getPrefix() + " " + getKillerText(victim, money))); }else{ int random = nextInt(m.getConfig().getInt("random-min"), m.getConfig().getInt("random-max")); if (tbb.isEnabled){ random = random * 3; } if (victimmoney >= random){ Main.economy.withdrawPlayer(victim, random); Main.economy.depositPlayer(killer, random); }else{ Main.economy.withdrawPlayer(victim, victimmoney); Main.economy.depositPlayer(killer, random); } victim.sendMessage(conv(getPrefix() + " " + getVictimRandomText(killer, random))); killer.sendMessage(conv(getPrefix() + " " + getKillerRandomText(victim, random))); } Second, TripleBountyBooster.class This class extends my main Booster class. Code: public class TripleBountyBooster extends Booster{ public static Main m; public TripleBountyBooster(Main ins){ m = ins; } public String executor; public boolean isEnabled = false; public String getName() { return "triple bounty"; } public String getExecutor() { return executor; } public void runEvent(int secs, Player player) { secs = secs * 20; this.executor = player.getName(); printBooster(getExecutor(), new TripleBountyBooster(m)); Bukkit.broadcastMessage("§cFor 30 minutes, the money for all the kills you get, will be multiplied by 3!"); isEnabled = true; for(Player p : Bukkit.getOnlinePlayers()){ TitleAPI.sendTitle(p, "§eA §rbounty §ebooster was activated!", "§aActivator: §r" + getExecutor(), 1, 5, 1); p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 0); Runnable r = new Runnable(){ public void run(){ isEnabled = false; Bukkit.broadcastMessage("§cThe §rbounty §cbooster has ended!"); TitleAPI.sendTitle(p, "§cThe §rbounty §cbooster has ended!", "", 1, 5, 1); } }; Bukkit.getScheduler().runTaskLater(m, r, secs); } } } And, finally the origin of all booster classes: Booster.class Pretty tiny, because it only contains the elements what all the boosters should have. Code: public abstract class Booster{ public abstract void runEvent(int secs, Player player); public abstract String getName(); public abstract String getExecutor(); public void printBooster(String player, Booster b){ Bukkit.broadcastMessage("§3[§dBooster§3] §e" + this.getExecutor() + " §ractivated the " + b.getName() + " §abooster!"); } } Thanks in advance.
Totally not proper OOP... but aside from that, the code looks sound. Have you tried putting in debug messages where the magic happens? The logic is a bit hard to follow, especially with only the sections of code we were given... like, I don't know what victimmoney is or what relation it has to money, but that'd be my guess as to where the problem lies.
And what of the debug messages? I'd test it myself, I just don't have the infrastructure built that you do...