Update LinkedInstance
Dieser Commit ist enthalten in:
Ursprung
0b12d669f9
Commit
949da15d6a
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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() {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren