Solved Name not defined!

Discussion in 'Spigot Plugin Development' started by delanootje, Sep 28, 2016.

  1. Hello!
    I just started making a plugin( at least i'm trying) .
    But after i fixed a few errors I an getting stuck with this error:
    https://gyazo.com/926176420984a84e8c947287ac37c31d

    This is my code:
    package pw.delano.tutorial;

    import org.bukkit.plugin.java.JavaPlugin;

    public class tutorial extends JavaPlugin {

    public void onEnable() {
    getLogger().info("Test Complete!");
    }

    }

    This is my Yml:
    Name: test
    main: pw.delano.tutorial.tutorial.test
    version: '1.0'

    Thank you!
     
  2. joehot200

    Supporter

    Uncapitalize the "N" in "Name", so it is "name".

    Also do not use ' in "version".

    For example, here is AntiAura's plugin.yml:
    Code (Text):

    name: AntiAura
    main: SomeMainClassHere
    version: 10.6
    depend: [ProtocolLib] #Some dependency that the plugin needs to run
    softdepend: [mcMMO] #Some dependency that the plugin can use but does not NEED.

     
     
  3. change
    pw.delano.tutorial.tutorial.test
    to
    pw.delano.tutorial.tutorial.tutorial

    here the problem

    public class tutorial extends JavaPlugin {

    if you like to work change tutorial to test
    and change
    Name: [name here]
    name: [name Here]
     
  4. joehot200

    Supporter

    Oh yes... That too. :)
     
  5. you can use

    Code (Text):
      public void onEnable() {
    Bukkit.getConsoleSender()
                            .sendMessage(ChatColor.GREEN+ "Plugin is Enabled!");
    }
     
  6. Now i get this error:
    [​IMG]
    https://gyazo.com/2191786e93bc308c736ee7e299fce36e
     
  7. show me plugin.yml
     
  8. name: test
    main: pw.delano.tutorial.tutorial.tutorial
    version: 1.0
     
  9. Code (Text):
      public void onEnable() {
    getLogger().info("Test Complete!");
    Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN+ "Plugin is Enabled!");


    }
     
  10. joehot200

    Supporter

  11. If your server is java 7 you must compile with Java 7
     
  12. it shows you have pw/delano/tutorial/tutorial that will make a error
    please check this video it will help you
     
  13. He did
     
  14. Don't link YouTube tutorial videos that's the worst thing you could do, they're often outdated, unexplained and sometimes the person making them isn't even that keen on the api or java
     
  15. 28.09 17:01:40 [Server] [Informatie] Server Ping Player Sample Count: 12
    28.09 17:01:40 [Server] [Informatie] Using 4 threads for Netty based IO
    28.09 17:01:40 [Server] [Informatie] Generating keypair
    28.09 17:01:40 [Server] [Informatie] Starting Minecraft server on 85.114.135.139:26218
    28.09 17:01:40 [Server] [Informatie] Using epoll channel type
    28.09 17:01:40 [Server] [Informatie] Set PluginClassLoader as parallel capable
    28.09 17:01:40 [Server] ERROR Could not load 'plugins/testt2.jar' in folder 'plugins'
    28.09 17:01:40 [Server] [Informatie] org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: pw/delano/tutorial/tutorial : Unsupported major.minor version 52.0
    28.09 17:01:40 [Server] [Informatie] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.10.jar:git-Spigot-3ccadba-fb568fd]
    28.09 17:01:40 [Server] [Informatie] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.10.jar:git-Spigot-3ccadba-fb568fd]
    28.09 17:01:40 [Server] [Informatie] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.10.jar:git-Spigot-3ccadba-fb568fd]
    28.09 17:01:40 [Server] [Informatie] at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugins(CraftServer.java:297) [spigot-1.10.jar:git-Spigot-3ccadba-fb568fd]
    28.09 17:01:40 [Server] [Informatie] at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:202) [spigot-1.10.jar:git-Spigot-3ccadba-fb568fd]
    28.09 17:01:40 [Server] [Informatie] at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:539) [spigot-1.10.jar:git-Spigot-3ccadba-fb568fd]
    28.09 17:01:40 [Server] [Informatie] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] Caused by: java.lang.UnsupportedClassVersionError: pw/delano/tutorial/tutorial : Unsupported major.minor version 52.0
    28.09 17:01:40 [Server] [Informatie] at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_75]
    28.09 17:01:40 [Server] [Informatie] at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0_75]
    28.09 17:01:41 [Server] Skipped 67 lines due to rate limit (30/s)
    28.09 17:01:41 [Server] [Informatie] Preparing start region for level 1 (Seed: -7918636922625305912)
    28.09 17:01:41 [Server] [Informatie] Enabling Multiverse-Core v2.5.0-SNAPSHOT-b722
    28.09 17:01:41 [Server] WARN Exception while loading value for environment
    28.09 17:01:41 [Server] WARN Exception while loading value for environment
    28.09 17:01:41 [Server] WARN WorldManager: Can't load this world because the folder was deleted/moved: Theed_hangar
    28.09 17:01:41 [Server] WARN Use '/mv remove' to remove it from the config!
    28.09 17:01:41 [Server] WARN WorldManager: Can't load this world because the folder was deleted/moved: TMO
    28.09 17:01:41 [Server] WARN Use '/mv remove' to remove it from the config!
    28.09 17:01:41 [Server] [Informatie] -------- World Settings For [Map] --------
    28.09 17:01:41 [Server] [Informatie] Entity Tracking Range: Pl 300 / An 300 / Mo 300 / Mi 300 / Other 300
    28.09 17:01:41 [Server] [Informatie] Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    28.09 17:01:41 [Server] [Informatie] Random Lighting Updates: false
    28.09 17:01:41 [Server] [Informatie] Structure Info Saving: true
    28.09 17:01:41 [Server] [Informatie] Cactus Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Cane Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Melon Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Mushroom Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Pumpkin Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Sapling Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Wheat Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] NetherWart Growth Modifier: 100%
    28.09 17:01:41 [Server] [Informatie] Entity Activation Range: An 32 / Mo 32 / Mi 16
    28.09 17:01:41 [Server] [Informatie] Max Entity Collisions: 8
    28.09 17:01:41 [Server] [Informatie] Custom Map Seeds: Village: 10387312 Feature: 14357617
    28.09 17:01:41 [Server] [Informatie] Max TNT Explosions: 100
    28.09 17:01:41 [Server] [Informatie] Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    28.09 17:01:41 [Server] [Informatie] Mob Spawn Range: 4
    28.09 17:01:41 [Server] [Informatie] Item Despawn Rate: 6000
    28.09 17:01:41 [Server] [Informatie] Item Merge Radius: 2.5
    28.09 17:01:41 [Server] [Informatie] Arrow Despawn Rate: 1200
    28.09 17:01:42 [Server] Skipped 6 lines due to rate limit (30/s)
    28.09 17:01:42 [Server] [Informatie] -------- World Settings For [ship] --------
    28.09 17:01:42 [Server] [Informatie] Entity Tracking Range: Pl 300 / An 300 / Mo 300 / Mi 300 / Other 300
    28.09 17:01:42 [Server] [Informatie] Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    28.09 17:01:42 [Server] [Informatie] Random Lighting Updates: false
    28.09 17:01:42 [Server] [Informatie] Structure Info Saving: true
    28.09 17:01:42 [Server] [Informatie] Cactus Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Cane Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Melon Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Mushroom Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Pumpkin Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Sapling Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Wheat Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] NetherWart Growth Modifier: 100%
    28.09 17:01:42 [Server] [Informatie] Entity Activation Range: An 32 / Mo 32 / Mi 16
    28.09 17:01:42 [Server] [Informatie] Max Entity Collisions: 8
    28.09 17:01:42 [Server] [Informatie] Custom Map Seeds: Village: 10387312 Feature: 14357617
    28.09 17:01:42 [Server] [Informatie] Max TNT Explosions: 100
    28.09 17:01:42 [Server] [Informatie] Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    28.09 17:01:42 [Server] [Informatie] Mob Spawn Range: 4
    28.09 17:01:42 [Server] [Informatie] Item Despawn Rate: 6000
    28.09 17:01:42 [Server] [Informatie] Item Merge Radius: 2.5
    28.09 17:01:42 [Server] [Informatie] Arrow Despawn Rate: 1200
    28.09 17:01:42 [Server] [Informatie] Allow Zombie Pigmen to spawn from portal blocks: true
    28.09 17:01:42 [Server] [Informatie] View Distance: 10
    28.09 17:01:42 [Server] [Informatie] Zombie Aggressive Towards Villager: true
    28.09 17:01:42 [Server] [Informatie] Experience Merge Radius: 3.0
    28.09 17:01:42 [Server] [Informatie] Nerfing mobs spawned from spawners: false
    28.09 17:01:42 [Server] [Informatie] Preparing start region for level 3 (Seed: -8834786308773175884)
    28.09 17:01:42 [Server] WARN WorldManager: Can't load this world because the folder was deleted/moved: Survivorz
    28.09 17:01:42 [Server] WARN Use '/mv remove' to remove it from the config!
    28.09 17:01:43 [Server] Skipped 93 lines due to rate limit (30/s)
    28.09 17:01:43 [Server] [Informatie] -------- World Settings For [Leger] --------
    28.09 17:01:43 [Server] [Informatie] Entity Tracking Range: Pl 300 / An 300 / Mo 300 / Mi 300 / Other 300
    28.09 17:01:43 [Server] [Informatie] Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
    28.09 17:01:43 [Server] [Informatie] Random Lighting Updates: false
    28.09 17:01:43 [Server] [Informatie] Structure Info Saving: true
    28.09 17:01:43 [Server] [Informatie] Cactus Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Cane Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Melon Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Mushroom Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Pumpkin Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Sapling Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Wheat Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] NetherWart Growth Modifier: 100%
    28.09 17:01:43 [Server] [Informatie] Entity Activation Range: An 32 / Mo 32 / Mi 16
    28.09 17:01:43 [Server] [Informatie] Max Entity Collisions: 8
    28.09 17:01:43 [Server] [Informatie] Custom Map Seeds: Village: 10387312 Feature: 14357617
    28.09 17:01:43 [Server] [Informatie] Max TNT Explosions: 100
    28.09 17:01:43 [Server] [Informatie] Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    28.09 17:01:43 [Server] [Informatie] Mob Spawn Range: 4
    28.09 17:01:43 [Server] [Informatie] Item Despawn Rate: 6000
    28.09 17:01:43 [Server] [Informatie] Item Merge Radius: 2.5
    28.09 17:01:43 [Server] [Informatie] Arrow Despawn Rate: 1200
    28.09 17:01:43 [Server] [Informatie] Allow Zombie Pigmen to spawn from portal blocks: true
    28.09 17:01:43 [Server] [Informatie] View Distance: 10
    28.09 17:01:43 [Server] [Informatie] Zombie Aggressive Towards Villager: true
    28.09 17:01:43 [Server] [Informatie] Experience Merge Radius: 3.0
    28.09 17:01:43 [Server] [Informatie] Nerfing mobs spawned from spawners: false
    28.09 17:01:43 [Server] [Informatie] Preparing start region for level 6 (Seed: -3570010900208604855)
    28.09 17:01:43 [Server] [Informatie] 7 - World(s) loaded.
    28.09 17:01:43 [Server] [Informatie] Version 2.5.0-SNAPSHOT-b722 (API v20) Enabled - By Rigby, fernferret, lithium3141 and main--
    28.09 17:01:43 [Server] Opstarten klaar! (2.986s)! For help, type "help" or "?"
    28.09 17:02:19 [Server] Skipped 2 lines due to rate limit (30/s)
     
  16. That error shows that your plugin is not compiled with the same Java version as the server is running.
     
    • Agree Agree x 2
  17. Actually you can run a plugin compiled with Java 7 on a Java 8 server
     
  18. Yeah thats why i dont get the error