Class RAMStatsProvider
java.lang.Object
io.github.thecsdev.betterstats.api.util.io.RAMStatsProvider
- All Implemented Interfaces:
IEditableStatsProvider
,IStatsProvider
An
IEditableStatsProvider
whose statistics are loaded into and
held in the memory (aka RAM), hence the name RAMStatsProvider
.-
Field Summary
Modifier and TypeFieldDescriptionprotected @Nullable net.minecraft.text.Text
protected @Nullable com.mojang.authlib.GameProfile
protected final it.unimi.dsi.fastutil.objects.Object2IntMap
<net.minecraft.util.Identifier> protected final it.unimi.dsi.fastutil.objects.Object2IntMap
<net.minecraft.stat.Stat<?>> -
Constructor Summary
ConstructorDescriptionRAMStatsProvider
(net.minecraft.network.PacketByteBuf buffer, boolean releaseBuffer) Creates aRAMStatsProvider
instance, after whichStatsProviderIO.read(PacketByteBuf, IEditableStatsProvider)
is called. -
Method Summary
Modifier and TypeMethodDescriptionfinal net.minecraft.text.Text
Returns a "visual"/"user friendly" displayText
that will be shown on the GUI screen as an indicator as to who the stats belong to.final com.mojang.authlib.GameProfile
Returns theGameProfile
of the player these stats belong to, ornull
if these stats are not associated with a player.final it.unimi.dsi.fastutil.objects.Object2IntMap
<net.minecraft.util.Identifier> final int
getPlayerBadgeValue
(net.minecraft.util.Identifier badgeId) Returns theInteger
value of a givenPlayerBadge
stat.final it.unimi.dsi.fastutil.objects.Object2IntMap
<net.minecraft.stat.Stat<?>> final int
getStatValue
(net.minecraft.stat.Stat<?> stat) Returns theInteger
value of a givenStat
.final void
setDisplayName
(net.minecraft.text.Text displayName) Sets the value ofIStatsProvider.getDisplayName()
.final void
setGameProfile
(@Nullable com.mojang.authlib.GameProfile playerProfile) Sets the value ofIStatsProvider.getGameProfile()
.final void
setPlayerBadgeValue
(net.minecraft.util.Identifier badgeId, int value) Sets theInteger
value of a givenPlayerBadge
stat.final void
setStatValue
(net.minecraft.stat.Stat<?> stat, int value) Sets the value of a givenStat
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.thecsdev.betterstats.api.util.io.IEditableStatsProvider
increaseStatValue, increaseStatValue, setPlayerBadgeValue, setStatValue
Methods inherited from interface io.github.thecsdev.betterstats.api.util.io.IStatsProvider
getPlayerBadgeValue, getStatValue
-
Field Details
-
displayName
@Nullable protected @Nullable net.minecraft.text.Text displayName -
gameProfile
@Nullable protected @Nullable com.mojang.authlib.GameProfile gameProfile -
statMap
protected final it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.stat.Stat<?>> statMap -
playerBadgeStatMap
protected final it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.util.Identifier> playerBadgeStatMap
-
-
Constructor Details
-
RAMStatsProvider
public RAMStatsProvider() -
RAMStatsProvider
public RAMStatsProvider(net.minecraft.network.PacketByteBuf buffer, boolean releaseBuffer) throws NullPointerException, IllegalHeaderException, io.github.thecsdev.tcdcommons.api.util.exceptions.UnsupportedFileVersionException Creates aRAMStatsProvider
instance, after whichStatsProviderIO.read(PacketByteBuf, IEditableStatsProvider)
is called.- Parameters:
buffer
- ThePacketByteBuf
to read from.releaseBuffer
- After reading, callPacketByteBuf.release()
?- Throws:
NullPointerException
IllegalHeaderException
io.github.thecsdev.tcdcommons.api.util.exceptions.UnsupportedFileVersionException
-
-
Method Details
-
getDisplayName
public final net.minecraft.text.Text getDisplayName()Description copied from interface:IStatsProvider
Returns a "visual"/"user friendly" displayText
that will be shown on the GUI screen as an indicator as to who the stats belong to.- Specified by:
getDisplayName
in interfaceIStatsProvider
-
setDisplayName
public final void setDisplayName(net.minecraft.text.Text displayName) Description copied from interface:IEditableStatsProvider
Sets the value ofIStatsProvider.getDisplayName()
.- Specified by:
setDisplayName
in interfaceIEditableStatsProvider
- Parameters:
displayName
- The new "display name" for thisIStatsProvider
.
-
getGameProfile
public final com.mojang.authlib.GameProfile getGameProfile()Description copied from interface:IStatsProvider
Returns theGameProfile
of the player these stats belong to, ornull
if these stats are not associated with a player.- Specified by:
getGameProfile
in interfaceIStatsProvider
-
setGameProfile
public final void setGameProfile(@Nullable @Nullable com.mojang.authlib.GameProfile playerProfile) Description copied from interface:IEditableStatsProvider
Sets the value ofIStatsProvider.getGameProfile()
.- Specified by:
setGameProfile
in interfaceIEditableStatsProvider
- Parameters:
playerProfile
- The newGameProfile
value for thisIStatsProvider
.
-
getStatValue
public final int getStatValue(net.minecraft.stat.Stat<?> stat) Description copied from interface:IStatsProvider
Returns theInteger
value of a givenStat
.- Specified by:
getStatValue
in interfaceIStatsProvider
- Parameters:
stat
- TheStat
whose value is to be obtained.- See Also:
-
setStatValue
public final void setStatValue(net.minecraft.stat.Stat<?> stat, int value) throws NullPointerException Description copied from interface:IEditableStatsProvider
Sets the value of a givenStat
.- Specified by:
setStatValue
in interfaceIEditableStatsProvider
- Parameters:
stat
- TheStat
whose value is to be changed.value
- The newStat
value.- Throws:
NullPointerException
-
getPlayerBadgeValue
public final int getPlayerBadgeValue(net.minecraft.util.Identifier badgeId) Description copied from interface:IStatsProvider
Returns theInteger
value of a givenPlayerBadge
stat.- Specified by:
getPlayerBadgeValue
in interfaceIStatsProvider
- Parameters:
badgeId
- The uniqueIdentifier
of thePlayerBadge
.
-
setPlayerBadgeValue
public final void setPlayerBadgeValue(net.minecraft.util.Identifier badgeId, int value) throws NullPointerException Description copied from interface:IEditableStatsProvider
Sets theInteger
value of a givenPlayerBadge
stat.- Specified by:
setPlayerBadgeValue
in interfaceIEditableStatsProvider
- Parameters:
badgeId
- The uniqueIdentifier
of thePlayerBadge
.value
- The newInteger
value.- Throws:
NullPointerException
-
getStatMap
public final it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.stat.Stat<?>> getStatMap() -
getPlayerBadgeStatMap
public final it.unimi.dsi.fastutil.objects.Object2IntMap<net.minecraft.util.Identifier> getPlayerBadgeStatMap()
-