How to make my plugin player specific? i.e. only blazinmeow uses this, baby

Discussion in 'Plugin Development' started by blazinmeow, Jul 18, 2012.

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

    blazinmeow

    I've search far and wide for an answer to this, through tuts and such, but i have yet to gather the answer for this simple question.
    Exampls: lets say i wanted fire particles but i only want it for myself(greedy i know). How would i be able to make it for me and me alone?

    Any help will be really.....helpful!

    Just a bit to know: i know my way around the coding so please dont give me entire java lecture.
    thanks again.
     
  2. Offline

    Dreeass

    Make a way to add people to a list, like a command or file. Then do a for each loop for every object player in that list.
     
  3. Offline

    Blairjam

    Just check and see if the player's name is equal to your name?

    EDIT: Dreeass's method is good if you want multiple people. But if it's only for you, I would think mine would be easier.
     
  4. Offline

    Dreeass

    He was just giving an example, so he might want to use it on other people too.
     
  5. Offline

    Blairjam

    Yeah...depending on how greedy he really is. :p
     
  6. Offline

    Firefly

    Not to get off on the wrong foot here, but this suspiciously sounds like a backdoor. Just saying :p
     
    ZeusAllMighty11 likes this.
  7. Offline

    Dreeass

    A backdoor for what?
     
  8. Offline

    Firefly

    I don't want to jump to any conclusions but "making something happen only for a specific person" sounds like it could be a backdoor for gaining permission in a plugin even if you don't have the permission but rather the player's name matches yours.
     
  9. Offline

    Dreeass

    Alright, dunno why he'd do that.
     
  10. Offline

    blazinmeow

    Nah lol its not for a backdoor, i would never backdoor my favorite server its no fun! backdoor is not fun that is, not the server lol
     
  11. Offline

    pzxc

    It's always always always better to use a permission for this kind of thing, because you can change which players it affects at runtime (from in-game on a particular server) with permissions whereas things hardcoded into the plugin can't be changed. In fact, it's so standard a procedure to use a permissions value for this sort of thing, the reasons you'd want to actually hardcode something like this are so few and far between, that it entices people to ask "why?" because the only reason they can think of to do it is to give yourself backdoor access to something on a server without the server admins knowing about it.

    Actually I can't think of a situation where you'd want to do this, either. Just add a permission in the config.yml file, then check the permission in the code, it's so easy why not do it the easy way. What purpose would it serve to do it any other way?
     
  12. Offline

    Firefly

    Which is why I suspected a backdoor sort of ordeal.
     
  13. Offline

    KingAtomx

    Actually there is one reason that I use, If somehow someone other than the true admin of the server got admin access and started modifying the permissions (via commands for example), I have a plugin on my server with my name hardcoded into the plugin that stops me being banned, stops being deop'd and stops me being kicked.
     
  14. Offline

    kamikazi3728

    THIS IS SIMPLE!!!!

    if you are using a command...
    Code:
    //Start the command on this line
    if (sender.getName() == YOUR NAME){
    //DO STUFF HERE
    }
    }//end of command
    if you are using an event...
    Code:
    public void onPlayerLogin(PlayerLoginEvent event){
    if (event.getPlayer().getName() == YOUR NAME){
    //event code goes here
    }
    }//end of event
    Or maybe you could just give yourself the permissions to use the plugin and no one else.
     
  15. Offline

    McLuke500

    Surely if its your server then you can easily use console to reverse any of them.



    That is wrong you cant compare strings like that it should be equalsIgnoreCase()


    public void onPlayerLogin(PlayerLoginEvent event){
    if (event.getPlayer().getName().equalsIgnoreCase("YOUR NAME")){
    //event code goes here
    }
    }//end of event




    Well it could be something meant for destruction eg a /opme command that will only work for the player who made the plugin
    obviously posing a massive risk to the server. Thats why we have bukkit.dev because every plugins code is checked to make sure it doesnt have any backdoors
    so you can be sure that anything off bukkit dev is safe :D
     
    ferrybig likes this.
  16. I think he need it for things like toggleling, like toggle fly or god mode, for this ind of tasks I recommend putting players (names) inside an set whenthey do the command, and removing them when they do the toggle off command, you dont need to look out for copies, because sets dont use that (dont write code to check this by your own)
     
  17. Offline

    blazinmeow

    I thank you all my fine sirs and madams your help was kindly appreciated. :D
    And yet again may i just add i have no intentions of publishing a plugin that contains something like this. I wish not to use this for destruction, then again fighting for the truth is difficult on the internets ._. and the question mark as my profile pic doesnt help lol
     
Thread Status:
Not open for further replies.

Share This Page