Skip to content

Commit

Permalink
feat(forge16): added locale for interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
danorris709 committed Feb 2, 2024
1 parent 0dfffcc commit 991f537
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class EnvyAurasLocale extends AbstractYamlConfig {
private List<String> givenAura = Lists.newArrayList("&e&l(!) &eYou have given %player% %amount% x %aura%");
private List<String> cancelOverwrite = Lists.newArrayList("&c&l(!) &cYou cancelled the aura overwrite");
private List<String> overwritten = Lists.newArrayList("&e&l(!) &eYou overwrote the %old_aura% to %new_aura% for %pokemon%");
private List<String> auraSet = Lists.newArrayList("&e&l(!) &eYou set %pokemon%'s aura to %aura%");
private List<String> cannotSetOthersAuras = Lists.newArrayList("&c&l(!) &cYou cannot set the aura for other players' Pokemon!");

public EnvyAurasLocale() {
super();
Expand All @@ -35,4 +37,12 @@ public List<String> getCancelOverwrite() {
public List<String> getOverwritten() {
return this.overwritten;
}

public List<String> getAuraSet() {
return this.auraSet;
}

public List<String> getCannotSetOthersAuras() {
return this.cannotSetOthersAuras;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.envyful.auras.listener;

import com.envyful.api.platform.PlatformProxy;
import com.envyful.api.text.Placeholder;
import com.envyful.auras.EnvyAuras;
import com.pixelmonmod.pixelmon.entities.pixelmon.PixelmonEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
Expand Down Expand Up @@ -27,19 +29,20 @@ public void onEntityInteract(PlayerInteractEvent.EntityInteractSpecific event) {
event.setCanceled(true);

if (!pixelmon.isOwnedBy(player)) {
//TODO: error + bypass logic
PlatformProxy.sendMessage(player, EnvyAuras.getLocale().getCannotSetOthersAuras());
return;
}

if (pixelmon.getPokemon().getPersistentData().contains("ENVY_AURAS")) {
itemInHand.shrink(1);
var pokemonAura = EnvyAuras.getConfig().auraFromPokemon(pixelmon);
EnvyAuras.getGraphics().getOverwriteWarningUI().open(EnvyAuras.getPlayerManager().getPlayer(player), aura, pixelmon);
return;
}

pixelmon.getPokemon().getPersistentData().putString("ENVY_AURAS", aura.id());
//TODO: success message
PlatformProxy.sendMessage(player, EnvyAuras.getLocale().getAuraSet(),
Placeholder.simple("%aura%", aura.displayName()),
Placeholder.simple("%pokemon%", pixelmon.getDisplayName().getString()));
itemInHand.shrink(1);
}

Expand Down

0 comments on commit 991f537

Please sign in to comment.