2014-10-29 70 views
0

我只是想創建我的第一個簡單的Bukkit插件,我看了一些教程,但我不能將它安裝在我的服務器上!我試圖編寫我的第一個Bukkit插件,但我不能安裝它

這裏是我的代碼:

package me.valli308.MintCraftBasic; 

import org.bukkit.ChatColor; 
import org.bukkit.event.EventHandler; 
import org.bukkit.event.Listener; 
import org.bukkit.event.player.PlayerJoinEvent; 
import org.bukkit.plugin.java.JavaPlugin; 
public class Example extends JavaPlugin implements Listener { 
    public void onEnable() { 
     getServer().getPluginManager().registerEvents(this, this); 
    } 
    @EventHandler 
    public void onJoin(PlayerJoinEvent event) { 
     event.setJoinMessage(ChatColor.AQUA + event.getPlayer().getName() + 
          " has joined the game"); 
    } 
} 

這裏是plugin.yml文件:

name: MintCraftBasic 
main: me.valli308.MintCraftBasic.Main 
version: 1 
author: valli308 

這裏是server.log文件:

2014-10-29 17:47:32 [INFO] Starting minecraft server version 1.6.2 
2014-10-29 17:47:32 [WARNING] To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar" 
2014-10-29 17:47:32 [INFO] Loading properties 
2014-10-29 17:47:32 [INFO] Default game type: SURVIVAL 
2014-10-29 17:47:32 [INFO] Generating keypair 
2014-10-29 17:47:32 [INFO] Starting Minecraft server on *:25565 
2014-10-29 17:47:32 [INFO] This server is running CraftBukkit version git-Bukkit-1.5.2-R1.0-25-g2a13a5a-b2812jnks (MC: 1.6.2) (Implementing API version 1.6.2-R0.1-SNAPSHOT) 
2014-10-29 17:47:32 [SEVERE] Could not load 'plugins\MintCraftBasic.jar' in folder 'plugins' 
org.bukkit.plugin.InvalidPluginException: java.lang.ClassCastException: class me.valli308.MintCraftBasic.Main 
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184) 
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305) 
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230) 
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugins(CraftServer.java:239) 
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.<init>(CraftServer.java:217) 
    at net.minecraft.server.v1_6_R2.PlayerList.<init>(PlayerList.java:56) 
    at net.minecraft.server.v1_6_R2.DedicatedPlayerList.<init>(SourceFile:11) 
    at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:106) 
    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391) 
    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582) 
Caused by: java.lang.ClassCastException: class me.valli308.MintCraftBasic.Main 
    at java.lang.Class.asSubclass(Unknown Source) 
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:174) 
    ... 9 more 
2014-10-29 17:47:32 [INFO] Preparing level "world" 
2014-10-29 17:47:32 [INFO] Preparing start region for level 0 (Seed: 2867628193957491119) 
2014-10-29 17:47:32 [WARNING] Could not get information about this CraftBukkit version; perhaps you are running a custom one?: IOException 
2014-10-29 17:47:32 [WARNING] Could not get latest artifact information: IOException 
2014-10-29 17:47:32 [INFO] Preparing start region for level 1 (Seed: 2867628193957491119) 
2014-10-29 17:47:33 [INFO] Preparing start region for level 2 (Seed: 2867628193957491119) 
2014-10-29 17:47:33 [INFO] Server permissions file permissions.yml is empty, ignoring it 
2014-10-29 17:47:33 [INFO] Done (0,880s)! For help, type "help" or "?" 

回答

1

您設置了錯誤的主類。 請選擇以下解決方案之一。

  • 變化main: me.valli308.MintCraftBasic.Mainmain: me.valli308.MintCraftBasic.Exampleplugin.yml文件。

  • public class Example extends JavaPlugin implements Listener {更改爲public class Main extends JavaPlugin implements Listener {Example.java文件中,並將其重命名爲Main.java

相關問題