Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void enableSpotlights() {
- for (File file : new File(ShowCore.getPlugin().getDataFolder() + "/spotlights/beams").listFiles()) {
- FileUtil util = new FileUtil(file);
- YamlConfiguration configuration = util.getConfiguration();
- String name = configuration.getString("name");
- Location location = configuration.getLocation("location");
- Spotlight spotlight = new Spotlight(name);
- spotlight.create(location);
- spotlight.clear();
- SpotlightCommand.spotlightHashMap.put(name, spotlight);
- }
- }
- private void disableSpotlights() {
- Collection<Spotlight> spotlightSet = SpotlightCommand.spotlightHashMap.values();
- for (Spotlight spotlight : spotlightSet) {
- String name = spotlight.getName();
- File file = FileUtil.getDataFile(name + ".yml", "spotlights/beams");
- try {
- file.createNewFile();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- FileUtil util = new FileUtil(file);
- YamlConfiguration configuration = util.getConfiguration();
- configuration.set("name", name);
- configuration.set("location", spotlight.getBase());
- ConfigurationSection section = configuration.createSection("positions");
- for (Position position : spotlight.getPositions()) {
- int currentValue = section.getKeys(false).size();
- ConfigurationSection pos = section.createSection(String.valueOf(currentValue));
- pos.set("x", position.getX());
- pos.set("y", position.getY());
- pos.set("z", position.getZ());
- pos.set("time", position.getTime());
- pos.set("delay", position.getDelay());
- }
- util.save();
- spotlight.delete();
- SpotlightCommand.spotlightHashMap.remove(name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment