Wieso funktioniert das Plugin nicht?

Hallo. Ich programmiere gerade ein Plugin. Eigendlich funktioniert es, doch es gibt ein problem. Es solten 2 Spieler an verschiedenen orten Teleportirt werden, doch beide Spieler werden an ein Ort Teleportiert. Hier der Code:

public class TeleportEvent implements Listener {
    public static Bootrennen plugin;

    public TeleportEvent(Bootrennen plugin) {

        TeleportEvent.plugin = plugin;
    }

    public static void start() {
        Location location = plugin.getConfig().getLocation("location.start1");
        Location loc = plugin.getConfig().getLocation("location.start2");
        int i = 1;
        for(Player current : Bukkit.getOnlinePlayers()) {
            Location playerLocation = plugin.getConfig().getLocation("location.start" + i);
            current.teleport(playerLocation);
            if (location != null) {
                if(location.getBlock() != current.getLocation().getBlock()) {
                    i = 1;
                   current.teleport(Objects.requireNonNull(plugin.getConfig().getLocation("location.start1")));
                    Boat bt = (Boat) current.getWorld().spawnEntity(location, EntityType.BOAT);
                    bt.addPassenger(current);
                } else {
                    if (loc != null) {
                       i = 2;
                        current.teleport(Objects.requireNonNull(plugin.getConfig().getLocation("location.start2")));
                        Boat bt = (Boat) current.getWorld().spawnEntity(location, EntityType.BOAT);
                        bt.addPassenger(current);
                      
                       i++;
                    }
                }
            }

        }
    }

    @EventHandler
    public void onExit(VehicleExitEvent e) {
        Player player = (Player) e.getExited();
        if (e.getExited().hasPermission("Operator")) {
            e.setCancelled(false);
        } else {
            player.sendMessage(ChatColor.RED + "Du darfst das nicht!");
            e.setCancelled(true);

        }
    }
}
Computer, Java, Minecraft, Spigot, Plugins Minecraft
PlotSquared wird nicht richtig aktiviert?

Ich möchte gerne PlotSquared auf meinem 1.16.5 Server nutzen.

Version: 4.4.495

Java Version: 8 (mit 16 geht es auch nicht)

Fehler:

java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because "this.engine" is null

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.plot.commands.DebugExec.init(DebugExec.java:108)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.plot.commands.DebugExec.<init>(DebugExec.java:65)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.plot.commands.MainCommand.getInstance(MainCommand.java:88)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.plot.commands.SubCommand.<init>(SubCommand.java:20)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.plot.commands.SubCommand.<init>(SubCommand.java:24)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.bukkit.commands.DebugUUID.<init>(DebugUUID.java:44)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.bukkit.util.BukkitCommand.<init>(BukkitCommand.java:24)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.bukkit.BukkitMain.registerCommands(BukkitMain.java:291)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.plot.PlotSquared.<init>(PlotSquared.java:239)

[21:14:33] [Server thread/WARN]: at com.github.intellectualsites.plotsquared.bukkit.BukkitMain.onEnable(BukkitMain.java:153)

[21:14:33] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)

[21:14:33] [Server thread/WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)

[21:14:33] [Server thread/WARN]: at org.mcnative.runtime.bukkit.plugin.McNativePluginWrapperLoader.enablePlugin(McNativePluginWrapperLoader.java:138)

[21:14:33] [Server thread/WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500)

[21:14:33] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518)

[21:14:33] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432)

[21:14:33] [Server thread/WARN]: at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:270)

[21:14:33] [Server thread/WARN]: at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074)

[21:14:33] [Server thread/WARN]: at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291)

[21:14:33] [Server thread/WARN]: at java.base/java.lang.Thread.run(Thread.java:831)

Minecraft, Citybuild, Plugins Minecraft, PlotSquared
com.mysql.cj.jdbc.exceptions.CommunicationsException?

Hallo, ich habe ein Java Plugin wo diese Meldung kommt:

The last packet successfully received from the server was 36.085.288 milliseconds ago.
The last packet sent successfully to the server was 36.085.288 milliseconds ago. is longer than the server configured value of 'wait_timeout'.
You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

und dieser Fehler:

com.mysql.cj.jdbc.exceptions.CommunicationsException

und ich weiß nicht so recht weiter da ich

autoReconnect = true

ja schon nutze.

databases.forEach(database -> {
  try {
    Connection connection = DriverManager.getConnection(getURL(database), user, password);
    connections.put(database, connection);

    Bukkit.getConsoleSender().sendMessage("§aDatenbank-Verbindung(§6" + database + "§a) erfolgreich hergestellt");
  }
  catch (SQLException exception) {
    Bukkit.getConsoleSender().sendMessage("§cDatenbank-Verbindung(§6" + database + "§c) konnte nicht hergestellt werden");
    exception.printStackTrace();
  }
});

private String getURL(String database) {
  return "jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=false&verifyServerCertificate=false&allowPublicKeyRetrieval=true&serverTimezone=Europe/Berlin&autoReconnect=true";
}

Dieser Fehler kommt bei anderen Plugins, die heruntergeladen sind, auch.

LG

Programmieren, Java, Ubuntu, Minecraft, Plugins Minecraft
Java: Wieso bekomme ich eine NullpointerExeption nach Server Reload?

Hallo.

Ich habe ein Minecraft Plugin in der Sprache Java programmiert und nachdem ich den Minecraft Server neulade, gibt dieser eine Fehlermeldung aus. Wieso?

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Caused by: java.lang.NullPointerException
at de.Schulschluss.shop_GUI.OnInventoryClick.onInventoryClick(OnInventoryClick.java:28) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 15 more

Anscheinend ist der Fehler dort:

Caused by: java.lang.NullPointerException
at de.Schulschluss.shop_GUI.OnInventoryClick.onInventoryClick(OnInventoryClick.java:28) ~[?:?]

Die Klasse sieht wie folgt aus:

public String Prefix = "Prefix >>";

@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
  Player p = (Player) e.getWhoClicked();

  if (e.getWhoClicked() instanceof Player) {
    if (e.getClickedInventory().getTitle() != null) {
      if (e.getClickedInventory().getTitle().equals(de.Schulschluss.Main.GUI_Name)) {
        if (e.getInventory().getName() == de.Schulschluss.Main.GUI_Name) {
          if (e.getCurrentItem() != null) {
            if (e.getSlot() == 10) {
              p.sendMessage(Prefix + "Jetzt.");
            }

            e.setCancelled(true);
          }
        }
      }
    }
  }
}

Ich bitte um Hilfe. Danke an alle im Voraus.

Computer, Programmieren, Java, Minecraft, Minecraft Server, Fehlermeldung, Minecraft plugin, Plugins Minecraft, Minecraft Plugins programmieren

Meistgelesene Fragen zum Thema Plugins Minecraft