Skip to content

Commit

Permalink
ExprTeamEntries - deprecate add/to
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneBeee committed Jun 2, 2023
1 parent e6273a9 commit 2438e03
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
import org.jetbrains.annotations.NotNull;

@Name("Team - Entries")
@Description({"Add/remove entries to/from a team. Entries can be entities/players or strings.",
"\nNOTE: `as strings` is useless when adding/remove. When returning, this will return the",
"list how Minecraft stores it, player names and entity UUIDs."})
@Description({"Get the entries of a team. Entries can be entities/players or strings.",
"\nWhen returning as strings this will return the list how Minecraft stores it, player names and entity UUIDs.",
"\nNOTE: adding/removing to/from team entries is now deprecated. Please directly add/remove to/from teams.",
"See Team type docs for more info!"})
@Examples({"set {_team} to team named \"my-team\"",
"add all players to team entries of {_team}",
"add player to team entries of team of target entity",
"clear team entries of {_team}",
"kill team entries of team named \"mob-team\"",
"add \"Batman\" to team entries of team named \"superheros\"",
"set {_entities::*} to team entries of team named \"mobs\"",
"set {_strings::*} to team entries as strings of team named \"mobs\""})
@Since("1.16.0, 2.10.0 (strings)")
Expand Down Expand Up @@ -69,11 +68,20 @@ protected Object[] get(Event event) {
@Nullable
@Override
public Class<?>[] acceptChange(ChangeMode mode) {
return switch (mode) {
case DELETE -> CollectionUtils.array();
case ADD, REMOVE -> CollectionUtils.array(Entity[].class, String[].class);
default -> null;
};
switch (mode) {
case ADD, REMOVE -> {
// TODO Deprecated INSERT VERSION
Skript.warning("You can now add/remove entities/strings to/from teams directly without this expression. " +
"ex: 'add player to team named \"a-team\"'");
return CollectionUtils.array(Player[].class, Entity[].class, String[].class);
}
case DELETE -> {
return CollectionUtils.array();
}
default -> {
return null;
}
}
}

@SuppressWarnings("NullableProblems")
Expand Down

0 comments on commit 2438e03

Please sign in to comment.