Fixed build errors after merge

This commit is contained in:
D4rkr34lm
2025-11-06 16:57:20 +01:00
parent 6c651e6d1c
commit e1b1366306
9 changed files with 159 additions and 161 deletions
@@ -1,20 +1,18 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License along with this program.
* If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.linkage;
@@ -32,6 +30,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
public abstract class AbstractLinker<T> {
@@ -52,16 +51,13 @@ public abstract class AbstractLinker<T> {
List<Class<?>> classes;
try {
classes = new BufferedReader(new InputStreamReader(plugin.getClass().getResourceAsStream("/META-INF/annotations/de.steamwar.linkage.Linked")))
.lines()
.map(s -> {
.lines().map(s -> {
try {
return Class.forName(s, false, plugin.getClass().getClassLoader());
} catch (ClassNotFoundException | NoClassDefFoundError e) {
throw new SecurityException(e.getMessage(), e);
}
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
}).filter(Objects::nonNull).collect(Collectors.toList());
} catch (SecurityException e) {
Throwable cause = e.getCause();
throw new LinkException(cause.getMessage(), cause);
@@ -71,12 +67,15 @@ public abstract class AbstractLinker<T> {
classes.forEach(clazz -> {
MinVersion minVersion = clazz.getAnnotation(MinVersion.class);
MaxVersion maxVersion = clazz.getAnnotation(MaxVersion.class);
if (!versionCheck(clazz, minVersion, maxVersion)) return;
if (!versionCheck(clazz, minVersion, maxVersion))
return;
EventMode eventMode = clazz.getAnnotation(EventMode.class);
if (!eventModeCheck(clazz, eventMode)) return;
if (!eventModeCheck(clazz, eventMode))
return;
PluginCheck[] pluginChecks = clazz.getAnnotationsByType(PluginCheck.class);
for (PluginCheck pluginCheck : pluginChecks) {
if (!pluginCheck(clazz, pluginCheck)) return;
if (!pluginCheck(clazz, pluginCheck))
return;
}
Object any;
@@ -157,12 +156,14 @@ public abstract class AbstractLinker<T> {
/**
* There is no need in calling {@link Enable#enable()} by this method.
*/
protected void linkObject(Object any) {
}
protected void linkObject(Object any) {}
/**
* There is no need in calling {@link Disable#disable()} ()} by this method.
*/
protected void unlinkObject(Object any) {
protected void unlinkObject(Object any) {}
public final <L> Optional<L> get(Class<L> clazz) {
return Optional.ofNullable((L) instances.get(clazz));
}
}