Inactive [ADMN] JoinCommand | Version 2.0a | Force 'dem commands! [1.1-R3]

Discussion in 'Inactive/Unsupported Plugins' started by Kohle, Nov 24, 2011.

  1. Offline

    shanko

    I get this,

    19.12 15:11:13 [Server] INFO [JoinCommand] A non-player joined the server... what would do that?!
    19.12 15:11:13 [Multicraft] Shanko ran command Message of the Day
    19.12 15:11:13 [Connect] User Shanko IP 174.18.47.234

    It still works perfect though.
     
  2. Offline

    Kohle

    Yes, that is a little thingy-ma-bob I added, caused by this code.
    Code:Java
    1.  
    2. if(!(player == null)) {
    3. System.out.println("[JoinCommand] A non-player joined the server what would do that?!");
    4. }
    5.  

    (Yes, the indentation is off, I'm aware.)

    Does this show up everytime a player logs in...? Otherwise, I have an idea why it is saying that. If you want I could do something else so it doesn't clog up your console.
     
  3. Offline

    shanko

    Yeah it shows up everytime, might have to do with one of my plugins. Doesn't bother me too much :p
     
  4. Offline

    CyrussM

    [SEVERE] Could not pass event PLAYER_JOIN to JoinCommand
    org.bukkit.command.CommandException: Unhandled exception executing command 'totalplaytime' in plugin Playtime v0.4
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:165)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:378)
    at org.bukkit.craftbukkit.entity.CraftPlayer.performCommand(CraftPlayer.java:206)
    at me.kohle.JoinCommand.JoinCommandPlayerListener.onPlayerJoin(JoinCommandPlayerListener.java:33)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:265)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:339)
    at net.minecraft.server.ServerConfigurationManager.c(ServerConfigurationManager.java:129)
    at net.minecraft.server.NetLoginHandler.b(NetLoginHandler.java:113)
    at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:39)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:94)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:527)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    Caused by: java.lang.NullPointerException
    at sl.nuclearw.playtime.playtime.getElapsedTimeLong(playtime.java:286)
    at sl.nuclearw.playtime.playtime.onCommand(playtime.java:185)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
    ... 14 more
     
  5. Offline

    Kohle

    Which CB are you using, what plugins? It may also be something with Playtime, I'll look into this sometime tomorrow.

    Also, sorry for the late response. I'm not getting notifications when someone posts in my thread :/
     
  6. Offline

    lolydodo123

    Could you add maybe add something like..If some one new joined, (AND ONLY NEW PEOPLE) the command only is forced on them, not other players that have already logged in and been through that process?
    thanks

    -lolydodo123
     
  7. Offline

    Nick22

    can you make it for the command is exucuted by the console and add a player variables, so you could do something like
    - give <player> 1 64 And it will give them a stack of stone when they join even if they are not allowed to spawn items.
     
  8. Offline

    Kohle

    Hmmm, might add this, it's not a bad idea.

    Edit: per-player commands almost done, then comes per-group/command group command through a permission node (ex: groups/users with the node "joincommand.1" will perform the commands marked under "1")
     
  9. Offline

    Zelif

    Show Spoiler

    Update to version 0.5 if you have not already, it is saying there is a null pointer at play time which looks to have been solved in 0.5. (It would return no playtime even if you had played) This still might throw a NPE for people who have not yet logged on before but it is indeed a playtime error.

    @Kohle
    When you edit the config file while the server is on it will reset back to what the config had when it loaded.
    So if I had:

    Code:java
    1. Commands:
    2. - time set 0

    Started the server it would load the config into memory(and keep it there). Then changed it to:
    Code:java
    1. Commands:
    2. - time set 13000

    And reloaded, restarted or stopped the server, it would revert back to time set 0.

    When onDisable saves back to the config with the config still in memeory so any changes are reset to either the ones that it loaded up with. So the only way to edit the config is if the server stopped.

    Note:this is what shanko on the first page was talking about. As to make the config you have to start the server, then stop the server, edit the config and then start the again.


    ------------------------------------
    Only a spelling mistake here :p
    Line 20 of Joincommand.java
    Code:java
    1. //See "Creating you're defaults"

    Should say //See "Creating your defaults"
    ------------------------------------

    ------------------------------------
    The null player check always firing.
    Line 27 of JoinCommandPlayerListener.java
    Code:java
    1. if(!(player == null))

    Remove the ! and it will only fire when player = null
    atm it is firing when player don't = null (so everytime someone joins)
    -------------------------------------

    -------------------------------------
    NPE while using it for the first time.
    Line 32 of JoinCommandPlayerListener.java
    Code:java
    1.  
    2. if(!(s == null)) {
    3. for (String s : stuff) {player.performCommand(s);
    4. }
    5. else {
    6. player.sendMessage("No command(s) to send");
    7. // Could use system msg rather then a player one
    8.  
    9. //System.out
    10. //.println( "[JoinCommand] " + name + ": has no command(s) set." );
    11. }
    12.  
    13.  

    This will stop an NPE being generated when there is no command or if you load the config after first creating it, will fix this also.
    -------------------------------------

    If you wish to do a check to see if the player exsists for the first time you will have to use
    onPlayerLogin as the onPlayerJoin comes after creating of a dat file.
    Code:java
    1. public void onPlayerLogin ( PlayerLoginEvent event ) {
    2. Player player = event.getPlayer();
    3. String name = player.getName();
    4. File file = new File( player.getWorld().getName() + "/players/" + name + ".dat" );
    5. boolean exists = file.exists();
    6. if ( !exists ) {
    7. //Call to get FirstSpawnCommands(FSC) if the person has no dat file (first time logging on)
    8. //Have the tag FSC: in the config and the loading into another array.
    9. List<String> stuff = plugin.getConfig().getList("FSC", null);
    10. for (String s : stuff) {player.performCommand(s);}
    11.  
    12. System.out
    13. .println( "[JoinCommand] " + name + ": logged in for first time. " );
    14. }
    15. }

    Credits goto HeroSpawn as I had a snoop and just put details that would support your plugin.
    I'm going to try my hand at resolving some of these either by pull requests or a fork(as the first time visit might not be how you wish to handle it)

    it is either me or JoinCommandPlayerListener.java in the jar is not the same size when I build it from github. After a few hrs wondering why I cannot build it I guess you haven't updated github with the working parts for that ;_; <--- Nvm fixed it. Don't mind me....
     
    Kohle likes this.
  10. Offline

    Kohle

    I love you so so much. Working on the newest version now. I noticed the issue with the ! but never got around to changing it, been too busy working on some other features but thanks, you just sped up production a ton.
     
    Zelif likes this.
  11. Offline

    Zelif

    :D tis fine I changed a few things trying to get
    org.bukkit.OfflinePlayer.hasPlayedBefore
    Since it would be easier then the way I was thinking. It is the last part I have to do.
    I made it so people don't have to restart the server to edit the config, they just have to /reload ;D
    Ill put it to the fork once I have it working.

    Update:
    • I have made it so that 2 lots of lists generate and are read in the config.
    • Reloading (using /reload or plugins like plugman) will work if you edit the config - No need to stop the server now
    • First time someone joins have a seperate command set aswell (didn't think to disable the normal one that can be for another time)
    • Made the default commands tell the admin what they have to do if the defaults are there.
    You can play around with what I have added if you don't want it the way I have done it, hopefully this can go into the other stuff you have been working on.
    Well Was my first time doing something this big only took 7hrs to learn it from the ground up ;D
    Oh and it also works with CB#1708
     
  12. Offline

    C3Minecraft

    I feel that you have possibility to be a great plugin Developer and wanted you to join our plugin Dev team. We work hard and will work with other developers to make great plugins leave me a message if you want to.
     
  13. Offline

    Kohle

    Amazing, really you are :) I'll keep an eye on that fork.
     
  14. Offline

    CyrussM

     
  15. Offline

    Zelif

    I looked at the code for that, and one of the vaules in getElapsedTimeLong is throwing a NPE because the command is issued as player logs in which it uses to calculate how long someone has been on. So when someone logs in one of the values is null.

    It pretty much is the way playtime is coded( it doesn't work on PLAYER_JOIN as it uses apart of that to calculate)
     
    Kohle likes this.
  16. Offline

    Kohle

    Newest version would be out if GitHub could compile the repo for me :p

    Unless some nice kind person *cough @Zelif *cough* would do it for me, it's gonna have to wait until Friday morning.
     
  17. Offline

    Zelif

    https://github.com/downloads/Zelif/JoinCommand/JoinCommand.zip
    For anyone that wishes to get it.



    @Kohle
    If you want to test this one,
    https://github.com/Zelif/JoinCommand/downloads
    download version 1.1-b
    [Just realised a spelling error so 1.1-b tje first command won't work but the rest of it works
    on the plus side too it doesn't throw a NPE :D I fixed the git up so if u wanted to test the first command with permissions too just recompile it.]

    Slight change to the onCommand to prevent people entering hi into the console and added a reload function: /jc-reload

    In doing that I removed /hi2
    I cleaned up my messy part in player join
    Edit: Put basic permissions in
    Nodes
    • JoinCommand.reload: true
    • JoinCommand.FirstCommand: true
    • JoinCommand.NormalCommand: true
    The first link in this post is to the code you wanted me to compile :D
     
  18. Offline

    Kohle

    @Zelif Uhm I'm t0tally stupid with GitHub, is there a way I can somehow make what you have to be my master branch, and can I do it online or do I need to use the GitBash?
     
  19. Offline

    Zelif

    @Kohle
    I'm pretty sure I have no idea, :D I think you know more about it then I do.
    You're talking to someone who learnt to use github and learnt java off your plugin.
    All I do is just copy the code then paste it in. (I'm sure there is a propper way about doing this not just the way I do it)
    God I suck at spelling at 4am
    I think I figured it out I just had to hit the pull request button :D

    you had already done it ;D oh and the only reason why I put a permissions node on first join was so that people could turn it off :D
    I have some code with me making another option to do so and it in the config as a true or false.
    And it seems I left out default to op on the * node >.<
    I'm not sure how you are going to do one for every player.
    But yeah the first join I guess should be done by the console I think as by default lots of people turn everything off for new people, I donno but this is what happens when there is a lack of anime :D
     
    Kohle likes this.
  20. Offline

    Kohle

    Might possibly be coming up in the future, it will be able to be enabled/disabled if added.
    There is now some permissions, so you can decide what group/user can use JoinCommand.
    Added :D Enjoy ~
    Added a feature so certain commands pertain to first time joiners only.

    Hmm, I see why you had that node. I fixed the default to op on the JoinCommand.* node, and for each player I'm going to see if I can have it check if there is a list in the config named <player's name>. If so, perform those commands. Otherwise, create a list named <player's name> and add the default commands... I'm thinking this will work.

    As for the group permissions, say a group was named Group1:JoinCommand.Group1, all people/groups with the node JoinCommand.Group1 will perform the commands in that list. I think I can accomplish this by getting the list names and useing a splitter to see if it is split, not sure if this will work thought, I just thought of it ;) Tomorrow is codeing/testing day for me. All day.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 21, 2016
    kahlilnc likes this.
  21. Offline

    CoolOppo

    Please update this to the latest RB!
     
  22. Offline

    shanko

    there should be a %a that means the player who joined names
    so if a player logs on for the first time we can give them items, or do /say %a welcome to the server!
     
  23. Offline

    shanko

    also will this be updated to R6?
     
  24. Offline

    Kohle

    Hi, I've actually pretty much stopped developing JoinCommand, but as far as I know Zelif will be taking control.
     
  25. Offline

    Zelif

    I have almost finished porting it to R6
    I just have to figure out how to read the config with the new listener system.
    (being new to java doesn't help ;D)
    I will get around to do this within the next 12 - 24 hrs ;D

    shanko
    R6 useable & works in 1.2.3
    https://github.com/downloads/Zelif/JoinCommand/JoinCommand.jar
    This link will always lead to the latest version.
    I removed the updater as I didn't know how it worked ;D
     
  26. Offline

    shanko

    yay! :D Thanks
     
  27. Offline

    Zelif

    Also I will be working on a way to have the commands separate server and player commands.

    I think all first join ones will default to the server or I can make it so the person setting it can choose ?
    This way you wont have to give people permissions to do things like give kits or as u posted the /say command.
    I will have to add what you suggested (the %a) if I were to do server base commands.
    (maybe just a %player% so it is self explanatory)
     
  28. Offline

    MylesIsCool

  29. Offline

    DarklightPvP

    Hmm. Maybe add the ability for the console to perform commands on new players? That would be useful.
     
  30. Offline

    The13thghost23

    Can someone provide me with the download link, because the provided link directs me to a website that is non-related to minecraft at all.
     

Share This Page