MoopleDev - What do you think of my java thinking skills and this command?

Results 1 to 5 of 5
  1. #1
    Newbie TreesN is offline
    MemberRank
    Jun 2013 Join Date
    21Posts

    MoopleDev - What do you think of my java thinking skills and this command?

    Hello again, before I continue I just wanna say I'm new java and MapleStory development in general.

    So I made this command for GM's and basically what its supposed to do... is for the GM to type /jguild VictimsNameWhosGuildYouWantToJoin and it would make the victim send an invite to you for their guild or something along those lines.. lmao.

    So.. I'm not even sure if this works because I have no one to test it with lol. So if you guys could tell me if it would work fine and what you think of my java thinking skills? ...

    Code:
    case "jguild": {
     
         MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]);
         MapleGuild.sendInvite(victim.getClient(), player.getName());
         player.getMap().removePlayer(c.getPlayer());
         player.getMap().addPlayer(c.getPlayer());
         player.message("Done.");
                    
         break;
                
    }
    Like I said I'm not that good.. I'm horrible. This command probably doesn't make any sense but I gave it my best try. I will continue to learn! Also if you know how to fix it please give me ideas but don't spoon feed. Thank you.


  2. #2
    I'm overrated. Fraysa is offline
    Grand MasterRank
    Apr 2008 Join Date
    4,889Posts

    Re: MoopleDev - What do you think of my java thinking skills and this command?

    Quote Originally Posted by TreesN View Post
    Hello again, before I continue I just wanna say I'm new java and MapleStory development in general.

    So I made this command for GM's and basically what its supposed to do... is for the GM to type /jguild VictimsNameWhosGuildYouWantToJoin and it would make the victim send an invite to you for their guild or something along those lines.. lmao.

    So.. I'm not even sure if this works because I have no one to test it with lol. So if you guys could tell me if it would work fine and what you think of my java thinking skills? ...

    Code:
    case "jguild": {
     
         MapleCharacter victim = c.getWorldServer().getPlayerStorage().getCharacterByName(sub[1]);
         MapleGuild.sendInvite(victim.getClient(), player.getName());
         player.getMap().removePlayer(c.getPlayer());
         player.getMap().addPlayer(c.getPlayer());
         player.message("Done.");
                    
         break;
                
    }
    Like I said I'm not that good.. I'm horrible. This command probably doesn't make any sense but I gave it my best try. I will continue to learn! Also if you know how to fix it please give me ideas but don't spoon feed. Thank you.
    Hey TreesN.

    First of all, I haven't looked at MoopleDEV for a while, so I don't know if Kevin uses switch for the commands. Much more organized that way. Anyways, to use the sendInvite command, you have to use the victim's client in the first argument, and in the second - the victim you're trying to send it to, well, yourself.

    I don't know if it will work, but to use it, you will have to use:

    Code:
    victim.getGuild().sendInvite(victim.getClient(), player.getName());
    You can't call MapleGuild.sendInvite, it won't work. You have to call it using the getGuild, because then it matches the functions in MapleGuild to the specific guild of the player you're calling it to, that's why I use victim.getGuild.

    Also, the sendInvite command (which I'm not sure will work, but heck why not) uses the client of the inviter and the target player to invite. That's why I used "victim.getClient()" - because he is "inviting" you, and "player.getName()" - because that's you.

    Good luck on further development, my friend.

  3. #3
    Newbie TreesN is offline
    MemberRank
    Jun 2013 Join Date
    21Posts

    Re: MoopleDev - What do you think of my java thinking skills and this command?

    Thanks for the reply, MoopleDev only uses switch for player commands and admin commands, I did all the GM ones because its easier for me :P Took forever but worth it. I see what you mean for victim.getGuild() makes sense. I understand more clearly now in regards to victim.getClient() and player.getName(). Thank you!

    edit; also yeah, the .sendinvite doesn't work with getGuild(). I will try and figure something out.

  4. #4
    I'm overrated. Fraysa is offline
    Grand MasterRank
    Apr 2008 Join Date
    4,889Posts

    Re: MoopleDev - What do you think of my java thinking skills and this command?

    Quote Originally Posted by TreesN View Post
    Thanks for the reply, MoopleDev only uses switch for player commands and admin commands, I did all the GM ones because its easier for me :P Took forever but worth it. I see what you mean for victim.getGuild() makes sense. I understand more clearly now in regards to victim.getClient() and player.getName(). Thank you!

    edit; also yeah, the .sendinvite doesn't work with getGuild(). I will try and figure something out.
    Really? It should. You can also use getGuild().addPlayer.

  5. #5
    Newbie TreesN is offline
    MemberRank
    Jun 2013 Join Date
    21Posts

    Re: MoopleDev - What do you think of my java thinking skills and this command?

    Ah, I think I figured it out!
    Code:
    victim.getGuild().addGuildMember(player.getMGC());
    addGuildMember is supposed to be MapleGuildCharacter mgc - int, so I tried getting some sort of id, which ended up being player.getMGC(). Hopefuly that's better now! Thanks again.

    edit; doesn't work, I'm gonna try getting guild id from victim then set guild id to myself or something.
    Last edited by TreesN; 03-07-13 at 01:32 AM.



Advertisement