mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed Network Particles and added a max-nodes config option
This commit is contained in:
parent
81b80643d3
commit
53be0a1842
@ -31,6 +31,7 @@
|
||||
* Added custom model data support for Languages
|
||||
* Added Grind Stone Recipes for Prismarine
|
||||
* Added String to the Bio Reactor
|
||||
* Added a config setting to limit how many Nodes a Network can have
|
||||
|
||||
### Changes
|
||||
* Removed Solar Array
|
||||
@ -44,6 +45,7 @@
|
||||
* Fixed GitHub cache
|
||||
* Fixed #1364
|
||||
* Fixed Bio Reactor not accepting melons
|
||||
* Fixed Cargo Networks particles being broken
|
||||
|
||||
## Release Candidate 4 (06 Jan 2020)
|
||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4
|
||||
|
@ -146,13 +146,17 @@ public class ErrorReport {
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled(plugin)) {
|
||||
plugins.add(" + " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
|
||||
if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency))
|
||||
|
||||
if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency)) {
|
||||
addons.add(" + " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
else {
|
||||
plugins.add(" - " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
|
||||
if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency))
|
||||
|
||||
if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency)) {
|
||||
addons.add(" - " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +1,25 @@
|
||||
package me.mrCookieSlime.Slimefun.api.network;
|
||||
package io.github.thebusybiscuit.slimefun4.api.network;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Particle.DustOptions;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Particles.MC_1_13.ParticleEffect;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* An abstract Network class to manage networks in a stateful way
|
||||
*
|
||||
* @author meiamsome
|
||||
*
|
||||
*/
|
||||
public abstract class Network {
|
||||
|
||||
private static List<Network> networkList = new ArrayList<>();
|
||||
|
||||
public static<T extends Network> T getNetworkFromLocation(Location l, Class<T> type) {
|
||||
for (Network network : networkList) {
|
||||
if (type.isInstance(network) && network.connectsTo(l)) {
|
||||
return type.cast(network);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static<T extends Network> List<T> getNetworksFromLocation(Location l, Class<T> type) {
|
||||
List<T> list = new ArrayList<>();
|
||||
for (Network network : networkList) {
|
||||
if (type.isInstance(network) && network.connectsTo(l)) {
|
||||
list.add(type.cast(network));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void registerNetwork(Network n) {
|
||||
networkList.add(n);
|
||||
}
|
||||
|
||||
public static void unregisterNetwork(Network n) {
|
||||
networkList.remove(n);
|
||||
}
|
||||
|
||||
public static void handleAllNetworkLocationUpdate(Location l) {
|
||||
for (Network n : getNetworksFromLocation(l, Network.class)) {
|
||||
n.handleLocationUpdate(l);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract int getRange();
|
||||
public abstract NetworkComponent classifyLocation(Location l);
|
||||
@ -79,7 +50,7 @@ public abstract class Network {
|
||||
|
||||
public void handleLocationUpdate(Location l) {
|
||||
if (regulator.equals(l)) {
|
||||
unregisterNetwork(this);
|
||||
SlimefunPlugin.getNetworkManager().unregisterNetwork(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -105,6 +76,7 @@ public abstract class Network {
|
||||
}
|
||||
|
||||
private void discoverStep() {
|
||||
int maxSteps = SlimefunPlugin.getNetworkManager().getMaxSize();
|
||||
int steps = 0;
|
||||
|
||||
while (nodeQueue.peek() != null) {
|
||||
@ -115,7 +87,7 @@ public abstract class Network {
|
||||
if (classification != currentAssignment) {
|
||||
if (currentAssignment == NetworkComponent.REGULATOR || currentAssignment == NetworkComponent.CONNECTOR) {
|
||||
// Requires a complete rebuild of the network, so we just throw the current one away.
|
||||
unregisterNetwork(this);
|
||||
SlimefunPlugin.getNetworkManager().unregisterNetwork(this);
|
||||
return;
|
||||
}
|
||||
else if (currentAssignment == NetworkComponent.TERMINUS) {
|
||||
@ -137,9 +109,10 @@ public abstract class Network {
|
||||
locationClassificationChange(l, currentAssignment, classification);
|
||||
}
|
||||
steps += 1;
|
||||
// Consider making this a configuration option so that it can be increased for servers
|
||||
// that can deal with the load.
|
||||
if(steps == 500) break;
|
||||
|
||||
if (steps >= maxSteps) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,12 +134,10 @@ public abstract class Network {
|
||||
|
||||
public void display() {
|
||||
Slimefun.runSync(() -> {
|
||||
DustOptions options = new DustOptions(Color.BLUE, 2F);
|
||||
|
||||
for (Location l : connectedLocations) {
|
||||
try {
|
||||
ParticleEffect.REDSTONE.display(l.clone().add(0.5, 0.5, 0.5), 0, 0, 0, 1, 1);
|
||||
} catch(Exception x) {
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while playing Network Animation for Slimefun " + Slimefun.getVersion(), x);
|
||||
}
|
||||
l.getWorld().spawnParticle(Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, options);
|
||||
}
|
||||
});
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package me.mrCookieSlime.Slimefun.api.network;
|
||||
package io.github.thebusybiscuit.slimefun4.api.network;
|
||||
|
||||
public enum NetworkComponent {
|
||||
|
@ -0,0 +1,62 @@
|
||||
package io.github.thebusybiscuit.slimefun4.api.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public final class NetworkManager {
|
||||
|
||||
private final int maxNodes;
|
||||
private final List<Network> networks = new LinkedList<>();
|
||||
|
||||
public NetworkManager(int capacity) {
|
||||
maxNodes = capacity;
|
||||
}
|
||||
|
||||
public int getMaxSize() {
|
||||
return maxNodes;
|
||||
}
|
||||
|
||||
public List<Network> getNetworkList() {
|
||||
return networks;
|
||||
}
|
||||
|
||||
public <T extends Network> T getNetworkFromLocation(Location l, Class<T> type) {
|
||||
for (Network network : networks) {
|
||||
if (type.isInstance(network) && network.connectsTo(l)) {
|
||||
return type.cast(network);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T extends Network> List<T> getNetworksFromLocation(Location l, Class<T> type) {
|
||||
List<T> list = new ArrayList<>();
|
||||
|
||||
for (Network network : networks) {
|
||||
if (type.isInstance(network) && network.connectsTo(l)) {
|
||||
list.add(type.cast(network));
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void registerNetwork(Network n) {
|
||||
networks.add(n);
|
||||
}
|
||||
|
||||
public void unregisterNetwork(Network n) {
|
||||
networks.remove(n);
|
||||
}
|
||||
|
||||
public void handleAllNetworkLocationUpdate(Location l) {
|
||||
for (Network n : getNetworksFromLocation(l, Network.class)) {
|
||||
n.handleLocationUpdate(l);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -31,7 +31,6 @@ import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.gps.ElevatorPlate;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class SlimefunCommand implements CommandExecutor, Listener {
|
||||
|
||||
@ -104,7 +103,7 @@ public class SlimefunCommand implements CommandExecutor, Listener {
|
||||
|
||||
public void sendHelp(CommandSender sender) {
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(ChatColors.color("&aSlimefun &2v" + Slimefun.getVersion()));
|
||||
sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion()));
|
||||
sender.sendMessage("");
|
||||
|
||||
for (SubCommand cmd : commands) {
|
||||
|
@ -83,7 +83,7 @@ public final class GuideSettings {
|
||||
"&7&oThis is very important when reporting bugs!",
|
||||
"",
|
||||
"&7Minecraft Version: &a" + Bukkit.getBukkitVersion(),
|
||||
"&7Slimefun Version: &a" + Slimefun.getVersion(),
|
||||
"&7Slimefun Version: &a" + SlimefunPlugin.getVersion(),
|
||||
"&7CS-CoreLib Version: &a" + CSCoreLib.getLib().getDescription().getVersion()
|
||||
), ChestMenuUtils.getEmptyClickHandler());
|
||||
|
||||
|
@ -10,7 +10,6 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.api.PlayerProfile;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class PlaceholderAPIHook extends PlaceholderExpansion {
|
||||
|
||||
@ -65,7 +64,7 @@ public class PlaceholderAPIHook extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
if (params.equals("gps_complexity")) {
|
||||
return String.valueOf(Slimefun.getGPSNetwork().getNetworkComplexity(p.getUniqueId()));
|
||||
return String.valueOf(SlimefunPlugin.getGPSNetwork().getNetworkComplexity(p.getUniqueId()));
|
||||
}
|
||||
|
||||
if (params.equals("timings_lag")) {
|
||||
|
@ -15,6 +15,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.GitHubService;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public abstract class GitHubConnector {
|
||||
@ -91,7 +92,7 @@ public abstract class GitHubConnector {
|
||||
onSuccess(element);
|
||||
}
|
||||
catch (IOException x) {
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while parsing GitHub-Data for Slimefun " + Slimefun.getVersion(), x);
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while parsing GitHub-Data for Slimefun " + SlimefunPlugin.getVersion(), x);
|
||||
onFailure();
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class BackpackListener implements Listener {
|
||||
if (item.getAmount() == 1) {
|
||||
if (Slimefun.hasUnlocked(p, backpack, true)) {
|
||||
if (!PlayerProfile.get(p, profile -> openBackpack(item, profile, backpack.getSize())))
|
||||
Slimefun.getLocal().sendMessage(p, "messages.opening-backpack");
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.opening-backpack");
|
||||
}
|
||||
}
|
||||
else SlimefunPlugin.getLocal().sendMessage(p, "backpack.no-stack", true);
|
||||
|
@ -136,7 +136,7 @@ public class BlockListener implements Listener {
|
||||
else if (SlimefunManager.isItemSimilar(item, SlimefunItems.BROKEN_SPAWNER, false)) e.setCancelled(true);
|
||||
else if (SlimefunManager.isItemSimilar(item, SlimefunItems.GPS_MARKER_TOOL, true)) {
|
||||
e.setCancelled(true);
|
||||
Slimefun.getGPSNetwork().addWaypoint(e.getPlayer(), e.getBlock().getLocation());
|
||||
SlimefunPlugin.getGPSNetwork().addWaypoint(e.getPlayer(), e.getBlock().getLocation());
|
||||
}
|
||||
else if (SlimefunManager.isItemSimilar(item, SlimefunItems.CHRISTMAS_PRESENT, false)) {
|
||||
e.setCancelled(true);
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class DeathpointListener implements Listener {
|
||||
|
||||
@ -26,7 +25,7 @@ public class DeathpointListener implements Listener {
|
||||
Player p = (Player) e.getEntity();
|
||||
|
||||
if (p.getInventory().containsAtLeast(SlimefunItems.GPS_EMERGENCY_TRANSMITTER, 1)) {
|
||||
Slimefun.getGPSNetwork().addWaypoint(p, SlimefunPlugin.getLocal().getMessage(p, "gps.deathpoint").replace("%date%", format.format(new Date())), p.getLocation().getBlock().getLocation());
|
||||
SlimefunPlugin.getGPSNetwork().addWaypoint(p, SlimefunPlugin.getLocal().getMessage(p, "gps.deathpoint").replace("%date%", format.format(new Date())), p.getLocation().getBlock().getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,30 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.network.Network;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkManager;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
|
||||
public class NetworkListener implements Listener {
|
||||
|
||||
private final NetworkManager manager;
|
||||
|
||||
public NetworkListener(SlimefunPlugin plugin) {
|
||||
manager = SlimefunPlugin.getNetworkManager();
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
Network.handleAllNetworkLocationUpdate(e.getBlock().getLocation());
|
||||
manager.handleAllNetworkLocationUpdate(e.getBlock().getLocation());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlaceBreak(BlockPlaceEvent e) {
|
||||
Network.handleAllNetworkLocationUpdate(e.getBlock().getLocation());
|
||||
manager.handleAllNetworkLocationUpdate(e.getBlock().getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.gps.ElevatorPlate;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.gps.Teleporter;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class TeleporterListener implements Listener {
|
||||
|
||||
@ -42,7 +41,7 @@ public class TeleporterListener implements Listener {
|
||||
|
||||
Block block = e.getClickedBlock().getRelative(BlockFace.DOWN);
|
||||
UUID owner = UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), "owner"));
|
||||
Slimefun.getGPSNetwork().openTeleporterGUI(e.getPlayer(), owner, block, Slimefun.getGPSNetwork().getNetworkComplexity(owner));
|
||||
SlimefunPlugin.getGPSNetwork().openTeleporterGUI(e.getPlayer(), owner, block, SlimefunPlugin.getGPSNetwork().getNetworkComplexity(owner));
|
||||
}
|
||||
}
|
||||
else if (id.equals("ELEVATOR_PLATE")) {
|
||||
|
@ -7,6 +7,7 @@ import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public final class NumberUtils {
|
||||
@ -22,7 +23,7 @@ public final class NumberUtils {
|
||||
// We have to create this instance here because it is not thread-safe and should not exist on a static level.
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date.replace('T', ' ').replace("Z", ""));
|
||||
} catch (ParseException x) {
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while parsing a GitHub-Date for Slimefun " + Slimefun.getVersion(), x);
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while parsing a GitHub-Date for Slimefun " + SlimefunPlugin.getVersion(), x);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public final class GEOScanner {
|
||||
|
||||
@ -18,7 +17,7 @@ public final class GEOScanner {
|
||||
private GEOScanner() {}
|
||||
|
||||
public static void scanChunk(Player p, Chunk chunk) {
|
||||
if (Slimefun.getGPSNetwork().getNetworkComplexity(p.getUniqueId()) < 600) {
|
||||
if (SlimefunPlugin.getGPSNetwork().getNetworkComplexity(p.getUniqueId()) < 600) {
|
||||
SlimefunPlugin.getLocal().sendMessages(p, "gps.insufficient-complexity", true, msg -> msg.replace("%complexity%", "600"));
|
||||
return;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public final class SlimefunGuide {
|
||||
|
||||
private static void openMainMenuAsync(Player player, boolean survival, SlimefunGuideLayout layout, int selectedPage) {
|
||||
if (!PlayerProfile.get(player, profile -> Slimefun.runSync(() -> openMainMenu(profile, layout, survival, selectedPage))))
|
||||
Slimefun.getLocal().sendMessage(player, "messages.opening-guide");
|
||||
SlimefunPlugin.getLocal().sendMessage(player, "messages.opening-guide");
|
||||
}
|
||||
|
||||
public static void openMainMenu(PlayerProfile profile, SlimefunGuideLayout layout, boolean survival, int selectedPage) {
|
||||
|
@ -13,6 +13,7 @@ import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
|
||||
import io.github.thebusybiscuit.cscorelib2.recipes.RecipeSnapshot;
|
||||
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkManager;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunTabCompleter;
|
||||
import io.github.thebusybiscuit.slimefun4.core.hooks.SlimefunHooks;
|
||||
@ -43,7 +44,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsLis
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GearListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.IgnitionChamberListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
|
||||
@ -51,6 +51,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfile
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TeleporterListener;
|
||||
@ -93,6 +94,7 @@ public final class SlimefunPlugin extends JavaPlugin {
|
||||
|
||||
private TickerTask ticker;
|
||||
private LocalizationService local;
|
||||
private NetworkManager networkManager;
|
||||
private Config researches;
|
||||
private Config items;
|
||||
private Config whitelist;
|
||||
@ -171,6 +173,9 @@ public final class SlimefunPlugin extends JavaPlugin {
|
||||
// Setup messages.yml
|
||||
local = new LocalizationService(this, config.getString("options.language"));
|
||||
|
||||
// Setting up Network classes
|
||||
networkManager = new NetworkManager(config.getInt("options.max-network-size"));
|
||||
|
||||
// Setting up other stuff
|
||||
utilities = new Utilities();
|
||||
gps = new GPSNetwork();
|
||||
@ -391,8 +396,8 @@ public final class SlimefunPlugin extends JavaPlugin {
|
||||
return instance.whitelist;
|
||||
}
|
||||
|
||||
public GPSNetwork getGPS() {
|
||||
return gps;
|
||||
public static GPSNetwork getGPSNetwork() {
|
||||
return instance.gps;
|
||||
}
|
||||
|
||||
public static SlimefunHooks getHooks() {
|
||||
@ -414,6 +419,10 @@ public final class SlimefunPlugin extends JavaPlugin {
|
||||
public static boolean isActive() {
|
||||
return instance != null;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return instance.getDescription().getVersion();
|
||||
}
|
||||
|
||||
public static ProtectionManager getProtectionManager() {
|
||||
return instance.protections;
|
||||
@ -442,5 +451,9 @@ public final class SlimefunPlugin extends JavaPlugin {
|
||||
public static GitHubService getGitHubService() {
|
||||
return instance.gitHubService;
|
||||
}
|
||||
|
||||
public static NetworkManager getNetworkManager() {
|
||||
return instance.networkManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -993,7 +993,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
||||
});
|
||||
}
|
||||
catch (Exception x) {
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while creating the Script Editor for Slimefun " + Slimefun.getVersion(), x);
|
||||
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while creating the Script Editor for Slimefun " + SlimefunPlugin.getVersion(), x);
|
||||
}
|
||||
|
||||
int i = 10;
|
||||
|
@ -39,13 +39,9 @@ public final class Slimefun {
|
||||
SlimefunPlugin.getUtilities().guideHandlers.put(handler.getTier(), handlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the GPSNetwork instance.
|
||||
*
|
||||
* @return the GPSNetwork instance.
|
||||
*/
|
||||
@Deprecated
|
||||
public static GPSNetwork getGPSNetwork() {
|
||||
return SlimefunPlugin.instance.getGPS();
|
||||
return SlimefunPlugin.getGPSNetwork();
|
||||
}
|
||||
|
||||
public static Logger getLogger() {
|
||||
@ -316,10 +312,12 @@ public final class Slimefun {
|
||||
return SlimefunPlugin.getUtilities().guideHandlers.getOrDefault(tier, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getVersion() {
|
||||
return SlimefunPlugin.instance.getDescription().getVersion();
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public static LocalizationService getLocal() {
|
||||
return SlimefunPlugin.getLocal();
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.Network;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.EnergyHologram;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.network.Network;
|
||||
import me.mrCookieSlime.Slimefun.api.network.NetworkComponent;
|
||||
|
||||
public class EnergyNet extends Network {
|
||||
|
||||
@ -58,7 +58,7 @@ public class EnergyNet extends Network {
|
||||
}
|
||||
|
||||
public static EnergyNet getNetworkFromLocation(Location l) {
|
||||
return getNetworkFromLocation(l, EnergyNet.class);
|
||||
return SlimefunPlugin.getNetworkManager().getNetworkFromLocation(l, EnergyNet.class);
|
||||
}
|
||||
|
||||
public static EnergyNet getNetworkFromLocationOrCreate(Location l) {
|
||||
@ -66,7 +66,7 @@ public class EnergyNet extends Network {
|
||||
|
||||
if (energyNetwork == null) {
|
||||
energyNetwork = new EnergyNet(l);
|
||||
registerNetwork(energyNetwork);
|
||||
SlimefunPlugin.getNetworkManager().registerNetwork(energyNetwork);
|
||||
}
|
||||
|
||||
return energyNetwork;
|
||||
|
@ -25,6 +25,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.Network;
|
||||
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.holograms.SimpleHologram;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
|
||||
@ -35,8 +37,6 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.network.Network;
|
||||
import me.mrCookieSlime.Slimefun.api.network.NetworkComponent;
|
||||
|
||||
public class CargoNet extends Network {
|
||||
|
||||
@ -62,7 +62,7 @@ public class CargoNet extends Network {
|
||||
private final Set<Location> exports = new HashSet<>();
|
||||
|
||||
public static CargoNet getNetworkFromLocation(Location l) {
|
||||
return getNetworkFromLocation(l, CargoNet.class);
|
||||
return SlimefunPlugin.getNetworkManager().getNetworkFromLocation(l, CargoNet.class);
|
||||
}
|
||||
|
||||
public static CargoNet getNetworkFromLocationOrCreate(Location l) {
|
||||
@ -70,7 +70,7 @@ public class CargoNet extends Network {
|
||||
|
||||
if (cargoNetwork == null) {
|
||||
cargoNetwork = new CargoNet(l);
|
||||
registerNetwork(cargoNetwork);
|
||||
SlimefunPlugin.getNetworkManager().registerNetwork(cargoNetwork);
|
||||
}
|
||||
|
||||
return cargoNetwork;
|
||||
|
@ -3,6 +3,7 @@ options:
|
||||
# These builds are much more tested and are far less likely to have any issues.
|
||||
# Note: When running a stable build auto-updates ONLY update to other stable builds! Perfect eh?
|
||||
# You can download the latest stable build here: https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/
|
||||
|
||||
auto-update: true
|
||||
armor-update-interval: 10
|
||||
give-guide-on-first-join: true
|
||||
@ -19,6 +20,7 @@ options:
|
||||
legacy-ore-washer: false
|
||||
legacy-dust-washer: false
|
||||
legacy-ore-grinder: true
|
||||
max-network-size: 200
|
||||
language: en
|
||||
|
||||
guide:
|
||||
|
Loading…
Reference in New Issue
Block a user