I have very big problems with version 1.14.4 in Minecraft. What worked well in 1.8.9 is no longer possible.
My biggest problem right now is that I can't use separate classes. I also get no error messages from Java (Bukkit).
Main:
package main;
import org.bukkit.plugin.java.JavaPlugin;
import commands.heal;
public class Main extends JavaPlugin {
public void OnEnabel () {
this.getCommand ("heal"). SetExecutor (new commands.heal (this));
}
public void OnDisabel () {
}
}
Heal:
package commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import main.Main;
public class heal implements CommandExecutor {
private main plugin;
public heal (Main plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand (CommandSender sender, Command command, String string, String [] arg) {
Player p = (player) transmitter;
if (sender instanceof Player) {
p.sendMessage ("You have healed yourself Erholgreich");
p.setHealth (20);
p.setFoodLevel (20);
p.setFireTicks (0);
}
else {
p.sendMessage ("You must be a player");
return false;
}
return false;
}
}
I have already tried it with the following possibility:
getCommand ("heal"). SetExecutor (new heal ());
I tried a lot of other methods, but all had the same problem. Minecraft 1.14.4 did not recognize it (it did not work).
The way I see it, you have a spelling problem. Not only in the German language I see blatant mistakes:
You have healed yourself Ervolgreich
You healed yourself successfully. // corrected
You have to be a player
You have to be a player. // corrected
but also where it becomes important for the functionality of the application itself:
OnEnable >> onEnable
OnDisabel >> onDisable
If you want to overwrite methods, you should always use the override annotation. Then you get in such a case, an error message from the compiler back.
Incidentally, you should reconsider some identifiers. The name player instead of p would be more meaningful and class names do not start with a capital letter for nothing, according to the Java convention. This is how they can be better differentiated from other elements.
PS.: If you have already imported the class at the top of the file header, then you need it here:
new commands.heal (this)
do not write down the classpath again.
The way I see it, you have a spelling problem. Not only in the German language I see glaring mistakes
Yes, a little bit but I'm working on it.