I made this bossbar plugin that runs fine till you relog, When you do, it starts doing %2 at a time & Increases more every time you relog. Could this be a problem Code: public void onJoin(PlayerJoinEvent e){ Player p = e.getPlayer(); Maybe it is starting the code again, While not stopping the other one? Here is the src: Code: package Example; import java.util.ArrayList; import java.util.List; import me.confuser.barapi.BarAPI; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; public class barapiplugin extends JavaPlugin implements Listener { public void onEnable(){ getServer().getPluginManager().registerEvents(this, this); } @EventHandler public void onJoin(PlayerJoinEvent e){ Player p = e.getPlayer(); showBarChanging(p); } public int iii=1; public void showBarChanging(final Player p){ getServer().getScheduler() .scheduleSyncRepeatingTask(this, new Runnable(){ public void run(){ List<String> list = new ArrayList<>(); list.add("§1Example, Example"); list.add("§2Example, Example"); list.add("§3Example, Example"); String message = (String) list.get(iii); iii++; if(iii==99){ iii=0; } BarAPI.setMessage(p, message); BarAPI.setHealth(p, iii); } }, 0L, 1 * 7); } }
crazyguy51 For one, you are adding to "iii" every 7 ticks for every player online. Also, add a check in the runnable to see if they're offline. If so, cancel the task.
crazyguy51 Try this: Code: ublic void showBarChanging(Player p) { new BukkitRunnable() { int iii = 1; @Override public void run() { if (!p.isOnline()) { this.cancel(); return; } List<String> list = new ArrayList<>(); list.add("§1Example, Example"); list.add("§2Example, Example"); list.add("§3Example, Example"); String message = (String) list.get(iii); iii++; if (iii == 99) { iii = 0; } BarAPI.setMessage(p, message); BarAPI.setHealth(p, iii); } }.runTaskTimer(yourPlugin, 0, timeInTicks); } I moved "iii" to be player-specific and added an online check that stops when the player logs off.