Solved Potions

Discussion in 'Plugin Development' started by sonicwolfsdutch, Aug 31, 2014.

Thread Status:
Not open for further replies.
  1. oke guys im trying to work on this how do i remove the fire resistance on a fire resistance potion becus this doesnt work

    Code:java
    1. @SuppressWarnings("deprecation")
    2. @EventHandler
    3. public void ondrink(PlayerItemConsumeEvent drink) {
    4. Player player = drink.getPlayer();
    5. if(drink.getItem().getType() == Material.POTION) {
    6. if(player.getItemInHand().getData().getData() == 3) {
    7. player.removePotionEffect(PotionEffectType.FIRE_RESISTANCE);
    8. player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 400, 0)); {
    9. }
    10. }
    11. }
    12. }
     
  2. Offline

    XxZHALO13Xx

    wolfs25 what do u mean..? ive always done
    Code:java
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 10, 1));
    2.  
    3. //The 10 and 1. The 10 is the Time in Ticks. 20 Tick = 1 Second, 1 = Amp.. Like the power
     
  3. like remove the fire resistance from a fire potion
     
  4. Offline

    XxZHALO13Xx

    wolfs25 whats the point of a potion if it doesnt do anything? what are u trying to accomplish?

    wolfs25 The potion effect isnt like the effect its the whole potion. you can use particles to get the particles if thats what your trying to do.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  5. im working on my friends uhc plugin and we have apple juice and fire potion looks like apple juice if u cant do it can the fire resistance is going to 1 second becus

    Code:java
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 1, 0));



    dident work D:
     
  6. Offline

    XxZHALO13Xx

    wolfs25 its because u have the tick at 1... 20 ticks is one second.. so set the ticks to around 300 just for testing and keep the amp at 0
     
  7. nope dident work :/
     
  8. Offline

    XxZHALO13Xx

    wolfs25 are you doing it correctly? whats the class look like. because its working for me
     

  9. if changed line 7 to ↓ dident work out D:
    Code:java
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 40, 0));
     
  10. Offline

    XxZHALO13Xx

    get rid of remove potion effect

    wolfs25 also do player.sendMessage("Test"); to see if that part executes. put it below add potion effect

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  11. yep did it and did work i think u cant remove the fire resistance of the fire resistance potion :/
     
  12. Offline

    XxZHALO13Xx

    also. getData() repeats. use it once not 2 times in a row.. any errors in console?

    if none of that works. try setting the amp to 1. also. did u register listener?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  13. nope doesn't crash also like everything works but removing the fire resistance part ... :/
     
  14. Offline

    XxZHALO13Xx

  15. thx u did it
    Code:java
    1. player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 20, 1));


    works!
     
Thread Status:
Not open for further replies.

Share This Page