char list delete ...
This commit is contained in:
parent
5843594ba3
commit
dd72e2d367
7 changed files with 93 additions and 44 deletions
|
@ -2508,16 +2508,18 @@ public class Player extends NetHandler implements ICrafting, Executor
|
|||
|
||||
switch (action)
|
||||
{
|
||||
case OPEN_EDITOR:
|
||||
case OPEN_EDITOR: {
|
||||
this.charEditor = true;
|
||||
// if(this.local)
|
||||
// this.server.resetProgress();
|
||||
NBTTagCompound tag = this.server.swapPlayer(this, null, EntityHuman.class);
|
||||
if(!this.characters.isEmpty() && this.selected >= 0)
|
||||
this.characters.set(this.selected, tag);
|
||||
int last = this.selected;
|
||||
this.selected = -1;
|
||||
this.sendPacket(new SPacketCharacterList(this.selected));
|
||||
this.sendPacket(!this.characters.isEmpty() && last >= 0 ? new SPacketCharacterList(this.selected, last, this.getCharacterInfo(tag)) : new SPacketCharacterList(this.selected));
|
||||
break;
|
||||
}
|
||||
|
||||
case CLOSE_EDITOR: {
|
||||
this.charEditor = false;
|
||||
|
@ -2538,16 +2540,29 @@ public class Player extends NetHandler implements ICrafting, Executor
|
|||
break;
|
||||
}
|
||||
|
||||
case SELECT_CHARACTER:
|
||||
case SELECT_CHARACTER: {
|
||||
int index = packetIn.getAuxData();
|
||||
if(index == this.selected || index >= this.characters.size() || index < 0)
|
||||
return;
|
||||
NBTTagCompound etag = this.server.swapPlayer(this, this.characters.get(index), null);
|
||||
if(!this.characters.isEmpty() && this.selected >= 0)
|
||||
this.characters.set(this.selected, etag);
|
||||
int last = this.selected;
|
||||
this.selected = index;
|
||||
this.sendPacket(new SPacketCharacterList(this.selected));
|
||||
this.sendPacket(!this.characters.isEmpty() && last >= 0 ? new SPacketCharacterList(this.selected, last, this.getCharacterInfo(etag)) : new SPacketCharacterList(this.selected));
|
||||
break;
|
||||
}
|
||||
|
||||
case DELETE_CHARACTER: {
|
||||
int index = packetIn.getAuxData();
|
||||
if(index == this.selected || index >= this.characters.size() || index < 0)
|
||||
return;
|
||||
if(this.selected > index)
|
||||
this.selected -= 1;
|
||||
this.characters.remove(index);
|
||||
this.sendPacket(new SPacketCharacterList(this.selected, index, null));
|
||||
break;
|
||||
}
|
||||
|
||||
case START_SNEAKING:
|
||||
this.entity.setSneaking(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue