[REQUEST] Promote player on button press

Discussion in 'Archived: Plugin Requests' started by ibab, Mar 22, 2012.

  1. Offline

    ibab

    Plugin category: Admin Tools

    Suggested name: ButtonPromote

    A bit about me: I'm currently hosting a server called Nextgen Minecraft and my staff is currently working on a self quizing system for the players, where they answer to rules related questions with buttons and get forward to new questions.

    What I want: I'm looking for a plugin that allows promoting players to certain group with a press of a button. I have seen some plugins that allow you to place a button and a sign on top of it defining what it does, but I'm looking for something that doesn't need that sign and is able to promote the player to the specific group only by them pressing the button.

    Additionally support for ButtonWarp would be useful with this plugin. (Promote and then warp to specific place)

    Ideas for commands:
    /bp set <group to promote> - After typing this, right clicking the button would add this promotion to the button.
    /bp remove - Would remove the promotion from the button after right clicking it.

    Ideas for permissions: Basic permissions like buttonpromote.create, buttonpromote.remove and buttonpromote.use

    When I'd like it by: Anytime, doesn't really matter. Soonest the better.

    Similar plugin requests: None.

    Devs who might be interested in this: @Codisimus
     
  2. Offline

    ftbastler

    Couldn't you just do that with a command?
     
  3. Offline

    LinkterSHD

    Not to be mean or anything but why don't you just use commands to rank players up. People could just then tell people to hit that button and they will be ranked up without out u realising. Use autoranks if you want to rank people up without editing groups.YML, autoranks will change ranks in game
     
  4. Offline

    ibab

    I have been hosting the server for a bit over than 1 year now. I have PEX and it has its own command (/pex promote) to promote the players to the next ladder. The issue is that we have had to basically quiz people manually by asking them 1-4 questions and as if they passed, they'd be promoted. Now we wanted to make it easier for us and stop having to quiz players, so we created a quizing room out of redstone and pistons. All we are missing from it is a button that would promote them when they have gone through the quiz.

    And no, this wouldn't be promoted without them realizing, because we'd have a sign near it saying that punching this will promote you. Basically the reason why I want a plugin that would not require a sign to specify what it does would be to make it look more clear.
     
  5. Offline

    Aldimensch

    I try do it for you... You have a nice Server and a good Reason!
     
  6. Offline

    NinjaWAffles

    I could make you a plugin, but it would be a quiz through commands, and not buttons.
     
  7. Offline

    iMint

    I can do this in 20 minutes. :)
     
  8. Offline

    Aldimensch

    iMint You dont need start to work I need only more Infos about Metadata. And I have to create a Array then its Ready for Realease.
     
  9. Offline

    iMint

    Oh i'm already done :O

    Edit:
    1. Why do you need Metadata?
    2. Why do you need Arrays?
    3. Release* just so you know :) Common mistake.
     
  10. Offline

    Aldimensch

    iMint my not completet solution.

    Code:
    onPlayerInteract:
     
    if(event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK){
                if(player.hasPermission(plugin.getConfig().getString("ButtonPromote.DefaultPlayer")))
                if(block.getTypeId() == 63 || block.getTypeId() == 68){
                    if(block.hasMetadata("ButtonPromote")){ //hasMetadata has been change in getMetadata
                     
                        player.sendMessage("isCoorect");
                        PromoteHim.isCorrect(player);
                        event.setCancelled(true);
                    }else{
                        PromoteHim.isIncorrect(player);
                    }                     
                
    Every Answer-Sign get a different Metadata. So he can quick change the Ask and Answer.

    Code:
    Class PromoteHim:
     
     
              public static void isCorrect(Player player) {
            int cAnswer = 0;
         
            for (int x = 1; x <= rounds; x++){ //rounds is an Int who is in the config.yml
                if(playerCheck.contains(player+""+rounds)){
                    promote();
                    return;
                }else{
                    if(playerCheck.contains(player+""+x)){
                        playerCheck.add(player+""+(x+1));
                    }
    }

    I dont know what you have done. But I think my solution is more Dynamic.
     
  11. Offline

    iMint

    Here you go.
    http://dl.dropbox.com/u/60598823/ButtonPromote.jar

    Permissions are the same as what you said above
    buttonpromote.create for /set and /setwarp
    buttonpromote.remove for /remove
    buttonpromote.use to use the buttons.

    Commands:
    /bp set <group name>
    /bp remove
    /bp setwarp (type this command at the location you want, then click the button. this will add a warp to the button)
    /bp cancel (cancels any selections)

    You can use this instead of ButtonWarp, just use /bp setwarp!

    Requires PermissionsEx.

    -----
    Aldimensch
    Why would you use metadata? That's less efficient.
    I simply used a HashMap<Block, String> to map the buttons to their respective groups.

    Also, i dont think you quite understood what he wants. He already made the quiz, all he wants is the buttons to promote/warp the player. :p
     
  12. Offline

    ibab

    iMint thank you a lot for creating this plugin, but there appears to be some problem when hitting the button.
    Code:
    2012-03-23 16:04:17 [SEVERE] Could not pass event PlayerInteractEvent to ButtonPromote
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:441)
    at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:168)
    at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:285)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:722)
    at net.minecraft.server.Packet15Place.handle(SourceFile:39)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:116)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.NullPointerException
    at me.iMint.ButtonPromote.bListener.onButtonPress(bListener.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
    ... 12 more
    Creating the button gives no errors at all, I get the message that button will promote to the group.

    I tried updating both, PEX and CraftBukkit.

    Also iMint is correct, I think Aldimensch did not completely understand what I am looking for. I don't want quizing plugin, I want a plugin that makes a button to promote the player who hits it.
     
  13. Offline

    iMint

    Okay I fixed the problem, it was a simple mistake.

    Before i compile it though, do you mind if I just use the config.yml to save buttons? Its a lot simpler than using a whole FileWriter method. This plugin doesnt use a config anyway so you don't care right? :)
     
  14. Offline

    ibab

    iMint I don't mind if you use config.yml, as long as the plugin still works. =)
     
  15. Offline

    iMint

    ibab likes this.
  16. Offline

    raully7

    Hello can you please make this compatible with Group Manager and also can you add that if the press the button they are quized with a question and they have 4 choice to choose from and they type [A] [C] [D] etc.
     

Share This Page