A simple question

Discussion in 'Plugin Development' started by camman00, Aug 19, 2015.

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

    camman00

    How do u check if the sender is a certain player name then to run the command if it is a certain player name like camman00 im making a plugin where only I can op people.
     
  2. Offline

    SkyleTyler1337

    @camman00
    Code:
    if(sender instanceof Player){
        Player player = (Player) sender;
        if(cmd.getName().equalsIgnoreCase("operator")){
             if(player.getName().equalsIgnoreCase("name") || player.getName().equals("name"){
                    //stuff  here
           }
       }
    }
    You could check before the cmd.getName() checking.. (not to sure if that would actually work)
     
  3. Offline

    camman00

    I'll will try that when I get home @SkyleTyler1337 also one more question how so if I am hurting a player it makes them take damage faster then normal.
     
  4. Offline

    SkyleTyler1337

    You mean taking less damage than normal?
     
  5. Offline

    Synapz

    @camman00 use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityDamageByEntityEvent.html.

    1) Check if damager instanceof player
    2) Check if they have a sword, axe, unarmed, whatever you want to add extra damage
    3) event.setDamage(event.getDamage()+2); this will add 2 (one heart) to damage dealt

    Edit: if what @AdobeGFX is true and you want burn to do faster damage, use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.html.
    1) Check is player is an instanceof Player
    2) Check if the Damage cause is them fire, hungre, whetever you want, or just always giving them extra damage
    3) Use event.setDamage(event.getDamage+1) The +1 adds half a heart to the damage making it kill them faster
     
    Last edited: Aug 19, 2015
  6. Offline

    AdobeGFX

    He either wants to be superman.. Or he just want people to take more damage when they get hurt.. Like if they burn, they take more damage than they should..
     
  7. Offline

    camman00

    Thank you all just one more question. What if I want to make the damage rate faster or slower if the player is in lava. Like for example I played on this one server and if u walked into lava it would damage you by 2 (leave you with 9 hearts) but it does 2 damage per tick so it pretty much instantly kills you.
    Pardon for my noob like questions
    Thank you all once again
     
  8. Offline

    Synapz

Thread Status:
Not open for further replies.

Share This Page