Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Polymeta committed Apr 12, 2023
1 parent 0d2051f commit 985ccb4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Refer to the default messages to see what placeholders are allowed where.
- `cooldownFeedback` - message that gets sent when the player is on cooldown
- `pokemonNotAllowed` - message that gets sent when a player attempts to gift a forbidden Pokémon
- `successFeedback` - message that get sent on successful gift
- `receivedPokemonFeedback` - message sent to player who received the gift
- `errorCantGiftYourself` - error message that gets displayed when a player attempts to gift to themselves
- `errorCouldntTakePokemon` - generic error message indicating something went wrong whilst taking the Pokémon away from the gifter
- `errorCouldntGivePokemon` - generic error message indicating something went wrong whilst giving the Pokémon to the target player
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.cobblemon.mod.common.api.permission.CobblemonPermission;
import com.cobblemon.mod.common.api.permission.PermissionLevel;
import com.cobblemon.mod.common.api.pokemon.PokemonProperties;
import com.cobblemon.mod.common.api.pokemon.PokemonPropertyExtractor;
import com.cobblemon.mod.common.api.storage.party.PartyPosition;
import com.cobblemon.mod.common.command.argument.PartySlotArgumentType;
import com.cobblemon.mod.common.pokemon.Pokemon;
Expand All @@ -16,7 +15,6 @@
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument;
import net.minecraft.network.chat.Component;

import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
Expand Down Expand Up @@ -106,6 +104,7 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
Pokegift.scheduler.schedule(() -> {playersOnCooldown.remove(player.getUUID());}, Pokegift.config.cooldown, TimeUnit.MINUTES);
}
player.sendSystemMessage(Pokegift.config.messages.successFeedback());
targetPlayer.sendSystemMessage(Pokegift.config.messages.receivedPokemonFeedback(player, slot));
return Command.SINGLE_SUCCESS;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static class MessageConfig {
" <aqua>lvl <level> <pokemon></aqua> to <green><player></green>?<giftconfirm><yellow> Click here to confirm!</giftconfirm>";
public String cooldownFeedback = "<gray>[<white>Poke<red>gift<gray>] <red>You are on cooldown!";
public String pokemonNotAllowed = "<gray>[<white>Poke<red>gift<gray>] <red>You cannot gift this pokemon!";
public String receivedPokemonFeedback = "<gray>[<white>Poke<red>gift<gray>] <green><player> gifted you a <pokemon>!";
public String successFeedback = "<gray>[<white>Poke<red>gift<gray>] <green>Successfully gifted your pokemon!";
public String errorCantGiftYourself = "<gray>[<white>Poke<red>gift<gray>]<red> Can't gift yourself pokemon!";
public String errorCouldntTakePokemon = "<gray>[<white>Poke<red>gift<gray>]<red> Something went wrong taking the pokemon from you";
Expand Down Expand Up @@ -86,5 +87,14 @@ public Component errorCouldntGivePokemon(ServerPlayer targetPlayer) {

return Component.Serializer.fromJson(GsonComponentSerializer.gson().serialize(text));
}

public Component receivedPokemonFeedback(ServerPlayer player, Pokemon pokemon) {
var text = Pokegift.miniMessage.deserialize(this.receivedPokemonFeedback,
Placeholder.unparsed("player", player.getName().getString()),
Placeholder.unparsed("pokemon", pokemon.getDisplayName().getString())
);

return Component.Serializer.fromJson(GsonComponentSerializer.gson().serialize(text));
}
}
}
2 changes: 2 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ shadowJar {
exclude "com/**/*"
exclude "com.*"

relocate 'net.kyori', 'io.github.polymeta.pokegift.shadow.net.kyori'

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx4096M
minecraft_version=1.19.2

archives_base_name=pokegift
mod_version=1.0.0
mod_version=1.1.0
maven_group=io.github.polymeta

architectury_version=6.5.69
Expand Down

0 comments on commit 985ccb4

Please sign in to comment.