Minecraft Kiste Items sortieren SPIGOT?

Servus,
ich möchte, dass in der Kiste die Items automatisch gestackt werden.
Ich bin da jz einige Stunden dran und weiß nicht mehr wie ichs machen könnte.

Hier was ich jz derzeit geschrieben habe:

ItemStack stack = null;
                    int itemPos = 0;
                    for(int c = 0; c < chestData.getSnapshotInventory().getSize(); c++) {
                        if(chestData.getSnapshotInventory().getItem(c) != null) {
                            if(stack == null) {
                                if(chestData.getSnapshotInventory().getItem(c).getAmount() != chestData.getSnapshotInventory().getItem(c).getMaxStackSize()) {
                                    stack = chestData.getSnapshotInventory().getItem(c);
                                    stack.setAmount(chestData.getSnapshotInventory().getItem(c).getAmount());
                                    itemPos = c;
                                }
                            }else if(stack.equals(chestData.getSnapshotInventory().getItem(c))){
                                if(stack.getAmount() + chestData.getSnapshotInventory().getItem(c).getAmount() >= stack.getMaxStackSize()) {
                                    int distance = stack.getMaxStackSize() - stack.getAmount();
                                    chestData.getSnapshotInventory().setItem(itemPos, stack);
                                    stack.setAmount(stack.getMaxStackSize());
                                    chestData.getSnapshotInventory().getItem(c).setAmount(chestData.getSnapshotInventory().getItem(c).getAmount()-distance);
                                }else {
                                    stack.setAmount(stack.getAmount() + chestData.getSnapshotInventory().getItem(c).getAmount());
                                    chestData.getSnapshotInventory().getItem(itemPos).setAmount(stack.getAmount());
                                }
                            }
                            
                            
                        }
                    }

DAnke im Vorraus!!

Computer, Programmieren, Java, Minecraft, Minecraft Server, Spigot, Minecraft plugin, Minecraft Plugins programmieren, Spiele und Gaming
1 Antwort
Was mache ich Falsch?

[14:05:47 ERROR]: Could not load 'plugins\Signieren.jar' in folder 'plugins'

