Yet Another World Protector

Yet Another World Protector

247k Downloads

Customizable flag messages

Z0rdak opened this issue ยท 3 comments

commented

Description

Currently there exists only a default message when a players action is denied through a flag.

It would be neat to customize these messages for each region. The simplest approach from the programming and user perspective would be to let the owner define a string with placeholders for each flag. If set, it would override the default flag message.

Placeholders

Placeholder Name Placeholder Description
Region name {region} Substitutes the region name of the involved region
Dimension name {dim} Substitutes the corresponding dimension name of the involved region
Flag name {flag} Substitutes the corresponding flag name
Player name {player} Substitutes the name of the involved player
Team name {team} Substitutes the team name of the involved player
Affiliation name {group} Substitutes the affiliation of the involved team or player
Position name {pos} Substitutes the position of the interaction
Entity name {entity} Substitutes the entity name of the involved entity, if applicable
Block name {block} Substitutes the block name of the targeted block, if applicable

Textformatting

Since the custom flag messages use the vanilla I18n system, the build-in text formatting can be used.

Take a look at this tool for reference as well as the minecraft wiki.

Examples

  • Sorry, you are not allowed to break blocks here, {player}.
  • Team {team} is not allowed to place blocks here!
  • Only players and teams which are '{affiliation}' are allowed to participate in PVP here!
  • PVP is disabled in this region {region}.
  • This action is denied here because of the '{flag}' flag.
  • Entity {entity} at {pos} can't be tamed because of the active flag '{flag}' in the region '{region}'.
  • You shall not pass!

Command syntax

Possible command syntax could be one of the following:

1. new flag command

  • /wp flag <dim|local> <region> <flag> msg set "Sorry, you are not allowed to break blocks here, {player}"
  • /wp flag <dim|local> <region> <flag> msg clear

2. extended flag sub-command

  • /wp region <dim> <region> flag <flag> msg set "Sorry, you are not allowed to break blocks here, {player}"
  • /wp region <dim> <region> flag <flag> msg clear

for Local Regions

  • /wp region <dim> <region> flag <flag> msg set "Sorry, you are not allowed to break blocks here, {player}"
  • /wp region <dim> <region> flag <flag> msg clear

for Dimensional Regions

Misc

  • Setting the flag message to "default" or "config" should result to a default flag message from the I18n keys.

To-do

  • Introduce FlagMessage type for further abstraction
  • Add possibility to mute each flag message individually
  • Add config option for default flag message (also using the placeholders discussed above)
  • Extend Flag type to store messages
  • Adjust de-/serialization
  • Add text style placeholders
  • Integrate new custom flag messages into flag checks.
  • Add command to manage messages (/wp flag dim|local|global <region> )
  • Add interactive CLI integration

Related Issues

commented

Done. Will be released with 0.0.4.0-beta1

commented

Instead of the config for flag messages using the I18n system would be way more flexible and brings the benefit of the build in text formatting.

This would require a custom translation text component to replace the placeholders for regions etc

commented

The first iteration will only include the flag, pos, region, dim and player templates