Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/ghost network block #118

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.sefiraat.networks.listeners;

import io.github.sefiraat.networks.NetworkStorage;
import io.github.sefiraat.networks.network.NetworkNode;
import io.github.sefiraat.networks.network.NodeDefinition;
import io.github.sefiraat.networks.network.NodeType;
import io.github.sefiraat.networks.slimefun.network.NetworkController;
Expand All @@ -25,11 +26,10 @@ public void onBlockPlace(BlockPlaceEvent e) {
private void removeNetwork(Location location) {
NodeDefinition definition = NetworkStorage.getAllNetworkObjects().get(location);
if (definition == null) return;
if (definition.getNode() == null) return;
NetworkStorage.removeNode(location);

if (definition.getNode().getNodeType() == NodeType.CONTROLLER) {
NetworkNode node = definition.getNode();
if (node != null && node.getNodeType() == NodeType.CONTROLLER) {
NetworkController.wipeNetwork(location);
}
NetworkStorage.removeNode(location);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public NetworkRoot(@Nonnull Location location, @Nonnull NodeType type, int maxNo
super(location, type);
this.maxNodes = maxNodes;
this.root = this;
NetworkNode node = new NetworkNode(location, NodeType.CONTROLLER);
io.github.sefiraat.networks.NetworkStorage.getAllNetworkObjects().get(location).setNode(node);
JWJUN233233 marked this conversation as resolved.
Show resolved Hide resolved
}

public void registerNode(@Nonnull Location location, @Nonnull NodeType type) {
Expand Down
Loading