org.bukkit.plugin.InvalidPluginException: main class `de.flavius.signieren.main.Main' does not extend JavaPlugin

    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:73) ~[spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:739) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]

    at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]

Caused by: java.lang.ClassCastException: class de.flavius.signieren.main.Main

    at java.lang.Class.asSubclass(Unknown Source) ~[?:1.8.0_261]

    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:71) ~[spigot.jar:git-Spigot-db6de12-18fbb24]

    ... 15 more

Minecraft server plugin, Minecraft Plugins programmieren
1 Antwort
Minecraft Plugin programmieren, EntityDamageByEntityEvent?

Hallo zusamen.

Ich Programmiere gerade ein Bedwars Plugin, jedenfalls habe ich jetzt lange rum probiert und schaffe es nicht, dass sich zwei, welche im Gleichen Team sind, keinen schaden gegenseitig machen. Jeder Spieler ist in einer Liste gespeichert die mit Teams.get... aufgerufen wird. Ich möchte gerne wissen wo der Fehler ist.

Danke im voraus.

@EventHandler

public void onDamage(EntityDamageEvent e) {

if(e.getEntity() instanceof Villager){

e.setCancelled(true);

}else if(e.getEntity() instanceof Player) {

if(Arena.getState().equals(GameState.COUNTOWNBEGIN) || Arena.getState().equals(GameState.JOIN) || Arena.getState().equals(GameState.END)) {

e.setCancelled(true);

}else {

e.setCancelled(false);

}

if(e.getCause().equals(DamageCause.VOID)) {

e.getEntity().teleport(Config.getwarteraum());

}

}

}

@EventHandler

public void MCvoid(Void e) {

}

@EventHandler

public void onPlayerdamage(EntityDamageByEntityEvent e)

if(e.getEntity() instanceof Player) {

Player p = (Player) e.getEntity();

Player pk = (Player) e.getDamager();

if(Teams.getListAqua().contains(p)) {

if(Teams.getListAqua().contains(pk)) {

e.setCancelled(true);

}else {

e.setCancelled(false);

}}else if(Teams.getListMagenta().contains(p)) {

if(Teams.getListMagenta().contains(pk)) {

e.setCancelled(true);

}else {

e.setCancelled(false);

}}else if(Teams.getListRed().contains(p)) {

if(Teams.getListRed().contains(pk)) {

e.setCancelled(true);

}else {

e.setCancelled(false);

}}else if(Teams.getListViolet().contains(p)) {

if(Teams.getListViolet().contains(pk)) {

e.setCancelled(true);

}else {

e.setCancelled(false);

}}}}}

Minecraft, Minecraft server plugin, minecraft spigot, Minecraft Plugins programmieren
1 Antwort
Minecraft: Fehlercode beim starten des servers (Plugin)?

Hey,

Ich habe heute mal ausprobiert ein Plugin für Minecraft zu programmieren. Ich schaue mir dazu Videos auf YouTube an. In der ersten Testphase, um zu überprüfen, ob das Plugin vom Server erkannt wird, sollte in der Konsole ein Text angezeigt werden. Jedoch steht dann da irgendwo mittendrin "Could not load...". Da ich mich früher NOCH NIE mit Java-Script befasst habe, weiß ich auch nicht, was ich falsch gemacht habe! Ich hoffe ihr könnt mir helfen...

Ps. Der Name des Plugins ist "TestPlugin"

Hier der Fehlercode:

Plugin TestPlugin v1.0 does not specify an api-version.

[20:37:20 ERROR]: Could not load 'plugins\MyTestPlugin.jar' in folder 'plugins'

org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: de/laurin/test/main/Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

   at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:139) ~[spigot.jar:git-Spigot-800b93f-8160e29]

   at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:334) ~[spigot.jar:git-Spigot-800b93f-8160e29]

   at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:253) [spigot.jar:git-Spigot-800b93f-8160e29]

   at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:351) [spigot.jar:git-Spigot-800b93f-8160e29]

   at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:203) [spigot.jar:git-Spigot-800b93f-8160e29]

   at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:784) [spigot.jar:git-Spigot-800b93f-8160e29]

   at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]

Caused by: java.lang.UnsupportedClassVersionError: de/laurin/test/main/Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

   at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_251]

   at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.8.0_251]

   at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.8.0_251]

   at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:142) ~[spigot.jar:git-Spigot-800b93f-8160e29]

   at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:92) ~[spigot.jar:git-Spigot-800b93f-8160e29]

   at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251]

   at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251]

   at java.lang.Class.forName0(Native Method) ~[?:1.8.0_251]

   at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_251]

   at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:60) ~[spigot.jar:git-Spigot-800b93f-8160e29]

   at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot.jar:git-Spigot-800b93f-8160e29]

   ... 6 more

Java, JavaScript, Minecraft, fehlercode, Minecraft Server, Plug-in, Minecraft Plugins programmieren, Spiele und Gaming
2 Antworten
Minecraft plugin scheduler?

Hallo leute, sobald ich zwei cooldowns parallel am laufen habe, und einer durch ist, gibt es beim zweiten cooldown folgende errormeldung. Weiß jemand wo das Problem ist?:

java.lang.NullPointerException
    at de.johannes.hcfabilitys.main.ABILITYT$1.run(ABILITY.java:101) ~[?:?]
    at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
    at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]

Hier der code:

public static void inGameCountDown(Player p, Player t) {
tp = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(), new Runnable() {
@Override
public void run() {
System.out.println("Activating run for: " + p.getName());
if(cooldown.get(p) == null) {
returnInventory(p, t);
Bukkit.getScheduler().cancelTask(tp);
}
if (cooldown.get(p) == 1) {
System.out.println("Canceling cooldown for: " + p.getName());
Bukkit.getScheduler().cancelTask(tp);
cooldown.remove(p);
returnInventory(p, t);
}
if(cooldown.containsKey(p)) {
int c = cooldown.get(p);
c--;
System.out.println("Hashmap contains key for: " + p.getName() + "   " + c);
cooldown.put(p, c);
}
}
}, 20, 20);
}
Java, Bukkit, Spigot, Minecraft plugin, Minecraft Plugins programmieren
1 Antwort
[09:03:02 ERROR]: Error occurred while enabling plugin v1.0 (Is it up to date?) java.lang.NullPointerException?

Hallo seit kurzem habe ich das Problem das mein Chatclear Command nicht geht. Beim Start kommt diese Fehlermeldung:

[09:03:02 ERROR]: Error occurred while enabling plugin v1.0 (Is it up to date?)

java.lang.NullPointerException

    at de.name.plugin.main.Main.onEnable(Main.java:25) ~[?:?]

    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugin(CraftServer.java:356) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.enablePlugins(CraftServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.reload(CraftServer.java:746) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.Bukkit.reload(Bukkit.java:534) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchServerCommand(CraftServer.java:632) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at net.minecraft.server.v1_8_R1.DedicatedServer.aM(DedicatedServer.java:353) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:317) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]

    at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]

Der Command ist in der plugin.yml und in der Main eingetragen. Eclipse selber erkennt auch keinen Fehler

PC, Technik, Java, Command, Eclipse, Error, Minecraft Plugins programmieren
1 Antwort
Minecraft Plugin Error entfernen?

Hallo.

Ich habe ein Minecraft Plugin in der 1.14 ein bisschen umgeschrieben (nur 1 oder 2 Nachrichten).

Jetzt kommt immer diese Meldung:

[19:48:39 ERROR]: Error occurred while enabling Manager v.3.0 (Is it up to date?)

java.lang.Error: Unresolved compilation problems:

    mplayer cannot be resolved to a variable

    mplayer cannot be resolved to a variable

    mplayer cannot be resolved to a variable

    at me.h1dd3nxn1nja.chatmanager.hooks.HookManager.loadDependencies(HookManager.java:52) ~[?:?]

    at me.h1dd3nxn1nja.chatmanager.Main.onEnable(Main.java:28) ~[?:?]

    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.14.4.jar:git-Paper-174]

    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:338) ~[patched_1.14.4.jar:git-Paper-174]

    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:420) ~[patched_1.14.4.jar:git-Paper-174]

    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugin(CraftServer.java:467) ~[patched_1.14.4.jar:git-Paper-174]

    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugins(CraftServer.java:381) ~[patched_1.14.4.jar:git-Paper-174]

    at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:474) ~[patched_1.14.4.jar:git-Paper-174]    at net.minecraft.server.v1_14_R1.DedicatedServer.init(DedicatedServer.java:290) ~[patched_1.14.4.jar:git-Paper-174]

    at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:870) ~[patched_1.14.4.jar:git-Paper-174]

    at java.lang.Thread.run(Unknown Source) [?:1.8.0_211]

Wie kann ich das verhindern?

Technik, Java, Minecraft, Eclipse, Minecraft Server, Minecraft plugin, Minecraft server plugin, Minecraft Plugins programmieren, Minecraft 1.14
2 Antworten

Meistgelesene Fragen zum Thema Minecraft Plugins programmieren