Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. package com.taiter.ce.Enchantments.Boots;
  2.  
  3.  
  4. /*
  5. * This file is part of Custom Enchantments
  6. * Copyright (C) Taiterio 2015
  7. *
  8. * This program is free software: you can redistribute it and/or modify it
  9. * under the terms of the GNU Lesser General Public License as published by the
  10. * Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  16. * for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21.  
  22.  
  23.  
  24. import org.bukkit.entity.Player;
  25. import org.bukkit.event.Event;
  26. import org.bukkit.event.entity.EntityDamageByEntityEvent;
  27. import org.bukkit.inventory.ItemStack;
  28. import org.bukkit.util.Vector;
  29.  
  30. import com.taiter.ce.Enchantments.CEnchantment;
  31.  
  32.  
  33.  
  34. public class RocketEscape extends CEnchantment {
  35.  
  36. int duration;
  37. int strength;
  38. int trigger;
  39. int cooldown;
  40.  
  41. public RocketEscape(Application app) {
  42. super(app);
  43. configEntries.add("HpToTrigger: 4");
  44. configEntries.add("Cooldown: 20");
  45. triggers.add(Trigger.DAMAGE_TAKEN);
  46. }
  47.  
  48. @Override
  49. public void effect(Event e, ItemStack item, int level) {
  50. EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
  51. Player player = (Player) event.getEntity();
  52. if(player.getHealth() <= trigger) {
  53. player.setVelocity(new Vector(player.getVelocity().getX(), 2, player.getVelocity().getZ()));
  54. player.sendMessage("Woah, that was a close one. Hurry! Use an Enderpearl!");
  55. generateCooldown(player, cooldown);
  56. }
  57. }
  58.  
  59. @Override
  60. public void initConfigEntries() {
  61. trigger = Integer.parseInt(getConfig().getString("Enchantments." + getOriginalName() + ".HpToTrigger"));
  62. cooldown = Integer.parseInt(getConfig().getString("Enchantments." + getOriginalName() + ".Cooldown"));
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement