Okay, so I have this in my Test class
public Test(Player p, int locX){
this.p = p;
this.locX = locX;
}
(and then I have the getters/setters in also)
And in my main class when someone types the command /test this is what happens:
Player player = (Player) sender;
int locX = 0;
Test t = new Test(player, locX);
t.setLocX(player.getLocation().getBlockX();
t.setP(player);
olist.put(player.getName(), t);
So this is just a test project I'm using to get a better understanding on how to get two values (that are different) from an object. So I want to make it so when a player types /check the player name (stored inside the object) and the location that is in the object are displayed to the player. So far I only have this
for(String s : olist.keySet()){
if(s == player.getName()){
//Here I would like to display the 2 values to the player, but not
//sure how I would separate the two values :\
}
}
Even though it doesn't make sense that I'm storing the player name inside the object when I have it inside the hashmap, I'm using this test project trying to learn how to get two different values from 1 object (in an actual project I would need to get an location and an int, but I'm starting off simple ;P). (Also this is using the Bukkit API but that shouldn't really effect anything...)