Thread: [718] Help With Setting Rights To Commands (Matrix) [718] *NEW USER*

Results 1 to 8 of 8
  1. #1 [718] Help With Setting Rights To Commands (Matrix) [718] *NEW USER* 
    Registered Member
    Join Date
    Jul 2014
    Posts
    5
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hi everyone.

    This is my very first post, so try not to go crazy on me.

    I recently got my hands on the Matrix 718 package and I want to start making something from it. I've been looking at a few posts on the very basics of starting a server and what not, and it all seems pretty simple. But i have a question that's been bugging me for the past couple of hours.

    First, since Matrix is a spawn server, it has commands for setting levels, banking from anywhere, and of course, spawning items. There's plenty more commands, but I can't think of anymore from the top of my head.

    Anyways, here's my question: How and where do I set rights for these commands? I've looked at a couple of posts about putting "if (player.getRights() >= 2)" right under the "if (cmd.length < 2) {" like this:

    Code:
    case "item":
    if (cmd.length < 2) {
    if (player.getRights() <= 2)
    player.getPackets().sendGameMessage(
    "Use: ::item id (optional:amount)");
    return true;
    }
    Is that even the correct way to write the code? Is that the only place I need to put it? Does a regular player right have anything to do with it?

    Also, I went to the "::admin" command from Commands.java and changed the usernames that were allowed to use it to mine. I did that instead of putting my name into the player.java because there were a bunch of posts saying that doing it in player.java never worked. Should I possibly change what right the "::admin" command gives?

    But overall, it's been bugging me for the day now and I decided to make an account and ask all of you.

    ----------------------

    Sorry for the really basic question. I'm fairly new to Java and development. Some guidance would really help.

    ----------------------

    Thanks a lot
    Reply With Quote  
     

  2. #2  
    Donator


    Join Date
    Jul 2011
    Posts
    570
    Thanks given
    135
    Thanks received
    142
    Rep Power
    291
    Hello, it's nice seeing new members ^.^ I will try and help you as best as I can. Setting rights is restricting the command to players with those rights. The basic rights are: Right 1 = Mod; Right 2 =Admin. To restrict commands to specific rights you'll have to create an "if-else" statement. It's pretty self explanatory, if these requirements are met, do this, or else do this. For your item command, or any command, if you want to limit it to admins or greater you would do something like this :

    Code:
    case "item": 
    if (cmd.length<2) {
    if (player.getRights() >=2 ) {
    do this
         }
    }
    else 
    do this
    return true;
    I don't have the command in front of me so I may be wrong.

    But anyways in Matrix there's sections where you can place your commands, if you place it in the "processAdmincommands" method it'll be admins only, if you place it in the "processNormalCommands" method or something like that (I don't remember the name) it'll be for normal players+. So what you're trying to do is pretty much unneeded, seeing as you can do it like that

    Hope I helped.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jul 2014
    Posts
    5
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Thanks for responding man

    Really glad you took the time to explain that all to me. I was clueless on what to do when I realised that what I was trying wasn't working.

    When I took a first look at the entire Commands.java code, I had no idea what I was actually looking at. All i did was search for the "item" case and just put "if (player.getRights() <= 2)" where ever I saw the command first. I took very little consideration into public static boolean. I was completely oblivious to seeing the SAME command in TWO different booleans until now. one was in the processNormalCommand, and I bet you can guess where the other one was . All i had to do was delete the one from the NormalCommand area and it worked perfectly! No need to add the "if, else" to it at all. Thanks a lot for your response. Greatly appreciated ^_^
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2018
    Posts
    4
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hello, I am also interested in the matrix 718 server/client. I would like to make it an eco server with no spawn, but i cant find the commands.java
    If someone is willing, I would still like help. Ill post a screenshot of what I'm looking at.






    or maybe not. It won't let me. It's march 2018, eclipse IDE for Java developers.

    I go to src, then scroll though looking for something along the lines of commands.java or command.java, and nothing. Any help?
    Reply With Quote  
     

  5. #5  
    Registered Member
    Ebp90's Avatar
    Join Date
    Apr 2018
    Posts
    238
    Thanks given
    18
    Thanks received
    158
    Rep Power
    878
    Quote Originally Posted by Dmonsta View Post
    Hello, I am also interested in the matrix 718 server/client. I would like to make it an eco server with no spawn, but i cant find the commands.java
    If someone is willng, I would still like help. Ill post a screenshot of what I'm looking at.






    or maybe not. It won't let me. It's march 2018, eclipse IDE for Java developers.

    I go to src, then scroll though looking for something along the lines of commands.java or command.java, and nothing. Any help?
    Check in player.java
    Reply With Quote  
     

  6. #6  
    Registered Member
    excl150's Avatar
    Join Date
    Jul 2014
    Posts
    123
    Thanks given
    46
    Thanks received
    30
    Rep Power
    97
    Quote Originally Posted by Dmonsta View Post
    Hello, I am also interested in the matrix 718 server/client. I would like to make it an eco server with no spawn, but i cant find the commands.java
    If someone is willng, I would still like help. Ill post a screenshot of what I'm looking at.






    or maybe not. It won't let me. It's march 2018, eclipse IDE for Java developers.

    I go to src, then scroll though looking for something along the lines of commands.java or command.java, and nothing. Any help?
    Matrix 718 must have a Commands.java, try to look in the player package.
    If you can't find it go to the source folder and search for it.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    May 2018
    Posts
    4
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    yep found it in com.rs.game.player.content

    thanks guys
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    May 2018
    Posts
    4
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    okay... I seriously don't understand how.
    I have deleted this line of code, tried to restrict it to (player.getRights >=2 )

    but to no avail. I tried to delete my public static boolean for processNormalCommand, and that just breaks my commands so even I, as owner, cannot do any commands.

    case "item":
    if (cmd.length < 2) {
    player.getPackets().sendGameMessage(
    "Use: ::item id (optional:amount)");
    return true;


    i've even done it like this:

    case "item":
    if (cmd.length < 2)
    if (player.getRights () > = 2) {
    player.getPackets().sendGameMessage(
    "Use: ::item id (optional:amount)");
    return true;

    and like this:

    case "item":
    if (cmd.length < 2) && (player.getRights () > = 2) {
    player.getPackets().sendGameMessage(
    "Use: ::item id (optional:amount)");
    return true;

    Either way, it just doesnt work for me. Normal players can still spawn. Also, if I just delete case "item" it'll either, break my coding, or, if i fix it, normal players can spawn again. I'm at a loss.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [Matrix 718] Need help with item 4 gp command
    By Originalstrucks in forum Help
    Replies: 4
    Last Post: 07-31-2013, 07:25 PM
  2. how to add player rights to command? help
    By Syndicate in forum Help
    Replies: 3
    Last Post: 06-14-2010, 11:13 PM
  3. Help with setting a UID
    By Josh™ in forum Help
    Replies: 7
    Last Post: 03-01-2009, 01:47 AM
  4. Need Help With Setting up Vps!
    By Engarde in forum Hosting
    Replies: 1
    Last Post: 02-12-2009, 05:47 PM
  5. need help with adding drops to monster
    By halosniper in forum Requests
    Replies: 0
    Last Post: 11-16-2008, 07:26 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •