mirror of
https://github.com/songoda/EpicFurnaces.git
synced 2024-11-30 22:03:22 +01:00
Added the option to not have HolographicDisplays installed.
This commit is contained in:
parent
a82eafe636
commit
5febb15458
@ -181,5 +181,11 @@
|
||||
<version>4.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>craftbukkit-1-13</artifactId>
|
||||
<version>4.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -5,7 +5,10 @@ import com.songoda.epicfurnaces.command.CommandManager;
|
||||
import com.songoda.epicfurnaces.handlers.BlacklistHandler;
|
||||
import com.songoda.epicfurnaces.hook.CraftBukkitHook;
|
||||
import com.songoda.epicfurnaces.hooks.*;
|
||||
import com.songoda.epicfurnaces.listeners.*;
|
||||
import com.songoda.epicfurnaces.listeners.BlockListeners;
|
||||
import com.songoda.epicfurnaces.listeners.FurnaceListeners;
|
||||
import com.songoda.epicfurnaces.listeners.InteractListeners;
|
||||
import com.songoda.epicfurnaces.listeners.InventoryListeners;
|
||||
import com.songoda.epicfurnaces.managers.*;
|
||||
import com.songoda.epicfurnaces.storage.Storage;
|
||||
import com.songoda.epicfurnaces.storage.types.StorageMysql;
|
||||
@ -32,12 +35,16 @@ import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.songoda.epicfurnaces.utils.StringUtils.formatText;
|
||||
import static java.util.Arrays.asList;
|
||||
@ -69,6 +76,8 @@ public class EpicFurnaces extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(formatText("Holographic displays " + (Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays") ? "found, enabling support for holograms!" : "not found, holograms will not work.")));
|
||||
|
||||
for (String name : asList("config", "data", "hooks", "blacklist", "Furnace Recipes")) {
|
||||
File file = new File(getDataFolder(), name + ".yml");
|
||||
if (!file.exists()) {
|
||||
@ -102,11 +111,14 @@ public class EpicFurnaces extends JavaPlugin {
|
||||
this.boostManager = new BoostManager(this);
|
||||
this.blacklistHandler = new BlacklistHandler(this);
|
||||
this.bukkitEnums = new BukkitEnums(this);
|
||||
this.hologramManager = new HologramManager(this);
|
||||
this.levelManager = new LevelManager(this);
|
||||
this.hookManager = new HookManager(this);
|
||||
this.economy = getServer().getServicesManager().getRegistration(Economy.class).getProvider();
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays")) {
|
||||
this.hologramManager = new HologramManager(this);
|
||||
}
|
||||
|
||||
checkStorage();
|
||||
levelManager.loadLevelManager();
|
||||
setupRecipes();
|
||||
@ -154,7 +166,7 @@ public class EpicFurnaces extends JavaPlugin {
|
||||
Bukkit.getConsoleSender().sendMessage(formatText("&7EpicFurnaces " + this.getDescription().getVersion() + " by &5Songoda <3&7!"));
|
||||
Bukkit.getConsoleSender().sendMessage(formatText("&7Action: &cDisabling&7..."));
|
||||
Bukkit.getConsoleSender().sendMessage(formatText("&a============================="));
|
||||
hologramManager.clearAll();
|
||||
getHologramManager().ifPresent(HologramManager::clearAll);
|
||||
saveToFile();
|
||||
}
|
||||
|
||||
@ -301,8 +313,8 @@ public class EpicFurnaces extends JavaPlugin {
|
||||
return bukkitEnums;
|
||||
}
|
||||
|
||||
public HologramManager getHologramManager() {
|
||||
return hologramManager;
|
||||
public Optional<HologramManager> getHologramManager() {
|
||||
return Optional.ofNullable(hologramManager);
|
||||
}
|
||||
|
||||
public HookManager getHookManager() {
|
||||
|
@ -26,7 +26,7 @@ public class FurnaceManager {
|
||||
}
|
||||
|
||||
public FurnaceObject addFurnace(Location location, FurnaceObject furnace) {
|
||||
instance.getHologramManager().updateHologram(furnace);
|
||||
instance.getHologramManager().ifPresent(manager -> manager.updateHologram(furnace));
|
||||
registeredFurnaces.put(roundLocation(location), furnace);
|
||||
return furnace;
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class FurnaceManager {
|
||||
}
|
||||
|
||||
public void removeFurnace(Location location) {
|
||||
instance.getHologramManager().remove(registeredFurnaces.remove(location));
|
||||
instance.getHologramManager().ifPresent(manager -> manager.remove(registeredFurnaces.remove(location)));
|
||||
}
|
||||
|
||||
public Optional<FurnaceObject> getFurnace(Location location) {
|
||||
@ -118,7 +118,12 @@ public class FurnaceManager {
|
||||
instance.getBoostManager().addBoostToPlayer(boostData);
|
||||
}
|
||||
}
|
||||
getFurnaces().values().forEach(furnace -> instance.getHologramManager().updateHologram(furnace));
|
||||
|
||||
if (!instance.getConfig().getBoolean("Main.Furnaces Have Holograms")) {
|
||||
return;
|
||||
}
|
||||
|
||||
getFurnaces().values().forEach(furnace -> instance.getHologramManager().ifPresent(manager -> manager.updateHologram(furnace)));
|
||||
}
|
||||
|
||||
public void saveToFile() {
|
||||
|
@ -31,6 +31,6 @@ public class HologramTask extends BukkitRunnable {
|
||||
|
||||
instance.getFurnaceManager().getFurnaces().values().stream()
|
||||
.filter(furnace -> furnace.getLocation() != null && furnace.getLocation().getWorld() != null && furnace.getLocation().getBlock() != null)
|
||||
.forEach(furnace -> instance.getHologramManager().updateHologram(furnace));
|
||||
.forEach(furnace -> instance.getHologramManager().ifPresent(manager -> manager.updateHologram(furnace)));
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ version: ${project.version}
|
||||
main: com.songoda.epicfurnaces.EpicFurnaces
|
||||
authors: [Brianna, GB6]
|
||||
website: https://songoda.com/
|
||||
depend: [HolographicDisplays, Vault]
|
||||
softdepend: [PlotSquared, GriefPrevention, USkyBlock, SkyBlock, WorldGuard, Factions]
|
||||
depend: [Vault]
|
||||
softdepend: [PlotSquared, GriefPrevention, USkyBlock, SkyBlock, WorldGuard, Factions, HolographicDisplays]
|
||||
commands:
|
||||
epicfurnaces:
|
||||
description: Default command for the EpicFurnaces plugin.
|
||||
|
Loading…
Reference in New Issue
Block a user