Development Assistance dl a Github file + offline player's IP

Discussion in 'Plugin Help/Development/Requests' started by To175, Dec 28, 2014.

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

    To175

    Last edited: Dec 28, 2014
  2. Offline

    To175

  3. Offline

    mrCookieSlime

    Moved to Offtopic (Im open for any suggestions for a more suitable Section)
     
  4. Offline

    To175

  5. Offline

    To175

    @Datdenkikniet Thanks !
    But can you help me please ? I am really lost :'(
    I don't know how to install and where...
    I JUST want to use
    Essentials.getOfflineUser().getLastLoginAddress();

    +@mrCookieSlime
     
  6. you download Essentials on their BukkitDev page, and add it as External Jar. Then you'll be able to use their methods.
     
  7. Offline

    mrCookieSlime

    Definitely not.
     
  8. Offline

    To175

    @Datdenkikniet Thanks you so much !
    But I have this error
    Code:
    Cannot make a static reference to the non-static method getOfflineUser(String) from the type Essentials
    Essentials.getOfflineUser(player).getLastLoginAddress();
    with player as a string
     
  9. @To175 The method isn't static as the error says. Try doing Essentials ess = new Essentials();
     
  10. Offline

    To175

    @bwfcwalshy
    Thanks !
    Now my plugin doesn't load :
    ERROR (open)

    [21:56:50] [Server thread/ERROR]: Could not load 'plugins/Mecraft.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/earth2me/essentials/Essentials
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:341) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:263) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugins(CraftServer.java:369) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.reload(CraftServer.java:864) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.Bukkit.reload(Bukkit.java:301) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Spigot-1642]
    Caused by: java.lang.NoClassDefFoundError: com/earth2me/essentials/Essentials
    at fr.mecraft.Mecraft.MeClass.<init>(MeClass.java:55) ~[?:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[?:1.7.0]
    at java.lang.Class.newInstance0(Class.java:372) ~[?:1.7.0]
    at java.lang.Class.newInstance(Class.java:325) ~[?:1.7.0]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Spigot-1642]
    ... 19 more
    Caused by: java.lang.ClassNotFoundException: com.earth2me.essentials.Essentials
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[?:1.7.0]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[craftbukkit.jar:git-Spigot-1642]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[?:1.7.0]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[?:1.7.0]
    at fr.mecraft.Mecraft.MeClass.<init>(MeClass.java:55) ~[?:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[?:1.7.0]
    at java.lang.Class.newInstance0(Class.java:372) ~[?:1.7.0]
    at java.lang.Class.newInstance(Class.java:325) ~[?:1.7.0]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Spigot-1642]
    ... 19 more

    I choose Essentials.jar as external as @Datdenkikniet asked me to do.
    And I added
    Code:
    import com.earth2me.essentials.Essentials;
     
  11. also put Essentials on your server
     
  12. Moved to Bukkit Alternates as this is now a development issue.
     
  13. Offline

    To175

    @Datdenkikniet Sorry forget to say I have ess jar in my plugin folder yep

    @Datdenkikniet
    Here is my folder
    IMAGE (open)
    [​IMG]


    <Edited by bwfcwalshy: Merged posts, please use the edit button rather than double posting.>
     
    Last edited by a moderator: Dec 28, 2014
  14. @To175 Code for the Main class.
     
  15. Offline

    To175

  16. @To175 By Main class I mean the one considered the 'main' by Bukkit, in this case MeClass.
     
  17. Offline

    To175

  18. Offline

    mrCookieSlime

    *cough* *cough* You don't want to create a new Essentials...
    Essentials ess = Bukkit.getPluginManager().getPlugin("Essentials")
    You better want to get the initialized instance of Essentials instead.
     
    To175 likes this.
  19. Offline

    To175

    @mrCookieSlime
    thanks but
     
  20. Offline

    mrCookieSlime

  21. Offline

    To175

    Thanks it works !
    But I have an other error because of this line (7)... IP = ess.getOfflineUser(player).getLastLoginAddress();
    ERROR (open)

    [23:32:30] [Server thread/ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'mpl' in plugin Mecraft v1
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) ~[craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Spigot-1642]
    Caused by: java.lang.NullPointerException
    at fr.mecraft.Mecraft.MeClass.IsPlayerBanned(MeClass.java:63) ~[?:?]
    at fr.mecraft.Mecraft.MeClass.onCommand(MeClass.java:443) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[craftbukkit.jar:git-Spigot-1642]
    ... 13 more


    Code:
        public Boolean IsPlayerBanned(String player){
            String IP;
            try{
                IP = Bukkit.getServer().getPlayer(player).getAddress().getAddress().getHostAddress();//LADRESSE IP
            }catch(NullPointerException e){
                IP = ess.getOfflineUser(player).getLastLoginAddress();
            }
            //[...]
    I used IsBannedPlayer with "troll32", He went to my server 1 hour ago.

    @mrCookieSlime
    @bwfcwalshy

    @mythbusterma you see mysql is god !! but there is error like ip wutwut

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 31, 2016
  22. Offline

    mythbusterma

    @To175

    I'm not sure what MySQL has to do with this discussion, nor what you mean. Why would you need the IP of an offline player anyway, if you're only doing checks when they log in. Besides, I thought you were going to use SQLite.

    Also, I'm not entirely sure why you tagged me.
     
  23. Offline

    To175

    @mythbusterma Here I use File to store banned players ! :p
    But no matter it doesn't work for the moment :oops:
     
  24. Offline

    mythbusterma

    @To175

    If you're using the file to store their IP, simply iterate over every entry. Or get it from Essentials, I'm really confused as to what the issue is here.
     
  25. Offline

    To175

    @mythbusterma
    Yes you're right.

    oh the issue is just that essentials give me java.lang.NullPointerException on :
    1. IP = ess.getOfflineUser(player).getLastLoginAddress();
    However I have essentials on my server (+in my build path so not any error in eclipse) and player has already connected and disconnected. I'm supposed to have his IP.

    Code:
    Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
    Is it a good cast ? Because the NullPointerException is really weird :(

    EDIT: Thanks to @teej107 (and his "2 years old post" ;) ) I find the solution !
    I test isOnline player ! Like that :
    Code:
    if(Bukkit.getServer().getPlayer(player)==null){
                IP = ess.getOfflineUser(player).getLastLoginAddress();
            }else{
                IP = Bukkit.getServer().getPlayer(player).getAddress().getAddress().getHostAddress();//LADRESSE IP
            }
    New question : do I have to HOOK something ?

    @mrCookieSlime It doest work !

    Code:
          if(Bukkit.getServer().getPlayer(player)==null){
                IP = ess.getOfflineUser(player).getLastLoginAddress();
            }else{
                IP = Bukkit.getServer().getPlayer(player).getAddress().getAddress().getHostAddress();//LADRESSE IP
            }

    IP = ess.getOfflineUser(player).getLastLoginAddress();

    is still NPE
     
    Last edited: Dec 30, 2014
  26. Offline

    To175

    @mrCookieSlime
    I did that !
    import com.earth2me.essentials.Essentials;
    Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
    getLogger().info("ess : "+ess);

    But I have ess = null :'(
    [16:25:54] [Server thread/INFO]: [Mecraft] ess : null
     
Thread Status:
Not open for further replies.

Share This Page