Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onDamage(final int level, final LivingEntity damager, final EntityDamageByEntityEvent event) {
- if (!(damager instanceof Player))
- return;
- final Entity victim = event.getEntity();
- new BukkitRunnable() {
- private int remainingSeconds = 25;
- private final Map<Location, Material> oldBlocks = new HashMap<>();
- @Override
- public void run() {
- remainingSeconds--;
- for (final Block block : getBlocksInRadius(victim.getLocation(), 4)) {
- if (block.getType() != Material.ICE) {
- oldBlocks.put(block.getLocation(), block.getType());
- block.setType(Material.ICE);
- }
- }
- if (remainingSeconds == 0) {
- this.cancel();
- for (final Map.Entry<Location, Material> entry : oldBlocks.entrySet()) {
- entry.getKey().getBlock().setType(entry.getValue());
- }
- }
- }
- }.runTaskTimer(SimplePlugin.getInstance(), 0, 6);
- }
Add Comment
Please, Sign In to add comment