Skip to content

Commit

Permalink
fix: ghost network block (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
JWJUN233233 authored Jun 13, 2024
1 parent 3c8ba40 commit 1514bf7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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);
}

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

0 comments on commit 1514bf7

Please sign in to comment.