Skip to content

Commit

Permalink
Merge pull request #15 from BrendonCurmi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
BrendonCurmi authored May 7, 2020
2 parents b7ec1c2 + 56e71de commit c3e171f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@

@NonnullByDefault
public class ArcPlatesCmd implements CommandExecutor {

@Override
public CommandResult execute(CommandSource src, CommandContext args) {
if (src instanceof Player) {
Player player = (Player) src;
new PokeSelectorUI(player, "Arceus Selector", "arceusselector", pokemon -> {
if (pokemon.getSpecies() == EnumSpecies.Arceus) new ArcPlates().launch(player, pokemon);
else player.sendMessage(Text.of(TextColors.RED, "Please only select an Arceus!"));
});
if (!(src instanceof Player)) {
src.sendMessage(Text.of(TextColors.RED, "This command can only be executed by a player"));
return CommandResult.empty();
}
Player player = (Player) src;
new PokeSelectorUI(player, "Arceus Selector", "arceusselector", pokemon -> {
if (pokemon.getSpecies() == EnumSpecies.Arceus) new ArcPlates().launch(player, pokemon);
else player.sendMessage(Text.of(TextColors.RED, "Please only select an Arceus!"));
});
return CommandResult.success();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.FusionDev.FusionPixelmon.commands;

import me.FusionDev.FusionPixelmon.FusionPixelmon;
import me.FusionDev.FusionPixelmon.config.configs.PokeDesignerConfig;
import me.FusionDev.FusionPixelmon.guis.PokeSelectorUI;
import me.FusionDev.FusionPixelmon.guis.shops.Shops;
import org.spongepowered.api.command.CommandResult;
Expand All @@ -14,18 +15,20 @@

@NonnullByDefault
public class PokeDesignerCmd implements CommandExecutor {

@Override
public CommandResult execute(CommandSource src, CommandContext args) {
if (src instanceof Player) {
Player player = (Player) src;
Shops shops = new Shops(player);
new PokeSelectorUI(player, "Pokemon Selector", "pokeselector", pokemon -> {
if (!FusionPixelmon.getInstance().getConfig().getPokeDesignerConfig().containsBlackListedPokemon(pokemon.getSpecies())) {
shops.launch(pokemon);
} else player.sendMessage(Text.of(TextColors.RED, "That Pokemon cant use the PokeDesigner!"));
});
if (!(src instanceof Player)) {
src.sendMessage(Text.of(TextColors.RED, "This command can only be executed by a player"));
return CommandResult.empty();
}
Player player = (Player) src;
Shops shops = new Shops(player);
PokeDesignerConfig config = FusionPixelmon.getInstance().getConfig().getPokeDesignerConfig();
new PokeSelectorUI(player, config.getPokeSelectorGuiTitle(), "pokeselector", pokemon -> {
if (!config.containsBlackListedPokemon(pokemon.getSpecies())) {
shops.launch(pokemon, config.getGuiTitle());
} else player.sendMessage(Text.of(TextColors.RED, "That Pokemon cant use the PokeDesigner!"));
});
return CommandResult.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public class PokeDesignerConfig {
@Inject
@Setting("blacklisted-pokemon")
public List<EnumSpecies> blacklistedPokemon = ImmutableList.of();
@Inject
@Setting("poke-selector-gui-title")
private String pokeSelectorGuiTitle;
@Inject
@Setting("gui-title")
private String guiTitle;

/**
* Checks if the specified species is blacklisted from the PokeDesigner.
Expand All @@ -30,6 +36,14 @@ public boolean containsBlackListedPokemon(EnumSpecies species) {
return blacklistedPokemon.contains(species);
}

public String getPokeSelectorGuiTitle() {
return pokeSelectorGuiTitle;
}

public String getGuiTitle() {
return guiTitle;
}

@ConfigSerializable
public static class ShopConfig {
@SuppressWarnings("UnstableApiUsage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ public int calculateCost() {
*
* @param pokemon the selected pokemon.
*/
public void launch(Pokemon pokemon) {
public void launch(Pokemon pokemon, String guiTitle) {
this.inv = new InvInventory();
this.pages = new ArrayList<>();
this.pokemon = pokemon;

bank = new BankAPI(player);

pagePokeEditor = new InvPage(8Pokemon Editor", SHOP_ID, 6);
pagePokeEditor = new InvPage(8" + guiTitle, SHOP_ID, 6);
pagePokeEditor.setInteractInventoryEventListener(event -> {
if (event instanceof InteractInventoryEvent.Close) {
resetSelectedOptions(false);
Expand Down
8 changes: 6 additions & 2 deletions src/main/resources/assets/fusionpixelmon/default.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Used for updating this file. Dont touch this.
version=6
version=7
# Block the player from taking fall damage after winning a battle against a pokemon.
anti-fall-damage=true
# Pixelmon blocks that the player is able click on to collect.
Expand All @@ -19,7 +19,11 @@ arcplate=true
pokedesigner {
# Pokemon that are blacklisted from the PokeDesigner.
# Example: blacklisted-pokemon=["Ditto", "Pikachu"]
blacklisted-pokemon = []
blacklisted-pokemon=[]
# The title of the Pokemon Selector GUI.
poke-selector-gui-title="Pokemon Selector"
# Title of the Shop GUI.
gui-title="Pokemon Editor"
# Settings for the different shops. To disable a specific shop, set 'enabled=false' to that shop.
shops {
level {
Expand Down

0 comments on commit c3e171f

Please sign in to comment.