My plugin is working on my local server, but not on Multicraft

Discussion in 'Plugin Development' started by icc, May 6, 2020.

  1. Offline

    icc

    I'm trying to upload my plugin to a multicraft server and it won't work. The plugin works fine on my locally hosted server, and there are no errors in my console (it's acting like my plugin just doesn't exist). I've uploaded other people's plugins like this, and they all work. I don't know what I'm doing wrong.

    I simplified my code as much as possible. Now it's literally just a command to heal the player. That doesn't work, either.

    Here's my (super simplified) code:

    Main class:

    Code:
    //ยง
    package me.icc.pluginTest;
    
    import org.bukkit.ChatColor;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import me.icc.pluginTest.commands.Commands;
    
    
    public class main extends JavaPlugin implements Listener {
    
        public void onEnable() {
    
            Commands commands = new Commands();
            getCommand(commands.cmd1).setExecutor(commands);
            getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "\n\nPlugin1 enabled!");
    
        }
    
        public void onDisable() {
    
            getServer().getConsoleSender().sendMessage(ChatColor.RED + "\n\nPlugin1 closed!");
    
        }
    
    }
    Commands class:

    Code:
    package me.icc.pluginTest.commands;
    
    import org.bukkit.ChatColor;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    
    
    import me.icc.pluginTest.main;
    
    @SuppressWarnings("unused")
    public class Commands implements Listener, CommandExecutor {
    
        public String cmd1 = "resethealth";
    
        @SuppressWarnings("deprecation")
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            Player player = (Player) sender;
    
            if(sender instanceof Player) {
               
                if (cmd.getName().equalsIgnoreCase(cmd1)) {
                   
                    player.setMaxHealth(20);
                    player.setHealth(20);
                    return true;
                   
                }
            }
            return false;
        }
    }
    
     
  2. Offline

    timtower Moderator Moderator

  3. Offline

    icc

    Here's the specific error:

    java.lang.UnsupportedClassVersionError: me/icc/pluginTest/Main has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0

    But in my terminal window, when I type java -version:

    java version "13.0.2"2020-01-14Java(TM) SE RuntimeEnvironment(build 13.0.2+8)JavaHotSpot(TM)64-BitServer VM (build 13.0.2+8, mixed mode, sharing)

    And I thought Java 13 was v57. From what I see my JRE matches my Java version. I don't know much about compiler errors.

    Here's the full pastebin:
    https://pastebin.com/TPzFnBSU
     
  4. Offline

    timtower Moderator Moderator

    @icc What java version are you using to compile?
     
  5. Offline

    robertlit

    The poject was compiled with Java 10 but the machine runs Java 8, hence an UnsupportedClassVersionError. You have to compile with Java 8 (or eariler).
     

Share This Page