sending players between servers by click villager

Discussion in 'Plugin Development' started by Arbuz3k, May 23, 2020.

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

    Arbuz3k

    this is my code, im new in cooding
    Code:
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Villager;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEntityEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import net.md_5.bungee.api.ProxyServer;
    import net.md_5.bungee.api.config.ServerInfo;
    import net.md_5.bungee.api.connection.ProxiedPlayer;
    
    public class Main extends JavaPlugin implements Listener{
    
        @EventHandler
        public void onPlayerInteractEntityEvent(PlayerInteractEntityEvent e) {
            Player l = e.getPlayer();
            ProxiedPlayer player = (ProxiedPlayer) l;
            Entity entity = e.getRightClicked();
    
            if (!(entity instanceof Villager)) {
                return;
            }
    
            if (!entity.getName().contains("Dirt") && !entity.getCustomName().contains("Dirt")) {
                return;
            }
    
            ServerInfo target = ProxyServer.getInstance().getServerInfo("Arena");
            player.connect(target);
            }
    }
     
    Last edited by a moderator: May 24, 2020
  2. Online

    timtower Moderator Moderator

    @Arbuz3k You did not register the event in your onEnable
     
  3. Offline

    Arbuz3k

    now i have error

    [14:06:23 ERROR]: Could not pass event PlayerInteractEntityEvent to teleportserver v1.0
    java.lang.NoClassDefFoundError: net/md_5/bungee/api/connection/ProxiedPlayer
    at me.anan4sek.server.tp.Main.onPlayerInteractEntityEvent(Main.java:26) ~[?:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.15.2.jar:git-Paper-227]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.15.2.jar:git-Paper-227]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-227]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:2014) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.PacketPlayInUseEntity.a(PacketPlayInUseEntity.java:51) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.PacketPlayInUseEntity.a(PacketPlayInUseEntity.java:6) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.MinecraftServer.ba(MinecraftServer.java:1081) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1074) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1035) ~[patched_1.15.2.jar:git-Paper-227]
    at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:950) ~[patched_1.15.2.jar:git-Paper-227]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]
     
  4. Online

    timtower Moderator Moderator

    Locked
    @Arbuz3k Bungeecord requires offline mode.
    Offline mode is not supported by Bukkit.
     
Thread Status:
Not open for further replies.

Share This Page