Changed xray

This commit is contained in:
Auxilor 2020-12-29 16:39:45 +00:00
parent 9391e7dd3d
commit 09dd679079
2 changed files with 19 additions and 7 deletions

View File

@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.scoreboard.Team;
import org.jetbrains.annotations.NotNull;
@ -92,6 +93,7 @@ public class Xray extends Spell {
shulker.setGravity(false);
shulker.setGlowing(true);
shulker.setInvisible(true);
shulker.setMetadata("xray-shulker", this.getPlugin().getMetadataValueFactory().create(true));
block1.setMetadata("xray-uuid", this.getPlugin().getMetadataValueFactory().create(shulker.getUniqueId()));
@ -115,7 +117,12 @@ public class Xray extends Spell {
return;
}
UUID uuid = (UUID) block.getMetadata("xray-uuid").get(0).value();
for (MetadataValue meta : block.getMetadata("xray-uuid")) {
if (!(meta.value() instanceof UUID)) {
continue;
}
UUID uuid = (UUID) meta.value();
assert uuid != null;
@ -125,4 +132,9 @@ public class Xray extends Spell {
entity.remove();
}
}
for (Entity shulkerEntity : block.getLocation().getWorld().getNearbyEntities(block.getLocation(), 2, 2, 2, entity -> entity.hasMetadata("xray-shulker"))) {
shulkerEntity.remove();
}
}
}

View File

@ -22,7 +22,7 @@ general-config:
config:
activation-sound: ENTITY_ENDERMAN_TELEPORT
cooldown: 30 # In seconds
cooldown: 40 # In seconds
blocks:
- coal_ore
- iron_ore
@ -32,5 +32,5 @@ config:
- ancient_debris
- diamond_ore
blocks-per-level: 3 # Blocks on all sides to scan per level
ticks: 20
ticks: 60
color-glow: true # Color ore glow based on ore type.