File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/main/java/ch/njol/skript/bukkitutil Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 33
33
import org .bukkit .entity .Player ;
34
34
import org .eclipse .jdt .annotation .Nullable ;
35
35
36
+ import com .google .common .collect .ImmutableList ;
37
+
36
38
import ch .njol .skript .Skript ;
37
39
import ch .njol .skript .util .Task ;
38
40
@@ -74,7 +76,7 @@ public void run() {
74
76
@ SuppressWarnings ({"null" , "unchecked" })
75
77
public final static Collection <? extends Player > getOnlinePlayers () {
76
78
if (hasCollecionGetOnlinePlayers ) {
77
- return Bukkit .getOnlinePlayers ();
79
+ return ImmutableList . copyOf ( Bukkit .getOnlinePlayers () );
78
80
} else {
79
81
if (getOnlinePlayers == null ) {
80
82
try {
@@ -88,9 +90,9 @@ public final static Collection<? extends Player> getOnlinePlayers() {
88
90
try {
89
91
final Object o = getOnlinePlayers .invoke (null );
90
92
if (o instanceof Collection <?>)
91
- return ( Collection <? extends Player >) o ;
93
+ return ImmutableList . copyOf (( Collection <? extends Player >) o ) ;
92
94
else
93
- return Arrays .asList ((Player []) o );
95
+ return Arrays .asList ((( Player []) o ). clone () );
94
96
} catch (final IllegalAccessException e ) {
95
97
Skript .outdatedError (e );
96
98
} catch (final IllegalArgumentException e ) {
You can’t perform that action at this time.
0 commit comments