Update Bungee/Spigot detection
Dieser Commit ist enthalten in:
Ursprung
de02138e8d
Commit
b7e5de4894
@ -80,7 +80,6 @@ public class LinkageProcessor extends AbstractProcessor {
|
||||
String name = new File(System.getProperty("user.dir")).getName();
|
||||
if (name.contains(".")) name = name.substring(0, name.indexOf('.'));
|
||||
name = name.toLowerCase();
|
||||
context = name.contains("bungee") ? LinkageType.Context.BUNGEE : LinkageType.Context.SPIGOT;
|
||||
|
||||
messager = processingEnv.getMessager();
|
||||
|
||||
@ -95,15 +94,17 @@ public class LinkageProcessor extends AbstractProcessor {
|
||||
File file = new File(System.getProperty("user.dir"));
|
||||
Optional<File> pluginYMLFile = Files.walk(file.toPath())
|
||||
.map(Path::toFile)
|
||||
.filter(f -> f.getName().equals("plugin.yml"))
|
||||
.filter(File::isFile)
|
||||
.filter(f -> f.getName().equals("plugin.yml") || f.getName().equals("bungee.yml"))
|
||||
.findFirst();
|
||||
if (!pluginYMLFile.isPresent()) {
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, "Could not find plugin.yml");
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, "Could not find plugin.yml or bungee.yml");
|
||||
return;
|
||||
}
|
||||
context = pluginYMLFile.get().getName().equals("bungee.yml") ? LinkageType.Context.BUNGEE : LinkageType.Context.SPIGOT;
|
||||
Optional<String> mainName = getMainName(pluginYMLFile.get());
|
||||
if (!mainName.isPresent()) {
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, "Could not find main class in plugin.yml");
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, "Could not find main class in plugin.yml or bungee.yml");
|
||||
return;
|
||||
}
|
||||
pluginMain = mainName.get();
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2022 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 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/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.linkage;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface Writer {
|
||||
void write(BufferedWriter writer) throws IOException;
|
||||
}
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.linkage.plan;
|
||||
|
||||
import de.steamwar.linkage.Writer;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
@ -27,7 +26,7 @@ import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class BuildPlan implements Writer {
|
||||
public class BuildPlan {
|
||||
|
||||
private final String packageName;
|
||||
private Set<String> imports = new HashSet<>();
|
||||
@ -57,7 +56,6 @@ public class BuildPlan implements Writer {
|
||||
staticLines.add(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(BufferedWriter writer) throws IOException {
|
||||
writer.write("package " + packageName + ";\n");
|
||||
if (!imports.isEmpty()) {
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.linkage.plan;
|
||||
|
||||
import de.steamwar.linkage.Writer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -29,7 +28,7 @@ import java.io.IOException;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FieldBuilder implements Writer {
|
||||
public class FieldBuilder {
|
||||
@Getter
|
||||
private final String type;
|
||||
private final String name;
|
||||
@ -39,7 +38,6 @@ public class FieldBuilder implements Writer {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(BufferedWriter writer) throws IOException {
|
||||
writer.write(" private static " + type + " " + getFieldName() + (initializer == null ? "" : " = " + initializer) + ";\n");
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.linkage.plan;
|
||||
|
||||
import de.steamwar.linkage.Writer;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
@ -28,7 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class MethodBuilder implements Writer {
|
||||
public class MethodBuilder {
|
||||
|
||||
private final String name;
|
||||
private final String returnType;
|
||||
@ -52,7 +51,6 @@ public class MethodBuilder implements Writer {
|
||||
this.isPrivate = isPrivate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(BufferedWriter writer) throws IOException {
|
||||
writer.write(" " + (isPrivate ? "private" : "public") + " static " + returnType + " " + getMethodName() + "(");
|
||||
for (int i = 0; i < parameters.size(); i++) {
|
||||
|
@ -19,18 +19,16 @@
|
||||
|
||||
package de.steamwar.linkage.plan;
|
||||
|
||||
import de.steamwar.linkage.Writer;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class ParameterBuilder implements Writer {
|
||||
public class ParameterBuilder {
|
||||
private String type;
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public void write(BufferedWriter writer) throws IOException {
|
||||
writer.write(type + " " + name);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren