Update LinkedInstance
Dieser Commit ist enthalten in:
Ursprung
0b12d669f9
Commit
949da15d6a
@ -37,10 +37,10 @@ import java.util.stream.Collectors;
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class BauCommand extends SWCommand {
|
||||
|
||||
@LinkedInstance(BauServer.class)
|
||||
@LinkedInstance
|
||||
private BauServer bauServer;
|
||||
|
||||
@LinkedInstance(InfoCommand.class)
|
||||
@LinkedInstance
|
||||
private InfoCommand infoCommand;
|
||||
|
||||
public BauCommand() {
|
||||
|
@ -21,7 +21,7 @@ import static de.steamwar.bausystem.features.tpslimit.TPSWarpUtils.getTps;
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class InfoCommand extends SWCommand {
|
||||
|
||||
@LinkedInstance(BauServer.class)
|
||||
@LinkedInstance
|
||||
private BauServer bauServer;
|
||||
|
||||
public InfoCommand() {
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class ColorCommand extends SWCommand {
|
||||
|
||||
@LinkedInstance(BauServer.class)
|
||||
@LinkedInstance
|
||||
private BauServer bauServer;
|
||||
|
||||
public ColorCommand() {
|
||||
|
@ -21,10 +21,10 @@ import java.util.logging.Level;
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class RegionCommand extends SWCommand {
|
||||
|
||||
@LinkedInstance(SelectCommand.class)
|
||||
@LinkedInstance
|
||||
private SelectCommand selectCommand;
|
||||
|
||||
@LinkedInstance(ColorCommand.class)
|
||||
@LinkedInstance
|
||||
private ColorCommand colorCommand;
|
||||
|
||||
public RegionCommand() {
|
||||
|
@ -73,7 +73,7 @@ public class LinkageUtils {
|
||||
if (linkedInstance == null) {
|
||||
continue;
|
||||
}
|
||||
Object object = objectMap.getOrDefault(linkedInstance.value(), null);
|
||||
Object object = objectMap.getOrDefault(field.getType(), null);
|
||||
Object source = objectMap.getOrDefault(field.getDeclaringClass(), null);
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
@ -122,9 +122,6 @@ public class LinkageUtils {
|
||||
if (linkedInstance == null) {
|
||||
continue;
|
||||
}
|
||||
if (!field.getType().isAssignableFrom(linkedInstance.value())) {
|
||||
continue;
|
||||
}
|
||||
fieldsToLink.add(field);
|
||||
}
|
||||
}
|
||||
|
@ -27,5 +27,4 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface LinkedInstance {
|
||||
Class<?> value();
|
||||
}
|
||||
|
@ -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)));
|
||||
}
|
||||
|
||||
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) {
|
||||
return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(file, pastePoint, pasteOptions), 15));
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren