Thread: What's this code doing?

Results 1 to 4 of 4
  1. #1 What's this code doing? 
    Registered Member
    Join Date
    May 2015
    Posts
    158
    Thanks given
    52
    Thanks received
    5
    Rep Power
    11
    Hi,

    I'm trying to somewhat debug some code this server has, so I can improve it on my own server.

    This piece of code is being used for presets, but I can't figure out what exactly it's doing?

    Code:
    for (String keys : player.getSavingAttributes().keySet()) {
        if (keys.contains("loadoutinv")) {
          }
    }
    Reply With Quote  
     

  2. #2  
    Success is the worst teacher

    Santa Hat's Avatar
    Join Date
    Oct 2012
    Age
    27
    Posts
    3,334
    Thanks given
    807
    Thanks received
    1,185
    Rep Power
    190
    It's looping through a map for the key "loadoutinv", the map is stored in the player class and is called through the getSavingAttributes(), I'd imagine somewhere in your source will have something else that adds data to that map in order to use.

    Essentially it's looping until it finds what it needs, in this case "loadoutinv"


    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    May 2015
    Posts
    158
    Thanks given
    52
    Thanks received
    5
    Rep Power
    11
    Quote Originally Posted by Santa Hat View Post
    It's looping through a map for the key "loadoutinv", the map is stored in the player class and is called through the getSavingAttributes(), I'd imagine somewhere in your source will have something else that adds data to that map in order to use.

    Essentially it's looping until it finds what it needs, in this case "loadoutinv"
    Appreciate it, thanks.
    Reply With Quote  
     

  5. #4  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,788
    Thanks given
    706
    Thanks received
    702
    Rep Power
    570
    Quote Originally Posted by Focused View Post
    Hi,

    I'm trying to somewhat debug some code this server has, so I can improve it on my own server.

    This piece of code is being used for presets, but I can't figure out what exactly it's doing?

    Code:
    for (String keys : player.getSavingAttributes().keySet()) {
        if (keys.contains("loadoutinv")) {
          }
    }
    It looks like a really unoptimised way of doing:

    Code:
    if (player.getSavingAttributes().contains("loadoutinv")) {
    
    }
    Project thread
    Reply With Quote  
     

  6. Thankful users:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. PI what does this code do?
    By Syndicate in forum Help
    Replies: 9
    Last Post: 05-07-2011, 10:59 PM
  2. What is this code and error
    By karbon v2 in forum Help
    Replies: 6
    Last Post: 01-18-2010, 05:22 AM
  3. My own bytecode language, what does this script do?
    By peterbjornx in forum Application Development
    Replies: 7
    Last Post: 01-13-2010, 11:32 PM
  4. What does this code mean?
    By munch in forum Help
    Replies: 5
    Last Post: 10-05-2009, 06:30 PM
  5. what is this code?
    By Musicmad in forum Help
    Replies: 1
    Last Post: 02-14-2009, 11:13 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •