本帖最后由 勤劳的鸽子 于 2023-2-12 11:34 编辑
我让ChatGPT为我编写了一个插件!
主类代码如下!
(他甚至可以生成配方为空气时返回的语句)
我作为一个入门级开发者已经在瑟瑟发抖了....
什么?你看不懂?没关系ChatGPT经过测试还可以给插件加入注解...

我让ChatGPT为我编写了一个插件!
主类代码如下!
(他甚至可以生成配方为空气时返回的语句)
我作为一个入门级开发者已经在瑟瑟发抖了....
什么?你看不懂?没关系ChatGPT经过测试还可以给插件加入注解...
你这ChatGPT是抄了多少开源插件才生成出这么完善的代码啊(恼)
ChatGPT这么强的吗?
我的评价是:进阶CV大法(
因为本人没学过插件开发 以下内容如有解释错误 轻喷(
声明插件主类RecipeAdder,Listener表明此为一个监听者类
这个方**在插件启动的时候被调用。
获取配置文件 但是我并没有找到这俩方法的实现(((
也许是添加配方 但是我没写过(
public class RecipeAdder extends JavaPlugin implements Listener
声明插件主类RecipeAdder,Listener表明此为一个监听者类
public void onEnable()
这个方**在插件启动的时候被调用。
saveDefaultConfig();
FileConfiguarion config = getConfig();
获取配置文件 但是我并没有找到这俩方法的实现(((
for (String key : config.getConfigurationSection("recipes").getKeys(false)) {
ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.getMaterial(config.getString(key + ".result.type"))));
recipe.shape(config.getString(key + ".shape.row1"), config.getString(key + ".shape.row2"), config.getString(key + ".shape.row3"));
for (String ingredientKey : config.getConfigurationSection(key + ".ingredients").getKeys(false)) {
recipe.setIngredient(ingredientKey.charAt(0), Material.getMaterial(config.getString(key + ".ingredients." + ingredientKey)));
}
Bukkit.addRecipe(recipe);
}
也许是添加配方 但是我没写过(