#Creating a Player Wrapping method

1 messages · Page 1 of 1 (latest)

sharp charm
#

Creating a Player Wrapping method

#

But somehow the method doesnt show up if i call it in my Class (I am creating a command)

alpine shadow
#

Show your code

sharp charm
#

So in the command class i have: ```String prefix = Main.getPrefix();

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    String usage = (prefix + "Bitte nutze /" + ChatColor.GREEN + label + 
            ChatColor.GRAY + " <" + ChatColor.GREEN +  "set" +
            ChatColor.GRAY + " | " + ChatColor.GREEN + "reset" + 
            ChatColor.GRAY +  "> <" + ChatColor.GREEN  + "status" +
            ChatColor.GRAY + ">.");
    
    if (sender instanceof Player) {
        Player p = (Player) sender;
        if (args.length == 1 || args.length == 2) {
            if (args.length == 1) {
                if (args[0].equals("reset")) {
                    p.setSt
                } else p.sendMessage(usage);
            } else if (args.length == 2) {
                
            }
        } else
            p.sendMessage(usage);
    } else 
        sender.sendMessage(prefix + "Der Command /" +  ChatColor.GREEN + label + ChatColor.GRAY + " kann nur von Spielern genutzt werden.");
    return false;
}```
#

And in the Warpper just this: ```
Player p;

public static void setStatus(Status s) {
    
}```
alpine shadow
#

Why is it static

#

Also you need an instance of your wrapper, not just Player

sharp charm
#

I thought it would solve it...

sharp charm
alpine shadow
#

You should have a constructor for your wrapper that takes in a player

#

And then potentially some kind of manager class to keep track of them

#

Where you can map UUID->Wrapper

sharp charm
#

I'mma try the constructor really quick

#

I will work on it tomorrow because I gotta go for now, thank you very much. Hope you have a nice christmas