SHARE
TWEET

ShowLaser 1

a guest May 26th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package MACORE.suite.effects;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import org.bukkit.Effect;
  6. import org.bukkit.Location;
  7. import org.bukkit.Particle;
  8. import org.bukkit.World;
  9. import org.bukkit.World.Spigot;
  10. import org.bukkit.scheduler.BukkitScheduler;
  11. import org.bukkit.scheduler.BukkitTask;
  12. import org.bukkit.util.Vector;
  13. import MACORE.suite.MaSuite;
  14.  
  15. public class MALaserRay
  16.     implements Runnable
  17. {
  18. private List<Location> locs;
  19. private String hex;
  20. private BukkitTask task;
  21. private int ticks;
  22.  
  23. public void showLaser(String hex, World world, double x, double y, double z, float pitch, float yaw, double length, int ticks)
  24. {
  25.     Location startLoc = new Location(world, x, y , z);
  26.     startLoc.setYaw(yaw);
  27.     startLoc.setPitch(pitch);
  28.     this.locs = getLine(startLoc, length);
  29.     this.hex = hex;
  30.     this.ticks = ticks;
  31.     this.task = MaSuite.instance.bs.runTaskTimerAsynchronously(MaSuite.instance, this, 0L, 1L);
  32. }
  33.  
  34. public List<Location> getLine(Location loc, double range)
  35. {
  36.     @SuppressWarnings({ "unchecked", "rawtypes" })
  37.     List<Location> locs = new ArrayList();
  38.     for (double i = 1.0D; i <= range; i += 0.25D) {
  39.         locs.add(loc.clone().add(loc.getDirection().multiply(i)));
  40.     }
  41.     return locs;
  42. }
  43.  
  44. public static void particleEffect(List<Location> locs, String hex)
  45. {
  46.     for(Location loc: locs) {
  47.         displayColoredParticle(loc, hex);
  48.     }
  49. }
  50.  
  51. public static void displayColoredParticle(Location loc, String hexVal)
  52. {
  53.     int R = 0;
  54.     int G = 0;
  55.     int B = 0;
  56.     if (hexVal.contains("flame")) {
  57.         loc.getWorld().spigot().playEffect(loc, Particle.FLAME, 0, 0, R / 255, B / 255, G / 255, 1.0F, 0, 100);
  58.     }
  59.     if (hexVal.contains("happyvillager")) {
  60.         loc.getWorld().spigot().playEffect(loc, Particle.VILLAGER_HAPPY, 0, 0, R / 255, B / 255, G / 255, 1.0F, 0 ,100);
  61.     }
  62.     if(hexVal.contains("fireworkSpark")) {
  63.         loc.getWorld().spigot().playEffect(loc, Particle.END_ROD, 0, 0, R / 255, B / 255, G / 255, 1.0F, 0 ,100);
  64.     }
  65.     if (hexVal.length() <= 6)
  66.     {
  67.         R = Integer.valueOf(hexVal.substring(0, 2), 16).intValue();
  68.         G = Integer.valueOf(hexVal.substring(3, 5), 16).intValue();
  69.         B = Integer.valueOf(hexVal.substring(5, 7), 16).intValue();
  70.         if (R <= 0) {
  71.             R = 1;
  72.         }
  73.     }
  74.     else if ((hexVal.length() <= 7) && (hexVal.substring(0, 1).equals("#")))
  75.     {
  76.         R = Integer.valueOf(hexVal.substring(0, 2), 16).intValue();
  77.         G = Integer.valueOf(hexVal.substring(3, 5), 16).intValue();
  78.         B = Integer.valueOf(hexVal.substring(5, 7), 16).intValue();
  79.         if (R <= 0) {
  80.             R = 1;
  81.         }
  82.     }
  83.     loc.getWorld().spigot().playEffect(loc, Particle.REDSTONE, 0, 0, R / 255, G / 255, B / 255, 1.0F, 0, 100);
  84. }
  85.  
  86.  
  87. public void run()
  88. {
  89.     particleEffect(this.locs, this.hex);
  90.     this.ticks -= 1;
  91.     if(this.ticks <= 0) {
  92.         this.task.cancel();
  93.     }
  94. }
  95. }
  96. errors:
  97. line 57: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
  98. line 60: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
  99. line 63: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
  100. line 83: The method playEffect(Location, Particle, int, int, int, int, int, float, int, int) is undefined for the type World.Spigot
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top