Guest User

Untitled

a guest
Dec 16th, 2025
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. private void enableSpotlights() {
  2. for (File file : new File(ShowCore.getPlugin().getDataFolder() + "/spotlights/beams").listFiles()) {
  3. FileUtil util = new FileUtil(file);
  4. YamlConfiguration configuration = util.getConfiguration();
  5.  
  6. String name = configuration.getString("name");
  7. Location location = configuration.getLocation("location");
  8.  
  9. Spotlight spotlight = new Spotlight(name);
  10. spotlight.create(location);
  11. spotlight.clear();
  12.  
  13. SpotlightCommand.spotlightHashMap.put(name, spotlight);
  14. }
  15. }
  16.  
  17. private void disableSpotlights() {
  18. Collection<Spotlight> spotlightSet = SpotlightCommand.spotlightHashMap.values();
  19. for (Spotlight spotlight : spotlightSet) {
  20. String name = spotlight.getName();
  21.  
  22. File file = FileUtil.getDataFile(name + ".yml", "spotlights/beams");
  23. try {
  24. file.createNewFile();
  25. } catch (IOException e) {
  26. throw new RuntimeException(e);
  27. }
  28.  
  29. FileUtil util = new FileUtil(file);
  30. YamlConfiguration configuration = util.getConfiguration();
  31.  
  32. configuration.set("name", name);
  33. configuration.set("location", spotlight.getBase());
  34.  
  35. ConfigurationSection section = configuration.createSection("positions");
  36. for (Position position : spotlight.getPositions()) {
  37. int currentValue = section.getKeys(false).size();
  38.  
  39. ConfigurationSection pos = section.createSection(String.valueOf(currentValue));
  40. pos.set("x", position.getX());
  41. pos.set("y", position.getY());
  42. pos.set("z", position.getZ());
  43. pos.set("time", position.getTime());
  44. pos.set("delay", position.getDelay());
  45. }
  46. util.save();
  47. spotlight.delete();
  48.  
  49. SpotlightCommand.spotlightHashMap.remove(name);
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment