Skip to content

Commit bf22b79

Browse files
send off tnt on request timeout
1 parent 3bf9a42 commit bf22b79

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/main/kotlin/com/outdatedversion/moleculer/visualizer/VisualizerStage.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.outdatedversion.moleculer.visualizer.moleculer.event.RequestTimeoutEv
1313
import com.outdatedversion.moleculer.visualizer.moleculer.event.ResponseEvent
1414
import de.slikey.effectlib.EffectManager
1515
import de.slikey.effectlib.EffectType
16-
import de.slikey.effectlib.effect.CircleEffect
1716
import de.slikey.effectlib.effect.HelixEffect
1817
import net.kyori.adventure.text.Component
1918
import net.kyori.adventure.text.format.NamedTextColor
@@ -31,10 +30,12 @@ import org.bukkit.entity.LivingEntity
3130
import org.bukkit.entity.Mob
3231
import org.bukkit.entity.Panda
3332
import org.bukkit.entity.Pig
33+
import org.bukkit.entity.TNTPrimed
3434
import org.bukkit.event.EventHandler
3535
import org.bukkit.event.HandlerList
3636
import org.bukkit.event.Listener
3737
import org.bukkit.persistence.PersistentDataType
38+
import org.bukkit.util.Vector
3839
import org.jetbrains.annotations.NotNull
3940
import org.slf4j.LoggerFactory
4041
import java.util.*
@@ -110,14 +111,12 @@ class VisualizerStage(
110111
Bukkit.getScheduler().runTask(this.plugin, Runnable {
111112
val sourceEntity = if (event.sourceServiceName != null) getEntityForService(event.sourceNodeId,
112113
event.sourceServiceName) else getEntityForNode(event.sourceNodeId)
114+
113115
if (sourceEntity != null) {
114-
val effect = CircleEffect(this.effectManager)
115-
effect.duration = 750
116-
effect.particles = 20
117-
effect.entity = sourceEntity
118-
effect.color = Color.RED
119-
effect.particle = Particle.REDSTONE
120-
effect.start()
116+
val tnt = sourceEntity.location.world.spawn(sourceEntity.location, TNTPrimed::class.java)
117+
tnt.yield = 0f
118+
tnt.fuseTicks = 40
119+
tnt.velocity = Vector(Math.random(), Math.random() * 2, Math.random())
121120
}
122121
})
123122
}
@@ -255,6 +254,8 @@ class VisualizerStage(
255254
serviceName = it
256255
)?.remove()
257256
}
257+
nodeIdToEntityUuid.remove(event.nodeId)
258+
nodeIdToServices.remove(event.nodeId)
258259
})
259260
}
260261

0 commit comments

Comments
 (0)