Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoreboard syntax. #6754

Draft
wants to merge 48 commits into
base: dev/feature
Choose a base branch
from

Conversation

Moderocky
Copy link
Member

@Moderocky Moderocky commented Jun 2, 2024

Additions

  • Registers scoreboard, team, objective and criterion types and their syntax
  • Registers placeholder types for:
    • Things with prefixes
    • Things with suffixes
    • Things with display names
    • Things with members

Changes

  • ExprPrefixSuffix removed from hooks, added as two regular expressions (ExprPrefix, ExprSuffix) that now support anything that can be prefixed/suffixed
  • If you don't have Vault, you can now acquire a player's team prefix via the main scoreboard

Syntax

Scoreboard

You can get or create scoreboards.

[the] [main|server] scoreboard
[a] new scoreboard

These have teams.

[the] teams of %scoreboard%

These also have objectives (which can be selected by multiple criteria).

[the] objectives of %scoreboard%
[the] %criteria% objectives of %scoreboard%

Teams

Sadly, teams are rubbish. Minecraft made them unimaginably badly.
I've gone to quite a lot of effort to get around that.

Teams support some changers by default (add X to team, reset team).

Teams have rules:

  • Collision
  • See name tags
  • See death messages
  • Friendly fire
  • See friendly invisible members

These are changed with an effect.

(allow|permit) (this team|other teams|everybody|nobody) to (collide with|see [the] name[ ]tag[s] of|see the death message[s] of) %teams%
(allow|permit) friendly fire for %teams%
(prevent|deny) friendly fire for %teams%
(allow|permit) %teams% to see [friendly] invisible[ player]s
(prevent|deny) %teams% from seeing [friendly] invisible[ player]s

These are tested with a condition.

if [only] (this team|other teams|everybody|nobody) can(not|n't) (collide with|see [the] name[ ]tag[s] of|see the death message[s] of) %teams%
if [only] (this team|other teams|everybody|nobody) can(not|n't) see %teams%'[s] (name[ ]tag[s]|death message[s])

Note: the only flag is used for enforcing accuracy: "everybody can see X" implies "this team can see X" whereas "everybody can see X" does not imply "only this team can see X".

Teams can have a prefix and suffix.

[the] prefix of %team%
[the] suffix of %team%

Teams have members!
In Minecraft, team entries are the (non-constant) names of players and the (non-constant) ids of entities, for some unfathomable reason.
To help those of us who don't appreciate this genius design, I added a backing wrapper set that references the team entries as Entity or OfflinePlayer wherever possible. This means that when you do loop members of {team}: you'll get the actual entities rather than a bunch of strings.
This supports changers as well as possible.

[the] members of %team%

Objectives

I haven't really looked at these yet, I hope they're not too difficult 😬

Criteria

Singular: %criterion%
Plural: %criteria%

Criteria are done a little weirdly internally, so we use #6718 for a literal.
We also have a String -> Criterion converter.

%*string% criteri(on|a)

We also provide literals that the server declares from the default Minecraft objectives (e.g. dummy, death count, kill count) and these are generated when the server loads.

The suffix is used to prevent them interfering with other syntax.

dummy criteri(on|a), trigger criteri(on|a), death count criteri(on|a), player kill count criteri(on|a), total kill count criteri(on|a), health criteri(on|a), food criteri(on|a), air criteri(on|a), armor criteri(on|a), xp criteri(on|a), level criteri(on|a), team kill black criteri(on|a), team kill dark blue criteri(on|a), team kill dark green criteri(on|a), team kill dark aqua criteri(on|a), team kill dark red criteri(on|a), team kill dark purple criteri(on|a), team kill gold criteri(on|a), team kill gray criteri(on|a), team kill dark gray criteri(on|a), team kill blue criteri(on|a), team kill green criteri(on|a), team kill aqua criteri(on|a), team kill red criteri(on|a), team kill light purple criteri(on|a), team kill yellow criteri(on|a), team kill white criteri(on|a), killed by team black criteri(on|a), killed by team dark blue criteri(on|a), killed by team dark green criteri(on|a), killed by team dark aqua criteri(on|a), killed by team dark red criteri(on|a), killed by team dark purple criteri(on|a), killed by team gold criteri(on|a), killed by team gray criteri(on|a), killed by team dark gray criteri(on|a), killed by team blue criteri(on|a), killed by team green criteri(on|a), killed by team aqua criteri(on|a), killed by team red criteri(on|a), killed by team light purple criteri(on|a), killed by team yellow criteri(on|a), killed by team white criteri(on|a)

Criteria have names (Minecraft's registration pattern) and their stringified version is their Skript pattern.

Todo

  • Actually support scores
  • Friendly fire/invisible condition for teams
  • Register & change objectives
  • Objective displays

Related Issues: depends on #6728, closes #3332

@EquipableMC
Copy link
Contributor

Would this allow us to create custom scoreboards like how it's done in SkBee?

@sovdeeth
Copy link
Member

sovdeeth commented Jun 2, 2024

Would this allow us to create custom scoreboards like how it's done in SkBee?

create scoreboards, yes
like skbee, no

@Asleeepp
Copy link
Contributor

Asleeepp commented Jun 2, 2024

This should also allow team's colors to be modified.

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some initial syntax-focused comments

@Moderocky
Copy link
Member Author

This should also allow team's colors to be modified.

it's in draft because it's not finished yet, there are still like 19 things missing

@Moderocky
Copy link
Member Author

Would this allow us to create custom scoreboards like how it's done in SkBee?

I have no idea what any addons do or do not do, it's roughly aiming to emulate what's written in the Minecraft wiki here (as far as Bukkit allows me to).

If there's something in particular you're asking about you'll need to describe it.

@sovdeeth
Copy link
Member

sovdeeth commented Jun 2, 2024

Would this allow us to create custom scoreboards like how it's done in SkBee?

I have no idea what any addons do or do not do, it's roughly aiming to emulate what's written in the Minecraft wiki here (as far as Bukkit allows me to).

If there's something in particular you're asking about you'll need to describe it.

Skbee has specific syntaxes for creating custom sidebar displays (set line 5 of scoreboard of player to "test") which uses fastboard(?) to do the scoreboard shenanigans. It's very different from using the actual minecraft scoreboard system.

@Moderocky
Copy link
Member Author

Skbee has specific syntaxes for creating custom sidebar displays (set line 5 of scoreboard of player to "test") which uses fastboard(?) to do the scoreboard shenanigans. It's very different from using the actual minecraft scoreboard system.

Ah I see. In that case, no.

Scoreboards can be set to display the score of an entry in a place (e.g. the sidebar, the tab list, above the head) and then will display anything with a score for that objective.

You can still (ab)use this to display lines of text: register a dummy objective, then give a fake offline player a score of (line number) for that objective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants