char list delete ...
This commit is contained in:
parent
5843594ba3
commit
dd72e2d367
7 changed files with 93 additions and 44 deletions
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import game.collect.Lists;
|
||||
import game.collect.Maps;
|
||||
|
||||
import game.Game;
|
||||
|
@ -27,6 +28,7 @@ import game.entity.types.EntityLiving;
|
|||
import game.gui.Gui;
|
||||
import game.gui.GuiConsole;
|
||||
import game.gui.GuiChar;
|
||||
import game.gui.GuiCharacters;
|
||||
import game.gui.container.GuiMachine;
|
||||
import game.gui.container.GuiMerchant;
|
||||
import game.init.EntityRegistry;
|
||||
|
@ -141,7 +143,7 @@ public class ClientPlayer extends NetHandler
|
|||
private boolean doneLoadingTerrain;
|
||||
// private boolean travelSound;
|
||||
private final Map<String, Integer> playerList = Maps.<String, Integer>newTreeMap();
|
||||
private final Map<Integer, PlayerCharacter> characterList = Maps.<Integer, PlayerCharacter>newHashMap();
|
||||
private final List<PlayerCharacter> characterList = Lists.<PlayerCharacter>newArrayList();
|
||||
// private final List<Entry<String, Integer>> players = Lists.newArrayList();
|
||||
private int selectedCharacter = -1;
|
||||
|
||||
|
@ -1525,15 +1527,20 @@ public class ClientPlayer extends NetHandler
|
|||
|
||||
for(Entry<Integer, PlayerCharacter> data : packet.getEntries()) {
|
||||
if(data.getValue() == null)
|
||||
this.characterList.remove(data.getKey());
|
||||
this.characterList.remove(data.getKey().intValue());
|
||||
else if(data.getKey() < this.characterList.size())
|
||||
this.characterList.set(data.getKey(), data.getValue());
|
||||
else
|
||||
this.characterList.put(data.getKey(), data.getValue());
|
||||
this.characterList.add(data.getKey(), data.getValue());
|
||||
}
|
||||
this.selectedCharacter = packet.getSelected();
|
||||
if(this.gameController.charEditor && this.selectedCharacter >= 0) {
|
||||
this.gameController.charEditor = false;
|
||||
this.gameController.displayGuiScreen(null);
|
||||
}
|
||||
else if(this.gameController.open instanceof GuiCharacters) {
|
||||
this.gameController.displayGuiScreen(this.gameController.open);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleKeepAlive(SPacketKeepAlive packetIn)
|
||||
|
@ -1890,7 +1897,7 @@ public class ClientPlayer extends NetHandler
|
|||
|
||||
public Collection<PlayerCharacter> getCharacterList()
|
||||
{
|
||||
return this.characterList.values();
|
||||
return this.characterList;
|
||||
}
|
||||
|
||||
public int getSelectedCharacter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue