Skip to content
New issue

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

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

Already on GitHub? # to your account

Player Statistics #7568

Open
wants to merge 9 commits into
base: dev/feature
Choose a base branch
from

Conversation

Burbulinis
Copy link
Contributor

Description

This PR aims to add player statistics and closes the beloved and old issue #4687! Here's a slight glimpse of how statistics will look like:

set {_int value} to statistic "leave game" of player

# returns an int, but eh... 'played time of player' exists
set {_play time} to statistic "play_one minute" of player 

# here comes some fun
set {_usage count} to statistic "use item" for grass block of player

set {_pig kill count} to statistic "kill entity" for a pig of player

on player statistic increase:
    send "Wow! The statistic %event-string% increased! It's now %future statistic value%"

on player statistic increase of "use item":
    send event-itemtype

on player statistic increase of "leave game":
    broadcast "wow... %player% left for the %future statistic value%th time..."

Target Minecraft Versions: any
Requirements: none
Related Issues: #4687

@Efnilite Efnilite added the feature Pull request adding a new feature. label Feb 1, 2025
@Burbulinis Burbulinis requested a review from Efnilite February 1, 2025 21:41

static {
Skript.registerEvent("Player Statistic Increase", EvtPlayerStatisticIncrease.class, PlayerStatisticIncrementEvent.class,
"player statistic increase [of %*-strings%]")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"player statistic increase [of %*-strings%]")
"player statistic increase [of %-strings%]")

Just realized after looking in skriptlang-development
But you dont need the * (literal identifier) here because it can only ever be a literal.


static {
Skript.registerEvent("Player Statistic Increase", EvtPlayerStatisticIncrease.class, PlayerStatisticIncrementEvent.class,
"player statistic increase [of %*-strings%]")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"player statistic increase [of %*-strings%]")
"player statistic (increase|increment) [of %*-strings%]")

@sovdeeth
Copy link
Member

sovdeeth commented Feb 2, 2025

I think the strings should be parsed into actual Statistics whenever possible, for faster comparison and to allow proper errors.
Which leads to asking why they're strings to begin with? Why not just an enum classinfo? jump statistic, walk one cm stat, etc

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants