Class Network
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.network.Network
An abstract Network class to manage networks in a stateful way
- Author:
- meiamsome
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNetwork(NetworkManager manager, org.bukkit.Location regulator) This constructs a newNetworkat the givenLocation. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddLocationToNetwork(org.bukkit.Location l) This method adds the givenLocationto thisNetwork.abstract NetworkComponentclassifyLocation(org.bukkit.Location l) This method assigns the givenLocationa type ofNetworkComponentfor classification.booleanconnectsTo(org.bukkit.Location l) This method checks whether the givenLocationis part of thisNetwork.voiddisplay()This method runs the network visualizer which displays aParticleon everyLocationthat thisNetworkis connected to.abstract intgetRange()This method returns the range of theNetwork.org.bukkit.LocationThis returns theLocationof the regulator block for thisNetworkintgetSize()This returns the size of thisNetwork.voidmarkDirty(org.bukkit.Location l) This method marks the givenLocationas dirty and adds it to aQueueto handle this update.abstract voidonClassificationChange(org.bukkit.Location l, NetworkComponent from, NetworkComponent to) This method is called whenever aLocationin thisNetworkchanges its classification.voidtick()This method updates thisNetworkand serves as the starting point for any running operations.
-
Field Details
-
regulator
protected org.bukkit.Location regulatorTheLocationof the regulator of thisNetwork. -
connectedLocations
-
regulatorNodes
-
connectorNodes
-
terminusNodes
-
-
Constructor Details
-
Network
This constructs a newNetworkat the givenLocation.- Parameters:
manager- TheNetworkManagerinstanceregulator- TheLocationmarking the regulator of thisNetwork.
-
-
Method Details
-
getRange
public abstract int getRange()This method returns the range of theNetwork. The range determines how far theNetworkwill search for nearby nodes from any given node. It basically translates to the maximum distance between nodes.- Returns:
- the range of this
Network
-
classifyLocation
This method assigns the givenLocationa type ofNetworkComponentfor classification.- Parameters:
l- TheLocationto classify- Returns:
- The assigned type of
NetworkComponentfor thisLocation
-
onClassificationChange
public abstract void onClassificationChange(org.bukkit.Location l, NetworkComponent from, NetworkComponent to) This method is called whenever aLocationin thisNetworkchanges its classification.- Parameters:
l- TheLocationthat is changing its classificationfrom- TheNetworkComponentthisLocationwas previously classified asto- TheNetworkComponentthisLocationis changing to
-
getSize
public int getSize()This returns the size of thisNetwork. It is equivalent to the amount ofLocationsconnected to thisNetwork.- Returns:
- The size of this
Network
-
addLocationToNetwork
protected void addLocationToNetwork(@Nonnull org.bukkit.Location l) This method adds the givenLocationto thisNetwork.- Parameters:
l- TheLocationto add
-
markDirty
public void markDirty(@Nonnull org.bukkit.Location l) This method marks the givenLocationas dirty and adds it to aQueueto handle this update.- Parameters:
l- TheLocationto update
-
connectsTo
public boolean connectsTo(@Nonnull org.bukkit.Location l) This method checks whether the givenLocationis part of thisNetwork.- Parameters:
l- TheLocationto check for- Returns:
- Whether the given
Locationis part of thisNetwork
-
display
public void display()This method runs the network visualizer which displays aParticleon everyLocationthat thisNetworkis connected to. -
getRegulator
@Nonnull public org.bukkit.Location getRegulator()This returns theLocationof the regulator block for thisNetwork- Returns:
- The
Locationof our regulator
-
tick
public void tick()This method updates thisNetworkand serves as the starting point for any running operations.
-