Skip to content

Commit

Permalink
v0.4 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenoyia committed May 8, 2017
1 parent 5e17815 commit 7b5459c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/xpgaming/xPPokeDex/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

import com.google.common.collect.Lists;
import com.google.common.reflect.TypeToken;
import com.google.inject.Inject;
import com.pixelmonmod.pixelmon.config.PixelmonItemsPokeballs;
import com.pixelmonmod.pixelmon.items.PixelmonItem;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.loader.ConfigurationLoader;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.DefaultConfig;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.manipulator.mutable.item.EnchantmentData;
import org.spongepowered.api.data.meta.ItemEnchantment;
Expand All @@ -30,10 +32,12 @@ public class Config {
public static Config getInstance() {
return instance;
}
@Inject
@DefaultConfig(sharedRoot = false) private File configDir;

private ConfigurationLoader<CommentedConfigurationNode> configLoader;
private CommentedConfigurationNode config;
private File configFile;
private File configFile = new File(this.configDir, "config.conf");

public ItemType Type(String item) {
ItemType i = Sponge.getGame().getRegistry().getType(ItemType.class,item).get();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/xpgaming/xPPokeDex/Convert.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
ItemStack theItem = itemInHand.get();
if(ItemStackComparators.ITEM_DATA.compare(theItem, Utils.getInstance().shinyToken()) == 0) {
holdingAShinyToken = true;
} else if(ItemStackComparators.ITEM_DATA.compare(theItem, Utils.getInstance().oldShinyToken()) == 0) {
holdingAShinyToken = true;
}
}
if(holdingAShinyToken) {
Expand All @@ -60,6 +62,7 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
player.setItemInHand(HandTypes.MAIN_HAND, null);
} else {
itemInHand.get().setQuantity(amount-1);
player.setItemInHand(HandTypes.MAIN_HAND, itemInHand.get());
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/xpgaming/xPPokeDex/Main.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.xpgaming.xPPokeDex;
import com.google.inject.Inject;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import ninja.leaping.configurate.loader.ConfigurationLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.args.GenericArguments;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.config.DefaultConfig;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener;
Expand All @@ -20,13 +22,16 @@
import org.spongepowered.api.service.economy.account.UniqueAccount;
import org.spongepowered.api.service.economy.transaction.ResultType;
import org.spongepowered.api.service.economy.transaction.TransactionResult;
import org.spongepowered.api.service.sql.SqlService;
import org.spongepowered.api.text.Text;

import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.Optional;

@Plugin(id = Main.id, name = Main.name, version = "0.3-fix", dependencies = {@Dependency(id = "pixelmon")})
@Plugin(id = Main.id, name = Main.name, version = "0.4", dependencies = {@Dependency(id = "pixelmon")})
public class Main {
private static Main instance = new Main();
public static Main getInstance() {
Expand Down Expand Up @@ -123,7 +128,7 @@ public void addMoney(Player p, int amount) {
@Listener
public void onGameInitialization(GameInitializationEvent event) {
Config.getInstance().setup(configFile, configLoader);
log.info("Loaded v0.3-fix!");
log.info("Loaded v0.4!");
Sponge.getCommandManager().register(this, pokedex, "pokedex", "pd", "dex");
Sponge.getCommandManager().register(this, pokedexAdmin, "pokedexadmin", "pda", "dexadmin");
Sponge.getServiceManager().provide(EconomyService.class);
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/xpgaming/xPPokeDex/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@ public ItemStack shinyToken() {
.quantity(1)
.build();
token.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "Shiny Token"));
List<Text> lore = Lists.newArrayList(Text.of(TextColors.YELLOW, "Use /pd convert <slot> to\ntransform your selected\nPokemon into a shiny!\n", TextColors.GOLD, "||Shiny Token||"));
List<Text> lore = Lists.newArrayList(Text.of(TextColors.YELLOW, "Use /pd convert <slot> to redeem!"));
token.offer(Keys.ITEM_LORE, lore);
return token;
}

public ItemStack oldShinyToken() {
ItemStack token = ItemStack.builder()
.itemType(ItemTypes.PAPER)
.quantity(1)
.build();
token.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "Shiny Token"));
List<Text> lore = Lists.newArrayList(Text.of(TextColors.YELLOW, "/pd convert <slot> to\ntransform your selected\nPokemon into a shiny!\n", TextColors.GOLD, "||Shiny Token||"));
token.offer(Keys.ITEM_LORE, lore);
return token;
}
Expand Down

0 comments on commit 7b5459c

Please sign in to comment.