Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RpgItens code

Comments in 'Plugin Development' started by yuri, Oct 9, 2016.

  1. yuri
    Offline

    yuri New Member

    Joined:
    May 20, 2015
    Posts:
    35
    Minecraft User:
    yodaylay22
    hello, I try to know some codes to help me with my RPGItens plugin, I want to do the same style Bukkit, I wonder if it is possible I make a system that recognizes the damage the item!
    I had in mind the following: use serCustonName and let something like this ( "Damage: 4 - 8"); it I was thinking of some code that reads the name and thus apply the damage from 4 to 8, if u have any tips or anything below leaves porfavor and excuse me my English evil
  2. Blabla
    Offline

    Blabla Active Member

    Joined:
    Sep 19, 2015
    Posts:
    82
    Minecraft User:
    The_Beast_Inside
    PHP:
    if($item->getCustomName() == "RPGItem") {
    $event->setDamage(blablabla);
    }
  3. yuri
    Offline

    yuri New Member

    Joined:
    May 20, 2015
    Posts:
    35
    Minecraft User:
    yodaylay22
    This will setDamage Add damage attack?
  4. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    Are you on about the damage the player will take when hit by item?
  5. XShockinFireX
    Offline

    XShockinFireX New Member

    Joined:
    Jan 28, 2016
    Posts:
    14
    Minecraft User:
    XShockinFireX
    PHP:
    if($item->getCustomName() == "RPGItem") {
        
    $event->setDamage($event->getDamage() + blablabla);
    }
  6. yuri
    Offline

    yuri New Member

    Joined:
    May 20, 2015
    Posts:
    35
    Minecraft User:
    yodaylay22
    Yes
  7. MichaelM04
    Offline

    MichaelM04 Active Member Plugin Developer

    Joined:
    Nov 12, 2015
    Posts:
    213
    Plugins:
    1
    Minecraft User:
    Michael
    The code that's been provided will do just that.
    PHP:
    if($item->getCustomName() == "Item"){
        
    $event->setDamage($event->getDamage() + 1.5);
    }
    That will do the original damage + 1.5 (hearts)
  8. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    It was best to ask just Incase anyway. Some people such as me can under the question in many different ways.

    xD
    MichaelM04 likes this.
  9. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    753
    Minecraft User:
    Thunder33345
    you can also use NBT since they arent editable like name can be edit via anvil
  10. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    If I understand you right you want to get the damager over a projectile? In most cases is $projectile->shootingEntity; uselful (yes without () ), but if you want to do that on TNT, then it wount work, thats why I use use $tnt->namedtag->setName($playername); in TNT, if the TNT explodes, then I get the player who primed or summoned the TNT with $this->getServer()->getPlayer($tnt->namedtag->getName());

Share This Page

Advertisement