Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Add blacklist for abuy handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rettichlp committed Sep 13, 2023
1 parent aa0e1e0 commit b0b0ff8
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.rettichlp.unicacityaddon.base.registry.annotation.UCEvent;
import com.rettichlp.unicacityaddon.commands.GetGunPatternCommand;
import net.labymod.api.client.gui.screen.key.Key;
import net.labymod.api.client.world.item.ItemStack;
import net.labymod.api.event.Subscribe;
import net.labymod.api.event.client.render.ScreenRenderEvent;
import net.labymod.api.event.client.render.world.RenderWorldEvent;
Expand All @@ -19,6 +18,7 @@
import net.labymod.api.util.math.vector.FloatVector3;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -87,8 +87,16 @@ public void onRenderWorld(RenderWorldEvent e) {

@Subscribe
public void onItemStackTooltip(ItemStackTooltipEvent e) {
ItemStack itemStack = e.itemStack();
lastHoveredSlotNumber = this.unicacityAddon.guiController().getSlotNumberByDisplayName(this.unicacityAddon.utilService().text().plain(itemStack.getDisplayName()));
String plainDisplayName = this.unicacityAddon.utilService().text().plain(e.itemStack().getDisplayName());

Collection<String> aBuyBlacklist = new ArrayList<>(Arrays.stream(Weapon.values()).map(Weapon::getName).toList());
aBuyBlacklist.add("Inventar");
aBuyBlacklist.add("Baseballschläger");
aBuyBlacklist.add("Messer");

lastHoveredSlotNumber = aBuyBlacklist.stream().noneMatch(plainDisplayName::contains)
? this.unicacityAddon.guiController().getSlotNumberByDisplayName(plainDisplayName)
: -1;
}

@Subscribe
Expand Down

0 comments on commit b0b0ff8

Please sign in to comment.