I have no idea why this doesnt work...

Discussion in 'Spigot Plugin Development' started by TheMcBaws, Jul 30, 2018.

  1. Code (Java):
    package net.atlanthea.themcbaws.ajoin.commands;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.FileConfiguration;


    public class AJoin extends Command {

        FileConfiguration config;

        public AJoin(String name, FileConfiguration config) {

            super(name);
            this.config = config;
            this.setAliases(config.getStringList("ajoin.settings.aliases"));
            this.setDescription(config.getString("ajoin.settings.plugindesc"));
            this.setUsage(config.getString("ajoin.settings.pluginusage"));
        }

        @Override
        public boolean execute(CommandSender sender, String commandLabel, String[] args) {
            System.out.println("Fuck you");
            return false;

        }

    }
     
    ...
     
  2. im not getting anything in the console
     
  3. Code (Java):
    package net.atlanthea.themcbaws.ajoin.commands;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;


    public class AJoin extends Command {

        FileConfiguration config;

        public AJoin(String name, FileConfiguration config) {

            super(name);
            this.config = config;
            this.setAliases(config.getStringList("ajoin.settings.aliases"));
            this.setDescription(config.getString("ajoin.settings.plugindesc"));
            this.setUsage(config.getString("ajoin.settings.pluginusage"));
        }

        @Override
        public boolean execute(CommandSender sender, String commandLabel, String[] args) {
            if(!(sender instanceof Player)) {
                sender.sendMessage("Fuck you");
            }
            return false;

        }

    }
     
    this also doesn't work
     
  4. DavidDevelops

    Supporter

    So, uhm, whats not working? whats this supposed to do? please give us full code + start up logs, also learn some java if you can't even explain the problem...
     
  5. I registered that command in the command map,
    Code (Java):
    cmp.register(config.getString("ajoin.settings.commandprefix"), new AJoin(config.getString("ajoin.settings.basecommand"), config));
    and I ran ajoin, which is at that config path
     
  6. DavidDevelops

    Supporter

    Explain what you are trying to do because your code makes less since then what you say...
     
  7. im trying to send "fuck you" to the person executing /ajoin