Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MACORE.suite.effects;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.Effect;
- import org.bukkit.Location;
- import org.bukkit.Particle;
- import org.bukkit.World;
- import org.bukkit.World.Spigot;
- import org.bukkit.scheduler.BukkitScheduler;
- import org.bukkit.scheduler.BukkitTask;
- import org.bukkit.util.Vector;
- import MACORE.suite.MaSuite;
- public class MALaserRay
- implements Runnable
- {
- private List<Location> locs;
- private String hex;
- private BukkitTask task;
- private int ticks;
- public void showLaser(String hex, World world, double x, double y, double z, float pitch, float yaw, double length, int ticks)
- {
- Location startLoc = new Location(world, x, y , z);
- startLoc.setYaw(yaw);
- startLoc.setPitch(pitch);
- this.locs = getLine(startLoc, length);
- this.hex = hex;
- this.ticks = ticks;
- this.task = MaSuite.instance.bs.runTaskTimerAsynchronously(MaSuite.instance, this, 0L, 1L);
- }
- public List<Location> getLine(Location loc, double range)
- {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- List<Location> locs = new ArrayList();
- for (double i = 1.0D; i <= range; i += 0.25D) {
- locs.add(loc.clone().add(loc.getDirection().multiply(i)));
- }
- return locs;
- }
- public static void particleEffect(List<Location> locs, String hex)
- {
- for(Location loc: locs) {
- displayColoredParticle(loc, hex);
- }
- }
- public static void displayColoredParticle(Location loc, String hexVal)
- {
- int R = 0;
- int G = 0;
- int B = 0;
- if (hexVal.contains("flame")) {
- loc.getWorld().spigot().playEffect(loc, Particle.FLAME, 0, 0, R / 255, B / 255, G / 255, 1.0F, 0, 100);
- }
- if (hexVal.contains("happyvillager")) {
- loc.getWorld().spigot().playEffect(loc, Particle.VILLAGER_HAPPY, 0, 0, R / 255, B / 255, G / 255, 1.0F, 0 ,100);
- }
- if(hexVal.contains("fireworkSpark")) {
- loc.getWorld().spigot().playEffect(loc, Particle.END_ROD, 0, 0, R / 255, B / 255, G / 255, 1.0F, 0 ,100);
- }
- if (hexVal.length() <= 6)
- {
- R = Integer.valueOf(hexVal.substring(0, 2), 16).intValue();
- G = Integer.valueOf(hexVal.substring(3, 5), 16).intValue();
- B = Integer.valueOf(hexVal.substring(5, 7), 16).intValue();
- if (R <= 0) {
- R = 1;
- }
- }
- else if ((hexVal.length() <= 7) && (hexVal.substring(0, 1).equals("#")))
- {
- R = Integer.valueOf(hexVal.substring(0, 2), 16).intValue();
- G = Integer.valueOf(hexVal.substring(3, 5), 16).intValue();
- B = Integer.valueOf(hexVal.substring(5, 7), 16).intValue();
- if (R <= 0) {
- R = 1;
- }
- }
- loc.getWorld().spigot().playEffect(loc, Particle.REDSTONE, 0, 0, R / 255, G / 255, B / 255, 1.0F, 0, 100);
- }
- public void run()
- {
- particleEffect(this.locs, this.hex);
- this.ticks -= 1;
- if(this.ticks <= 0) {
- this.task.cancel();
- }
- }
- }
- errors:
- line 57: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
- line 60: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
- line 63: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
- line 83: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement