Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Timelord
- implements Listener
- {
- public MainClass plugin;
- public ArrayList<String> frozenPlayers = new ArrayList();
- public Timelord(MainClass instance)
- {
- this.plugin = instance;
- }
- @EventHandler
- public void onEntityDamage(PlayerInteractEvent event) {
- Player player = event.getPlayer();
- if ((player.getItemInHand().getType().equals(Material.WATCH)) && (
- (event.getAction() == Action.RIGHT_CLICK_AIR) ||
- (event.getAction() == Action.RIGHT_CLICK_BLOCK))) {
- if (Abilities.cooldown.contains(player.getName())) {
- player.sendMessage("§cEspere o cooldown !");
- return;
- }
- if (User.isTimelordkit(player).booleanValue()) {
- List nearbyEntities = event.getPlayer().getNearbyEntities(5.0D, 5.0D, 5.0D);
- for (Entity target : nearbyEntities)
- if ((target instanceof Player)) {
- Player t = (Player)target;
- this.frozenPlayers.add(t.getName());
- Abilities.cooldown.add(player.getName());
- player.sendMessage("§cO Tempo foi parado !");
- t.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 5));
- Bukkit.getServer().getScheduler().runTaskLater(this.plugin, new Runnable(t) {
- public void run() {
- Timelord.this.frozenPlayers.remove(this.val$t.getName());
- this.val$t.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 300, 2));
- }
- }
- , 100L);
- Bukkit.getServer().getScheduler().runTaskLater(this.plugin, new Runnable(t) {
- public void run() {
- Abilities.cooldown.remove(this.val$t.getName());
- }
- }
- , 800L);
- }
- }
- }
- }
- @EventHandler
- public void onPlayerMove(PlayerMoveEvent e)
- {
- if (this.frozenPlayers.contains(e.getPlayer().getName()))
- e.getPlayer().teleport(e.getPlayer());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement