Make NPCBase.java compliant with updated NPC.java
Makes NPCBase compliant with net.jitse.npclib.api.NPC. Implements NPC#getText() to return List<String> and NPC#getSlot(NPCSlot slot) to return ItemStack.
This commit is contained in:
@@ -263,6 +263,29 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItem(NPCSlot slot) {
|
||||||
|
if (slot == null) {
|
||||||
|
throw new NullPointerException("Slot cannot be null");
|
||||||
|
}
|
||||||
|
switch (slot) {
|
||||||
|
case HELMET:
|
||||||
|
return this.helmet;
|
||||||
|
case CHESTPLATE:
|
||||||
|
return this.chestplate;
|
||||||
|
case LEGGINGS:
|
||||||
|
return this.leggings;
|
||||||
|
case BOOTS:
|
||||||
|
return this.boots;
|
||||||
|
case MAINHAND:
|
||||||
|
return this.inHand;
|
||||||
|
case OFFHAND:
|
||||||
|
return this.offHand;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Entered an invalid inventory slot");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC setItem(NPCSlot slot, ItemStack item) {
|
public NPC setItem(NPCSlot slot, ItemStack item) {
|
||||||
if (slot == null) {
|
if (slot == null) {
|
||||||
@@ -315,4 +338,9 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
|
|||||||
this.text = text;
|
this.text = text;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user