Chest Executer [Easy]

Discussion in 'Archived: Plugin Requests' started by eprocks6054, Jul 25, 2012.

  1. Offline

    eprocks6054

    Suggested name: ChestTrigger

    What I want: This plugin is basically like VariableTriggers but VariableTriggers doesn't have a chest trigger. I would like a plugin that executes a command on the opening of a chest. If this is too time consuming to make, if you could make me a custom one that just clears your inventory when you right-click on the chest to open it. I know this sounds pointless but I'm using it for a CTF server for chest classes and this will allow me to make it work. PS: The command will be executed by the player not the console.

    Ideas for commands: If custom it won't need commands but if you do a regular executing command on click then maybe. (/ct new clearinventory). CT stands for Chest Trigger and clearinventory is the command.

    Ideas for permissions: Not needed if custom but here is a example. chesttrigger. access (Allow people to make triggers). I don't even have permissions because my server has no need for it right now due to the simplicity of my ctf plugin. So if you do add permissions, if you choose to do a non-custom then please make default op for making commands on chests and the public will be able to use it.

    When I'd like it by: As soon as possible please.
     
  2. Offline

    lol768

    I can look into this. I'll do the clear inv variant first, if that's ok.
     
  3. Offline

    eprocks6054

    Whatever allows me to force a player to execute /clearinventory by opening a chest is ok with me. I said it doesn't have to be custom lol. If anyone can do me a quick custom one it would be appreciated. ;)
     
  4. Offline

    lol768

    Very quick coding for running /clearinventory when you right click on a chest.
    http://www.filedropper.com/cc

    It's untested, so tell me if it works. I'll make it better tomorrow.
     
  5. Offline

    eprocks6054

    Testing it right now i'll tell you how it goes. :)
    Update: Added to my plugins folder and restarted but its not showing up with /plugins or in the console...Needs some work to find the problem. I hope it's not too much to ask.
     
  6. Offline

    hawkfalcon

  7. Offline

    LexLaiden

    Why make a plugin when you can alredy do this with VariableTriggers???

    Make your chest a click trigger with
    /vtclick CMD clearinventory
    or
    /vtclick CMDOP clearinventory
    in case the player doesn't have permission

    VariableTriggers lets you run any command you already have.
     
  8. Offline

    CoffeeOD

    Hi eprocks6054, I have send you pm about this, when time do read and reply if intrest.
     
  9. Offline

    lol768

    Oops, I'll take a look at what is happening. You could use variable triggers but I prefer to have simpler, more compact plugins to sort stuff like this out.

    Fixed the issue (tested it just now, my code isn't great at 11PM): http://www.filedropper.com/cc_1

    Source:
    PHP:
    package me.lol768.cc;
     
    import java.util.logging.Logger;
     
    import org.bukkit.Bukkit;
    import org.bukkit.Material;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class 
    main extends JavaPlugin implements Listener
    {
    Logger log;
        public 
    void onEnable()
        {
            
    log Bukkit.getLogger();
            
    log.info("Plugin starting up");
            
    getServer().getPluginManager().registerEvents(thisthis);
        }
       
        public 
    void onDisable()
        {
            
    log Bukkit.getLogger();
            
    log.info("Plugin shutting up");
        }
       
        @
    EventHandler
        
    public void chest(PlayerInteractEvent e)
        {
            if (
    e.getClickedBlock().getType() == Material.CHEST && e.getAction().equals(Action.RIGHT_CLICK_BLOCK))
            {
                
    e.getPlayer().performCommand("clearinventory");
            }
        }
    }
     
  10. Offline

    eprocks6054

    Ok, I tested it and got the same result. It's not even showing up in the plugins list oddly enough. I see you added clearinventory in this version and btw did you mean this plugin is shutting down. It say's this plugin is starting up and below it, it says this plugins is shutting up.
     
  11. Offline

    lol768

    Copy and pasting doesn't always work well, lol. I think its a Java issues (I'll try and compile it with an older jre).
     
  12. Offline

    eprocks6054

    Ok good luck ;)
     
  13. Offline

    lol768

Share This Page