Config Question

Discussion in 'Plugin Development' started by plus44kills, Jan 17, 2013.

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

    plus44kills

    Hi i was wondering on this and i was wondering how it would work if i did /rent it would put a configured date such as dec 4 in i cns esily do that manually but i need it so when i type /setrent it replace the string named rent with what you type after /setrent like /setrent dec4

    Code:
    package me.sam.gtb;
     
    import java.util.logging.Logger;
     
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class gtb extends JavaPlugin implements Listener{
        public final Logger logger = Logger.getLogger("Minecraft");
        public static gtb plugin;
       
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this .getDescription();
            this.logger.info(pdfFile.getName() + " Has  Been Disabled");
        }
       
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this .getDescription();
            this.logger.info(pdfFile.getName() + " Has  Been Enabled");
           
        }
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
           
            if(commandLabel.equalsIgnoreCase("nextrent"));
            player.sendMessage(ChatColor.GOLD + getConfig().getString("rent"));
           
            return false;
           
        }
        public boolean onCommand1(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
           
            if(commandLabel.equalsIgnoreCase("setrent"));
           
            return false;
           
        }
    }
    
     
  2. Offline

    Miner_Fil

    You need to save the config, Put this inside onEnable()
    Code:
    getConfig().options().copyDefaults(true);
    saveConfig();
     
  3. Offline

    plus44kills

    Ok i added that
     
  4. Offline

    RainoBoy97

    plus44kills
    You dont need a new onCommand in the same class if you have several commands :p Also do { after if statements instead of ;
     
  5. Offline

    fireblast709

    you cannot even do that... Either due compilation errors, or they simple are ignored by bukkit
     
  6. Offline

    RainoBoy97

    Well, just letting him know.
     
  7. Offline

    plus44kills

    Can we get back to my question?
     
Thread Status:
Not open for further replies.

Share This Page