SteamWar/BauSystem2.0
Archiviert
12
0

Update LinkedInstance

Dieser Commit ist enthalten in:
yoyosource 2021-05-01 10:53:01 +02:00
Ursprung 0b12d669f9
Commit 949da15d6a
7 geänderte Dateien mit 11 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -37,10 +37,10 @@ import java.util.stream.Collectors;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
public class BauCommand extends SWCommand { public class BauCommand extends SWCommand {
@LinkedInstance(BauServer.class) @LinkedInstance
private BauServer bauServer; private BauServer bauServer;
@LinkedInstance(InfoCommand.class) @LinkedInstance
private InfoCommand infoCommand; private InfoCommand infoCommand;
public BauCommand() { public BauCommand() {

Datei anzeigen

@ -21,7 +21,7 @@ import static de.steamwar.bausystem.features.tpslimit.TPSWarpUtils.getTps;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
public class InfoCommand extends SWCommand { public class InfoCommand extends SWCommand {
@LinkedInstance(BauServer.class) @LinkedInstance
private BauServer bauServer; private BauServer bauServer;
public InfoCommand() { public InfoCommand() {

Datei anzeigen

@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
public class ColorCommand extends SWCommand { public class ColorCommand extends SWCommand {
@LinkedInstance(BauServer.class) @LinkedInstance
private BauServer bauServer; private BauServer bauServer;
public ColorCommand() { public ColorCommand() {

Datei anzeigen

@ -21,10 +21,10 @@ import java.util.logging.Level;
@Linked(LinkageType.COMMAND) @Linked(LinkageType.COMMAND)
public class RegionCommand extends SWCommand { public class RegionCommand extends SWCommand {
@LinkedInstance(SelectCommand.class) @LinkedInstance
private SelectCommand selectCommand; private SelectCommand selectCommand;
@LinkedInstance(ColorCommand.class) @LinkedInstance
private ColorCommand colorCommand; private ColorCommand colorCommand;
public RegionCommand() { public RegionCommand() {

Datei anzeigen

@ -73,7 +73,7 @@ public class LinkageUtils {
if (linkedInstance == null) { if (linkedInstance == null) {
continue; continue;
} }
Object object = objectMap.getOrDefault(linkedInstance.value(), null); Object object = objectMap.getOrDefault(field.getType(), null);
Object source = objectMap.getOrDefault(field.getDeclaringClass(), null); Object source = objectMap.getOrDefault(field.getDeclaringClass(), null);
try { try {
field.setAccessible(true); field.setAccessible(true);
@ -122,9 +122,6 @@ public class LinkageUtils {
if (linkedInstance == null) { if (linkedInstance == null) {
continue; continue;
} }
if (!field.getType().isAssignableFrom(linkedInstance.value())) {
continue;
}
fieldsToLink.add(field); fieldsToLink.add(field);
} }
} }

Datei anzeigen

@ -27,5 +27,4 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
public @interface LinkedInstance { public @interface LinkedInstance {
Class<?> value();
} }

Datei anzeigen

@ -20,6 +20,10 @@ public class RegionUtils {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s))); Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
} }
public static void message(Region region, String s) {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.sendMessage(s));
}
static EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) { static EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(file, pastePoint, pasteOptions), 15)); return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(file, pastePoint, pasteOptions), 15));
} }