diff --git a/src/main/java/me/trouper/clonedupecore/server/trims/TrimManager.java b/src/main/java/me/trouper/clonedupecore/server/trims/TrimManager.java index 3246c2b..40a1464 100644 --- a/src/main/java/me/trouper/clonedupecore/server/trims/TrimManager.java +++ b/src/main/java/me/trouper/clonedupecore/server/trims/TrimManager.java @@ -24,9 +24,15 @@ public class TrimManager implements Main, Data { } public void tickPlayer(Player player) { - if (shouldHide(player)) return; - UUID uuid = player.getUniqueId(); + if (shouldHide(player)) { + if (activePlayers.containsKey(uuid)) { + animations.get(activePlayers.get(uuid).material).onRemove(player); + activePlayers.remove(uuid); + } + return; + } + ValidMaterial currentMaterial = getActiveMaterial(player); ActiveTrim active = activePlayers.get(uuid); Location currentLocation = player.getLocation(); diff --git a/src/main/java/me/trouper/clonedupecore/server/trolls/OrbitalTrollWand.java b/src/main/java/me/trouper/clonedupecore/server/trolls/OrbitalTrollWand.java index e4b7d61..4c49325 100644 --- a/src/main/java/me/trouper/clonedupecore/server/trolls/OrbitalTrollWand.java +++ b/src/main/java/me/trouper/clonedupecore/server/trolls/OrbitalTrollWand.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Stack; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; public class OrbitalTrollWand extends AbstractWand implements TrollFeature { private static final ItemStack ORBITAL_WAND = ItemBuilder.of(Material.TRIPWIRE_HOOK) @@ -67,14 +68,26 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { @Override public void stop(CommandSender sender, Player target) {} - private final Map cannonMap = new HashMap<>(); - private final Map> playerHistory = new HashMap<>(); + private final Map cannonMap = new ConcurrentHashMap<>(); + private final Map> playerHistory = new ConcurrentHashMap<>(); + + private final Component SUCCESS_RESTORE = Component.text("Restored previous explosion."); + private final Component ERROR_EMPTY_STACK = Component.text("Undo stack is empty!"); + private final Component ERROR_EXCEPTION = Component.text("An exception was thrown when undoing the explosion! Check console for details."); + private final Component ERROR_ALREADY_CHARGING = Component.text("You are already charging the Ion Cannon!"); + private final Component SUCCESS_CHARGING = Component.text("Charging Ion Cannon..."); + private final Component SUCCESS_AIM = Component.text("You can now aim the Ion Cannon."); + private final Component ERROR_NOT_CONTROLLING = Component.text("You are not controlling the Ion Cannon."); + private final Component SUCCESS_DEACTIVATED = Component.text("Deactivated Ion Cannon Safely."); private boolean undoHistory(Player player) { - Stack history = playerHistory.getOrDefault(player.getUniqueId(),new Stack<>()); + Stack history = playerHistory.get(player.getUniqueId()); if (history == null || history.isEmpty()) return false; try (ExplosionResult result = history.pop()) { result.restore(); + if (history.isEmpty()) { + playerHistory.remove(player.getUniqueId()); + } } catch (Exception e) { e.printStackTrace(); return false; @@ -86,91 +99,97 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { protected void onSwapHand(Player player) { try { if (undoHistory(player)) { - Text.message(Text.Pallet.SUCCESS,false,player, Component.text("Restored previous explosion.")); + Text.message(Text.Pallet.SUCCESS, false, player, SUCCESS_RESTORE); + SoundPlayer.play(player, Sound.ENTITY_ILLUSIONER_PREPARE_BLINDNESS, 10, 1); } else { - Text.message(Text.Pallet.ERROR,false,player,Component.text("Undo stack is empty!")); + Text.message(Text.Pallet.ERROR, false, player, ERROR_EMPTY_STACK); } } catch (Exception e) { e.printStackTrace(); - Text.message(Text.Pallet.ERROR,false,player,Component.text("An exception was thrown when undoing the explosion! Check console for details.")); + Text.message(Text.Pallet.ERROR, false, player, ERROR_EXCEPTION); } } @Override protected void onRightClick(Player player) { - if (cannonMap.containsKey(player.getUniqueId())) { - OrbitalIonCannon playerCannon = cannonMap.get(player.getUniqueId()); + UUID playerId = player.getUniqueId(); + OrbitalIonCannon playerCannon = cannonMap.get(playerId); + + if (playerCannon != null) { if (playerCannon.getFireTask() != null || playerCannon.getChargeTask() != null) { - Text.message(Text.Pallet.ERROR,false,player,Component.text("You are already charging the Ion Cannon!")); - cannonMap.remove(player.getUniqueId()); + Text.message(Text.Pallet.ERROR, false, player, ERROR_ALREADY_CHARGING); + cannonMap.remove(playerId); return; } playerCannon.charge(); - cannonMap.remove(player.getUniqueId()); - Text.message(Text.Pallet.SUCCESS,false,player, Component.text("Charging Ion Cannon...")); + cannonMap.remove(playerId); + Text.message(Text.Pallet.SUCCESS, false, player, SUCCESS_CHARGING); return; } + OrbitalIonCannon cannon = new OrbitalIonCannon(player, traceTargets(player)); - cannonMap.put(player.getUniqueId(),cannon); - Text.message(Text.Pallet.SUCCESS,false,player, Component.text("You can now aim the Ion Cannon.")); + cannonMap.put(playerId, cannon); + Text.message(Text.Pallet.SUCCESS, false, player, SUCCESS_AIM); } @Override protected void onLeftClick(Player player) { - if (!cannonMap.containsKey(player.getUniqueId())) { - Text.message(Text.Pallet.ERROR,false,player,Component.text("You are not controlling the Ion Cannon.")); + UUID playerId = player.getUniqueId(); + OrbitalIonCannon playerCannon = cannonMap.get(playerId); + + if (playerCannon == null) { + Text.message(Text.Pallet.ERROR, false, player, ERROR_NOT_CONTROLLING); return; } - OrbitalIonCannon playerCannon = cannonMap.get(player.getUniqueId()); - playerCannon.destroy(); - cannonMap.remove(player.getUniqueId()); - Text.message(Text.Pallet.SUCCESS,false,player, Component.text("Deactivated Ion Cannon Safely.")); + playerCannon.destroy(); + cannonMap.remove(playerId); + Text.message(Text.Pallet.SUCCESS, false, player, SUCCESS_DEACTIVATED); + SoundPlayer.play(player, Sound.BLOCK_BEACON_DEACTIVATE, 1, 0.5F); } @Override protected void onScrollDown(Player player) { - if (!cannonMap.containsKey(player.getUniqueId())) { - Text.message(Text.Pallet.ERROR,false,player,Component.text("You are not controlling the Ion Cannon.")); + OrbitalIonCannon cannon = cannonMap.get(player.getUniqueId()); + if (cannon == null) { + Text.message(Text.Pallet.ERROR, false, player, ERROR_NOT_CONTROLLING); return; } - OrbitalIonCannon cannon = cannonMap.get(player.getUniqueId()); - if (cannon.getPower() <= 1) { - SoundPlayer.play(player,Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.3F); + SoundPlayer.play(player, Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.3F); cannon.setPower(2); return; } - cannon.setPower(Math.max(1,cannon.getPower() - 5)); - SoundPlayer.play(player,Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.7F); + cannon.setPower(Math.max(1, cannon.getPower() - 5)); + SoundPlayer.play(player, Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.7F); - player.sendActionBar(Text.format(Text.Pallet.INFO,"Set ion cannon power to {0}.",cannon.getPower())); + player.sendActionBar(Text.format(Text.Pallet.INFO, "Set ion cannon power to {0}.", cannon.getPower())); } @Override protected void onScrollUp(Player player) { - if (!cannonMap.containsKey(player.getUniqueId())) { - Text.message(Text.Pallet.ERROR,false,player,Component.text("You are not controlling the Ion Cannon.")); + OrbitalIonCannon cannon = cannonMap.get(player.getUniqueId()); + if (cannon == null) { + Text.message(Text.Pallet.ERROR, false, player, ERROR_NOT_CONTROLLING); return; } - OrbitalIonCannon cannon = cannonMap.get(player.getUniqueId()); - if (cannon.getPower() >= 50) { - SoundPlayer.play(player,Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.3F); + SoundPlayer.play(player, Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.3F); cannon.setPower(49); return; } - cannon.setPower(Math.min(50,cannon.getPower() + 5)); - SoundPlayer.play(player,Sound.BLOCK_NOTE_BLOCK_HAT, 1, 0.8F); + cannon.setPower(Math.min(50, cannon.getPower() + 5)); + SoundPlayer.play(player, Sound.BLOCK_NOTE_BLOCK_HAT, 1, 0.8F); - player.sendActionBar(Text.format(Text.Pallet.INFO,"Set ion cannon power to {0}.",cannon.getPower())); + player.sendActionBar(Text.format(Text.Pallet.INFO, "Set ion cannon power to {0}.", cannon.getPower())); } public class OrbitalIonCannon { private final Player owner; + private final UUID ownerId; private final OrbitalConfiguration simulatedOrbit; private Location skyRenderLocation; private Location skyTraceLocation; @@ -181,19 +200,24 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { private BukkitTask fireTask; private int power; private ExplosionResult explosionResult; + private final BukkitTask tickTask = new BukkitRunnable() { @Override public void run() { + if (owner == null || !owner.isOnline()) { + destroy(); + return; + } + updateOrbitLocation(); setSkyRenderLocation(getSimulatedOrbit().getRenderLocation(getTargetLocation())); - setSkyTraceLocation(CustomDisplayRaytracer.blocksInFrontOf(getTargetLocation(),getSimulatedOrbit().getNormalToSatellite(getTargetLocation().toVector()),20,false).getLoc()); - if (!getAimTask().isCancelled()) { + setSkyTraceLocation(CustomDisplayRaytracer.blocksInFrontOf(getTargetLocation(), getSimulatedOrbit().getNormalToSatellite(getTargetLocation().toVector()), 20, false).getLoc()); + + if (aimTask != null && !aimTask.isCancelled()) { setTargetLocation(traceTargets(getOwner())); - setGroundTraced(CustomDisplayRaytracer.trace(getSkyTraceLocation(),getTargetLocation(),5,(point)-> { + setGroundTraced(CustomDisplayRaytracer.trace(getSkyTraceLocation(), getTargetLocation(), 5, (point) -> { Material type = point.getLoc().getBlock().getType(); - boolean collidable = type.isCollidable(); - Verbose.send("Block at {0} collision: {1}, {2}",point.getLoc(),type,collidable); - return collidable; + return type.isCollidable(); }).getLoc()); } } @@ -201,10 +225,10 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { private OrbitalIonCannon(Player owner, Location target) { this.owner = owner; + this.ownerId = owner.getUniqueId(); this.targetLocation = target; this.power = 20; this.simulatedOrbit = new OrbitalConfiguration(target.toVector()); - this.setAimTask(aimRunnable.runTaskTimer(main.getPlugin(), 0, 1)); } @@ -214,18 +238,18 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { @Override public void run() { if (ticksElapsed >= 120) { - if (getExplosionResult() != null) { - getExplosionResult().close(); + if (getExplosionResult() != null && getExplosionResult().getTaskManager() != null && !getExplosionResult().getTaskManager().isClosed()) { + getExplosionResult().getTaskManager().close(); } destroy(); return; } - + if (ticksElapsed <= 40) { - BlockDisplay inner = BlockDisplayRaytracer.trace(Material.WHITE_CONCRETE_POWDER,getGroundTraced(),getSkyRenderLocation(),1,2); + BlockDisplay inner = BlockDisplayRaytracer.trace(Material.WHITE_CONCRETE_POWDER, getGroundTraced(), getSkyRenderLocation(), 1, 2); inner.setGlowing(true); inner.setGlowColorOverride(Color.fromRGB(0xFFDDDD)); - BlockDisplayRaytracer.trace(Material.WHITE_STAINED_GLASS,getGroundTraced(),getSkyRenderLocation(),1.5 + main.random().nextDouble(),2); + BlockDisplayRaytracer.trace(Material.WHITE_STAINED_GLASS, getGroundTraced(), getSkyRenderLocation(), 1.5 + main.random().nextDouble(), 2); } if (ticksElapsed == 0) { @@ -237,13 +261,9 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { .setBurnDelay(0) .setDestructionDelay(1); - Stack history = playerHistory.getOrDefault(getOwner().getUniqueId(),new Stack<>()); - - setExplosionResult(ExplosionUtils.createExplosion(getGroundTraced(),options)); - + Stack history = playerHistory.computeIfAbsent(ownerId, k -> new Stack<>()); + setExplosionResult(ExplosionUtils.createExplosion(getGroundTraced(), options)); history.push(getExplosionResult()); - - playerHistory.put(getOwner().getUniqueId(),history); } ticksElapsed++; @@ -252,26 +272,31 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { private final BukkitRunnable chargeRunnable = new BukkitRunnable() { int ticksElapsed = 0; + @Override public void run() { - if (ticksElapsed >= 20) { - setFireTask(fireRunnable.runTaskTimer(main.getPlugin(),0,1)); + final int delay = 40; + if (ticksElapsed >= delay) { + setFireTask(fireRunnable.runTaskTimer(main.getPlugin(), 0, 1)); this.cancel(); return; } - - if (ticksElapsed == 1) { - new SoundPlayer(Sound.ENTITY_WARDEN_SONIC_CHARGE,30,0.5F).playAt(getTargetLocation(),40); - new SoundPlayer(Sound.BLOCK_CONDUIT_AMBIENT,30,0.5F).playAt(getGroundTraced(),40); + + if (ticksElapsed == 0) { + int volume = getPower() * 20; + int radius = getPower() * 10; + new SoundPlayer(Sound.ENTITY_WARDEN_LISTENING, volume, 0.6F).playAt(getGroundTraced(), radius); + new SoundPlayer(Sound.ENTITY_WARDEN_SONIC_CHARGE, volume, 0.7F).playAt(getGroundTraced(), radius); + new SoundPlayer(Sound.BLOCK_CONDUIT_AMBIENT, volume, 0.5F).playAt(getGroundTraced(), radius); } - double thickness = (double) ticksElapsed / 20; - int otherValues = ((ticksElapsed / 20 * 100) + 100); + double thickness = (double) ticksElapsed / delay; + int otherValues = ((ticksElapsed / delay * 100) + 100); - BlockDisplay inner = BlockDisplayRaytracer.trace(Material.RED_CONCRETE, getGroundTraced(),getSkyRenderLocation(),thickness,2); + BlockDisplay inner = BlockDisplayRaytracer.trace(Material.RED_CONCRETE, getGroundTraced(), getSkyRenderLocation(), thickness, 2); inner.setGlowing(true); - inner.setGlowColorOverride(Color.fromRGB(255,otherValues,otherValues)); - BlockDisplayRaytracer.trace(Material.ORANGE_STAINED_GLASS, getGroundTraced(),getSkyRenderLocation(),thickness + 0.1 ,2); + inner.setGlowColorOverride(Color.fromRGB(255, otherValues, otherValues)); + BlockDisplayRaytracer.trace(Material.ORANGE_STAINED_GLASS, getGroundTraced(), getSkyRenderLocation(), thickness + 0.1, 2); ticksElapsed++; } @@ -279,6 +304,7 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { private final BukkitRunnable aimRunnable = new BukkitRunnable() { int ticksElapsed = 0; + @Override public void run() { if (getChargeTask() != null) { @@ -287,13 +313,13 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { } if (ticksElapsed == 0) { - new SoundPlayer(Sound.BLOCK_RESPAWN_ANCHOR_CHARGE,1,0.5F).playAt(groundTraced,40); + new SoundPlayer(Sound.BLOCK_RESPAWN_ANCHOR_CHARGE, getPower() * 20, 0.5F).playAt(groundTraced, getPower() * 10); } - BlockDisplay inner = BlockDisplayRaytracer.trace(Material.RED_CONCRETE_POWDER,getGroundTraced(),getSkyRenderLocation(),0.1,2); + BlockDisplay inner = BlockDisplayRaytracer.trace(Material.RED_CONCRETE_POWDER, getGroundTraced(), getSkyRenderLocation(), 0.1, 2); inner.setGlowing(true); inner.setGlowColorOverride(Color.fromRGB(0xFF0000)); - BlockDisplayRaytracer.trace(Material.RED_STAINED_GLASS,getGroundTraced(),getSkyRenderLocation(),0.2,2); + BlockDisplayRaytracer.trace(Material.RED_STAINED_GLASS, getGroundTraced(), getSkyRenderLocation(), 0.2, 2); ticksElapsed++; } @@ -304,122 +330,83 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { destroy(); return; } - getSimulatedOrbit().tick(); } private void destroy() { - if (getTickTask() != null) this.getTickTask().cancel(); - if (getFireTask() != null) this.getFireTask().cancel(); - if (getChargeTask() != null) this.getChargeTask().cancel(); - if (getAimTask() != null) this.getAimTask().cancel(); + if (tickTask != null && !tickTask.isCancelled()) tickTask.cancel(); + if (fireTask != null && !fireTask.isCancelled()) fireTask.cancel(); + if (chargeTask != null && !chargeTask.isCancelled()) chargeTask.cancel(); + if (aimTask != null && !aimTask.isCancelled()) aimTask.cancel(); + + cannonMap.remove(ownerId); } private void charge() { - this.getAimTask().cancel(); - this.setChargeTask(this.chargeRunnable.runTaskTimer(main.getPlugin(),0,1)); + if (this.aimTask != null && !this.aimTask.isCancelled()) { + this.aimTask.cancel(); + } + this.setChargeTask(this.chargeRunnable.runTaskTimer(main.getPlugin(), 0, 1)); } - public Player getOwner() { - return owner; - } - - public Location getTargetLocation() { - return targetLocation; - } - - public void setTargetLocation(Location targetLocation) { - this.targetLocation = targetLocation; - } - - public BukkitTask getAimTask() { - return aimTask; - } - - public void setAimTask(BukkitTask aimTask) { - this.aimTask = aimTask; - } - - public BukkitTask getChargeTask() { - return chargeTask; - } - - public void setChargeTask(BukkitTask chargeTask) { - this.chargeTask = chargeTask; - } - - public BukkitTask getFireTask() { - return fireTask; - } - - public void setFireTask(BukkitTask fireTask) { - this.fireTask = fireTask; - } - - public BukkitTask getTickTask() { - return tickTask; - } - - public ExplosionResult getExplosionResult() { - return explosionResult; - } - - public void setExplosionResult(ExplosionResult explosionResult) { - this.explosionResult = explosionResult; - } - - public OrbitalConfiguration getSimulatedOrbit() { - return simulatedOrbit; - } - - public Location getSkyRenderLocation() { - return skyRenderLocation; - } - - public void setSkyRenderLocation(Location skyRenderLocation) { - this.skyRenderLocation = skyRenderLocation; - } - - public Location getGroundTraced() { - return groundTraced; - } - - public void setGroundTraced(Location groundTraced) { - this.groundTraced = groundTraced; - } - - public int getPower() { - return power; - } - - public void setPower(int power) { - this.power = power; - } - - public Location getSkyTraceLocation() { - return skyTraceLocation; - } - - public void setSkyTraceLocation(Location skyTraceLocation) { - this.skyTraceLocation = skyTraceLocation; - } + public Player getOwner() { return owner; } + public Location getTargetLocation() { return targetLocation; } + public void setTargetLocation(Location targetLocation) { this.targetLocation = targetLocation; } + public BukkitTask getAimTask() { return aimTask; } + public void setAimTask(BukkitTask aimTask) { this.aimTask = aimTask; } + public BukkitTask getChargeTask() { return chargeTask; } + public void setChargeTask(BukkitTask chargeTask) { this.chargeTask = chargeTask; } + public BukkitTask getFireTask() { return fireTask; } + public void setFireTask(BukkitTask fireTask) { this.fireTask = fireTask; } + public BukkitTask getTickTask() { return tickTask; } + public ExplosionResult getExplosionResult() { return explosionResult; } + public void setExplosionResult(ExplosionResult explosionResult) { this.explosionResult = explosionResult; } + public OrbitalConfiguration getSimulatedOrbit() { return simulatedOrbit; } + public Location getSkyRenderLocation() { return skyRenderLocation; } + public void setSkyRenderLocation(Location skyRenderLocation) { this.skyRenderLocation = skyRenderLocation; } + public Location getGroundTraced() { return groundTraced; } + public void setGroundTraced(Location groundTraced) { this.groundTraced = groundTraced; } + public int getPower() { return power; } + public void setPower(int power) { this.power = power; } + public Location getSkyTraceLocation() { return skyTraceLocation; } + public void setSkyTraceLocation(Location skyTraceLocation) { this.skyTraceLocation = skyTraceLocation; } } - public class OrbitalConfiguration { + public static class OrbitalConfiguration { private Vector baseSatellite; + private final Vector[] satelliteOffsets = { + new Vector(0, 0, 0), // base + new Vector(60_000_000, 0, 0), // posX + new Vector(0, 0, 60_000_000), // posZ + new Vector(60_000_000, 0, 60_000_000), // posXZ + new Vector(-60_000_000, 0, 0), // negX + new Vector(0, 0, -60_000_000), // negZ + new Vector(-60_000_000, 0, -60_000_000), // negXZ + new Vector(60_000_000, 0, -60_000_000), // posXNegZ + new Vector(-60_000_000, 0, 60_000_000) // negXPosZ + }; + + private final Vector tempVector1 = new Vector(); + private final Vector tempVector2 = new Vector(); + private final Vector[] satellites = new Vector[9]; + public OrbitalConfiguration(Vector center) { this.baseSatellite = center.clone().setY(11_368_121); + for (int i = 0; i < satellites.length; i++) { + satellites[i] = new Vector(); + } } public void tick() { Vector orbitalLocation = getBaseSatellite(); if (orbitalLocation.getX() > 30_000_000 || orbitalLocation.getZ() > 30_000_000) { - setBaseSatellite(new Vector(-orbitalLocation.getX(),orbitalLocation.getY(),-orbitalLocation.getZ())); + setBaseSatellite(tempVector1.setX(-orbitalLocation.getX()).setY(orbitalLocation.getY()).setZ(-orbitalLocation.getZ())); return; } - setBaseSatellite(orbitalLocation.clone().add(new Vector(2_500,0,762))); + tempVector1.setX(2_500).setY(0).setZ(762); + setBaseSatellite(orbitalLocation.clone().add(tempVector1)); } public Location getRenderLocation(Location center) { @@ -429,27 +416,19 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { } public Vector getNormalToSatellite(Vector target) { - Vector closestSatellite = getClosestSatellite(target).clone(); - return closestSatellite.clone().subtract(target).normalize(); + Vector closestSatellite = getClosestSatellite(target); + return tempVector2.copy(closestSatellite).subtract(target).normalize(); } public Vector getNormalToTarget(Vector target) { - Vector closestSatellite = getClosestSatellite(target).clone(); - return target.clone().subtract(closestSatellite).normalize(); + Vector closestSatellite = getClosestSatellite(target); + return tempVector2.copy(target).subtract(closestSatellite).normalize(); } public Vector getClosestSatellite(Vector location) { - Vector[] satellites = new Vector[] { - getBaseSatellite(), - getPosXSat(), - getPosZSat(), - getPosXZSat(), - getNegXSat(), - getNegZSat(), - getNegXZSat(), - getPosXNegZSat(), - getNegXPosZSat() - }; + for (int i = 0; i < satellites.length; i++) { + satellites[i].copy(baseSatellite).add(satelliteOffsets[i]); + } Vector closest = satellites[0]; double minDistance = location.distanceSquared(closest); @@ -465,50 +444,12 @@ public class OrbitalTrollWand extends AbstractWand implements TrollFeature { return closest; } - public Vector getPosXSat() { - return baseSatellite.clone().add(new Vector(60_000_000,0,0)); - } - - public Vector getPosZSat() { - return baseSatellite.clone().add(new Vector(0,0,60_000_000)); - } - - public Vector getPosXZSat() { - return baseSatellite.clone().add(new Vector(60_000_000,0,60_000_000)); - } - - public Vector getNegXSat() { - return baseSatellite.clone().add(new Vector(-60_000_000,0,0)); - } - - public Vector getNegZSat() { - return baseSatellite.clone().add(new Vector(0,0,-60_000_000)); - } - - public Vector getNegXZSat() { - return baseSatellite.clone().add(new Vector(-60_000_000,0,60_000_000)); - } - - public Vector getPosXNegZSat() { - return baseSatellite.clone().add(new Vector(60_000_000,0,-60_000_000)); - } - - public Vector getNegXPosZSat() { - return baseSatellite.clone().add(new Vector(-60_000_000,0,60_000_000)); - } - - public Vector getBaseSatellite() { - return baseSatellite; - } - - public void setBaseSatellite(Vector baseSatellite) { - this.baseSatellite = baseSatellite; - } + public Vector getBaseSatellite() { return baseSatellite; } + public void setBaseSatellite(Vector baseSatellite) { this.baseSatellite = baseSatellite; } } private static Location traceTargets(Player player) { - Point hit = CustomDisplayRaytracer.trace(player.getEyeLocation(),player.getEyeLocation().getDirection(),128,CustomDisplayRaytracer.HIT_BLOCK); - + Point hit = CustomDisplayRaytracer.trace(player.getEyeLocation(), player.getEyeLocation().getDirection(), 128, CustomDisplayRaytracer.HIT_BLOCK); return hit.getLoc(); } -} +} \ No newline at end of file