Programm Tpa Plugin bugt

Dieses Thema im Forum "Programmierung" wurde erstellt von Lentry, 24. Mai 2016.

  1. Lentry
    Offline

    Lentry

    Registriert seit:
    15. Mai 2016
    Beiträge:
    39
    Hallo,
    Ich habe ein Tpa Plugin geschrieben. Und ich bekomme ein Feheler wann ich /Tpaccept mache.

    Die Tpa Classe:

    Code (Text):
    1. package de.mtrx.FreeBuild;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.command.Command;
    5. import org.bukkit.command.CommandExecutor;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.entity.Player;
    8.  
    9. public class TPA implements CommandExecutor {
    10.  
    11.     @Override
    12.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    13.        
    14.         Player p = (Player) sender;
    15.        
    16.         if(args.length == 1) {
    17.            
    18.             try{
    19.            
    20.             Player p2 = Bukkit.getPlayer(args[0]);
    21.            
    22.             main.tpa.put(p2, p);
    23.            
    24.             p2.sendMessage("§e " + p.getName() + "§7 mit /tpaccept kannst die amfragen annehmen.");
    25.             p.sendMessage("Die Teleport anfrage wurde angenommen.");
    26.            
    27.            
    28.            
    29.             }
    30.             catch(Exception ex) {
    31.                
    32.                 p.sendMessage("§2Dieser Spieler ist nicht Online.");
    33.                
    34.             }
    35.            
    36.            
    37.         } else {
    38.             p.sendMessage("§c/Tpa Name");
    39.         }
    40.        
    41.        
    42.        
    43.        
    44.        
    45.        
    46.         return true;
    47.     }
    48.  
    49. }
    50.  

    TPACCEPT Classe


    Code (Text):
    1. package de.mtrx.FreeBuild;
    2.  
    3. import org.bukkit.command.Command;
    4. import org.bukkit.command.CommandExecutor;
    5. import org.bukkit.command.CommandSender;
    6. import org.bukkit.entity.Player;
    7.  
    8. public class tpaccept implements CommandExecutor {
    9.  
    10.     @Override
    11.     public boolean onCommand(CommandSender cmd, Command sender, String label, String[] args) {
    12.    
    13.         Player p = (Player) sender;
    14.        
    15.         if(args.length == 0) {
    16.            
    17.    
    18.                
    19.                    Player p2 = main.tpa.get(p);
    20.                  
    21.                    p2.teleport(p.getLocation());
    22.                  
    23.                    p.sendMessage("§cWurde erfolgreich Teleportiert");
    24.                
    25.  
    26.    
    27.            
    28.            
    29.            
    30.            
    31.         } else {
    32.             p.sendMessage("§c/tpaccept");
    33.         }
    34.            
    35.        
    36.        
    37.        
    38.        
    39.         return false;
    40.     }
    41.  
    42. }
    43.  
    LG MTRX
     
    #1
  2. Baba43
    Offline

    Baba43 Ehem. Teammitglied

    Registriert seit:
    5. November 2012
    Beiträge:
    589
    Wie wäre es, wenn du uns den Fehler mitteilst?
     
    #2
  3. Lentry
    Offline

    Lentry

    Registriert seit:
    15. Mai 2016
    Beiträge:
    39
    wann ich tpaccept eingebe passirt das.



    Code (Text):
    1. [17:20:38 INFO]: MTRX issued server command: /tpa ProxyPlayer_
    2. [17:20:44 INFO]: ProxyPlayer_ issued server command: /tpacccept
    3. [17:20:44 ERROR]: null
    4. org.bukkit.command.CommandException: Unhandled exception executing command 'tpacccept' in plugin FreeBuildSystem v1.0
    5.         at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    6.         at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    7.         at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    8.         at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot.jar:git-Spigot-db6de12-18fbb24]
    9.         at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot.jar:git-Spigot-db6de12-18fbb24]
    10.         at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-db6de12-18fbb24]
    11.         at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-db6de12-18fbb24]
    12.         at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-db6de12-18fbb24]
    13.         at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_92]
    14.         at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_92]
    15.         at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot.jar:git-Spigot-db6de12-18fbb24]
    16.         at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot.jar:git-Spigot-db6de12-18fbb24]
    17.         at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-db6de12-18fbb24]
    18.         at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]
    19.         at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]
    20.         at java.lang.Thread.run(Unknown Source) [?:1.8.0_92]
    21. Caused by: java.lang.ClassCastException: org.bukkit.command.PluginCommand cannot be cast to org.bukkit.entity.Player
    22.         at de.mtrx.FreeBuild.tpaccept.onCommand(tpaccept.java:13) ~[?:?]
    23.         at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    24.         ... 15 more

    Wann ich joine kommt das

    Code (Text):
    1. [17:22:09 INFO]: UUID of player ProxyPlayer_ is 9606abd6-5b85-3c59-9efa-a055f6f97e1e
    2. [17:22:09 ERROR]: Could not pass event PlayerJoinEvent to FreeBuildSystem v1.0
    3. org.bukkit.event.EventException
    4.         at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    5.         at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    6.         at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-db6de12-18fbb24]
    7.         at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-db6de12-18fbb24]
    8.         at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:298) [spigot.jar:git-Spigot-db6de12-18fbb24]
    9.         at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:157) [spigot.jar:git-Spigot-db6de12-18fbb24]
    10.         at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [spigot.jar:git-Spigot-db6de12-18fbb24]
    11.         at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [spigot.jar:git-Spigot-db6de12-18fbb24]
    12.         at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [spigot.jar:git-Spigot-db6de12-18fbb24]
    13.         at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [spigot.jar:git-Spigot-db6de12-18fbb24]
    14.         at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:814) [spigot.jar:git-Spigot-db6de12-18fbb24]
    15.         at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-db6de12-18fbb24]
    16.         at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]
    17.         at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]
    18.         at java.lang.Thread.run(Unknown Source) [?:1.8.0_92]
    19. Caused by: java.lang.NoClassDefFoundError: com/connorlinfoot/titleapi/TitleAPI
    20.         at de.mtrx.FreeBuild.Events.onJoin(Events.java:37) ~[?:?]
    21.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
    22.         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
    23.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_92]
    24.         at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_92]
    25.         at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
    26.         ... 14 more
    27. [17:22:09 INFO]: ProxyPlayer_[/127.0.0.1:49210] logged in with entity id 314 at ([world]92.30000001192093, 82.0, 320.95598812792855)
     
    #3
  4. Kronos197
    Offline

    Kronos197

    Registriert seit:
    20. Dezember 2013
    Beiträge:
    153
    Ort:
    Frankfurt
    Minecraft:
    Kronos197
    Bei dem Tpaccept, kannst du nicht einen Command zum Player casten, sondern nur einen CommandSender. Da würde ich aber vorher noch überprüfen ob es überhaupt ein Spieler ist. Kann nähmlich auch die Console oder ein CommandBlock sein.....

    Zu deinem 2. Fehler....
    Du benutzt wahrscheinlich eine API, welche sich jedoch nicht in dem plugins ordner befindet....

    LG
    Kronos197
     
    #4
  5. MiCrJonas
    Offline

    MiCrJonas

    Registriert seit:
    29. Oktober 2012
    Beiträge:
    1.069
    Nenn' mal in der Signatur der Methode onCommand() in tpaccept den CommandSender 'sender' und den Command 'cmd'. Du hast das vertauscht.
     
    #5