Skip to content

Commit

Permalink
Now allowing eggs to be converted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenoyia committed May 7, 2017
1 parent eadda61 commit d08f630
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/xpgaming/xPPokeDex/Convert.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
if (optstorage.isPresent()) {
PlayerStorage storage = (PlayerStorage) optstorage.get();
NBTTagCompound nbt = storage.partyPokemon[slot - 1];
if(nbt == null || nbt.getBoolean(NbtKeys.IS_EGG)) {
if(nbt == null) {
src.sendMessage(Text.of("\u00A7f[\u00A7cPokeDex\u00A7f] \u00A7cThere's not a valid Pokemon in slot "+slot+"!"));
} else {
int isShiny = nbt.getInteger(NbtKeys.IS_SHINY);
if(isShiny == 1) {
src.sendMessage(Text.of("\u00A7f[\u00A7cPokeDex\u00A7f] \u00A7cThat Pokemon is already shiny!"));
} else {
nbt.setInteger(NbtKeys.IS_SHINY, 1);
src.sendMessage(Text.of("\u00A7f[\u00A7bPokeDex\u00A7f] \u00A7bSuccessfully converted that Pokemon to shiny!"));
if(nbt.getBoolean(NbtKeys.IS_EGG))
src.sendMessage(Text.of("\u00A7f[\u00A7bPokeDex\u00A7f] \u00A7bSuccessfully converted! It will hatch as a shiny!"));
else src.sendMessage(Text.of("\u00A7f[\u00A7bPokeDex\u00A7f] \u00A7bSuccessfully converted that Pokemon to a shiny!"));
if(itemInHand.isPresent()) {
int amount = itemInHand.get().getQuantity();
if(amount == 1) {
Expand Down

0 comments on commit d08f630

Please sign in to comment.