Package de.z0rdak.yawp.core.flag
Class FlagMessage
java.lang.Object
de.z0rdak.yawp.core.flag.FlagMessage
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic com.mojang.serialization.Codec<FlagMessage> static final Stringstatic FlagMessagestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionFlagMessage(String msg) FlagMessage(String msg, boolean muted) FlagMessage(String msg, boolean muted, boolean isDefault) -
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.booleanbooleanisMuted()msg()voidmute(boolean mute) voidreset()voidtoString()
-
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
-
CODEC
-
-
Constructor Details
-
FlagMessage
-
FlagMessage
-
FlagMessage
-
-
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
-