Minecraft Java plugin does not work despite correct programming?

so
- in Worlds
8

Have here a small problem regarding a Minecraft plugin. I think I programmed everything correctly and the plugin also starts properly according to the console. However, it does not feel the task of a player to teleports to a certain position when he reaches a determined y-value.

Here is the source code

Thanks for your answers and suggestions in advance!

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.java. *;
public class main extends JavaPlugin {

@Override
public void onDisable () {

System.out.println ("Plugin has been disabled");

}

@Override
public void onEnable () {

System.out.println ("Plugin loaded");

}

public void playerMove (PlayerMoveEvents) {

Player player = e.getPlayer ();

if (player.getLocation (). GetY () <110) {

Location loc = new Location (getServer (). GetWorld (player.getWorld (). GetName ()), 72, 173, 621);
player.teleport (loc);
System.out.println ( "lol");

ma

@Override

public void onEnable () {

System.out.println ("Plugin loaded");

this.getServer (). GetPluginManager (). RegisterEvents (new playerMove (), this);

so

But I want Intellii then create a new class is this normal? Lg

ma

Yes. Events and such things should always be in a different class.

Do

Import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.java. *;
public class main extends JavaPlugin implements Listener {

@Override
public void onDisable () {

System.out.println ("Plugin has been disabled");

}

@Override
public void onEnable () {

System.out.println ("Plugin loaded");

Bukkit.getPluginManager (). RegisterEvents (this, this);

}

@EventHandler
public void playerMove (PlayerMoveEvents) {

Player player = e.getPlayer ();

if (player.getLocation (). GetY () <110) {

Location loc = new Location (getServer (). GetWorld (player.getWorld (). GetName ()), 72, 173, 621);
player.teleport (loc);
System.out.println ( "lol");

so

Do I have to note something in the main class then who I do the whole playerMove thing in a separate class

Li

Instead of News PlayerMove () just do this since it's already in the main itself

ma

This.getServer (). GetPluginManager (). RegisterEvents (new playerMove (), this);

Is that noted?

Do

You should first learn Java before you start writing plugins. Otherwise, your plugins will not work and / or cause errors