WGCustomFlags Plugin Problem

Dieses Thema im Forum "Programmierung" wurde erstellt von Basti07711, 14. April 2014.

  1. Basti07711
    Offline

    Basti07711 Ehem. Teammitglied

    Registriert seit:
    2. August 2012
    Beiträge:
    714
    Ort:
    Hinter dir
    Minecraft:
    Basti07711
    Hi Leute,
    ich schreibe derzeit an einem Plugin, welches Blöcke in einer WorldGuard-Region nach einer bestimten zeit regeneriert. Dazu nutze ich WorldGuard/WorldEdit/WorldGuardCustomFlags. Ich habe mich nach einer Open-Source gerichtet, jedoch funktioniert sie nicht. Ich bekomme diesen Fehler:
    Code (Text):
    1. [15:44:46 ERROR]: Could not load 'plugins\BlockRegen.jar' in folder 'plugins'
    2. org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/sk
    3. 89q/worldguard/protection/flags/Flag
    4.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    5. ava:137) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    6.         at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    7. java:314) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    8.         at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    9. .java:236) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    10.         at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugins(CraftServer.ja
    11. va:355) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    12.         at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.jav
    13. a:135) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    14.         at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    15. :437) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    16.         at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17. 17) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    18. Caused by: java.lang.NoClassDefFoundError: com/sk89q/worldguard/protection/flags
    19. /Flag
    20.         at java.lang.Class.forName0(Native Method) ~[?:1.8.0]
    21.         at java.lang.Class.forName(Unknown Source) ~[?:1.8.0]
    22.         at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.jav
    23. a:40) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    24.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    25. ava:133) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    26.         ... 6 more
    27. Caused by: java.lang.ClassNotFoundException: com.sk89q.worldguard.protection.fla
    28. gs.Flag
    29.         at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0]
    30.         at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0]
    31.         at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0]
    32.  
    33.         at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0]
    34.         at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    35. java:77) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    36.         at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    37. java:62) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    38.         at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0]
    39.         at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0]
    40.         at java.lang.Class.forName0(Native Method) ~[?:1.8.0]
    41.         at java.lang.Class.forName(Unknown Source) ~[?:1.8.0]
    42.         at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.jav
    43. a:40) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    44.         at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    45. ava:133) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    46.         ... 6 more
    Und dies ist meine HauptClass:

    Code (Text):
    1. package me.Basti07711.BlockRegen;
    2.  
    3. import org.bukkit.plugin.Plugin;
    4. import org.bukkit.plugin.java.JavaPlugin;
    5.  
    6. import com.mewin.WGCustomFlags.WGCustomFlagsPlugin;
    7. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
    8. import com.sk89q.worldguard.protection.flags.StateFlag;
    9.  
    10. public class Main extends JavaPlugin{
    11.     public static StateFlag BlockRegen = new StateFlag("BlockRegen", true);
    12.  
    13.     private WorldGuardPlugin wgPlugin;
    14.     private WGCustomFlagsPlugin wgCustPlugin;
    15.     private RegenList listener;
    16.    
    17.     public static custLogger logger = new custLogger("BlockRegen");
    18.     public static custLogger getCustLogger() {
    19.             return logger;
    20.     }
    21.  
    22.     public void onEnable() {
    23.         wgPlugin = getWorldGuard();
    24.         wgCustPlugin = getWGCustomFlags();
    25.  
    26.         if (wgPlugin == null) {
    27.             getLogger().warning("This plugin requires WorldGuard, disabling.");
    28.             getServer().getPluginManager().disablePlugin(this);
    29.             return;
    30.         }
    31.  
    32.         if (wgCustPlugin == null) {
    33.             getLogger().warning("This plugin requires WorldGuard Custom Flags, disabling.");
    34.             getServer().getPluginManager().disablePlugin(this);
    35.             return;
    36.         }
    37.  
    38.         listener = new RegenList(wgPlugin);
    39.         getServer().getPluginManager().registerEvents(listener, this);
    40.  
    41.         wgCustPlugin.addCustomFlag(BlockRegen);
    42.     }
    43.  
    44.     private WorldGuardPlugin getWorldGuard() {
    45.         Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
    46.  
    47.         if ((plugin == null) || (!(plugin instanceof WorldGuardPlugin))) {
    48.             return null;
    49.         }
    50.  
    51.         return (WorldGuardPlugin)plugin;
    52.     }
    53.  
    54.     private WGCustomFlagsPlugin getWGCustomFlags() {
    55.         Plugin plugin = getServer().getPluginManager().getPlugin("WGCustomFlags");
    56.  
    57.         if ((plugin == null) || (!(plugin instanceof WGCustomFlagsPlugin))) {
    58.             return null;
    59.         }
    60.  
    61.         return (WGCustomFlagsPlugin)plugin;
    62.     }
    63. }
    Was habe ich falsch gemacht?
     
    #1
  2. Du solltest einfach in die Plugin.yml depend: [WorldGuard] machen, damit dieses vorher geladen wird.
     
    #2
  3. Basti07711
    Offline

    Basti07711 Ehem. Teammitglied

    Registriert seit:
    2. August 2012
    Beiträge:
    714
    Ort:
    Hinter dir
    Minecraft:
    Basti07711
    Habe ich gemacht, doch nun kommt ein neuer Fehler:

    Code (Text):
    1. [15:05:00] [Server thread/ERROR]: Error occurred while enabling Regeneration v0.1 (Is it up to date?)
    2. java.lang.NullPointerException
    3.     at com.mewin.WGCustomFlags.WGCustomFlagsPlugin.getSaveHandler(WGCustomFlagsPlugin.java:314) ~[?:?]
    4.     at com.mewin.WGCustomFlags.WGCustomFlagsPlugin.loadFlagsForWorld(WGCustomFlagsPlugin.java:185) ~[?:?]
    5.     at com.mewin.WGCustomFlags.WGCustomFlagsPlugin.loadAllWorlds(WGCustomFlagsPlugin.java:174) ~[?:?]
    6.     at com.mewin.WGCustomFlags.WGCustomFlagsPlugin.addCustomFlag(WGCustomFlagsPlugin.java:246) ~[?:?]
    7.     at main.Start.onEnable(Start.java:37) ~[?:?]
    8.     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) ~[spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    9.     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:350) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    10.     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:390) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    11.     at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.java:460) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    12.     at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.java:380) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    13.     at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:348) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    14.     at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:325) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    15.     at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:281) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    16.     at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:186) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    17.     at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:437) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    18.     at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [spigot.jar:git-Spigot-1.7.2-R0.3-122-gb58e277]
    Hier ist mein Listener zu allem:
    Code (Text):
    1. package main;
    2.  
    3. import org.bukkit.Location;
    4. import org.bukkit.Material;
    5. import org.bukkit.World;
    6. import org.bukkit.block.Block;
    7. import org.bukkit.event.EventHandler;
    8. import org.bukkit.event.Listener;
    9. import org.bukkit.event.block.BlockBreakEvent;
    10.  
    11. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
    12.  
    13. public class BlockListner implements Listener{
    14.  
    15.     public BlockListner(WorldGuardPlugin wgPlugin) {
    16.     }
    17.    
    18.       @EventHandler
    19.         public void onBreak(BlockBreakEvent event) {
    20.             Block block = event.getBlock();
    21.             Material type = event.getBlock().getType();
    22.             double x = block.getX();
    23.             double y = block.getY();
    24.             double z = block.getZ();
    25.            
    26.             World world = block.getWorld();
    27.            
    28.             Location loc = new Location(world, x, y, z);
    29.            
    30.             world.getBlockAt(loc).setType(type);
    31.         }
    32. }
    Ich verzweifel langsam :(
     
    #3
  4. Pappi
    Offline

    Pappi Gesperrt

    Registriert seit:
    28. Oktober 2012
    Beiträge:
    141
    Ort:
    H.a.S/NRW/Germany
    Minecraft:
    Pappi / PapaHarni
    Der Fehler ist aber in deiner Hauptklasse

    Code (Text):
    1.  at main.Start.onEnable(Start.java:37)
     
    #4