Item commands

Discussion in 'Archived: Plugin Requests' started by tommygoesha, May 9, 2013.

  1. Offline

    tommygoesha

    im not sure besides powertool if there is a plugin out there that you can set in a config for a item to run a command.
    say i want right click with a clock to make it day time, when anyone uses the clock itll run through console.. or run other plugin commands
    like if i right click with a sword (i know thats to block) itll open up the /mcmmo stats

    Any suggestions? if its not made already, itd be nice to see it. If it is made please direct me to it :D?
     
  2. Offline

    Zarius

    OtherDrops can do this (with a config file based approach), eg.

    PHP:
      ANY:
      - 
    actionrightclick
        tool
    diamondsword
        command
    "/mcmmo stats"
     
      
    actionrightclick
        tool
    clock~DayChanger   # optionally you can include a lorename like so
        
    command"/time day"
    Commands above use the activating players permission. You can also use "/*time day" to run it as if the player is an OP or "/$time day" to run it as if from console. Check out the "command" section on the OtherDrops parameters page for more info (if you're interested).
     
  3. Offline

    tommygoesha

    Thanks! :)

    Alright so i tried doing this but for some reason it doesnt work, not even the included ones.



    PHP:
    include-files:
      - 
    includes/od-dyewool.yml            # Dye wool after placing!
      
    includes/Clock.yml
      
    includes/od-stop_mob_farms.yml      # Stop mob farming!
      
    includes/od-fix_undroppables.yml    # fix glass, bookshelf, boat and stairs drops
      
    includes/od-goldtools-basic.yml    # allow gold tools chance to get ice, glowstone and grass
    #  - includes/od-goldtools-smelt.yml    # gold-pickaxe smelts ores to ingots, sand to glass, etc
    #  - includes/od-ore_extraction.yml      # allow ores to be "extracted" - leaving behind the stone
    #  - includes/od-leaf_overhaul.yml      # overhaul leaf drops (apples, cocoa beans, leaves, sticks & a very small chance of golden apple)
    #  - includes/od-playerdeath_zombie.yml  # players drop zombies on death
    #  - includes/od-undead_chaos.yml        # the undead shall rise again! Includes players dropping zombies/skeletons
    #  - includes/od-random_examples.yml    # For crazy testing only :) Read through examples before activating.
     
    ## Other users overhauls
    #  - includes/overhaul-catballs.yml    # great example/playable config from Catballs (disable "ob" configs before using this one, otherwise you might have too many drops)
    #  - includes/overhaul-zarius.yml      # Zar's messy config (I run this with no other includes, at the moment)
     
    ## Add your files here (alternatively just add your custom drops to the bottom of this file)
    #  - my_custom_file1.yml
     
     
    aliases:
    ##########
    # add custom YAML aliases here (advanced customisation) - see the wiki for more information
     
    defaults:
    ##########
    # add default values for the config below, "include-files" have their own "defaults" sections
     
     
    otherdrops:
        
    GLASS:
        - 
    dropGLASS
     
        CLOCK
    :
        - 
    actionRIGHT_CLICK
          tool
    clock~Main Menu  # optionally you can include a lorename like so
          
    command"/Menu"

    and here is the included one i made for Clock
    PHP:
    defaults:
        
    biomesALL
        worlds
    ALL
     
    otherdrops
    :
            
    CLOCK:
                - 
    actionRIGHT_CLICK
                  tool
    clock~DayChanger  # optionally you can include a lorename like so
                  
    command"/menu"
            
    WATCH:
                - 
    actionRIGHT_CLICK
                  tool
    clock~DayChanger  # optionally you can include a lorename like so
                  
    command"/menu"

    Neither Clock on the main or in the included work =\

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  4. Offline

    Zarius

    tommygoesha - I can see you've changed it from ANY: to "CLOCK:" or "WATCH:". It wont work that way as it needs to specify the thing being rightclicked "on" rather than the item itself (the item is specified with the "tool" line).

    So it needs to be as per my original example, eg:

    PHP:
      ANY:
      - 
    actionrightclick
        tool
    diamondsword
        command
    "/mcmmo stats"
     
      
    actionrightclick
        tool
    clock~DayChanger  # optionally you can include a lorename like so
        
    command"/time day"

    I do plan on making that way of writing the config work though, eventually (not a high priority).
     
  5. Offline

    ab9876

    Alright. How many little events with right clicking on blocks do you want?
     
  6. Offline

    tommygoesha

    Alright so i did exactly that and even changing it to just
    PHP:
      ANY:
      - 
    actionrightclick
        tool
    diamondsword
        command
    "/mcmmo stats"
    PHP:
        ANY:
            - 
    actionRIGHT_CLICK
             tool
    WATCH
             command
    "/mcmmo stats"
    and

    PHP:
    otherdrops:
        
    ANY:
            - 
    actionRIGHT_CLICK
             tool
    WATCH
             command
    "/mcmmo stats"
    and nothing works =\
     
  7. Offline

    ChrisX930

    how can I get the Item that I've created with the Plugin (for example tool: clock~DayChanger
     
  8. Offline

    Zarius

    tommygoesha
    Sorry, yeah should be watch, not clock. Are you sure the /mcmmo stats command works by itself? I thought the command should be /mcstats?


    ChrisX930
    You can type "/odd watch~DayChanger" or alternatively configure some creature or block to drop the item at some point.

    Also, using just "DayChanger" you could probably also take the watch and rename at an anvil. To stop players doing this you could use a color code in the displayname - eg. watch~&6DayChanger (that way players can't rename at the anvil as it cannot add color codes).
     
  9. Offline

    ChrisX930



    "/odd watch~DayChanger" will disable OtherDrops ('cause of "odd"- = otherdrops disable)
    /od watch-DayChanger won't work.

    I've added
    ANY:
    - action: RIGHT_CLICK
    tool: watch~DayChanger
    command: "/i"

    to the "otherdrops-drops"-File.
    The Anvil-Thing wouldn't work, too.
     
  10. Offline

    Zarius

    If /odd is disabling OtherDrops you are using the old (release) version. Please try with the latest beta version (2.8b.534).
     
  11. Offline

    tommygoesha

    well i was never using the stats, im using /menu
    from the chestcommands plugin, but i also tried warps and /broker buy (with a gold block)
    none of em worked =\.. the ones that came with the plugin work though
     
  12. Offline

    ab9876

    keep forgetting to post this lol. I am in the final stage of testing

    The damn config keeps reverting every time I restart. Somebody please help me -_- I forget how to make the config stay. Here is the generating config.yml part of the plugin:
    Code:
        File file = new File(getDataFolder() + File.separator + "config.yml");
     
     
        @Override
        public void onEnable() {
            ConfigLogger.enabled(true);
            if (!file.exists()) {
                this.getLogger().info("Generating the config.yml...");
                this.getConfig().addDefault("CMD1" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM1ID" + ".ID", 406);
                this.getConfig().addDefault("CMD2" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM2ID" + ".ID", 406);
                this.getConfig().addDefault("CMD3" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM3ID" + ".ID", 406);
                this.getConfig().addDefault("CMD4" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM4ID" + ".ID", 406);
                this.getConfig().addDefault("CMD5" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM5ID" + ".ID", 406);
                this.getConfig().addDefault("CMD6" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM6ID" + ".ID", 406);
                this.getConfig().addDefault("CMD7" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM7ID" + ".ID", 406);
                this.getConfig().addDefault("CMD8" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM8ID" + ".ID", 406);
                this.getConfig().addDefault("CMD9" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM9ID" + ".ID", 406);
                this.getConfig().addDefault("CMD10" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM10ID" + ".ID", 406);
                this.getConfig().addDefault("CMD11" + ".cmd", "mcmmo");
                this.getConfig().addDefault("ITEM11ID" + ".ID", 406);
                this.getConfig().options().copyDefaults(true);
                this.saveConfig();
            }
           
            pm = getServer().getPluginManager();
            pm.registerEvents(playerListener, this);
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
       
        @Override
        public void onDisable()
        {
        ConfigLogger.enabled(false);   
            saveConfig();
        }
    and here is a little snipped of the reading part of the Listener:
    Code:
        public void onPlayerInteract(PlayerInteractEvent e){
            Player player = e.getPlayer();
            if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
                loadConfiguration();
                if(player.getItemInHand().getTypeId() == 0){
                    e.setCancelled(true);
                }
                else if(player.getItemInHand().getTypeId() == plugin.getConfig().getInt("ITEM1ID")){
                    player.performCommand(plugin.getConfig().getString("CMD1"));
    Probable error due to not checking

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  13. Offline

    tommygoesha

    erm?... make a new post this is something completely different.
     
  14. Offline

    ab9876

    I am trying to help you here. This is a custom plugin for your mcmmo commands.

    or honestly any command.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  15. Offline

    tommygoesha

    i had no idea you were even working on something?... ._. but alright
     
  16. Offline

    ab9876

    Isn't this what you wanted? A plugin that works where you can right click with a block, and it does a command.
     
  17. Offline

    tommygoesha

    yea but i was getting help with the otherdrops plugin >.< but yea sure if you can thatd be great.
     
  18. Offline

    ab9876

    Oh. Ok. I thought you said that didn't work.
     
  19. Offline

    tommygoesha

    yea right now its not working but supposedly it is but ya sure ill use your plugin
     
  20. Offline

    ab9876

    K. I just have a little bug where it automatically resets the config on every reload. I am checking it out though.

    I finally finished it :) Posting it now.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  21. Offline

    tommygoesha

    alright link me when you can :D
     
  22. Offline

    ab9876

    It's up, but verifying.
     

Share This Page