Simple plugin needed. PAID $10

Discussion in 'Archived: Plugin Requests' started by Brant Wladichuk, Nov 24, 2011.

  1. Offline

    Brant Wladichuk

    Hey everyone.

    I've got a seemingly simple plugin that shouldn't take more then an hour to make.

    All I need it to do is:

    An OP places a sign. On the sign the OP defines a Sign ID (int, second line) and title (string, third line). Like so:

    Code:
    ------------
        ID:1 (or 2, 3, 4 etc etc)
     sign title (this does nothing functional.)
    ------------
           |
           |
    
    When a player clicks the sign the server whispers a code to them

    The code is generated by taking 3 varibles and wrapping them in an MD5 hash, then displaying just the first 8 characters.

    Varible 1 = players username
    Varible 2 = Secret word (defined by admin in plugin config)
    Varible 3 = Sign ID

    in PHP terms: (I have no idea what the java syntax is for anything. So ill make functions pretty literal.)
    Code:
    $user = Get Player Username
    $id = Get sign id
    $word = Get word from config
    
    $hash = md5($user . "" .  $word  . "" .  $id);
    $code = substr($hash, 0, 8);
    
    WHISPER TO PLAYER ON CLICK $code;
    
    
    Result from that will look something like: d7he84jr

    The rest is then handled by my PHP script.

    Thanks! PM me if your interested.
     
  2. As you say yourself... This is easy :)

    If you can wait till the weekend I can help!
     
  3. Offline

    tee jay

    An example of MD5 in Java: http://www.asjava.com/core-java/java-md5-example/
    And with that, you would simply register a player interact event and pass in a player listener. In the player listener you might have something like this:
    Code:
        @Override
        public void onPlayerInteract(PlayerInteractEvent event)
        {
            Player p = event.getPlayer();
            Material m = event.getClickedBlock().getType();
            // if we clicked a sign
            if (m == Material.SIGN_POST || m == Material.WALL_SIGN)
            {
                Sign sign = (Sign) event.getClickedBlock().getState();
                String md5 = SomeClass.getMD5(p.getName() + // player name
                        sign.getLine(0) + // "ID" written on first line of sign
                        plugin.getConfig().getString("sign.secretword")); // read secret word from config file at path sign.secretword
                p.sendMessage("Your code: " + md5.substring(0, 8));
            }
        }
    You could probably also use a block listener and listen to block damage if you wanted left click.


    Also, I suppose to know what signs were placed for this you would have to record onBlockPlace if sign was placed by an OP and it follows that format, and add it to a collection of sorts.
     

Share This Page