So im trying to make a 10 by 10 invisible sphere shield that produces redstone particles where the blocks should be and the shield moves with you and no entity can enter the shield. I cant seem to make it ‘CODE’ package me.geraldvhz.banblade.commands;import org.bukkit.*;import org.bukkit.command.Command;import org.bukkit.command.CommandExecutor;import org.bukkit.command.CommandSender;import org.bukkit.entity.Entity;import org.bukkit.entity.LivingEntity;import org.bukkit.entity.Player;import org.bukkit.plugin.java.JavaPlugin;import org.bukkit.scheduler.BukkitRunnable;import org.bukkit.util.Vector;import java.util.HashMap;import java.util.Map;public class bbshield implements CommandExecutor { private JavaPlugin plugin; private Map<Player, Boolean> shieldEnabled; public bbshield(JavaPlugin plugin) { this.plugin = plugin; this.shieldEnabled = new HashMap<>();plugin.getCommand("bbshield").setExecutor(this);} @Overridepublic boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!(sender instanceof Player)) return true;Player player = (Player) sender; if (shieldEnabled.getOrDefault(player, false)) return true;shieldEnabled.put(player, true);spawnShield(player);sender.sendMessage("Shield has been enabled. Press Num Lock to disable."); return true;} private void spawnShield(Player player) { World world = player.getWorld();Location center = player.getLocation(); for (int x = -10; x <= 10; x++) { for (int y = -10; y <= 10; y++) { for (int z = -10; z <= 10; z++) { Location loc = center.clone().add(x, y, z); if (loc.distance(center) <= 10) { new BukkitRunnable() { public void run() { // Get the player's locationLocation loc = player.getLocation();// Spawn the redstone particle at the player's locationloc.getWorld().spawnParticle(Particle.REDSTONE, loc, 1, new Particle.DustOptions(Color.fromRGB(255, 0, 0), 1));// Play the note block sound at the player's locationloc.getWorld().playSound(loc, Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1);} }.runTaskTimer(plugin, 0, 20); for (Entity entity : world.getNearbyEntities(loc, 1, 1, 1)) { if (entity instanceof LivingEntity && !entity.equals(player)) { Vector direction = entity.getLocation().subtract(center).toVector().normalize();entity.setVelocity(direction.multiply(0.5));} } } } } } } private void despawnShield(Player player) { World world = player.getWorld();Location center = player.getLocation(); for (int x = -10; x <= 10; x++) { for (int y = -10; y <= 10; y++) { for (int z = -10; z <= 10; z++) { Location loc = center.clone().add(x, y, z); if (loc.distance(center) <= 10) { world.getBlockAt(loc).setType(Material.AIR);} } } } plugin.getConfig().set("shieldEnabled." + player.getUniqueId().toString(), false);plugin.saveConfig();} public void handleNumLock(Player player) { boolean enabled = shieldEnabled.getOrDefault(player, false); if (enabled) { shieldEnabled.put(player, false);despawnShield(player);player.sendMessage("Shield has been disabled.");} else { shieldEnabled.put(player, true);spawnShield(player);player.sendMessage("Shield has been enabled. Press Num Lock to disable.");} } public void handlePlayerQuit(Player player) { plugin.getConfig().set("shieldEnabled." + player.getUniqueId().toString(), false);plugin.saveConfig();shieldEnabled.remove(player);} } ‘ I will attach the file aswell Why is this taking so long?
lol, anyways i do need help with it I need someone too help me, I am still learning to make plugins. EDIT by Moderator: merged posts, please use the edit button instead of double posting. EDIT by User: Oh ok srry
Can you encapsulate your code using 'CODE' '/CODE' with brackets instead so your code can be easier to read.