Package de.z0rdak.yawp.core.flag
Class FlagMessage
java.lang.Object
de.z0rdak.yawp.core.flag.FlagMessage
- All Implemented Interfaces:
INbtSerializable<net.minecraft.nbt.CompoundTag>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA correlation of a region and a flag. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFlagMessage(String msg) FlagMessage(String msg, boolean muted) FlagMessage(net.minecraft.nbt.CompoundTag msgNbt) -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.MutableComponentbuildFrom(FlagCheckResult result, Map<String, String> substitutes) Builds a flag message from the given flag check result and substitutes.defaultSubstitutes(RegionFlag flag, IProtectedRegion region, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.entity.player.Player player) Returns a map with default substitutes for the given flag and region.defaultSubstitutesFor(FlagCheckResult result) Returns a map with default substitutes for the given flag check result.voiddeserializeNBT(net.minecraft.nbt.CompoundTag nbt) booleanbooleanisMuted()msg()voidmute(boolean mute) voidreset()net.minecraft.nbt.CompoundTagvoidtoString()
-
Field Details
-
FLAG_TEMPLATE
- See Also:
-
POS_TEMPLATE
- See Also:
-
REGION_TEMPLATE
- See Also:
-
DIM_TEMPLATE
- See Also:
-
PLAYER_TEMPLATE
- See Also:
-
CONFIG_MSG
- See Also:
-
MSG_TOKEN
-
DEFAULT_FLAG_MSG
-
-
Constructor Details
-
FlagMessage
-
FlagMessage
-
FlagMessage
public FlagMessage(net.minecraft.nbt.CompoundTag msgNbt)
-
-
Method Details
-
defaultSubstitutes
public static Map<String,String> defaultSubstitutes(RegionFlag flag, IProtectedRegion region, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.entity.player.Player player) Returns a map with default substitutes for the given flag and region.- Parameters:
flag- the flag to get the substitutes forregion- the region to get the substitutes forpos- the position to get the substitutes forplayer- the player to get the substitutes for- Returns:
- a map with default substitutes for the given flag and region
-
defaultSubstitutesFor
Returns a map with default substitutes for the given flag check result.
The substitutes are built from the flag, responsible region, position and player in the result.
The substitutes are then returned as a map.- Parameters:
result- the flag check result to get the default substitutes for- Returns:
- a map with default substitutes for the given flag check result
-
buildFrom
public static net.minecraft.network.chat.MutableComponent buildFrom(FlagCheckResult result, Map<String, String> substitutes) Builds a flag message from the given flag check result and substitutes.
The flag message is built from the flag message template of the flag in the result.
The matches in the flag message template are replaced with the substitutes.
The flag message is then returned as aMutableComponent.- Parameters:
result- the flag check result to build the message forsubstitutes- the substitutes to replace the matches in the flag message template with- Returns:
- the flag message for the given flag check result and substitutes
-
isMuted
public boolean isMuted() -
mute
public void mute(boolean mute) -
reset
public void reset() -
isDefault
public boolean isDefault() -
msg
-
setMsg
-
toString
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfaceINbtSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfaceINbtSerializable<net.minecraft.nbt.CompoundTag>
-