Please Help

Discussion in 'Plugin Development' started by PlEAseHelpMe333, Jun 1, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    PlEAseHelpMe333

    I dont know how to fix that.. please some one fix that for me.
    please.
    Code:
      private TeamCommand getCommand(String key){
        TeamCommand tc;
        label65:
        for (Iterator localIterator = this.commands.values().iterator(); localIterator.hasNext(); return tc){
          tc = (TeamCommand)localIterator.next();
          if (tc.name().equalsIgnoreCase(key)) {
            return tc;
          }
          if ((tc.alias() == null) || (!tc.alias().equalsIgnoreCase(key))) {
            break label65;
          }
        }
        return null;
      }
     
  2. Offline

    ark9026

  3. Offline

    PlEAseHelpMe333

    Code:
    package me.daniel.util;
    
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.TreeMap;
    import java.util.Vector;
    
    import me.daniel.TeamManager;
    import me.daniel.cmds.Chat;
    import me.daniel.cmds.Create;
    import me.daniel.cmds.FriendlyFire;
    import me.daniel.cmds.HQ;
    import me.daniel.cmds.Info;
    import me.daniel.cmds.Join;
    import me.daniel.cmds.Kick;
    import me.daniel.cmds.Leave;
    import me.daniel.cmds.Pass;
    import me.daniel.cmds.Promote;
    import me.daniel.cmds.Rally;
    import me.daniel.cmds.Remove;
    import me.daniel.cmds.SetHQ;
    import me.daniel.cmds.SetRally;
    import me.daniel.cmds.TeamCommand;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.Plugin;
    
    public class CommandManager
      implements CommandExecutor
    {
      static CommandManager instance = new CommandManager();
    
      public static CommandManager getInstance(Plugin p)
      {
        return instance;
      }
    
      @SuppressWarnings("unchecked")
    TreeMap<String, TeamCommand> commands = new TreeMap();
    
      public void setup()
      {
        this.commands.put("chat", new Chat());
        this.commands.put("create", new Create());
        this.commands.put("ff", new FriendlyFire());
        this.commands.put("hq", new HQ());
        this.commands.put("info", new Info());
        this.commands.put("join", new Join());
        this.commands.put("kick", new Kick());
        this.commands.put("leave", new Leave());
        this.commands.put("pass", new Pass());
        this.commands.put("promote", new Promote());
        this.commands.put("rally", new Rally());
        this.commands.put("remove", new Remove());
        this.commands.put("sethq", new SetHQ());
        this.commands.put("setrally", new SetRally());
      }
    
      MessageManager msgmgr = MessageManager.getInstance();
      SettingsManager settings = SettingsManager.getInstance();
    
      public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
      {
        if (!(sender instanceof Player))
        {
          this.msgmgr.log("The console can't use Team!");
          return true;
        }
        Player p = (Player)sender;
        if (cmd.getName().equalsIgnoreCase("team"))
        {
          if (args.length == 0)
          {
            this.msgmgr.msg(p, "***All Players***", true);
            for (TeamCommand command : this.commands.values()) {
              if (!command.managersOnly()) {
                this.msgmgr.msg(p,
                  "/" + cmd.getName() + " " +
                  command.name() + " " + (
                  command.alias() != null ? "(" + command.alias() + ") " : "") + (
                  command.usage() != null ? command.usage() : "") +
                  " - " + command.desc());
              }
            }
            this.msgmgr.msg(p, "***Managers Only***", true);
            for (TeamCommand command : this.commands.values()) {
              if (command.managersOnly()) {
                this.msgmgr.msg(p,
                  "/" + cmd.getName() + " " +
                  command.name() + " " + (
                  command.alias() != null ? "(" + command.alias() + ") " : "") + (
                  command.usage() != null ? command.usage() : "") +
                  " - " + command.desc());
              }
            }
            return true;
          }
          String sub = args[0];
          Object l = new Vector();
          ((Vector)l).addAll(Arrays.asList(args));
          ((Vector)l).remove(0);
          args = (String[])((Vector)l).toArray(new String[0]);
       
          TeamCommand c = getCommand(sub);
          if (c == null)
          {
            this.msgmgr.msg(p, "/team " + sub + " is not a valid command! See /team help.");
            return true;
          }
          if ((c.managersOnly()) && (!TeamManager.getInstance().getPlayerTeam(p).getManagers().contains(p.getName())))
          {
            this.msgmgr.msg(p, "You need to be a manager to execute that command.");
            return true;
          }
          try
          {
            c.onCommand(p, args);
          }
          catch (Exception e)
          {
            e.printStackTrace();
            this.msgmgr.msg(p, "An error has occured while executing the command: " + e.getMessage());
          }
          return true;
        }
        return true;
      }
    
      private TeamCommand getCommand(String key)
      {
        TeamCommand tc;
        label65:
        for (Iterator localIterator = this.commands.values().iterator(); localIterator.hasNext(); return tc)
        {
          tc = (TeamCommand)localIterator.next();
          if (tc.name().equalsIgnoreCase(key)) {
            return tc;
          }
          if ((tc.alias() == null) || (!tc.alias().equalsIgnoreCase(key))) {
            break label65;
          }
        }
        return null;
      }
    }
    
    This is a team plugin that i open with java decompiler.. yea yea im noob. but i want just change some things and the chat.. i dont have to much time to learn how to fix these , so please help me, :)
     
    Last edited: Jun 1, 2015
  4. Offline

    CoolGamerXD

    "Don't have time to learn how to fix these?" What are you expecting then?
     
  5. Offline

    Googlelover1234

    @PlEAseHelpMe333
    We still don't have any sort of idea on what you are attempting to do, please tell us what exactly you want help with.
     
Thread Status:
Not open for further replies.

Share This Page