Solved BukkitAdapter is not visible?

Discussion in 'Spigot Plugin Development' started by Wilsoon, Jan 17, 2020.

Thread Status:
Not open for further replies.
  1. So yeah, I know what "is not visible" means, but why though, I have added Worldedit-bukkit as a dependency and repository. However:

    Code (Java):
    package com.gmail.calorious.wergteleport;

    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.*;
    import com.sk89q.worldedit.bukkit.*;
    import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
    import com.sk89q.worldedit.bukkit.selections.*;

    public class EventHandling implements Listener {
        public static boolean enabled = true;
        BukkitAdapter adapter = getAdapter();
        @EventHandler
        public void onPlayerMove(PlayerMoveEvent e) {
            Player player = BukkitAdapter.adapt(player);
            if (enabled == true) {
               
            } else {
                player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Entered a set region, no action. Reason: Not Enabled");
            }
        public void setEnabled(boolean enabled) { EventHandling.enabled = enabled; }
    }
    Everytime I have the "BukkitAdapter", it says it is not visible, is there a reason for this?
     
    • Useful Useful x 1
  2. Where is getAdapter ?
     
  3. Idk, that's useless, so I'll remove that part. As for BukkitAdapter though
     
  4. Try use wg, it maybe contains the bukkitAdapter class
     
  5. Nope still nothing.
     
  6. md_5

    Administrator Developer

    That line isn't even valid Java???
     
  7. I'm quite new to Java, this is considered my first listener plugin I'm trying out, all I want is for Worldedit's API to work, the documentation doesn't really say anything about this, so I chose to post it here.
     
  8. I would highly recommend to write some own plugins before attempting to use another devs api.
    (I myself always treat them as if they where a broken mess)

    This is a documentation with examples and everything:
    https://worldedit.readthedocs.io/en/latest/api/

    Its not super easy to understand.
    You need to understand most principles of object oriented programming before using it.
    Just write some code yourself first.

    PS this:
    Code (Text):
    bukkit.*;
    Is a nono unless you are using windows editor to write your code...
     
  9. Hmm ok, thanks! I've done a few of my own plugins, but none of them had a listener in it as I found that kinda confusing. Thanks again!
     
  10. Roughly solved, I'ma close this. I think it worked
     
Thread Status:
Not open for further replies.