Class NetworkManager

java.lang.Object
io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager

public class NetworkManager extends Object
The NetworkManager is responsible for holding all instances of Network and providing some utility methods that would have probably been static otherwise.
Author:
TheBusyBiscuit, meiamsome
See Also:
  • Constructor Details

    • NetworkManager

      public NetworkManager(int maxStepSize, boolean enableVisualizer, boolean deleteExcessItems)
      This creates a new NetworkManager with the given capacity.
      Parameters:
      maxStepSize - The maximum amount of nodes a Network can have
      enableVisualizer - Whether the Network visualizer is enabled
      deleteExcessItems - Whether excess items from a CargoNet should be voided
    • NetworkManager

      public NetworkManager(int maxStepSize)
      This creates a new NetworkManager with the given capacity.
      Parameters:
      maxStepSize - The maximum amount of nodes a Network can have
  • Method Details

    • getMaxSize

      public int getMaxSize()
      This method returns the limit of nodes a Network can have. This value is read from the Config file.
      Returns:
      the maximum amount of nodes a Network can have
    • isVisualizerEnabled

      public boolean isVisualizerEnabled()
      This returns whether the Network visualizer is enabled.
      Returns:
      Whether the Network visualizer is enabled
    • isItemDeletionEnabled

      public boolean isItemDeletionEnabled()
      This returns whether excess items from a CargoNet should be voided instead of being dropped to the ground.
      Returns:
      Whether to delete excess items
    • getNetworkList

      @Nonnull public List<Network> getNetworkList()
      This returns a List of every Network on the Server. The returned List is not modifiable.
      Returns:
      A List containing every Network on the Server
    • getNetworkFromLocation

      @Nonnull public <T extends Network> Optional<T> getNetworkFromLocation(@Nullable Location l, @Nonnull Class<T> type)
    • getNetworksFromLocation

      @Nonnull public <T extends Network> List<T> getNetworksFromLocation(@Nullable Location l, @Nonnull Class<T> type)
    • registerNetwork

      public void registerNetwork(@Nonnull Network network)
      This registers a given Network.
      Parameters:
      network - The Network to register
    • unregisterNetwork

      public void unregisterNetwork(@Nonnull Network network)
      This removes a Network from the network system.
      Parameters:
      network - The Network to remove
    • updateAllNetworks

      public void updateAllNetworks(@Nonnull Location l)
      This method updates every Network found at the given Location. More precisely, Network.markDirty(Location) will be called.
      Parameters:
      l - The Location to update