SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.06k stars 367 forks source link

Add Statistic support #4687

Open kossnikita opened 2 years ago

kossnikita commented 2 years ago

Suggestion

The API has a class org.bukkit.Statistic which is currently not used in the Skript. Except for one expression new ExprTimePlayed #2522 This expression can be replaced with ExprStatistic for offline players and adding a new Statistic Skript type.

Why?

Some of the statistics may be useful for conditions. For example, the number of deaths or the time since the last sleep.

Other

No response

Agreement

Pikachu920 commented 2 years ago

while statistics would be useful, I don't think removing the time played expression is necessary

kossnikita commented 2 years ago

This is not necessary because the syntax %offlineplayer%'s %statistic% completely replaces %offlineplayer%'s time played. Because time played is statistic.

AyhamAl-Ali commented 2 years ago

Removing a pretty much used expression is to be avoided unless for a very good/important reason which this isn't of type

kossnikita commented 2 years ago

But if this does not affect the work of existing scripts, then what could be wrong? The syntax will not change in any way, as will the functionality (get and set statistics)

Pikachu920 commented 2 years ago

a couple reasons -

  1. The existing expression returns a timespan and not and int
  2. the syntax %player%'s %statistic% probably isn't viable. imagine some of the weird syntaxes that could allow (e.g. player's jump, player's drop or player's dispenser inspected
kossnikita commented 2 years ago

Initially, I assumed that all time related statistics would be timespans. This requires additional processing. player's number of jumps or player's number of stone drop for these examples. Okay, I see that there can be problems with this. Although so far it seems to me that everything can be solved. Are you suggesting that instead of adding a single expression for the statistics, add multiple expressions for each of the statistics?

AyhamAl-Ali commented 2 years ago

There will be one expression and it will look something like this statistic [value[s]] %strings/statistics% of %offlineplayers% Chossing the %strings/statistics% part will decide whether we should make it be as a string or add statistics enum values as literals which I don't think is needed since it may be misleading, so string would be fair and enough