Development Assistance My plugin isn't working properly (greater and smaller than?)

Discussion in 'Plugin Help/Development/Requests' started by MieskeB, Aug 24, 2016.

Thread Status:
Not open for further replies.
  1. Dear sir/madam,

    I am trying creating new plugins for my server, everything worked until I've added a new command (codes listed down below). This command should do /vote 1 or /vote 2 or whatever... But when I type it in, it will only say "/vote <args>" like I've said in the plugin.yml. I think the problem has something to do with the equal or greater then (located at line 35, 45, 55, 65 of the vote command class). Thanks in advance!

    This is the main class:

    Code:
    package me.TheMlgKillerPro;
    
    import org.bukkit.ChatColor;
    import org.bukkit.permissions.Permission;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class TheMlgKillerPro extends JavaPlugin{
    
        public Permission playerPermission = new Permission("themlgkillerpro");
    
        @Override
        public void onEnable() {
            getLogger().info(ChatColor.GREEN + "TheMlgKillerPro's plugin is enabled!");
            new PlayerJoin(this);
            new Side(this);
            PluginManager pm = getServer().getPluginManager();
            pm.addPermission(playerPermission);
            this.getCommand("themlgkillerpro").setExecutor(new CmdTheMlgKillerPro(this));
            this.getCommand("Admin").setExecutor(new CmdAdmin(this));
            this.getCommand("Spawn").setExecutor(new CmdSpawn(this));
            this.getCommand("Side").setExecutor(new CmdSide(this));
            this.getCommand("SideCreate").setExecutor(new CmdSideCreate(this));
            this.getCommand("Permissions").setExecutor(new CmdPermissions(this));
            this.getCommand("vote").setExecutor(new CmdVote(this));
            registerConfig();    
        }
    
    
        @Override
        public void onDisable() {
            getLogger().info(ChatColor.RED + "TheMlgKillerPro's plugin is disabled!");
        }
    
    
        private void registerConfig() {
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    
        public void registerEvents() {
            PluginManager pm = getServer().getPluginManager();
        
            pm.registerEvents(new PlayerJoin(this), this);
        
        }
    }
    
    this is the vote command class:

    Code:
    package me.TheMlgKillerPro;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    
    public class CmdVote implements CommandExecutor{
    
        TheMlgKillerPro plugin;
    
        public CmdVote(TheMlgKillerPro pl){
            this.plugin = pl;
        }
    
    
    
        public boolean onCommand (CommandSender sender, Command cmd, String label, String [] args) {
              if (cmd.getName().equalsIgnoreCase("admin") && sender instanceof Player) {
                Player player = (Player) sender;
          
                if (cmd.getName().equalsIgnoreCase ("vote")) {
                    if (plugin.getConfig().getString("vote") == plugin.getConfig().getString("true")) {
                        if (player.hasPermission("themlgkillerpro.vote")) {
                            if (args.length == 0) {
                                player.sendMessage(ChatColor.GREEN + "=-=-=" + ChatColor.RED + "votelist 1/" + plugin.getConfig ().getString ("votepageamount") + ChatColor.GREEN + "=-=-=");
                                player.sendMessage(ChatColor.GRAY + "Vote at these sites for additional rewards");
                                player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page1.1"));
                                player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page1.2"));
                                player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page1.3"));
                                return true;
                            }
                            if (args.length == 1) {
                                if (Integer.parseInt(plugin.getConfig ().getString("votepageamount")) >= 1) {
                                    if (args [0].equalsIgnoreCase ("1")) {
                                        player.sendMessage(ChatColor.GREEN + "=-=-=" + ChatColor.RED + "votelist 1/" + plugin.getConfig ().getString ("votepageamount") + ChatColor.GREEN + "=-=-=");
                                        player.sendMessage(ChatColor.GRAY + "Vote at these sites for additional rewards");
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page1.1"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page1.2"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page1.3"));
                                        return true;
                                    }
                                }
                                if(Integer.parseInt(plugin.getConfig ().getString ("votepageamount")) >= 2) {
                                    if (args [0].equalsIgnoreCase ("2")) {
                                        player.sendMessage(ChatColor.GREEN + "=-=-=" + ChatColor.RED + "votelist 2/" + plugin.getConfig ().getString ("votepageamount") + ChatColor.GREEN + "=-=-=");
                                        player.sendMessage(ChatColor.GRAY + "Vote at these sites for additional rewards");
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page2.1"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page2.2"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page2.3"));
                                        return true;
                                    }
                                }
                                if(Integer.parseInt(plugin.getConfig ().getString ("votepageamount")) >= 3) {
                                    if (args [0].equalsIgnoreCase ("3")) {
                                        player.sendMessage(ChatColor.GREEN + "=-=-=" + ChatColor.RED + "votelist 3/" + plugin.getConfig ().getString ("votepageamount") + ChatColor.GREEN + "=-=-=");
                                        player.sendMessage(ChatColor.GRAY + "Vote at these sites for additional rewards");
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page3.1"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page3.2"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page3.3"));
                                        return true;
                                    }
                                }
                                if(Integer.parseInt(plugin.getConfig ().getString ("votepageamount")) >= 4) {
                                    if (args [0].equalsIgnoreCase ("4")) {
                                        player.sendMessage(ChatColor.GREEN + "=-=-=" + ChatColor.RED + "votelist 4/" + plugin.getConfig ().getString ("votepageamount") + ChatColor.GREEN + "=-=-=");
                                        player.sendMessage(ChatColor.GRAY + "Vote at these sites for additional rewards");
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString ("page4.1"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig ().getString ("page4.2"));
                                        player.sendMessage(ChatColor.GREEN + plugin.getConfig().getString("page4.3"));
                                        return true;
                                    }
                                }
                            }
                        }
                    }
                }
              }
              return false;
        }
    }
    
     
Thread Status:
Not open for further replies.

Share This Page