SteamWar/BauSystem2.0
Archiviert
12
0

Fixed flag static init order leading to null pointer exeption
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
D4rkr34lm 2024-03-02 21:51:49 +01:00
Ursprung e4346a36e1
Commit ccf155d500
2 geänderte Dateien mit 6 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -34,6 +34,7 @@ import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Linked @Linked
@ -111,11 +112,10 @@ public class TraceCommand extends SWCommand {
} }
return null; return null;
} }
@Override @Override
public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
return ViewFlag.flags.stream() return ViewFlag.flags.stream()
.map(viewFlag -> viewFlag.name) .map(flag -> flag.name)
.map(name -> "--" + name) .map(name -> "--" + name)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

Datei anzeigen

@ -30,6 +30,10 @@ import java.util.function.UnaryOperator;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public abstract class ViewFlag { public abstract class ViewFlag {
/**
* Static registry of static flags
*/
public static final List<ViewFlag> flags = new ArrayList<>();
public static ViewFlag EXPLOSION = new ViewFlag(true,"explosion") { public static ViewFlag EXPLOSION = new ViewFlag(true,"explosion") {
@Override @Override
@ -53,11 +57,6 @@ public abstract class ViewFlag {
*/ */
public final String[] aliases; public final String[] aliases;
/**
* Static registry of static flags
*/
public static final List<ViewFlag> flags = new ArrayList<>();
public ViewFlag(boolean isStatic, String name, String... aliases) { public ViewFlag(boolean isStatic, String name, String... aliases) {
this.name = name; this.name = name;
this.aliases = aliases; this.aliases = aliases;