use of com.badbones69.crazycrates.api.objects.Crate in project Crazy-Crates by Crazy-Crew.
the class HolographicSupport method createHologram.
public void createHologram(Block block, Crate crate) {
CrateHologram crateHologram = crate.getHologram();
if (!crateHologram.isEnabled())
return;
double height = crateHologram.getHeight();
Hologram hologram = HologramsAPI.createHologram(CrazyManager.getJavaPlugin(), block.getLocation().add(.5, height, .5));
crateHologram.getMessages().forEach(line -> hologram.appendTextLine(color(line)));
holograms.put(block, hologram);
}
use of com.badbones69.crazycrates.api.objects.Crate in project Crazy-Crates by Crazy-Crew.
the class BrokeLocationsControl method onWorldLoad.
@EventHandler
public void onWorldLoad(WorldLoadEvent e) {
if (!cc.getBrokeCrateLocations().isEmpty()) {
int fixedAmount = 0;
List<BrokeLocation> fixedWorlds = new ArrayList<>();
for (BrokeLocation brokeLocation : cc.getBrokeCrateLocations()) {
Location location = brokeLocation.getLocation();
if (location.getWorld() != null) {
cc.getCrateLocations().add(new CrateLocation(brokeLocation.getLocationName(), brokeLocation.getCrate(), location));
if (cc.getHologramController() != null) {
cc.getHologramController().createHologram(location.getBlock(), brokeLocation.getCrate());
}
fixedWorlds.add(brokeLocation);
fixedAmount++;
}
}
cc.getBrokeCrateLocations().removeAll(fixedWorlds);
if (fileManager.isLogging()) {
CrazyManager.getJavaPlugin().getLogger().warning("Fixed " + fixedAmount + " broken crate locations.");
if (cc.getBrokeCrateLocations().isEmpty()) {
CrazyManager.getJavaPlugin().getLogger().warning("All broken crate locations have been fixed.");
}
}
}
}
Aggregations