Here is my code:

```
package meg.zach.d;

import org.apache.logging.log4j.core.jmx.Server;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import net.md_5.bungee.api.ChatColor;

public class Main extends JavaPlugin {
    public void onEnable() {
        getLogger().info("Plugin Enabled");
    }

    public void onDisable() {

    }

    @SuppressWarnings("deprecation")
    public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]) {
        Player p = (Player) sender;
        if (cmd.getName().equalsIgnoreCase("promote") && sender instanceof Player) {
            if (args[0] == "mod") {
                for (Player playerToPromote : Bukkit.getServer().getOnlinePlayers()) {
                    if (playerToPromote.getName().equalsIgnoreCase(args[1])) {
                        String modN = ChatColor.GRAY + "[Mod] ";
                        playerToPromote.setDisplayName(modN + playerToPromote.getDisplayName());
                        String modb = ChatColor.YELLOW + "has been promoted into a ";
                        String mod = ChatColor.GOLD + "Mod ";
                        Bukkit.getServer().broadcastMessage(playerToPromote + modb + mod);

                    }
                    else if(!(playerToPromote.isOnline())){
                        p.sendMessage(ChatColor.RED + "player not online");
                    }
                }

            }

        }
        return false;
    }

```

So my question is when I do /promote and mod and name it doesn't change the display name or anything, and also `getOnlinePlayers` is deprecated for some reason.
Does anyone know how to solve this?