can annyone help me with this code?

package me.nocare.who.cmds;

import me.nocare.who.Whoplugin;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class WhoCommandHandler implements CommandExecutor {

    private Whoplugin plugin;

    public WhoCommandHandler(Whoplugin instance) {
        this.plugin = instance;

    public boolean onCommand(CommandSender sender, Command Command, String commandLabel, String[] args) {
        String msg = this.getOnlineUserOutput();
        if (sender instanceof Player) {
            Player player = (Player) sender;
            Player.sendMessage(msg); } // **<-- get an error here**
        else {
        return true;

    private String getOnlineUserOutput() {
        String output = "Online Players (%s/%s): %s";
        return String.format(output, this.plugin.getServer().getOnlinePlayers().length, this.plugin.getServer()

    private String formatPlayerList(Player[] onlinePlayers) {
        String returnValue = onlinePlayers[0].getDisplayName();
        for (int i - 1; i < onlinePlayers.length; i++) { // ** <-- and one on the i after int**
            returnValue += ", "+onlinePlayers[i].getDisplayName();
        return returnValue; 

3 Years
Discussion Span
Last Post by rikje.van.driessche

Welcome to DaniWeb.

"get an error here" tells us nothing. If you have a compiler or runtime error message please post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the correct result should be. Help us to help you.

Anyway, at a guess, you are calling sendMessage as if it's a static method (you call it using the class name). My guess is that it's an instance method.

As for line 38... "-" is not the same as "=". I'd ask for a better/clearer/sharper monitor for my next birthday!

Edited by JamesCherrill


thanks James i solved the sendmessage my self and now i know why the i gaves a error thanks! and i was becaus i watched it on youtube ;p i already have a good monitor

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.