Solved Plugin won't load

Discussion in 'Plugin Development' started by Cuvthe3rd, Feb 1, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Cuvthe3rd

    Today i made a plugin that pastes schematics, but then when i did the same thing (useing the exact same code) it didn't work and faild to load the plugin.

    strangly enough, when i remove the bit of code that pastes the file, it loads the plugin:
    Bit of code:
    Code:
    EditSession session = new EditSession(new BukkitWorld(player.getLocation().getWorld()), 200);
                    SchematicFormat schematic = SchematicFormat.getFormat(new File("/plugins/missilewars2/schematics/redtomahawk.schematic"));
                    CuboidClipboard clipboard = schematic.load(new File("/plugins/missilewars2/schematics/redtomahawk.schematic"));
                    clipboard.paste(session, BukkitUtil.toVector(event.getClickedBlock().getLocation()), true);
    
    Class that wont paste:
    Code:
    package me.cuv.mw2;
    
    import java.io.File;
    import java.io.IOException;
    
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    
    import com.sk89q.worldedit.CuboidClipboard;
    import com.sk89q.worldedit.EditSession;
    import com.sk89q.worldedit.MaxChangedBlocksException;
    import com.sk89q.worldedit.bukkit.BukkitUtil;
    import com.sk89q.worldedit.bukkit.BukkitWorld;
    import com.sk89q.worldedit.data.DataException;
    import com.sk89q.worldedit.schematic.SchematicFormat;
    
    @SuppressWarnings("deprecation")
    public class RedMissiles implements Listener{
    
        MainClass plugin;
    
        public RedMissiles(MainClass plugin)
        {
            this.plugin = plugin;
        }
    
        @EventHandler
        public void onPlayerInteract(PlayerInteractEvent event) throws DataException, IOException, MaxChangedBlocksException{
            Player player = event.getPlayer();
    
            if(event.getAction() == Action.RIGHT_CLICK_BLOCK){       
                if(player.getItemInHand().getType() == Material.DIAMOND){
                    event.setCancelled(true);
                   
                    EditSession session = new EditSession(new BukkitWorld(player.getLocation().getWorld()), 200);
                    SchematicFormat schematic = SchematicFormat.getFormat(new File("/plugins/missilewars2/schematics/redtomahawk.schematic"));
                    CuboidClipboard clipboard = schematic.load(new File("/plugins/missilewars2/schematics/redtomahawk.schematic"));
                    clipboard.paste(session, BukkitUtil.toVector(event.getClickedBlock().getLocation()), true);
                }
            }
        }
    }
    
    Console error:
    http://pastebin.com/ugfQpr93
     
  2. Offline

    PreFiXAUT

    @Cuvthe3rd Line 20 of your Stacktrace: java.lang.NoClassDefFoundError: com/sk89q/worldedit/LocalWorld

    Apparently you dont have World-Edit installed
     
  3. Offline

    Cuvthe3rd

    @PreFiXAUT Worldedit is installed on my server
     
  4. Offline

    nverdier

    @Cuvthe3rd Perhaps you have two different versions? Use the same jar file for both your server and in the build path.
     
  5. Offline

    Cuvthe3rd

    @nverdier I have checked that, the plugin and the server both use the exact same version.
     
  6. Offline

    nverdier

    @Cuvthe3rd I mean of worldedit. Is your library and plugin for worldedit the same version?
     
  7. Offline

    Rocoty

    @Cuvthe3rd also make sure that your plugin loads after world edit by adding a depend clause in your plugin.yml.
     
  8. Offline

    Cuvthe3rd

    @nverdier They use the exact same version of worldedit

    @Rocoty Thanks, that seems to work now <3
     
    Last edited by a moderator: Feb 2, 2015
Thread Status:
Not open for further replies.

Share This Page