Class PlayerBadgeHandler
java.lang.Object
io.github.thecsdev.tcdcommons.api.badge.PlayerBadgeHandler
- All Implemented Interfaces:
it.unimi.dsi.fastutil.objects.ObjectIterable<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<net.minecraft.util.Identifier>>
,Iterable<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<net.minecraft.util.Identifier>>
- Direct Known Subclasses:
ServerPlayerBadgeHandler
public class PlayerBadgeHandler
extends Object
implements it.unimi.dsi.fastutil.objects.ObjectIterable<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<net.minecraft.util.Identifier>>
A handler for managing the
PlayerBadge
s assigned to a player.
This class serves as a container for keeping track of which badges a player has at any given time.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final net.minecraft.util.Identifier
protected final it.unimi.dsi.fastutil.objects.Object2IntMap
<net.minecraft.util.Identifier> A set that stores theIdentifier
s of thePlayerBadge
s assigned to this player. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Clears allPlayerBadge
stats from thestatMap
.final int
getValue
(net.minecraft.util.Identifier badgeId) final void
increaseValue
(net.minecraft.util.Identifier badgeId, int by) final it.unimi.dsi.fastutil.objects.ObjectIterator
<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<net.minecraft.util.Identifier>> iterator()
void
setValue
(net.minecraft.util.Identifier badgeId, int value) toMapByModId
(Iterable<net.minecraft.util.Identifier> badgeIDs) Creates a newMap
, maps thePlayerBadge
Identifier
s by their corresponding "mod IDs", and returns theMap
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectIterable
spliterator
-
Field Details
-
PBH_CUSTOM_DATA_ID
public static final net.minecraft.util.Identifier PBH_CUSTOM_DATA_ID- See Also:
-
statMap
protected final it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.util.Identifier> statMapA set that stores theIdentifier
s of thePlayerBadge
s assigned to this player.
-
-
Constructor Details
-
PlayerBadgeHandler
public PlayerBadgeHandler()
-
-
Method Details
-
iterator
public final it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<net.minecraft.util.Identifier>> iterator() -
getValue
public final int getValue(net.minecraft.util.Identifier badgeId) - Parameters:
badgeId
- ThePlayerBadge
's uniqueIdentifier
.
-
setValue
- Parameters:
badgeId
- ThePlayerBadge
's uniqueIdentifier
.value
- The new value.- Throws:
NullPointerException
-
increaseValue
public final void increaseValue(net.minecraft.util.Identifier badgeId, int by) - Parameters:
badgeId
- ThePlayerBadge
's uniqueIdentifier
.by
- The amount to increase the value by.
-
clearBadges
public final void clearBadges()Clears allPlayerBadge
stats from thestatMap
. -
toMapByModId
public static final Map<String,List<net.minecraft.util.Identifier>> toMapByModId(Iterable<net.minecraft.util.Identifier> badgeIDs) Creates a newMap
, maps thePlayerBadge
Identifier
s by their corresponding "mod IDs", and returns theMap
.- Parameters:
badgeIDs
- AnIterable
Object
containing the set ofPlayerBadge
Identifier
s.
-