Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.kbz.runes;
- import java.util.Random;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.entity.EntityDamageByEntityEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class Runes extends JavaPlugin implements Listener {
- public void onEnable() {
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onEntityHitSlow(EntityDamageByEntityEvent event) {
- Random random = new Random();
- int Chance = random.nextInt(100);
- if (event.getDamager() instanceof Player && event.getEntity() instanceof Player && Chance <= 12) {
- Player attacker = (Player) event.getDamager();
- Player damaged = (Player) event.getEntity();
- if (attacker.getItemInHand().getTypeId() == Material.DIAMOND_SWORD.getId()) {
- PotionEffect potioneffect = new PotionEffect(PotionEffectType.SLOW, 75, 3);
- damaged.removePotionEffect(PotionEffectType.SPEED); //pizza added this
- potioneffect.apply(damaged);
- attacker.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "Arena" + ChatColor.GRAY + "]"
- + ChatColor.YELLOW + " Your Rune of " + ChatColor.LIGHT_PURPLE + "Slowing" + ChatColor.YELLOW
- + " was activated! ");
- }
- }
- }
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onEntityHitSpeed(EntityDamageByEntityEvent event) {
- Random random = new Random();
- int Chance = random.nextInt(100);
- if (event.getDamager() instanceof Player && event.getEntity() instanceof Player && Chance <= 12) {
- Player attacker = (Player) event.getDamager();
- if (attacker.getItemInHand().getTypeId() == Material.DIAMOND_SWORD.getId()) {
- PotionEffect potioneffect = new PotionEffect(PotionEffectType.SPEED, 75, 2);
- attacker.removePotionEffect(PotionEffectType.SPEED);//pizza added this
- potioneffect.apply(attacker);
- attacker.sendMessage(
- ChatColor.GRAY + "[" + ChatColor.RED + "Arena" + ChatColor.GRAY + "]" + ChatColor.YELLOW
- + " Your Rune of " + ChatColor.WHITE + "Speed" + ChatColor.YELLOW + " was activated! ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement