HashMap issue in a guild plugin?

Discussion in 'Plugin Development' started by Gonmarte, Nov 13, 2015.

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

    mcdorli

    Wait wait, what? Did you miss out ","-s?
     
  2. Offline

    Gonmarte

  3. Offline

    mcdorli

    BTW.: Did you run your code? If yes, then what was the outcome, was there any errors? If yes, then please post them, and your whole classes
     
  4. Offline

    Scimiguy

    You realise you didn't give us your stacktrace right
     
  5. Offline

    Gonmarte

    @Scimiguy I did, i dotnt know why it dissapear, ill try to post it again
    @mcdorli No errors when the plugin has been enabled, just with the commands, ill try to post the stacktrace again
     
  6. Offline

    mcdorli

    The whole stack-trace:
    start the server, log in, use the command, log out, stop the server, then post the stack-trace, from the beginning to the end, not just the errors
     
  7. Offline

    Gonmarte

  8. Offline

    mcdorli

    offline mode not supported
    Code:
    [14:26:04] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
    
    @timtower bitte lock, danke
     
  9. Offline

    Scimiguy

    I just reported it, like you should have.

    Though I'm not sure the fact that it's running in offline mode should affect the current thread, since they're unrelated


    @Gonmarte
    We can't solve errors without classes.
    Your error is in your Commands class, line 24
     
  10. Offline

    Gonmarte

    @mcdorli Im going to post another in online mode

    @Scimiguy I have already put the class

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 20, 2015
  11. Offline

    Xerox262

    Read the forum rules, offline mode is not supported it implies piracy since you do not need an official account to use it, regardless of relevance to the problem the thread will be locked for it. P.S. The command class is on page 2.

    You're getting the player without checking the arguments length.

    You should really format your code it's incredibly hard to read. If you're using IntelliJ click on Code > Reformat Code (Default Shortcut is CTRL+ALT+L) if you're on eclipse then it's Source > Format (Default shortcut is CTRL + SHIFT + F) please post another stack trace so we can see what the actual error is and the formatted class so we can know what is on what line.
     
  12. Offline

    Gonmarte

    @Xerox262
    @timtower
    I swear for god that i have an official account called Gonmarte. Yo can check Its mine. I was using ofline mode because i dont have the official launcher of minecraft in my grandfather pc, so i was using the pirate launcher. but i have a premioun account!

    In pastebin the code is not formated?
     
  13. Offline

    Xerox262

    I didn't say you don't, I was telling @Scimiguy why it's not allowed on the site, also if you had the time to download the pirate launcher why did you not have the time to download the official one?

    Edit: Oops, didn't see the paste bin link. Apologies. It's not the full class though, you removed the package declaration and all imports, while they might not be helpful themselves they add on extra lines and we don't know how many you have.
     
  14. Offline

    Gonmarte

    @Xerox262 Because i bought minecraft like 6 months ago, and i play minecraft over then 3 years so i had the pirate launcher in there.
    I see, im going to post everythin.
    PS: I think i found out the error, i didnt add supress warnings decrepted to the getPlayer(); Ill try if the error is gone.
     
  15. Offline

    Xerox262

    Supressing deprecation doesn't change the error, it just means it wont flag the warning in your IDE. Odds are it's an ArrayOutOfBounds exception because you're getting the second argument without checking if there is one, however you could be getting a NullPointer.

    And if you've had the offline mode problem before then why not just download the official launcher, I assume it's more time consuming to have to remake your thread every time it gets locked rather than just going on minecraft.net and clicking download. You're gonna get to a point where you'll have to be approved everytime you make a post, which will be a problem when there's no staff online to approve it.
     
  16. Offline

    timtower Administrator Administrator Moderator

    @mcdorli Use the report button for moderator stuff. Told you that before. No need to post about it.
    @Gonmarte Get rid of the pirate launcher please
     
    Xerox262 likes this.
  17. Offline

    Gonmarte

    @Xerox262 Im going to do it. U were right it didnt changed anything.
    StackTrace
    While i was attempting to run the command /clan in the server it shoed in the conolse this error and i got a red warning message in the game.
    Code:
    [15:13:06] [Server thread/ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'clan' in plugin Clans v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:196) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServer.java:542) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.PlayerConnection.handleCommand(PlayerConnection.java:932) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java:814) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.PacketPlayInChat.a(PacketPlayInChat.java:28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.PacketPlayInChat.handle(PacketPlayInChat.java:47) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:655) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:250) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at Clans.ClanCommands.Commands.onCommand(Commands.java:25) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        ... 13 more
    
    
    
    Commans Class:
    http://pastebin.com/Lf4bM2Vq
    The error was in line 25, i dont know what is the problem of that variable...
     
  18. Offline

    mcdorli

    There is only 1 people in the server, am I right?
     
  19. Offline

    Xerox262

    I already posted the answer to your problem in a reply before, it's getting more and more clear that you have little understanding/no knowledge of Java and you should really invest more time into it if you want to create better working Bukkit plugins (not an attempt to bully, an opinion)

    Why would that change his Bukkit.getPlayer(args[1]);? Unless you mean because it would return null but that wouldn't throw an error on line 25
     
  20. Offline

    Gonmarte

    @mcdorli Yes

    @Xerox262 Firstoble , u dont have any agurment to say anything abuot my knowledge in java. Second you didnt say to me what is the error...
     
  21. Offline

    mcdorli

    Basic programming knowledge about modern, non-scripting languages (because for example lua actually works differently)

    in an array, the 0(zero)th element is the first one, and the 1st element is the second one

    Player target = Bukkit.getServer().getPlayer(args[1]);

    You want to get the second player on the server , but there isn't any. And no, @Xerox262 does have arguments to say something about your java knowledge, because this is basic java, that you don't know.
     
  22. Offline

    Gonmarte

    @mcdorli But it is the String array, so im getting the args array not the player one
     
  23. Offline

    mcdorli

    Then args[1] is null, or there is no player like that.
     
  24. Offline

    Xerox262

    It was an ArrayOutOfIndexException, one of the reasons I said he probably does not have baisc Java knowledge since it's an exception that you would handle many times BEFORE you start messing with the Bukkit API.
     
  25. Offline

    mcdorli

    Yes it is.

    @Gonmarte What I said before about the arrays is still counts. args only contains the words after the command

    /command args contains these words only

    Either you don't know what the first argument is, or you didn't do a null check
     
  26. Offline

    Gonmarte

    @mcdorli im going to try to fix that, ill test and then share with you the results

    @mcdorli @Xerox262
    The /clan command is working but the others are bugged, it just return the message clan, the only wanna that works is the /clan leave. when i run this command it shows a message saying : Nao tens clan ( in english means, you dont have a clan). So the leave command its working because it detected that he didnt had a clan but all the others just return the message clan ...
    Im going to post the ClansManager class

    Commands:
    http://pastebin.com/Lf4bM2Vq

    ClansManager class ( this is the class that i have to store all the methods/informations of the clans):

    http://pastebin.com/mbhzZyu4

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Nov 20, 2015
  27. Offline

    Gonmarte

  28. Offline

    Xerox262

    We told you your problem though... You're missing a second argument, it's basic Java.
     
  29. Offline

    Gonmarte

    @Xerox262 But if i dont know what is the second argument i cant put it do you understand? The second argument, is, foe e.g the clan that players wants to create i cant check what the argument s cuz i dont know!
     
  30. Offline

    Scimiguy

    @Gonmarte
    Then check that in your code and stop the rest of it from running if you don't have a second argument
     
Thread Status:
Not open for further replies.

Share This Page