Solved Variables

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

AmiT177

Member
Feb 27, 2017
8
0
0
How do I get the whole variable list?
For exmaple if I want to check what players have X in the variable Y.Z
 
Could you be more specific?

You can check the method to get a variable with this: https://github.com/bensku/Skript/bl.../ch/njol/skript/variables/Variables.java#L276
As Skript has 2 different ways to store the player in a variable name, with player's name or uuid, So I recommend this:
Java:
ClassInfo<Player> ci = Classes.getExactClassInfo(Player.class);
String playerName = ci.getParser().toVariableNameString(player);
//And then Skript will return the player's name or the player's uuid depending of config.
//Then you use it in your variable name like: "SomeVariableName." + playerName
 
Im trying to do it the opposite,
I need to scan throught the whole variables that starts with server.stat.NAME
But I cant scan through all the players, only through the variables.
 
Doesnt help.
This code is to get one variable,
I need to get all of them that starts with server.stat.
Read the documentation. Calling passing the name of a list variable to getVariable returns a Map which you can then iterate through.
Java:
Variables.getVariable("server.stat::*", null, false); // returns a Map<String, Object>

If you're not using list variables, the only way to do this is by getting Skript's internal variable map from Variables and iterating through it. You should not do this. Use list variables.