【问题标题】:Server doesn't enable my spigot plugin. (It doesn't even try)服务器没有启用我的 spigot 插件。 (它甚至没有尝试)
【发布时间】:2021-06-21 22:04:03
【问题描述】:

我基本上是在制作一个插口插件,以供练习。

服务器没有启用服务器,控制台没有错误。它也没有启用插件的“INFO”。

这是我的主要课程

package me.FarrosGaming.SpawnPillager;

import org.bukkit.plugin.java.JavaPlugin;

import me.FarrosGaming.SpawnPillager.commands.PillagerCommand;

public class Main extends JavaPlugin {
    @Override
    public void onEnable() {
        new PillagerCommand(this);
    }
    
    @Override
    public void onDisable() {
        
    }
}

这是我的命令类

package me.FarrosGaming.SpawnPillager.commands;

import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;

import me.FarrosGaming.SpawnPillager.Main;

public class PillagerCommand implements CommandExecutor {
    private Main plugin;
    
    public PillagerCommand(Main plugin) {
        this.plugin = plugin;
        plugin.getCommand("chase").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players who can send this command.");
            return true;
        }
        
        Player player = (Player) sender;
        
        if (player.hasPermission("hello.use")) {
            Location location = player.getLocation();
            World world = player.getWorld();
            
            for (int i = 0; i < 10; i++) {
                world.spawnEntity(location, EntityType.CREEPER);
            }
            
            return true;
        } else {
            player.sendMessage("You do not have a permission to use this command");
        }
        
        return false;
    }
    
}

这是我的 plugin.yml 文件

name: SpawnPillager
version: 1.0
author: FarrosGaming
description: blabla
main: me.FarrosGaming.SpawnPillager.Main

commands:
  chase:
    description: Spawn pillager in your location
    usage: /chase

从字面上看,plugin.yml 中没有空格 我正在使用最新版本的 spigot。

【问题讨论】:

  • 您确定插件在您的plugins 目录中,并且您在将jar 放入该目录后重新启动了服务器吗?主要是健全性检查,因为您的代码/plugin.yml 不会立即出现其他问题
  • @Lucan 是的,我正在将我的 jar 文件放入 plugins 文件夹中,并且我已经重新启动了服务器,但没有任何反应。
  • 您确定正确导出 .jar 文件了吗?

标签: java bukkit


【解决方案1】:

确保您将插件的 Jar 放在正确的位置,我的意思是正确的服务器的插件文件夹,如果您使用多个然后重新加载/重新启动服务器, 我要告诉这个,因为我自己也犯了这个错误..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-27
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 2020-06-09
    • 1970-01-01
    相关资源
    最近更新 更多