我正在开发一台《我的世界》服务器,我需要为其测试一个插件。该插件在 github 上有源代码,我决定使用它们(我们正在讨论 MMOEconomy 插件)。 为了编译插件,我尝试使用 mvn install 和 mvn clean install 命令,但在所有情况下命令行都返回错误
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.718 s
[INFO] Finished at: 2024-05-14T15:47:35+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project MMOEconomy: Compilation failure: Compilation failure:
[ERROR] /D:/Games/Minecraft/other/mmoeconomy-main/src/main/java/fr/phoenix/mmoeconomy/comp/item/ItemsAdderItem.java:[31,49] cannot find symbol
[ERROR] symbol: method getItemStack()
[ERROR] location: class java.lang.Object
[ERROR] /D:/Games/Minecraft/other/mmoeconomy-main/src/main/java/fr/phoenix/mmoeconomy/comp/profiles/MMOEcoProfileDataModule.java:[19,5] method does not override or implement a method from a supertype
[ERROR] /D:/Games/Minecraft/other/mmoeconomy-main/src/main/java/fr/phoenix/mmoeconomy/comp/profiles/MMOEcoProfileDataModule.java:[29,5] method does not override or implement a method from a supertype
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
附注ItemsAdderItem 文件中的代码可能有用。java 是此错误的来源,所以我将保留下面的所有代码
package fr.phoenix.mmoeconomy.comp.item;
import dev.lone.itemsadder.api.CustomBlock;
import dev.lone.itemsadder.api.CustomStack;
import dev.lone.itemsadder.api.ItemsAdder;
import io.lumine.mythic.lib.api.MMOLineConfig;
import org.apache.commons.lang.Validate;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class ItemsAdderItem implements EconomyItem {
private final String id;
public ItemsAdderItem(MMOLineConfig config) {
config.validateKeys("id");
this.id = config.getString("id");
}
@Override
public boolean matches(ItemStack itemStack) {
CustomStack stack = CustomStack.byItemStack(itemStack);
if (stack == null) return false;
return stack.getId().equals(id);
}
@Override
public ItemStack getItemStack() {
List<CustomStack> customStacks = ItemsAdder.getAllItems(id);
Validate.isTrue(customStacks.size() > 0, "There isn't any ItemsAdder item associated to id: " + id);
return ItemsAdder.getAllItems(id).get(0).getItemStack();
}
}
说实话,我什至不知道如何解决这个问题,因为我不懂java,但我的任务是在spigotmc上购买之前测试这个插件
从 Maven 输出中可以看到:
ItemsAdderItem
和 MMOEcoProfileDataModule
是错误的。
对于
ItemsAdderItem
:类dev.lone.itemsadder.api.CustomStack
似乎错过了getItemStack
方法。这可能是由于 pom.xml
(Maven 构建文件)中的版本定义错误造成的。
如果您不是开发人员,您可能对此无能为力。您应该联系为您提供 Maven 构建文件的实体,并报告它们已损坏并且无法从源代码构建。