BroShare - Indev - Get Your Own Twin.[1317]

Discussion in 'WIP and Development Status' started by TopGear93, Oct 17, 2011.

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

    TopGear93

    This is Temporary till i get home. Currently at school and thought of this. needed area to save this info and my thoughts. Have any other ideas? post them! i plan on making & completing this plugin. i may need a team!

    BroShare
    Indev

    BroShare will bring twins into minecraft. Share items / homes / chests / and feel each others pain!

    Features:
    • Lockette - LWC compatiblity for chest sharing.
    • Share items ONLY between each other.
    • Finding ores will share 50-50.
    • Feel each others pain!
    • Twins will have same skin.
    Download:
    None yet.

    Todo:
    • Share Pain
    • Share Chests
    • Share Items
    • Same Skins
    • Config
    • Spout Compatibilities?
    • Split major ores 50-50 on a random time setup
    Changelog:
    v1.0 - being designed / thought of.
     
  2. Offline

    Kohle

    Sounds fun :)
     
    TopGear93 likes this.
  3. Offline

    TopGear93

    but once again im stuck with where to begin with coding. lol, i come up with interesting ideas but dont know what to code.
     
    Kohle likes this.
  4. Offline

    zwarmapapa

    You have to start with a command that binds 2 players together
    Then maybe a maximum distance between the 2 players, outside that distance they won't share anything

    And then I would start with sharing pain :p
     
  5. Offline

    TopGear93

    lol this is all greek to me. so i would need to use a flatfile or yml that would hold the twins. but see the major issue is how do i make multiple groups of twins?

    examples:
    earl
    gump
    -
    will
    dave
    -
    stephano
    strelok.
     
  6. Offline

    zwarmapapa

    I would put a twin pair per row, and use a delimiter like a space between them, then you'll get something like this

    earl gump
    will dave
    stephano strelok

    Then you have to load the textfile, split it into an array with /n as delimiter, then you'll get the couples
    Then filter out the empty rows, and split the rest with space as delimiter, then you'll get the players in the twin couples

    :p


    Edit: also str_replace all "/r" to "", because some people might edit it with notepad, and it uses "/r/n" as a newline
     
    TopGear93 likes this.
  7. Offline

    TopGear93

    AUGH MY BRAIN IT BURNS! what who said that.... this is an interesting idea but i have no clue how to do this hahaha.

    so wait i would do this?

    /twins dave earl

    so you would have to get the players into a string

    " player.toString(""); "????

    hmm ill have to give it a try. when i get home tonight. after some thinking it doesnt sound THAT bad. but eh i dont have the determination lol....
     
  8. Offline

    zwarmapapa

    Hmmmm how to explain this, I know java, but not the bucket api, so I'll explain that in psuedocode
    I'll explain it in parts :p

    // add twin
    Player typs /twin player1 player2
    Create textfile to save, if it doesn't exist yet
    Check if player1 and player2 are online
    Check if player1 and player2 aren't paired yet:
    Code:
    boolean playerAlreadyTwinned = false;
    
    String playerName = get the players name;
    String[] lines = get textfile's data;
    
    for( String line : lines )
    {
        if( playerAlreadyTwinned )
        {
            break;
        }
    
        if( !line.equalsIgnoreCase("") ) // line isn't empty
        {
            String players[] = line.split(" "); // uses space as a delimiter
            {
                for( String player : players )
                {
                    if( player.equalsIgnoreCase(playerName) )
                    {
                        playerAlreadyTwinned = true;
                        break;
                    }
                }
            }
        }
    }
    If they aren't paired yet (if playerAlreadyTwinned == false ), write this row in the textfile: player1+" "+player2

    That's the code to pair players together

    Now, on every damage the player gets, you must check if the player is paired, and if that player is online too.
    Then you have to check if he's between 50 meter of that player.
    And if so, the player should get only half the damage, and the other player should get half the damage too.

    // share damage
    Code to do everytime a player gets damage:
    Code:
    String myTwin = "";
    
    String playerName = get the players name;
    String[] lines = get textfile's data;
    
    for( String line : lines )
    {
         if( !myTwin.equalsIgnoreCase("") ) // he found his twin
         {
              break;
         }
    
         if( !line.equalsIgnoreCase("") ) // line isn't empty
         {
              String players[] = line.split(" "); // uses space as a delimiter
              for( int i=0; i<players.length; i++ )
              {
                   for( int j=0; j<2; j++ )
                   {
                        if( players[j].equalsIgnoreCase(playerName) )
                        {
                             myTwin = players[1-j]; // 1-j  turns 1 into 0, and 0 into 1
                             break;
                        }
                   }
              }
         }
    }
    Check if myTwin is online, and if so, check if he's between the 50 meters from the player
    Then share your damage with him

    The best is to save a twin's name into java, so it won't have to 'search' his twin every time
    That will reduce the lag allot

    That's the code to share pain

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
Thread Status:
Not open for further replies.

Share This Page