Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Mar 1, 2020
0 parents commit b5ea099
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Project exclude paths
/out/
/target/
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/artifacts/waterTNT_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.com.justabanana.watertnt</groupId>
<artifactId>waterTNT</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<kotlin.version>1.3.61</kotlin.version>
</properties>


<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
41 changes: 41 additions & 0 deletions src/main/kotlin/main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import org.bukkit.Material
import org.bukkit.entity.EntityType
import org.bukkit.entity.TNTPrimed
import org.bukkit.event.EventHandler
import org.bukkit.event.EventPriority
import org.bukkit.event.Listener
import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.event.entity.EntityExplodeEvent

class WaterTNT():JavaPlugin() {
override fun onEnable() {
server.pluginManager.registerEvents(TntExplosionListener(), this)
}
}

class TntExplosionListener:Listener {
@EventHandler(priority = EventPriority.HIGHEST)
fun onEntityExplode(event: EntityExplodeEvent) {
if (event.isCancelled) {
return
}

val entity = event.entity
if (entity.type != EntityType.PRIMED_TNT) {
return
}
val location = entity.location
val world = entity.world
val block = world.getBlockAt(location)

if(block.type != Material.WATER || block.type != Material.LAVA) {
return
}
event.isCancelled = true
block.type = Material.AIR

val newTNT = world.spawnEntity(location,EntityType.PRIMED_TNT) as TNTPrimed
newTNT.fuseTicks = 1
newTNT.setGravity(false)
}
}
5 changes: 5 additions & 0 deletions src/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: WaterTNT
version: 1.0
author: JustABanana
main: WaterTNT
api-version: 1.15
2 changes: 2 additions & 0 deletions waterTNT.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

0 comments on commit b5ea099

Please sign in to comment.