diff --git a/Bunkers/.gradle/6.8/executionHistory/executionHistory.bin b/Bunkers/.gradle/6.8/executionHistory/executionHistory.bin new file mode 100644 index 0000000..cbd758c Binary files /dev/null and b/Bunkers/.gradle/6.8/executionHistory/executionHistory.bin differ diff --git a/Bunkers/.gradle/6.8/executionHistory/executionHistory.lock b/Bunkers/.gradle/6.8/executionHistory/executionHistory.lock new file mode 100644 index 0000000..599e431 Binary files /dev/null and b/Bunkers/.gradle/6.8/executionHistory/executionHistory.lock differ diff --git a/Bunkers/.gradle/6.8/fileChanges/last-build.bin b/Bunkers/.gradle/6.8/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Bunkers/.gradle/6.8/fileChanges/last-build.bin differ diff --git a/Bunkers/.gradle/6.8/fileHashes/fileHashes.bin b/Bunkers/.gradle/6.8/fileHashes/fileHashes.bin new file mode 100644 index 0000000..19af660 Binary files /dev/null and b/Bunkers/.gradle/6.8/fileHashes/fileHashes.bin differ diff --git a/Bunkers/.gradle/6.8/fileHashes/fileHashes.lock b/Bunkers/.gradle/6.8/fileHashes/fileHashes.lock new file mode 100644 index 0000000..85082a6 Binary files /dev/null and b/Bunkers/.gradle/6.8/fileHashes/fileHashes.lock differ diff --git a/Bunkers/.gradle/6.8/fileHashes/resourceHashesCache.bin b/Bunkers/.gradle/6.8/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..afdd41f Binary files /dev/null and b/Bunkers/.gradle/6.8/fileHashes/resourceHashesCache.bin differ diff --git a/Bunkers/.gradle/6.8/gc.properties b/Bunkers/.gradle/6.8/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Bunkers/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Bunkers/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..b1d611b Binary files /dev/null and b/Bunkers/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Bunkers/.gradle/buildOutputCleanup/cache.properties b/Bunkers/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..4549f70 --- /dev/null +++ b/Bunkers/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sat Jul 24 19:59:25 CEST 2021 +gradle.version=6.8 diff --git a/Bunkers/.gradle/buildOutputCleanup/outputFiles.bin b/Bunkers/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..24fdeeb Binary files /dev/null and b/Bunkers/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/Bunkers/.gradle/checksums/checksums.lock b/Bunkers/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..906b66a Binary files /dev/null and b/Bunkers/.gradle/checksums/checksums.lock differ diff --git a/Bunkers/.gradle/checksums/md5-checksums.bin b/Bunkers/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..78590fa Binary files /dev/null and b/Bunkers/.gradle/checksums/md5-checksums.bin differ diff --git a/Bunkers/.gradle/checksums/sha1-checksums.bin b/Bunkers/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..33ead88 Binary files /dev/null and b/Bunkers/.gradle/checksums/sha1-checksums.bin differ diff --git a/Bunkers/.gradle/configuration-cache/gc.properties b/Bunkers/.gradle/configuration-cache/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Bunkers/.gradle/vcs-1/gc.properties b/Bunkers/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Bunkers/.idea/.gitignore b/Bunkers/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Bunkers/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Bunkers/.idea/compiler.xml b/Bunkers/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/Bunkers/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Bunkers/.idea/gradle.xml b/Bunkers/.idea/gradle.xml new file mode 100644 index 0000000..611e7c8 --- /dev/null +++ b/Bunkers/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/Bunkers/.idea/jarRepositories.xml b/Bunkers/.idea/jarRepositories.xml new file mode 100644 index 0000000..55f1d4b --- /dev/null +++ b/Bunkers/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Bunkers/.idea/libraries-with-intellij-classes.xml b/Bunkers/.idea/libraries-with-intellij-classes.xml new file mode 100644 index 0000000..9fa3156 --- /dev/null +++ b/Bunkers/.idea/libraries-with-intellij-classes.xml @@ -0,0 +1,65 @@ + + + + + + \ No newline at end of file diff --git a/Bunkers/.idea/misc.xml b/Bunkers/.idea/misc.xml new file mode 100644 index 0000000..b0051c8 --- /dev/null +++ b/Bunkers/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Bunkers/build.gradle b/Bunkers/build.gradle new file mode 100644 index 0000000..d58be1c --- /dev/null +++ b/Bunkers/build.gradle @@ -0,0 +1,62 @@ +plugins { + id "org.jetbrains.kotlin.jvm" version "1.5.0" + id "com.github.johnrengelman.shadow" version "5.2.0" +} + +group = 'cc.fyre.carnage' +version = '1.0-SNAPSHOT' +description = 'carnage' + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() +} + +repositories { + mavenLocal() + mavenCentral() + + flatDir { + dirs 'libs' + } + +} + +dependencies { + + compile "com.google.code.gson:gson:2.8.5" + + compileOnly "net.frozenorb:qLib:LATEST" + compileOnly 'cc.fyre.engine:game:1.0-SNAPSHOT' + compileOnly 'com.comphenix.protocol:ProtocolLib:4.4.0' + compileOnly 'net.hylist:spigot-server:1.7.10-R0.1-SNAPSHOT' + compileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.0' + + compileOnly fileTree(dir: 'libs', include: ['*.jar']) +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} \ No newline at end of file diff --git a/Bunkers/build/classes/kotlin/main/META-INF/bunkers.kotlin_module b/Bunkers/build/classes/kotlin/main/META-INF/bunkers.kotlin_module new file mode 100644 index 0000000..70f0f69 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/META-INF/bunkers.kotlin_module differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/Bunkers$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/Bunkers$Companion.class new file mode 100644 index 0000000..6993789 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/Bunkers$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/Bunkers.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/Bunkers.class new file mode 100644 index 0000000..576447f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/Bunkers.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/ClaimHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/ClaimHandler.class new file mode 100644 index 0000000..88f8765 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/ClaimHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim$BorderIterator$BorderDirection.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim$BorderIterator$BorderDirection.class new file mode 100644 index 0000000..94ec069 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim$BorderIterator$BorderDirection.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim$BorderIterator.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim$BorderIterator.class new file mode 100644 index 0000000..8268dea Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim$BorderIterator.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim.class new file mode 100644 index 0000000..a1a119d Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/Claim.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/ClaimSelection$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/ClaimSelection$Companion.class new file mode 100644 index 0000000..6f56a4c Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/ClaimSelection$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/ClaimSelection.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/ClaimSelection.class new file mode 100644 index 0000000..8a55377 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/data/ClaimSelection.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/listener/ClaimListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/listener/ClaimListener.class new file mode 100644 index 0000000..9d8b443 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/listener/ClaimListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/listener/ClaimPositionListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/listener/ClaimPositionListener.class new file mode 100644 index 0000000..a87be6c Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/listener/ClaimPositionListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/movement/ClaimMovementAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/movement/ClaimMovementAdapter.class new file mode 100644 index 0000000..ef87cfd Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/claim/movement/ClaimMovementAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/EventHandler$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/EventHandler$Companion.class new file mode 100644 index 0000000..c26ef08 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/EventHandler$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/EventHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/EventHandler.class new file mode 100644 index 0000000..1b694ac Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/EventHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/command/KOTHSetTimeCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/command/KOTHSetTimeCommand.class new file mode 100644 index 0000000..3a68147 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/command/KOTHSetTimeCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/command/KOTHStartCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/command/KOTHStartCommand.class new file mode 100644 index 0000000..7d97c77 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/command/KOTHStartCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/listener/EventListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/listener/EventListener.class new file mode 100644 index 0000000..e2cc050 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/listener/EventListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/service/EventService.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/service/EventService.class new file mode 100644 index 0000000..6e6928c Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/event/service/EventService.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$Companion.class new file mode 100644 index 0000000..9c63cd8 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$onGameFinish$$inlined$sortedByDescending$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$onGameFinish$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..ad3c646 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$onGameFinish$$inlined$sortedByDescending$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$onPlayersSent$$inlined$sortedByDescending$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$onPlayersSent$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..bd83578 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter$onPlayersSent$$inlined$sortedByDescending$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter.class new file mode 100644 index 0000000..89bbf43 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/BunkersGameAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/deathmessage/BunkersDeathMessageConfiguration.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/deathmessage/BunkersDeathMessageConfiguration.class new file mode 100644 index 0000000..e4a603f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/deathmessage/BunkersDeathMessageConfiguration.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener$onChunkLoad$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener$onChunkLoad$1.class new file mode 100644 index 0000000..3c4cb2f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener$onChunkLoad$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener$onMapLoad$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener$onMapLoad$1.class new file mode 100644 index 0000000..283a9e4 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener$onMapLoad$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener.class new file mode 100644 index 0000000..658998b Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/ChunkListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$Companion.class new file mode 100644 index 0000000..c7ffcdf Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$onGameStateChangeEnding$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$onGameStateChangeEnding$1.class new file mode 100644 index 0000000..e9fdfdf Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$onGameStateChangeEnding$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$onItemConsume$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$onItemConsume$1.class new file mode 100644 index 0000000..1f402de Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener$onItemConsume$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener.class new file mode 100644 index 0000000..1c598b5 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/GameListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/LunarClientListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/LunarClientListener.class new file mode 100644 index 0000000..8455169 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/LunarClientListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/VotingListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/VotingListener.class new file mode 100644 index 0000000..f76cfdb Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/listener/VotingListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/CountdownScoreboardAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/CountdownScoreboardAdapter.class new file mode 100644 index 0000000..6b27e29 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/CountdownScoreboardAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/InProgressScoreboardAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/InProgressScoreboardAdapter.class new file mode 100644 index 0000000..ee06bc7 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/InProgressScoreboardAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter$getScoreGetter$lambda-2$$inlined$sortedBy$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter$getScoreGetter$lambda-2$$inlined$sortedBy$1.class new file mode 100644 index 0000000..a47a922 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter$getScoreGetter$lambda-2$$inlined$sortedBy$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter.class new file mode 100644 index 0000000..bb6e5a4 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/WaitingScoreboardAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/WaitingScoreboardAdapter.class new file mode 100644 index 0000000..31b0498 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/scoreboard/WaitingScoreboardAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter$Direction.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter$Direction.class new file mode 100644 index 0000000..9112440 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter$Direction.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter$provide$$inlined$sortedByDescending$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter$provide$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..07ba0d2 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter$provide$$inlined$sortedByDescending$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter.class new file mode 100644 index 0000000..a455128 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/game/tab/BunkersTabAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/PillarHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/PillarHandler.class new file mode 100644 index 0000000..35287b6 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/PillarHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/Pillar$Type.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/Pillar$Type.class new file mode 100644 index 0000000..d4434b5 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/Pillar$Type.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/Pillar.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/Pillar.class new file mode 100644 index 0000000..1398018 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/Pillar.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/adapter/WallAdapter.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/adapter/WallAdapter.class new file mode 100644 index 0000000..2190806 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/data/adapter/WallAdapter.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarListener.class new file mode 100644 index 0000000..38346c2 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarPacketListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarPacketListener.class new file mode 100644 index 0000000..0bd2e9b Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarPacketListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarWallListener$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarWallListener$Companion.class new file mode 100644 index 0000000..41b34b3 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarWallListener$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarWallListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarWallListener.class new file mode 100644 index 0000000..c44ad19 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pillar/listener/PillarWallListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/PvPClassHandler$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/PvPClassHandler$Companion.class new file mode 100644 index 0000000..7cd822f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/PvPClassHandler$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/PvPClassHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/PvPClassHandler.class new file mode 100644 index 0000000..c923157 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/PvPClassHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/PvPClass$Type.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/PvPClass$Type.class new file mode 100644 index 0000000..0e30bc5 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/PvPClass$Type.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/PvPClass.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/PvPClass.class new file mode 100644 index 0000000..1c2650b Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/PvPClass.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem$EffectConsumableItem.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem$EffectConsumableItem.class new file mode 100644 index 0000000..307ef5d Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem$EffectConsumableItem.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem.class new file mode 100644 index 0000000..e1834f5 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect$BardEffect$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect$BardEffect$Companion.class new file mode 100644 index 0000000..61510ea Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect$BardEffect$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect$BardEffect.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect$BardEffect.class new file mode 100644 index 0000000..a7abad0 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect$BardEffect.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect.class new file mode 100644 index 0000000..eb2778d Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/service/BardService.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/service/BardService.class new file mode 100644 index 0000000..e7e9358 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/service/BardService.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/type/BardClass.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/type/BardClass.class new file mode 100644 index 0000000..fb67860 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/data/type/BardClass.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent$Companion.class new file mode 100644 index 0000000..f765357 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent.class new file mode 100644 index 0000000..29f45d5 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent$Companion.class new file mode 100644 index 0000000..5a99b76 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent.class new file mode 100644 index 0000000..2bc5162 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent$Companion.class new file mode 100644 index 0000000..1bbe2e3 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent.class new file mode 100644 index 0000000..bc10cc3 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/listener/PvPClassListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/listener/PvPClassListener.class new file mode 100644 index 0000000..ebe3a1e Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/pvpclass/listener/PvPClassListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/RepairHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/RepairHandler.class new file mode 100644 index 0000000..5a0e7c6 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/RepairHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/listener/RepairListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/listener/RepairListener.class new file mode 100644 index 0000000..7564b75 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/listener/RepairListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/menu/RepairMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/menu/RepairMenu.class new file mode 100644 index 0000000..a51ea61 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/menu/RepairMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/menu/element/RepairButton.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/menu/element/RepairButton.class new file mode 100644 index 0000000..732a303 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/repair/menu/element/RepairButton.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/ShopHandler$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/ShopHandler$Companion.class new file mode 100644 index 0000000..edeb601 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/ShopHandler$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/ShopHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/ShopHandler.class new file mode 100644 index 0000000..3fb5e90 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/ShopHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/data/ShopType$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/data/ShopType$Companion.class new file mode 100644 index 0000000..0aabb53 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/data/ShopType$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/data/ShopType.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/data/ShopType.class new file mode 100644 index 0000000..b830793 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/data/ShopType.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/listener/ShopListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/listener/ShopListener.class new file mode 100644 index 0000000..0b88326 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/listener/ShopListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/BuildMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/BuildMenu.class new file mode 100644 index 0000000..891173b Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/BuildMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/ClassMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/ClassMenu.class new file mode 100644 index 0000000..136ad23 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/ClassMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/CombatMenu$getButtons$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/CombatMenu$getButtons$1.class new file mode 100644 index 0000000..80e4269 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/CombatMenu$getButtons$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/CombatMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/CombatMenu.class new file mode 100644 index 0000000..65cb59d Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/CombatMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/EnchantMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/EnchantMenu.class new file mode 100644 index 0000000..9ab237e Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/EnchantMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/SellMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/SellMenu.class new file mode 100644 index 0000000..b3d13ff Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/SellMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/BuyElement.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/BuyElement.class new file mode 100644 index 0000000..c471476 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/BuyElement.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/EnchantElement.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/EnchantElement.class new file mode 100644 index 0000000..7954628 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/EnchantElement.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/SellElement.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/SellElement.class new file mode 100644 index 0000000..7abacca Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/menu/element/SellElement.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/parameter/ShopTypeParameterProvider.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/parameter/ShopTypeParameterProvider.class new file mode 100644 index 0000000..1c14c8c Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/parameter/ShopTypeParameterProvider.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/service/ShopService.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/service/ShopService.class new file mode 100644 index 0000000..b58d2eb Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/shop/service/ShopService.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler$Companion.class new file mode 100644 index 0000000..ce37442 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler$WhenMappings.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler$WhenMappings.class new file mode 100644 index 0000000..180cebc Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler$WhenMappings.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler.class new file mode 100644 index 0000000..f91b014 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/StatisticHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/command/BalanceCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/command/BalanceCommand.class new file mode 100644 index 0000000..1614558 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/command/BalanceCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/command/PayCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/command/PayCommand.class new file mode 100644 index 0000000..1ee5c9f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/command/PayCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/listener/StatisticListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/listener/StatisticListener.class new file mode 100644 index 0000000..b3f3a2a Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/listener/StatisticListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/service/BalanceService.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/service/BalanceService.class new file mode 100644 index 0000000..5bae544 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/statistic/service/BalanceService.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/SupplyHandler$addSupplyToService$task$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/SupplyHandler$addSupplyToService$task$1.class new file mode 100644 index 0000000..d531195 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/SupplyHandler$addSupplyToService$task$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/SupplyHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/SupplyHandler.class new file mode 100644 index 0000000..996cb06 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/SupplyHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/data/Supply.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/data/Supply.class new file mode 100644 index 0000000..8f6a095 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/data/Supply.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/listener/SupplyListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/listener/SupplyListener.class new file mode 100644 index 0000000..a9de65d Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/supply/listener/SupplyListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/TeamHandler$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/TeamHandler$Companion.class new file mode 100644 index 0000000..514d393 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/TeamHandler$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/TeamHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/TeamHandler.class new file mode 100644 index 0000000..ae35f85 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/TeamHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamChatCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamChatCommand.class new file mode 100644 index 0000000..23418d7 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamChatCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamClaimCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamClaimCommand.class new file mode 100644 index 0000000..55b27c9 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamClaimCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamFocusCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamFocusCommand.class new file mode 100644 index 0000000..e5859e1 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamFocusCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamHQCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamHQCommand.class new file mode 100644 index 0000000..59dba4f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamHQCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamInfoCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamInfoCommand.class new file mode 100644 index 0000000..6f2dfbf Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamInfoCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamLocationCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamLocationCommand.class new file mode 100644 index 0000000..582a882 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamLocationCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamRallyCommand$execute$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamRallyCommand$execute$1.class new file mode 100644 index 0000000..4d67517 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamRallyCommand$execute$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamRallyCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamRallyCommand.class new file mode 100644 index 0000000..c5c8fd3 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamRallyCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetDTRCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetDTRCommand.class new file mode 100644 index 0000000..a7f9ac4 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetDTRCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetHQCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetHQCommand.class new file mode 100644 index 0000000..b1f6050 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetHQCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetHologramCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetHologramCommand.class new file mode 100644 index 0000000..033ed28 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetHologramCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetShopCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetShopCommand.class new file mode 100644 index 0000000..9c89190 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamSetShopCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamVoteKickCommand.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamVoteKickCommand.class new file mode 100644 index 0000000..2e74ee0 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/TeamVoteKickCommand.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/parameter/TeamParameterProvider.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/parameter/TeamParameterProvider.class new file mode 100644 index 0000000..9d96b34 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/command/parameter/TeamParameterProvider.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Companion.class new file mode 100644 index 0000000..b7ef5b9 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Type$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Type$Companion.class new file mode 100644 index 0000000..e9d6cc5 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Type$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Type.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Type.class new file mode 100644 index 0000000..b14654a Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team$Type.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team.class new file mode 100644 index 0000000..6ae731e Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/Team.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/TeamChest.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/TeamChest.class new file mode 100644 index 0000000..284c0e3 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/data/TeamChest.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamChatListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamChatListener.class new file mode 100644 index 0000000..d72f60f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamChatListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamChestListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamChestListener.class new file mode 100644 index 0000000..fae9751 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamChestListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamListener$onPlayerJoin$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamListener$onPlayerJoin$1.class new file mode 100644 index 0000000..921af44 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamListener$onPlayerJoin$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamListener.class new file mode 100644 index 0000000..ebff409 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamProtectionListener$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamProtectionListener$Companion.class new file mode 100644 index 0000000..45ef75f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamProtectionListener$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamProtectionListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamProtectionListener.class new file mode 100644 index 0000000..ea73612 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamProtectionListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamRallyListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamRallyListener.class new file mode 100644 index 0000000..86ed498 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/listener/TeamRallyListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/TeamChestModifyMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/TeamChestModifyMenu.class new file mode 100644 index 0000000..9e43928 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/TeamChestModifyMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/TeamChestPurchaseMenu.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/TeamChestPurchaseMenu.class new file mode 100644 index 0000000..8d6a961 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/TeamChestPurchaseMenu.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/button/TeamChestMemberButton.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/button/TeamChestMemberButton.class new file mode 100644 index 0000000..023580a Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/button/TeamChestMemberButton.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/button/TeamChestPurchaseButton.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/button/TeamChestPurchaseButton.class new file mode 100644 index 0000000..39d53f1 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/team/menu/button/TeamChestPurchaseButton.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/TimerHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/TimerHandler.class new file mode 100644 index 0000000..80f0294 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/TimerHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/Timer$createTask$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/Timer$createTask$1.class new file mode 100644 index 0000000..5d0173a Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/Timer$createTask$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/Timer.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/Timer.class new file mode 100644 index 0000000..1f0254f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/Timer.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/TimerType$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/TimerType$Companion.class new file mode 100644 index 0000000..ed9b5bd Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/TimerType$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/TimerType.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/TimerType.class new file mode 100644 index 0000000..37cf8e6 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/data/TimerType.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerCreateEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerCreateEvent$Companion.class new file mode 100644 index 0000000..aa821ad Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerCreateEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerCreateEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerCreateEvent.class new file mode 100644 index 0000000..d6b1123 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerCreateEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExpireEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExpireEvent$Companion.class new file mode 100644 index 0000000..c06c745 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExpireEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExpireEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExpireEvent.class new file mode 100644 index 0000000..4ce3dcf Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExpireEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExtendEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExtendEvent$Companion.class new file mode 100644 index 0000000..dc89b49 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExtendEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExtendEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExtendEvent.class new file mode 100644 index 0000000..4f1cb43 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerExtendEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerRemoveEvent$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerRemoveEvent$Companion.class new file mode 100644 index 0000000..ab4ff37 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerRemoveEvent$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerRemoveEvent.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerRemoveEvent.class new file mode 100644 index 0000000..f02c279 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/event/TimerRemoveEvent.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/AntidoteListener$onTimerCreate$1.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/AntidoteListener$onTimerCreate$1.class new file mode 100644 index 0000000..8e8e409 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/AntidoteListener$onTimerCreate$1.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/AntidoteListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/AntidoteListener.class new file mode 100644 index 0000000..8d1e864 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/AntidoteListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/EnderpearlListener$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/EnderpearlListener$Companion.class new file mode 100644 index 0000000..19c9ec3 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/EnderpearlListener$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/EnderpearlListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/EnderpearlListener.class new file mode 100644 index 0000000..c78d055 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/EnderpearlListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/HomeListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/HomeListener.class new file mode 100644 index 0000000..277c2a8 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/HomeListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/RespawnListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/RespawnListener.class new file mode 100644 index 0000000..84cae57 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/RespawnListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/TimerListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/TimerListener.class new file mode 100644 index 0000000..ab9599c Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/timer/listener/TimerListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/VillagerHandler$Companion.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/VillagerHandler$Companion.class new file mode 100644 index 0000000..2cfb9aa Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/VillagerHandler$Companion.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/VillagerHandler.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/VillagerHandler.class new file mode 100644 index 0000000..ca8678c Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/VillagerHandler.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/data/VillagerEntity.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/data/VillagerEntity.class new file mode 100644 index 0000000..61e0c7f Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/data/VillagerEntity.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/data/kb/ZeroKBProfile.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/data/kb/ZeroKBProfile.class new file mode 100644 index 0000000..b667a69 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/data/kb/ZeroKBProfile.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerListener.class new file mode 100644 index 0000000..49cc692 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerLoggerListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerLoggerListener.class new file mode 100644 index 0000000..8c419cd Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerLoggerListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerPacketListener.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerPacketListener.class new file mode 100644 index 0000000..0eca874 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/listener/VillagerPacketListener.class differ diff --git a/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/service/VillagerLoggerService.class b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/service/VillagerLoggerService.class new file mode 100644 index 0000000..2a74075 Binary files /dev/null and b/Bunkers/build/classes/kotlin/main/cc/fyre/bunkers/villager/service/VillagerLoggerService.class differ diff --git a/Bunkers/build/kotlin/compileKotlin/build-history.bin b/Bunkers/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..211cfea Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/build-history.bin differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..4a132c5 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..31db614 --- /dev/null +++ b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream @@ -0,0 +1 @@ +Q$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\command\KOTHSetTimeCommand.ktF$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\EnchantMenu.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\data\TimerType.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\BuildMenu.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\service\BardService.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerExtendEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamInfoCommand.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetDTRCommand.kt\$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\InProgressScoreboardAdapter.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\data\Supply.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\TimerHandler.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamChestListener.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\movement\ClaimMovementAdapter.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamClaimCommand.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\data\Claim.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\PvPClassEquipEvent.kt[$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\CountdownScoreboardAdapter.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\parameter\ShopTypeParameterProvider.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\listener\RepairListener.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\PvPClassUnEquipEvent.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\listener\ShopListener.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\service\ShopService.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\CombatMenu.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\menu\element\RepairButton.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\LunarClientListener.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\command\KOTHStartCommand.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\service\VillagerLoggerService.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\listener\SupplyListener.ktG$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\PvPClass.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarWallListener.ktX$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\VotingScoreboardAdapter.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\type\BardEffectEvent.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarPacketListener.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\listener\EventListener.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\ClassMenu.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\EnderpearlListener.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamChatListener.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\ShopHandler.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\TeamHandler.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\service\EventService.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\service\BalanceService.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\data\kb\ZeroKBProfile.ktG$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\menu\RepairMenu.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\AntidoteListener.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamLocationCommand.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\listener\PvPClassListener.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\data\Pillar.kt]$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\parameter\TeamParameterProvider.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\TimerListener.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\data\Timer.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\command\BalanceCommand.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\data\TeamChest.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\data\ShopType.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\VotingListener.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetHologramCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerRemoveEvent.ktH$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\BunkersGameAdapter.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\SellElement.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\TeamChestModifyMenu.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\SellMenu.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\button\TeamChestPurchaseButton.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\data\adapter\WallAdapter.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\command\PayCommand.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\tab\BunkersTabAdapter.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\button\TeamChestMemberButton.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamChatCommand.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamRallyListener.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamVoteKickCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\data\VillagerEntity.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\EnchantElement.ktc$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\deathmessage\BunkersDeathMessageConfiguration.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\PillarHandler.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetShopCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetHQCommand.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamHQCommand.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\TeamChestPurchaseMenu.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\VillagerHandler.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\WaitingScoreboardAdapter.kt?$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\data\Team.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\SupplyHandler.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerExpireEvent.kt8$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\Bunkers.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\BuyElement.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\type\BardClass.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\RespawnListener.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\PvPClassHandler.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamListener.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamFocusCommand.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\RepairHandler.ktL$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\HomeListener.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerListener.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\item\energy\EnergyEffect.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\GameListener.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\listener\ClaimPositionListener.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerLoggerListener.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamRallyCommand.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerPacketListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\listener\StatisticListener.ktL$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\ChunkListener.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\EventHandler.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\item\ConsumableItem.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\listener\ClaimListener.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerCreateEvent.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\StatisticHandler.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamProtectionListener.ktJ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\data\ClaimSelection.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\ClaimHandler.kt \ No newline at end of file diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..4ee2ced Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..a5fbec6 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..ba08800 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..4b1d575 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..0a3f5f3 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..aa71739 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..8aa3e07 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..c8fcfd5 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..3a69b8c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..2270724 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..b2011f2 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..aa71739 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..8aa3e07 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..c8fcfd5 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..e74b63c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..2270724 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab new file mode 100644 index 0000000..14dadaa Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream new file mode 100644 index 0000000..f8d2c20 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len new file mode 100644 index 0000000..c74a057 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len new file mode 100644 index 0000000..ec8f944 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at new file mode 100644 index 0000000..ca60b73 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i new file mode 100644 index 0000000..eda4a5c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..9dca8c7 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..b8e7ca0 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..396b400 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..73f3a40 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..906b9aa Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..f98dde9 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..cf0a9b4 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..49dd08b Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..bb7002d Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..90f446f Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values new file mode 100644 index 0000000..c25a598 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..4c3e8fc Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s new file mode 100644 index 0000000..3af0aac --- /dev/null +++ b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s @@ -0,0 +1 @@ +âµø² \ No newline at end of file diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..f723b6e Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..5faf1e8 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..726fd8c --- /dev/null +++ b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream @@ -0,0 +1 @@ +8$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\Bunkers.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\ClaimHandler.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\data\Claim.ktJ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\data\ClaimSelection.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\listener\ClaimListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\listener\ClaimPositionListener.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\movement\ClaimMovementAdapter.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\EventHandler.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\command\KOTHSetTimeCommand.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\command\KOTHStartCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\listener\EventListener.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\service\EventService.ktH$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\BunkersGameAdapter.ktc$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\deathmessage\BunkersDeathMessageConfiguration.ktL$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\ChunkListener.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\GameListener.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\LunarClientListener.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\VotingListener.kt[$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\CountdownScoreboardAdapter.kt\$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\InProgressScoreboardAdapter.ktX$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\VotingScoreboardAdapter.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\WaitingScoreboardAdapter.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\tab\BunkersTabAdapter.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\PillarHandler.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\data\Pillar.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\data\adapter\WallAdapter.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarPacketListener.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarWallListener.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\PvPClassHandler.ktG$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\PvPClass.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\item\ConsumableItem.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\item\energy\EnergyEffect.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\service\BardService.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\type\BardClass.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\PvPClassEquipEvent.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\PvPClassUnEquipEvent.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\type\BardEffectEvent.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\listener\PvPClassListener.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\RepairHandler.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\listener\RepairListener.ktG$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\menu\RepairMenu.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\menu\element\RepairButton.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\ShopHandler.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\data\ShopType.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\listener\ShopListener.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\BuildMenu.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\ClassMenu.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\CombatMenu.ktF$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\EnchantMenu.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\SellMenu.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\BuyElement.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\EnchantElement.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\SellElement.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\parameter\ShopTypeParameterProvider.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\service\ShopService.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\StatisticHandler.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\command\BalanceCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\command\PayCommand.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\listener\StatisticListener.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\service\BalanceService.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\SupplyHandler.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\data\Supply.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\listener\SupplyListener.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\TeamHandler.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamChatCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamClaimCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamFocusCommand.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamHQCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamInfoCommand.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamLocationCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamRallyCommand.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetDTRCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetHQCommand.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetHologramCommand.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetShopCommand.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamVoteKickCommand.kt]$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\parameter\TeamParameterProvider.kt?$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\data\Team.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\data\TeamChest.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamChatListener.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamChestListener.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamProtectionListener.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamRallyListener.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\TeamChestModifyMenu.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\TeamChestPurchaseMenu.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\button\TeamChestMemberButton.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\button\TeamChestPurchaseButton.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\TimerHandler.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\data\Timer.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\data\TimerType.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerCreateEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerExpireEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerExtendEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerRemoveEvent.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\AntidoteListener.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\EnderpearlListener.ktL$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\HomeListener.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\RespawnListener.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\TimerListener.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\VillagerHandler.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\data\VillagerEntity.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\data\kb\ZeroKBProfile.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerListener.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerLoggerListener.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerPacketListener.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\service\VillagerLoggerService.kt \ No newline at end of file diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..4ee2ced Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..a5fbec6 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..3ce9024 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..9299d12 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..d4da447 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..319fc62 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..d73a735 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..b31f54b Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..0682e54 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..ed93c06 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..95137dd Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..8dd30df Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..e5ebdc5 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..bba171d Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..a81966d Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..6ae275f Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..2bef6ae --- /dev/null +++ b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +114 +6 \ No newline at end of file diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..6ac1e4c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..726fd8c --- /dev/null +++ b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream @@ -0,0 +1 @@ +8$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\Bunkers.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\ClaimHandler.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\data\Claim.ktJ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\data\ClaimSelection.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\listener\ClaimListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\listener\ClaimPositionListener.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\claim\movement\ClaimMovementAdapter.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\EventHandler.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\command\KOTHSetTimeCommand.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\command\KOTHStartCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\listener\EventListener.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\event\service\EventService.ktH$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\BunkersGameAdapter.ktc$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\deathmessage\BunkersDeathMessageConfiguration.ktL$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\ChunkListener.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\GameListener.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\LunarClientListener.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\listener\VotingListener.kt[$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\CountdownScoreboardAdapter.kt\$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\InProgressScoreboardAdapter.ktX$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\VotingScoreboardAdapter.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\scoreboard\WaitingScoreboardAdapter.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\game\tab\BunkersTabAdapter.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\PillarHandler.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\data\Pillar.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\data\adapter\WallAdapter.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarPacketListener.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pillar\listener\PillarWallListener.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\PvPClassHandler.ktG$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\PvPClass.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\item\ConsumableItem.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\item\energy\EnergyEffect.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\service\BardService.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\data\type\BardClass.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\PvPClassEquipEvent.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\PvPClassUnEquipEvent.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\event\type\BardEffectEvent.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\pvpclass\listener\PvPClassListener.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\RepairHandler.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\listener\RepairListener.ktG$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\menu\RepairMenu.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\repair\menu\element\RepairButton.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\ShopHandler.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\data\ShopType.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\listener\ShopListener.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\BuildMenu.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\ClassMenu.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\CombatMenu.ktF$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\EnchantMenu.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\SellMenu.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\BuyElement.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\EnchantElement.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\menu\element\SellElement.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\parameter\ShopTypeParameterProvider.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\shop\service\ShopService.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\StatisticHandler.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\command\BalanceCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\command\PayCommand.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\listener\StatisticListener.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\statistic\service\BalanceService.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\SupplyHandler.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\data\Supply.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\supply\listener\SupplyListener.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\TeamHandler.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamChatCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamClaimCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamFocusCommand.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamHQCommand.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamInfoCommand.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamLocationCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamRallyCommand.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetDTRCommand.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetHQCommand.ktT$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetHologramCommand.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamSetShopCommand.ktQ$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\TeamVoteKickCommand.kt]$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\command\parameter\TeamParameterProvider.kt?$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\data\Team.ktD$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\data\TeamChest.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamChatListener.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamChestListener.ktK$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamListener.ktU$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamProtectionListener.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\listener\TeamRallyListener.ktN$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\TeamChestModifyMenu.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\TeamChestPurchaseMenu.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\button\TeamChestMemberButton.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\team\menu\button\TeamChestPurchaseButton.ktC$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\TimerHandler.ktA$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\data\Timer.ktE$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\data\TimerType.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerCreateEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerExpireEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerExtendEvent.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\event\TimerRemoveEvent.ktP$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\AntidoteListener.ktR$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\EnderpearlListener.ktL$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\HomeListener.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\RespawnListener.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\timer\listener\TimerListener.ktI$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\VillagerHandler.ktM$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\data\VillagerEntity.ktO$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\data\kb\ZeroKBProfile.ktS$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerListener.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerLoggerListener.ktY$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\listener\VillagerPacketListener.ktW$PROJECT_DIR$\src\main\kotlin\cc\fyre\bunkers\villager\service\VillagerLoggerService.kt \ No newline at end of file diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..4ee2ced Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..a5fbec6 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..5f07d47 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..25e690c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..36afa02 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..3f77128 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..cfeb6a8 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..5672451 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..8b24c41 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..1401fd5 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..ba569a6 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..6d1fc79 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..ee7366c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..a4bec2c Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values new file mode 100644 index 0000000..83e39c2 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..7ffdf31 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s new file mode 100644 index 0000000..6631c3d --- /dev/null +++ b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s @@ -0,0 +1 @@ +ísÛ}ârÊ–ðbÅX \ No newline at end of file diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..01f3248 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..5315f7a Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/Bunkers/build/kotlin/compileKotlin/last-build.bin b/Bunkers/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..9e10ea4 Binary files /dev/null and b/Bunkers/build/kotlin/compileKotlin/last-build.bin differ diff --git a/Bunkers/build/libs/bunkers-1.0-SNAPSHOT.jar b/Bunkers/build/libs/bunkers-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..5fe82d4 Binary files /dev/null and b/Bunkers/build/libs/bunkers-1.0-SNAPSHOT.jar differ diff --git a/Bunkers/build/publications/shadow/pom-default.xml b/Bunkers/build/publications/shadow/pom-default.xml new file mode 100644 index 0000000..59d084f --- /dev/null +++ b/Bunkers/build/publications/shadow/pom-default.xml @@ -0,0 +1,8 @@ + + + 4.0.0 + cc.fyre.carnage + bunkers + 1.0-SNAPSHOT + + diff --git a/Bunkers/build/resources/main/plugin.yml b/Bunkers/build/resources/main/plugin.yml new file mode 100644 index 0000000..8009c4e --- /dev/null +++ b/Bunkers/build/resources/main/plugin.yml @@ -0,0 +1,4 @@ +name: Bunkers +main: cc.fyre.bunkers.Bunkers +version: 1.0-SNAPSHOT +depend: [qLib,GameEngine] diff --git a/Bunkers/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml b/Bunkers/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml new file mode 100644 index 0000000..9f9159d --- /dev/null +++ b/Bunkers/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml @@ -0,0 +1,12 @@ + + + cc.fyre.carnage + bunkers + + 1.0-SNAPSHOT + + 1.0-SNAPSHOT + + 20210829081348 + + diff --git a/Bunkers/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml b/Bunkers/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml new file mode 100644 index 0000000..a2d5d9d --- /dev/null +++ b/Bunkers/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml @@ -0,0 +1,24 @@ + + + cc.fyre.carnage + bunkers + 1.0-SNAPSHOT + + + true + + 20210829081348 + + + jar + 1.0-SNAPSHOT + 20210829081348 + + + pom + 1.0-SNAPSHOT + 20210829081348 + + + + diff --git a/Bunkers/build/tmp/shadowJar/MANIFEST.MF b/Bunkers/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Bunkers/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Bunkers/gradle/wrapper/gradle-wrapper.jar b/Bunkers/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/Bunkers/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Bunkers/gradle/wrapper/gradle-wrapper.properties b/Bunkers/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..da9702f --- /dev/null +++ b/Bunkers/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/Bunkers/gradlew b/Bunkers/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/Bunkers/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/Bunkers/gradlew.bat b/Bunkers/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/Bunkers/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Bunkers/settings.gradle b/Bunkers/settings.gradle new file mode 100644 index 0000000..9d19b66 --- /dev/null +++ b/Bunkers/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'bunkers' diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/Bunkers.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/Bunkers.kt new file mode 100644 index 0000000..ad3e1a2 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/Bunkers.kt @@ -0,0 +1,78 @@ +package cc.fyre.bunkers + +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.claim.ClaimHandler +import cc.fyre.bunkers.event.EventHandler +import cc.fyre.bunkers.game.BunkersGameAdapter +import cc.fyre.bunkers.game.tab.BunkersTabAdapter +import cc.fyre.bunkers.pvpclass.PvPClassHandler +import cc.fyre.bunkers.repair.RepairHandler +import cc.fyre.bunkers.shop.ShopHandler +import cc.fyre.bunkers.villager.VillagerHandler +import cc.fyre.bunkers.statistic.StatisticHandler +import cc.fyre.bunkers.supply.SupplyHandler +import cc.fyre.bunkers.pillar.PillarHandler + +import cc.fyre.bunkers.timer.TimerHandler +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.tab.FrozenTabHandler + +import org.bukkit.plugin.java.JavaPlugin + +/** + * @project bunkers + * + * @date 30/07/2020 + * @author xanderume@gmail.com + */ +class Bunkers : JavaPlugin() { + + lateinit var adapter: BunkersGameAdapter + + lateinit var shopHandler: ShopHandler + lateinit var teamHandler: TeamHandler + lateinit var claimHandler: ClaimHandler + lateinit var timerHandler: TimerHandler + lateinit var eventHandler: EventHandler + lateinit var supplyHandler: SupplyHandler + lateinit var repairHandler: RepairHandler + lateinit var pillarHandler: PillarHandler + lateinit var villagerHandler: VillagerHandler + lateinit var pvpClassHandler: PvPClassHandler + lateinit var statisticHandler: StatisticHandler + + override fun onEnable() { + instance = this + + this.adapter = BunkersGameAdapter(this) + + GameEngine.instance.gameHandler.adapter = this.adapter + + this.shopHandler = ShopHandler(this) + this.teamHandler = TeamHandler(this) + this.claimHandler = ClaimHandler(this) + this.eventHandler = EventHandler(this) + this.timerHandler = TimerHandler(this) + this.supplyHandler = SupplyHandler(this) + this.repairHandler = RepairHandler(this) + this.pillarHandler = PillarHandler(this) + this.villagerHandler = VillagerHandler(this) + this.pvpClassHandler = PvPClassHandler(this) + this.statisticHandler = StatisticHandler(this) + + FrozenTabHandler.setLayoutProvider(BunkersTabAdapter) + } + + + override fun onDisable() { + this.claimHandler.dispose() + this.supplyHandler.dispose() + this.pvpClassHandler.dispose() + } + + companion object { + + lateinit var instance: Bunkers + + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/ClaimHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/ClaimHandler.kt new file mode 100644 index 0000000..d05dfbe --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/ClaimHandler.kt @@ -0,0 +1,57 @@ +package cc.fyre.bunkers.claim + +import net.hylist.HylistSpigot +import cc.fyre.bunkers.Bunkers + +import cc.fyre.bunkers.claim.data.ClaimSelection +import cc.fyre.bunkers.claim.listener.ClaimListener +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.claim.listener.ClaimPositionListener +import cc.fyre.bunkers.claim.movement.ClaimMovementAdapter +import cc.fyre.engine.map.data.Map + +import org.bukkit.ChatColor + +import org.bukkit.entity.Player +import java.util.* + + +/** + * @project hcf + * + * @date 04/04/2020 + * @author xanderume@gmail.com + */ +class ClaimHandler(private val instance: Bunkers) { + + val selections = HashMap() + + init { + HylistSpigot.INSTANCE.addMovementHandler(ClaimMovementAdapter(this.instance)) + + this.instance.server.pluginManager.registerEvents(ClaimListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(ClaimMovementAdapter(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(ClaimPositionListener(this.instance),this.instance) + } + + fun findSelection(uuid: UUID):Optional { + return Optional.ofNullable(this.selections[uuid]) + } + + fun startSelection(player: Player,team: Team,map: Map,slot: Int) { + + if (this.selections.remove(player.uniqueId) != null) { + player.inventory.removeItem(ClaimSelection.ITEM) + } + + player.inventory.setItem(slot,ClaimSelection.ITEM) + player.sendMessage("${ChatColor.GREEN}You have been given a claiming wand.") + + this.selections[player.uniqueId] = ClaimSelection(map,team) + } + + fun dispose() { + this.selections.keys.map{this.instance.server.getPlayer(it)}.filter{it != null}.forEach{it.inventory.removeItem(ClaimSelection.ITEM)} + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/data/Claim.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/data/Claim.kt new file mode 100644 index 0000000..c46b835 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/data/Claim.kt @@ -0,0 +1,104 @@ +package cc.fyre.bunkers.claim.data + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import org.bukkit.Location +import org.bukkit.World +import org.bukkit.block.Block +import kotlin.math.max +import kotlin.math.min + +/** + * @project hcf + * + * @date 04/04/2020 + * @author xanderume@gmail.com + */ +class Claim(world: World,x1: Int,x2: Int,z1: Int,z2: Int) { + + constructor(first: Location,second: Location):this(first.world,first.blockX,second.blockX,first.blockZ,second.blockZ) + + private val x1 = min(x1,x2) + private val x2 = max(x1,x2) + private val z1 = min(z1,z2) + private val z2 = max(z1,z2) + + private val world = world.name + + fun findWorld():World? = Bunkers.instance.server.getWorld(this.world) + + fun contains(x: Int,z: Int,world: World):Boolean { + return x >= this.x1 && x <= this.x2 && z >= this.z1 && z <= this.z2 && this.world == world.name + } + + fun contains(location: Location):Boolean { + + val world = this.findWorld() ?: return false + + return this.contains(location.blockX,location.blockZ,world) + } + + fun getLower():Location { + return Location(this.findWorld(),this.x1.toDouble(),0.0,this.z1.toDouble()) + } + + fun getUpper():Location { + return Location(this.findWorld(),this.x2.toDouble(),256.0,this.z2.toDouble()) + } + + fun borderIterator():Iterator> { + return BorderIterator(this,this.x1,this.z1,this.x2,this.z2) + } + + // HCTeams can suck my dick nigga + class BorderIterator(val claim: Claim,x1: Int, z1: Int, x2: Int, z2: Int) : MutableIterator> { + + private var x: Int = min(x1,x2) + private var z: Int = min(z1,z2) + + private var next = true + private var direction = BorderDirection.POS_Z + + private var minX: Int = this.claim.getLower().blockX + private var minZ: Int = this.claim.getLower().blockZ + private var maxX: Int = this.claim.getUpper().blockX + private var maxZ: Int = this.claim.getUpper().blockZ + + override fun hasNext(): Boolean { + return this.next + } + + override fun next():Pair { + if (this.direction == BorderDirection.POS_Z) { + if (++this.z == this.maxZ) { + this.direction = BorderDirection.POS_X + } + } else if (this.direction == BorderDirection.POS_X) { + if (++this.x == this.maxX) { + this.direction = BorderDirection.NEG_Z + } + } else if (this.direction == BorderDirection.NEG_Z) { + if (--this.z == this.minZ) { + this.direction = BorderDirection.NEG_X + } + } else if (this.direction == BorderDirection.NEG_X) { + if (--this.x == this.minX) { + this.next = false + } + } + return Pair(this.x,this.z) + } + + override fun remove() {} + + enum class BorderDirection { + + POS_X, + POS_Z, + NEG_X, + NEG_Z + + } + + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/data/ClaimSelection.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/data/ClaimSelection.kt new file mode 100644 index 0000000..0692edb --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/data/ClaimSelection.kt @@ -0,0 +1,49 @@ +package cc.fyre.bunkers.claim.data + +import cc.fyre.bunkers.team.data.Team +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.Material + +import org.bukkit.event.block.Action + +/** + * @project hcf + * + * @date 04/04/2020 + * @author xanderume@gmail.com + */ +class ClaimSelection(val map: Map,val team: Team) { + + var first: Location? = null + var second: Location? = null + + fun getFormattedMessage(action: Action,location: Location):Array { + + val toReturn = arrayOfNulls(1) + + toReturn[0] = "${ChatColor.YELLOW}Set claim's location ${ChatColor.LIGHT_PURPLE}${if (action == Action.LEFT_CLICK_BLOCK) 1 else 2}${ChatColor.YELLOW} to ${ChatColor.GREEN}(${ChatColor.WHITE}${location.blockX}, ${location.blockY}, ${location.blockZ}${ChatColor.GREEN})${ChatColor.YELLOW}." + + return toReturn + } + + companion object { + + val ITEM = ItemBuilder.of(Material.WOOD_HOE) + .name("${ChatColor.GREEN}${ChatColor.ITALIC}Claiming Wand") + .addToLore( + "", + "${ChatColor.YELLOW}Right Click ${ChatColor.GOLD}Air", + "${ChatColor.AQUA}- ${ChatColor.WHITE}Cancel current claim", + "", + "${ChatColor.YELLOW}Right/Left Click ${ChatColor.GOLD}Block", + "${ChatColor.AQUA}- ${ChatColor.WHITE}Select claim's corners", + "", + "${ChatColor.BLUE}Crouch ${ChatColor.YELLOW}Left Click ${ChatColor.GOLD}Block/Air", + "${ChatColor.AQUA}- ${ChatColor.WHITE}Purchase current claim" + ).build() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/listener/ClaimListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/listener/ClaimListener.kt new file mode 100644 index 0000000..3634dcf --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/listener/ClaimListener.kt @@ -0,0 +1,59 @@ +package cc.fyre.bunkers.claim.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.claim.data.ClaimSelection +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener + +import org.bukkit.event.player.PlayerDropItemEvent +import org.bukkit.event.player.PlayerItemDamageEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project hcf + * + * @date 01/05/2020 + * @author xanderume@gmail.com + */ +class ClaimListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!this.instance.claimHandler.findSelection(event.player.uniqueId).isPresent) { + return + } + + event.player.inventory.remove(ClaimSelection.ITEM) + + this.instance.claimHandler.selections.remove(event.player.uniqueId) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDropItem(event: PlayerDropItemEvent) { + + if (!event.itemDrop.itemStack.isSimilar(ClaimSelection.ITEM)) { + return + } + + event.itemDrop.remove() + + this.instance.claimHandler.selections.remove(event.player.uniqueId) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDamageItem(event: PlayerItemDamageEvent) { + + if (!event.item.isSimilar(ClaimSelection.ITEM)) { + return + } + + if (!this.instance.claimHandler.findSelection(event.player.uniqueId).isPresent) { + return + } + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/listener/ClaimPositionListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/listener/ClaimPositionListener.kt new file mode 100644 index 0000000..2904add --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/listener/ClaimPositionListener.kt @@ -0,0 +1,96 @@ +package cc.fyre.bunkers.claim.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.claim.data.Claim +import cc.fyre.bunkers.claim.data.ClaimSelection +import org.bukkit.Bukkit + +import org.bukkit.ChatColor +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action +import org.bukkit.event.player.PlayerInteractEvent + + +/** + * @project hcf + * + * @date 03/06/2020 + * @author xanderume@gmail.com + */ +class ClaimPositionListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.item == null) { + return + } + + if (!event.item.isSimilar(ClaimSelection.ITEM)) { + return + } + + val optionalSelection = this.instance.claimHandler.findSelection(event.player.uniqueId) + + if (!optionalSelection.isPresent) { + return + } + + val selection = optionalSelection.get() + + event.isCancelled = true + + if (event.action == Action.RIGHT_CLICK_AIR) { + event.player.itemInHand = null + event.player.sendMessage("${ChatColor.RED}You have cancelled the claiming process.") + + this.instance.claimHandler.selections.remove(event.player.uniqueId) + return + } + + if (event.action == Action.LEFT_CLICK_AIR) { + + if (!event.player.isSneaking) { + return + } + + if (selection.first == null || selection.second == null) { + event.player.sendMessage("${ChatColor.RED}You have not selected both corners of your claim yet!") + return + } + + event.player.itemInHand = null + + this.instance.claimHandler.selections.remove(event.player.uniqueId) + + selection.team.claim = Claim(selection.first!!,selection.second!!) + + Bukkit.getServer().scheduler.runTaskAsynchronously(this.instance) { + + if (!Bunkers.instance.teamHandler.saveTeamData(selection.team,selection.map).wasAcknowledged()) { + event.player.sendMessage("${ChatColor.RED}Failed to update team data..") + return@runTaskAsynchronously + } + + event.player.sendMessage("${ChatColor.YELLOW}Updated ${selection.team.type.getDisplayName()}${ChatColor.YELLOW}'s claim on map ${ChatColor.LIGHT_PURPLE}${selection.map.id}${ChatColor.YELLOW}.") + } + return + } + + if (event.clickedBlock == null) { + return + } + + if (event.action == Action.LEFT_CLICK_BLOCK) { + selection.first = event.clickedBlock.location + } else { + selection.second = event.clickedBlock.location + } + + selection.getFormattedMessage(event.action,event.clickedBlock.location).filterNotNull().forEach{event.player.sendMessage(it)} + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/movement/ClaimMovementAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/movement/ClaimMovementAdapter.kt new file mode 100644 index 0000000..1586fa0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/claim/movement/ClaimMovementAdapter.kt @@ -0,0 +1,60 @@ +package cc.fyre.bunkers.claim.movement + +import cc.fyre.bunkers.Bunkers +import net.hylist.handler.MovementHandler + +import mkremins.fanciful.FancyMessage +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerTeleportEvent + +/** + * @project hcf + * + * @date 03/06/2020 + * @author xanderume@gmail.com + */ +class ClaimMovementAdapter(private val instance: Bunkers) : MovementHandler,Listener { + + override fun handleUpdateRotation(player: Player,to: Location,from: Location,packet: PacketPlayInFlying?) {} + + override fun handleUpdateLocation(player: Player,to: Location,from: Location,packet: PacketPlayInFlying?) { + + if (from.blockX == to.blockX && from.blockZ == to.blockZ) { + return + } + + val toTeam = this.instance.teamHandler.findByLocation(to) + val fromTeam = this.instance.teamHandler.findByLocation(from) + + if (fromTeam.type == toTeam.type) { + return + } + + FancyMessage("${ChatColor.YELLOW}Now leaving: ") + .then(fromTeam.getDisplayName()) + .tooltip("${ChatColor.GREEN}Click to view team info.") + .command("/team info ${fromTeam.type.name}") + .then("${ChatColor.YELLOW} (${ChatColor.RED}Dangerous${ChatColor.YELLOW})") + .send(player) + + FancyMessage("${ChatColor.YELLOW}Now entering: ") + .then(toTeam.getDisplayName()) + .tooltip("${ChatColor.GREEN}Click to view team info.") + .command("/team info ${toTeam.type.name}") + .then("${ChatColor.YELLOW} (${ChatColor.RED}Dangerous${ChatColor.YELLOW})") + .send(player) + + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + this.handleUpdateLocation(event.player,event.to,event.from,null) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/EventHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/EventHandler.kt new file mode 100644 index 0000000..2fdecf7 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/EventHandler.kt @@ -0,0 +1,143 @@ +package cc.fyre.bunkers.event + +import net.hylist.HylistSpigot +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.event.command.KOTHSetTimeCommand +import cc.fyre.bunkers.event.command.KOTHStartCommand +import cc.fyre.bunkers.event.listener.EventListener +import cc.fyre.bunkers.event.service.EventService +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.team.listener.TeamProtectionListener +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.util.TimeUtils +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.Player +import java.util.* +import java.util.concurrent.TimeUnit +import kotlin.math.abs + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class EventHandler(private val instance: Bunkers) { + + private var active = false + + var controller: UUID? = null + var maxControlTime = 480 + + var controlledBy: UUID? = null + var controlledByTeam: Team? = null + + val service = EventService(this.instance) + + init { + HylistSpigot.INSTANCE.addMovementHandler(EventListener(this.instance)) + + FrozenCommandHandler.registerClass(KOTHStartCommand::class.java) + FrozenCommandHandler.registerClass(KOTHSetTimeCommand::class.java) + + this.instance.server.pluginManager.registerEvents(EventListener(this.instance),this.instance) + } + + fun isActive():Boolean { + return this.active + } + + fun setActive(value: Boolean) { + + if (value) { + this.service.runTaskTimer(this.instance,20L,20L) + this.instance.server.broadcastMessage("$PREFIX ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW} can now be contested.") + } + + this.active = value + } + + fun setMaxCaptureTime(seconds: Int) { + + if (this.service.remaining.get() > seconds) { + this.service.remaining.set(seconds) + } + + this.maxControlTime = seconds + this.instance.server.broadcastMessage("$PREFIX ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW} has been reduced to ${ChatColor.RED}${TimeUtils.formatIntoDetailedString(seconds)}${ChatColor.YELLOW}.") + } + + fun getCaptureZone():Location { + return this.instance.teamHandler.cache[Team.Type.KOTH]?.hq ?: this.instance.server.getWorld(GameEngine.instance.gameHandler.map.id).spawnLocation.clone().add(0.5,0.0,0.5) + } + + fun setController(player: Player?) { + + if ((this.maxControlTime - this.service.remaining.get() > 30)) { + this.instance.server.broadcastMessage("$PREFIX ${ChatColor.YELLOW}Control of ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW} lost.") + } + + this.service.remaining.set(this.maxControlTime) + + this.controller = player?.uniqueId + + if (player == null) { + this.service.remaining.set(this.maxControlTime) + return + } + + player.sendMessage("$PREFIX ${ChatColor.YELLOW}Attempting to control ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW}.") + } + + fun isInsideCaptureZone(location: Location, player: Player):Boolean { + + val zone = this.getCaptureZone() + + if (!location.world.name.equals(zone.world.name,true)) { + return false + } + + if (TeamProtectionListener.protection.containsKey(player.uniqueId)) { + return false + } + + if (GameEngine.instance.spectateHandler.isSpectating(player.uniqueId)) { + return false + } + + if (GameEngine.instance.disqualifieHandler.isDisqualified(player.uniqueId)) { + return false + } + + val respawn = this.instance.timerHandler.findRemaining(player.uniqueId, TimerType.RESPAWN) + + if (respawn > 0L) { + return false + } + + var radius = 3 + + if (location.world.name.equals("Classic",true)) { + radius = 5 + } + + return abs(location.blockX - zone.blockX) <= radius && abs(location.blockY - zone.blockY) <= 5 && abs(location.blockZ - zone.blockZ) <= radius + } + + companion object { + + val PREFIX = "${ChatColor.GOLD}[KingOfTheHill]" + val KOTH_START_TIME = TimeUnit.MINUTES.toSeconds(10).toInt() + val CAPTURE_TIME_DECREASE = mutableMapOf( + TimeUnit.MINUTES.toSeconds(20).toInt() to 420, + TimeUnit.MINUTES.toSeconds(30).toInt() to 360, + TimeUnit.MINUTES.toSeconds(40).toInt() to 300, + TimeUnit.MINUTES.toSeconds(50).toInt() to 240, + TimeUnit.MINUTES.toSeconds(60).toInt() to 180 + ) + + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/command/KOTHSetTimeCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/command/KOTHSetTimeCommand.kt new file mode 100644 index 0000000..c371d1f --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/command/KOTHSetTimeCommand.kt @@ -0,0 +1,17 @@ +package cc.fyre.bunkers.event.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.command.CommandSender + +object KOTHSetTimeCommand { + + @JvmStatic + @Command(names = ["koth settime","event settime"],permission = "op") + fun execute(sender: CommandSender, @Param(name = "seconds")seconds: Int) { + Bunkers.instance.eventHandler.service.remaining.set(seconds) + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/command/KOTHStartCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/command/KOTHStartCommand.kt new file mode 100644 index 0000000..63f18bb --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/command/KOTHStartCommand.kt @@ -0,0 +1,15 @@ +package cc.fyre.bunkers.event.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import org.bukkit.command.CommandSender + +object KOTHStartCommand { + + @JvmStatic + @Command(names = ["koth start","event start"],permission = "op") + fun execute(sender: CommandSender) { + Bunkers.instance.eventHandler.setActive(!Bunkers.instance.eventHandler.isActive()) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/listener/EventListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/listener/EventListener.kt new file mode 100644 index 0000000..1bbf89f --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/listener/EventListener.kt @@ -0,0 +1,109 @@ +package cc.fyre.bunkers.event.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.engine.GameEngine +import net.hylist.handler.MovementHandler +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.PlayerDeathEvent +import org.bukkit.event.player.PlayerQuitEvent +import org.bukkit.event.player.PlayerTeleportEvent + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class EventListener(private val instance: Bunkers):Listener,MovementHandler { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!this.instance.eventHandler.isActive()) { + return + } + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + if (this.instance.eventHandler.controller == null || this.instance.eventHandler.controller != event.player.uniqueId) { + return + } + + this.instance.eventHandler.setController(GameEngine.instance.gameHandler.getPlayers().filter{it.uniqueId != event.player.uniqueId}.firstOrNull{this.instance.eventHandler.isInsideCaptureZone(it.location, it)}) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerDeath(event: PlayerDeathEvent) { + + if (!this.instance.eventHandler.isActive()) { + return + } + + if (!GameEngine.instance.gameHandler.isPlaying(event.entity)) { + return + } + + if (this.instance.eventHandler.controller == null || this.instance.eventHandler.controller != event.entity.uniqueId) { + return + } + + this.instance.eventHandler.setController(GameEngine.instance.gameHandler.getPlayers().filter{it.uniqueId != event.entity.uniqueId}.firstOrNull{this.instance.eventHandler.isInsideCaptureZone(it.location, it)}) + return + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + this.handleUpdateLocation(event.player,event.to,event.from,null) + } + + override fun handleUpdateRotation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) {} + + override fun handleUpdateLocation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) { + + if (from.blockX == to.blockX && from.blockZ == to.blockZ) { + return + } + + if (!this.instance.eventHandler.isActive()) { + return + } + + if (!GameEngine.instance.gameHandler.isPlaying(player)) { + return + } + + if (GameEngine.instance.spectateHandler.isSpectating(player)) { + return + } + + if (this.instance.eventHandler.controller != null) { + + if (player.uniqueId != this.instance.eventHandler.controller) { + return + } + + if (this.instance.eventHandler.isInsideCaptureZone(to, player)) { + return + } + + this.instance.eventHandler.setController(GameEngine.instance.gameHandler.getPlayers().filter{it.uniqueId != player.uniqueId}.firstOrNull{this.instance.eventHandler.isInsideCaptureZone(it.location, it)}) + return + } + + if (!this.instance.eventHandler.isInsideCaptureZone(to, player)) { + return + } + + this.instance.eventHandler.setController(player) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/service/EventService.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/service/EventService.kt new file mode 100644 index 0000000..1e83201 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/event/service/EventService.kt @@ -0,0 +1,68 @@ +package cc.fyre.bunkers.event.service + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.event.EventHandler + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.util.TimeUtils +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class EventService(private val instance: Bunkers) : BukkitRunnable() { + + val remaining = AtomicInteger(480) + + override fun run() { + + if (this.instance.eventHandler.controller == null) { + return + } + + if (GameEngine.instance.gameHandler.getState() != GameServer.State.IN_PROGRESS) { + return + } + + val player = this.instance.server.getPlayer(this.instance.eventHandler.controller) + + if (player == null || !this.instance.eventHandler.isInsideCaptureZone(player.location, player) || player.isDead) { + this.instance.eventHandler.setController(GameEngine.instance.gameHandler.getPlayers().filter{it.uniqueId != this.instance.eventHandler.controller}.firstOrNull{this.instance.eventHandler.isInsideCaptureZone(it.location, it)}) + return + } + + if (this.remaining.get() <= 0) { + this.cancel() + this.instance.eventHandler.controlledBy = this.instance.eventHandler.controller!! + this.instance.eventHandler.controlledByTeam = this.instance.teamHandler.findById(this.instance.eventHandler.controller!!) + this.instance.eventHandler.setActive(false) + GameEngine.instance.gameHandler.setState(GameServer.State.ENDING) + return + } + + if (this.remaining.get() != this.instance.eventHandler.maxControlTime && this.remaining.get() % 30 == 0) { + + val team = this.instance.teamHandler.findById(this.instance.eventHandler.controller!!)!! + + team.sendMessage("${EventHandler.PREFIX}${ChatColor.YELLOW} Your team is controlling ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW}.",this.instance.eventHandler.controller!!) + + this.instance.server.getPlayer(this.instance.eventHandler.controller).sendMessage("${EventHandler.PREFIX}${ChatColor.YELLOW} Attempting to control ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW}.") + + val ignore = team.members.plus(this.instance.eventHandler.controller) + + this.instance.server.onlinePlayers.filter{!ignore.contains(it.uniqueId)}.forEach{ + it.sendMessage(ChatColor.GOLD.toString() + "${EventHandler.PREFIX} ${ChatColor.BLUE}${GameEngine.instance.gameHandler.map.id}${ChatColor.YELLOW} is trying to be controlled. ${ChatColor.RED}(${TimeUtils.formatIntoHHMMSS(this.remaining.get())})") + } + + } + + this.remaining.decrementAndGet() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/BunkersGameAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/BunkersGameAdapter.kt new file mode 100644 index 0000000..a913c0a --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/BunkersGameAdapter.kt @@ -0,0 +1,392 @@ +package cc.fyre.bunkers.game + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.event.EventHandler +import cc.fyre.bunkers.game.deathmessage.BunkersDeathMessageConfiguration +import cc.fyre.bunkers.game.listener.* +import cc.fyre.bunkers.game.scoreboard.* + +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.team.data.Team + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.game.adapter.GameAdapter +import cc.fyre.engine.game.adapter.scoreboard.ScoreboardAdapter +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.game.data.type.BunkersGame +import cc.fyre.engine.profile.data.type.BunkersProfile +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.util.ItemBuilder +import com.google.common.collect.ImmutableSet +import com.google.gson.JsonObject +import net.frozenorb.qlib.deathmessage.FrozenDeathMessageHandler +import net.frozenorb.qlib.nametag.NametagInfo +import net.frozenorb.qlib.nametag.NametagProvider +import net.frozenorb.qlib.util.TimeUtils +import net.frozenorb.qlib.util.UUIDUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.meta.PotionMeta +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType +import java.util.* +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project bunkers + * + * @date 13/08/2020 + * @author xanderume@gmail.com + */ +class BunkersGameAdapter(private val instance: Bunkers) : GameAdapter { + + init { + + FrozenDeathMessageHandler.setConfiguration(BunkersDeathMessageConfiguration) + + this.instance.server.pluginManager.registerEvents(GameListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(ChunkListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(VotingListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(LunarClientListener(this.instance),this.instance) + } + + override fun onTick(seconds: Int) { + + if (seconds >= EventHandler.KOTH_START_TIME && !this.instance.eventHandler.isActive()) { + this.instance.eventHandler.setActive(true) + } + + if (EventHandler.CAPTURE_TIME_DECREASE.containsKey(seconds)) { + this.instance.eventHandler.setMaxCaptureTime(EventHandler.CAPTURE_TIME_DECREASE[seconds]!!) + } + + if (TeamHandler.RAIDABLE_BROADCASTS.contains(seconds) || (TeamHandler.RAIDABLE_TIME - seconds <= 5 && seconds <= TeamHandler.RAIDABLE_TIME)) { + this.instance.server.broadcastMessage("${ChatColor.RED}${ChatColor.BOLD}All teams will go raidable in ${TimeUtils.formatIntoDetailedString((TeamHandler.RAIDABLE_TIME - seconds))}.") + } + + if (seconds == TeamHandler.RAIDABLE_TIME) { + this.instance.server.broadcastMessage("${ChatColor.RED}${ChatColor.BOLD}All teams are now raidable.") + this.instance.teamHandler.findPlayerTeams().filter{!it.isRaidable()}.forEach{it.dtr = 0.0} + return + } + + val payload = JsonObject() + + payload.addProperty("GAME_TIME",seconds * 1000L) + + if (this.instance.eventHandler.isActive()) { + + val zoneData = JsonObject() + + zoneData.addProperty("CAP_ZONE_NAME",this.instance.teamHandler.cache[Team.Type.KOTH]?.getDisplayName() ?: "") + zoneData.addProperty("CAP_ZONE_TIME",this.instance.eventHandler.service.remaining.get()) + + payload.add("CAP_ZONE_DATA",zoneData) + } + + this.instance.teamHandler.findPlayerTeams().forEach{payload.addProperty("${it.type.name}_DTR",it.getDTRDisplay())} + + GameEngine.instance.gameHandler.addMetadata(payload) + } + + override fun onGameFinish() { + + val team = this.instance.eventHandler.controlledByTeam + + val messages = ArrayList() + + messages.add(Team.LINE) + messages.add(" ") + messages.add(StringUtils.center("${ChatColor.GOLD}Winner: ${team?.getDisplayName() ?: "${ChatColor.WHITE}Unknown"}",Team.LINE.length)) + + if (team != null) { + messages.add(StringUtils.center(StringUtils.join(team.members.map{UUIDUtils.name(it)}.toTypedArray(),"${ChatColor.GRAY}, "),Team.LINE.length)) + } + + messages.add(" ") + + val kills = this.instance.statisticHandler.kills.entries.sortedByDescending{it.value}.take(3) + + messages.add(StringUtils.center("${ChatColor.GOLD}Top Kills:",Team.LINE.length)) + + val colors = arrayOf(ChatColor.DARK_GREEN,ChatColor.GREEN,ChatColor.GOLD) + + kills.withIndex().forEach{messages.add(StringUtils.center("${colors[it.index]}#${it.index + 1} ${UUIDUtils.name(it.value.key)}${ChatColor.GRAY}: ${it.value.value}",Team.LINE.length))} + + messages.add(" ") + messages.add(Team.LINE) + + messages.forEach{this.instance.server.broadcastMessage(it)} + } + + override fun onPlayersSent(players: ArrayList) { + GameEngine.instance.gameHandler.parties.sortedByDescending{it.size}.forEach{this.instance.teamHandler.addToTeam(it)} + //this.loadParties(ArrayList(GameEngine.instance.gameHandler.parties.sortedBy{it.size})) + } + + override fun onGameAddPlayer(player: Player) { + + val team = this.instance.teamHandler.findById(player.uniqueId) + + if (team != null) { + return + } + + if (this.instance.teamHandler.addToTeam(player.uniqueId) != null) { + return + } + + GameEngine.instance.spectateHandler.addSpectator(player) + } + + override fun onGameAddSpectator(player: Player) { + + val team = this.instance.teamHandler.cache[Team.Type.KOTH] ?: return + + player.teleport(team.hq) + } + + override fun onGameDisqualifiePlayer(uuid: UUID) { + + val name = "${this.instance.teamHandler.findById(uuid)?.type?.color ?: ChatColor.WHITE}${UUIDUtils.name(uuid)}" + + this.instance.server.broadcastMessage("$name${ChatColor.GOLD}[${this.instance.statisticHandler.getKills(uuid)}]${ChatColor.RED} has been disqualified.") + } + + override fun onGameRemovePlayer(player: Player) {} + + override fun getNameTag(player: Player,target: Player):NametagInfo? { + + val targetTeam = this.instance.teamHandler.findById(target.uniqueId) + + if (targetTeam != null && targetTeam.isFocused(player)) { + return NametagProvider.createNametag(ChatColor.LIGHT_PURPLE.toString(),"") + } + + val team = this.instance.teamHandler.findById(player.uniqueId) + + if (team != null) { + val nameTagEntry = NametagProvider.createNametag(team.type.color.toString(),"") + + if (targetTeam == null || !targetTeam.getName().equals(team.getName(), true)) { + //TODO nameTagEntry.allowFriendlyVisibility = false + } + + if (targetTeam != null && targetTeam.getName().equals(team.getName(), true)) { + //TODO nameTagEntry.allowFriendlyVisibility = true + } + + return NametagProvider.createNametag(team.type.color.toString(),"") + } + + return null + } + + override fun getScoreboardAdapters(): HashMap { + + val toReturn = hashMapOf() + + toReturn[GameServer.State.WAITING] = WaitingScoreboardAdapter() + toReturn[GameServer.State.VOTING] = VotingScoreboardAdapter() + toReturn[GameServer.State.COUNTDOWN] = CountdownScoreboardAdapter() + toReturn[GameServer.State.IN_PROGRESS] = InProgressScoreboardAdapter() + + return toReturn + } + override fun getEndGameData():Game { + + var team: Team? = null + + if (this.instance.eventHandler.controlledBy != null) { + team = this.instance.teamHandler.findById(this.instance.eventHandler.controlledBy!!) + } + + val teams = ArrayList() + + this.instance.teamHandler.findPlayerTeams().forEach{teams.add(BunkersGame.Team(it.getName(),it.getColor().toString(),it.dtr,it.members.toCollection(ArrayList())))} + + return BunkersGame( + GameEngine.instance.gameHandler.getGameTime(), + GameEngine.instance.gameHandler.map.id, + teams, + this.instance.statisticHandler.kills, + this.instance.statisticHandler.deaths, + this.instance.statisticHandler.playTime, + this.instance.statisticHandler.oresMined.entries.associate{it.key to it.value.entries.sumBy{entry -> entry.value}}.toMap(HashMap()), + this.instance.statisticHandler.playTimeClass.entries.associate{it.key to it.value.entries.maxByOrNull{entry -> entry.value}?.key}.toMap(HashMap()), + team?.getName(), + this.instance.eventHandler.controlledBy + ) + } + + override fun onGameFinishUpdateProfiles() { + + val controller = this.instance.eventHandler.controlledBy + val winningTeam = if (controller == null) null else this.instance.teamHandler.findById(controller) + + this.instance.teamHandler.findPlayerTeams().forEach{team -> + + for (member in team.members) { + + var profile = GameEngine.instance.api.profileHandler.findById(member,GameEngineAPI.GameMode.BUNKERS) as BunkersProfile? + + if (profile == null) { + profile = BunkersProfile(member) + } + + val player = this.instance.server.getPlayer(profile.id) + + if (player != null) { + + val pvpClass = this.instance.pvpClassHandler.findById(player.uniqueId) + + if (pvpClass != null) { + this.instance.statisticHandler.recalculatePlayTime(player.uniqueId,pvpClass.type.backendType) + } + + this.instance.statisticHandler.recalculatePlayTime(player.uniqueId) + } + + if (winningTeam != null && winningTeam.isMember(profile.id) && player != null) { + + if (GameEngine.instance.gameHandler.ranked) { + profile.rankedWins++ + } else { + profile.normalWins++ + } + + profile.totalWins++ + } else { + if (GameEngine.instance.gameHandler.ranked) { + profile.rankedLosses++ + } else { + profile.normalLosses++ + } + + profile.totalLosses++ + } + + profile.gamesPlayed++ + profile.kills += this.instance.statisticHandler.getKills(member) + profile.deaths += this.instance.statisticHandler.getDeaths(member) + profile.playTime += this.instance.statisticHandler.getPlayTime(member) + profile.oresMined += this.instance.statisticHandler.getOresMined(member) + + BunkersProfile.Ore.values().forEach{ + profile.oresTypeMined[it] = (profile.oresTypeMined[it] ?: 0) + this.instance.statisticHandler.getOresMined(member,it) + } + + BunkersProfile.PvPClass.values().forEach{ + profile.classPlayTime[it] = (profile.classPlayTime[it] ?: 0L) + this.instance.statisticHandler.getPlayTime(member,it) + } + + GameEngine.instance.api.profileHandler.update(profile) + } + + } + } + + companion object { + + val ANTIDOTE = ItemBuilder.of(Material.POTION).name("${ChatColor.RED}${ChatColor.BOLD}Antidote").data(8228).build() + val LESSER_INVISIBILITY = ItemBuilder.of(Material.POTION).name("${ChatColor.WHITE}Lesser Invisibility").data(8270).build() + + val STARTER_ITEMS = ImmutableSet.of( + ItemBuilder.of(Material.STONE_AXE).addToLore("${ChatColor.GOLD}Soulbound").build(), + ItemBuilder.of(Material.STONE_PICKAXE).addToLore("${ChatColor.GOLD}Soulbound").build() + ) + + init { + + val itemMeta = LESSER_INVISIBILITY.itemMeta as PotionMeta + + itemMeta.addCustomEffect(PotionEffect(PotionEffectType.INVISIBILITY,(6*60) * 20,2),true) + + LESSER_INVISIBILITY.itemMeta = itemMeta + } + + } + + // Old method use this one if current isn't good + + /* + fun loadParties(parties: ArrayList>) { + + Bunkers.instance.server.logger.info("--- Party Sets ---") + parties.forEach{Bunkers.instance.server.logger.info(StringUtils.join(arrayListOf(it).flatMap{ members -> members.map{ member -> UUIDUtils.name(member)}},", "))} + Bunkers.instance.server.logger.info("------------------") + Bunkers.instance.server.logger.info(" ") + Bunkers.instance.server.logger.info("--- Full Sets ---") + parties.forEach{Bunkers.instance.server.logger.info(StringUtils.join(arrayListOf(parties.filter{it.size >= TeamHandler.PLAYERS_PER_TEAM}).flatMap{ members -> members.flatten().map{ member -> UUIDUtils.name(member)}},", "))} + Bunkers.instance.server.logger.info("------------------") + + val oddParties = ArrayList>() + + parties.removeIf{ + + if (it.size < TeamHandler.PLAYERS_PER_TEAM) { + return@removeIf false + } + + val team = Bunkers.instance.teamHandler.cache.values.first{team -> !team.type.isSystem() && team.members.size == 0} + val oddMembers = ArrayList() + + for (uuid in it) { + + if (team.members.size >= TeamHandler.PLAYERS_PER_TEAM) { + + Bunkers.instance.server.logger.info("--- Odd Man Out ---") + Bunkers.instance.server.logger.info("${UUIDUtils.name(uuid)} -> ${team.type}") + Bunkers.instance.server.logger.info("-----------------------") + + oddMembers.add(uuid) + continue + } + + Bunkers.instance.server.logger.info("--- Add Member ---") + Bunkers.instance.server.logger.info("${UUIDUtils.name(uuid)} -> ${team.type}") + Bunkers.instance.server.logger.info("-----------------------") + + team.members.add(uuid) + } + + oddParties.add(oddMembers) + return@removeIf true + } + + for (party in parties) { + + val foundPlayers = ArrayList() + + for (possibleParty in parties.filter{it != party}) { + + if (foundPlayers.size + possibleParty.size > TeamHandler.PLAYERS_PER_TEAM) { + continue + } + + foundPlayers.addAll(possibleParty) + } + + if (foundPlayers.size == TeamHandler.PLAYERS_PER_TEAM) { + parties.forEach{nigger -> nigger.removeIf{foundPlayers.contains(it)}} + Bunkers.instance.teamHandler.cache.values.first{team -> !team.type.isSystem() && team.members.size == 0}.members.addAll(foundPlayers) + } + + } + + if (oddParties.isNotEmpty()) { + oddParties.sortedBy{it.size}.forEach{members -> members.forEach{Bunkers.instance.teamHandler.cache.values.first{team -> !team.type.isSystem() && team.members.size < TeamHandler.PLAYERS_PER_TEAM}.members.add(it)}} + } + + if (parties.isNotEmpty()) { + parties.sortedBy{it.size}.forEach{members -> members.forEach{Bunkers.instance.teamHandler.cache.values.first{team -> !team.type.isSystem() && team.members.size < TeamHandler.PLAYERS_PER_TEAM}.members.add(it)}} + } + + Bunkers.instance.teamHandler.cache.values.forEach{Bunkers.instance.server.logger.info("${it.type} -> ${StringUtil.join(it.members.map{ member -> UUIDUtils.name(member)}.toTypedArray(),", ")}")} + }*/ + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/deathmessage/BunkersDeathMessageConfiguration.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/deathmessage/BunkersDeathMessageConfiguration.kt new file mode 100644 index 0000000..fbcd678 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/deathmessage/BunkersDeathMessageConfiguration.kt @@ -0,0 +1,25 @@ +package cc.fyre.bunkers.game.deathmessage + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.deathmessage.DeathMessageConfiguration +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.ChatColor +import java.util.* + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +object BunkersDeathMessageConfiguration : DeathMessageConfiguration { + + override fun shouldShowDeathMessage(p0: UUID?, p1: UUID?, p2: UUID?): Boolean { + return true + } + + override fun formatPlayerName(uuid: UUID): String { + return "${Bunkers.instance.teamHandler.findById(uuid)?.getColor() ?: ChatColor.WHITE}${UUIDUtils.name(uuid)}${ChatColor.DARK_RED}[${Bunkers.instance.statisticHandler.getKills(uuid)}]" + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/ChunkListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/ChunkListener.kt new file mode 100644 index 0000000..49ee3ad --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/ChunkListener.kt @@ -0,0 +1,88 @@ +package cc.fyre.bunkers.game.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.engine.map.event.MapLoadEvent +import org.bukkit.Chunk +import org.bukkit.entity.Monster +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.world.ChunkLoadEvent +import org.bukkit.event.world.ChunkUnloadEvent +import org.bukkit.scheduler.BukkitRunnable + + +/** + * @project bunkers + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +class ChunkListener(private val instance: Bunkers) : Listener { + + private val cache = ArrayList() + + @EventHandler(priority = EventPriority.MONITOR) + private fun onChunkLoad(event: ChunkLoadEvent) { + + object : BukkitRunnable() { + + override fun run() { + event.chunk.entities.filterIsInstance().forEach{it.remove()} + } + + }.runTaskLater(this.instance,20L) + + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onChunkUnLoad(event: ChunkUnloadEvent) { + + if (!this.cache.contains(event.chunk)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onMapLoad(event: MapLoadEvent) { + + object : BukkitRunnable() { + + override fun run() { + + for (team in this@ChunkListener.instance.teamHandler.findPlayerTeams()) { + + val location = team.hq + + if (location == null) { + this@ChunkListener.instance.server.logger.info("Failed to load chunks for ${team.getName()}, no hq set.") + return + } + + for (x in -4 until 4) { + + for (z in -4 until 4) { + + location.world.getChunkAtAsync(location.blockX + (x shr 4),location.blockZ + (z shr 4)) { + + if (this@ChunkListener.cache.contains(it)) { + return@getChunkAtAsync + } + + it.load() + + this@ChunkListener.cache.add(it) + this@ChunkListener.instance.logger.info("Loaded chunk at ${it.x}, ${it.z} for ${team.getName()}.") + } + } + } + + } + } + + }.runTaskLater(this.instance,5L) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/GameListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/GameListener.kt new file mode 100644 index 0000000..3deaf7b --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/GameListener.kt @@ -0,0 +1,267 @@ +package cc.fyre.bunkers.game.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.game.BunkersGameAdapter +import cc.fyre.bunkers.team.data.Team +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.event.GameStateChangeEvent +import cc.fyre.engine.map.event.MapLoadEvent +import cc.fyre.engine.server.data.GameServer +import org.apache.commons.lang.StringUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld +import org.bukkit.entity.* +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action +import org.bukkit.event.block.BlockFadeEvent +import org.bukkit.event.block.BlockPhysicsEvent +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.inventory.InventoryOpenEvent +import org.bukkit.event.inventory.InventoryType +import org.bukkit.event.player.PlayerDropItemEvent +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.event.player.PlayerItemConsumeEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.potion.PotionEffectType +import org.bukkit.scheduler.BukkitRunnable +import org.bukkit.util.StringUtil + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class GameListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onMapLoad(event: MapLoadEvent) { + event.world.setGameRuleValue("doMobSpawning","false") + event.world.entities.filterIsInstance().forEach{it.remove()} + + val handle = (event.world as CraftWorld).handle + + handle.spigotConfig.walkExhaustion = 0.0F + handle.spigotConfig.regenExhaustion = 0.0F + handle.spigotConfig.sprintExhaustion = 0.0F + handle.spigotConfig.combatExhaustion = 0.0F + } + + + @EventHandler(priority = EventPriority.LOWEST) + private fun onFarmDecay(event: BlockFadeEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPlayerDropItem(event: PlayerDropItemEvent) { + + val stack = event.itemDrop.itemStack + + if (!stack.hasItemMeta() || !stack.itemMeta.hasLore() || !ChatColor.stripColor(stack.itemMeta.lore[0]).equals("Soulbound",true)) { + return + } + + event.itemDrop.remove() + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (event.isCancelled) { + return + } + + if (event.entity !is Player) { + return + } + + val player = event.entity as Player + + if (player.activePotionEffects.none{it.type == PotionEffectType.INVISIBILITY && it.amplifier == 2}) { + return + } + + var attacker: Player? = null + + if (event.damager is Player) { + attacker = event.damager as Player + } else if (event.damager is Projectile && (event.damager as Projectile).shooter is Player) { + attacker = (event.damager as Projectile).shooter as Player + } + + if (attacker == null) { + return + } + + player.removePotionEffect(PotionEffectType.INVISIBILITY) + player.sendMessage("${ChatColor.RED}${ChatColor.RED}Your lesser invisibility has been removed!") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + //TODO LunarClientAPI.getInstance().sendPacket(event.player, LCPacketServerRule(ServerRule.LEGACY_COMBAT, true)) + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + if (!team.isRaidable()) { + return + } + + GameEngine.instance.gameHandler.removePlayer(event.player) + GameEngine.instance.spectateHandler.addSpectator(event.player) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.action != Action.PHYSICAL) { + return + } + + if (event.clickedBlock.type != Material.SOIL) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onInventoryOpen(event: InventoryOpenEvent) { + + if (!DISABLED_INVENTORIES.any{it == event.inventory.type}) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onItemConsume(event: PlayerItemConsumeEvent) { + + if (event.isCancelled) { + return + } + + if (event.item.type != Material.POTION) { + return + } + + object : BukkitRunnable() { + + override fun run() { + + if (!event.player.isOnline) { + return + } + + event.player.itemInHand = null + } + + }.runTaskLater(this.instance,2L) + + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onGameStateChange(event: GameStateChangeEvent) { + + if (event.new != GameServer.State.IN_PROGRESS) { + return + } + + val koth = this.instance.teamHandler.cache[Team.Type.KOTH]!! + + if (koth.hq != null) { + koth.hq!!.chunk.load() + } + + this.instance.server.onlinePlayers.forEach{ + + val team = this.instance.teamHandler.findById(it.uniqueId) + + if (team?.hq != null && !team.hq!!.chunk.isLoaded) { + team.hq!!.chunk.load() + } + + if (team == null) { + it.teleport(koth.hq) + } else { + + val hq = team.hq + + if (hq == null) { + it.sendMessage("${ChatColor.RED}Your team's HQ seems to be missing, please contact an administrator..") + } else { + it.teleport(hq) + //TODO sendPacket(it,WayPointAddPacket("HQ",hq.world,hq.blockX,hq.blockY,hq.blockZ,team.type.getRGBColor(),forced = true,visible = true)) + + val teams = StringUtils.join(this.instance.teamHandler.findPlayerTeams().filter{ filtered -> filtered.type != team.type && filtered.members.isNotEmpty()}.map{ filtered -> filtered.getDisplayName()}.toTypedArray()) + + arrayListOf( + "", + " ${ChatColor.GOLD}You are apart of the ${team.getDisplayName()}${ChatColor.GOLD} team.", + " ${ChatColor.GOLD}Make $teams${ChatColor.GOLD} raidable", + " ${ChatColor.GOLD}and/or capture ${koth.getDisplayName()}${ChatColor.GOLD} to win.", + " ${ChatColor.GOLD}Make sure to block up all ${ChatColor.RED}${ChatColor.BOLD}${team.holograms.size} ${ChatColor.GOLD}entrances!", + " ${ChatColor.GOLD}Food can be found outside your base.", + "" + ).forEach{message -> it.sendMessage(message)} + } + + } + + if (koth.hq != null) { + //TODO sendPacket(it,WayPointAddPacket("${koth.getDisplayName()}${ChatColor.WHITE}",koth.hq!!.world,koth.hq!!.blockX,koth.hq!!.blockY,koth.hq!!.blockZ,koth.type.getRGBColor(),forced = true,visible = true)) + } + + BunkersGameAdapter.STARTER_ITEMS.forEach{item -> it.inventory.addItem(item)} + } + + this.instance.teamHandler.findPlayerTeams().forEach{team -> team.shops.entries.forEach{this.instance.villagerHandler.cache.add(this.instance.shopHandler.spawnVillager(it.value,it.key,team.type))}} + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onBlockPhysics(event: BlockPhysicsEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onGameStateChangeEnding(event: GameStateChangeEvent) { + + if (event.new != GameServer.State.ENDING) { + return + } + + val team = this.instance.eventHandler.controlledByTeam ?: return + + object : BukkitRunnable() { + + override fun run() { + + val koth = this@GameListener.instance.teamHandler.cache[Team.Type.KOTH] + + if (koth?.hq != null) { + koth.hq!!.world.spawnEntity(koth.hq,EntityType.FIREWORK) as Firework + } + + Bukkit.broadcastMessage("${team.getDisplayName()}${ChatColor.YELLOW} wins!") + } + + }.runTaskTimer(this.instance,30L,30L) + } + + companion object { + + val DISABLED_INVENTORIES = InventoryType.values().filter{it != InventoryType.CHEST && it != InventoryType.CREATIVE && it != InventoryType.PLAYER}.toMutableSet() + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/LunarClientListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/LunarClientListener.kt new file mode 100644 index 0000000..ca55430 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/LunarClientListener.kt @@ -0,0 +1,70 @@ +package cc.fyre.bunkers.game.listener + +import net.hylist.HylistSpigot +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import net.hylist.handler.MovementHandler +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerTeleportEvent + +/** + * @project bunkers + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +class LunarClientListener(private val instance: Bunkers) : Listener,MovementHandler { + + init { + HylistSpigot.INSTANCE.addMovementHandler(this) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + this.instance.server.scheduler.runTaskLater(this.instance,{ + + if (event.player == null || !event.player.isOnline) { + return@runTaskLater + } + + val koth = this.instance.teamHandler.cache[Team.Type.KOTH] + + if (koth?.hq != null) { + //TODO LunarClientAPI.instance.packetHandler.sendPacket(event.player,WayPointAddPacket("${koth.getDisplayName()}${ChatColor.WHITE}",koth.hq!!.world,koth.hq!!.blockX,koth.hq!!.blockY,koth.hq!!.blockZ,koth.type.getRGBColor(),forced = true,visible = true)) + } + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return@runTaskLater + + if (team.hq == null) { + return@runTaskLater + } + + //TODO LunarClientAPI.instance.packetHandler.sendPacket(event.player,WayPointAddPacket("HQ",team.hq!!.world,team.hq!!.blockX,team.hq!!.blockY,team.hq!!.blockZ,team.type.getRGBColor(),forced = true,visible = true)) + },20L) + + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + this.handleUpdateLocation(event.player,event.to,event.from,null) + } + + override fun handleUpdateLocation(player: Player,to: Location,from: Location,packet: PacketPlayInFlying?) { + + if (from.blockX == to.blockX && from.blockZ == to.blockZ) { + return + } + + } + + override fun handleUpdateRotation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) {} + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/VotingListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/VotingListener.kt new file mode 100644 index 0000000..1b00512 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/listener/VotingListener.kt @@ -0,0 +1,65 @@ +package cc.fyre.bunkers.game.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import org.apache.commons.lang.StringUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent + +/** + * @project bunkers + * + * @date 20/01/2021 + * @author xanderume@gmail.com + */ +class VotingListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (event.player.world != GameEngine.instance.voteHandler.world) { + return + } + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + if (!GameEngine.instance.gameHandler.getState().isPastOrCurrently(GameServer.State.IN_PROGRESS)) { + return + } + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + if (team.hq == null) { + event.player.sendMessage("${ChatColor.RED}Your team's HQ seems to be missing, please contact an administrator..") + return + } + + Bukkit.getScheduler().runTaskLater(this.instance,{ + + val koth = this.instance.teamHandler.cache[Team.Type.KOTH]!! + + event.player.teleport(team.hq) + + val teams = StringUtils.join(this.instance.teamHandler.findPlayerTeams().filter{ filtered -> filtered.type != team.type && filtered.members.isNotEmpty()}.map{ filtered -> filtered.getDisplayName()}.toTypedArray()) + + arrayListOf( + "", + " ${ChatColor.GOLD}You are apart of the ${team.getDisplayName()}${ChatColor.GOLD} team.", + " ${ChatColor.GOLD}Make $teams${ChatColor.GOLD} raidable", + " ${ChatColor.GOLD}and/or capture ${koth.getDisplayName()}${ChatColor.GOLD} to win.", + " ${ChatColor.GOLD}Make sure to block up all ${ChatColor.RED}${ChatColor.BOLD}${team.holograms.size} ${ChatColor.GOLD}entrances!", + " ${ChatColor.GOLD}Food can be found outside your base.", + "" + ).forEach{message -> event.player.sendMessage(message)} + + },10L) + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/CountdownScoreboardAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/CountdownScoreboardAdapter.kt new file mode 100644 index 0000000..6b214a5 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/CountdownScoreboardAdapter.kt @@ -0,0 +1,40 @@ +package cc.fyre.bunkers.game.scoreboard + +import cc.fyre.bunkers.Bunkers +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.adapter.GameAdapter +import cc.fyre.engine.game.adapter.scoreboard.ScoreboardAdapter +import net.frozenorb.qlib.scoreboard.ScoreGetter +import net.frozenorb.qlib.scoreboard.TitleGetter +import org.bukkit.ChatColor + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class CountdownScoreboardAdapter : ScoreboardAdapter { + + override fun getTitleGetter(): TitleGetter { + return TitleGetter.forStaticString( + "${ChatColor.GOLD}${ChatColor.BOLD} MC-Market ${ChatColor.GRAY}┃${ChatColor.WHITE} Bunkers" + ) + } + + override fun getScoreGetter(): ScoreGetter { + return ScoreGetter{toReturn,player -> + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) ?: return@ScoreGetter + + toReturn.add(GameAdapter.SCOREBOARD_LINE) + toReturn.add("${ChatColor.GREEN}${ChatColor.BOLD}Map${ChatColor.GRAY}: ${ChatColor.WHITE}${GameEngine.instance.gameHandler.map.id}") + toReturn.add("${ChatColor.GOLD}${ChatColor.BOLD}Team${ChatColor.GRAY}: ${team.getDisplayName()}") + toReturn.add("${ChatColor.DARK_BLUE}${GameAdapter.SCOREBOARD_LINE}") + + toReturn.toTypedArray() + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/InProgressScoreboardAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/InProgressScoreboardAdapter.kt new file mode 100644 index 0000000..e3742f2 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/InProgressScoreboardAdapter.kt @@ -0,0 +1,87 @@ +package cc.fyre.bunkers.game.scoreboard + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.adapter.GameAdapter +import cc.fyre.engine.game.adapter.scoreboard.ScoreboardAdapter +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.util.FormatUtil +import net.frozenorb.qlib.scoreboard.ScoreGetter +import net.frozenorb.qlib.scoreboard.TitleGetter +import org.bukkit.ChatColor + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class InProgressScoreboardAdapter : ScoreboardAdapter { + + override fun getTitleGetter(): TitleGetter { + return TitleGetter.forStaticString( + "${ChatColor.GOLD}${ChatColor.BOLD} MC-Market ${ChatColor.GRAY}┃${ChatColor.WHITE} Bunkers" + ) + } + + override fun getScoreGetter(): ScoreGetter { + return ScoreGetter{toReturn,player -> + + if (GameEngine.instance.gameHandler.getState() == GameServer.State.VOTING) { + GameEngine.instance.voteHandler.cache.entries.forEach{toReturn.add("${ChatColor.DARK_AQUA}${ChatColor.BOLD}${it.key.id}${ChatColor.GRAY}: ${ChatColor.WHITE}${it.value.size}")} + } + + if (GameEngine.instance.gameHandler.getState() == GameServer.State.IN_PROGRESS) { + toReturn.add("${ChatColor.GOLD}${ChatColor.BOLD}Game Time${ChatColor.GRAY}: ${ChatColor.RED}${FormatUtil.formatIntoMMSS(GameEngine.instance.gameHandler.getGameTime())}") + } + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team != null) { + toReturn.add("${ChatColor.GOLD}${ChatColor.BOLD}DTR${ChatColor.GRAY}: ${team.getDTRDisplay()}") + } + + if (!GameEngine.instance.spectateHandler.isSpectating(player)) { + toReturn.add("${ChatColor.GREEN}${ChatColor.BOLD}Balance${ChatColor.GRAY}:${ChatColor.RED} $${Bunkers.instance.statisticHandler.getBalance(player.uniqueId)}") + } + + if (Bunkers.instance.eventHandler.isActive()) { + toReturn.add("${ChatColor.BLUE}${ChatColor.BOLD}${GameEngine.instance.gameHandler.map.id}${ChatColor.GRAY}: ${ChatColor.RED}${FormatUtil.formatIntoMMSS(Bunkers.instance.eventHandler.service.remaining.get() * 1000L)}") + } + + Bunkers.instance.timerHandler.findTimers(player.uniqueId).filter{it.type.displays}.forEach{toReturn.add("${it.type.scoreboard}${ChatColor.GRAY}:${ChatColor.RED} ${FormatUtil.formatIntoFancy(it.getRemaining())}")} + + + val pvpClass = Bunkers.instance.pvpClassHandler.findById(player.uniqueId) + + if (pvpClass != null) { + + if (pvpClass.isEnergyBased()) { + + val cooldown = Bunkers.instance.timerHandler.findRemaining(player.uniqueId,TimerType.ENERGY_COOLDOWN) + + if (cooldown > 0L) { + toReturn.add("${ChatColor.GREEN}${ChatColor.BOLD}${pvpClass.getName()} Effect${ChatColor.GRAY}: ${ChatColor.RED}${FormatUtil.formatIntoMMSS(cooldown)}") + } + + val energy = Bunkers.instance.pvpClassHandler.getEnergy(player) + + if (energy > 0) { + toReturn.add("${ChatColor.AQUA}${ChatColor.BOLD}${pvpClass.getName()} Energy${ChatColor.GRAY}: ${ChatColor.RED}$energy.0") + } + + } + + } + + if (toReturn.isNotEmpty()) { + toReturn.add(0,GameAdapter.SCOREBOARD_LINE) + toReturn.add("${ChatColor.DARK_BLUE}${GameAdapter.SCOREBOARD_LINE}") + } + + toReturn.toTypedArray() + } + } + +} diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter.kt new file mode 100644 index 0000000..114807e --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/VotingScoreboardAdapter.kt @@ -0,0 +1,38 @@ +package cc.fyre.bunkers.game.scoreboard + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.adapter.GameAdapter +import cc.fyre.engine.game.adapter.scoreboard.ScoreboardAdapter +import net.frozenorb.qlib.scoreboard.ScoreGetter +import net.frozenorb.qlib.scoreboard.TitleGetter +import org.bukkit.ChatColor + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class VotingScoreboardAdapter : ScoreboardAdapter { + + override fun getTitleGetter(): TitleGetter { + return TitleGetter.forStaticString( + "${ChatColor.GOLD}${ChatColor.BOLD} MC-Market ${ChatColor.GRAY}┃${ChatColor.WHITE} Bunkers" + ) + } + + override fun getScoreGetter(): ScoreGetter { + return ScoreGetter{toReturn,_ -> + + + toReturn.add(GameAdapter.SCOREBOARD_LINE) + + GameEngine.instance.voteHandler.cache.entries.sortedBy{it.key.id.length}.forEach{toReturn.add("${it.key.id}: ${ChatColor.GOLD}${it.value.size}")} + + toReturn.add("${ChatColor.DARK_BLUE}${GameAdapter.SCOREBOARD_LINE}") + toReturn.toTypedArray() + } + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/WaitingScoreboardAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/WaitingScoreboardAdapter.kt new file mode 100644 index 0000000..7380221 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/scoreboard/WaitingScoreboardAdapter.kt @@ -0,0 +1,32 @@ +package cc.fyre.bunkers.game.scoreboard + +import cc.fyre.engine.game.adapter.GameAdapter +import cc.fyre.engine.game.adapter.scoreboard.ScoreboardAdapter +import net.frozenorb.qlib.scoreboard.ScoreGetter +import net.frozenorb.qlib.scoreboard.TitleGetter +import org.bukkit.ChatColor + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class WaitingScoreboardAdapter : ScoreboardAdapter { + + override fun getTitleGetter(): TitleGetter { + return TitleGetter.forStaticString( + "${ChatColor.GOLD}${ChatColor.BOLD} MC-Market ${ChatColor.GRAY}┃${ChatColor.WHITE} Bunkers" + ) } + + override fun getScoreGetter(): ScoreGetter { + return ScoreGetter{ toReturn, _ -> + toReturn.add(GameAdapter.SCOREBOARD_LINE) + toReturn.add("Waiting...") + toReturn.add("${ChatColor.DARK_BLUE}${GameAdapter.SCOREBOARD_LINE}") + + toReturn.toTypedArray() + } + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/tab/BunkersTabAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/tab/BunkersTabAdapter.kt new file mode 100644 index 0000000..e75520e --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/game/tab/BunkersTabAdapter.kt @@ -0,0 +1,216 @@ +package cc.fyre.bunkers.game.tab + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.event.EventHandler +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.timer.data.TimerType + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.util.FormatUtil +import com.google.common.collect.HashBasedTable +import net.frozenorb.qlib.tab.construct.TabLayout +import net.frozenorb.qlib.tab.provider.LayoutProvider +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project bunkers + * + * @date 21/08/2020 + * @author xanderume@gmail.com + */ +object BunkersTabAdapter : LayoutProvider { + + override fun provide(player: Player): TabLayout { + + val layout = TabLayout.create(player) + + var y = 3 + + layout.set(0,y++,"${ChatColor.GOLD}Player Info:") + layout.set(0,y++,"${ChatColor.GRAY}Kills: ${ChatColor.WHITE}${Bunkers.instance.statisticHandler.getKills(player.uniqueId)}") + layout.set(0,y++,"${ChatColor.GRAY}Deaths: ${ChatColor.WHITE}${Bunkers.instance.statisticHandler.getDeaths(player.uniqueId)}") + + y++ + + if (player.location.world != null) { + layout.set(0,y++,"${ChatColor.GOLD}Location:") + layout.set(0,y++,"${ChatColor.RED}${Bunkers.instance.teamHandler.findByLocation(player.location).getDisplayName()}") + layout.set(0,y++,"${ChatColor.GRAY}${player.location.blockX}, ${player.location.blockZ} [${this.getCardinalDirection(player)}${ChatColor.GRAY}]") + } + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team != null) { + y = 3 + + layout.set(1,y++,"${ChatColor.GOLD}Team Info:") + layout.set(1,y++,"${ChatColor.GRAY}DTR: ${team.getDTRDisplay()}") + layout.set(1,y++,"${ChatColor.GRAY}Online: ${ChatColor.WHITE}${team.findOnlineMembers().size}/${team.members.size}") + } + + y = 3 + + layout.set(2,y++,"${ChatColor.GOLD}Game Info:") + + if (GameEngine.instance.gameHandler.getState().isPastOrCurrently(GameServer.State.IN_PROGRESS)) { + layout.set(2,y++,"${ChatColor.GRAY}Time: ${ChatColor.WHITE}${FormatUtil.formatIntoMMSS(GameEngine.instance.gameHandler.getGameTime())}") + } else { + + var map = "Voting" + + if (GameEngine.instance.gameHandler.getState().isPastOrCurrently(GameServer.State.COUNTDOWN)) { + map = GameEngine.instance.gameHandler.map.id + } + + layout.set(2,y++,"${ChatColor.GRAY}Map: ${ChatColor.WHITE}$map") + } + + layout.set(2,y++,"${ChatColor.GRAY}Players: ${ChatColor.WHITE}${GameEngine.instance.gameHandler.getPlayers().size}") + + y++ + + if (GameEngine.instance.gameHandler.getState().isPastOrCurrently(GameServer.State.COUNTDOWN)) { + val captureZone = Bunkers.instance.eventHandler.getCaptureZone() + + layout.set(2,y++,"${ChatColor.GOLD}${GameEngine.instance.gameHandler.map.id}:") + layout.set(2,y++,"${ChatColor.GRAY}${captureZone.blockX}, ${captureZone.blockZ}") + + val time = if (Bunkers.instance.eventHandler.isActive()) { + Bunkers.instance.eventHandler.service.remaining.get() * 1000L + } else { + (EventHandler.KOTH_START_TIME * 1000L) - (GameEngine.instance.gameHandler.getGameTime()) + } + + layout.set(2,y++,"${ChatColor.GRAY}${FormatUtil.formatIntoMMSS(time)}") + } + + y = 7 + + var x = 1 + + Bunkers.instance.teamHandler.findPlayerTeams().sortedByDescending{it.isMember(player)}.forEach{ + + val next: Int = if (y == 7) { + 0 + } else { + if (x >= 2) { + 0 + } else { + x + 1 + } + } + + layout.set(x,y++,"${it.getDisplayName()} Team ${ChatColor.GRAY}[${it.getDTRDisplay()}${ChatColor.GRAY}]") + + it.members.forEach{member -> layout.set(x,y++,this.getDisplayName(player,member,it))} + + y = 14 + x = next + } + + return layout + } + + private fun getCardinalDirection(player: Player):String { + + var rot = (player.location.yaw - 90) % 360.toDouble() + + if (rot < 0) { + rot += 360.0 + } + + return this.getDirection(rot) + } + + private fun getDirection(rot: Double): String { + + return when { + 0 <= rot && rot < 22.5 -> Direction.WEST.getDisplay() + 22.5 <= rot && rot < 67.5 -> "${Direction.NORTH.getDisplay()}${Direction.WEST.getDisplay()}" + 67.5 <= rot && rot < 112.5 -> Direction.NORTH.getDisplay() + 112.5 <= rot && rot < 157.5 -> "${Direction.NORTH.getDisplay()}${Direction.EAST.getDisplay()}" + 157.5 <= rot && rot < 202.5 -> Direction.EAST.getDisplay() + 202.5 <= rot && rot < 247.5 -> "${Direction.SOUTH.getDisplay()}${Direction.EAST.getDisplay()}" + 247.5 <= rot && rot < 292.5 -> Direction.SOUTH.getDisplay() + 292.5 <= rot && rot < 337.5 -> "${Direction.SOUTH.getDisplay()}${Direction.WEST.getDisplay()}" + 337.5 <= rot && rot < 360.0 -> Direction.WEST.getDisplay() + else -> "" + } + + } + private fun getDisplayName(viewer: Player,uuid: UUID,team: Team): String { + + val player = Bunkers.instance.server.getPlayer(uuid) + + if (player != null) { + + if (GameEngine.instance.spectateHandler.isSpectating(player)) { + return "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${player.name}" + } + + val respawn = Bunkers.instance.timerHandler.findRemaining(uuid,TimerType.RESPAWN) + + if (team.isMember(viewer.uniqueId) && respawn > 0L) { + return "${ChatColor.GRAY}${player.name}${ChatColor.RED} ${respawn / 1000L}s" + } + + return "${team.getColor()}${player.name}" + } + + val name = UUIDUtils.name(uuid) + + if (GameEngine.instance.disqualifieHandler.isDisqualified(uuid)) { + return "${ChatColor.DARK_GRAY}${ChatColor.STRIKETHROUGH}${name}" + } + + return "${ChatColor.GRAY}$name" + } + + enum class Direction(private val display: String) { + + EAST("E"), + WEST("W"), + SOUTH("S"), + NORTH("N"); + + fun getDisplay():String { + + if (GameEngine.instance.gameHandler.getState().isBeforeOrCurrently(GameServer.State.COUNTDOWN)) { + return "${ChatColor.WHITE}${this.display}" + } + + return "${DIRECTIONS.get(GameEngine.instance.gameHandler.map.id.toLowerCase(),this) ?: ChatColor.WHITE}${this.display}" + } + + } + + val DIRECTIONS = HashBasedTable.create() + + init { + //TODO LOL + DIRECTIONS.put("western",Direction.WEST,ChatColor.BLUE) + DIRECTIONS.put("western",Direction.EAST,ChatColor.YELLOW) + DIRECTIONS.put("western",Direction.SOUTH,ChatColor.RED) + DIRECTIONS.put("western",Direction.NORTH,ChatColor.GREEN) + + DIRECTIONS.put("classic",Direction.WEST,ChatColor.YELLOW) + DIRECTIONS.put("classic",Direction.EAST,ChatColor.GREEN) + DIRECTIONS.put("classic",Direction.SOUTH,ChatColor.RED) + DIRECTIONS.put("classic",Direction.NORTH,ChatColor.BLUE) + + DIRECTIONS.put("medieval",Direction.WEST,ChatColor.GREEN) + DIRECTIONS.put("medieval",Direction.EAST,ChatColor.YELLOW) + DIRECTIONS.put("medieval",Direction.NORTH,ChatColor.RED) + DIRECTIONS.put("medieval",Direction.SOUTH,ChatColor.BLUE) + + DIRECTIONS.put("colosseum",Direction.WEST,ChatColor.YELLOW) + DIRECTIONS.put("colosseum",Direction.EAST,ChatColor.GREEN) + DIRECTIONS.put("colosseum",Direction.NORTH,ChatColor.RED) + DIRECTIONS.put("colosseum",Direction.SOUTH,ChatColor.BLUE) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/PillarHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/PillarHandler.kt new file mode 100644 index 0000000..8c69469 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/PillarHandler.kt @@ -0,0 +1,181 @@ +package cc.fyre.bunkers.pillar + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.pillar.data.Pillar + +import cc.fyre.bunkers.pillar.data.adapter.WallAdapter + +import cc.fyre.bunkers.pillar.listener.PillarListener +import cc.fyre.bunkers.pillar.listener.PillarPacketListener +import cc.fyre.bunkers.pillar.listener.PillarWallListener +import com.comphenix.protocol.ProtocolLibrary +import com.google.common.collect.HashBasedTable +import org.bukkit.Location +import org.bukkit.Material +import org.bukkit.entity.Player +import java.util.* +import java.util.function.Predicate +import kotlin.collections.HashMap +import kotlin.collections.HashSet + + +/** + * @project hcf + * + * @date 27/08/2020 + * @author xanderume@gmail.com + */ + +// Rewrite & cleanup of https://github.com/iPvP-MC/iHCF/master/com/doctordark/hcf/visualise/VisualiseHandler.java + +class PillarHandler(private val instance: Bunkers) { + + val cache: HashBasedTable = HashBasedTable.create() + val adapters = ArrayList() + + init { + this.instance.server.pluginManager.registerEvents(PillarWallListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(PillarListener(this.instance),this.instance) + + ProtocolLibrary.getProtocolManager().addPacketListener(PillarPacketListener(this.instance)) + } + + fun findPillar(uuid: UUID,location: Location):Pillar? { + return this.cache.get(uuid,location) + } + + fun findPillars(uuid: UUID):MutableSet { + return this.cache.row(uuid).values.toMutableSet() + } + + fun findPillars(uuid: UUID,type: Pillar.Type):MutableSet { + return this.cache.row(uuid).filter{it.value.type == type}.values.toMutableSet() + } + + fun findPillarAmountByType(uuid: UUID,type: Pillar.Type):Int { + + val toReturn = HashSet() + + for (pillar in this.cache.row(uuid).filter{it.value.type == type}.values) { + + if (toReturn.any{it.location.blockX == pillar.location.blockX && it.location.blockZ == pillar.location.blockZ}) { + continue + } + + toReturn.add(pillar) + } + + return toReturn.size + } + + fun sendPillars(player: Player,type: Pillar.Type,locations: Collection,material: Material,overwrite: Boolean) { + this.sendPillars(player,type,locations,material,0,overwrite) + } + + fun sendPillars(player: Player,type: Pillar.Type,locations: Collection,material: Material,data: Int,overwrite: Boolean) { + this.sendPillars(player,type,locations,Material.GLASS,material,data,overwrite) + } + + fun sendPillars(player: Player,type: Pillar.Type,locations: Collection,origin: Material,material: Material,data: Int,overwrite: Boolean) { + + val pillars = HashMap() + + for (location in locations) { + + if (this.cache.contains(player.uniqueId,location) && !overwrite) { + continue + } + + if (location.block.type.isSolid || location.block.type != Material.AIR) { + continue + } + + var blockType = origin + + if (type != Pillar.Type.CLAIM_BORDER) { + + if (location.blockY == 0 || location.blockY % 3 == 0) { + blockType = material + } + + } + + val pillar = Pillar(type,location,blockType,data.toShort()) + + pillars[location] = pillar + + player.sendBlockChange(location,pillar.material,pillar.data.toByte()) + + this.cache.put(player.uniqueId,location,pillar) + } + + } + + fun sendPillarsAsync(player: Player,type: Pillar.Type,locations: Collection,material: Material,overwrite: Boolean) { + + val pillars = HashMap() + + for (location in locations) { + + if (this.cache.contains(player.uniqueId,location) && !overwrite) { + continue + } + + location.world.getChunkAtAsync(location) { + + if (location.block.type.isSolid || location.block.type != Material.AIR) { + return@getChunkAtAsync + } + + var blockType = Material.GLASS + + if (type != Pillar.Type.CLAIM_BORDER) { + + if (location.blockY == 0 || location.blockY % 3 == 0) { + blockType = material + } + + } + + val pillar = Pillar(type,location,blockType) + + pillars[location] = pillar + + player.sendBlockChange(location,pillar.material,pillar.data.toByte()) + + this.cache.put(player.uniqueId,location,pillar) + } + + } + + } + + fun removePillar(player: Player,location: Location) { + + val pillar = this.cache.remove(player.uniqueId,location) ?: return + + if (pillar.material == location.block.type && pillar.data == location.block.data.toShort()) { + return + } + + player.sendBlockChange(location,location.block.type,location.block.data) + } + + fun removePillars(player: Player,type: Pillar.Type) { + this.removePillars(player,type,Predicate{true}) + } + + fun removePillars(player: Player,locations: Collection) { + locations.forEach{this.removePillar(player,it)} + } + + fun removePillars(player: Player,type: Pillar.Type,predicate: Predicate) { + + if (!this.cache.containsRow(player.uniqueId)) { + return + } + + HashMap(this.cache.row(player.uniqueId)).filter{predicate.test(it.value) && (it.value == null || it.value.type == type)}.forEach{this.removePillar(player,it.key)} + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/data/Pillar.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/data/Pillar.kt new file mode 100644 index 0000000..ddebb66 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/data/Pillar.kt @@ -0,0 +1,22 @@ +package cc.fyre.bunkers.pillar.data + +import org.bukkit.Location +import org.bukkit.Material + +/** + * @project hcf + * + * @date 27/08/2020 + * @author xanderume@gmail.com + */ +class Pillar(val type: Type,val location: Location,val material: Material,val data: Short) { + + constructor(type: Type,location: Location,material: Material):this(type,location,material,0) + + enum class Type(val materials: Array) { + + CLAIM_BORDER(arrayOf(Material.STAINED_GLASS)); + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/data/adapter/WallAdapter.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/data/adapter/WallAdapter.kt new file mode 100644 index 0000000..6acf916 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/data/adapter/WallAdapter.kt @@ -0,0 +1,20 @@ +package cc.fyre.bunkers.pillar.data.adapter + +import cc.fyre.bunkers.team.data.Team +import org.bukkit.entity.Player + +import org.bukkit.Material + +/** + * @project hcf + * + * @date 02/01/2021 + * @author xanderume@gmail.com + */ +interface WallAdapter { + + fun getMaterial(player: Player):Pair + fun shouldCheck(player: Player,team: Team?):Boolean + fun shouldApply(player: Player,team: Team,playerTeam: Team?):Boolean + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarListener.kt new file mode 100644 index 0000000..c9300dd --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarListener.kt @@ -0,0 +1,28 @@ +package cc.fyre.bunkers.pillar.listener + +import cc.fyre.bunkers.Bunkers +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.PlayerDeathEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project hcf + * + * @date 28/08/2020 + * @author xanderume@gmail.com + */ +class PillarListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.pillarHandler.findPillars(event.player.uniqueId).forEach{this.instance.pillarHandler.cache.remove(event.player.uniqueId,it.type)} + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerDeath(event: PlayerDeathEvent) { + this.instance.pillarHandler.findPillars(event.entity.uniqueId).forEach{this.instance.pillarHandler.cache.remove(event.entity.uniqueId,it.type)} + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarPacketListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarPacketListener.kt new file mode 100644 index 0000000..b2c7b2e --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarPacketListener.kt @@ -0,0 +1,61 @@ +package cc.fyre.bunkers.pillar.listener + +import cc.fyre.bunkers.Bunkers +import com.comphenix.protocol.PacketType +import com.comphenix.protocol.events.PacketAdapter +import com.comphenix.protocol.events.PacketEvent + +import org.bukkit.GameMode +import org.bukkit.Location + +/** + * @project hcf + * + * @date 28/08/2020 + * @author xanderume@gmail.com + */ +class PillarPacketListener(private val instance: Bunkers) : PacketAdapter(instance,listOf(PacketType.Play.Client.BLOCK_DIG,PacketType.Play.Client.BLOCK_PLACE)) { + + override fun onPacketReceiving(event: PacketEvent) { + + if (event.packet.type == PacketType.Play.Client.BLOCK_PLACE) { + + val pillar = this.instance.pillarHandler.findPillar(event.player.uniqueId,Location(event.player.world,event.packet.integers.read(0).toDouble(),event.packet.integers.read(1).toDouble(),event.packet.integers.read(2).toDouble())) + + if (pillar == null || event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + return + } + + val action = event.packet.integers.read(4) + + if (!(action == 0 || action == 2)) { + return + } + + val x = event.packet.integers.read(0) + val y = event.packet.integers.read(1) + val z = event.packet.integers.read(2) + + val location = Location(event.player.world,x.toDouble(),y.toDouble(),z.toDouble()) + + val pillar = this.instance.pillarHandler.findPillar(event.player.uniqueId,location) ?: return + + event.isCancelled = true + + if (action == 2) { + event.player.sendBlockChange(location,pillar.material,pillar.data.toByte()) + return + } + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.player.sendBlockChange(location,pillar.material,pillar.data.toByte()) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarWallListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarWallListener.kt new file mode 100644 index 0000000..e0745c2 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pillar/listener/PillarWallListener.kt @@ -0,0 +1,146 @@ +package cc.fyre.bunkers.pillar.listener + +import net.hylist.HylistSpigot +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.pillar.data.Pillar +import net.hylist.handler.MovementHandler + +import cc.fyre.bunkers.pillar.data.adapter.WallAdapter +import cc.fyre.bunkers.team.data.Team + +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.GameMode +import org.bukkit.Location +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerTeleportEvent +import java.util.* +import java.util.function.Predicate +import kotlin.collections.HashMap +import kotlin.math.abs + + +/** + * @project hcf + * + * @date 16/09/2020 + * @author xanderume@gmail.com + */ +class PillarWallListener(private val instance: Bunkers) : Listener,MovementHandler { + + init { + HylistSpigot.INSTANCE.addMovementHandler(this) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + this.handleUpdateLocation(event.player,event.to,event.from,null) + } + + override fun handleUpdateRotation(player: Player,to: Location,from: Location,packet: PacketPlayInFlying?) {} + + override fun handleUpdateLocation(player: Player,to: Location,from: Location,packet: PacketPlayInFlying?) { + + if (player.gameMode == GameMode.CREATIVE) { + return + } + + if (from.blockX == to.blockX && from.blockY == to.blockY && from.blockZ == to.blockZ) { + return + } + + val team = this.instance.teamHandler.findById(player.uniqueId) ?: return + + val adapters = this.instance.pillarHandler.adapters.filter{it.shouldCheck(player,team)} + + if (adapters.isEmpty()) { + return + } + + this.instance.pillarHandler.removePillars(player,Pillar.Type.CLAIM_BORDER,Predicate{ + return@Predicate it.location.world == to.world && + abs(to.blockX - it.location.blockX) > WALL_BORDER_HORIZONTAL_DISTANCE || + abs(to.blockY - it.location.blockY) > WALL_BORDER_HEIGHT_ABOVE_DIFF || + abs(to.blockZ - it.location.blockZ) > WALL_BORDER_HORIZONTAL_DISTANCE + }) + + val minX = to.blockX - WALL_BORDER_HORIZONTAL_DISTANCE + val maxX = to.blockX + WALL_BORDER_HORIZONTAL_DISTANCE + val minZ = to.blockZ - WALL_BORDER_HORIZONTAL_DISTANCE + val maxZ = to.blockZ + WALL_BORDER_HORIZONTAL_DISTANCE + + val minHeight: Int = to.blockY - WALL_BORDER_HEIGHT_BELOW_DIFF + val maxHeight: Int = to.blockY + WALL_BORDER_HEIGHT_ABOVE_DIFF + + val entries = HashMap() + + for (x in minX until maxX) { + + for (z in minZ until maxZ) { + + val enemy = this.instance.teamHandler.findByLocation(Location(to.world,x.toDouble(),0.0,z.toDouble())) + + for (adapter in adapters) { + + if (!adapter.shouldApply(player,enemy,team)) { + continue + } + + if (entries.containsKey(enemy)) { + // prevent flicker + continue + } + + entries[enemy] = adapter + } + + } + + } + + for (entry in entries) { + + if (entry.key.claim == null) { + continue + } + + val material = entry.value.getMaterial(player) + + if (entry.key.claim!!.contains(player.location)) { + continue + } + + val locations = ArrayList() + + entry.key.claim!!.borderIterator().forEachRemaining{ + + if (abs(it.first - to.blockX) > WALL_BORDER_HORIZONTAL_DISTANCE) { + return@forEachRemaining + } + + if (abs(it.second - to.blockZ) > WALL_BORDER_HORIZONTAL_DISTANCE) { + return@forEachRemaining + } + + for (i in minHeight until maxHeight) { + locations.add(Location(to.world,it.first.toDouble(),i.toDouble(),it.second.toDouble())) + } + + } + + this.instance.pillarHandler.sendPillars(player,Pillar.Type.CLAIM_BORDER,locations,material.first,material.first,material.second,true) + } + + } + + companion object { + + private const val WALL_BORDER_HEIGHT_BELOW_DIFF = 3 + private const val WALL_BORDER_HEIGHT_ABOVE_DIFF = 4 + private const val WALL_BORDER_HORIZONTAL_DISTANCE = 7 + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/PvPClassHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/PvPClassHandler.kt new file mode 100644 index 0000000..10eccfb --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/PvPClassHandler.kt @@ -0,0 +1,138 @@ +package cc.fyre.bunkers.pvpclass + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.pvpclass.data.PvPClass +import cc.fyre.bunkers.pvpclass.data.type.BardClass +import cc.fyre.bunkers.pvpclass.event.PvPClassEquipEvent +import cc.fyre.bunkers.pvpclass.event.PvPClassUnEquipEvent +import cc.fyre.bunkers.pvpclass.listener.PvPClassListener +import cc.fyre.engine.profile.data.type.BunkersProfile +import com.google.common.collect.HashBasedTable +import org.bukkit.entity.Player +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType +import java.util.* +import java.util.concurrent.TimeUnit +import kotlin.collections.HashMap +import kotlin.math.min + + +/** + * @project hcf + * + * @date 10/09/2020 + * @author xanderume@gmail.com + */ +class PvPClassHandler(private val instance: Bunkers) { + + val cache = HashMap() + val typeToClass = HashMap() + + val effects = HashBasedTable.create() + + private val energy = HashMap() + + init { + this.typeToClass[PvPClass.Type.BARD] = BardClass + + this.instance.server.pluginManager.registerEvents(PvPClassListener(this.instance),this.instance) + } + + fun dispose() { + this.instance.server.onlinePlayers.filter{this.cache.containsKey(it.uniqueId)}.forEach{this.setPvPClass(it,null)} + } + + fun findById(uuid: UUID):PvPClass? { + + if (!this.cache.containsKey(uuid)) { + return null + } + + return this.typeToClass[this.cache[uuid]!!] + } + + fun findByType(type: PvPClass.Type):PvPClass? { + return this.typeToClass[type] + } + + fun setPvPClass(player: Player,type: PvPClass.Type?) { + + if (this.cache.containsKey(player.uniqueId)) { + + if (this.cache[player.uniqueId] == type) { + return + } + + val previous = this.cache.remove(player.uniqueId)!! + + this.instance.server.pluginManager.callEvent(PvPClassUnEquipEvent(player,this.typeToClass[previous]!!)) + + this.energy.remove(player.uniqueId) + this.typeToClass[previous]!!.onDisable(player) + + this.instance.statisticHandler.recalculatePlayTime(player.uniqueId,previous.backendType) + this.instance.statisticHandler.playTimeClassEquipped[player.uniqueId]?.remove(previous.backendType) + + previous.effects.filter{player.activePotionEffects.any{effect -> it.type == effect.type && it.duration > (TimeUnit.MINUTES.toMillis(8L)) && it.amplifier == effect.amplifier}}.forEach{player.removePotionEffect(it.type)} + } + + if (type == null || !this.typeToClass.containsKey(type)) { + return + } + + val event = PvPClassEquipEvent(player,this.typeToClass[type]!!) + + this.instance.server.pluginManager.callEvent(event) + + if (event.isCancelled) { + return + } + + this.cache[player.uniqueId] = type + this.energy[player.uniqueId] = System.currentTimeMillis() + this.typeToClass[type]!!.onEnable(player) + + + this.instance.statisticHandler.playTimeClassEquipped.putIfAbsent(player.uniqueId,EnumMap(BunkersProfile.PvPClass::class.java)) + this.instance.statisticHandler.playTimeClassEquipped[player.uniqueId]!![type.backendType] = System.currentTimeMillis() + + type.effects.forEach{player.addPotionEffect(it,true)} + } + + fun getEnergy(player: Player):Int { + + if (!this.energy.containsKey(player.uniqueId)) { + return 0 + } + + val energy = this.energy[player.uniqueId]!! + + if (energy == 0L) { + return 0 + } + + return min(100,(1.0 * (System.currentTimeMillis()) - energy).toInt() / 1000) + } + + fun setEnergy(player: Player,energy: Int) { + this.energy[player.uniqueId] = (System.currentTimeMillis() - (1000L * energy)) + } + + fun addPotionEffect(player: Player,effect: PotionEffect) { + + if (player.activePotionEffects.any{it.type == effect.type && (it.amplifier > effect.amplifier || (it.amplifier == effect.amplifier && it.duration > effect.duration))}) { + return + } + + // only cache the ones are lower then infinite & normal bard speed duration + player.activePotionEffects.stream().filter{it.type == effect.type && it.duration > 120 && it.duration <= 1_000_000}.findFirst().ifPresent{this.effects.put(player.uniqueId,it.type,it)} + + player.addPotionEffect(effect,true) + } + + companion object { + + const val BARD_RANGE = 25.0 + + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/PvPClass.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/PvPClass.kt new file mode 100644 index 0000000..920c7c4 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/PvPClass.kt @@ -0,0 +1,67 @@ +package cc.fyre.bunkers.pvpclass.data + +import cc.fyre.bunkers.pvpclass.data.item.energy.EnergyEffect +import cc.fyre.bunkers.pvpclass.data.item.ConsumableItem +import cc.fyre.engine.profile.data.type.BunkersProfile +import com.google.common.collect.HashBasedTable +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project hcf + * + * @date 10/09/2020 + * @author xanderume@gmail.com + */ +abstract class PvPClass(val type: Type) { + + protected val effects = ArrayList() + + private val cooldowns = HashBasedTable.create() + private val consumables = this.getConsumableItems() + + fun getName():String { + return this.type.displayName + } + + abstract fun onEnable(player: Player) + abstract fun onDisable(player: Player) + + abstract fun isEnergyBased():Boolean + abstract fun getConsumableItems():List + + open fun isEquipped(player: Player):Boolean { + return player.inventory.armorContents.all{it != null && it.type.name.startsWith(this.type.armor)} + } + + fun getCooldown(player: Player,consumable: ConsumableItem):Long { + + if (!this.cooldowns.contains(player.uniqueId,consumable.material)) { + return 0L + } + + return (this.cooldowns.get(player.uniqueId,consumable.material) + consumable.cooldown) - System.currentTimeMillis() + } + + fun setCooldown(player: Player,consumable: ConsumableItem) { + this.cooldowns.put(player.uniqueId,consumable.material,System.currentTimeMillis()) + } + + fun findEffectByItem(material: Material):EnergyEffect? { + return this.effects.firstOrNull{it.material == material} + } + + fun findConsumableByItem(material: Material):ConsumableItem? { + return this.consumables.firstOrNull{it.material == material} + } + + enum class Type(val displayName: String,val armor: String,val effects: Array,val backendType: BunkersProfile.PvPClass) { + DIAMOND("Diamond","DIAMOND",arrayOf(),BunkersProfile.PvPClass.DIAMOND), + BARD("Bard","GOLD",arrayOf(PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1),PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,0),PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1)),BunkersProfile.PvPClass.BARD); + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem.kt new file mode 100644 index 0000000..78def2a --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/item/ConsumableItem.kt @@ -0,0 +1,28 @@ +package cc.fyre.bunkers.pvpclass.data.item + +import cc.fyre.bunkers.Bunkers + +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.potion.PotionEffect + +/** + * @project hcf + * + * @date 10/09/2020 + * @author xanderume@gmail.com + */ +abstract class ConsumableItem(val material: Material,val cooldown: Long) { + + abstract fun onConsume(player: Player): Boolean + + class EffectConsumableItem(material: Material,cooldown: Long,private val effect: PotionEffect) : ConsumableItem(material,cooldown) { + + override fun onConsume(player: Player):Boolean { + Bunkers.instance.pvpClassHandler.addPotionEffect(player,this.effect) + return true + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect.kt new file mode 100644 index 0000000..ff21418 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/item/energy/EnergyEffect.kt @@ -0,0 +1,102 @@ +package cc.fyre.bunkers.pvpclass.data.item.energy + +import cc.fyre.bunkers.Bunkers + +import cc.fyre.bunkers.pvpclass.PvPClassHandler +import cc.fyre.bunkers.pvpclass.data.PvPClass +import cc.fyre.bunkers.pvpclass.data.item.ConsumableItem +import cc.fyre.bunkers.pvpclass.data.type.BardClass +import cc.fyre.bunkers.pvpclass.event.type.BardEffectEvent +import cc.fyre.bunkers.team.data.Team +import cc.fyre.engine.util.PotionUtil +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType +import java.util.concurrent.TimeUnit +import java.util.function.Predicate + +/** + * @project hcf + * + * @date 11/09/2020 + * @author xanderume@gmail.com + */ +open class EnergyEffect(val energy: Int,material: Material,val effect: PotionEffect?) : ConsumableItem(material,TimeUnit.SECONDS.toMillis(10L)) { + + override fun onConsume(player: Player): Boolean { + + if (this.effect == null) { + return false + } + + player.addPotionEffect(this.effect,true) + return true + } + + class BardEffect(energy: Int,material: Material,val passive: PotionEffect?,effect: PotionEffect?) : EnergyEffect(energy,material,effect) { + + var predicate: Predicate? = null + + constructor(energy: Int,material: Material,passive: PotionEffect?,effect: PotionEffect?,predicate: Predicate):this(energy,material,passive,effect) { + this.predicate = predicate + } + + override fun onConsume(player: Player): Boolean { + + val debuff = if (this.effect == null) false else isDebuff(this.effect.type) + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) ?: return false + + val receivers = findReceivers(player,team,PvPClassHandler.BARD_RANGE,debuff,this.effect) + + Bunkers.instance.server.pluginManager.callEvent(BardEffectEvent(player,receivers.filter{it.uniqueId != player.uniqueId},this)) + + receivers.forEach{ + + if (this.effect == null && this.predicate != null) { + this.predicate!!.test(it) + } else if (this.effect != null) { + Bunkers.instance.pvpClassHandler.addPotionEffect(it,this.effect) + } + + } + return true + } + + companion object { + + fun isDebuff(effect: PotionEffectType):Boolean { + return PotionUtil.isDebuff(effect) + } + + fun findReceivers(player: Player,team: Team,range: Double,debuff: Boolean,effect: PotionEffect?):Collection { + + val toReturn = ArrayList() + + player.getNearbyEntities(range,range / 2,range).filter{it.uniqueId != player.uniqueId}.filterIsInstance().filter{ + + val pvpClass = Bunkers.instance.pvpClassHandler.findById(it.uniqueId) + + if (effect != null && pvpClass?.type == PvPClass.Type.BARD && BardClass.BARD_ILLEGAL_EFFECTS.contains(effect.type)) { + return@filter false + } + + if (debuff) { + return@filter !team.isMember(it.uniqueId) + } + + return@filter team.isMember(it.uniqueId) + }.forEach{toReturn.add(it)} + + if (effect == null || !BardClass.BARD_ILLEGAL_EFFECTS.contains(effect.type)) { + toReturn.add(player) + } + + return toReturn + } + + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/service/BardService.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/service/BardService.kt new file mode 100644 index 0000000..8c51b73 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/service/BardService.kt @@ -0,0 +1,48 @@ +package cc.fyre.bunkers.pvpclass.data.service + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.pvpclass.PvPClassHandler +import cc.fyre.bunkers.pvpclass.data.PvPClass +import cc.fyre.bunkers.pvpclass.data.item.energy.EnergyEffect +import org.bukkit.scheduler.BukkitRunnable + +/** + * @project hcf + * + * @date 12/09/2020 + * @author xanderume@gmail.com + */ +class BardService(private val instance: Bunkers) : BukkitRunnable() { + + override fun run() { + + for (entry in this.instance.pvpClassHandler.cache.filterValues{it == PvPClass.Type.BARD}.mapKeys{this.instance.server.getPlayer(it.key)}.mapValues{this.instance.pvpClassHandler.findByType(it.value)}) { + + if (entry.key == null || !entry.key.isOnline) { + continue + } + + if (entry.value == null) { + continue + } + + if (entry.key.itemInHand == null) { + continue + } + + val effect = entry.value!!.findEffectByItem(entry.key.itemInHand.type) + + if (effect == null || effect !is EnergyEffect.BardEffect || effect.passive == null) { + continue + } + + val team = this.instance.teamHandler.findById(entry.key.uniqueId) ?: return + + val receivers = EnergyEffect.BardEffect.findReceivers(entry.key,team,PvPClassHandler.BARD_RANGE,EnergyEffect.BardEffect.isDebuff(effect.passive.type),effect.passive) + + receivers.forEach{this.instance.pvpClassHandler.addPotionEffect(it,effect.passive)} + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/type/BardClass.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/type/BardClass.kt new file mode 100644 index 0000000..d550776 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/data/type/BardClass.kt @@ -0,0 +1,97 @@ +package cc.fyre.bunkers.pvpclass.data.type + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.pvpclass.data.PvPClass +import cc.fyre.bunkers.pvpclass.data.item.energy.EnergyEffect +import cc.fyre.bunkers.pvpclass.data.item.ConsumableItem +import cc.fyre.bunkers.pvpclass.data.service.BardService +import cc.fyre.bunkers.pvpclass.event.type.BardEffectEvent +import cc.fyre.engine.util.FormatUtil +import cc.fyre.engine.util.PotionUtil +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.PotionEffectAddEvent +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType +import java.util.function.Predicate + +/** + * @project hcf + * + * @date 12/09/2020 + * @author xanderume@gmail.com + */ +object BardClass : PvPClass(Type.BARD),Listener { + + val BARD_ILLEGAL_EFFECTS = arrayOf(PotionEffectType.INCREASE_DAMAGE) + private val service = BardService(Bunkers.instance) + + init { + this.effects.add(EnergyEffect.BardEffect(20,Material.SUGAR,PotionEffect(PotionEffectType.SPEED,6*20,1),PotionEffect(PotionEffectType.SPEED,6*20,2))) + this.effects.add(EnergyEffect.BardEffect(45,Material.BLAZE_POWDER,PotionEffect(PotionEffectType.INCREASE_DAMAGE,6*20,0),PotionEffect(PotionEffectType.INCREASE_DAMAGE,5*20,1))) + this.effects.add(EnergyEffect.BardEffect(40,Material.GHAST_TEAR,PotionEffect(PotionEffectType.REGENERATION,6*20,0),PotionEffect(PotionEffectType.REGENERATION,5*20,2))) + this.effects.add(EnergyEffect.BardEffect(40,Material.IRON_INGOT,PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,6*20,0),PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,5*20,2))) + this.effects.add(EnergyEffect.BardEffect(25,Material.FEATHER,PotionEffect(PotionEffectType.JUMP,6*20,1),PotionEffect(PotionEffectType.JUMP,5*20,6))) + this.effects.add(EnergyEffect.BardEffect(25,Material.MAGMA_CREAM,PotionEffect(PotionEffectType.FIRE_RESISTANCE,6*20,0),PotionEffect(PotionEffectType.FIRE_RESISTANCE,46*20,0))) + this.effects.add(EnergyEffect.BardEffect(35,Material.SPIDER_EYE,null,PotionEffect(PotionEffectType.WITHER,5*20,1))) + + this.effects.add(EnergyEffect.BardEffect(25,Material.WHEAT,null,null,Predicate{ + it.foodLevel = 20 + it.saturation = 10.0F + return@Predicate true + })) + + //this.effects.add(EnergyEffect.BardEffect(25,Material.FERMENTED_SPIDER_EYE,PotionEffect(PotionEffectType.INVISIBILITY,6*20,0),PotionEffect(PotionEffectType.INVISIBILITY,46*20,0))) + + this.service.runTaskTimer(Bunkers.instance,4L,4L) + + Bunkers.instance.server.pluginManager.registerEvents(this,Bunkers.instance) + } + + override fun onEnable(player: Player) {} + + override fun onDisable(player: Player) {} + + override fun isEnergyBased(): Boolean { + return true + } + + override fun getConsumableItems(): List { + return ArrayList() + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPotionEffectAdd(event: PotionEffectAddEvent) { + + if (Bunkers.instance.pvpClassHandler.findById(event.entity.uniqueId)?.type != this.type) { + return + } + + if (BARD_ILLEGAL_EFFECTS.none{it == event.effect.type}) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onBardEffect(event: BardEffectEvent) { + + if (event.effect.effect == null) { + return + } + + val name = PotionUtil.getDisplayName(event.effect.effect.type) + val level = FormatUtil.toRoman(event.effect.effect.amplifier + 1) + val debuff = PotionUtil.isDebuff(event.effect.effect.type) + + val total = event.receivers.size + + event.player.sendMessage("${ChatColor.YELLOW}You have given $name $level ${ChatColor.YELLOW}to ${if (debuff) "${ChatColor.RED}${total}${ChatColor.YELLOW} enem${if (total == 1) "y" else "ies"}" else if (total == 0 && !BARD_ILLEGAL_EFFECTS.contains(event.effect.effect.type)) "yourself" else "${ChatColor.GREEN}$total ${ChatColor.YELLOW}teammate${if (total == 1) "" else "s"}"}.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent.kt new file mode 100644 index 0000000..4c9e2ec --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/PvPClassEquipEvent.kt @@ -0,0 +1,35 @@ +package cc.fyre.bunkers.pvpclass.event + +import cc.fyre.bunkers.pvpclass.data.PvPClass +import org.bukkit.entity.Player +import org.bukkit.event.Cancellable +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project hcf + * + * @date 11/09/2020 + * @author xanderume@gmail.com + */ +class PvPClassEquipEvent(val player: Player,val pvpClass: PvPClass) : Event(), Cancellable { + + private var cancelled = false + + override fun isCancelled(): Boolean { + return this.cancelled + } + + override fun setCancelled(cancelled: Boolean) { + this.cancelled = cancelled + } + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent.kt new file mode 100644 index 0000000..5f0b751 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/PvPClassUnEquipEvent.kt @@ -0,0 +1,25 @@ +package cc.fyre.bunkers.pvpclass.event + +import cc.fyre.bunkers.pvpclass.data.PvPClass +import org.bukkit.entity.Player + +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project hcf + * + * @date 11/09/2020 + * @author xanderume@gmail.com + */ +class PvPClassUnEquipEvent(val player: Player,val pvpClass: PvPClass) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent.kt new file mode 100644 index 0000000..af74c51 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/event/type/BardEffectEvent.kt @@ -0,0 +1,25 @@ +package cc.fyre.bunkers.pvpclass.event.type + +import cc.fyre.bunkers.pvpclass.data.item.energy.EnergyEffect +import org.bukkit.entity.Player +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project hcf + * + * @date 11/09/2020 + * @author xanderume@gmail.com + */ +class BardEffectEvent(val player: Player,val receivers: Collection,val effect: EnergyEffect.BardEffect) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/listener/PvPClassListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/listener/PvPClassListener.kt new file mode 100644 index 0000000..b84c74f --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/pvpclass/listener/PvPClassListener.kt @@ -0,0 +1,158 @@ +package cc.fyre.bunkers.pvpclass.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.engine.util.FormatUtil +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action +import org.bukkit.event.entity.PotionEffectExpireEvent +import org.bukkit.event.inventory.EquipmentSetEvent +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project hcf + * + * @date 10/09/2020 + * @author xanderume@gmail.com + */ +class PvPClassListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.HIGHEST) + private fun onPlayerJoin(event: PlayerJoinEvent) { + this.instance.pvpClassHandler.typeToClass.values.stream().filter{it.isEquipped(event.player)}.findFirst().ifPresent{this.instance.pvpClassHandler.setPvPClass(event.player,it.type)} + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.pvpClassHandler.setPvPClass(event.player,null) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEquipmentSet(event: EquipmentSetEvent) { + + if (event.humanEntity !is Player) { + return + } + + val current = this.instance.pvpClassHandler.findById(event.humanEntity.uniqueId) + + // current one is equipped no need to check for other one + if (current != null && current.isEquipped(event.humanEntity as Player)) { + return + } + + val new = this.instance.pvpClassHandler.typeToClass.values.firstOrNull{it.isEquipped(event.humanEntity as Player)} + + if (new != null) { + this.instance.pvpClassHandler.setPvPClass(event.humanEntity as Player,new.type) + return + } + + this.instance.pvpClassHandler.setPvPClass(event.humanEntity as Player,null) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.action == Action.PHYSICAL) { + return + } + + if (event.item == null) { + return + } + + val pvpClass = this.instance.pvpClassHandler.findById(event.player.uniqueId) ?: return + + val consumable = pvpClass.findConsumableByItem(event.item.type) ?: return + + val cooldown = pvpClass.getCooldown(event.player,consumable) + + if (cooldown > 0L) { + event.player.sendMessage("${ChatColor.RED}You cannot use this for another ${ChatColor.BOLD}${FormatUtil.formatIntoFancy(cooldown)}${ChatColor.RED}.") + return + } + + if (!consumable.onConsume(event.player)) { + return + } + + pvpClass.setCooldown(event.player,consumable) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onEnergyInteract(event: PlayerInteractEvent) { + + if (!event.action.name.contains("RIGHT")) { + return + } + + if (event.player.itemInHand == null) { + return + } + + val pvpClass = this.instance.pvpClassHandler.findById(event.player.uniqueId) ?: return + + if (!pvpClass.isEnergyBased()) { + return + } + + val effect = pvpClass.findEffectByItem(event.player.itemInHand.type) ?: return + + val cooldown = this.instance.timerHandler.findRemaining(event.player.uniqueId,TimerType.ENERGY_COOLDOWN) + + if (cooldown > 0L) { + event.player.sendMessage("${ChatColor.RED}You cannot use this for another ${ChatColor.BOLD}${FormatUtil.formatIntoFancy(cooldown)}${ChatColor.RED}.") + return + } + + val energy = this.instance.pvpClassHandler.getEnergy(event.player) + + if (energy < effect.energy) { + event.player.sendMessage("${ChatColor.RED}You do not have enough energy for this! You need ${effect.energy} energy, but you only have ${energy.toInt()}.") + return + } + + if (!effect.onConsume(event.player)) { + return + } + + if (event.player.itemInHand.amount == 1) { + event.player.itemInHand = null + } else { + event.player.itemInHand.amount = event.player.itemInHand.amount - 1 + } + + this.instance.timerHandler.addTimer(event.player.uniqueId,TimerType.ENERGY_COOLDOWN) + this.instance.pvpClassHandler.setEnergy(event.player,energy - effect.energy) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPotionExpire(event: PotionEffectExpireEvent) { + + if (event.entity !is Player) { + return + } + + val previous = this.instance.pvpClassHandler.effects.remove(event.entity.uniqueId,event.effect.type) + + //restore all effects that are missing for example infinite speed 2 + if (previous == null || previous.duration >= 1_000_000) { + + val pvpClass = this.instance.pvpClassHandler.findById(event.entity.uniqueId) ?: return + + this.instance.server.scheduler.runTaskLater(this.instance,{pvpClass.type.effects.filter{!event.entity.hasPotionEffect(it.type)}.forEach{event.entity.addPotionEffect(it)}},1L) + return + } + + event.isCancelled = true + event.entity.addPotionEffect(previous,true) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/RepairHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/RepairHandler.kt new file mode 100644 index 0000000..7a4af69 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/RepairHandler.kt @@ -0,0 +1,26 @@ +package cc.fyre.bunkers.repair + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.repair.listener.RepairListener +import org.bukkit.inventory.ItemStack +import org.spigotmc.SpigotConfig + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class RepairHandler(private val instance: Bunkers) { + + init { + SpigotConfig.reduceArmorDamage = true + + this.instance.server.pluginManager.registerEvents(RepairListener(this.instance),this.instance) + } + + fun calculatePrice(item: ItemStack):Int { + return ((100.0 - (((item.type.maxDurability.toDouble() - item.durability.toDouble()) / item.type.maxDurability.toDouble()) * 100.0)) * 3.0).toInt() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/listener/RepairListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/listener/RepairListener.kt new file mode 100644 index 0000000..cd19342 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/listener/RepairListener.kt @@ -0,0 +1,42 @@ +package cc.fyre.bunkers.repair.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.repair.menu.RepairMenu +import org.bukkit.Material +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action +import org.bukkit.event.player.PlayerInteractEvent + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class RepairListener(private val instance: Bunkers):Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.isCancelled) { + return + } + + if (event.clickedBlock == null) { + return + } + + if (event.action == Action.PHYSICAL || event.action.name.contains("AIR",true)) { + return + } + + if (event.clickedBlock.type != Material.ANVIL) { + return + } + + this.instance.server.scheduler.runTaskLater(this.instance,{RepairMenu().openMenu(event.player)},1L) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/menu/RepairMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/menu/RepairMenu.kt new file mode 100644 index 0000000..4dcc3bc --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/menu/RepairMenu.kt @@ -0,0 +1,43 @@ +package cc.fyre.bunkers.repair.menu + +import cc.fyre.bunkers.repair.menu.element.RepairButton +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class RepairMenu : Menu() { + + override fun size(buttons: Map): Int { + return 6*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.LIGHT_PURPLE}${ChatColor.BOLD}Repair" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + toReturn[11] = RepairButton(player.inventory.helmet) + toReturn[20] = RepairButton(player.inventory.chestplate) + toReturn[29] = RepairButton(player.inventory.leggings) + toReturn[38] = RepairButton(player.inventory.boots) + toReturn[42] = RepairButton(player.inventory.itemInHand) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/menu/element/RepairButton.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/menu/element/RepairButton.kt new file mode 100644 index 0000000..7d240b9 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/repair/menu/element/RepairButton.kt @@ -0,0 +1,80 @@ +package cc.fyre.bunkers.repair.menu.element + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.ItemBuilder +import net.frozenorb.qlib.util.ItemUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class RepairButton(private val itemStack: ItemStack?) : Button() { + + private val name = if (this.itemStack == null || this.itemStack.type == Material.AIR) "Air" else ItemUtils.getName(ItemStack(this.itemStack.type)) + + override fun getName(p0: Player?): String ?{ + return null + } + + override fun getMaterial(p0: Player?): Material? { + return null + } + + override fun getDescription(p0: Player?): MutableList? { + return null + } + + override fun getButtonItem(player: Player?): ItemStack { + + if (this.itemStack == null || this.itemStack.type == Material.AIR || this.itemStack.type.maxDurability == 0.toShort()) { + return ItemBuilder.of(Material.STAINED_GLASS_PANE) + .name(" ") + .data(15) + .build() + } + + if (this.itemStack.durability == 0.toShort()) { + return ItemBuilder.of(Material.STAINED_GLASS_PANE).name(" ").data(13).build() + } + + val price = Bunkers.instance.repairHandler.calculatePrice(this.itemStack) + + return ItemBuilder.copyOf(this.itemStack.clone()).name("${ChatColor.GOLD}${this.name}").addToLore( + "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}", + "${ChatColor.GREEN}Repair ${ChatColor.YELLOW}${this.name}${ChatColor.GREEN} for ${ChatColor.RED}$${price}${ChatColor.GREEN}.", + "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}" + ).build() + } + + override fun clicked(player: Player, slot: Int, clickType: ClickType?) { + + if (this.itemStack == null || this.itemStack.type == Material.AIR) { + return + } + + if (this.itemStack.durability == 0.toShort()) { + return + } + + val price = Bunkers.instance.repairHandler.calculatePrice(this.itemStack) + + if (price > Bunkers.instance.statisticHandler.getBalance(player.uniqueId)) { + player.sendMessage("${ChatColor.RED}You cannot afford to repair this item.") + return + } + + this.itemStack.durability = 0 + + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,-price) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/ShopHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/ShopHandler.kt new file mode 100644 index 0000000..aa75189 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/ShopHandler.kt @@ -0,0 +1,63 @@ +package cc.fyre.bunkers.shop + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.shop.data.ShopType +import cc.fyre.bunkers.shop.listener.ShopListener +import cc.fyre.bunkers.shop.parameter.ShopTypeParameterProvider +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.villager.data.VillagerEntity +import net.frozenorb.qlib.command.FrozenCommandHandler +import org.bukkit.Location +import org.bukkit.Material +import org.bukkit.inventory.Inventory +import org.bukkit.inventory.ItemStack +import org.bukkit.metadata.FixedMetadataValue + +/** + * @project bunkers + * + * @date 18/08/2020 + * @author xanderume@gmail.com + */ +class ShopHandler(private val instance: Bunkers) { + + init { + this.instance.server.pluginManager.registerEvents(ShopListener(this.instance),this.instance) + + FrozenCommandHandler.registerParameterType(ShopType::class.java,ShopTypeParameterProvider()) + } + + fun spawnVillager(location: Location,shop: ShopType,team: Team.Type):VillagerEntity { + + val villager = this.instance.villagerHandler.spawnVillager(location) + + villager.bukkitEntity.setMetadata(TYPE_METADATA,FixedMetadataValue(this.instance,shop.name)) + villager.bukkitEntity.setMetadata(TEAM_METADATA,FixedMetadataValue(this.instance,team.name)) + + villager.customName = "${team.color}${shop.getDisplayName()}" + villager.customNameVisible = true + + return villager + } + + companion object { + + const val TYPE_METADATA = "SHOP_TYPE" + const val TEAM_METADATA = "TEAM_TYPE" + + const val RESPAWN_SECONDS = 300 + + fun isArmor(item: ItemStack):Boolean { + return item.type.name.endsWith("HELMET",true) + || item.type.name.endsWith("CHESTPLATE",true) + || item.type.name.endsWith("LEGGINGS",true) + || item.type.name.endsWith("BOOTS",true) + } + + fun findAvailableSlots(inventory: Inventory):Int { + return inventory.contents.filter{it == null || it.type == Material.AIR}.count() + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/data/ShopType.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/data/ShopType.kt new file mode 100644 index 0000000..9802bf3 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/data/ShopType.kt @@ -0,0 +1,35 @@ +package cc.fyre.bunkers.shop.data + +import cc.fyre.bunkers.shop.menu.BuildMenu +import cc.fyre.bunkers.shop.menu.CombatMenu +import cc.fyre.bunkers.shop.menu.EnchantMenu +import cc.fyre.bunkers.shop.menu.SellMenu +import net.frozenorb.qlib.menu.Menu +import org.apache.commons.lang.StringUtils + +/** + * @project bunkers + * + * @date 18/08/2020 + * @author xanderume@gmail.com + */ +enum class ShopType(val menu: Menu) { + + SELL(SellMenu()), + BUILD(BuildMenu()), + COMBAT(CombatMenu()), + ENCHANT(EnchantMenu()); + + fun getDisplayName():String { + return "${StringUtils.capitalize(this.name.toLowerCase())} Shop" + } + + companion object { + + fun findByName(name: String): ShopType? { + return values().firstOrNull{it.name.equals(name,true)} + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/listener/ShopListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/listener/ShopListener.kt new file mode 100644 index 0000000..64855db --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/listener/ShopListener.kt @@ -0,0 +1,121 @@ +package cc.fyre.bunkers.shop.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.shop.ShopHandler +import cc.fyre.bunkers.shop.data.ShopType +import cc.fyre.bunkers.shop.service.ShopService +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.bunkers.villager.VillagerHandler +import cc.fyre.bunkers.villager.data.kb.ZeroKBProfile +import cc.fyre.engine.GameEngine +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftVillager +import org.bukkit.entity.Player +import org.bukkit.entity.Villager +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.entity.EntityDamageEvent +import org.bukkit.event.entity.EntityDeathEvent +import org.bukkit.event.player.PlayerInteractEntityEvent + +/** + * @project bunkers + * + * @date 18/08/2020 + * @author xanderume@gmail.com + */ +class ShopListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDeath(event: EntityDeathEvent) { + + if (event.entity !is Villager) { + return + } + + if (!event.entity.hasMetadata(ShopHandler.TYPE_METADATA) || !event.entity.hasMetadata(ShopHandler.TEAM_METADATA)) { + return + } + + val shop = ShopType.findByName(event.entity.getMetadata(ShopHandler.TYPE_METADATA)[0].asString()) ?: return + val type = Team.Type.findByName(event.entity.getMetadata(ShopHandler.TEAM_METADATA)[0].asString()) ?: return + + ShopService(event.entity.location.clone(),shop,type).runTaskTimer(this.instance,20L,20L) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityInteract(event: PlayerInteractEntityEvent) { + + if (event.rightClicked !is Villager) { + return + } + + if (!event.rightClicked.hasMetadata(ShopHandler.TYPE_METADATA) || !event.rightClicked.hasMetadata(ShopHandler.TEAM_METADATA)) { + return + } + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + val type = Team.Type.findByName(event.rightClicked.getMetadata(ShopHandler.TEAM_METADATA)[0].asString()) ?: return + + if (team.type != type) { + return + } + + if (this.instance.timerHandler.hasTimer(event.player.uniqueId,TimerType.RESPAWN)) { + return + } + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + this.instance.server.scheduler.runTask(this.instance) { + ShopType.findByName(event.rightClicked.getMetadata(ShopHandler.TYPE_METADATA)[0].asString())?.menu?.openMenu(event.player) + } + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (event.entity !is Villager) { + return + } + + if ((event.entity as Villager).kbProfile != VillagerHandler.KB_PROFILE) { + (event.entity as CraftVillager).kbProfile = VillagerHandler.KB_PROFILE + } + + if (!event.entity.hasMetadata(ShopHandler.TYPE_METADATA) || !event.entity.hasMetadata(ShopHandler.TEAM_METADATA)) { + return + } + + if (event !is EntityDamageByEntityEvent) { + event.isCancelled = true + return + } + + if (event.damager !is Player) { + return + } + + val team = this.instance.teamHandler.findById(event.damager.uniqueId) + + if (team == null) { + event.isCancelled = true + return + } + + val type = Team.Type.findByName(event.entity.getMetadata(ShopHandler.TEAM_METADATA)[0].asString()) ?: return + + if (team.type != type) { + event.damage = event.damage / 1.5F + return + } + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/BuildMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/BuildMenu.kt new file mode 100644 index 0000000..6130c33 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/BuildMenu.kt @@ -0,0 +1,51 @@ +package cc.fyre.bunkers.shop.menu + +import cc.fyre.bunkers.shop.menu.element.BuyElement +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu + +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 05/08/2020 + * @author xanderume@gmail.com + */ +class BuildMenu : Menu() { + + override fun size(buttons: Map): Int { + return 5*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.BLUE}${ChatColor.BOLD}Build" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + toReturn[10] = BuyElement(ItemStack(Material.FENCE_GATE),3,true) + toReturn[11] = BuyElement(ItemStack(Material.LADDER),3,true) + toReturn[12] = BuyElement(ItemStack(Material.CHEST),3,true) + + toReturn[14] = BuyElement(ItemStack(Material.COBBLESTONE),1,true) + toReturn[15] = BuyElement(ItemStack(Material.STONE),1,true) + toReturn[16] = BuyElement(ItemStack(Material.SMOOTH_BRICK),1,true) + + toReturn[30] = BuyElement(ItemStack(Material.DIAMOND_PICKAXE),50,false) + toReturn[31] = BuyElement(ItemStack(Material.DIAMOND_AXE),50,false) + toReturn[32] = BuyElement(ItemStack(Material.DIAMOND_SPADE),50,false) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/ClassMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/ClassMenu.kt new file mode 100644 index 0000000..6b5106d --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/ClassMenu.kt @@ -0,0 +1,52 @@ +package cc.fyre.bunkers.shop.menu + +import cc.fyre.bunkers.shop.menu.element.BuyElement +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import net.frozenorb.qlib.menu.buttons.BackButton +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 26/12/2020 + * @author xanderume@gmail.com + */ +class ClassMenu : Menu() { + + override fun size(buttons: Map): Int { + return 5*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.RED}${ChatColor.BOLD}Class" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + toReturn[10] = BuyElement(ItemStack(Material.SUGAR),10,true) + toReturn[11] = BuyElement(ItemStack(Material.WHEAT),10,true) + + toReturn[15] = BuyElement(ItemStack(Material.BLAZE_POWDER),20,true) + toReturn[16] = BuyElement(ItemStack(Material.GHAST_TEAR),20,true) + + toReturn[19] = BuyElement(ItemStack(Material.FEATHER),10,true) + toReturn[20] = BuyElement(ItemStack(Material.MAGMA_CREAM),10,true) + + toReturn[24] = BuyElement(ItemStack(Material.SPIDER_EYE),20,true) + toReturn[25] = BuyElement(ItemStack(Material.IRON_INGOT),20,true) + + toReturn[31] = BackButton(CombatMenu()) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/CombatMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/CombatMenu.kt new file mode 100644 index 0000000..52d8a93 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/CombatMenu.kt @@ -0,0 +1,84 @@ +package cc.fyre.bunkers.shop.menu + +import cc.fyre.bunkers.game.BunkersGameAdapter +import cc.fyre.bunkers.shop.menu.element.BuyElement + +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu + +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 05/08/2020 + * @author xanderume@gmail.com + */ +class CombatMenu : Menu() { + + override fun size(buttons: Map): Int { + return 6*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.RED}${ChatColor.BOLD}Combat" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + toReturn[9] = BuyElement(ItemStack(Material.DIAMOND_HELMET),75,false) + toReturn[18] = BuyElement(ItemStack(Material.DIAMOND_CHESTPLATE),200,false) + toReturn[27] = BuyElement(ItemStack(Material.DIAMOND_LEGGINGS),150,false) + toReturn[36] = BuyElement(ItemStack(Material.DIAMOND_BOOTS),75,false) + + toReturn[19] = BuyElement(ItemStack(Material.DIAMOND_SWORD),100,false) + toReturn[28] = BuyElement(ItemStack(Material.ENDER_PEARL),25,true) + + toReturn[13] = object : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.RED}${ChatColor.BOLD}Class Shop" + } + + override fun getDescription(p0: Player?): MutableList { + return arrayListOf() + } + + override fun getMaterial(p0: Player?): Material { + return Material.GOLD_INGOT + } + + override fun clicked(player: Player?, slot: Int, clickType: ClickType?) { + ClassMenu().openMenu(player) + } + + } + + toReturn[21] = BuyElement(ItemBuilder.of(Material.POTION).data(8226).build(),"Speed Potion",10,false) + toReturn[22] = BuyElement(BunkersGameAdapter.ANTIDOTE,"Antidote",150,false) + toReturn[23] = BuyElement(BunkersGameAdapter.LESSER_INVISIBILITY,"Lesser Invisibility",300,false) + toReturn[30] = BuyElement(ItemBuilder.of(Material.POTION).data(16421).build(),"Healing Potion",5,true) + toReturn[31] = BuyElement(ItemBuilder.of(Material.POTION).data(16388).build(),"Poison Potion",50,false) + toReturn[32] = BuyElement(ItemBuilder.of(Material.POTION).data(16426).build(),"Slowness Potion",50,false) + toReturn[40] = BuyElement(ItemBuilder.of(Material.POTION).data(16430).build(),"Invisibility Potion",1250,false) + + toReturn[17] = BuyElement(ItemStack(Material.GOLD_HELMET),75,false) + toReturn[26] = BuyElement(ItemStack(Material.GOLD_CHESTPLATE),200,false) + toReturn[35] = BuyElement(ItemStack(Material.GOLD_LEGGINGS),150,false) + toReturn[44] = BuyElement(ItemStack(Material.GOLD_BOOTS),75,false) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } + +} diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/EnchantMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/EnchantMenu.kt new file mode 100644 index 0000000..4456ead --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/EnchantMenu.kt @@ -0,0 +1,48 @@ +package cc.fyre.bunkers.shop.menu + +import cc.fyre.bunkers.shop.menu.element.EnchantElement + +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu + +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.enchantments.Enchantment +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack + +class EnchantMenu : Menu() { + + override fun size(buttons: Map): Int { + return 6*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.BLUE}${ChatColor.BOLD}Enchant" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + toReturn[10] = EnchantElement(ItemStack(Material.DIAMOND_HELMET),Enchantment.PROTECTION_ENVIRONMENTAL,1,300) + toReturn[19] = EnchantElement(ItemStack(Material.DIAMOND_CHESTPLATE),Enchantment.PROTECTION_ENVIRONMENTAL,1,300) + toReturn[28] = EnchantElement(ItemStack(Material.DIAMOND_LEGGINGS),Enchantment.PROTECTION_ENVIRONMENTAL,1,300) + toReturn[37] = EnchantElement(ItemStack(Material.DIAMOND_BOOTS),Enchantment.PROTECTION_ENVIRONMENTAL,1,300) + + toReturn[12] = EnchantElement(ItemStack(Material.DIAMOND_SWORD),Enchantment.DAMAGE_ALL,1,125) + toReturn[13] = EnchantElement(ItemStack(Material.FEATHER),Enchantment.PROTECTION_FALL,4,125) + toReturn[14] = EnchantElement(ItemStack(Material.DIAMOND_PICKAXE),Enchantment.DIG_SPEED,3,500) + + toReturn[16] = EnchantElement(ItemStack(Material.GOLD_HELMET),Enchantment.DURABILITY,3,350) + toReturn[25] = EnchantElement(ItemStack(Material.GOLD_CHESTPLATE),Enchantment.DURABILITY,3,350) + toReturn[34] = EnchantElement(ItemStack(Material.GOLD_LEGGINGS),Enchantment.DURABILITY,3,350) + toReturn[43] = EnchantElement(ItemStack(Material.GOLD_BOOTS),Enchantment.DURABILITY,3,350) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/SellMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/SellMenu.kt new file mode 100644 index 0000000..444e971 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/SellMenu.kt @@ -0,0 +1,46 @@ +package cc.fyre.bunkers.shop.menu + +import cc.fyre.bunkers.shop.menu.element.SellElement + + +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu + +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 04/08/2020 + * @author xanderume@gmail.com + */ +class SellMenu : Menu() { + + override fun size(buttons: Map): Int { + return 9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.GREEN}${ChatColor.BOLD}Sell" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + toReturn[2] = SellElement(Material.EMERALD,40,true) + toReturn[3] = SellElement(Material.DIAMOND,30,true) + toReturn[4] = SellElement(Material.GOLD_INGOT,25,true) + toReturn[5] = SellElement(Material.IRON_INGOT,20,true) + toReturn[6] = SellElement(Material.COAL,10,true) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/BuyElement.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/BuyElement.kt new file mode 100644 index 0000000..427da3e --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/BuyElement.kt @@ -0,0 +1,153 @@ +package cc.fyre.bunkers.shop.menu.element + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.shop.ShopHandler +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.ItemUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 05/08/2020 + * @author xanderume@gmail.com + */ +class BuyElement(private val item: ItemStack,private val price: Int,private val fill: Boolean) : Button() { + + private var name: String? = null + private var displayName: String? = null + + constructor(item: ItemStack,displayName: String,price: Int,fill: Boolean):this(item,price,fill) { + this.name = displayName + this.displayName = displayName + } + + override fun getName(player: Player): String { + + val balance = Bunkers.instance.statisticHandler.getBalance(player.uniqueId) + + if (this.name == null) { + this.name = ItemUtils.getName(ItemStack(this.item.type)) + } + + return "${if (balance < this.price) ChatColor.RED else ChatColor.GREEN}Buy ${this.name}" + } + + override fun getMaterial(p0: Player?): Material? { + return this.item.type + } + + override fun getDamageValue(player: Player?): Byte { + return this.item.data.data + } + + override fun getDescription(player: Player): MutableList { + + val lore = ArrayList() + val balance = Bunkers.instance.statisticHandler.getBalance(player.uniqueId) + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.GREEN}Buy ${ChatColor.YELLOW}1x ${this.name}${ChatColor.GREEN} for ${ChatColor.RED}$${this.price}${ChatColor.GREEN}.") + + if (this.fill) { + + var amount = if (this.item.maxStackSize != 1) this.item.maxStackSize else ShopHandler.findAvailableSlots(player.inventory) + + if (amount * this.price > balance) { + amount = (balance / this.price) + } + + if (amount != 0) { + lore.add("${ChatColor.GREEN}Buy ${ChatColor.YELLOW}${amount}x ${this.name}${ChatColor.GREEN} for ${ChatColor.RED}$${amount * this.price}${ChatColor.GREEN}.") + } + + } + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + //TODO: cleanup armor part + + override fun clicked(player: Player,slot: Int,clickType: ClickType) { + + if (this.name == null) { + this.name = ItemUtils.getName(ItemStack(this.item.type)) + } + + val balance = Bunkers.instance.statisticHandler.getBalance(player.uniqueId) + + if (!this.fill || clickType.isLeftClick) { + + if (balance < this.price) { + player.sendMessage("${ChatColor.RED}You cannot afford this item.") + return + } + + if (ShopHandler.isArmor(this.item)) { + + val part = this.item.type.name.toUpperCase().split("_")[1] + + when { + part == "HELMET" && (player.inventory.helmet == null || player.inventory.helmet.type == Material.AIR) -> player.inventory.helmet = this.item + part == "CHESTPLATE" && (player.inventory.chestplate == null || player.inventory.chestplate.type == Material.AIR) -> player.inventory.chestplate = this.item + part == "LEGGINGS" && (player.inventory.leggings == null || player.inventory.leggings.type == Material.AIR) -> player.inventory.leggings = this.item + part == "BOOTS" && (player.inventory.boots == null || player.inventory.boots.type == Material.AIR) -> player.inventory.boots = this.item + else -> player.inventory.addItem(this.item) + } + + player.updateInventory() + } else { + player.inventory.addItem(this.item) + } + + player.sendMessage("${ChatColor.GREEN}Purchased ${ChatColor.YELLOW}1${ChatColor.GREEN} ${this.name} for ${ChatColor.WHITE}$${this.price}${ChatColor.GREEN}.") + + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,-this.price) + return + } + + if (!clickType.isRightClick) { + return + } + + var amount = if (this.item.maxStackSize != 1) this.item.maxStackSize else ShopHandler.findAvailableSlots(player.inventory) + + if (amount * this.price > balance) { + amount = (balance / this.price) + } + + if (amount == 0) { + return + } + + val item = this.item.clone() + + item.amount = amount + + if (this.item.maxStackSize > 1) { + player.inventory.addItem(item) + } else { + repeat(amount) { + + val new = item.clone() + + new.amount = 1 + + player.inventory.addItem(new) + } + + } + + player.sendMessage("${ChatColor.GREEN}Purchased ${ChatColor.YELLOW}${amount}${ChatColor.GREEN} ${"${this.name}${if (amount > 1) "" else "s"}"} for ${ChatColor.WHITE}$${amount * this.price}${ChatColor.GREEN}.") + + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,-(amount*this.price)) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/EnchantElement.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/EnchantElement.kt new file mode 100644 index 0000000..8c762c5 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/EnchantElement.kt @@ -0,0 +1,109 @@ +package cc.fyre.bunkers.shop.menu.element + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.shop.ShopHandler +import cc.fyre.engine.util.EnchantUtil +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.ItemUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.enchantments.Enchantment +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import org.bukkit.inventory.ItemStack + +class EnchantElement(private val item: ItemStack,private val enchant: Enchantment,private val level: Int,private val price: Int) : Button() { + + private var displayName: String? = null + + constructor(item: ItemStack,enchant: Enchantment,level: Int,price: Int,displayName: String):this(item,enchant,level,price) { + this.displayName = displayName + } + + private val name = this.displayName ?: ItemUtils.getName(this.item) + + override fun getName(player: Player): String { + + val balance = Bunkers.instance.statisticHandler.getBalance(player.uniqueId) + + return "${if (balance < this.price) ChatColor.RED else ChatColor.GREEN}Buy ${EnchantUtil.getName(this.enchant)} ${this.level}" + } + + override fun getMaterial(p0: Player?): Material? { + return this.item.type + } + + override fun getDamageValue(player: Player?): Byte { + return this.item.data.data + } + + override fun getDescription(p0: Player?): MutableList { + + val lore = arrayListOf() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.GREEN}Buy ${ChatColor.YELLOW}${EnchantUtil.getName(this.enchant)} ${this.level} ${ChatColor.GREEN}for ${ChatColor.RED}$${this.price}${ChatColor.GREEN}.") + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun clicked(player: Player,slot: Int,clickType: ClickType) { + + val balance = Bunkers.instance.statisticHandler.getBalance(player.uniqueId) + + if (balance < this.price) { + player.sendMessage("${ChatColor.RED}You cannot afford this enchant.") + return + } + + val item = player.inventory.armorContents.plus(player.inventory.contents).filterNotNull().filter{ + + if (it.type == Material.AIR) { + return@filter false + } + + if (it.containsEnchantment(this.enchant)) { + return@filter false + } + + if (this.enchant == Enchantment.DURABILITY && this.item.type.name.contains("DIAMOND")) { + return@filter false + } + + if (this.enchant == Enchantment.DURABILITY) { + return@filter ShopHandler.isArmor(it) && this.item.type.name.split("_")[1].equals(it.type.name.split("_")[1],true) + } + + if (this.enchant == Enchantment.PROTECTION_FALL) { + return@filter it.type.name.endsWith("BOOTS") + } + + if (this.enchant == Enchantment.PROTECTION_ENVIRONMENTAL) { + return@filter ShopHandler.isArmor(it) && this.item.type.name.split("_")[1].equals(it.type.name.split("_")[1],true) + } + + // for some reason canEnchantItem returns false? + if (this.enchant == Enchantment.ARROW_INFINITE) { + return@filter it.type == Material.BOW + } + + return@filter this.enchant.canEnchantItem(it) + }.firstOrNull{ if (this.item.type == Material.FEATHER && this.enchant == Enchantment.PROTECTION_FALL) it.type.name.endsWith("BOOTS") else if (this.enchant == Enchantment.PROTECTION_ENVIRONMENTAL || this.enchant == Enchantment.DURABILITY) ShopHandler.isArmor(it) else if (this.enchant == Enchantment.ARROW_INFINITE) it.type == Material.BOW else it.type == this.item.type} + + if (item == null) { + player.sendMessage("${ChatColor.RED}You have no item to enchant ${ChatColor.WHITE}${EnchantUtil.getName(this.enchant)}${ChatColor.RED} on.") + return + } + + item.addEnchantment(this.enchant,this.level) + player.updateInventory() + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,-this.price) + + player.sendMessage("${ChatColor.GREEN}Enchanted${ChatColor.YELLOW} ${EnchantUtil.getName(this.enchant)} ${this.level} ${ChatColor.GREEN}on your ${ChatColor.WHITE}${ItemUtils.getName(ItemStack(item.type))} ${ChatColor.GREEN}for ${ChatColor.WHITE}$${this.price}${ChatColor.GREEN}.") + + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/SellElement.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/SellElement.kt new file mode 100644 index 0000000..a33f5c8 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/menu/element/SellElement.kt @@ -0,0 +1,85 @@ +package cc.fyre.bunkers.shop.menu.element + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.ItemUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 05/08/2020 + * @author xanderume@gmail.com + */ +class SellElement(private val item: Material,private val price: Int,private val all: Boolean) : Button() { + + private val name = ItemUtils.getName(ItemStack(this.item)).replace(" Ingot","") + + override fun getName(player: Player): String { + return "${if (player.inventory.contents.any{it != null && it.type == this.item}) ChatColor.RED else ChatColor.GREEN}Sell ${this.name}" + } + + override fun getMaterial(p0: Player?): Material { + return this.item + } + + override fun getDescription(p0: Player?): MutableList { + val lore = ArrayList() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.GREEN}Sell ${ChatColor.YELLOW}1x ${this.name}${ChatColor.GREEN} for ${ChatColor.RED}$${this.price}${ChatColor.GREEN}.") + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun clicked(player: Player, slot: Int, clickType: ClickType) { + + val collections = player.inventory.contents.filter{it != null && it.type == this.item}.toCollection(ArrayList()) + + if (collections.isEmpty()) { + player.sendMessage("${ChatColor.RED}You do not have any ${this.name.toLowerCase()} to sell.") + return + } + + if (!this.all || clickType.isLeftClick) { + val item = player.inventory.contents.firstOrNull{it != null && it.type == this.item} + + if (item == null) { + player.sendMessage("${ChatColor.RED}You do not have any ${this.name.toLowerCase()} to sell.") + return + } + + if (item.amount == 1) { + player.inventory.removeItem(item) + } else { + item.amount = item.amount - 1 + } + + player.updateInventory() + player.sendMessage("${ChatColor.GREEN}Sold ${ChatColor.YELLOW}1 ${ChatColor.GREEN}${this.name} for ${ChatColor.WHITE}$${this.price}${ChatColor.YELLOW}.") + + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,this.price) + return + } + + val amount = collections.filter{it != null && it.type == this.item}.map{it.amount}.sum() + + collections.forEach{player.inventory.removeItem(it)} + + player.updateInventory() + player.sendMessage("${ChatColor.GREEN}Sold ${ChatColor.YELLOW}${amount} ${ChatColor.GREEN}${"${this.name}${if (this.isPlural()) "s" else ""}"} for ${ChatColor.WHITE}$${amount * this.price}${ChatColor.YELLOW}.") + + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,this.price * amount) + } + + private fun isPlural():Boolean { + return this.item != Material.IRON_INGOT && this.item != Material.GOLD_INGOT && this.item != Material.COAL + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/parameter/ShopTypeParameterProvider.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/parameter/ShopTypeParameterProvider.kt new file mode 100644 index 0000000..100931e --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/parameter/ShopTypeParameterProvider.kt @@ -0,0 +1,33 @@ +package cc.fyre.bunkers.shop.parameter + +import cc.fyre.bunkers.shop.data.ShopType +import net.frozenorb.qlib.command.ParameterType +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 04/08/2020 + * @author xanderume@gmail.com + */ +class ShopTypeParameterProvider : ParameterType { + + override fun transform(sender: CommandSender, source: String): ShopType? { + + val toReturn = ShopType.values().firstOrNull{it.name.equals(source,true)} + + if (toReturn == null) { + sender.sendMessage("${ChatColor.RED}Shop type ${ChatColor.YELLOW}$source${ChatColor.RED} not found.") + return null + } + + return toReturn + } + + override fun tabComplete(player: Player, flags: Set, source: String): List { + return emptyList() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/service/ShopService.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/service/ShopService.kt new file mode 100644 index 0000000..bacc36d --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/shop/service/ShopService.kt @@ -0,0 +1,48 @@ +package cc.fyre.bunkers.shop.service + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.shop.ShopHandler +import cc.fyre.bunkers.shop.data.ShopType +import cc.fyre.bunkers.team.data.Team +import net.frozenorb.qlib.hologram.FrozenHologramHandler +import net.frozenorb.qlib.util.TimeUtils +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.scheduler.BukkitRunnable +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project bunkers + * + * @date 18/08/2020 + * @author xanderume@gmail.com + */ +class ShopService(private val location: Location,private val shop: ShopType,private val team: Team.Type):BukkitRunnable() { + + private val hologram = FrozenHologramHandler.createHologram() + .at(this.location.clone().add(0.0,1.6,0.0)) + .build() + + private val remaining = AtomicInteger(ShopHandler.RESPAWN_SECONDS) + + init { + this.hologram.addLines("${this.team.color}${this.shop.getDisplayName()}","${ChatColor.GRAY}Respawns in ${ChatColor.YELLOW}${TimeUtils.formatIntoHHMMSS(this.remaining.get())}") + FrozenHologramHandler.getCache().add(this.hologram) + } + + override fun run() { + + if (this.remaining.get() <= 0) { + this.hologram.destroy() + + FrozenHologramHandler.getCache().remove(this.hologram) + Bunkers.instance.shopHandler.spawnVillager(this.location,this.shop,this.team) + + this.cancel() + return + } + + this.hologram.setLine(1,"${ChatColor.GRAY}Respawns in ${ChatColor.YELLOW}${TimeUtils.formatIntoHHMMSS(this.remaining.decrementAndGet())}") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/StatisticHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/StatisticHandler.kt new file mode 100644 index 0000000..a46ab87 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/StatisticHandler.kt @@ -0,0 +1,155 @@ +package cc.fyre.bunkers.statistic + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.statistic.command.BalanceCommand +import cc.fyre.bunkers.statistic.command.PayCommand +import cc.fyre.bunkers.statistic.listener.StatisticListener +import cc.fyre.bunkers.statistic.service.BalanceService +import cc.fyre.engine.profile.data.type.BunkersProfile +import net.frozenorb.qlib.command.FrozenCommandHandler +import org.bukkit.Material +import java.util.* +import java.util.concurrent.TimeUnit +import kotlin.collections.HashMap + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +class StatisticHandler(private val instance: Bunkers) { + + val kills = HashMap() + val deaths = HashMap() + val balance = HashMap() + val killStreak = HashMap() + + val oresMined = HashMap>() + + val playTime = HashMap() + val playTimeJoined = HashMap() + + val playTimeClass = HashMap>() + val playTimeClassEquipped = HashMap>() + + init { + FrozenCommandHandler.registerClass(PayCommand::class.java) + FrozenCommandHandler.registerClass(BalanceCommand::class.java) + + this.instance.server.pluginManager.registerEvents(StatisticListener(this.instance),this.instance) + + this.instance.server.scheduler.runTaskTimer(this.instance,BalanceService(this.instance),60L,60L) + } + + fun getKills(uuid: UUID):Int { + return this.kills[uuid] ?: 0 + } + + fun addKills(uuid: UUID,amount: Int) { + this.kills.putIfAbsent(uuid,0) + this.kills[uuid] = this.kills[uuid]!! + amount + } + + fun getDeaths(uuid: UUID):Int { + return this.deaths[uuid] ?: 0 + } + + fun addDeaths(uuid: UUID,amount: Int) { + this.deaths.putIfAbsent(uuid,0) + this.deaths[uuid] = this.deaths[uuid]!! + amount + } + + fun getBalance(uuid: UUID):Int { + return this.balance[uuid] ?: STARTER_BALANCE + } + + fun addBalance(uuid: UUID,amount: Int) { + this.balance.putIfAbsent(uuid,STARTER_BALANCE) + this.balance[uuid] = this.balance[uuid]!! + amount + } + + fun getOresMined(uuid: UUID):Int { + + if (!this.oresMined.containsKey(uuid)) { + return 0 + } + + return this.oresMined[uuid]!!.entries.sumBy{it.value} + } + + fun getOresMined(uuid: UUID,ore: BunkersProfile.Ore):Int { + + if (!this.oresMined.containsKey(uuid)) { + return 0 + } + + return this.oresMined[uuid]!![ore] ?: 0 + } + + fun addOresMined(uuid: UUID,material: Material) { + this.oresMined.putIfAbsent(uuid,EnumMap(BunkersProfile.Ore::class.java)) + + val ore = when(material) { + Material.COAL_ORE -> BunkersProfile.Ore.COAL + Material.IRON_ORE -> BunkersProfile.Ore.IRON + Material.GOLD_ORE -> BunkersProfile.Ore.GOLD + Material.DIAMOND_ORE -> BunkersProfile.Ore.DIAMOND + Material.EMERALD_ORE -> BunkersProfile.Ore.EMERALD + else -> null + } ?: return + + this.oresMined[uuid]!![ore] = (this.oresMined[uuid]!![ore] ?: 0) + 1 + } + + fun getPlayTime(uuid: UUID):Long { + return this.playTime[uuid] ?: 0L + } + + fun getPlayTime(uuid: UUID,type: BunkersProfile.PvPClass):Long { + + if (!this.playTimeClass.containsKey(uuid)) { + return 0L + } + + return this.playTimeClass[uuid]!![type] ?: 0L + } + + fun recalculatePlayTime(uuid: UUID) { + + if (!this.playTimeJoined.containsKey(uuid)) { + return + } + + this.playTime[uuid] = (this.playTime[uuid] ?: 0) + (System.currentTimeMillis() - this.playTimeJoined[uuid]!!) + } + + fun recalculatePlayTime(uuid: UUID,pvpClass: BunkersProfile.PvPClass) { + + if (!this.playTimeClassEquipped.containsKey(uuid)) { + return + } + + this.playTimeClass.putIfAbsent(uuid,EnumMap(BunkersProfile.PvPClass::class.java)) + this.playTimeClass[uuid]!![pvpClass] = (this.playTimeClass[uuid]!![pvpClass] ?: 0) + (System.currentTimeMillis() - (this.playTimeClassEquipped[uuid]!![pvpClass] ?: 0L)) + } + + fun getKillStreak(uuid: UUID):Int { + this.killStreak.putIfAbsent(uuid,0) + return this.killStreak[uuid]!! + } + + fun addKillStreak(uuid: UUID,amount: Int) { + this.killStreak.putIfAbsent(uuid,0) + this.killStreak[uuid] = this.killStreak[uuid]!! + amount + } + + companion object { + + const val STARTER_BALANCE = 150 + const val BALANCE_PER_KILL = 200 + + val PAY_TIME = TimeUnit.MINUTES.toMillis(2L) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/command/BalanceCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/command/BalanceCommand.kt new file mode 100644 index 0000000..461af2e --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/command/BalanceCommand.kt @@ -0,0 +1,50 @@ +package cc.fyre.bunkers.statistic.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project bunkers + * + * @date 03/02/2021 + * @author xanderume@gmail.com + */ +object BalanceCommand { + + @JvmStatic + @Command(names = ["balance","bal","money"],permission = "") + fun execute(player: Player,@Param(name = "player",defaultValue = "self")uuid: UUID) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + Bukkit.getServer().scheduler.runTaskAsynchronously(Bunkers.instance) { + + if (!team.isMember(uuid)) { + player.sendMessage("${ChatColor.RED}${UUIDUtils.name(uuid)} is not on your team.") + return@runTaskAsynchronously + } + + val balance = Bunkers.instance.statisticHandler.getBalance(uuid) + + if (player.uniqueId == uuid) { + player.sendMessage("${ChatColor.GREEN}Balance: ${ChatColor.RED}$$balance") + return@runTaskAsynchronously + } + + player.sendMessage("${ChatColor.GREEN}${UUIDUtils.name(uuid)} Balance: ${ChatColor.RED}$$balance") + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/command/PayCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/command/PayCommand.kt new file mode 100644 index 0000000..451f298 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/command/PayCommand.kt @@ -0,0 +1,75 @@ +package cc.fyre.bunkers.statistic.command + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.statistic.StatisticHandler +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.util.FormatUtil +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* +import java.util.concurrent.TimeUnit + +/** + * @project bunkers + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +object PayCommand { + + @JvmStatic + @Command(names = ["pay"],permission = "") + fun execute(player: Player,@Param(name = "player")uuid: UUID,@Param(name = "amount")amount: Int) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + if (amount <= 0) { + player.sendMessage("${ChatColor.RED}Amount must be positive.") + return + } + + if (amount > Bunkers.instance.statisticHandler.getBalance(player.uniqueId)) { + player.sendMessage("${ChatColor.RED}You only have $${Bunkers.instance.statisticHandler.getBalance(player.uniqueId)}.") + return + } + + if (player.uniqueId == uuid) { + player.sendMessage("${ChatColor.RED}You cannot pay yourself!") + return + } + + if (!team.isMember(uuid)) { + player.sendMessage("${ChatColor.RED}${UUIDUtils.name(uuid)} is not on your team.") + return + } + + if (GameEngine.instance.gameHandler.getState() != GameServer.State.IN_PROGRESS) { + player.sendMessage("${ChatColor.RED}Please wait for the game to start.") + return + } + + val time = GameEngine.instance.gameHandler.getGameTime() + + if (time <= StatisticHandler.PAY_TIME) { + player.sendMessage("${ChatColor.RED}You can only pay teammates ${ChatColor.WHITE}${FormatUtil.formatIntoDetailedString(StatisticHandler.PAY_TIME)}${ChatColor.RED} into the game, please wait another ${ChatColor.RED}${ChatColor.BOLD}${FormatUtil.formatIntoDetailedString(TimeUnit.MINUTES.toMillis(2L) - time)}${ChatColor.RED}!") + return + } + + Bunkers.instance.statisticHandler.addBalance(uuid,amount) + Bunkers.instance.statisticHandler.addBalance(player.uniqueId,-amount) + + player.sendMessage("${ChatColor.YELLOW}You have sent ${ChatColor.LIGHT_PURPLE}$${amount}${ChatColor.YELLOW} to ${ChatColor.LIGHT_PURPLE}${UUIDUtils.name(uuid)}${ChatColor.YELLOW}.") + + Bunkers.instance.server.getPlayer(uuid)?.sendMessage("${ChatColor.LIGHT_PURPLE}${player.name}${ChatColor.YELLOW} has sent you $${ChatColor.LIGHT_PURPLE}${amount}${ChatColor.YELLOW}.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/listener/StatisticListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/listener/StatisticListener.kt new file mode 100644 index 0000000..e2d89b0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/listener/StatisticListener.kt @@ -0,0 +1,40 @@ +package cc.fyre.bunkers.statistic.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.engine.GameEngine +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project bunkers + * + * @date 25/12/2020 + * @author xanderume@gmail.com + */ +class StatisticListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + this.instance.statisticHandler.playTimeJoined[event.player.uniqueId] = System.currentTimeMillis() + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + this.instance.statisticHandler.recalculatePlayTime(event.player.uniqueId) + this.instance.statisticHandler.playTimeJoined.remove(event.player.uniqueId) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/service/BalanceService.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/service/BalanceService.kt new file mode 100644 index 0000000..569109d --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/statistic/service/BalanceService.kt @@ -0,0 +1,25 @@ +package cc.fyre.bunkers.statistic.service + +import cc.fyre.bunkers.Bunkers + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer + +/** + * @project bunkers + * + * @date 05/08/2020 + * @author xanderume@gmail.com + */ +class BalanceService(private val instance: Bunkers) : Runnable { + + override fun run() { + + if (GameEngine.instance.gameHandler.getState() != GameServer.State.IN_PROGRESS) { + return + } + + GameEngine.instance.gameHandler.getPlayers().forEach{this.instance.statisticHandler.addBalance(it.uniqueId,3)} + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/SupplyHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/SupplyHandler.kt new file mode 100644 index 0000000..df1a2c4 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/SupplyHandler.kt @@ -0,0 +1,69 @@ +package cc.fyre.bunkers.supply + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.supply.data.Supply + +import cc.fyre.bunkers.supply.listener.SupplyListener +import com.google.common.collect.HashBasedTable +import org.bukkit.Location +import org.bukkit.Material +import org.bukkit.block.Block +import org.bukkit.inventory.ItemStack +import org.bukkit.scheduler.BukkitRunnable +import org.bukkit.scheduler.BukkitTask +import java.util.* +import kotlin.collections.HashSet + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class SupplyHandler(private val instance: Bunkers) { + + val cache = HashBasedTable.create() + + private val supplies = HashSet() + + init { + this.supplies.add(Supply(Material.CROPS,ItemStack(Material.COOKIE),Material.AIR,2500L)) + this.supplies.add(Supply(Material.POTATO,ItemStack(Material.BAKED_POTATO),Material.AIR,2500L)) + this.supplies.add(Supply(Material.CARROT,ItemStack(Material.GOLDEN_CARROT),Material.AIR,2500L)) + + this.supplies.add(Supply(Material.COAL_ORE,ItemStack(Material.COAL),Material.COBBLESTONE,10_000L)) + this.supplies.add(Supply(Material.IRON_ORE,ItemStack(Material.IRON_INGOT),Material.COBBLESTONE,10_000L)) + this.supplies.add(Supply(Material.GOLD_ORE,ItemStack(Material.GOLD_INGOT),Material.COBBLESTONE,20_000L)) + this.supplies.add(Supply(Material.DIAMOND_ORE,ItemStack(Material.DIAMOND),Material.COBBLESTONE,20_000L)) + this.supplies.add(Supply(Material.EMERALD_ORE,ItemStack(Material.EMERALD),Material.COBBLESTONE,30_000L)) + + this.instance.server.pluginManager.registerEvents(SupplyListener(this.instance),this.instance) + } + + fun dispose() { + this.cache.values().forEach{it.cancel()} + } + + fun isBeingSupplied(location: Location):Boolean { + return this.cache.containsRow(location) + } + + fun getSupplyByOrigin(origin: Material):Supply? { + return this.supplies.firstOrNull{it.origin == origin} + } + + fun addSupplyToService(block: Block,entry: Supply) { + + val task = object : BukkitRunnable() { + + override fun run() { + this@SupplyHandler.cache.remove(block.location,entry) + block.type = entry.origin + } + + }.runTaskLater(this.instance,entry.duration / 50) + + this.cache.put(block.location,entry,task) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/data/Supply.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/data/Supply.kt new file mode 100644 index 0000000..d03f1c9 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/data/Supply.kt @@ -0,0 +1,16 @@ +package cc.fyre.bunkers.supply.data + +import org.bukkit.Material +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class Supply(val origin: Material,val reward: ItemStack,val replace: Material,val duration: Long) { + + fun isFarm() = false + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/listener/SupplyListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/listener/SupplyListener.kt new file mode 100644 index 0000000..1b2f4aa --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/supply/listener/SupplyListener.kt @@ -0,0 +1,41 @@ +package cc.fyre.bunkers.supply.listener + +import cc.fyre.bunkers.Bunkers +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent + +/** + * @project bunkers + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class SupplyListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (event.isCancelled) { + return + } + + if (this.instance.supplyHandler.isBeingSupplied(event.block.location)) { + event.isCancelled = true + return + } + + val supply = this.instance.supplyHandler.getSupplyByOrigin(event.block.type) ?: return + + this.instance.statisticHandler.addOresMined(event.player.uniqueId,event.block.type) + + event.block.type = supply.replace + + event.isCancelled = true + event.player.inventory.addItem(supply.reward) + + this.instance.supplyHandler.addSupplyToService(event.block,supply) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/TeamHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/TeamHandler.kt new file mode 100644 index 0000000..aebedff --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/TeamHandler.kt @@ -0,0 +1,158 @@ +package cc.fyre.bunkers.team +/** + * @project bunkers + * + * @date 30/07/2020 + * @author xanderume@gmail.com + */ + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.command.* +import cc.fyre.bunkers.team.command.parameter.TeamParameterProvider +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.team.listener.* +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.map.data.Map +import com.mongodb.client.model.Filters +import com.mongodb.client.model.UpdateOptions +import com.mongodb.client.result.UpdateResult +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.qLib +import net.frozenorb.qlib.util.UUIDUtils +import org.apache.commons.lang.StringUtils +import org.bson.Document +import org.bukkit.ChatColor +import org.bukkit.Location + +import java.util.* +import java.util.concurrent.CompletableFuture +import java.util.concurrent.TimeUnit +import kotlin.collections.HashMap + +//TODO: team loading & saving is kinda ass +class TeamHandler(private val instance: Bunkers) { + + val cache = HashMap() + val collection = GameEngine.instance.api.databaseHandler.mongoDB.getCollection("teams") + + init { + Team.Type.values().forEach{this.cache[it] = Team(it)} + + this.instance.server.pluginManager.registerEvents(TeamListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(TeamChatListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(TeamChestListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(TeamRallyListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(TeamProtectionListener(this.instance),this.instance) + + FrozenCommandHandler.registerClass(TeamHQCommand::class.java) + FrozenCommandHandler.registerClass(TeamInfoCommand::class.java) + FrozenCommandHandler.registerClass(TeamChatCommand::class.java) + FrozenCommandHandler.registerClass(TeamSetHQCommand::class.java) + FrozenCommandHandler.registerClass(TeamSetShopCommand::class.java) + FrozenCommandHandler.registerClass(TeamClaimCommand::class.java) + FrozenCommandHandler.registerClass(TeamFocusCommand::class.java) + FrozenCommandHandler.registerClass(TeamRallyCommand::class.java) + FrozenCommandHandler.registerClass(TeamLocationCommand::class.java) + FrozenCommandHandler.registerClass(TeamVoteKickCommand::class.java) + FrozenCommandHandler.registerClass(TeamSetDTRCommand::class.java) + FrozenCommandHandler.registerClass(TeamSetHologramCommand::class.java) + FrozenCommandHandler.registerParameterType(Team::class.java,TeamParameterProvider()) + } + + fun findById(uuid: UUID):Team? { + return this.cache.values.firstOrNull{it.members.contains(uuid)} + } + + fun findByLocation(location: Location):Team { + return this.cache.values.firstOrNull{it.claim != null && it.claim!!.contains(location)} ?: (this.cache[Team.Type.WAR_ZONE] ?: Team(Team.Type.WAR_ZONE)) + } + + fun findSystemTeams():MutableSet { + return this.cache.values.filter{it.type.isSystem()}.toMutableSet() + } + + fun findPlayerTeams():MutableSet { + return this.cache.values.filter{!it.type.isSystem()}.toMutableSet() + } + + fun loadTeamDataSync(map: Map) { + + val document = this.collection.find(Filters.eq("_id",map.id)).firstOrNull() ?: return + + Team.Type.values().filter{document.containsKey(it.name)}.forEach{ + val team = qLib.GSON.fromJson(Document.parse(document.getString(it.name)).toJson(GameEngineAPI.JSON_WRITER_SETTINGS),Team::class.java) + + val cachedTeam = this.cache[it]!! + + cachedTeam.hq = team.hq + cachedTeam.claim = team.claim + cachedTeam.shops.putAll(team.shops) + cachedTeam.holograms.addAll(team.holograms) + } + + } + + fun saveTeamData(team: Team,map: Map):UpdateResult { + + val document = this.collection.find(Filters.eq("_id",map.id)).firstOrNull() ?: Document("_id",map.id) + + document.append(team.type.name,qLib.GSON.toJson(team)) + + return this.collection.updateOne(Document("_id",map.id),Document("\$set",document), UpdateOptions().upsert(true)) + } + + fun addToTeam(uuid: UUID):Team? { + + val team = Bunkers.instance.teamHandler.findPlayerTeams().filter{!it.isFull()}.maxByOrNull{it.getAvailableSlots()} + + if (team == null) { + + val player = this.instance.server.getPlayer(uuid) + + GameEngine.instance.gameHandler.removePlayer(player) + player.kickPlayer("${ChatColor.RED}We we're unable find you a team!") + return null + } + + this.instance.logger.info("Added ${UUIDUtils.name(uuid)} to ${team.getDisplayName()} team.") + + team.members.add(uuid) + return team + } + + fun addToTeam(players: ArrayList) { + + val team = this.findPlayerTeams().find{it.getAvailableSlots() >= players.size} ?: this.findPlayerTeams().maxByOrNull{it.getAvailableSlots()} + + if (team == null) { + players.forEach{this.addToTeam(it)} + return + } + + players.filter{Bunkers.instance.teamHandler.findById(it) == null}.forEach{ + + if (team.isFull()) { + this.addToTeam(it) + this.instance.logger.info("Team ${team.getDisplayName()} was full, moved ${UUIDUtils.name(it)} to another team.") + } else { + team.members.add(it) + } + + } + + this.instance.logger.info("Added ${StringUtils.join(team.members.map{UUIDUtils.name(it)}.toTypedArray(),", ")} to ${team.getDisplayName()} team.") + } + + companion object { + + const val CHEST_PRICE = 500 + const val PLAYERS_PER_TEAM = 5 + + val RALLY_TIME = TimeUnit.MINUTES.toSeconds(5L).toInt() + val RAIDABLE_TIME = TimeUnit.HOURS.toSeconds(1L).toInt() + val RAIDABLE_BROADCASTS = mutableListOf(TimeUnit.MINUTES.toSeconds(30L).toInt(),TimeUnit.MINUTES.toSeconds(40L).toInt(),TimeUnit.MINUTES.toSeconds(50L).toInt(),TimeUnit.MINUTES.toSeconds(55L).toInt()) + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamChatCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamChatCommand.kt new file mode 100644 index 0000000..5db19ee --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamChatCommand.kt @@ -0,0 +1,65 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +object TeamChatCommand { + + @JvmStatic + @Command(names = ["team chat","t chat","team c","t c"],permission = "") + fun execute(player: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + team.chat[player.uniqueId] = !(team.chat[player.uniqueId] ?: false) + + player.sendMessage("${ChatColor.YELLOW}You are now talking in ${if (team.chat[player.uniqueId]!!) "${ChatColor.BLUE}team" else "${ChatColor.RED}public"}${ChatColor.YELLOW} chat.") + } + + @JvmStatic + @Command(names = ["publicchat","pc"], permission = "") + fun publicChat(player: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + team.chat[player.uniqueId] = false + + player.sendMessage("${ChatColor.YELLOW}You are now talking in ${ChatColor.RED}public${ChatColor.YELLOW} chat.") + } + + @JvmStatic + @Command(names = ["teamchat","tc"], permission = "") + fun teamChat(player: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + team.chat[player.uniqueId] = true + + player.sendMessage("${ChatColor.YELLOW}You are now talking in ${ChatColor.BLUE}team${ChatColor.YELLOW} chat.") + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamClaimCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamClaimCommand.kt new file mode 100644 index 0000000..434e59b --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamClaimCommand.kt @@ -0,0 +1,27 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers + +import cc.fyre.bunkers.team.data.Team +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +object +TeamClaimCommand { + + @JvmStatic + @Command(names = ["team claim","t claim","faction claim","fac claim","f claim"],hidden = true,permission = "bunkers.command.team.claim") + fun execute(player: Player, @Param(name = "team")team: Team, @Param(name = "map")map: Map) { + Bunkers.instance.claimHandler.startSelection(player,team,map,0) + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamFocusCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamFocusCommand.kt new file mode 100644 index 0000000..78f74cb --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamFocusCommand.kt @@ -0,0 +1,57 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.nametag.FrozenNametagHandler +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 20/08/2020 + * @author xanderume@gmail.com + */ +object TeamFocusCommand { + + @JvmStatic + @Command(names = ["team focus","t focus","faction focus","fac focus","f focus","focus"], permission = "") + fun execute(player: Player,@Param(name = "player")target: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + if (team.isMember(target)) { + player.sendMessage("${ChatColor.RED}${target.name} is on your team.") + return + } + + if (team.focus != null && team.focus == target.uniqueId) { + team.focus = null + team.sendMessage("${ChatColor.LIGHT_PURPLE}${player.name}${ChatColor.YELLOW} has un-focused ${ChatColor.LIGHT_PURPLE}${target.name}${ChatColor.YELLOW}.") + team.findOnlineMembers().forEach{FrozenNametagHandler.reloadPlayer(it,target)} + return + } + + val members = team.findOnlineMembers() + + if (team.focus != null) { + + Bunkers.instance.server.getPlayer(team.focus)?.also{ + members.forEach{member -> FrozenNametagHandler.reloadPlayer(it,member)} + } + + } + + team.focus = target.uniqueId + team.sendMessage("${ChatColor.LIGHT_PURPLE}${player.name}${ChatColor.YELLOW} has focused ${ChatColor.LIGHT_PURPLE}${target.name}${ChatColor.YELLOW}.") + + members.forEach{FrozenNametagHandler.reloadPlayer(it,target)} + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamHQCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamHQCommand.kt new file mode 100644 index 0000000..79ddfb9 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamHQCommand.kt @@ -0,0 +1,61 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +object TeamHQCommand { + + @JvmStatic + @Command(names = [ + "faction hq","fac hq","f hq","team hq","t hq","hq","faction home","fac home","f home","team home","t home","home", + "faction stuck","fac stuck","f stuck","team stuck","t stuck","stuck","faction stuck","fac stuck","f stuck","team stuck","t stuck","stuck" + ],permission = "") + fun execute(player: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + if (team.hq == null) { + player.sendMessage("${ChatColor.RED}Your team's HQ has not been setup, please contact an administrator.") + return + } + + if (GameEngine.instance.gameHandler.getState() != GameServer.State.IN_PROGRESS) { + player.sendMessage("${ChatColor.RED}You cannot warp to your team's HQ right now.") + return + } + + if (Bunkers.instance.timerHandler.hasTimer(player.uniqueId,TimerType.HOME)) { + player.sendMessage("${ChatColor.RED}You are already warping to your team's HQ!") + return + } + + if (Bunkers.instance.timerHandler.hasTimer(player.uniqueId,TimerType.RESPAWN)) { + player.sendMessage("${ChatColor.RED}You cannot warp to your team's HQ whilst respawning!") + return + } + + val teamByLocation = Bunkers.instance.teamHandler.findByLocation(player.location) + + val duration = if (teamByLocation.type == team.type || teamByLocation.type == Team.Type.WAR_ZONE || teamByLocation.type == Team.Type.KOTH || team.isRaidable()) 10_000L else 30_000L + + Bunkers.instance.timerHandler.addTimer(player.uniqueId,TimerType.HOME,duration) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamInfoCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamInfoCommand.kt new file mode 100644 index 0000000..1553996 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamInfoCommand.kt @@ -0,0 +1,22 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.team.data.Team +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.command.CommandSender + +/** + * @project bunkers + * + * @date 08/08/2020 + * @author xanderume@gmail.com + */ +object TeamInfoCommand { + + @JvmStatic + @Command(names = ["faction info","fac info","f info","team info","t info","faction who","fac who","f who","team who","t who","faction show","fac show","f show","team show","t show","faction i","fac i","f i","team i","t i"], permission = "") + fun execute(sender: CommandSender,@Param(name = "team",defaultValue = "self")team: Team) { + team.sendInfo(sender) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamLocationCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamLocationCommand.kt new file mode 100644 index 0000000..20b05b0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamLocationCommand.kt @@ -0,0 +1,31 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 20/08/2020 + * @author xanderume@gmail.com + */ +object TeamLocationCommand { + + @JvmStatic + @Command(names = ["tl"], permission = "") + fun execute(player: Player,@Param(name = "player",defaultValue = "self")target: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + team.sendMessage("${ChatColor.DARK_AQUA}(Team) ${target.name}: ${ChatColor.YELLOW}[${target.location.blockX}, ${target.location.blockY}, ${target.location.blockZ}] ${ChatColor.DARK_AQUA}- ${Bunkers.instance.teamHandler.findByLocation(target.location).getDisplayName()}") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamRallyCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamRallyCommand.kt new file mode 100644 index 0000000..1b5749d --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamRallyCommand.kt @@ -0,0 +1,63 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.team.data.Team +import cc.fyre.engine.GameEngine +import cc.fyre.engine.util.FormatUtil +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.scheduler.BukkitRunnable + +/** + * @project bunkers + * + * @date 22/12/2020 + * @author xanderume@gmail.com + */ +object TeamRallyCommand { + + + @JvmStatic + @Command(names = ["faction rally","fac rally","f rally","team rally","t rally","rally"], permission = "") + fun execute(player: Player,@Param(name = "team",defaultValue = "self")team: Team) { + + if (!GameEngine.instance.gameHandler.isPlaying(player)) { + player.sendMessage("${ChatColor.RED}You cannot do this as a spectator!") + return + } + + if (team.rally != null) { + //TODO team.findOnlineMembers().forEach{LunarClientAPI.instance.packetHandler.sendPacket(it,WayPointRemovePacket("Rally",team.rally!!.world))} + } + + if (team.rallyTask != null) { + team.rallyTask!!.cancel() + } + + team.rally = player.location.clone().add(0.5,0.0,0.5) + team.rallyTask = object : BukkitRunnable() { + + override fun run() { + + if (team.rally == null) { + return + } + + //TODO team.findOnlineMembers().forEach{LunarClientAPI.instance.packetHandler.sendPacket(it,WayPointRemovePacket("Rally",team.rally!!.world))} + team.rally = null + team.rallyTask = null + team.sendMessage("${ChatColor.DARK_AQUA}The team rally has expired!") + } + + }.runTaskLater(Bunkers.instance,TeamHandler.RALLY_TIME * 20L) + + //TODO val packet = WayPointAddPacket("Rally",team.rally!!.world,team.rally!!.blockX,team.rally!!.blockY,team.rally!!.blockZ,Color.ORANGE,forced = true,visible = true) + + team.sendMessage("${ChatColor.DARK_AQUA}${player.name} has updated the team's rally point, this will last for ${FormatUtil.formatIntoDetailedString(TeamHandler.RALLY_TIME * 1000L)}!") + //TODO team.findOnlineMembers().forEach{LunarClientAPI.instance.packetHandler.sendPacket(it,packet)} + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetDTRCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetDTRCommand.kt new file mode 100644 index 0000000..36d893a --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetDTRCommand.kt @@ -0,0 +1,29 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.team.data.Team +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import kotlin.math.min + +/** + * @project bunkers + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +object +TeamSetDTRCommand { + + @JvmStatic + @Command(names = ["team setdtr","t setdtr","faction setdtr","fac setdtr","f setdtr","setdtr"],hidden = true,permission = "bunkers.command.team.setdtr") + fun execute(sender: CommandSender, @Param(name = "team")team: Team, @Param(name = "dtr")dtr: Double) { + team.dtr = min(dtr,TeamHandler.PLAYERS_PER_TEAM + 1.0) + + sender.sendMessage("${ChatColor.YELLOW}You have set ${team.getDisplayName()}${ChatColor.YELLOW}'s DTR to: ${ChatColor.LIGHT_PURPLE}${team.getDTR()}") + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetHQCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetHQCommand.kt new file mode 100644 index 0000000..b920fab --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetHQCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.engine.map.data.Map +import org.bukkit.ChatColor + +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +object TeamSetHQCommand { + + @JvmStatic + @Command(names = ["team sethq","t sethq","faction sethq","fac sethq","f sethq"],async = true,permission = "bunkers.command.team.sethq") + fun execute(player: Player,@Param(name = "team")team: Team,@Param(name = "map",defaultValue = "current")map: Map) { + team.hq = player.location + + if (!Bunkers.instance.teamHandler.saveTeamData(team,map).wasAcknowledged()) { + player.sendMessage("${ChatColor.RED}Failed to update team data..") + return + } + + player.sendMessage("${ChatColor.YELLOW}Updated ${team.getDisplayName()}${ChatColor.YELLOW}'s HQ on map ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetHologramCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetHologramCommand.kt new file mode 100644 index 0000000..6a618c0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetHologramCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team + +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +object TeamSetHologramCommand { + + @JvmStatic + @Command(names = ["team sethologram","t sethologram","faction sethologram","fac sethologram","f sethologram"],async = true,permission = "bunkers.command.team.sethologram") + fun execute(player: Player, @Param(name = "team")team: Team, @Param(name = "map",defaultValue = "current")map: Map) { + team.holograms.add(player.location.clone()) + + if (!Bunkers.instance.teamHandler.saveTeamData(team,map).wasAcknowledged()) { + player.sendMessage("${ChatColor.RED}Failed to update team data..") + return + } + + player.sendMessage("${ChatColor.YELLOW}Added Hologram for ${team.getDisplayName()}${ChatColor.YELLOW}'s team on map ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetShopCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetShopCommand.kt new file mode 100644 index 0000000..b111221 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamSetShopCommand.kt @@ -0,0 +1,34 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.shop.data.ShopType +import cc.fyre.bunkers.team.data.Team +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.engine.map.data.Map +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 04/08/2020 + * @author xanderume@gmail.com + */ +object TeamSetShopCommand { + + @JvmStatic + @Command(names = ["team setshop","t setshop","faction setshop","fac setshop","f setshop"],async = true,permission = "bunkers.command.team.setshop") + fun execute(player: Player, @Param(name = "shop")type: ShopType, @Param(name = "team")team: Team, @Param(name = "map",defaultValue = "current")map: Map) { + team.shops[type] = Location(Bunkers.instance.server.getWorld(map.id),player.location.x,player.location.y,player.location.z,player.location.yaw,player.location.pitch) + + if (!Bunkers.instance.teamHandler.saveTeamData(team,map).wasAcknowledged()) { + player.sendMessage("${ChatColor.RED}Failed to update team data..") + return + } + + player.sendMessage("${ChatColor.YELLOW}Updated ${team.getDisplayName()}${ChatColor.YELLOW}'s ${type.name} shop on map ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamVoteKickCommand.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamVoteKickCommand.kt new file mode 100644 index 0000000..5d14a72 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/TeamVoteKickCommand.kt @@ -0,0 +1,103 @@ +package cc.fyre.bunkers.team.command + +import cc.fyre.bunkers.Bunkers +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import mkremins.fanciful.FancyMessage +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import kotlin.collections.ArrayList + +/** + * @project bunkers + * + * @date 24/08/2020 + * @author xanderume@gmail.com + */ +object TeamVoteKickCommand { + + @JvmStatic + @Command(names = ["faction votekick","fac votekick","f votekick","team votekick","t votekick","votekick","faction votekick","fac votekick","f votekick","team votekick","t votekick","votekick"], permission = "") + fun execute(player: Player,@Param(name = "player")target: Player) { + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + if (GameEngine.instance.gameHandler.getState().isBeforeOrCurrently(GameServer.State.COUNTDOWN)) { + player.sendMessage("${ChatColor.RED}You cannot votekick players as the game has not started yet!") + return + } + + if (team.members.size <= 2) { + player.sendMessage("${ChatColor.RED}Members can no longer be vote kicked.") + return + } + + if (!team.isMember(target)) { + player.sendMessage("${ChatColor.WHITE}${target.name} ${ChatColor.RED}is not on your team.") + return + } + + if (GameEngine.instance.spectateHandler.isSpectating(player) || GameEngine.instance.disqualifieHandler.isDisqualified(player.uniqueId)) { + player.sendMessage("${ChatColor.RED}You can no longer vote kick a member.") + return + } + + if (player.uniqueId == target.uniqueId) { + player.sendMessage("${ChatColor.RED}You cannot vote kick yourself.") + return + } + + if (GameEngine.instance.spectateHandler.isSpectating(target) || GameEngine.instance.disqualifieHandler.isDisqualified(target.uniqueId)) { + player.sendMessage("${ChatColor.RED}You can no longer vote kick ${ChatColor.WHITE}${target.name}${ChatColor.RED}.") + return + } + + team.votes.putIfAbsent(target.uniqueId,ArrayList()) + + if (team.votes[target.uniqueId]!!.contains(player.uniqueId)) { + player.sendMessage("${ChatColor.RED}You have already voted to kick ${target.name})}${ChatColor.RED}.") + return + } + + val required = team.findAliveMembers().size - 1 + + team.votes[target.uniqueId]!!.add(player.uniqueId) + + if (team.votes[target.uniqueId]!!.size >= required) { + team.dtr -= 1.0 + team.votes[target.uniqueId]?.clear() + + team.sendMessage("${ChatColor.RED}${target.name} has been voted off the team!",target.uniqueId) + target.sendMessage("${ChatColor.RED}You have been voted off the team.") + + GameEngine.instance.gameHandler.removePlayer(target) + GameEngine.instance.spectateHandler.addSpectator(target) + + Bunkers.instance.statisticHandler.recalculatePlayTime(target.uniqueId) + Bunkers.instance.statisticHandler.playTimeJoined.remove(target.uniqueId) + + Bunkers.instance.server.onlinePlayers.filterNot{team.isMember(it)}.forEach{it.sendMessage("${team.getColor()}${target.name}${ChatColor.RED} has been voted off ${team.getDisplayName()}${ChatColor.RED}'s team!")} + return + } + + team.members.mapNotNull{Bunkers.instance.server.getPlayer(it)}.forEach{ + + val message = FancyMessage("${team.getColor()}[Team] ${ChatColor.RED}${player.name}${ChatColor.YELLOW} has voted to kick ${ChatColor.RED}${target.name}${ChatColor.YELLOW}.") + + if (it.uniqueId != target.uniqueId) { + message.tooltip("${ChatColor.GREEN}Click to vote kick ${player.name}.") + } + + message.send(it) + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/parameter/TeamParameterProvider.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/parameter/TeamParameterProvider.kt new file mode 100644 index 0000000..33681f0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/command/parameter/TeamParameterProvider.kt @@ -0,0 +1,70 @@ +package cc.fyre.bunkers.team.command.parameter + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import net.frozenorb.qlib.command.ParameterType +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import java.lang.Exception +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +class TeamParameterProvider : ParameterType { + + override fun transform(sender: CommandSender,source: String): Team? { + + if (sender is Player && source.equals("self",true)) { + + val team = Bunkers.instance.teamHandler.findById(sender.uniqueId) + + if (team == null) { + sender.sendMessage("${ChatColor.RED}You are not on a team!") + return null + } + + return team + } + + var type: Team.Type? = null + + try { + type = Team.Type.valueOf(source.toUpperCase()) + } catch (ex: Exception) {} + + if (type != null) { + return Bunkers.instance.teamHandler.cache[type]!! + } + + var id: UUID? + + val player = Bunkers.instance.server.getPlayer(source) + + if (player != null) { + id = player.uniqueId + } + + id = UUIDUtils.uuid(source) + + val team: Team? = if (id == null) null else Bunkers.instance.teamHandler.findById(id) + + if (team == null) { + sender.sendMessage("${ChatColor.RED}No team or member with the name $source found.") + return null + } + + return team + } + + override fun tabComplete(player: Player, flags: Set, source: String): List { + return ArrayList() + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/data/Team.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/data/Team.kt new file mode 100644 index 0000000..1454c69 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/data/Team.kt @@ -0,0 +1,237 @@ +package cc.fyre.bunkers.team.data + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.claim.data.Claim +import cc.fyre.bunkers.shop.data.ShopType +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.timer.data.TimerType + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import com.google.gson.annotations.Expose +import mkremins.fanciful.FancyMessage +import net.frozenorb.qlib.util.UUIDUtils +import org.apache.commons.lang.StringUtils +import org.apache.commons.lang.WordUtils +import org.bukkit.ChatColor +import org.bukkit.Color +import org.bukkit.DyeColor +import org.bukkit.Location +import org.bukkit.block.Block +import org.bukkit.block.Chest +import org.bukkit.block.DoubleChest +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import org.bukkit.scheduler.BukkitTask +import java.text.DecimalFormat +import java.util.* +import kotlin.collections.HashMap +import kotlin.collections.HashSet + +/** + * @project bunkers + * + * @date 30/07/2020 + * @author xanderume@gmail.com + */ +class Team(val type: Type) { + + var hq: Location? = null + var claim: Claim? = null + val shops = HashMap() + val holograms = HashSet() + + var focus: UUID? = null + + @Transient var dtr = TeamHandler.PLAYERS_PER_TEAM + 1.0 + @Transient val chat = mutableMapOf() + @Transient var votes = mutableMapOf>() + @Transient val members = hashSetOf() + + @Transient var chests = mutableMapOf() + + @Transient var rally: Location? = null + @Transient var rallyTask: BukkitTask? = null + + fun isFull():Boolean { + return this.members.size >= TeamHandler.PLAYERS_PER_TEAM + } + + fun getAvailableSlots():Int { + return TeamHandler.PLAYERS_PER_TEAM - this.members.size + } + + fun isMember(uuid: UUID):Boolean { + return this.members.contains(uuid) + } + + fun isMember(player: Player):Boolean { + return this.members.contains(player.uniqueId) + } + + fun isRaidable():Boolean { + return this.dtr <= 0.0 + } + + fun getDTR():String { + return DTR_FORMAT.format(this.dtr) + } + + fun isFocused(player: Player):Boolean { + return this.focus != null && this.focus == player.uniqueId + } + + + fun getDTRDisplay():String { + + var color = ChatColor.GREEN + + when { + this.dtr <= 0.0 -> color = ChatColor.GOLD + this.dtr > 1.0 && this.dtr <= 2.0 -> color = ChatColor.YELLOW + this.dtr > 0.0 && this.dtr <= 1.0 -> color = ChatColor.RED + this.dtr <= (TeamHandler.PLAYERS_PER_TEAM + 1.0) / 2 -> color = ChatColor.DARK_RED + } + + return "$color${this.getDTR()}" + } + + fun getColor():ChatColor { + return this.type.color + } + + fun getDisplayName():String { + return this.type.getDisplayName() + } + + fun sendMessage(message: FancyMessage) { + this.members.mapNotNull{Bunkers.instance.server.getPlayer(it)}.forEach{message.send(it)} + } + + fun sendMessage(message: String) { + this.sendMessage(*arrayOf(message)) + } + + fun sendMessage(vararg message: String) { + this.members.mapNotNull{Bunkers.instance.server.getPlayer(it)}.forEach{it.sendMessage(message)} + } + + fun sendMessage(message: String,vararg ignore: UUID) { + this.members.filter{!ignore.contains(it)}.mapNotNull{Bunkers.instance.server.getPlayer(it)}.forEach{it.sendMessage(message)} + } + + fun sendInfo(sender: CommandSender) { + sender.sendMessage(LINE) + + if (this.type.isSystem()) { + sender.sendMessage(this.getDisplayName()) + sender.sendMessage("${ChatColor.YELLOW}Location: ${ChatColor.WHITE}${if (this.hq == null) "None" else "${this.hq!!.blockX}, ${this.hq!!.blockZ}"}") + } else { + sender.sendMessage("${this.getDisplayName()} ${ChatColor.GRAY}[${this.findOnlineMembers().size}/${this.members.size}]${ChatColor.DARK_AQUA} - ${ChatColor.YELLOW}HQ: ${ChatColor.WHITE}${if (this.hq == null) "None" else "${this.hq!!.blockX}, ${this.hq!!.blockZ}"}") + + if (this.members.isNotEmpty()) { + sender.sendMessage("${ChatColor.YELLOW}Members: ${StringUtils.join(this.members.map{"${this.getDisplayName(it)}${ChatColor.YELLOW}[${ChatColor.GREEN}${Bunkers.instance.statisticHandler.getKills(it)}${ChatColor.YELLOW}]"}.toTypedArray(),"${ChatColor.GRAY}, ")}") + } + + sender.sendMessage("${ChatColor.YELLOW}Deaths Until Raidable: ${this.getDTRDisplay()}") + } + + sender.sendMessage(LINE) + } + + fun getDisplayName(uuid: UUID): String { + + val player = Bunkers.instance.server.getPlayer(uuid) + + if (player != null) { + + if (GameEngine.instance.spectateHandler.isSpectating(player)) { + return "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${player.name}" + } + + val respawn = Bunkers.instance.timerHandler.findRemaining(uuid,TimerType.RESPAWN) + + if (respawn > 0L) { + return "${ChatColor.RED}${player.name}" + } + + return "${ChatColor.GREEN}${player.name}" + } + + val name = UUIDUtils.name(uuid) + + if (GameEngine.instance.disqualifieHandler.isDisqualified(uuid)) { + return "${ChatColor.DARK_GRAY}${ChatColor.STRIKETHROUGH}${name}" + } + + return "${ChatColor.GRAY}$name" + } + + fun findChestByBlock(block: Block):TeamChest? { + + val state = block.state + + if (state !is Chest) { + return null + } + + val holder = state.inventory.holder + + return if (holder is DoubleChest) { + this.chests[holder.location] + } else { + this.chests[block.location] + } + } + + fun findAliveMembers():MutableSet { + return this.members.filter{!(GameEngine.instance.spectateHandler.isSpectating(it) || GameEngine.instance.disqualifieHandler.isDisqualified(it))}.toMutableSet() + } + + fun findOnlineMembers():MutableList { + return this.members.mapNotNull{Bunkers.instance.server.getPlayer(it)}.toMutableList() + } + + fun getName(): String { + return WordUtils.capitalizeFully(this.type.name.replace("_"," ")).replace(" ","") + } + + enum class Type(val color: ChatColor) { + + RED(ChatColor.RED), + BLUE(ChatColor.BLUE), + GREEN(ChatColor.GREEN), + YELLOW(ChatColor.YELLOW), + KOTH(ChatColor.AQUA), + WAR_ZONE(ChatColor.DARK_RED); + + fun isSystem():Boolean { + return this == WAR_ZONE || this == KOTH + } + + fun getDisplayName():String { + + if (this == KOTH && (GameEngine.instance.gameHandler.getState().isPastOrCurrently(GameServer.State.COUNTDOWN))) { + return "${this.color}${GameEngine.instance.gameHandler.map.id} ${ChatColor.GOLD}KOTH" + } + + return "${this.color}${WordUtils.capitalizeFully(this.name.replace("_"," ")).replace(" ","")}" + } + + companion object { + + fun findByName(name: String):Type? { + return values().firstOrNull{it.name.equals(name,true)} + } + + } + + } + + companion object { + + val DTR_FORMAT = DecimalFormat("0.0") + + val LINE = "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",53)}" + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/data/TeamChest.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/data/TeamChest.kt new file mode 100644 index 0000000..1a86a00 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/data/TeamChest.kt @@ -0,0 +1,11 @@ +package cc.fyre.bunkers.team.data + +import java.util.* + +data class TeamChest(val owner: UUID,val double: Boolean,val members: MutableSet = mutableSetOf()) { + + fun isMember(uuid: UUID):Boolean { + return uuid == this.owner || this.members.contains(uuid) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamChatListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamChatListener.kt new file mode 100644 index 0000000..ef7327b --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamChatListener.kt @@ -0,0 +1,58 @@ +package cc.fyre.bunkers.team.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.engine.GameEngine +import org.bukkit.ChatColor +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.AsyncPlayerChatEvent + +/** + * @project bunkers + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +class TeamChatListener(private val instance: Bunkers):Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onAsyncChat(event: AsyncPlayerChatEvent) { + + if (event.isCancelled) { + return + } + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + if (GameEngine.instance.spectateHandler.isSpectating(event.player)) { + return + } + + val teamPrefix = event.message[0] == '@' + val globalPrefix = event.message[0] == '!' + + if ((teamPrefix || globalPrefix)) { + + if (event.message.length == 1) { + event.player.sendMessage("${ChatColor.RED}You must supply a message.") + event.isCancelled = true + return + } + + event.message = event.message.substring(1).trim() + } + + if (teamPrefix || (team.chat[event.player.uniqueId] == true && !globalPrefix)) { + event.recipients.clear() + event.recipients.addAll(team.findOnlineMembers()) + + event.format = "${ChatColor.DARK_AQUA}(Team) ${event.player.name}:${ChatColor.YELLOW} ${event.message}" + return + } + + event.format = "${ChatColor.GOLD}[${team.getDisplayName()}${ChatColor.GOLD}]${ChatColor.WHITE}${event.player.name}: ${event.message}" + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamChestListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamChestListener.kt new file mode 100644 index 0000000..4312a56 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamChestListener.kt @@ -0,0 +1,120 @@ +package cc.fyre.bunkers.team.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.team.menu.TeamChestPurchaseMenu +import cc.fyre.bunkers.team.menu.TeamChestModifyMenu +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.block.Chest +import org.bukkit.block.DoubleChest +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.player.PlayerInteractEvent + +class TeamChestListener(private val instance: Bunkers) : Listener { + + private val placed = hashSetOf() + + @EventHandler(priority = EventPriority.MONITOR) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (event.isCancelled) { + return + } + + if (event.block.state !is Chest) { + return + } + + this.placed.add(event.block.location) + + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (event.isCancelled) { + return + } + + if (event.block.state !is Chest) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.block.location) + + if (team.findChestByBlock(event.block) != null) { + event.isCancelled = true + return + } + + if (this.placed.remove(event.block.location)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.HIGHEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.isCancelled) { + return + } + + val state = event.clickedBlock.state + + if (state !is Chest) { + return + } + + if (this.placed.contains(event.clickedBlock.location)) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.clickedBlock.location) + + if (!team.isMember(event.player.uniqueId)) { + return + } + + val chest = team.findChestByBlock(event.clickedBlock) + + if (chest == null) { + + if (state.inventory.holder is DoubleChest) { + TeamChestPurchaseMenu(true,(state.inventory.holder as DoubleChest).location).openMenu(event.player) + } else { + TeamChestPurchaseMenu(false,state.location).openMenu(event.player) + } + + event.isCancelled = true + return + } + + if (!chest.isMember(event.player.uniqueId)) { + event.player.sendMessage("${ChatColor.RED}You cannot access this chest.") + event.isCancelled = true + return + } + + if (event.action != Action.LEFT_CLICK_BLOCK) { + return + } + + if (chest.owner != event.player.uniqueId) { + return + } + + event.isCancelled = true + + TeamChestModifyMenu(chest).openMenu(event.player) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamListener.kt new file mode 100644 index 0000000..ebed5c3 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamListener.kt @@ -0,0 +1,221 @@ +package cc.fyre.bunkers.team.listener + +import net.hylist.HylistSpigot +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.statistic.StatisticHandler +import cc.fyre.engine.GameEngine +import cc.fyre.engine.map.event.MapLoadEvent +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.hologram.FrozenHologramHandler +import net.frozenorb.qlib.hologram.construct.Hologram +import net.hylist.handler.MovementHandler +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.Bukkit + +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.Player +import org.bukkit.entity.Projectile +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.entity.PlayerDeathEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerPearlRefundEvent +import org.bukkit.event.player.PlayerRespawnEvent +import org.bukkit.event.player.PlayerTeleportEvent +import org.bukkit.scheduler.BukkitRunnable + +/** + * @project bunkers + * + * @date 06/08/2020 + * @author xanderume@gmail.com + */ +class TeamListener(private val instance: Bunkers) : Listener,MovementHandler { + + val cache = HashSet() + + init { + HylistSpigot.INSTANCE.addMovementHandler(this) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onMapLoad(event: MapLoadEvent) { + Bukkit.getServer().scheduler.runTaskAsynchronously(this.instance) { + this.instance.teamHandler.loadTeamDataSync(event.map) + this.instance.teamHandler.findPlayerTeams().flatMap{it.holograms}.withIndex().forEach{ + + val hologram = FrozenHologramHandler.createHologram() + .at(it.value.clone().add(0.0,1.5,0.0)) + .build() + + hologram.addLines("${ChatColor.RED}${ChatColor.BOLD}WARNING!","${ChatColor.YELLOW}Blockup this entrance!") + + FrozenHologramHandler.getCache().add(hologram) + + this.cache.add(hologram) + } + } + + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDeath(event: PlayerDeathEvent) { + + val team = this.instance.teamHandler.findById(event.entity.uniqueId) ?: return + + if (event.entity.killer != null) { + + val balance = this.instance.statisticHandler.getBalance(event.entity.uniqueId) + + this.instance.statisticHandler.addKills(event.entity.killer.uniqueId,1) + this.instance.statisticHandler.addBalance(event.entity.killer.uniqueId,if (balance >= StatisticHandler.BALANCE_PER_KILL) StatisticHandler.BALANCE_PER_KILL else balance) + + event.entity.killer.sendMessage("${ChatColor.GOLD}You earned ${ChatColor.WHITE}$${if (balance >= StatisticHandler.BALANCE_PER_KILL) StatisticHandler.BALANCE_PER_KILL else balance}.0${ChatColor.GOLD} for killing ${team.type.color}${event.entity.name}${ChatColor.GOLD}!") + } + + team.dtr -= 1.0 + team.sendMessage( + "${ChatColor.RED}Member Death: ${ChatColor.WHITE}${event.entity.name}", + "${ChatColor.RED}DTR: ${ChatColor.WHITE}${team.getDTR()}" + ) + + if (team.dtr <= 0) { + team.findOnlineMembers().forEach{TeamProtectionListener.protection.remove(it.uniqueId)} + } + + event.entity.world.strikeLightningEffect(event.entity.location) + event.drops.removeIf{it.hasItemMeta() && it.itemMeta.hasLore() && ChatColor.stripColor(it.itemMeta.lore[0]).equals("Soulbound",true)} + + if (team.isRaidable()) { + GameEngine.instance.gameHandler.removePlayer(event.entity) + } + + this.instance.statisticHandler.addDeaths(event.entity.uniqueId,1) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerRespawn(event: PlayerRespawnEvent) { + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + if (!team.isRaidable()) { + return + } + + GameEngine.instance.spectateHandler.addSpectator(event.player) + + this.instance.statisticHandler.recalculatePlayTime(event.player.uniqueId) + this.instance.statisticHandler.playTimeJoined.remove(event.player.uniqueId) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + + if (event.cause != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.to) + + if (team.type.isSystem()) { + return + } + + if (team.isRaidable()) { + return + } + + if (team.isMember(event.player)) { + return + } + + if ((team.hq?.distance(event.to) ?: 8.0) > 7.0 || (team.hq?.distance(event.from) ?: 8.0) <= 7.0) { + return + } + + event.player.sendMessage("${ChatColor.RED}You cannot enderpearl this close to ${team.getDisplayName()}${ChatColor.RED}'s HQ!") + event.isCancelled = true + + this.instance.server.pluginManager.callEvent(PlayerPearlRefundEvent(event.player)) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (GameEngine.instance.gameHandler.getState().isBeforeOrCurrently(GameServer.State.COUNTDOWN)) { + return + } + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + object : BukkitRunnable() { + + override fun run() { + + if (!event.player.isOnline) { + return + } + + team.sendInfo(event.player) + } + + }.runTaskLater(this.instance,20L) + + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (event.entity !is Player) { + return + } + + val team = this.instance.teamHandler.findById(event.entity.uniqueId) + + if (team == null) { + event.isCancelled = true + return + } + + val attacker = if (event.damager is Player) event.damager as Player else if (event.damager is Projectile && (event.damager as Projectile).shooter is Player) (event.damager as Projectile).shooter as Player else null ?: return + + if (attacker.uniqueId == event.entity.uniqueId) { + return + } + + if (!team.isMember(attacker.uniqueId)) { + return + } + + event.isCancelled = true + } + + override fun handleUpdateRotation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) {} + + override fun handleUpdateLocation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) { + + if (from.blockX == to.blockX && from.blockZ == to.blockZ) { + return + } + + if (!GameEngine.instance.gameHandler.isPlaying(player)) { + return + } + + this.cache.removeIf{ + + if (player.world.uid != it.location.world.uid || it.location.distance(player.location) > 5.0) { + return@removeIf false + } + + it.destroy() + FrozenHologramHandler.getCache().remove(it) + return@removeIf true + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamProtectionListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamProtectionListener.kt new file mode 100644 index 0000000..e39877f --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamProtectionListener.kt @@ -0,0 +1,391 @@ +package cc.fyre.bunkers.team.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.Team +import com.google.common.collect.ImmutableSet +import org.bukkit.ChatColor +import org.bukkit.GameMode +import org.bukkit.Location +import org.bukkit.Material +import org.bukkit.entity.ItemFrame +import org.bukkit.entity.Player +import org.bukkit.entity.Projectile +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockIgniteEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.entity.EntityDamageEvent +import org.bukkit.event.entity.PotionSplashEvent +import org.bukkit.event.hanging.HangingBreakByEntityEvent +import org.bukkit.event.hanging.HangingPlaceEvent +import org.bukkit.event.player.* +import java.util.* +import kotlin.collections.HashMap +import kotlin.collections.HashSet + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +class TeamProtectionListener(private val instance: Bunkers) : Listener { + + private val blocks = HashSet() + private val restricted = HashMap() + + @EventHandler(priority = EventPriority.HIGH,ignoreCancelled = true) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.block.location) + + if (team.isRaidable()) { + return + } + + if (team.isMember(event.player)) { + + if ((team.hq?.distance(event.block.location) ?: 10.0) <= 5.0) { + event.player.sendMessage("${ChatColor.RED}You cannot place this close to your team's HQ!") + event.isCancelled = true + return + } + + this.blocks.add(event.block.location) + return + } + + event.isCancelled = true + event.player.sendMessage("${ChatColor.YELLOW}You cannot build in ${team.getDisplayName()}${ChatColor.YELLOW}'s territory!") + } + + @EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + if (this.instance.supplyHandler.getSupplyByOrigin(event.block.type) != null) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.block.location) + + if (team.isRaidable()) { + return + } + + if (team.isMember(event.player.uniqueId)) { + + if (this.blocks.remove(event.block.location)) { + return + } + + event.isCancelled = true + return + } + + event.isCancelled = true + event.player.sendMessage("${ChatColor.YELLOW}You cannot build in ${team.getDisplayName()}${ChatColor.YELLOW}'s territory!") + + if (team.type == Team.Type.WAR_ZONE) { + return + } + + if (!event.block.type.isBlock) { + return + } + + this.restricted[event.player.uniqueId] = System.currentTimeMillis() + 1000L + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + if (event.action == Action.LEFT_CLICK_AIR || event.action == Action.RIGHT_CLICK_AIR) { + return + } + + if (event.action == Action.PHYSICAL) { + event.isCancelled = true + return + } + + if (event.clickedBlock == null) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.clickedBlock.location) + + if (team.isRaidable() || team.isMember(event.player)) { + return + } + + if (NO_INTERACT.none{it == event.clickedBlock.type}) { + return + } + + event.isCancelled = true + event.player.sendMessage("${ChatColor.YELLOW}You cannot do this in ${team.getDisplayName()}${ChatColor.YELLOW}'s territory!") + } + + @EventHandler(priority = EventPriority.HIGH) + private fun onHangingPlace(event: HangingPlaceEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.block.location) + + if (team.isRaidable() || team.isMember(event.player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.HIGH) + private fun onHangingBreakByEntity(event: HangingBreakByEntityEvent) { + + if (event.remover !is Player) { + return + } + + val player = event.remover as Player + + if (player.gameMode == GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.entity.location) + + if (team.isRaidable() || team.isMember(player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true) + private fun onInteractEntity(event: PlayerInteractEntityEvent) { + + if (event.rightClicked !is ItemFrame) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.rightClicked.location) + + if (team.isRaidable() || team.isMember(event.player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.HIGH,ignoreCancelled = true) + private fun onEntityDamageItemFrame(event: EntityDamageByEntityEvent) { + + if (event.entity !is ItemFrame) { + return + } + + if (event.damager !is Player && !(event.damager is Projectile && (event.damager as Projectile).shooter is Player)) { + return + } + + val player = if (event.damager is Player) event.damager as Player else (event.damager as Projectile).shooter as Player + + if (player.gameMode == GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.entity.location) + + if (team.isRaidable() || team.isMember(player)) { + return + } + + event.isCancelled = true + } + + + @EventHandler(priority = EventPriority.HIGHEST) + private fun onBlockIgnite(event: BlockIgniteEvent) { + + if (event.player == null || event.player.gameMode != GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(event.block.location) + + if (team.isRaidable() || team.isMember(event.player)) { + return + } + + if (event.cause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && (team.isMember(event.player))) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onBucketFill(event: PlayerBucketFillEvent) { + + val location = event.blockClicked.getRelative(event.blockFace).location + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(location) + + if (team.isRaidable() || team.isMember(event.player)) { + return + } + + event.isCancelled = true + event.player.sendMessage("${ChatColor.BLUE}You cannot build in ${team.getDisplayName()}${ChatColor.YELLOW}'s territory.") + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onBucketEmpty(event: PlayerBucketEmptyEvent) { + + val location = event.blockClicked.getRelative(event.blockFace).location + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + val team = this.instance.teamHandler.findByLocation(location) + + if (team.isRaidable() || team.isMember(event.player)) { + return + } + + event.isCancelled = true + event.player.sendMessage("${ChatColor.BLUE}You cannot build in ${team.getDisplayName()}${ChatColor.YELLOW}'s territory.") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.restricted.remove(event.player.uniqueId) + } + + @EventHandler(priority = EventPriority.NORMAL,ignoreCancelled = true) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (!this.restricted.containsKey(event.damager.uniqueId)) { + return + } + + if (System.currentTimeMillis() >= this.restricted[event.damager.uniqueId]!!) { + this.restricted.remove(event.damager.uniqueId) + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + if (event.to != team.hq) { + return + } + + protection[event.player.uniqueId] = false + } + + @EventHandler(priority = EventPriority.HIGHEST) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (event.isCancelled) { + return + } + + if (event.entity !is Player) { + return + } + + if (protection.containsKey(event.entity.uniqueId) && event.cause == EntityDamageEvent.DamageCause.POISON) { + event.isCancelled = true + return + } + + if (protection.remove(event.entity.uniqueId) == null) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPotionSplash(event: PotionSplashEvent) { + event.affectedEntities.removeIf{it is Player && protection.containsKey(it.uniqueId)} + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onEntityDamageByEntityProtection(event: EntityDamageByEntityEvent) { + + if (event.isCancelled) { + return + } + + var attacker: Player? = null + + if (event.damager is Player) { + attacker = event.damager as Player + } else if (event.damager is Projectile && (event.damager as Projectile).shooter is Player) { + attacker = (event.damager as Projectile).shooter as Player + } + + if (event.entity !is Player || attacker == null) { + return + } + + if (protection.containsKey(event.entity.uniqueId)) { + event.isCancelled = true + attacker.sendMessage("${ChatColor.RED}${(event.entity as Player).name} is currently PvP Protected!") + return + } + + if (!protection.containsKey(event.damager.uniqueId)) { + return + } + + if (protection[event.damager.uniqueId] == true) { + protection.remove(event.damager.uniqueId) + return + } + + event.isCancelled = true + (event.damager as Player).sendMessage("${ChatColor.RED}Your PvP Protection will be removed upon attacking.") + protection[event.damager.uniqueId] = true + } + + companion object { + + val protection: HashMap = HashMap() + val NO_INTERACT: ImmutableSet = ImmutableSet.of(Material.FENCE_GATE,Material.FURNACE,Material.BURNING_FURNACE,Material.BREWING_STAND,Material.CHEST,Material.HOPPER,Material.DISPENSER,Material.WOODEN_DOOR,Material.STONE_BUTTON,Material.WOOD_BUTTON,Material.TRAPPED_CHEST,Material.TRAP_DOOR,Material.LEVER,Material.DROPPER,Material.ENCHANTMENT_TABLE,Material.BED_BLOCK,Material.ANVIL,Material.BEACON) + val ATTACK_DISABLING_BLOCKS: ImmutableSet = ImmutableSet.of(Material.GLASS, Material.WOOD_DOOR, Material.IRON_DOOR, Material.FENCE_GATE) + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamRallyListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamRallyListener.kt new file mode 100644 index 0000000..d0bb5d2 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/listener/TeamRallyListener.kt @@ -0,0 +1,29 @@ +package cc.fyre.bunkers.team.listener + +import cc.fyre.bunkers.Bunkers +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent + +/** + * @project bunkers + * + * @date 22/12/2020 + * @author xanderume@gmail.com + */ +class TeamRallyListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + val team = this.instance.teamHandler.findById(event.player.uniqueId) ?: return + + if (team.rally == null) { + return + } + + //TODO LunarClientAPI.instance.packetHandler.sendPacket(event.player,WayPointAddPacket("Rally",team.rally!!.world,team.rally!!.blockX,team.rally!!.blockY,team.rally!!.blockZ,Color.ORANGE,forced = true,visible = true)) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/TeamChestModifyMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/TeamChestModifyMenu.kt new file mode 100644 index 0000000..f1c0493 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/TeamChestModifyMenu.kt @@ -0,0 +1,37 @@ +package cc.fyre.bunkers.team.menu + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.data.TeamChest +import cc.fyre.bunkers.team.menu.button.TeamChestMemberButton +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import org.bukkit.entity.Player + +class TeamChestModifyMenu(private val chest: TeamChest) : Menu() { + + override fun size(buttons: MutableMap?): Int { + return 3*9 + } + + override fun getTitle(player: Player): String { + return "${if (this.chest.double) "Large " else ""}Chest" + } + + override fun isPlaceholder(): Boolean { + return true + } + + override fun getButtons(player: Player): MutableMap { + + var index = 12 + val team = Bunkers.instance.teamHandler.findById(player.uniqueId)!! + val toReturn = mutableMapOf() + + for (member in team.members.filter{it != player.uniqueId}) { + toReturn[index++] = TeamChestMemberButton(this.chest,member) + } + + return toReturn + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/TeamChestPurchaseMenu.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/TeamChestPurchaseMenu.kt new file mode 100644 index 0000000..e7a0c37 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/TeamChestPurchaseMenu.kt @@ -0,0 +1,33 @@ +package cc.fyre.bunkers.team.menu + +import cc.fyre.bunkers.team.menu.button.TeamChestPurchaseButton +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import org.bukkit.Location +import org.bukkit.entity.Player + +class TeamChestPurchaseMenu(private val double: Boolean, private val location: Location) : Menu() { + + override fun size(buttons: MutableMap?): Int { + return 3*9 + } + + override fun getTitle(player: Player): String { + return "Buy Chest" + } + + override fun isPlaceholder(): Boolean { + return true + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = mutableMapOf() + + toReturn[11] = TeamChestPurchaseButton(this.double,this.location,true) + toReturn[15] = TeamChestPurchaseButton(this.double,this.location,false) + + return toReturn + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/button/TeamChestMemberButton.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/button/TeamChestMemberButton.kt new file mode 100644 index 0000000..08bdfc0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/button/TeamChestMemberButton.kt @@ -0,0 +1,47 @@ +package cc.fyre.bunkers.team.menu.button + +import cc.fyre.bunkers.team.data.TeamChest +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import java.util.* + +class TeamChestMemberButton(private val chest: TeamChest,private val member: UUID) : Button() { + + private val disqualified = GameEngine.instance.disqualifieHandler.isDisqualified(this.member) + + override fun getName(p0: Player?): String { + + val color = if (this.disqualified) ChatColor.GRAY else if (this.chest.isMember(this.member)) ChatColor.GREEN else ChatColor.RED + + return "$color${ChatColor.BOLD}${if (this.disqualified) ChatColor.STRIKETHROUGH else ""}${UUIDUtils.name(this.member)}" + } + + + override fun getDescription(p0: Player?): MutableList { + return mutableListOf() + } + + override fun getMaterial(p0: Player?): Material { + return Material.SKULL_ITEM + } + + override fun clicked(player: Player?, slot: Int, clickType: ClickType?) { + + if (this.disqualified) { + return + } + + if (this.chest.isMember(this.member)) { + this.chest.members.remove(this.member) + } else { + this.chest.members.add(this.member) + } + + + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/button/TeamChestPurchaseButton.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/button/TeamChestPurchaseButton.kt new file mode 100644 index 0000000..e5a5ecd --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/team/menu/button/TeamChestPurchaseButton.kt @@ -0,0 +1,70 @@ +package cc.fyre.bunkers.team.menu.button + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.team.TeamHandler +import cc.fyre.bunkers.team.data.TeamChest +import cc.fyre.bunkers.team.menu.TeamChestModifyMenu +import net.frozenorb.qlib.menu.Button +import org.bukkit.ChatColor +import org.bukkit.DyeColor +import org.bukkit.Location +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType + +class TeamChestPurchaseButton(private val double: Boolean, private val location: Location, private val value: Boolean) : Button() { + + override fun getName(p0: Player?): String { + + if (this.value) { + return "${ChatColor.GREEN}${ChatColor.BOLD}Purchase Chest" + } + + return "${ChatColor.RED}${ChatColor.BOLD}Cancel Purchase" + } + + override fun getMaterial(p0: Player?): Material { + return Material.WOOL + } + + override fun getDescription(p0: Player?): MutableList { + return mutableListOf() + } + + override fun getDamageValue(player: Player?): Byte { + return if (this.value) DyeColor.LIME.woolData else DyeColor.RED.woolData + } + + override fun clicked(player: Player, slot: Int, clickType: ClickType?) { + + if (!this.value) { + player.sendMessage("${ChatColor.RED}Purchase cancelled.") + return + } + + val team = Bunkers.instance.teamHandler.findById(player.uniqueId) + + if (team == null) { + player.sendMessage("${ChatColor.RED}You are not on a team!") + return + } + + + val balance = Bunkers.instance.statisticHandler.getBalance(player.uniqueId) + + if (balance <= TeamHandler.CHEST_PRICE) { + player.closeInventory() + player.sendMessage("${ChatColor.RED}You need ${ChatColor.BOLD}$${TeamHandler.CHEST_PRICE}${ChatColor.RED} to purchase this chest.") + return + } + + val chest = TeamChest(player.uniqueId,this.double) + + team.chests[this.location] = chest + + player.sendMessage("${ChatColor.GREEN}You have purchased this chest for ${ChatColor.BOLD}${TeamHandler.CHEST_PRICE}${ChatColor.GREEN}!") + + TeamChestModifyMenu(chest).openMenu(player) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/TimerHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/TimerHandler.kt new file mode 100644 index 0000000..dbb7224 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/TimerHandler.kt @@ -0,0 +1,117 @@ +package cc.fyre.bunkers.timer + +import net.hylist.HylistSpigot +import cc.fyre.bunkers.Bunkers + +import cc.fyre.bunkers.timer.data.Timer +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.bunkers.timer.event.TimerCreateEvent +import cc.fyre.bunkers.timer.event.TimerExtendEvent +import cc.fyre.bunkers.timer.event.TimerRemoveEvent +import cc.fyre.bunkers.timer.listener.* + +import java.util.* +import java.util.concurrent.ConcurrentHashMap +import kotlin.collections.HashSet + +/** + * @project hcf + * + * @date 06/07/2020 + * @author xanderume@gmail.com + */ +class TimerHandler(private val instance: Bunkers) { + + val cache = ConcurrentHashMap>() + + init { + HylistSpigot.INSTANCE.addMovementHandler(HomeListener(this.instance)) + HylistSpigot.INSTANCE.addMovementHandler(RespawnListener(this.instance)) + + this.instance.server.pluginManager.registerEvents(HomeListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(TimerListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(RespawnListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(AntidoteListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(EnderpearlListener(this.instance),this.instance) + } + + fun findTimers(uuid: UUID):HashSet { + return this.cache[uuid] ?: HashSet() + } + + fun addTimer(uuid: UUID,type: TimerType) { + this.addTimer(uuid,type,type.duration) + } + + fun addTimer(uuid: UUID,type: TimerType,duration: Long) { + + this.cache.putIfAbsent(uuid,HashSet()) + + var timer = this.cache[uuid]!!.firstOrNull{it.type == type} + + if (timer != null) { + timer.setRemaining(duration) + this.instance.server.pluginManager.callEvent(TimerExtendEvent(timer,uuid,duration)) + return + } + + timer = Timer(type,duration,uuid) + + val event = TimerCreateEvent(timer,uuid,duration) + + this.instance.server.pluginManager.callEvent(event) + + if (event.isCancelled) { + return + } + + this.cache[uuid]!!.add(timer) + } + + fun removeTimer(uuid: UUID,type: TimerType):Boolean { + + if (!this.cache.containsKey(uuid)) { + return false + } + + val timer = this.cache[uuid]!!.firstOrNull{it.type == type} ?: return false + + timer.task?.cancel() + + this.instance.server.pluginManager.callEvent(TimerRemoveEvent(timer,uuid)) + + return this.cache[uuid]!!.remove(timer) + } + + fun hasTimer(uuid: UUID,type: TimerType):Boolean { + + if (!this.cache.containsKey(uuid)) { + return false + } + + return this.cache[uuid]!!.any{it.type == type && it.getRemaining() > 0} + } + + fun setPaused(uuid: UUID,type: TimerType,value: Boolean):Boolean { + + if (!this.cache.containsKey(uuid)) { + return false + } + + val timer = this.cache[uuid]!!.firstOrNull{it.type == type} ?: return false + + timer.setPaused(value) + return true + } + + fun findRemaining(uuid: UUID,type: TimerType):Long { + + if (!this.cache.containsKey(uuid)) { + return 0L + } + + return this.cache[uuid]!!.firstOrNull{it.type == type}?.getRemaining() ?: 0L + } + + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/data/Timer.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/data/Timer.kt new file mode 100644 index 0000000..2b92082 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/data/Timer.kt @@ -0,0 +1,107 @@ +package cc.fyre.bunkers.timer.data + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.event.TimerExpireEvent +import org.bukkit.scheduler.BukkitRunnable +import org.bukkit.scheduler.BukkitTask +import java.util.* + +/** + * @project hcf + * + * @date 06/07/2020 + * @author xanderume@gmail.com + */ +open class Timer(val type: TimerType,private val duration: Long,var owner: UUID?) { + + constructor(type: TimerType,owner: UUID?):this(type,type.duration,owner) + + var task: BukkitTask? = null + + private var paused = 0L + private var started = System.currentTimeMillis() + private var expires = System.currentTimeMillis() + this.duration + + init { + + if (this.owner != null) { + this.task = this.createTask(this.duration) + } + + } + + fun getDuration(): Long { + return this.duration + } + + fun isPaused():Boolean { + return this.paused != 0L + } + + fun setPaused(value: Boolean) { + + if (value == this.isPaused()) { + return + } + + if (value) { + + if (this.task != null) { + this.task!!.cancel() + } + + this.paused = this.getRemaining() + return + } + + this.setRemaining(this.paused) + this.paused = 0L + } + + fun getRemaining():Long { + + if (this.paused != 0L) { + return this.paused + } + + return this.expires - System.currentTimeMillis() + } + + fun setRemaining(duration: Long) { + + if (duration <= 0L) { + return + } + + this.expires = System.currentTimeMillis() + duration + + if (this.owner == null) { + return + } + + if (this.task != null) { + this.task!!.cancel() + } + + this.task = this.createTask(duration) + } + + private fun createTask(duration: Long): BukkitTask { + return object : BukkitRunnable() { + + override fun run() { + + if (this@Timer.owner == null) { + return + } + + if (Bunkers.instance.timerHandler.cache.containsKey(this@Timer.owner!!)) { + Bunkers.instance.timerHandler.cache[this@Timer.owner!!]!!.remove(this@Timer) + } + + Bunkers.instance.server.pluginManager.callEvent(TimerExpireEvent(this@Timer,this@Timer.owner!!)) + } + + }.runTaskLater(Bunkers.instance,duration / 50L) + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/data/TimerType.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/data/TimerType.kt new file mode 100644 index 0000000..3f691fd --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/data/TimerType.kt @@ -0,0 +1,29 @@ +package cc.fyre.bunkers.timer.data + +import org.bukkit.ChatColor +import org.bukkit.Material +import java.util.concurrent.TimeUnit + +/** + * @project hcf + * + * @date 06/07/2020 + * @author xanderume@gmail.com + */ +enum class TimerType(val duration: Long,val scoreboard: String,val displays: Boolean,val icon: Material?) { + + HOME(TimeUnit.SECONDS.toMillis(10L),"${ChatColor.BLUE}${ChatColor.BOLD}HQ",true,Material.WOOD_DOOR), + RESPAWN(TimeUnit.SECONDS.toMillis(15L),"${ChatColor.GOLD}${ChatColor.BOLD}Respawn",true,Material.LEASH), + ANTIDOTE(TimeUnit.SECONDS.toMillis(5L),"${ChatColor.RED}${ChatColor.BOLD}Antidote",true,Material.SPIDER_EYE), + ENDER_PEARL(TimeUnit.SECONDS.toMillis(16L),"${ChatColor.YELLOW}${ChatColor.BOLD}Enderpearl",true,Material.ENDER_PEARL), + ENERGY_COOLDOWN(TimeUnit.SECONDS.toMillis(10L),"${ChatColor.GREEN}${ChatColor.BOLD}Energy Effect",false,Material.GOLD_HELMET); + + companion object { + + fun findByName(name: String): TimerType? { + return values().firstOrNull{it.name.equals(name,true) || it.name.replace("_", "").equals(name,true) || ChatColor.stripColor(it.scoreboard.replace(" ", "")).equals(name,true)} + } + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerCreateEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerCreateEvent.kt new file mode 100644 index 0000000..5962eb4 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerCreateEvent.kt @@ -0,0 +1,41 @@ +package cc.fyre.bunkers.timer.event + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.Timer +import org.bukkit.event.Cancellable +import org.bukkit.event.Event +import org.bukkit.event.HandlerList +import java.util.* + +/** + * @project hcf + * + * @date 06/07/2020 + * @author xanderume@gmail.com + */ +class TimerCreateEvent(val timer: Timer,val uuid: UUID,val duration: Long) : Event(),Cancellable { + + private var cancelled = false + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + + override fun isCancelled(): Boolean { + return this.cancelled + } + + override fun setCancelled(cancelled: Boolean) { + this.cancelled = cancelled + } + + fun call(): TimerCreateEvent { + Bunkers.instance.server.pluginManager.callEvent(this) + return this + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerExpireEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerExpireEvent.kt new file mode 100644 index 0000000..ccc47aa --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerExpireEvent.kt @@ -0,0 +1,30 @@ +package cc.fyre.bunkers.timer.event + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.Timer +import org.bukkit.event.Event +import org.bukkit.event.HandlerList +import java.util.* + +/** + * @project hcf + * + * @date 06/07/2020 + * @author xanderume@gmail.com + */ +class TimerExpireEvent(val timer: Timer, val uuid: UUID) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + + fun call(): TimerExpireEvent { + Bunkers.instance.server.pluginManager.callEvent(this) + return this + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerExtendEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerExtendEvent.kt new file mode 100644 index 0000000..bb446b7 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerExtendEvent.kt @@ -0,0 +1,26 @@ +package cc.fyre.bunkers.timer.event + +import cc.fyre.bunkers.timer.data.Timer +import org.bukkit.event.Event +import org.bukkit.event.HandlerList +import java.util.* + +/** + * @project hcf + * + * @date 01/11/2020 + * @author xanderume@gmail.com + */ +class TimerExtendEvent(val timer: Timer,val uuid: UUID,val newDuration: Long) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + + @JvmStatic val handlerList = HandlerList() + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerRemoveEvent.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerRemoveEvent.kt new file mode 100644 index 0000000..0dc9f7b --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/event/TimerRemoveEvent.kt @@ -0,0 +1,30 @@ +package cc.fyre.bunkers.timer.event + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.Timer +import org.bukkit.event.Event +import org.bukkit.event.HandlerList +import java.util.* + +/** + * @project hcf + * + * @date 19/07/2020 + * @author xanderume@gmail.com + */ +class TimerRemoveEvent(val timer: Timer, val uuid: UUID) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + + fun call(): TimerRemoveEvent { + Bunkers.instance.server.pluginManager.callEvent(this) + return this + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/AntidoteListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/AntidoteListener.kt new file mode 100644 index 0000000..435fc7a --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/AntidoteListener.kt @@ -0,0 +1,115 @@ +package cc.fyre.bunkers.timer.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.game.BunkersGameAdapter +import cc.fyre.bunkers.pvpclass.data.item.energy.EnergyEffect +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.bunkers.timer.event.TimerCreateEvent +import cc.fyre.engine.util.FormatUtil +import net.frozenorb.qlib.util.TimeUtils +import net.md_5.bungee.api.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.PotionEffectAddEvent +import org.bukkit.event.player.PlayerItemConsumeEvent +import org.bukkit.scheduler.BukkitRunnable + +/** + * @project bunkers + * + * @date 03/02/2021 + * @author xanderume@gmail.com + */ +class AntidoteListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerCreate(event: TimerCreateEvent) { + + if (event.timer.type != TimerType.ANTIDOTE) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + player.sendMessage("${ChatColor.RED}You are now immune to debuffs for ${TimeUtils.formatIntoDetailedString((event.timer.getDuration() / 1000L).toInt())}.") + + object : BukkitRunnable() { + + override fun run() { + + for (effect in player.activePotionEffects) { + + if (EnergyEffect.BardEffect.isDebuff(effect.type)) { + player.removePotionEffect(effect.type) + } + + } + + } + + }.runTaskLater(this.instance,2L) + + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPreConsume(event: PlayerItemConsumeEvent) { + + if (event.item.type != Material.POTION) { + return + } + + if (!BunkersGameAdapter.ANTIDOTE.isSimilar(event.item)) { + return + } + + val cooldown = this.instance.timerHandler.findRemaining(event.player.uniqueId,TimerType.ANTIDOTE) + + if (cooldown <= 0L) { + return + } + + event.isCancelled = true + event.player.sendMessage("${ChatColor.RED}You cannot use this for another ${ChatColor.BOLD}${FormatUtil.formatIntoFancy(cooldown)}${ChatColor.RED}.") + event.player.updateInventory() + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onItemConsume(event: PlayerItemConsumeEvent) { + + if (event.isCancelled) { + return + } + + if (event.item.type != Material.POTION) { + return + } + + if (!BunkersGameAdapter.ANTIDOTE.isSimilar(event.item)) { + return + } + + this.instance.timerHandler.addTimer(event.player.uniqueId,TimerType.ANTIDOTE) + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPotionEffectAdd(event: PotionEffectAddEvent) { + + if (event.entity !is Player) { + return + } + + if (!this.instance.timerHandler.hasTimer(event.entity.uniqueId,TimerType.ANTIDOTE)) { + return + } + + if (!EnergyEffect.BardEffect.isDebuff(event.effect.type)) { + return + } + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/EnderpearlListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/EnderpearlListener.kt new file mode 100644 index 0000000..22bcb87 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/EnderpearlListener.kt @@ -0,0 +1,146 @@ +package cc.fyre.bunkers.timer.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.engine.util.FormatUtil +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.EnderPearl +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.ProjectileLaunchEvent +import org.bukkit.event.player.PlayerPearlRefundEvent +import org.bukkit.inventory.ItemStack + +/** + * @project hcf + * + * @date 20/07/2020 + * @author xanderume@gmail.com + */ +class EnderpearlListener(private val instance: Bunkers):Listener { + + @EventHandler(priority = EventPriority.MONITOR,ignoreCancelled = true) + private fun onProjectileLaunched(event: ProjectileLaunchEvent) { + + if (event.entity !is EnderPearl || event.entity.shooter !is Player) { + return + } + + this.instance.timerHandler.addTimer((event.entity.shooter as Player).uniqueId,TimerType.ENDER_PEARL) + } + + @EventHandler(priority = EventPriority.HIGH,ignoreCancelled = true) + private fun onProjectileLaunch(event: ProjectileLaunchEvent) { + + if (event.entity !is EnderPearl || event.entity.shooter !is Player) { + return + } + + val cooldown = this.instance.timerHandler.findRemaining((event.entity.shooter as Player).uniqueId,TimerType.ENDER_PEARL) + + if (cooldown <= 0) { + return + } + + event.isCancelled = true + + (event.entity.shooter as Player).sendMessage("${ChatColor.RED}You cannot use this for another ${ChatColor.BOLD}${FormatUtil.formatIntoFancy(cooldown)}${ChatColor.RED}.") + (event.entity.shooter as Player).updateInventory() + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPearlRefund(event: PlayerPearlRefundEvent) { + event.player.inventory.addItem(ItemStack(Material.ENDER_PEARL)) + this.instance.timerHandler.removeTimer(event.player.uniqueId,TimerType.ENDER_PEARL) + } + +// @EventHandler(priority = EventPriority.LOW) +// private fun onPlayerTeleport(event: PlayerTeleportEvent) { +// +// if (event.isCancelled || event.cause != PlayerTeleportEvent.TeleportCause.ENDER_PEARL || event.to.world.environment != World.Environment.NORMAL) { +// return +// } +// +// val face = this.getDirection(event.player) +// val block = this.getDirectionalBlock(event.to.block,face) +// +// if ((block == null || block.type != Material.FENCE_GATE || block.getRelative(BlockFace.UP).type != Material.TRAP_DOOR) && event.to.block.type != Material.FENCE_GATE && EntityEnderPearl.pearlAbleType.stream().noneMatch { it: String? -> event.to.block.type.name.contains(it!!) } && !event.to.block.getRelative(BlockFace.UP).type.name.contains("STEP") || event.to.block.type == null || block == null && EntityEnderPearl.pearlAbleType.none{event.to.block.type.name.contains(it)}) { +// return +// } +// +// if (this.isPearlGlitching(block) && event.to.block.type != Material.AIR) { +// event.isCancelled = true +// this.instance.server.pluginManager.callEvent(PlayerPearlRefundEvent(event.player)) +// return +// } +// +// event.to = this.findSuitableLocation(event.to,face) +// } + +// private fun getDirectionalBlock(block: Block,face: BlockFace): Block? { +// +// val relative = block.getRelative(face) +// +// if (relative == null || relative.type == Material.AIR) { +// return null +// } +// +// return relative +// } + +// private fun isPearlGlitching(block: Block?): Boolean { +// return block != null && block.type != Material.AIR && block.type.isSolid && !RETURN_TYPES.contains(block.type) || block is Openable && !(block as Openable).isOpen +// } + +// private fun findSuitableLocation(location: Location,face: BlockFace): Location { +// +// val toReturn = location.clone() +// +// if (face.ordinal <= 3) { +// toReturn.x += face.modX +// toReturn.y += face.modY +// toReturn.z += face.modZ +// } +// +// if (toReturn.block.getRelative(BlockFace.DOWN) == null || !toReturn.block.getRelative(BlockFace.DOWN).type.isSolid) { +// toReturn.y += BlockFace.DOWN.modY +// } +// +// return toReturn +// } + +// private fun getDirection(player: Player): BlockFace { +// +// var toReturn = player.location.yaw +// +// if (toReturn < 0) { +// toReturn += 360.0F +// } +// +// if (toReturn >= 315 || toReturn < 45) { +// return BlockFace.SOUTH +// } else if (toReturn < 135) { +// return BlockFace.WEST +// } else if (toReturn < 225) { +// return BlockFace.NORTH +// } else if (toReturn < 315) { +// return BlockFace.EAST +// } +// +// return BlockFace.NORTH +// } + + companion object { + + val RETURN_TYPES = arrayListOf( + Material.LADDER,Material.BRICK_STAIRS,Material.SMOOTH_STAIRS,Material.WOOD_STAIRS,Material.SPRUCE_WOOD_STAIRS,Material.TORCH,Material.NETHER_BRICK_STAIRS, + Material.QUARTZ_STAIRS,Material.BEDROCK,Material.CAKE,Material.STEP,Material.WOOD_STEP,Material.LEVER,Material.DAYLIGHT_DETECTOR,Material.COBBLE_WALL, + Material.FENCE_GATE,Material.SIGN,Material.SIGN_POST,Material.WALL_SIGN,Material.STATIONARY_WATER,Material.WATER,Material.LAVA,Material.STATIONARY_LAVA, + Material.STONE_PLATE,Material.WOOD_PLATE,Material.IRON_PLATE,Material.GOLD_PLATE + ) + + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/HomeListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/HomeListener.kt new file mode 100644 index 0000000..5308920 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/HomeListener.kt @@ -0,0 +1,123 @@ +package cc.fyre.bunkers.timer.listener + +import cc.fyre.bunkers.Bunkers +import net.hylist.handler.MovementHandler +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.bunkers.timer.event.TimerCreateEvent +import cc.fyre.bunkers.timer.event.TimerExpireEvent +import cc.fyre.engine.util.FormatUtil +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.entity.EnderPearl +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityDamageEvent +import org.bukkit.event.player.PlayerQuitEvent +import org.bukkit.event.player.PlayerTeleportEvent + +/** + * @project hcf + * + * @date 06/07/2020 + * @author xanderume@gmail.com + */ +class HomeListener(private val instance: Bunkers) : Listener,MovementHandler { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerCreate(event: TimerCreateEvent) { + + if (event.timer.type != TimerType.HOME) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + player.sendMessage("${ChatColor.YELLOW}Teleporting in ${ChatColor.LIGHT_PURPLE}${FormatUtil.formatIntoDetailedString(event.timer.getDuration())}${ChatColor.YELLOW}... Stay still and do not take damage.") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerExpire(event: TimerExpireEvent) { + + if (event.timer.type != TimerType.HOME) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + val team = this.instance.teamHandler.findById(player.uniqueId) ?: return + + if (team.hq == null) { + player.sendMessage("${ChatColor.RED}Your team's HQ has not been setup, please contact an administrator.") + return + } + + player.world.getEntitiesByClass(EnderPearl::class.java).filter{pearl -> pearl.shooter != null && pearl.shooter is Player && (pearl.shooter as Player).uniqueId == player.uniqueId}.forEach{pearl -> pearl.remove()} + + this.instance.server.scheduler.runTask(this.instance) { + + if (team.hq!!.chunk.isLoaded) { + team.hq!!.chunk.load() + } + + player.teleport(team.hq) + } + + player.sendMessage("${ChatColor.YELLOW}Warping to ${ChatColor.LIGHT_PURPLE}${team.getDisplayName()}${ChatColor.YELLOW}${ChatColor.YELLOW}'s HQ.") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.timerHandler.removeTimer(event.player.uniqueId, TimerType.HOME) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (event.isCancelled) { + return + } + + if (event.damage <= 0) { + return + } + + if (event.entity !is Player) { + return + } + + if (!this.instance.timerHandler.removeTimer(event.entity.uniqueId,TimerType.HOME)) { + return + } + + (event.entity as Player).sendMessage("${ChatColor.RED}Teleport cancelled.") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + + if (event.isCancelled) { + return + } + + this.handleUpdateLocation(event.player,event.to,event.from,null) + } + + override fun handleUpdateRotation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) {} + + override fun handleUpdateLocation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) { + + if (from.blockX == to.blockX && from.blockZ == to.blockZ) { + return + } + + if (!this.instance.timerHandler.removeTimer(player.uniqueId,TimerType.HOME)) { + return + } + + player.sendMessage("${ChatColor.RED}Teleport cancelled.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/RespawnListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/RespawnListener.kt new file mode 100644 index 0000000..b5c71a1 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/RespawnListener.kt @@ -0,0 +1,247 @@ +package cc.fyre.bunkers.timer.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.game.BunkersGameAdapter +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.bunkers.timer.event.TimerExpireEvent +import cc.fyre.engine.GameEngine +import net.hylist.handler.MovementHandler +import net.minecraft.server.v1_7_R4.PacketPlayInFlying +import org.bukkit.ChatColor +import org.bukkit.GameMode +import org.bukkit.Location +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.entity.* +import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.player.* +import org.spigotmc.SpigotConfig +import java.util.* +import kotlin.collections.HashMap + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class RespawnListener(private val instance: Bunkers) : Listener, MovementHandler { + + private val cache = HashMap() + + init { + SpigotConfig.instantRespawn = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerDeath(event: PlayerDeathEvent) { + + this.cache[event.entity.uniqueId] = event.entity.location + + if (!GameEngine.instance.gameHandler.isPlaying(event.entity)) { + return + } + + event.entity.gameMode = GameMode.CREATIVE + event.entity.isFlying = true + + this.instance.timerHandler.addTimer(event.entity.uniqueId,TimerType.RESPAWN) + this.instance.server.onlinePlayers.forEach{it.hidePlayer(event.entity)} + + GameEngine.instance.gameHandler.removePlayer(event.entity) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerRespawn(event: PlayerRespawnEvent) { + + if (!this.cache.containsKey(event.player.uniqueId)) { + return + } + + event.respawnLocation = this.cache[event.player.uniqueId]!!.clone().add(0.0,5.0,0.0) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerExpire(event: TimerExpireEvent) { + + if (event.timer.type != TimerType.RESPAWN) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + val team = this.instance.teamHandler.findById(player.uniqueId) ?: return + + if (team.hq == null) { + player.sendMessage("${ChatColor.RED}Your team's HQ has not been setup, please contact an administrator.") + return + } + + player.gameMode = GameMode.SURVIVAL + player.isFlying = false + player.inventory.clear() + + this.cache.remove(player.uniqueId) + + BunkersGameAdapter.STARTER_ITEMS.forEach{player.inventory.addItem(it)} + + //need to go on main thread + this.instance.server.scheduler.runTask(this.instance) { + + if (team.hq!!.chunk.isLoaded) { + team.hq!!.chunk.load() + } + + player.teleport(team.hq) + } + + this.instance.server.onlinePlayers.forEach{it.showPlayer(player)} + + GameEngine.instance.gameHandler.addPlayer(player) + + player.sendMessage("${ChatColor.YELLOW}Warping to ${ChatColor.LIGHT_PURPLE}${team.getDisplayName()}${ChatColor.YELLOW}${ChatColor.YELLOW}'s HQ.") + } + + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (!this.instance.timerHandler.hasTimer(event.player.uniqueId,TimerType.RESPAWN)) { + return + } + + event.player.gameMode = GameMode.CREATIVE + event.player.isFlying = true + event.player.inventory.clear() + event.player.inventory.armorContents = null + event.player.activePotionEffects.forEach{event.player.removePotionEffect(it.type)} + + this.instance.server.onlinePlayers.forEach{it.hidePlayer(event.player)} + + this.instance.timerHandler.setPaused(event.player.uniqueId,TimerType.RESPAWN,false) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.timerHandler.setPaused(event.player.uniqueId,TimerType.RESPAWN,true) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + + if (event.isCancelled) { + return + } + + this.handleUpdateLocation(event.player,event.to,event.from,null) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (!this.instance.timerHandler.hasTimer(event.player.uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (!this.instance.timerHandler.hasTimer(event.player.uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (event.entity !is Player) { + return + } + + if (!this.instance.timerHandler.hasTimer((event.entity as Player).uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (!this.instance.timerHandler.hasTimer(event.player.uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (event.damager !is Player) { + return + } + + if (!this.instance.timerHandler.hasTimer(event.damager.uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onInventoryClick(event: InventoryClickEvent) { + + if (event.whoClicked !is Player) { + return + } + + if (!this.instance.timerHandler.hasTimer((event.whoClicked as Player).uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPickupItem(event: PlayerPickupItemEvent) { + + if (!this.instance.timerHandler.hasTimer(event.player.uniqueId,TimerType.RESPAWN)) { + return + } + + event.isCancelled = true + } + + override fun handleUpdateRotation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) {} + + override fun handleUpdateLocation(player: Player, to: Location, from: Location, packet: PacketPlayInFlying?) { + + if (from.blockX == to.blockX && from.blockZ == to.blockZ) { + return + } + + if (!this.instance.timerHandler.hasTimer(player.uniqueId,TimerType.RESPAWN)) { + return + } + + val location = this.cache[player.uniqueId] ?: this.cache.putIfAbsent(player.uniqueId,from) ?: return + + if (location.distance(to) < 25) { + return + } + + player.teleport(from) + player.sendMessage("${ChatColor.RED}You cannot move more than 25 blocks from where you died.") + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/TimerListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/TimerListener.kt new file mode 100644 index 0000000..3eafef9 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/timer/listener/TimerListener.kt @@ -0,0 +1,64 @@ +package cc.fyre.bunkers.timer.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.timer.event.TimerCreateEvent +import cc.fyre.bunkers.timer.event.TimerExtendEvent +import cc.fyre.bunkers.timer.event.TimerRemoveEvent +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project bunkers + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +class TimerListener(private val instance: Bunkers) :Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + val timers = this.instance.timerHandler.cache[event.player.uniqueId] ?: return + + //TODO timers.filter{it.type.icon != null}.forEach{LunarClientAPI.instance.packetHandler.sendPacket(event.player,CooldownPacket(it.type.icon!!,it.type.name,1L))} + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerCreate(event: TimerCreateEvent) { + + if (event.timer.type.icon == null) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + //TODO LunarClientAPI.instance.packetHandler.sendPacket(player,CooldownPacket(event.timer.type.icon,event.timer.type.name,event.duration)) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerRemove(event: TimerRemoveEvent) { + + if (event.timer.type.icon == null) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + //TODO LunarClientAPI.instance.packetHandler.sendPacket(player,CooldownPacket(event.timer.type.icon,event.timer.type.name,1L)) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onTimerExtend(event: TimerExtendEvent) { + + if (event.timer.type.icon == null) { + return + } + + val player = this.instance.server.getPlayer(event.uuid) ?: return + + //TODO LunarClientAPI.instance.packetHandler.sendPacket(player,CooldownPacket(event.timer.type.icon,event.timer.type.name,event.newDuration)) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/VillagerHandler.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/VillagerHandler.kt new file mode 100644 index 0000000..d974a79 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/VillagerHandler.kt @@ -0,0 +1,136 @@ +package cc.fyre.bunkers.villager + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.villager.data.VillagerEntity +import cc.fyre.bunkers.villager.listener.VillagerPacketListener +import cc.fyre.bunkers.villager.data.kb.ZeroKBProfile +import cc.fyre.bunkers.villager.listener.VillagerListener +import cc.fyre.bunkers.villager.listener.VillagerLoggerListener +import cc.fyre.bunkers.villager.service.VillagerLoggerService +import com.comphenix.protocol.ProtocolLibrary +import net.frozenorb.qlib.qLib +import net.frozenorb.qlib.serialization.ItemStackAdapter +import net.minecraft.server.v1_7_R4.EntityTypes +import org.bukkit.ChatColor + +import org.bukkit.Location +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import org.bukkit.metadata.FixedMetadataValue +import java.util.* + +import kotlin.collections.HashMap +import kotlin.collections.HashSet + + +/** + * @project bunkers + * + * @date 03/08/2020 + * @author xanderume@gmail.com + */ +class VillagerHandler(private val instance: Bunkers) { + + val cache = HashSet() + val items = HashMap>() + val loggers = HashMap() + val services = HashMap() + + init { + this.registerEntity(VillagerEntity::class.java,"Villager",120) + + this.instance.server.pluginManager.registerEvents(VillagerListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(VillagerLoggerListener(this.instance),this.instance) + + ProtocolLibrary.getProtocolManager().addPacketListener(VillagerPacketListener(this.instance)) + } + + fun spawnVillager(location: Location):VillagerEntity { + + if (!location.chunk.isLoaded) { + location.chunk.load() + } + + val villager = VillagerEntity(location) + + villager.setLocation(location.x,location.y,location.z,(location.yaw * 256.0f / 360.0f),(location.pitch * 256.0f / 360.0f)) + villager.setPosition(location.x,location.y,location.z) + + val result = villager.world.addEntity(villager) + + if (!result) { + this.instance.server.logger.info("Failed to spawn villager.") + } + + villager.k = false + villager.fromMobSpawner = true + + villager.health = villager.maxHealth + villager.kbProfile = KB_PROFILE + + this.cache.add(villager) + + return villager + } + + fun spawnCombatLogger(location: Location,player: Player) { + + val villager = this.spawnVillager(location) + + villager.customName = "${ChatColor.GRAY}(Combat-Logger)${this.instance.teamHandler.findById(player.uniqueId)?.getColor() ?: ChatColor.WHITE} ${player.name}" + villager.customNameVisible = true + + val items = ArrayList() + + items.addAll(player.inventory.contents.filterNotNull().filter{it.type != Material.AIR}) + items.addAll(player.inventory.armorContents.filterNotNull().filter{it.type != Material.AIR}) + + villager.bukkitEntity.setMetadata(LOGGER_OWNER_METADATA,FixedMetadataValue(this.instance,player.uniqueId.toString())) + villager.bukkitEntity.setMetadata(LOGGER_ITEMS_METADATA,FixedMetadataValue(this.instance,qLib.GSON.toJson(items,ItemStackAdapter::class.java))) + + this.items[player.uniqueId] = player.inventory.contents.plus(player.inventory.armorContents).filterNotNull().filter{it.type != Material.AIR}.toTypedArray() + this.loggers[player.uniqueId] = villager + + val service = VillagerLoggerService(player.uniqueId,villager) + + service.runTaskTimer(this.instance,20L,20L) + + this.services[player.uniqueId] = service + } + + private fun registerEntity(entityClass: Class<*>, name: String, id: Int) { + this.setFieldPrivateStaticMap("d",entityClass,name) + this.setFieldPrivateStaticMap("f",entityClass,Integer.valueOf(id)) + } + + private fun setFieldPrivateStaticMap(fieldName: String, key: Any, value: Any) { + + try { + val field = EntityTypes::class.java.getDeclaredField(fieldName) + field.isAccessible = true + val map = field.get(null) as HashMap + map[key] = value + field.set(null, map) + } catch (ex: SecurityException) { + ex.printStackTrace() + } catch (ex: IllegalArgumentException) { + ex.printStackTrace() + } catch (ex: IllegalAccessException) { + ex.printStackTrace() + } catch (ex: NoSuchFieldException) { + ex.printStackTrace() + } + + } + + companion object { + + val KB_PROFILE = ZeroKBProfile() + + const val LOGGER_OWNER_METADATA = "LOGGER_OWNER" + const val LOGGER_ITEMS_METADATA = "LOGGER_ITEMS" + + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/data/VillagerEntity.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/data/VillagerEntity.kt new file mode 100644 index 0000000..ed2d1c0 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/data/VillagerEntity.kt @@ -0,0 +1,29 @@ +package cc.fyre.bunkers.villager.data + +import net.minecraft.server.v1_7_R4.DamageSource +import net.minecraft.server.v1_7_R4.Entity +import net.minecraft.server.v1_7_R4.EntityAgeable +import net.minecraft.server.v1_7_R4.EntityVillager +import org.bukkit.Location +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld + +/** + * @project bunkers + * + * @date 16/08/2020 + * @author xanderume@gmail.com + */ +class VillagerEntity(location: Location):EntityVillager((location.world as CraftWorld).handle) { + + override fun move(x: Double,y: Double,z: Double) {} + override fun collide(entity: Entity?) {} + override fun g(d0: Double, d1: Double, d2: Double) {} + + override fun dropDeathLoot(flag: Boolean, i: Int) {} + override fun createChild(entity: EntityAgeable?): EntityAgeable? = null + + override fun damageEntity(damagesource: DamageSource,float: Float): Boolean { + return super.damageEntity(damagesource,float / 2.5F) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/data/kb/ZeroKBProfile.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/data/kb/ZeroKBProfile.kt new file mode 100644 index 0000000..88a32a5 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/data/kb/ZeroKBProfile.kt @@ -0,0 +1,72 @@ +package cc.fyre.bunkers.villager.data.kb + +import net.hylist.knockback.KnockbackProfile + +/** + * @project bunkers + * + * @date 17/08/2020 + * @author xanderume@gmail.com + */ +class ZeroKBProfile : KnockbackProfile { + + private val name = "Zero" + private var friction = 2.0 + private var vertical = 0.0 + private var horizontal = 0.0 + private var verticalLimit = 0.0 + private var extraVertical = 0.0 + private var extraHorizontal = 0.0 + + override fun getName():String { + return name + } + + override fun getFriction(): Double { + return friction + } + + override fun setFriction(friction: Double) { + this.friction = friction + } + + override fun getHorizontal(): Double { + return horizontal + } + + override fun setHorizontal(horizontal: Double) { + this.horizontal = horizontal + } + + override fun getVertical(): Double { + return vertical + } + + override fun setVertical(vertical: Double) { + this.vertical = vertical + } + + override fun getVerticalLimit(): Double { + return verticalLimit + } + + override fun setVerticalLimit(verticalLimit: Double) { + this.verticalLimit = verticalLimit + } + + override fun getExtraHorizontal(): Double { + return extraHorizontal + } + + override fun setExtraHorizontal(extraHorizontal: Double) { + this.extraHorizontal = extraHorizontal + } + + override fun getExtraVertical(): Double { + return extraVertical + } + + override fun setExtraVertical(extraVertical: Double) { + this.extraVertical = extraVertical + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerListener.kt new file mode 100644 index 0000000..dd51758 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerListener.kt @@ -0,0 +1,39 @@ +package cc.fyre.bunkers.villager.listener + +import cc.fyre.bunkers.Bunkers +import org.bukkit.entity.Villager +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.PotionEffectAddEvent +import org.bukkit.event.world.ChunkUnloadEvent + +/** + * @project bunkers + * + * @date 18/08/2020 + * @author xanderume@gmail.com + */ +class VillagerListener(private val instance: Bunkers):Listener { + + + @EventHandler(priority = EventPriority.MONITOR) + private fun onChunkUnLoad(event: ChunkUnloadEvent) { + + if (this.instance.villagerHandler.cache.none{event.chunk.entities.firstOrNull{entity -> entity.uniqueId == it.uniqueID} != null}) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPotionEffectAdd(event: PotionEffectAddEvent) { + + if (event.entity !is Villager) { + return + } + + event.isCancelled = true + } +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerLoggerListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerLoggerListener.kt new file mode 100644 index 0000000..a3ca61c --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerLoggerListener.kt @@ -0,0 +1,134 @@ +package cc.fyre.bunkers.villager.listener + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.statistic.StatisticHandler +import cc.fyre.bunkers.timer.data.TimerType +import cc.fyre.bunkers.villager.VillagerHandler + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.util.UUIDUtils + +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.entity.Villager +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.entity.EntityDeathEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent +import java.util.* + +/** + * @project bunkers + * + * @date 18/08/2020 + * @author xanderume@gmail.com + */ +class VillagerLoggerListener(private val instance: Bunkers) : Listener { + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!GameEngine.instance.gameHandler.isPlaying(event.player)) { + return + } + + if (GameEngine.instance.gameHandler.getState() != GameServer.State.IN_PROGRESS) { + return + } + + this.instance.villagerHandler.spawnCombatLogger(event.player.location,event.player) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDeath(event: EntityDeathEvent) { + + if (event.entity !is Villager) { + return + } + + if (!event.entity.hasMetadata(VillagerHandler.LOGGER_OWNER_METADATA) || !event.entity.hasMetadata(VillagerHandler.LOGGER_ITEMS_METADATA)) { + return + } + + val uuid = UUID.fromString(event.entity.getMetadata(VillagerHandler.LOGGER_OWNER_METADATA)[0].asString()) ?: return + + + val items = this.instance.villagerHandler.items.remove(uuid) + + if (items != null) { + event.drops.clear() + event.drops.addAll(items) + } + + this.instance.villagerHandler.loggers.remove(uuid) + + val team = this.instance.teamHandler.findById(uuid) ?: return + val name = UUIDUtils.name(uuid) + + if (event.entity.killer != null) { + + val balance = this.instance.statisticHandler.getBalance(event.entity.uniqueId) + + this.instance.statisticHandler.addKills(event.entity.killer.uniqueId,1) + this.instance.statisticHandler.addBalance(event.entity.killer.uniqueId,if (balance >= StatisticHandler.BALANCE_PER_KILL) StatisticHandler.BALANCE_PER_KILL else balance) + + event.entity.killer.sendMessage("${ChatColor.GOLD}You earned ${ChatColor.WHITE}$${if (balance >= StatisticHandler.BALANCE_PER_KILL) StatisticHandler.BALANCE_PER_KILL else balance}.0${ChatColor.GOLD} for killing ${team.type.color}$name${ChatColor.GOLD}!") + } + + team.dtr -= 1.0 + team.sendMessage("${ChatColor.RED}Member Death: ${ChatColor.WHITE}$name","${ChatColor.RED}DTR: ${ChatColor.WHITE}${team.getDTR()}") + + event.entity.world.strikeLightningEffect(event.entity.location) + event.drops.removeIf{it.hasItemMeta() && it.itemMeta.hasLore() && ChatColor.stripColor(it.itemMeta.lore[0]).equals("Soulbound",true)} + + if (!team.isRaidable()) { + this.instance.timerHandler.addTimer(uuid,TimerType.RESPAWN) + this.instance.timerHandler.setPaused(uuid,TimerType.RESPAWN,true) + } + + this.instance.server.broadcastMessage("${team.getColor()}$name${ChatColor.GOLD}[${this.instance.statisticHandler.getKills(uuid)}] ${ChatColor.YELLOW}${if (event.entity.killer == null) "died" else "was slain by ${this.instance.teamHandler.findById(event.entity.killer.uniqueId)?.getColor() ?: ChatColor.WHITE}${event.entity.killer.name}${ChatColor.GOLD}[${this.instance.statisticHandler.getKills(event.entity.killer.uniqueId)}]"}${ChatColor.YELLOW}.") + + this.instance.statisticHandler.addDeaths(uuid,1) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageByEntityEvent) { + + if (event.entity !is Villager) { + return + } + + if (!event.entity.hasMetadata(VillagerHandler.LOGGER_OWNER_METADATA)) { + return + } + + val uuid = UUID.fromString(event.entity.getMetadata(VillagerHandler.LOGGER_OWNER_METADATA)[0].asString()) ?: return + + if (event.damager !is Player) { + return + } + + val team = this.instance.teamHandler.findById(event.damager.uniqueId) ?: return + + if (!team.isMember(uuid)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + val villager = this.instance.villagerHandler.loggers.remove(event.player.uniqueId) ?: return + + villager.bukkitEntity.remove() + + this.instance.villagerHandler.services.remove(event.player.uniqueId) + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerPacketListener.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerPacketListener.kt new file mode 100644 index 0000000..eb0d6eb --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/listener/VillagerPacketListener.kt @@ -0,0 +1,31 @@ +package cc.fyre.bunkers.villager.listener + +import cc.fyre.bunkers.Bunkers +import com.comphenix.protocol.PacketType +import com.comphenix.protocol.events.PacketAdapter +import com.comphenix.protocol.events.PacketEvent + +/** + * @project bunkers + * + * @date 08/08/2020 + * @author xanderume@gmail.com + */ +class VillagerPacketListener(instance: Bunkers) : PacketAdapter(instance,PacketType.Play.Server.NAMED_SOUND_EFFECT) { + + override fun onPacketSending(event: PacketEvent) { + + val name = event.packet.strings.read(0) + + if (!name.startsWith("MOB.VILLAGER",true)) { + return + } + + if (name.endsWith("DEATH",true) || name.endsWith("HIT",true)) { + return + } + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/service/VillagerLoggerService.kt b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/service/VillagerLoggerService.kt new file mode 100644 index 0000000..e9f7d90 --- /dev/null +++ b/Bunkers/src/main/kotlin/cc/fyre/bunkers/villager/service/VillagerLoggerService.kt @@ -0,0 +1,38 @@ +package cc.fyre.bunkers.villager.service + +import cc.fyre.bunkers.Bunkers +import cc.fyre.bunkers.villager.data.VillagerEntity +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.* +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project bunkers + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +class VillagerLoggerService(private val uuid: UUID,private val villager: VillagerEntity):BukkitRunnable() { + + private val name = this.villager.customName + private val remaining = AtomicInteger(25) + + override fun run() { + + if (this.remaining.get() == 0 || this.villager.bukkitEntity.isDead) { + this.cancel() + + if (!this.villager.bukkitEntity.isDead) { + this.villager.bukkitEntity.remove() + } + + Bunkers.instance.villagerHandler.loggers.remove(this.uuid) + Bunkers.instance.villagerHandler.services.remove(this.uuid) + return + } + + this.villager.customName = "${this.name}${ChatColor.YELLOW} (${this.remaining.decrementAndGet()}s)" + } + +} \ No newline at end of file diff --git a/Bunkers/src/main/resources/plugin.yml b/Bunkers/src/main/resources/plugin.yml new file mode 100644 index 0000000..8009c4e --- /dev/null +++ b/Bunkers/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: Bunkers +main: cc.fyre.bunkers.Bunkers +version: 1.0-SNAPSHOT +depend: [qLib,GameEngine] diff --git a/Engine/.gradle/6.8/executionHistory/executionHistory.bin b/Engine/.gradle/6.8/executionHistory/executionHistory.bin new file mode 100644 index 0000000..2a7f4a9 Binary files /dev/null and b/Engine/.gradle/6.8/executionHistory/executionHistory.bin differ diff --git a/Engine/.gradle/6.8/executionHistory/executionHistory.lock b/Engine/.gradle/6.8/executionHistory/executionHistory.lock new file mode 100644 index 0000000..0f66333 Binary files /dev/null and b/Engine/.gradle/6.8/executionHistory/executionHistory.lock differ diff --git a/Engine/.gradle/6.8/fileChanges/last-build.bin b/Engine/.gradle/6.8/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Engine/.gradle/6.8/fileChanges/last-build.bin differ diff --git a/Engine/.gradle/6.8/fileHashes/fileHashes.bin b/Engine/.gradle/6.8/fileHashes/fileHashes.bin new file mode 100644 index 0000000..852db5c Binary files /dev/null and b/Engine/.gradle/6.8/fileHashes/fileHashes.bin differ diff --git a/Engine/.gradle/6.8/fileHashes/fileHashes.lock b/Engine/.gradle/6.8/fileHashes/fileHashes.lock new file mode 100644 index 0000000..12cd5ba Binary files /dev/null and b/Engine/.gradle/6.8/fileHashes/fileHashes.lock differ diff --git a/Engine/.gradle/6.8/fileHashes/resourceHashesCache.bin b/Engine/.gradle/6.8/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..1de7ada Binary files /dev/null and b/Engine/.gradle/6.8/fileHashes/resourceHashesCache.bin differ diff --git a/Engine/.gradle/6.8/gc.properties b/Engine/.gradle/6.8/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Engine/.gradle/6.8/javaCompile/classAnalysis.bin b/Engine/.gradle/6.8/javaCompile/classAnalysis.bin new file mode 100644 index 0000000..44acf1c Binary files /dev/null and b/Engine/.gradle/6.8/javaCompile/classAnalysis.bin differ diff --git a/Engine/.gradle/6.8/javaCompile/jarAnalysis.bin b/Engine/.gradle/6.8/javaCompile/jarAnalysis.bin new file mode 100644 index 0000000..eadaf17 Binary files /dev/null and b/Engine/.gradle/6.8/javaCompile/jarAnalysis.bin differ diff --git a/Engine/.gradle/6.8/javaCompile/javaCompile.lock b/Engine/.gradle/6.8/javaCompile/javaCompile.lock new file mode 100644 index 0000000..a0e2e52 Binary files /dev/null and b/Engine/.gradle/6.8/javaCompile/javaCompile.lock differ diff --git a/Engine/.gradle/6.8/javaCompile/taskHistory.bin b/Engine/.gradle/6.8/javaCompile/taskHistory.bin new file mode 100644 index 0000000..a0c8d58 Binary files /dev/null and b/Engine/.gradle/6.8/javaCompile/taskHistory.bin differ diff --git a/Engine/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Engine/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..7a0a825 Binary files /dev/null and b/Engine/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Engine/.gradle/buildOutputCleanup/cache.properties b/Engine/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..6ac1877 --- /dev/null +++ b/Engine/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sat Jul 24 19:59:35 CEST 2021 +gradle.version=6.8 diff --git a/Engine/.gradle/buildOutputCleanup/outputFiles.bin b/Engine/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..587526c Binary files /dev/null and b/Engine/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/Engine/.gradle/checksums/checksums.lock b/Engine/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..116a215 Binary files /dev/null and b/Engine/.gradle/checksums/checksums.lock differ diff --git a/Engine/.gradle/checksums/md5-checksums.bin b/Engine/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..6fbe53d Binary files /dev/null and b/Engine/.gradle/checksums/md5-checksums.bin differ diff --git a/Engine/.gradle/checksums/sha1-checksums.bin b/Engine/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..5875ba7 Binary files /dev/null and b/Engine/.gradle/checksums/sha1-checksums.bin differ diff --git a/Engine/.gradle/configuration-cache/gc.properties b/Engine/.gradle/configuration-cache/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Engine/.gradle/vcs-1/gc.properties b/Engine/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Engine/.idea/.gitignore b/Engine/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Engine/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Engine/.idea/compiler.xml b/Engine/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/Engine/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Engine/.idea/gradle.xml b/Engine/.idea/gradle.xml new file mode 100644 index 0000000..9c628f0 --- /dev/null +++ b/Engine/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/Engine/.idea/jarRepositories.xml b/Engine/.idea/jarRepositories.xml new file mode 100644 index 0000000..55f1d4b --- /dev/null +++ b/Engine/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engine/.idea/libraries-with-intellij-classes.xml b/Engine/.idea/libraries-with-intellij-classes.xml new file mode 100644 index 0000000..9fa3156 --- /dev/null +++ b/Engine/.idea/libraries-with-intellij-classes.xml @@ -0,0 +1,65 @@ + + + + + + \ No newline at end of file diff --git a/Engine/.idea/misc.xml b/Engine/.idea/misc.xml new file mode 100644 index 0000000..b0051c8 --- /dev/null +++ b/Engine/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Engine/api/build.gradle b/Engine/api/build.gradle new file mode 100644 index 0000000..deec761 --- /dev/null +++ b/Engine/api/build.gradle @@ -0,0 +1,50 @@ +plugins { + id "org.jetbrains.kotlin.jvm" version "1.5.0" + id "com.github.johnrengelman.shadow" version "5.2.0" + id "com.gorylenko.gradle-git-properties" version "2.2.2" +} + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() + archiveName = "engine-" + this.name + "-" + this.version + ".jar" +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + compile "com.google.code.gson:gson:2.8.5" + compile "cc.fyre.symbiote:symbiote:1.0-SNAPSHOT" + compile "org.mongodb:mongo-java-driver:3.10.2" + + compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.0" +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} diff --git a/Engine/api/build/classes/kotlin/main/META-INF/api.kotlin_module b/Engine/api/build/classes/kotlin/main/META-INF/api.kotlin_module new file mode 100644 index 0000000..70f0f69 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/META-INF/api.kotlin_module differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI$Companion.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI$Companion.class new file mode 100644 index 0000000..53080cf Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI$Companion.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI$GameMode.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI$GameMode.class new file mode 100644 index 0000000..01ace4e Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI$GameMode.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI.class new file mode 100644 index 0000000..56b1350 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/GameEngineAPI.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/database/DatabaseHandler.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/database/DatabaseHandler.class new file mode 100644 index 0000000..e9dd2a8 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/database/DatabaseHandler.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/GameDataHandler.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/GameDataHandler.class new file mode 100644 index 0000000..f3c87dc Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/GameDataHandler.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/Game.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/Game.class new file mode 100644 index 0000000..2c8e2bb Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/Game.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/type/BunkersGame$Team.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/type/BunkersGame$Team.class new file mode 100644 index 0000000..47c40e0 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/type/BunkersGame$Team.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/type/BunkersGame.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/type/BunkersGame.class new file mode 100644 index 0000000..64c3c0f Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/game/data/type/BunkersGame.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/ProfileHandler.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/ProfileHandler.class new file mode 100644 index 0000000..eeadece Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/ProfileHandler.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/Profile.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/Profile.class new file mode 100644 index 0000000..233f772 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/Profile.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$Ore.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$Ore.class new file mode 100644 index 0000000..5e31b6c Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$Ore.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$PvPClass.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$PvPClass.class new file mode 100644 index 0000000..c12599f Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$PvPClass.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$getPrimaryClass$$inlined$sortedByDescending$1.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$getPrimaryClass$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..b511ae2 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile$getPrimaryClass$$inlined$sortedByDescending$1.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile.class new file mode 100644 index 0000000..2d3fc06 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/profile/data/type/BunkersProfile.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/GameServerHandler.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/GameServerHandler.class new file mode 100644 index 0000000..7b62550 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/GameServerHandler.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer$Companion.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer$Companion.class new file mode 100644 index 0000000..c56fd16 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer$Companion.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer$State.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer$State.class new file mode 100644 index 0000000..bc01de3 Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer$State.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer.class new file mode 100644 index 0000000..c7dc8ef Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/data/GameServer.class differ diff --git a/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/listener/GameServerListener.class b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/listener/GameServerListener.class new file mode 100644 index 0000000..fd8f0ee Binary files /dev/null and b/Engine/api/build/classes/kotlin/main/cc/fyre/engine/server/listener/GameServerListener.class differ diff --git a/Engine/api/build/kotlin/api10SNAPSHOTjar-classes.txt b/Engine/api/build/kotlin/api10SNAPSHOTjar-classes.txt new file mode 100644 index 0000000..c8147cc --- /dev/null +++ b/Engine/api/build/kotlin/api10SNAPSHOTjar-classes.txt @@ -0,0 +1 @@ +C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\GameEngineAPI$Companion.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\GameEngineAPI$GameMode.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\GameEngineAPI.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\database\DatabaseHandler.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\game\GameDataHandler.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\game\data\Game.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\game\data\type\BunkersGame$Team.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\game\data\type\BunkersGame.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\profile\ProfileHandler.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\profile\data\Profile.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\profile\data\type\BunkersProfile$Ore.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\profile\data\type\BunkersProfile$PvPClass.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\profile\data\type\BunkersProfile$getPrimaryClass$$inlined$sortedByDescending$1.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\profile\data\type\BunkersProfile.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\server\GameServerHandler.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\server\data\GameServer$Companion.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\server\data\GameServer$State.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\server\data\GameServer.class;C:\Users\xande\Documents\fyre\$$$\engine\api\build\classes\kotlin\main\cc\fyre\engine\server\listener\GameServerListener.class \ No newline at end of file diff --git a/Engine/api/build/kotlin/compileKotlin/build-history.bin b/Engine/api/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..97a0c2a Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/build-history.bin differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..6d19f40 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..6e6c7ae Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..e4e877d Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..a541356 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..89ee2b2 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..c2815c5 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..d7c064c Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..3bcecf0 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..0cfcfa1 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..09407ef Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..10e3b98 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..e041941 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..15f271d Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..3bcecf0 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..0cfcfa1 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..09407ef Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..336cce7 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..e041941 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab new file mode 100644 index 0000000..4b73c71 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream new file mode 100644 index 0000000..0128bd2 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len new file mode 100644 index 0000000..a57f5a0 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len new file mode 100644 index 0000000..01bdaa1 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at new file mode 100644 index 0000000..a4566aa Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i new file mode 100644 index 0000000..c72edd8 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..57aac3b Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..01e4cca Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..7b79156 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..14f7c06 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..ef6c15f Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..70f1223 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..4c4c4d1 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..ddb6974 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..f6ed631 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..14f7c06 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..7f83a18 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..fc8bd6e Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..5ba5a2c Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..150935c Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..e4e877d Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..a541356 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..380dcb9 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..dcf34ac Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..8a5cd75 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..f078d91 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..a196eeb Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..93a595b Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..d8e4d80 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..55ac800 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..34ab339 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..1ce991a Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..1b6e45b Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..817b326 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..f86de80 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..0ff8a94 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..feef2d8 --- /dev/null +++ b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +18 +7 \ No newline at end of file diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..0f127d8 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..150935c Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..e4e877d Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..a541356 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..5b7bdc3 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..b857bf8 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..fa0732c Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..99cb6e9 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..c54fd0d Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..09407ef Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..3d17800 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..504f86b Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..06489b4 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..b36b9ce Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..2a793c1 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..af35e75 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..e9849ac Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..46d05b3 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/Engine/api/build/kotlin/compileKotlin/last-build.bin b/Engine/api/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..0d0a325 Binary files /dev/null and b/Engine/api/build/kotlin/compileKotlin/last-build.bin differ diff --git a/Engine/api/build/libs/api-1.0-SNAPSHOT.jar b/Engine/api/build/libs/api-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..07289f9 Binary files /dev/null and b/Engine/api/build/libs/api-1.0-SNAPSHOT.jar differ diff --git a/Engine/api/build/libs/engine-api-1.0-SNAPSHOT.jar b/Engine/api/build/libs/engine-api-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..be33b51 Binary files /dev/null and b/Engine/api/build/libs/engine-api-1.0-SNAPSHOT.jar differ diff --git a/Engine/api/build/publications/shadow/pom-default.xml b/Engine/api/build/publications/shadow/pom-default.xml new file mode 100644 index 0000000..67a1f01 --- /dev/null +++ b/Engine/api/build/publications/shadow/pom-default.xml @@ -0,0 +1,8 @@ + + + 4.0.0 + cc.fyre.engine + api + 1.0-SNAPSHOT + + diff --git a/Engine/api/build/resources/main/git.properties b/Engine/api/build/resources/main/git.properties new file mode 100644 index 0000000..966753a --- /dev/null +++ b/Engine/api/build/resources/main/git.properties @@ -0,0 +1,19 @@ +git.branch= +git.build.host=IMAGESE-432HNTP +git.build.user.email=xanderume@gmail.com +git.build.user.name=xander +git.build.version=1.0-SNAPSHOT +git.closest.tag.commit.count= +git.closest.tag.name= +git.commit.id= +git.commit.id.abbrev= +git.commit.id.describe= +git.commit.message.full= +git.commit.message.short= +git.commit.time= +git.commit.user.email= +git.commit.user.name= +git.dirty=true +git.remote.origin.url= +git.tags= +git.total.commit.count=0 diff --git a/Engine/api/build/tmp/jar/MANIFEST.MF b/Engine/api/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Engine/api/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Engine/api/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml b/Engine/api/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml new file mode 100644 index 0000000..5b12c54 --- /dev/null +++ b/Engine/api/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml @@ -0,0 +1,12 @@ + + + cc.fyre.engine + api + + 1.0-SNAPSHOT + + 1.0-SNAPSHOT + + 20210725122141 + + diff --git a/Engine/api/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml b/Engine/api/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml new file mode 100644 index 0000000..6869382 --- /dev/null +++ b/Engine/api/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml @@ -0,0 +1,24 @@ + + + cc.fyre.engine + api + 1.0-SNAPSHOT + + + true + + 20210725122141 + + + pom + 1.0-SNAPSHOT + 20210725122141 + + + jar + 1.0-SNAPSHOT + 20210725122141 + + + + diff --git a/Engine/api/build/tmp/shadowJar/MANIFEST.MF b/Engine/api/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Engine/api/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/GameEngineAPI.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/GameEngineAPI.kt new file mode 100644 index 0000000..161399f --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/GameEngineAPI.kt @@ -0,0 +1,76 @@ +package cc.fyre.engine + +import cc.fyre.engine.database.DatabaseHandler +import cc.fyre.engine.game.GameDataHandler +import cc.fyre.engine.game.data.type.BunkersGame +import cc.fyre.engine.profile.ProfileHandler +import cc.fyre.engine.profile.data.type.BunkersProfile +import cc.fyre.engine.server.GameServerHandler + +import com.google.gson.GsonBuilder +import com.google.gson.LongSerializationPolicy +import org.bson.json.JsonMode +import org.bson.json.JsonWriterSettings +import java.io.File + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GameEngineAPI(val mode: GameMode) { + + val gson = GsonBuilder().create() + + val databaseHandler = DatabaseHandler(this) + + val gameDataHandler = GameDataHandler(this) + val gameServerHandler = GameServerHandler(this) + + val profileHandler = this.loadProfileHandler() + + fun dispose() { + this.databaseHandler.dispose() + } + + private fun loadProfileHandler():ProfileHandler<*> { + + if (this.mode == GameMode.BUNKERS) { + return ProfileHandler(this) + } + + return ProfileHandler(this) + } + + enum class GameMode(val season: Int, + val displayName: String, + val mongoDB: String, + val redisDB: String, + val lobbyServer: String, + val prefix: String, + val requiredQueueSize: Int, + val requiredDuelSize: Int, + val mapBased: Boolean, + val spectatable: Boolean, + val disqualifies: Boolean, + val clazz: Class<*>, + val profileClazz: Class<*>, + val idPath: String) { + + BUNKERS(3,"Bunkers","bunkers","bunkers","Bunkers-Lobby","§7[§c§lBunkers§7]",20,3,true,true,true,BunkersGame::class.java,BunkersProfile::class.java,"teams.players") + + } + + companion object { + + val PARENT_DIRECTORY = File("/home/engine/") + + const val GAME_DATA_PACKET = "GAME_DATA" + const val GAME_SEND_PACKET = "GAME_SEND" + const val GAME_SENT_PACKET = "GAME_SENT" + + val JSON_WRITER_SETTINGS: JsonWriterSettings = JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).build() + } + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/database/DatabaseHandler.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/database/DatabaseHandler.kt new file mode 100644 index 0000000..253e009 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/database/DatabaseHandler.kt @@ -0,0 +1,35 @@ +package cc.fyre.engine.database + +import cc.fyre.engine.GameEngineAPI +import cc.fyre.symbiote.SymbioteAPI +import cc.fyre.symbiote.type.RedisSymbioteAPI +import com.mongodb.MongoClient +import com.mongodb.ServerAddress +import com.mongodb.client.MongoDatabase + +import redis.clients.jedis.JedisPool + +/** + * @project bunkers + * + * @date 30/07/2020 + * @author xanderume@gmail.com + */ +class DatabaseHandler(private val instance: GameEngineAPI) { + + val symbiote: SymbioteAPI + + val mongoDB: MongoDatabase + val mongoPool = MongoClient(ServerAddress("localhost",27017)) + val redisPool = JedisPool("localhost",6379) + + init { + this.mongoDB = this.mongoPool.getDatabase(this.instance.mode.mongoDB) + this.symbiote = RedisSymbioteAPI(this.instance.gson,this.redisPool,this.instance.mode.redisDB) + } + + fun dispose() { + this.redisPool.close() + } + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/game/GameDataHandler.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/game/GameDataHandler.kt new file mode 100644 index 0000000..fb2d861 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/game/GameDataHandler.kt @@ -0,0 +1,85 @@ +package cc.fyre.engine.game + +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.game.data.Game +import com.mongodb.client.MongoCollection +import com.mongodb.client.model.Filters +import com.mongodb.client.model.UpdateOptions +import com.mongodb.client.result.UpdateResult +import org.bson.Document +import java.util.* +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +class GameDataHandler(private val instance: GameEngineAPI) { + + val collection: MongoCollection + val collections = hashMapOf>() + + init { + + for (i in 1..this.instance.mode.season) { + this.collections[i] = this.instance.databaseHandler.mongoDB.getCollection("games${if (i == 1) "" else "$i"}") + } + + this.collection = this.collections[this.instance.mode.season]!! + } + + private fun getCollection(season: Int):MongoCollection { + return this.collections.getOrPut(season) { this.instance.databaseHandler.mongoDB.getCollection("games$season") } + } + + fun update(game: Game):UpdateResult { + return this.collection.updateOne(Document("_id",game.id.toString()),Document("\$set",Document.parse(this.instance.gson.toJson(game,game.mode.clazz))),UpdateOptions().upsert(true)) + } + + fun findById(id: UUID,mode: GameEngineAPI.GameMode,season: Int):Collection { + return this.getCollection(season).find(Filters.and(Filters.eq(this.instance.mode.idPath,id.toString()),Filters.eq("mode",mode.name))).map{this.instance.gson.fromJson(it.toJson(GameEngineAPI.JSON_WRITER_SETTINGS),mode.clazz) as T}.toList() + } + + + fun findById(id: UUID,mode: GameEngineAPI.GameMode):HashMap> { + + val toReturn = HashMap>() + + for (entry in this.collections.entries) { + + toReturn[entry.key] = ArrayList() + + for (document in entry.value.find(Filters.and(Filters.eq(this.instance.mode.idPath,id.toString()),Filters.eq("mode",mode.name)))) { + toReturn[entry.key]!!.add(this.instance.gson.fromJson(document.toJson(GameEngineAPI.JSON_WRITER_SETTINGS),mode.clazz) as T) + } + + } + + return toReturn + } + + fun findByMode(mode: GameEngineAPI.GameMode,season: Int):Collection { + return this.getCollection(season).find(Filters.eq("mode",mode.name)).map{this.instance.gson.fromJson(it.toJson(GameEngineAPI.JSON_WRITER_SETTINGS),mode.clazz) as T}.toList() + } + + fun findByMode(mode: GameEngineAPI.GameMode):HashMap> { + + val toReturn = HashMap>() + + for (entry in this.collections.entries) { + + toReturn[entry.key] = ArrayList() + + for (document in entry.value.find(Filters.eq("mode",mode.name))) { + toReturn[entry.key]!!.add(this.instance.gson.fromJson(document.toJson(GameEngineAPI.JSON_WRITER_SETTINGS),mode.clazz) as T) + } + + } + + return toReturn + } + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/game/data/Game.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/game/data/Game.kt new file mode 100644 index 0000000..5bd6d53 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/game/data/Game.kt @@ -0,0 +1,18 @@ +package cc.fyre.engine.game.data + +import cc.fyre.engine.GameEngineAPI +import com.google.gson.annotations.SerializedName +import java.util.* + +/** + * @project engine + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +open class Game(@SerializedName("_id")val id: UUID,val mode: GameEngineAPI.GameMode,val time: Long) { + + var ranked = false + val created = System.currentTimeMillis() + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/game/data/type/BunkersGame.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/game/data/type/BunkersGame.kt new file mode 100644 index 0000000..b9805c3 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/game/data/type/BunkersGame.kt @@ -0,0 +1,65 @@ +package cc.fyre.engine.game.data.type + +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.profile.data.type.BunkersProfile +import com.google.gson.annotations.SerializedName +import java.util.* +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +class BunkersGame( + time: Long, + val map: String, + val teams: ArrayList, + val kills: HashMap, + val deaths: HashMap, + val playTime: HashMap, + val oresMined: HashMap, + val primaryClass: HashMap, + val winner: String?, + val kothControlledBy: UUID? +) : Game(UUID.randomUUID(),GameEngineAPI.GameMode.BUNKERS,time) { + + fun getKills(player: UUID):Int { + return this.kills[player] ?: 0 + } + + fun getDeaths(player: UUID):Int { + return this.deaths[player] ?: 0 + } + + fun getWinningTeam():Team? { + + if (this.winner == null) { + return null + } + + return this.teams.firstOrNull{it.name.equals(this.winner,true)} + } + + fun getOresMined(uuid: UUID):Int { + return this.oresMined[uuid] ?: 0 + } + + fun getPrimaryClass(uuid: UUID):String { + return this.primaryClass[uuid]?.displayName ?: "N/A" + } + + fun getPlayers():MutableList { + return this.teams.flatMap{it.players}.toMutableList() + } + + fun getWinners():MutableList { + return this.getWinningTeam()?.players?.toMutableList() ?: ArrayList() + } + + class Team(val name: String,val color: String,val dtr: Double,val players: ArrayList) + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/profile/ProfileHandler.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/profile/ProfileHandler.kt new file mode 100644 index 0000000..14a49c8 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/profile/ProfileHandler.kt @@ -0,0 +1,44 @@ +package cc.fyre.engine.profile + +import cc.fyre.engine.GameEngineAPI + +import cc.fyre.engine.profile.data.Profile +import com.mongodb.client.MongoCollection +import com.mongodb.client.model.Filters +import com.mongodb.client.model.UpdateOptions +import com.mongodb.client.result.UpdateResult +import org.bson.Document +import java.util.* + +/** + * @project engine + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +class ProfileHandler(private val instance: GameEngineAPI) { + + val collection: MongoCollection + val collections = hashMapOf>() + + init { + + for (i in 1..this.instance.mode.season) { + this.collections[i] = this.instance.databaseHandler.mongoDB.getCollection("profiles${if (i == 1) "" else "$i"}") + } + + this.collection = this.collections[this.instance.mode.season]!! + } + + fun update(profile: Profile):UpdateResult { + return this.collection.updateOne(Document("_id",profile.id.toString()),Document("\$set",Document.parse(this.instance.gson.toJson(profile,profile.mode.profileClazz))),UpdateOptions().upsert(true)) + } + + fun findById(id: UUID,mode: GameEngineAPI.GameMode):T? { + + val query = this.collection.find(Filters.eq("_id",id.toString())).first() ?: return null + + return this.instance.gson.fromJson(query.toJson(GameEngineAPI.JSON_WRITER_SETTINGS),mode.profileClazz) as T + } + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/profile/data/Profile.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/profile/data/Profile.kt new file mode 100644 index 0000000..a251589 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/profile/data/Profile.kt @@ -0,0 +1,15 @@ +package cc.fyre.engine.profile.data + +import cc.fyre.engine.GameEngineAPI +import com.google.gson.annotations.SerializedName +import java.util.* + +/** + * @project engine + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +open class Profile(@SerializedName("_id")val id: UUID,val mode: GameEngineAPI.GameMode) { + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/profile/data/type/BunkersProfile.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/profile/data/type/BunkersProfile.kt new file mode 100644 index 0000000..68db5a7 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/profile/data/type/BunkersProfile.kt @@ -0,0 +1,67 @@ +package cc.fyre.engine.profile.data.type + +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.profile.data.Profile +import java.util.* +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 17/12/2020 + * @author xanderume@gmail.com + */ +class BunkersProfile(uuid: UUID) : Profile(uuid,GameEngineAPI.GameMode.BUNKERS) { + + var normalWins = 0 + var normalLosses = 0 + + var rankedWins = 0 + var rankedLosses = 0 + + var totalWins = 0 + var totalLosses = 0 + + var kills = 0 + var deaths = 0 + + var playTime = 0L + var oresMined = 0 + + var gamesPlayed = 0 + + var oresTypeMined = HashMap() + var classPlayTime = HashMap() + + fun getOresMined(ore: Ore):Int { + return this.oresTypeMined[ore] ?: 0 + } + + fun getPrimaryClass():String { + + if (this.classPlayTime.isEmpty()) { + return "N/A" + } + + return PvPClass.values().associate{it to (this.classPlayTime[it] ?: 0L)}.entries.sortedByDescending{it.value}.firstOrNull()?.key?.displayName ?: "N/A" + } + + enum class Ore(val displayName: String) { + + COAL("COAL"), + IRON("Iron"), + GOLD("Gold"), + DIAMOND("Diamond"), + EMERALD("Emerald"), + + } + + enum class PvPClass(val displayName: String) { + + BARD("Bard"), + //ARCHER("Archer"), + DIAMOND("Diamond"), + + } + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/server/GameServerHandler.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/server/GameServerHandler.kt new file mode 100644 index 0000000..e20a863 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/server/GameServerHandler.kt @@ -0,0 +1,47 @@ +package cc.fyre.engine.server + +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.server.listener.GameServerListener +import cc.fyre.symbiote.Symbiote +import java.util.* + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GameServerHandler(private val instance: GameEngineAPI) { + + val cache = hashMapOf() + + init { + this.instance.databaseHandler.symbiote.addListener(GameServerListener(this.instance)) + } + + fun findById(id: String):GameServer? { + return this.cache[id.toLowerCase()] + } + + fun findLastGame(player: UUID):GameServer? { + return this.findLastGame(player,this.instance.mode) + } + + fun findLastGame(player: UUID,mode: GameEngineAPI.GameMode):GameServer? { + return this.cache.values.firstOrNull{it.mode == mode && it.players.contains(player) && !it.spectators.contains(player)} + } + + fun update(server: GameServer) { + this.instance.databaseHandler.symbiote.sendPacket(Symbiote(GameServer.UPDATE_ID,server)) + } + + fun findAvailableGames():MutableSet { + return this.cache.values.filter{it.isAvailable() && it.mode == this.instance.mode}.toMutableSet() + } + + fun findSpectatableGames():MutableSet { + return this.cache.values.filter{it.isInProgress() && it.mode == this.instance.mode && it.mode.spectatable}.toMutableSet() + } + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/server/data/GameServer.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/server/data/GameServer.kt new file mode 100644 index 0000000..e9dae46 --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/server/data/GameServer.kt @@ -0,0 +1,67 @@ +package cc.fyre.engine.server.data + +import cc.fyre.engine.GameEngineAPI +import com.google.gson.JsonObject +import com.google.gson.annotations.SerializedName +import java.util.* +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GameServer(@SerializedName("_id")val id: String,val port: Int,val mode: GameEngineAPI.GameMode) { + + var state = State.VOTING + var ranked = false + var players = hashSetOf() + var spectators = hashSetOf() + var disqualified = hashSetOf() + var lastHeartbeat = 0L + + val metadata = JsonObject() + + fun isOnline():Boolean { + return this.lastHeartbeat != 0L && (System.currentTimeMillis() - this.lastHeartbeat) < ONLINE_FAIL_SAFE + } + + fun isAvailable():Boolean { + return this.state == State.WAITING && this.isOnline() + } + + fun isInProgress():Boolean { + return this.state == State.IN_PROGRESS + } + + enum class State { + + // keep them in order + + WAITING, + VOTING, + COUNTDOWN, + IN_PROGRESS, + ENDING; + + fun isPastOrCurrently(state: State):Boolean { + return this.ordinal >= state.ordinal + } + + fun isBeforeOrCurrently(state: State):Boolean { + return this.ordinal <= state.ordinal + } + + } + + companion object { + + const val UPDATE_ID = "GAME_DATA_UPDATE" + const val DELETE_ID = "GAME_DATA_DELETE" + const val ONLINE_FAIL_SAFE = 5000L + + } + + +} \ No newline at end of file diff --git a/Engine/api/src/main/kotlin/cc/fyre/engine/server/listener/GameServerListener.kt b/Engine/api/src/main/kotlin/cc/fyre/engine/server/listener/GameServerListener.kt new file mode 100644 index 0000000..616e8bb --- /dev/null +++ b/Engine/api/src/main/kotlin/cc/fyre/engine/server/listener/GameServerListener.kt @@ -0,0 +1,35 @@ +package cc.fyre.engine.server.listener + +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.server.data.GameServer +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import com.google.gson.JsonObject + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GameServerListener(private val api: GameEngineAPI) : ParasiteListener { + + @Parasite(GameServer.UPDATE_ID) + fun onServerUpdate(data: JsonObject) { + + val server = this.api.gson.fromJson(data,GameServer::class.java) + + if (!this.api.gameServerHandler.cache.containsKey(server.id.toLowerCase())) { + this.api.gameServerHandler.cache[server.id.toLowerCase()] = server + return + } + + this.api.gameServerHandler.cache.replace(server.id.toLowerCase(),server) + } + + @Parasite(GameServer.DELETE_ID) + fun onServerDelete(data: JsonObject) { + this.api.gameServerHandler.cache.remove(data["_id"].asString.toLowerCase()) + } + +} \ No newline at end of file diff --git a/Engine/build.gradle b/Engine/build.gradle new file mode 100644 index 0000000..f8ec8dc --- /dev/null +++ b/Engine/build.gradle @@ -0,0 +1,31 @@ +allprojects { + group = 'cc.fyre.engine' + version = '1.0-SNAPSHOT' +} + +subprojects { + + repositories { + + flatDir { + dirs 'libs' + } + + mavenLocal() + mavenCentral() + } + + afterEvaluate { + + dependencies { + compileOnly fileTree(dir: 'libs', include: ['*.jar']) + } + + } + + tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + } + + +} diff --git a/Engine/game/build.gradle b/Engine/game/build.gradle new file mode 100644 index 0000000..0cc8914 --- /dev/null +++ b/Engine/game/build.gradle @@ -0,0 +1,50 @@ +plugins { + id "org.jetbrains.kotlin.jvm" version "1.5.0" + id "com.github.johnrengelman.shadow" version "5.2.0" +} + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() + archiveName = "engine-" + this.name + "-" + this.version + ".jar" +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + compile project(":api") + + compileOnly 'com.comphenix.protocol:ProtocolLib:4.4.0' + compileOnly "net.frozenorb:qLib:LATEST" + compileOnly 'cc.fyre:spigot-server:1.7.10-R0.1-SNAPSHOT' + compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.0" +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} diff --git a/Engine/game/build/classes/kotlin/main/META-INF/game.kotlin_module b/Engine/game/build/classes/kotlin/main/META-INF/game.kotlin_module new file mode 100644 index 0000000..70f0f69 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/META-INF/game.kotlin_module differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/GameEngine$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/GameEngine$Companion.class new file mode 100644 index 0000000..46287e8 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/GameEngine$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/GameEngine.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/GameEngine.class new file mode 100644 index 0000000..5b0bc4a Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/GameEngine.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/DisqualifieHandler$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/DisqualifieHandler$Companion.class new file mode 100644 index 0000000..2b8a70c Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/DisqualifieHandler$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/DisqualifieHandler.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/DisqualifieHandler.class new file mode 100644 index 0000000..1efd2d4 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/DisqualifieHandler.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/listener/DisqualifieListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/listener/DisqualifieListener.class new file mode 100644 index 0000000..526be6f Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/listener/DisqualifieListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/service/DisqualifieService.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/service/DisqualifieService.class new file mode 100644 index 0000000..2a9b418 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/disqualifie/service/DisqualifieService.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/GameHandler$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/GameHandler$Companion.class new file mode 100644 index 0000000..17160b1 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/GameHandler$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/GameHandler.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/GameHandler.class new file mode 100644 index 0000000..73ec8f3 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/GameHandler.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter$Companion.class new file mode 100644 index 0000000..f1858db Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter$DefaultGameAdapter.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter$DefaultGameAdapter.class new file mode 100644 index 0000000..e71f980 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter$DefaultGameAdapter.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter.class new file mode 100644 index 0000000..1b33c7a Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/GameAdapter.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/scoreboard/ScoreboardAdapter.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/scoreboard/ScoreboardAdapter.class new file mode 100644 index 0000000..86689dc Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/adapter/scoreboard/ScoreboardAdapter.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/command/ForceStartCommand.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/command/ForceStartCommand.class new file mode 100644 index 0000000..96a5bc5 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/command/ForceStartCommand.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/event/GameStateChangeEvent$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/event/GameStateChangeEvent$Companion.class new file mode 100644 index 0000000..62f04f3 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/event/GameStateChangeEvent$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/event/GameStateChangeEvent.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/event/GameStateChangeEvent.class new file mode 100644 index 0000000..529ca66 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/event/GameStateChangeEvent.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GameListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GameListener.class new file mode 100644 index 0000000..e9b1fc8 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GameListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GamePacketListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GamePacketListener.class new file mode 100644 index 0000000..d73cb85 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GamePacketListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GameStateListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GameStateListener.class new file mode 100644 index 0000000..99b0db1 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/listener/GameStateListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/nametag/GameNameTagAdapter.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/nametag/GameNameTagAdapter.class new file mode 100644 index 0000000..9c99e8d Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/nametag/GameNameTagAdapter.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/service/CountdownService.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/service/CountdownService.class new file mode 100644 index 0000000..83b5571 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/service/CountdownService.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/service/GameTimerService.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/service/GameTimerService.class new file mode 100644 index 0000000..3f2b95a Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/game/service/GameTimerService.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/listener/GeneralListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/listener/GeneralListener.class new file mode 100644 index 0000000..d4c8077 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/listener/GeneralListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/MapHandler$special$$inlined$sortedBy$1.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/MapHandler$special$$inlined$sortedBy$1.class new file mode 100644 index 0000000..2b8e19e Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/MapHandler$special$$inlined$sortedBy$1.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/MapHandler.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/MapHandler.class new file mode 100644 index 0000000..e51cdb1 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/MapHandler.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapIconCommand.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapIconCommand.class new file mode 100644 index 0000000..57db40f Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapIconCommand.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapLoadCommand.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapLoadCommand.class new file mode 100644 index 0000000..4be5258 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapLoadCommand.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapTPCommand.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapTPCommand.class new file mode 100644 index 0000000..f73a7f0 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/MapTPCommand.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/parameter/MapParameterProvider.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/parameter/MapParameterProvider.class new file mode 100644 index 0000000..1a050d9 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/command/parameter/MapParameterProvider.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/data/Map.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/data/Map.class new file mode 100644 index 0000000..e7bcdf5 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/data/Map.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/event/MapLoadEvent$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/event/MapLoadEvent$Companion.class new file mode 100644 index 0000000..4b85d1e Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/event/MapLoadEvent$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/event/MapLoadEvent.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/event/MapLoadEvent.class new file mode 100644 index 0000000..ed04c52 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/event/MapLoadEvent.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/listener/MapListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/listener/MapListener.class new file mode 100644 index 0000000..19fcd21 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/map/listener/MapListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/SpectateHandler.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/SpectateHandler.class new file mode 100644 index 0000000..276c91f Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/SpectateHandler.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/Item.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/Item.class new file mode 100644 index 0000000..7d5c73f Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/Item.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/SpectateMenu.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/SpectateMenu.class new file mode 100644 index 0000000..bad2cb3 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/SpectateMenu.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/TeleportMenu.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/TeleportMenu.class new file mode 100644 index 0000000..de13355 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/TeleportMenu.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/element/SpectateButton.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/element/SpectateButton.class new file mode 100644 index 0000000..9ec3057 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/element/SpectateButton.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/element/TeleportButton.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/element/TeleportButton.class new file mode 100644 index 0000000..669d3a6 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/menu/element/TeleportButton.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/LobbyItem.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/LobbyItem.class new file mode 100644 index 0000000..9492df5 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/LobbyItem.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/SpectateItem.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/SpectateItem.class new file mode 100644 index 0000000..c18497e Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/SpectateItem.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/TeleportItem.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/TeleportItem.class new file mode 100644 index 0000000..8e1c013 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/data/type/TeleportItem.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/listener/SpectateListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/listener/SpectateListener.class new file mode 100644 index 0000000..b9d1ac5 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/spectate/listener/SpectateListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/BungeeUtil.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/BungeeUtil.class new file mode 100644 index 0000000..2b4d30b Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/BungeeUtil.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/EnchantUtil.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/EnchantUtil.class new file mode 100644 index 0000000..dfc0827 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/EnchantUtil.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/FormatUtil.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/FormatUtil.class new file mode 100644 index 0000000..0ee625a Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/FormatUtil.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/PotionUtil.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/PotionUtil.class new file mode 100644 index 0000000..ef3ab4d Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/util/PotionUtil.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/VoteHandler$Companion.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/VoteHandler$Companion.class new file mode 100644 index 0000000..935ed87 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/VoteHandler$Companion.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/VoteHandler.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/VoteHandler.class new file mode 100644 index 0000000..220bf0f Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/VoteHandler.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/command/VoteCommand.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/command/VoteCommand.class new file mode 100644 index 0000000..6a3e46c Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/command/VoteCommand.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/listener/VoteListener.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/listener/VoteListener.class new file mode 100644 index 0000000..e00616f Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/listener/VoteListener.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/service/VoteService$run$$inlined$sortedByDescending$1.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/service/VoteService$run$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..78eae38 Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/service/VoteService$run$$inlined$sortedByDescending$1.class differ diff --git a/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/service/VoteService.class b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/service/VoteService.class new file mode 100644 index 0000000..9c230cb Binary files /dev/null and b/Engine/game/build/classes/kotlin/main/cc/fyre/engine/voting/service/VoteService.class differ diff --git a/Engine/game/build/kotlin/compileKotlin/build-history.bin b/Engine/game/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..aa7b6c9 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/build-history.bin differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..e8997af Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..631cd4c Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..3878c14 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..709f734 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..101cd74 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..48fd9ec Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..be10dbb Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..d6f3d17 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..b3482a8 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..62cf1e5 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..b9b5f4b Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..46f8922 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..f5266c3 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..d6f3d17 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..b3482a8 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..62cf1e5 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..5bbad5e Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..46f8922 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab new file mode 100644 index 0000000..761e0a6 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream new file mode 100644 index 0000000..2f8137b Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len new file mode 100644 index 0000000..7911e33 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len new file mode 100644 index 0000000..a9f80ae Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at new file mode 100644 index 0000000..2af40fb Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i new file mode 100644 index 0000000..8002d0a Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..be23c22 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..3739bb5 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..9d5b257 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..bff9925 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..8a52d33 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..2617f42 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..d6554b9 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..8281594 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..1dab4ab Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..6f80c14 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..31584e4 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..0544ef5 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..23ccb76 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..dd0e594 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..3878c14 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..709f734 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..51071c6 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..239e79b Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..1dbc6d7 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..8379808 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..78e8f3b Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..6f677df Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..b13067a Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..c5f98e9 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..b5cb182 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..37b0cc4 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..9196559 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..42df8b9 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..96e9115 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..fab913b Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..fcb34dd --- /dev/null +++ b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +43 +1 \ No newline at end of file diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..3680791 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..dd0e594 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..3878c14 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..709f734 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..956b516 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..818435c Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..921dcf9 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..c86230b Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..5b8e1ac Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..a123325 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..006f666 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..a243e51 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..4ca521f Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..e764b95 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..222e4f4 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..3eaf7c6 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values new file mode 100644 index 0000000..d4d4987 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..32d062e Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s new file mode 100644 index 0000000..e9d182f --- /dev/null +++ b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s @@ -0,0 +1 @@ +îq \ No newline at end of file diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..72b181f Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/Engine/game/build/kotlin/compileKotlin/last-build.bin b/Engine/game/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..882a783 Binary files /dev/null and b/Engine/game/build/kotlin/compileKotlin/last-build.bin differ diff --git a/Engine/game/build/libs/engine-game-1.0-SNAPSHOT.jar b/Engine/game/build/libs/engine-game-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..e95b4c9 Binary files /dev/null and b/Engine/game/build/libs/engine-game-1.0-SNAPSHOT.jar differ diff --git a/Engine/game/build/publications/shadow/pom-default.xml b/Engine/game/build/publications/shadow/pom-default.xml new file mode 100644 index 0000000..797da9b --- /dev/null +++ b/Engine/game/build/publications/shadow/pom-default.xml @@ -0,0 +1,8 @@ + + + 4.0.0 + cc.fyre.engine + game + 1.0-SNAPSHOT + + diff --git a/Engine/game/build/resources/main/config.yml b/Engine/game/build/resources/main/config.yml new file mode 100644 index 0000000..53b0af5 --- /dev/null +++ b/Engine/game/build/resources/main/config.yml @@ -0,0 +1 @@ +server-id: "Bunkers-01" \ No newline at end of file diff --git a/Engine/game/build/resources/main/plugin.yml b/Engine/game/build/resources/main/plugin.yml new file mode 100644 index 0000000..84a2e87 --- /dev/null +++ b/Engine/game/build/resources/main/plugin.yml @@ -0,0 +1,4 @@ +name: GameEngine +main: cc.fyre.engine.GameEngine +version: 1.0-SNAPSHOT +depend: [qLib,Kotlin] diff --git a/Engine/game/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml b/Engine/game/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml new file mode 100644 index 0000000..a7ace9b --- /dev/null +++ b/Engine/game/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml @@ -0,0 +1,12 @@ + + + cc.fyre.engine + game + + 1.0-SNAPSHOT + + 1.0-SNAPSHOT + + 20210829082618 + + diff --git a/Engine/game/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml b/Engine/game/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml new file mode 100644 index 0000000..2b7d803 --- /dev/null +++ b/Engine/game/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml @@ -0,0 +1,24 @@ + + + cc.fyre.engine + game + 1.0-SNAPSHOT + + + true + + 20210829082618 + + + pom + 1.0-SNAPSHOT + 20210829082618 + + + jar + 1.0-SNAPSHOT + 20210829082618 + + + + diff --git a/Engine/game/build/tmp/shadowJar/MANIFEST.MF b/Engine/game/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Engine/game/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/GameEngine.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/GameEngine.kt new file mode 100644 index 0000000..a1ff969 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/GameEngine.kt @@ -0,0 +1,64 @@ +package cc.fyre.engine + +import cc.fyre.engine.disqualifie.DisqualifieHandler +import cc.fyre.engine.game.GameHandler +import cc.fyre.engine.listener.GeneralListener +import cc.fyre.engine.map.MapHandler +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.spectate.SpectateHandler +import cc.fyre.engine.util.BungeeUtil +import cc.fyre.engine.voting.VoteHandler +import cc.fyre.symbiote.Symbiote +import org.bukkit.plugin.java.JavaPlugin + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GameEngine : JavaPlugin() { + + lateinit var api: GameEngineAPI + lateinit var mapHandler: MapHandler + lateinit var gameHandler: GameHandler + lateinit var voteHandler: VoteHandler + lateinit var spectateHandler: SpectateHandler + lateinit var disqualifieHandler: DisqualifieHandler + + override fun onEnable() { + instance = this + + this.api = GameEngineAPI(this.findGameMode()) + + this.mapHandler = MapHandler(this) + this.gameHandler = GameHandler(this) + this.voteHandler = VoteHandler(this) + this.spectateHandler = SpectateHandler(this) + this.disqualifieHandler = DisqualifieHandler(this) + + this.server.logger.info("[GameEngine] Loaded Game Engine on ${this.api.mode.displayName}.") + + this.server.messenger.registerOutgoingPluginChannel(this,BungeeUtil.PROXY_CHANNEL) + this.server.pluginManager.registerEvents(GeneralListener(this),this) + } + + override fun onDisable() { + this.mapHandler.dispose() + this.voteHandler.dispose() + + this.api.databaseHandler.symbiote.sendPacket(Symbiote(GameServer.DELETE_ID,this.gameHandler.server)) + this.api.dispose() + } + + private fun findGameMode():GameEngineAPI.GameMode { + return GameEngineAPI.GameMode.BUNKERS + } + + companion object { + + lateinit var instance: GameEngine + + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/DisqualifieHandler.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/DisqualifieHandler.kt new file mode 100644 index 0000000..243e785 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/DisqualifieHandler.kt @@ -0,0 +1,42 @@ +package cc.fyre.engine.disqualifie + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.disqualifie.listener.DisqualifieListener +import cc.fyre.engine.disqualifie.service.DisqualifieService +import java.util.* +import java.util.concurrent.TimeUnit +import kotlin.collections.HashMap +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class DisqualifieHandler(private val instance: GameEngine) { + + val cache = HashMap() + val service = DisqualifieService(this.instance) + + private val disqualified = HashSet() + + init { + this.instance.server.pluginManager.registerEvents(DisqualifieListener(this.instance),this.instance) + } + + fun disqualifie(uuid: UUID) { + this.disqualified.add(uuid) + this.instance.gameHandler.adapter.onGameDisqualifiePlayer(uuid) + } + + fun isDisqualified(uuid: UUID):Boolean { + return this.disqualified.contains(uuid) + } + + companion object { + + val DURATION = TimeUnit.MINUTES.toMillis(5L) + + } +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/listener/DisqualifieListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/listener/DisqualifieListener.kt new file mode 100644 index 0000000..064c3c2 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/listener/DisqualifieListener.kt @@ -0,0 +1,58 @@ +package cc.fyre.engine.disqualifie.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.event.GameStateChangeEvent +import cc.fyre.engine.server.data.GameServer +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class DisqualifieListener(private val instance: GameEngine):Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (this.instance.disqualifieHandler.cache.remove(event.player.uniqueId) != null) { + return + } + + if (!this.instance.disqualifieHandler.isDisqualified(event.player.uniqueId)) { + return + } + + this.instance.spectateHandler.addSpectator(event.player) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (this.instance.spectateHandler.isSpectating(event.player) || this.instance.disqualifieHandler.isDisqualified(event.player.uniqueId)) { + return + } + + this.instance.disqualifieHandler.cache[event.player.uniqueId] = System.currentTimeMillis() + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onGameStateChange(event: GameStateChangeEvent) { + + if (!this.instance.api.mode.disqualifies) { + return + } + + if (event.new != GameServer.State.IN_PROGRESS) { + return + } + + this.instance.disqualifieHandler.service.runTaskTimer(this.instance,20L,20L) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/service/DisqualifieService.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/service/DisqualifieService.kt new file mode 100644 index 0000000..addc06c --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/disqualifie/service/DisqualifieService.kt @@ -0,0 +1,31 @@ +package cc.fyre.engine.disqualifie.service + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.disqualifie.DisqualifieHandler +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class DisqualifieService(private val instance: GameEngine) : BukkitRunnable() { + + override fun run() { + + this.instance.disqualifieHandler.cache.entries.removeIf{ + + if (((it.value + DisqualifieHandler.DURATION) - System.currentTimeMillis()) > 0) { + return@removeIf false + } + + this.instance.gameHandler.players.remove(it.key) + this.instance.disqualifieHandler.disqualifie(it.key) + return@removeIf true + } + + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/GameHandler.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/GameHandler.kt new file mode 100644 index 0000000..54cbdde --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/GameHandler.kt @@ -0,0 +1,150 @@ +package cc.fyre.engine.game + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.adapter.GameAdapter +import cc.fyre.engine.game.command.ForceStartCommand +import cc.fyre.engine.game.event.GameStateChangeEvent +import cc.fyre.engine.game.listener.GameListener +import cc.fyre.engine.game.listener.GamePacketListener +import cc.fyre.engine.game.listener.GameStateListener +import cc.fyre.engine.game.nametag.GameNameTagAdapter +import cc.fyre.engine.game.service.CountdownService +import cc.fyre.engine.game.service.GameTimerService +import cc.fyre.engine.map.data.Map +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.voting.VoteHandler +import com.google.gson.JsonObject +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.nametag.FrozenNametagHandler +import org.bukkit.Bukkit +import org.bukkit.entity.Player +import java.util.* +import java.util.concurrent.TimeUnit +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 11/08/2020 + * @author xanderume@gmail.com + */ +class GameHandler(private val instance: GameEngine) { + + val server = GameServer( + this.instance.config.getString("server-id"), + Bukkit.getServer().port, + this.instance.api.mode + ) + + val players = HashSet() + + val service = GameTimerService(this.instance) + val countdownService = CountdownService(this.instance) + + var ranked = false + var lastLogout = 0L + + var adapter: GameAdapter = GameAdapter.DefaultGameAdapter() + + private var state = GameServer.State.WAITING + + lateinit var map: Map + lateinit var parties: ArrayList> + + init { + FrozenCommandHandler.registerClass(ForceStartCommand::class.java) + FrozenNametagHandler.registerProvider(GameNameTagAdapter(this.instance)) + + this.instance.server.scheduler.runTaskTimerAsynchronously(this.instance,{this.update()},40L,40L) + this.instance.server.pluginManager.registerEvents(GameListener(this.instance),this.instance) + this.instance.server.pluginManager.registerEvents(GameStateListener(this.instance),this.instance) + + this.instance.api.databaseHandler.symbiote.addListener(GamePacketListener(this.instance)) + } + + fun getState():GameServer.State { + return this.state + } + + fun setState(state: GameServer.State) { + + if (this.state == state) { + return + } + + this.instance.server.pluginManager.callEvent(GameStateChangeEvent(this.state,state)) + this.state = state + return + } + + private fun update() { + this.server.state = this.state + this.server.ranked = this.ranked + this.server.players = this.players + this.server.spectators = this.instance.spectateHandler.cache + this.server.disqualified = this.players.filter{this.instance.disqualifieHandler.isDisqualified(it)}.toHashSet() + this.server.lastHeartbeat = System.currentTimeMillis() + + if (this.instance.api.mode.mapBased && this.state.isPastOrCurrently(GameServer.State.COUNTDOWN)) { + this.server.metadata.addProperty("map",this.map.id) + } + + this.instance.api.gameServerHandler.update(this.server) + } + + fun addMetadata(jsonObject: JsonObject) { + jsonObject.entrySet().forEach{this.server.metadata.add(it.key,it.value)} + } + + fun addPlayer(player: Player) { + this.players.add(player.uniqueId) + this.adapter.onGameAddPlayer(player) + } + + fun removePlayer(player: Player) { + this.players.remove(player.uniqueId) + this.adapter.onGameRemovePlayer(player) + } + + fun getGameTime():Long { + + if (this.service.started == 0L) { + return 0L + } + + return System.currentTimeMillis() - this.service.started + } + + fun getVotingTime():Long { + + if (this.instance.voteHandler.service.started == 0L) { + return VoteHandler.VOTING_SECONDS * 1000L + } + + return (this.instance.voteHandler.service.started + VoteHandler.VOTING_SECONDS * 1000L) - System.currentTimeMillis() + } + + fun getCountdownTime():Long { + + if (this.countdownService.started == 0L) { + return VoteHandler.VOTING_SECONDS * 1000L + } + + return (this.countdownService.started + COUNTDOWN_SECONDS * 1000L) - System.currentTimeMillis() + } + + fun isPlaying(player: Player):Boolean { + return this.players.contains(player.uniqueId) + } + + fun getPlayers():MutableSet { + return this.players.mapNotNull{this.instance.server.getPlayer(it)}.toMutableSet() + } + + companion object { + + const val COUNTDOWN_SECONDS = 15 + + val AUTO_END_GAME_TIME = TimeUnit.MINUTES.toMillis(5L) + } +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/adapter/GameAdapter.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/adapter/GameAdapter.kt new file mode 100644 index 0000000..2a5512e --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/adapter/GameAdapter.kt @@ -0,0 +1,62 @@ +package cc.fyre.engine.game.adapter + +import cc.fyre.engine.game.adapter.scoreboard.ScoreboardAdapter +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.nametag.NametagInfo +import net.minecraft.util.org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 12/08/2020 + * @author xanderume@gmail.com + */ +interface GameAdapter { + + fun onTick(seconds: Int) + fun onGameFinish() + fun onGameFinishUpdateProfiles() + + fun onPlayersSent(players: ArrayList) + + fun onGameAddPlayer(player: Player) + fun onGameRemovePlayer(player: Player) + fun onGameAddSpectator(player: Player) + fun onGameDisqualifiePlayer(uuid: UUID) + + fun getNameTag(player: Player,target: Player): NametagInfo? + fun getScoreboardAdapters():HashMap + + fun getEndGameData():Game? + + class DefaultGameAdapter : GameAdapter { + + override fun onTick(seconds: Int) {} + override fun onGameFinish() {} + override fun onGameFinishUpdateProfiles() {} + + override fun onPlayersSent(players: ArrayList) {} + + override fun onGameAddPlayer(player: Player) {} + override fun onGameRemovePlayer(player: Player) {} + override fun onGameAddSpectator(player: Player) {} + override fun onGameDisqualifiePlayer(uuid: UUID) {} + + override fun getNameTag(player: Player, target: Player):NametagInfo? = null + override fun getScoreboardAdapters(): HashMap = hashMapOf() + + override fun getEndGameData(): Game? = null + } + + companion object { + + val SCOREBOARD_LINE = "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",20)}" + + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/adapter/scoreboard/ScoreboardAdapter.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/adapter/scoreboard/ScoreboardAdapter.kt new file mode 100644 index 0000000..8e6c90f --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/adapter/scoreboard/ScoreboardAdapter.kt @@ -0,0 +1,11 @@ +package cc.fyre.engine.game.adapter.scoreboard + +import net.frozenorb.qlib.scoreboard.ScoreGetter +import net.frozenorb.qlib.scoreboard.TitleGetter + +interface ScoreboardAdapter { + + fun getTitleGetter(): TitleGetter + fun getScoreGetter(): ScoreGetter + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/command/ForceStartCommand.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/command/ForceStartCommand.kt new file mode 100644 index 0000000..5eee50c --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/command/ForceStartCommand.kt @@ -0,0 +1,30 @@ +package cc.fyre.engine.game.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +/** + * @project engine + * + * @date 16/08/2020 + * @author xanderume@gmail.com + */ +object ForceStartCommand { + + @JvmStatic + @Command(names = ["forcestart"],hidden = true,permission = "bunkers.command.forcestart") + fun execute(sender: CommandSender) { + + if (GameEngine.instance.gameHandler.getState().isPastOrCurrently(GameServer.State.IN_PROGRESS)) { + sender.sendMessage("${ChatColor.RED}The game has already started!") + return + } + + GameEngine.instance.gameHandler.setState(GameServer.State.COUNTDOWN) + GameEngine.instance.gameHandler.setState(GameServer.State.IN_PROGRESS) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/event/GameStateChangeEvent.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/event/GameStateChangeEvent.kt new file mode 100644 index 0000000..71bb4d0 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/event/GameStateChangeEvent.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.game.event + +import cc.fyre.engine.server.data.GameServer +import org.bukkit.event.Cancellable +import org.bukkit.event.Event +import org.bukkit.event.HandlerList +/** + * @project bunkers + * + * @date 09/08/2020 + * @author xanderume@gmail.com + */ +class GameStateChangeEvent(val previous: GameServer.State,val new: GameServer.State):Event(),Cancellable { + + private var cancelled = false + + override fun isCancelled(): Boolean { + return this.cancelled + } + + override fun setCancelled(cancelled: Boolean) { + this.cancelled = cancelled + } + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GameListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GameListener.kt new file mode 100644 index 0000000..a8b8d90 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GameListener.kt @@ -0,0 +1,61 @@ +package cc.fyre.engine.game.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.scoreboard.FrozenScoreboardHandler +import net.frozenorb.qlib.scoreboard.ScoreboardConfiguration + +import org.bukkit.GameMode +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project engine + * + * @date 12/08/2020 + * @author xanderume@gmail.com + */ +class GameListener(private val instance: GameEngine) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (FrozenScoreboardHandler.getConfiguration() == null && this.instance.gameHandler.adapter.getScoreboardAdapters()[this.instance.gameHandler.getState()] != null) { + + val configuration = ScoreboardConfiguration() + + configuration.titleGetter = this.instance.gameHandler.adapter.getScoreboardAdapters()[this.instance.gameHandler.getState()]!!.getTitleGetter() + configuration.scoreGetter = this.instance.gameHandler.adapter.getScoreboardAdapters()[this.instance.gameHandler.getState()]!!.getScoreGetter() + + FrozenScoreboardHandler.setConfiguration(configuration) + } + + if (!this.instance.gameHandler.getState().isBeforeOrCurrently(GameServer.State.COUNTDOWN)) { + return + } + + if (GameEngine.instance.api.mode.mapBased && this.instance.gameHandler.getState() == GameServer.State.WAITING) { + this.instance.gameHandler.setState(GameServer.State.VOTING) + } + + event.player.health = event.player.maxHealth + event.player.foodLevel = 20 + event.player.gameMode = GameMode.ADVENTURE + event.player.inventory.clear() + event.player.inventory.armorContents = null + event.player.activePotionEffects.forEach{event.player.removePotionEffect(it.type)} + + event.player.teleport(this.instance.voteHandler.world.spawnLocation.add(0.5,0.0,0.5)) + + this.instance.gameHandler.addPlayer(event.player) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.gameHandler.lastLogout = System.currentTimeMillis() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GamePacketListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GamePacketListener.kt new file mode 100644 index 0000000..246dcf0 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GamePacketListener.kt @@ -0,0 +1,64 @@ +package cc.fyre.engine.game.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.symbiote.Symbiote +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import com.google.gson.JsonObject +import org.bukkit.Bukkit +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class GamePacketListener(private val instance: GameEngine):ParasiteListener { + + @Parasite(GameEngineAPI.GAME_DATA_PACKET) + fun onPartyData(data: JsonObject) { + + if (GameEngine.instance.gameHandler.server.id != data["_id"].asString) { + return + } + + if (GameEngineAPI.GameMode.valueOf(data["mode"].asString) != this.instance.api.mode) { + return + } + + + this.instance.gameHandler.ranked = data["ranked"].asBoolean + this.instance.gameHandler.parties = this.instance.api.gson.fromJson>>(data["parties"].asString,List::class.java).map{list -> list.map{value -> UUID.fromString(value)}.toCollection(ArrayList())}.toCollection(ArrayList()) + + // We received the data, now send a packet back to the lobby informing to send the players to the game. + + val payload = JsonObject() + + payload.addProperty("_id",GameEngine.instance.gameHandler.server.id) + payload.addProperty("mode",this.instance.api.mode.name) + payload.addProperty("players",this.instance.api.gson.toJson(this.instance.gameHandler.parties.flatten())) + + Bukkit.getServer().scheduler.runTaskAsynchronously(this.instance) { + GameEngine.instance.api.databaseHandler.symbiote.sendPacket(Symbiote(GameEngineAPI.GAME_SEND_PACKET,payload)) + } + + } + + @Parasite(GameEngineAPI.GAME_SENT_PACKET) + fun onPartySent(data: JsonObject) { + + if (GameEngine.instance.gameHandler.server.id != data["_id"].asString) { + return + } + + if (GameEngineAPI.GameMode.valueOf(data["mode"].asString) != this.instance.api.mode) { + return + } + + this.instance.gameHandler.adapter.onPlayersSent(this.instance.api.gson.fromJson>(data["players"].asString,List::class.java).map{UUID.fromString(it)}.toCollection(ArrayList())) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GameStateListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GameStateListener.kt new file mode 100644 index 0000000..ad28c06 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/listener/GameStateListener.kt @@ -0,0 +1,127 @@ +package cc.fyre.engine.game.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.game.event.GameStateChangeEvent +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.util.BungeeUtil +import cc.fyre.symbiote.parasite.ParasiteListener +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.scoreboard.FrozenScoreboardHandler +import net.frozenorb.qlib.scoreboard.ScoreboardConfiguration +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.GameMode +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import java.util.* + +/** + * @project engine + * + * @date 12/08/2020 + * @author xanderume@gmail.com + */ +class GameStateListener(private val instance: GameEngine) : Listener,ParasiteListener { + + init { + this.instance.api.databaseHandler.symbiote.addListener(this) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onStateVoting(event: GameStateChangeEvent) { + + if (event.new != GameServer.State.VOTING) { + return + } + + this.instance.voteHandler.service.runTaskTimer(this.instance,20L,20L) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onStateCountdown(event: GameStateChangeEvent) { + + if (event.new != GameServer.State.COUNTDOWN) { + return + } + + if (event.previous == GameServer.State.VOTING) { + + val map = this.instance.gameHandler.map + val votes = this.instance.voteHandler.getVotes(map) + + this.instance.mapHandler.copyAndLoadMap(map) + this.instance.gameHandler.getPlayers().forEach{it.inventory.clear()} + this.instance.server.broadcastMessage(" ") + this.instance.server.broadcastMessage("${this.instance.api.mode.prefix}${ChatColor.WHITE} Map ${ChatColor.GOLD}${map.id}${ChatColor.WHITE} has won with ${ChatColor.GOLD}${this.instance.voteHandler.getVotes(map)} vote${if (votes == 1) "" else "s"}${ChatColor.WHITE}.") + this.instance.server.broadcastMessage(" ") + } + + this.instance.gameHandler.countdownService.runTaskTimer(this.instance,20L,20L) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onStateInProgress(event: GameStateChangeEvent) { + + if (event.new != GameServer.State.IN_PROGRESS) { + return + } + + this.instance.gameHandler.service.runTaskTimer(this.instance,20L,20L) + this.instance.gameHandler.getPlayers().forEach{it.gameMode = GameMode.SURVIVAL} + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onGameStateChange(event: GameStateChangeEvent) { + + if (event.previous == event.new) { + return + } + + val adapter = this.instance.gameHandler.adapter.getScoreboardAdapters()[event.new] ?: return + val configuration = ScoreboardConfiguration() + + configuration.titleGetter = adapter.getTitleGetter() + configuration.scoreGetter = adapter.getScoreGetter() + + FrozenScoreboardHandler.setConfiguration(configuration) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onGameStateEnding(event: GameStateChangeEvent) { + + if (event.new != GameServer.State.ENDING) { + return + } + + this.instance.gameHandler.adapter.onGameFinish() + + this.instance.server.scheduler.runTaskLaterAsynchronously(this.instance,{ + this.instance.gameHandler.adapter.onGameFinishUpdateProfiles() + },20L) + + val data = this.instance.gameHandler.adapter.getEndGameData() + + if (data != null) { + data.ranked = this.instance.gameHandler.ranked + + Bukkit.getServer().scheduler.runTaskAsynchronously(this.instance) { + this.instance.api.gameDataHandler.update(data) + } + + } + + this.instance.server.scheduler.runTaskLater(this.instance,{ + + Bukkit.getServer().onlinePlayers.forEach{ + // We have to teleport all the players to a different world before we can delete the world + it.teleport(Bukkit.getServer().worlds[0].spawnLocation) + BungeeUtil.sendToServer(it,GameEngine.instance.api.mode.lobbyServer) + } + + this.instance.server.shutdown() + },10*20L) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/nametag/GameNameTagAdapter.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/nametag/GameNameTagAdapter.kt new file mode 100644 index 0000000..20d0aa1 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/nametag/GameNameTagAdapter.kt @@ -0,0 +1,27 @@ +package cc.fyre.engine.game.nametag + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.nametag.NametagInfo +import net.frozenorb.qlib.nametag.NametagProvider +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class GameNameTagAdapter(private val instance: GameEngine) : NametagProvider("Bunkers Nametags",1) { + + + override fun fetchNametag(player: Player,target: Player):NametagInfo { + + if (this.instance.spectateHandler.isSpectating(player)) { + return createNametag(ChatColor.GRAY.toString(),"") + } + + return this.instance.gameHandler.adapter.getNameTag(player,target) ?: createNametag(ChatColor.RED.toString(),"") + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/service/CountdownService.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/service/CountdownService.kt new file mode 100644 index 0000000..8ee047f --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/service/CountdownService.kt @@ -0,0 +1,40 @@ +package cc.fyre.engine.game.service + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.GameHandler +import cc.fyre.engine.server.data.GameServer +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project engine + * + * @date 11/08/2020 + * @author xanderume@gmail.com + */ +class CountdownService(private val instance: GameEngine) : BukkitRunnable() { + + var started = 0L + var remaining = AtomicInteger(GameHandler.COUNTDOWN_SECONDS) + + override fun run() { + + if (this.started == 0L) { + this.started = System.currentTimeMillis() + } + + if (this.remaining.get() == 15 || this.remaining.get() == 10 || this.remaining.get() in 1..5) { + this.instance.server.broadcastMessage("${this.instance.api.mode.prefix} ${ChatColor.WHITE}Game starts in ${ChatColor.GOLD}${this.remaining.get()} second${if (this.remaining.get() == 1) "" else "s"}${ChatColor.WHITE}.") + } + + if (this.remaining.get() <= 0) { + this.cancel() + this.instance.gameHandler.setState(GameServer.State.IN_PROGRESS) + return + } + + this.remaining.decrementAndGet() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/game/service/GameTimerService.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/game/service/GameTimerService.kt new file mode 100644 index 0000000..3d94590 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/game/service/GameTimerService.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.game.service + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.GameHandler +import org.bukkit.scheduler.BukkitRunnable +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project engine + * + * @date 12/08/2020 + * @author xanderume@gmail.com + */ +class GameTimerService(private val instance: GameEngine) : BukkitRunnable() { + + var time = AtomicInteger() + var started = 0L + + override fun run() { + + if (this.started == 0L) { + this.started = System.currentTimeMillis() + } + + if ((this.instance.gameHandler.lastLogout != 0L && (((this.instance.gameHandler.lastLogout + GameHandler.AUTO_END_GAME_TIME) - System.currentTimeMillis()) <= 0)) && this.instance.gameHandler.getPlayers().isEmpty()) { + this.instance.server.shutdown() + return + } + + this.instance.gameHandler.adapter.onTick(this.time.incrementAndGet()) + } + +} diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/listener/GeneralListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/listener/GeneralListener.kt new file mode 100644 index 0000000..1a7172c --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/listener/GeneralListener.kt @@ -0,0 +1,92 @@ +package cc.fyre.engine.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import org.bukkit.entity.EnderPearl +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockIgniteEvent +import org.bukkit.event.block.LeavesDecayEvent +import org.bukkit.event.entity.* +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent +import org.bukkit.event.weather.WeatherChangeEvent + +/** + * @project engine + * + * @date 12/08/2020 + * @author xanderume@gmail.com + */ +class GeneralListener(private val instance: GameEngine):Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockIgnite(event: BlockIgniteEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onLeavesDecay(event: LeavesDecayEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onCreeperPower(event: CreeperPowerEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityExplode(event: EntityExplodeEvent) { + event.blockList().clear() + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onExplosionPrime(event: ExplosionPrimeEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onWeatherChange(event: WeatherChangeEvent) { + event.world.time = 6000 + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (this.instance.gameHandler.getState() == GameServer.State.IN_PROGRESS) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onFoodLevelChange(event: FoodLevelChangeEvent) { + + if (this.instance.gameHandler.getState() == GameServer.State.IN_PROGRESS) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDeath(event: PlayerDeathEvent) { + event.entity.world.getEntitiesByClass(EnderPearl::class.java).filter{it.shooter != null && it.shooter is Player && (it.shooter as Player).uniqueId == event.entity.uniqueId}.forEach{it.remove()} + } + + @EventHandler(priority = EventPriority.LOW) + private fun onJoin(event: PlayerJoinEvent) { + event.joinMessage = null + } + + @EventHandler(priority = EventPriority.LOW) + private fun onQuit(event: PlayerQuitEvent) { + event.quitMessage = null + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/MapHandler.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/MapHandler.kt new file mode 100644 index 0000000..3891253 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/MapHandler.kt @@ -0,0 +1,109 @@ +package cc.fyre.engine.map + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.map.command.MapIconCommand +import cc.fyre.engine.map.command.MapLoadCommand +import cc.fyre.engine.map.command.MapTPCommand +import cc.fyre.engine.map.command.parameter.MapParameterProvider +import cc.fyre.engine.map.data.Map +import cc.fyre.engine.map.event.MapLoadEvent +import cc.fyre.engine.map.listener.MapListener + +import com.google.gson.JsonSyntaxException +import com.mongodb.client.model.Filters +import com.mongodb.client.model.UpdateOptions +import com.mongodb.client.result.UpdateResult +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.qLib +import net.minecraft.util.org.apache.commons.io.FileUtils +import org.bson.Document +import org.bukkit.World +import org.bukkit.WorldCreator +import java.io.File +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class MapHandler(private val instance: GameEngine) { + + val cache = HashSet() + val container = File("${GameEngineAPI.PARENT_DIRECTORY.path}/${this.instance.api.mode.name.toLowerCase()}/maps") + val collection = this.instance.api.databaseHandler.mongoDB.getCollection("maps") + + init { + + FrozenCommandHandler.registerClass(MapTPCommand::class.java) + FrozenCommandHandler.registerClass(MapIconCommand::class.java) + FrozenCommandHandler.registerClass(MapLoadCommand::class.java) + FrozenCommandHandler.registerParameterType(Map::class.java,MapParameterProvider()) + + if (!this.container.exists()) { + this.container.mkdirs() + } + + for (file in this.container.listFiles()?.filterNotNull()?.filter{it.isDirectory}!!.sortedBy{it.name.length}) { + + val map: Map + val document = this.collection.find(Filters.eq("_id",file.name)).first() + + if (document == null) { + + map = Map(file.name) + + if (!this.update(map).wasAcknowledged()) { + this.instance.logger.info("Failed to create Map ${file.name}.") + continue + } + + this.cache.add(map) + this.instance.logger.info("Created new Map ${map.id}.") + continue + } + + try { + map = qLib.GSON.fromJson(document.toJson(GameEngineAPI.JSON_WRITER_SETTINGS),Map::class.java) + } catch (ex: JsonSyntaxException) { + this.instance.logger.info("Failed to load Map ${file.name}.") + continue + } + + this.cache.add(map) + this.instance.logger.info("Loaded Map ${map.id}.") + } + + this.instance.server.pluginManager.registerEvents(MapListener(this.instance),this.instance) + } + + fun dispose() { + this.cache.mapNotNull{this.instance.server.getWorld(it.id)}.forEach{this.deleteWorld(it)} + } + + fun findById(id: String):Map? { + return this.cache.firstOrNull{it.id.equals(id,true)} + } + + fun update(map: Map):UpdateResult { + return this.collection.updateOne(Document("_id",map.id),Document("\$set",Document.parse(qLib.GSON.toJson(map))),UpdateOptions().upsert(true)) + } + + fun deleteWorld(world: World) { + this.instance.server.unloadWorld(world,true) + FileUtils.deleteDirectory(world.worldFolder) + } + + fun copyAndLoadMap(map: Map):World { + FileUtils.copyDirectory(map.getContainer(),File("${this.instance.server.worldContainer.path}/${map.id}")) + + val world = this.instance.server.createWorld(WorldCreator.name(map.id)) + + this.instance.server.pluginManager.callEvent(MapLoadEvent(map,world)) + + return world + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapIconCommand.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapIconCommand.kt new file mode 100644 index 0000000..19476f5 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapIconCommand.kt @@ -0,0 +1,34 @@ +package cc.fyre.engine.map.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack + +/** + * @project engine + * + * @date 16/08/2020 + * @author xanderume@gmail.com + */ +object MapIconCommand { + + @JvmStatic + @Command(names = ["map icon","map seticon"],hidden = true,async = true,permission = "bunkers.command.map.icon") + fun execute(player: Player,@Param(name = "map")map: Map) { + + map.icon = if (player.itemInHand == null || player.itemInHand.type == Material.AIR) ItemStack(Material.GRASS) else player.itemInHand.clone() + + if (!GameEngine.instance.mapHandler.update(map).wasAcknowledged()) { + player.sendMessage("${ChatColor.RED}Failed to update map data..") + return + } + + player.sendMessage("${ChatColor.YELLOW}Updated icon for map ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}.") + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapLoadCommand.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapLoadCommand.kt new file mode 100644 index 0000000..bcb42ad --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapLoadCommand.kt @@ -0,0 +1,38 @@ +package cc.fyre.engine.map.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 16/08/2020 + * @author xanderume@gmail.com + */ +object MapLoadCommand { + + @JvmStatic + @Command(names = ["map load"],hidden = true,permission = "bunkers.command.map.load") + fun execute(sender: CommandSender,@Param(name = "map")map: Map) { + + if (GameEngine.instance.server.getWorld(map.id) != null) { + sender.sendMessage("${ChatColor.RED}Map ${map.id} has already been loaded.") + return + } + + sender.sendMessage("${ChatColor.YELLOW}Loading map ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}..") + + if (sender !is Player) { + GameEngine.instance.mapHandler.copyAndLoadMap(map) + return + } + + sender.teleport(GameEngine.instance.mapHandler.copyAndLoadMap(map).spawnLocation) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapTPCommand.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapTPCommand.kt new file mode 100644 index 0000000..7840f91 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/MapTPCommand.kt @@ -0,0 +1,27 @@ +package cc.fyre.engine.map.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +object MapTPCommand { + + @JvmStatic + @Command(names = ["map tp"],hidden = true,permission = "bunkers.command.map.tp") + fun execute(sender: Player,@Param(name = "map")map: Map) { + + val world = map.getWorld() + + if (world == null) { + sender.sendMessage("${ChatColor.RED}Map \"${map.id}\" has not been loaded, use /map load ${map.id} to load the map.") + return + } + + sender.sendMessage("${ChatColor.YELLOW}Teleporting to map ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}..") + sender.teleport(GameEngine.instance.mapHandler.copyAndLoadMap(map).spawnLocation) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/parameter/MapParameterProvider.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/parameter/MapParameterProvider.kt new file mode 100644 index 0000000..d492941 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/command/parameter/MapParameterProvider.kt @@ -0,0 +1,38 @@ +package cc.fyre.engine.map.command.parameter + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.map.data.Map +import net.frozenorb.qlib.command.ParameterType +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 13/08/2020 + * @author xanderume@gmail.com + */ +class MapParameterProvider : ParameterType { + + override fun transform(sender: CommandSender, source: String): Map? { + + val toReturn = if (sender is Player && source.equals("current",true)) GameEngine.instance.mapHandler.findById(sender.world.name) else GameEngine.instance.mapHandler.findById(source) + + if (sender is Player && source.equals("current",true) && toReturn != null) { + return toReturn + } + + if (toReturn == null) { + sender.sendMessage("${ChatColor.RED}Map ${ChatColor.YELLOW}$source ${ChatColor.RED} not found.") + return null + } + + return toReturn + } + + override fun tabComplete(player: Player, flags: Set, source: String): List { + return arrayListOf() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/data/Map.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/data/Map.kt new file mode 100644 index 0000000..09ce82b --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/data/Map.kt @@ -0,0 +1,31 @@ +package cc.fyre.engine.map.data + +import cc.fyre.engine.GameEngine +import com.google.gson.annotations.Expose +import com.google.gson.annotations.SerializedName +import org.bukkit.Bukkit + +import org.bukkit.Material +import org.bukkit.World +import org.bukkit.inventory.ItemStack +import java.io.File + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class Map(@SerializedName("_id")val id: String) { + + var icon = ItemStack(Material.GRASS) + + fun getWorld():World? { + return Bukkit.getServer().getWorld(this.id) + } + + fun getContainer():File { + return File("${GameEngine.instance.mapHandler.container.path}/${this.id}") + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/event/MapLoadEvent.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/event/MapLoadEvent.kt new file mode 100644 index 0000000..66606c4 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/event/MapLoadEvent.kt @@ -0,0 +1,24 @@ +package cc.fyre.engine.map.event + +import cc.fyre.engine.map.data.Map +import org.bukkit.World +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class MapLoadEvent(val map: Map,val world: World):Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/map/listener/MapListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/map/listener/MapListener.kt new file mode 100644 index 0000000..773dee6 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/map/listener/MapListener.kt @@ -0,0 +1,28 @@ +package cc.fyre.engine.map.listener + +import cc.fyre.engine.GameEngine +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.world.WorldInitEvent + +/** + * @project engine + * + * @date 11/08/2020 + * @author xanderume@gmail.com + */ +class MapListener(private val instance: GameEngine) : Listener { + + @EventHandler(priority = EventPriority.HIGHEST) + private fun onWorldInit(event: WorldInitEvent) { + + if (this.instance.mapHandler.findById(event.world.name) == null) { + return + } + + event.world.keepSpawnInMemory = false + } + + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/SpectateHandler.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/SpectateHandler.kt new file mode 100644 index 0000000..5158c7c --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/SpectateHandler.kt @@ -0,0 +1,103 @@ +package cc.fyre.engine.spectate + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.spectate.listener.SpectateListener +import cc.fyre.engine.spectate.data.Item +import cc.fyre.engine.spectate.data.type.LobbyItem +import cc.fyre.engine.spectate.data.type.SpectateItem +import cc.fyre.engine.spectate.data.type.TeleportItem +import org.bukkit.GameMode + +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import java.util.* +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class SpectateHandler(private val instance: GameEngine) { + + val cache = HashSet() + + private val items = HashSet() + + init { + this.items.add(LobbyItem()) + this.items.add(TeleportItem()) + this.items.add(SpectateItem()) + + this.instance.server.pluginManager.registerEvents(SpectateListener(this.instance),this.instance) + } + + fun addItem(item: Item) { + this.items.add(item) + } + + fun isSpectating(uuid: UUID):Boolean { + return this.cache.contains(uuid) + } + + fun isSpectating(player: Player):Boolean { + return this.cache.contains(player.uniqueId) + } + + fun addSpectator(player: Player) { + this.cache.add(player.uniqueId) + + this.instance.gameHandler.adapter.onGameAddSpectator(player) + + this.instance.server.scheduler.runTaskLater(this.instance,{ + + if (!player.isOnline) { + return@runTaskLater + } + + player.allowFlight = true + player.isFlying = true + player.gameMode = GameMode.CREATIVE + player.inventory.armorContents = null + player.inventory.clear() + + this.instance.server.onlinePlayers.filter{!this.instance.spectateHandler.isSpectating(it)}.forEach{it.hidePlayer(player)} + + this.items.filter{it.hasPermission(player)}.forEach{player.inventory.setItem(it.getSlot(player),it.getItem(player))} + + player.updateInventory() + },5L) + + this.instance.logger.info("${player.name} has been added as a spectator.") + } + + fun removeSpectator(player: Player) { + player.inventory.clear() + + this.cache.remove(player.uniqueId) + this.instance.logger.info("${player.name} has been removed from spectating.") + } + + fun getSpectators():MutableSet { + return this.cache.mapNotNull{this.instance.server.getPlayer(it)}.toMutableSet() + } + + fun refreshItems(player: Player) { + this.refreshItems(player,true) + } + + fun refreshItems(player: Player,clear: Boolean) { + + if (clear) { + player.inventory.clear() + } + + this.items.filter{it.hasPermission(player)}.forEach{player.inventory.setItem(it.getSlot(player),it.getItem(player))} + } + + fun findItemByItemStack(itemStack: ItemStack, player: Player):Item? { + return this.items.firstOrNull{it.isSimilar(player,itemStack)} + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/Item.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/Item.kt new file mode 100644 index 0000000..90ae144 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/Item.kt @@ -0,0 +1,46 @@ +package cc.fyre.engine.spectate.data + +import org.bukkit.Bukkit +import org.bukkit.entity.Player + +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +abstract class Item { + + abstract fun getSlot(player: Player):Int + abstract fun getItem(player: Player):ItemStack + abstract fun onInteract(event: PlayerInteractEvent) + + open fun hasPermission(player: Player) = true + + fun isSimilar(player: Player,stack: ItemStack?): Boolean { + + if (stack == null) { + return false + } + + val created = this.getItem(player) + + if (stack.typeId != created.typeId) { + return false + } + + if (stack.hasItemMeta() != created.hasItemMeta()) { + return false + } + + if (!Bukkit.getServer().itemFactory.equals(stack.itemMeta,created.itemMeta)) { + return false + } + + return true + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/SpectateMenu.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/SpectateMenu.kt new file mode 100644 index 0000000..cff4fdb --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/SpectateMenu.kt @@ -0,0 +1,37 @@ +package cc.fyre.engine.spectate.data.menu + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.spectate.data.menu.element.SpectateButton +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.pagination.PaginatedMenu +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +class SpectateMenu : PaginatedMenu() { + + override fun getPrePaginatedTitle(p0: Player?): String { + return "Spectatable Games" + } + + override fun getAllPagesButtons(p0: Player?): HashMap { + return GameEngine.instance.api.gameServerHandler.findSpectatableGames() + .filter{it.id != GameEngine.instance.gameHandler.server.id} + .withIndex() + .associate{it.index to SpectateButton(it.value)} + .toMap(HashMap()) + } + + override fun getMaxItemsPerPage(player: Player): Int { + return 9 + } + + override fun isAutoUpdate(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/TeleportMenu.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/TeleportMenu.kt new file mode 100644 index 0000000..a4afb01 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/TeleportMenu.kt @@ -0,0 +1,28 @@ +package cc.fyre.engine.spectate.data.menu + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.spectate.data.menu.element.TeleportButton +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +class TeleportMenu : Menu() { + + override fun getTitle(player: Player): String { + return "Teleport" + } + + override fun getButtons(p0: Player?): MutableMap { + return GameEngine.instance.gameHandler.getPlayers() + .withIndex() + .associate{it.index to TeleportButton(it.value)} + .toMutableMap() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/element/SpectateButton.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/element/SpectateButton.kt new file mode 100644 index 0000000..142e3a0 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/element/SpectateButton.kt @@ -0,0 +1,69 @@ +package cc.fyre.engine.spectate.data.menu.element + +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.util.BungeeUtil +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.TimeUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType + +/** + * @project engine + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +class SpectateButton(private val server: GameServer) : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.GOLD}${ChatColor.BOLD}${server.id}" + } + + override fun getMaterial(p0: Player?): Material { + return Material.WATCH + } + + override fun getDescription(player: Player): MutableList { + + val lore = ArrayList() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + lore.add("${ChatColor.YELLOW}Time: ${ChatColor.RED}${TimeUtils.formatIntoHHMMSS(server.metadata.get("GAME_TIME").asInt / 1000)}") + lore.add("${ChatColor.YELLOW}Players: ${ChatColor.RED}${server.players.size}/${server.mode.requiredQueueSize}") + lore.add(" ") + lore.add("${ChatColor.RED}Red${ChatColor.GRAY}: ${server.metadata.get("RED_DTR").asString}") + lore.add("${ChatColor.BLUE}Blue${ChatColor.GRAY}: ${server.metadata.get("BLUE_DTR").asString}") + lore.add("${ChatColor.GREEN}Green${ChatColor.GRAY}: ${server.metadata.get("GREEN_DTR").asString}") + lore.add("${ChatColor.YELLOW}Yellow${ChatColor.GRAY}: ${server.metadata.get("YELLOW_DTR").asString}") + + if (server.metadata.has("CAP_ZONE_DATA")) { + + val json = server.metadata["CAP_ZONE_DATA"].asJsonObject + + lore.add(" ") + lore.add("${json["CAP_ZONE_NAME"].asString}${ChatColor.GRAY}: ${ChatColor.RED}${TimeUtils.formatIntoMMSS(json["CAP_ZONE_TIME"].asInt)}") + } + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + if (server.players.contains(player.uniqueId)) { + lore.add("${ChatColor.GREEN}Click to rejoin.") + } else { + lore.add("${ChatColor.GREEN}Click to spectate.") + } + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun clicked(player: Player, slot: Int, clickType: ClickType?) { + player.closeInventory() + BungeeUtil.sendToServer(player,this.server.id) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/element/TeleportButton.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/element/TeleportButton.kt new file mode 100644 index 0000000..c6123c3 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/menu/element/TeleportButton.kt @@ -0,0 +1,49 @@ +package cc.fyre.engine.spectate.data.menu.element + +import net.frozenorb.qlib.menu.Button +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType + +/** + * @project engine + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +class TeleportButton(private val player: Player) : Button() { + + private val displayName = this.player.name + + override fun getName(player: Player): String { + return this.displayName + } + + + override fun getMaterial(player: Player): Material { + return Material.SKULL_ITEM + } + + override fun getDamageValue(player: Player): Byte { + return 3 + } + + override fun getDescription(player: Player): MutableList { + + val lore = ArrayList() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.YELLOW}Click to teleport to ${this.displayName}${ChatColor.YELLOW}.") + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun clicked(player: Player,slot: Int,clickType: ClickType?) { + player.teleport(this.player) + player.closeInventory() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/LobbyItem.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/LobbyItem.kt new file mode 100644 index 0000000..99d26cc --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/LobbyItem.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.spectate.data.type + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.spectate.data.Item +import cc.fyre.engine.util.BungeeUtil +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project engine + * + * @date 14/08/2020 + * @author xanderume@gmail.com + */ +class LobbyItem : Item() { + + override fun getSlot(player: Player): Int { + return 4 + } + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.INK_SACK).name("${ChatColor.RED}» ${ChatColor.GOLD}${ChatColor.BOLD}Return To Lobby ${ChatColor.RED}«").data(14).build() + } + + override fun onInteract(event: PlayerInteractEvent) { + BungeeUtil.sendToServer(event.player,GameEngine.instance.api.mode.lobbyServer) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/SpectateItem.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/SpectateItem.kt new file mode 100644 index 0000000..b4dab44 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/SpectateItem.kt @@ -0,0 +1,39 @@ +package cc.fyre.engine.spectate.data.type + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.spectate.data.Item +import cc.fyre.engine.spectate.data.menu.SpectateMenu +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project engine + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +class SpectateItem : Item() { + + override fun getSlot(player: Player): Int { + return 8 + } + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.WATCH).name("${ChatColor.RED}» ${ChatColor.YELLOW}${ChatColor.BOLD}Spectate Game ${ChatColor.RED}«").build() + } + + override fun onInteract(event: PlayerInteractEvent) { + + if (GameEngine.instance.api.gameServerHandler.findSpectatableGames().none{it.id != GameEngine.instance.gameHandler.server.id}) { + return + } + + SpectateMenu().openMenu(event.player) + } + + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/TeleportItem.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/TeleportItem.kt new file mode 100644 index 0000000..7ebac3e --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/data/type/TeleportItem.kt @@ -0,0 +1,32 @@ +package cc.fyre.engine.spectate.data.type + +import cc.fyre.engine.spectate.data.Item +import cc.fyre.engine.spectate.data.menu.TeleportMenu +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project engine + * + * @date 19/08/2020 + * @author xanderume@gmail.com + */ +class TeleportItem : Item() { + + override fun getSlot(player: Player): Int { + return 0 + } + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.COMPASS).name("${ChatColor.RED}» ${ChatColor.GREEN}${ChatColor.BOLD}Teleport ${ChatColor.RED}«").build() + } + + override fun onInteract(event: PlayerInteractEvent) { + TeleportMenu().openMenu(event.player) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/listener/SpectateListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/listener/SpectateListener.kt new file mode 100644 index 0000000..a5be395 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/spectate/listener/SpectateListener.kt @@ -0,0 +1,240 @@ +package cc.fyre.engine.spectate.listener + +import cc.fyre.engine.GameEngine +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.entity.* +import org.bukkit.event.hanging.HangingBreakByEntityEvent +import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.player.* +import org.bukkit.event.vehicle.VehicleDestroyEvent +import org.bukkit.event.vehicle.VehicleEntityCollisionEvent + +/** + * @project hub + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +class SpectateListener(private val instance: GameEngine):Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (this.instance.gameHandler.isPlaying(event.player) && !this.instance.disqualifieHandler.isDisqualified(event.player.uniqueId)) { + this.instance.spectateHandler.getSpectators().forEach{event.player.hidePlayer(it)} + return + } + + this.instance.spectateHandler.addSpectator(event.player) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.player)) { + return + } + + this.instance.spectateHandler.removeSpectator(event.player) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.player)) { + return + } + + event.isCancelled = true + + if (!event.action.name.contains("RIGHT",true)) { + return + } + + if (event.item == null) { + return + } + + this.instance.spectateHandler.findItemByItemStack(event.item,event.player)?.onInteract(event) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (event.entity !is Player) { + return + } + + if (!this.instance.spectateHandler.isSpectating(event.entity as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (event.damager !is Player) { + return + } + + if (!this.instance.spectateHandler.isSpectating(event.damager as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onInventoryClick(event: InventoryClickEvent) { + + if (event.whoClicked !is Player) { + return + } + + if (!this.instance.spectateHandler.isSpectating(event.whoClicked as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPickupItem(event: PlayerPickupItemEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onFoodLevelChange(event: FoodLevelChangeEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.entity as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityTarget(event: EntityTargetEvent) { + + if (event.target !is Player) { + return + } + + if (!this.instance.spectateHandler.isSpectating(event.target as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDeath(event: PlayerDeathEvent) { + + if (!this.instance.spectateHandler.isSpectating(event.entity)) { + return + } + + event.drops.clear() + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onVehicleDestroy(event: VehicleDestroyEvent) { + + if (event.attacker !is Player || !this.instance.spectateHandler.isSpectating(event.attacker as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onVehicleEntityCollision(event: VehicleEntityCollisionEvent) { + + if (event.entity !is Player || !this.instance.spectateHandler.isSpectating(event.entity as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onHangingBreak(event: HangingBreakByEntityEvent) { + + if (event.remover !is Player || !this.instance.spectateHandler.isSpectating(event.remover as Player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDropItem(event: PlayerDropItemEvent) { + + if (!GameEngine.instance.spectateHandler.isSpectating(event.player)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.HIGHEST) + private fun onAsyncPlayerChat(event: AsyncPlayerChatEvent) { + + if (event.isCancelled) { + return + } + + if (!GameEngine.instance.spectateHandler.isSpectating(event.player)) { + return + } + + if (event.player.isOp && event.message[0] == '!') { + + if (event.message.length == 1) { + event.player.sendMessage("${ChatColor.RED}You must supply a message.") + event.isCancelled = true + return + } + + event.message = event.message.substring(1).trim() + return + } + + event.format = "${ChatColor.GRAY}[Spectator]${event.player.name}: ${event.message}" + event.recipients.clear() + event.recipients.addAll(GameEngine.instance.spectateHandler.getSpectators()) + } +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/util/BungeeUtil.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/util/BungeeUtil.kt new file mode 100644 index 0000000..358c55a --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/util/BungeeUtil.kt @@ -0,0 +1,28 @@ +package cc.fyre.engine.util + +import cc.fyre.engine.GameEngine +import com.google.common.io.ByteStreams +import org.bukkit.entity.Player + +object BungeeUtil { + + const val PROXY_CHANNEL = "BungeeCord" + + @JvmStatic + fun sendToServer(player: Player,server: String) { + + try { + + val out = ByteStreams.newDataOutput() + + out.writeUTF("Connect") + out.writeUTF(server) + + player.sendPluginMessage(GameEngine.instance,PROXY_CHANNEL,out.toByteArray()) + } catch (e: Exception) { + e.printStackTrace() + } + + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/util/EnchantUtil.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/util/EnchantUtil.kt new file mode 100644 index 0000000..b3ca7f3 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/util/EnchantUtil.kt @@ -0,0 +1,53 @@ +package cc.fyre.engine.util + +import org.apache.commons.lang.WordUtils +import org.bukkit.enchantments.Enchantment + +object EnchantUtil { + + private val names = hashMapOf() + + init { + this.names[Enchantment.LURE] = "Lure" + this.names[Enchantment.LUCK] = "Luck of the Sea" + + this.names[Enchantment.THORNS] = "Thorns" + this.names[Enchantment.OXYGEN] = "Respiration" + this.names[Enchantment.WATER_WORKER] = "Aqua Affinity" + + this.names[Enchantment.KNOCKBACK] = "Knockback" + this.names[Enchantment.DIG_SPEED] = "Efficiency" + this.names[Enchantment.DURABILITY] = "Unbreaking" + this.names[Enchantment.SILK_TOUCH] = "Silk Touch" + this.names[Enchantment.FIRE_ASPECT] = "Fire Aspect" + + this.names[Enchantment.ARROW_FIRE] = "Flame" + this.names[Enchantment.ARROW_DAMAGE] = "Power" + this.names[Enchantment.ARROW_INFINITE] = "Infinity" + this.names[Enchantment.ARROW_KNOCKBACK] = "Punch" + + this.names[Enchantment.LOOT_BONUS_MOBS] = "Looting" + this.names[Enchantment.LOOT_BONUS_BLOCKS] = "Fortune" + + this.names[Enchantment.DAMAGE_ALL] = "Sharpness" + this.names[Enchantment.DAMAGE_UNDEAD] = "Smite" + this.names[Enchantment.DAMAGE_ARTHROPODS] = "Bane of Arthropods" + + this.names[Enchantment.PROTECTION_FIRE] = "Fire Protection" + this.names[Enchantment.PROTECTION_FALL] = "Feather Falling" + this.names[Enchantment.PROTECTION_EXPLOSIONS] = "Blast Protection" + this.names[Enchantment.PROTECTION_PROJECTILE] = "Projectile Protection" + this.names[Enchantment.PROTECTION_ENVIRONMENTAL] = "Protection" + } + + @JvmStatic + fun getName(enchantment: Enchantment):String { + return this.names[enchantment] ?: WordUtils.capitalizeFully(enchantment.name.lowercase().replace("_"," ")) + } + + @JvmStatic + fun getByName(name: String): Enchantment? { + return this.names.entries.firstOrNull{it.key.name.equals(name,true) || it.value.equals(name,true)}?.key + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/util/FormatUtil.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/util/FormatUtil.kt new file mode 100644 index 0000000..24bb420 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/util/FormatUtil.kt @@ -0,0 +1,128 @@ +package cc.fyre.engine.util + +import java.util.* +import java.util.concurrent.TimeUnit +import kotlin.math.round + +object FormatUtil { + + private val map = TreeMap() + + init { + this.map[1] = "I" + this.map[4] = "IV" + this.map[5] = "V" + this.map[9] = "IX" + this.map[10] = "X" + this.map[40] = "XL" + this.map[50] = "L" + this.map[90] = "XC" + this.map[100] = "C" + this.map[400] = "CD" + this.map[500] = "D" + this.map[900] = "CM" + this.map[1000] = "M" + } + + @JvmStatic + fun isInteger(input: String): Boolean { + + return try { + input.toInt() + true + } catch (e: NumberFormatException) { + false + } + + } + + @JvmStatic + fun isShort(input: String): Boolean { + + return try { + input.toShort() + true + } catch (e: NumberFormatException) { + false + } + + } + + @JvmStatic + fun toRoman(int: Int): String { + + val number = this.map.floorKey(int) + + if (int == number) { + return this.map[int] ?: "" + } + + return "${this.map[number] ?: ""}${this.toRoman(int - number)}" + } + + @JvmStatic + fun formatIntoFancy(millis: Long):String { + + if (millis >= TimeUnit.SECONDS.toMillis(60L)) { + return this.formatIntoMMSS(millis) + } + + val seconds = millis / 1000.0 + + return "${if (seconds > 0.1) round(10.0 * seconds) / 10.0 else 0.1}s" + } + + @JvmStatic + fun formatIntoMMSS(millis: Long): String { + + var toReturn = (millis/1000) + + val seconds = toReturn % 60 + + toReturn -= seconds + + var minutesCount = (toReturn / 60) + val minutes = minutesCount % 60 + + minutesCount -= minutes + + val hours = minutesCount / 60 + + return (if (hours > 0) (if (hours < 10) "0" else "") + hours + ":" else "") + (if (minutes < 10) "0" else "") + minutes + ":" + (if (seconds < 10) "0" else "") + seconds + } + + @JvmStatic + fun formatIntoDetailedString(millis: Long): String { + + if (millis <= 0L) { + return "0 seconds" + } + + val secs = millis / 1000L + + val remainder = secs % 86400 + + val days = secs / 86400 + val hours = remainder / 3600 + val minutes = remainder / 60 - hours * 60 + val seconds = remainder % 3600 - minutes * 60 + + val fDays = if (days > 0) " " + days + " day" + (if (days > 1) "s" else "") else "" + + var fHours = "" + var fMinutes = "" + var fSeconds = "" + + if (days < 1) { + fHours = if (hours > 0) " " + hours + " hour" + (if (hours > 1) "s" else "") else "" + + if (hours < 1) { + fMinutes = if (minutes > 0) " " + minutes + " minute" + (if (minutes > 1) "s" else "") else "" + fSeconds = if (seconds > 0) " " + seconds + " second" + (if (seconds > 1) "s" else "") else "" + } + + } + + return (fDays + fHours + fMinutes + fSeconds).trim { it <= ' ' } + } +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/util/PotionUtil.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/util/PotionUtil.kt new file mode 100644 index 0000000..4677466 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/util/PotionUtil.kt @@ -0,0 +1,98 @@ +package cc.fyre.engine.util + +import org.apache.commons.lang.WordUtils +import org.bukkit.ChatColor +import org.bukkit.potion.PotionEffectType +import java.util.concurrent.TimeUnit + +/** + * @project carnage + * + * @date 28/02/2021 + * @author xanderume@gmail.com + */ +object PotionUtil { + + @JvmStatic val DEBUFFS = arrayListOf( + PotionEffectType.HARM,PotionEffectType.SLOW,PotionEffectType.HUNGER, + PotionEffectType.POISON,PotionEffectType.WITHER,PotionEffectType.WEAKNESS, + PotionEffectType.CONFUSION,PotionEffectType.BLINDNESS,PotionEffectType.SLOW_DIGGING + ) + + @JvmStatic val MAX_POTION_DURATION = TimeUnit.MINUTES.toMillis(8L) + + private val names = hashMapOf() + private val colors = hashMapOf() + + init { + names[PotionEffectType.HEAL] = "Healing" + names[PotionEffectType.HARM] = "Harming" + names[PotionEffectType.SLOW] = "Slowness" + names[PotionEffectType.JUMP] = "Jump Boost" + names[PotionEffectType.SPEED] = "Speed" + names[PotionEffectType.HUNGER] = "Hunger" + names[PotionEffectType.POISON] = "Poison" + names[PotionEffectType.WITHER] = "Wither" + names[PotionEffectType.WEAKNESS] = "Weakness" + names[PotionEffectType.CONFUSION] = "Nausea" + names[PotionEffectType.BLINDNESS] = "Blindness" + names[PotionEffectType.SATURATION] = "Saturation" + names[PotionEffectType.ABSORPTION] = "Absorption" + names[PotionEffectType.REGENERATION] = "Regeneration" + names[PotionEffectType.FAST_DIGGING] = "Haste" + names[PotionEffectType.SLOW_DIGGING] = "Mining Fatigue" + names[PotionEffectType.NIGHT_VISION] = "Night Vision" + names[PotionEffectType.INVISIBILITY] = "Invisibility" + names[PotionEffectType.HEALTH_BOOST] = "Health Boost" + names[PotionEffectType.INCREASE_DAMAGE] = "Strength" + names[PotionEffectType.WATER_BREATHING] = "Water Breathing" + names[PotionEffectType.FIRE_RESISTANCE] = "Fire Resistance" + names[PotionEffectType.DAMAGE_RESISTANCE] = "Resistance" + + colors[PotionEffectType.HEAL] = ChatColor.RED + colors[PotionEffectType.HARM] = ChatColor.GOLD + colors[PotionEffectType.SLOW] = ChatColor.GRAY + colors[PotionEffectType.JUMP] = ChatColor.GREEN + colors[PotionEffectType.SPEED] = ChatColor.AQUA + colors[PotionEffectType.HUNGER] = ChatColor.DARK_GREEN + colors[PotionEffectType.POISON] = ChatColor.DARK_GREEN + colors[PotionEffectType.WITHER] = ChatColor.DARK_PURPLE + colors[PotionEffectType.WEAKNESS] = ChatColor.DARK_GRAY + colors[PotionEffectType.CONFUSION] = ChatColor.DARK_PURPLE + colors[PotionEffectType.BLINDNESS] = ChatColor.DARK_GRAY + colors[PotionEffectType.SATURATION] = ChatColor.RED + colors[PotionEffectType.ABSORPTION] = ChatColor.YELLOW + colors[PotionEffectType.REGENERATION] = ChatColor.LIGHT_PURPLE + colors[PotionEffectType.FAST_DIGGING] = ChatColor.BLUE + colors[PotionEffectType.SLOW_DIGGING] = ChatColor.RED + colors[PotionEffectType.NIGHT_VISION] = ChatColor.DARK_BLUE + colors[PotionEffectType.INVISIBILITY] = ChatColor.GRAY + colors[PotionEffectType.HEALTH_BOOST] = ChatColor.RED + colors[PotionEffectType.INCREASE_DAMAGE] = ChatColor.RED + colors[PotionEffectType.WATER_BREATHING] = ChatColor.BLUE + colors[PotionEffectType.FIRE_RESISTANCE] = ChatColor.GOLD + colors[PotionEffectType.DAMAGE_RESISTANCE] = ChatColor.GRAY + } + + @JvmStatic + fun getName(type: PotionEffectType):String { + return names.getOrPut(type) { WordUtils.capitalizeFully(type.name.lowercase().replace(" ","")) } + } + + @JvmStatic + fun getColor(type: PotionEffectType):ChatColor { + return colors[type] ?: ChatColor.RED + } + + + @JvmStatic + fun isDebuff(type: PotionEffectType):Boolean { + return DEBUFFS.contains(type) + } + + @JvmStatic + fun getDisplayName(type: PotionEffectType):String { + return "${colors[type] ?: ChatColor.WHITE}${getName(type)}" + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/voting/VoteHandler.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/VoteHandler.kt new file mode 100644 index 0000000..01b10a7 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/VoteHandler.kt @@ -0,0 +1,114 @@ +package cc.fyre.engine.voting + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.map.data.Map +import cc.fyre.engine.voting.command.VoteCommand +import cc.fyre.engine.voting.listener.VoteListener +import cc.fyre.engine.voting.service.VoteService +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.util.ItemBuilder +import net.minecraft.util.org.apache.commons.io.FileUtils +import org.bukkit.ChatColor +import org.bukkit.World +import org.bukkit.WorldCreator +import org.bukkit.enchantments.Enchantment +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import java.io.File +import java.util.* +import kotlin.collections.HashMap +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 11/08/2020 + * @author xanderume@gmail.com + */ +class VoteHandler(private val instance: GameEngine) { + + val cache = HashMap>() + val service = VoteService(this.instance) + val cooldown = HashMap() + + var world: World = this.instance.server.getWorld("world") + + init { + + if (this.instance.api.mode.mapBased) { + this.instance.server.pluginManager.registerEvents(VoteListener(this.instance),this.instance) + + FileUtils.copyDirectory(File("${GameEngineAPI.PARENT_DIRECTORY.path}/${this.instance.api.mode.name.toLowerCase()}/voting"),File("${this.instance.server.worldContainer.path}/voting")) + + this.world = this.instance.server.createWorld(WorldCreator.name("voting")) + } + + FrozenCommandHandler.registerClass(VoteCommand::class.java) + + this.instance.mapHandler.cache.forEach{this.cache[it] = HashSet()} + } + + fun dispose() { + this.instance.mapHandler.deleteWorld(this.world) + } + + fun addVote(player: Player,map: Map) { + this.cache.values.forEach{it.removeIf{id -> id == player.uniqueId}} + this.cache[map]!!.add(player.uniqueId) + this.cooldown[player.uniqueId] = System.currentTimeMillis() + + player.sendMessage("${ChatColor.YELLOW}You have voted for ${ChatColor.LIGHT_PURPLE}${map.id}${ChatColor.YELLOW}.") + } + + fun removeVote(player: Player,map: Map):Boolean { + + val toReturn = this.cache[map]!!.remove(player.uniqueId) + + if (toReturn) { + this.cooldown[player.uniqueId] = System.currentTimeMillis() + } + + return toReturn + } + + fun getVotes(map: Map):Int { + + if (!this.cache.containsKey(map)) { + return 0 + } + + return this.cache[map]!!.size + } + + fun refreshItems(player: Player) { + this.cache.keys.withIndex().forEach{player.inventory.setItem(it.index,this.createItemStack(it.value,this.cache[it.value]!!.contains(player.uniqueId)))} + } + + fun isOnCooldown(player: Player):Boolean { + return this.cooldown.containsKey(player.uniqueId) && ((this.cooldown[player.uniqueId]!! + 1000L) - System.currentTimeMillis()) > 0 + } + + fun findVotingItem(itemStack: ItemStack):Map? { + return this.cache.keys.firstOrNull{it.icon.type == itemStack.type && ChatColor.stripColor(itemStack.itemMeta.displayName).equals(it.id,true)} + } + + private fun createItemStack(map: Map,voted: Boolean): ItemStack { + + val toReturn = ItemBuilder.copyOf(map.icon.clone()).name("${if (voted) ChatColor.GREEN else ChatColor.GRAY}${ChatColor.BOLD}${map.id}") + + if (voted) { + //toReturn.glow() + toReturn.enchant(Enchantment.DURABILITY,10) + } + + return toReturn.build() + } + + companion object { + + const val VOTING_SECONDS = 30 + + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/voting/command/VoteCommand.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/command/VoteCommand.kt new file mode 100644 index 0000000..ac0ff63 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/command/VoteCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.voting.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.map.data.Map +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor + +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 16/08/2020 + * @author xanderume@gmail.com + */ +object VoteCommand { + + @JvmStatic + @Command(names = ["vote"],permission = "") + fun execute(player: Player,@Param( name = "map")map: Map) { + + if (GameEngine.instance.gameHandler.getState() != GameServer.State.VOTING) { + player.sendMessage("${ChatColor.RED}Voting is closed.") + return + } + + GameEngine.instance.voteHandler.addVote(player,map) + GameEngine.instance.voteHandler.refreshItems(player) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/voting/listener/VoteListener.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/listener/VoteListener.kt new file mode 100644 index 0000000..529dc70 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/listener/VoteListener.kt @@ -0,0 +1,126 @@ +package cc.fyre.engine.voting.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.menu.Menu +import org.bukkit.GameMode +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.player.PlayerDropItemEvent +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerPickupItemEvent + +/** + * @project engine + * + * @date 11/08/2020 + * @author xanderume@gmail.com + */ +class VoteListener(private val instance: GameEngine):Listener { + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (this.instance.gameHandler.getState() != GameServer.State.VOTING) { + return + } + + this.instance.voteHandler.refreshItems(event.player) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (this.instance.gameHandler.getState() != GameServer.State.VOTING) { + return + } + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDropItem(event: PlayerDropItemEvent) { + + if (this.instance.gameHandler.getState() != GameServer.State.VOTING) { + return + } + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerPickupItem(event: PlayerPickupItemEvent) { + + if (this.instance.gameHandler.getState() != GameServer.State.VOTING) { + return + } + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onInventoryClick(event: InventoryClickEvent) { + + if (event.whoClicked !is Player) { + return + } + + if (this.instance.gameHandler.getState() != GameServer.State.VOTING) { + return + } + + if (event.whoClicked.gameMode == GameMode.CREATIVE) { + return + } + + if (Menu.currentlyOpenedMenus.containsKey(event.whoClicked.name)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (this.instance.gameHandler.getState() != GameServer.State.VOTING) { + return + } + + if (event.item == null) { + return + } + + val map = this.instance.voteHandler.findVotingItem(event.item) ?: return + + if (this.instance.voteHandler.isOnCooldown(event.player)) { + return + } + + if (this.instance.voteHandler.removeVote(event.player,map)) { + this.instance.voteHandler.refreshItems(event.player) + return + } + + this.instance.voteHandler.addVote(event.player,map) + this.instance.voteHandler.refreshItems(event.player) + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/kotlin/cc/fyre/engine/voting/service/VoteService.kt b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/service/VoteService.kt new file mode 100644 index 0000000..478b731 --- /dev/null +++ b/Engine/game/src/main/kotlin/cc/fyre/engine/voting/service/VoteService.kt @@ -0,0 +1,41 @@ +package cc.fyre.engine.voting.service + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.voting.VoteHandler +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project engine + * + * @date 11/08/2020 + * @author xanderume@gmail.com + */ +class VoteService(private val instance: GameEngine) : BukkitRunnable() { + + var started = 0L + var remaining = AtomicInteger(VoteHandler.VOTING_SECONDS) + + override fun run() { + + if (this.started == 0L) { + this.started = System.currentTimeMillis() + } + + if (this.remaining.get() == 15 || this.remaining.get() == 10 || this.remaining.get() in 1..5) { + this.instance.server.broadcastMessage("${this.instance.api.mode.prefix} ${ChatColor.WHITE}Map voting ends in ${ChatColor.GOLD}${this.remaining.get()} second${if (this.remaining.get() == 1) "" else "s"}${ChatColor.WHITE}.") + } + + if (this.remaining.get() <= 0) { + this.cancel() + this.instance.gameHandler.map = this.instance.voteHandler.cache.entries.sortedByDescending{it.value.size}[0].key + this.instance.gameHandler.setState(GameServer.State.COUNTDOWN) + return + } + + this.remaining.decrementAndGet() + } + +} \ No newline at end of file diff --git a/Engine/game/src/main/resources/config.yml b/Engine/game/src/main/resources/config.yml new file mode 100644 index 0000000..53b0af5 --- /dev/null +++ b/Engine/game/src/main/resources/config.yml @@ -0,0 +1 @@ +server-id: "Bunkers-01" \ No newline at end of file diff --git a/Engine/game/src/main/resources/plugin.yml b/Engine/game/src/main/resources/plugin.yml new file mode 100644 index 0000000..84a2e87 --- /dev/null +++ b/Engine/game/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: GameEngine +main: cc.fyre.engine.GameEngine +version: 1.0-SNAPSHOT +depend: [qLib,Kotlin] diff --git a/Engine/gradle/wrapper/gradle-wrapper.jar b/Engine/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/Engine/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Engine/gradle/wrapper/gradle-wrapper.properties b/Engine/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..da9702f --- /dev/null +++ b/Engine/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/Engine/gradlew b/Engine/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/Engine/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/Engine/gradlew.bat b/Engine/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/Engine/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Engine/lobby/build.gradle b/Engine/lobby/build.gradle new file mode 100644 index 0000000..0cc8914 --- /dev/null +++ b/Engine/lobby/build.gradle @@ -0,0 +1,50 @@ +plugins { + id "org.jetbrains.kotlin.jvm" version "1.5.0" + id "com.github.johnrengelman.shadow" version "5.2.0" +} + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() + archiveName = "engine-" + this.name + "-" + this.version + ".jar" +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + compile project(":api") + + compileOnly 'com.comphenix.protocol:ProtocolLib:4.4.0' + compileOnly "net.frozenorb:qLib:LATEST" + compileOnly 'cc.fyre:spigot-server:1.7.10-R0.1-SNAPSHOT' + compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.0" +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} diff --git a/Engine/lobby/build/classes/kotlin/main/META-INF/lobby.kotlin_module b/Engine/lobby/build/classes/kotlin/main/META-INF/lobby.kotlin_module new file mode 100644 index 0000000..70f0f69 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/META-INF/lobby.kotlin_module differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/GameEngine$Companion.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/GameEngine$Companion.class new file mode 100644 index 0000000..0c99b11 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/GameEngine$Companion.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/GameEngine.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/GameEngine.class new file mode 100644 index 0000000..0bbdbc0 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/GameEngine.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/AdapterHandler$Companion.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/AdapterHandler$Companion.class new file mode 100644 index 0000000..bc6d987 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/AdapterHandler$Companion.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/AdapterHandler.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/AdapterHandler.class new file mode 100644 index 0000000..617bff9 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/AdapterHandler.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/BunkersAdapter.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/BunkersAdapter.class new file mode 100644 index 0000000..de462e9 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/BunkersAdapter.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu$getButtons$$inlined$sortedBy$1.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu$getButtons$$inlined$sortedBy$1.class new file mode 100644 index 0000000..b113e8e Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu$getButtons$$inlined$sortedBy$1.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu$getButtons$lambda-11$$inlined$sortedBy$1.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu$getButtons$lambda-11$$inlined$sortedBy$1.class new file mode 100644 index 0000000..8c1c4e4 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu$getButtons$lambda-11$$inlined$sortedBy$1.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu.class new file mode 100644 index 0000000..fe8cf4a Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameElement.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameElement.class new file mode 100644 index 0000000..fbcacfe Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameElement.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameSeasonElement.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameSeasonElement.class new file mode 100644 index 0000000..76bbe96 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameSeasonElement.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameSpectateElement.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameSpectateElement.class new file mode 100644 index 0000000..cb4eda6 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/element/GameSpectateElement.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/leaderboard/LeaderBoardElement.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/leaderboard/LeaderBoardElement.class new file mode 100644 index 0000000..0a19997 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/menu/leaderboard/LeaderBoardElement.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout$provide$$inlined$sortedByDescending$1.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout$provide$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..fa4cdca Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout$provide$$inlined$sortedByDescending$1.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout.class new file mode 100644 index 0000000..ee8b49c Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/command/LeaderBoardAddCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/command/LeaderBoardAddCommand.class new file mode 100644 index 0000000..e116c71 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/command/LeaderBoardAddCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/command/LeaderBoardRefreshCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/command/LeaderBoardRefreshCommand.class new file mode 100644 index 0000000..e5ed82f Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/command/LeaderBoardRefreshCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/LobbyAdapter.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/LobbyAdapter.class new file mode 100644 index 0000000..5c1cd9c Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/LobbyAdapter.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/board/LeaderBoardEntry.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/board/LeaderBoardEntry.class new file mode 100644 index 0000000..be3e591 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/board/LeaderBoardEntry.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/config/AdapterConfig.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/config/AdapterConfig.class new file mode 100644 index 0000000..854c8b9 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/data/config/AdapterConfig.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/listener/AdapterListener.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/listener/AdapterListener.class new file mode 100644 index 0000000..39667c2 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/listener/AdapterListener.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameHistoryMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameHistoryMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..9c77330 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameHistoryMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameHistoryMenu.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameHistoryMenu.class new file mode 100644 index 0000000..08a6e11 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameHistoryMenu.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameSeasonMenu.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameSeasonMenu.class new file mode 100644 index 0000000..ce57ff1 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/menu/GameSeasonMenu.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/service/LobbyUpdateService.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/service/LobbyUpdateService.class new file mode 100644 index 0000000..1fee935 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/adapter/service/LobbyUpdateService.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/EngineDumpCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/EngineDumpCommand.class new file mode 100644 index 0000000..8bbeed7 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/EngineDumpCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/ForceSendCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/ForceSendCommand.class new file mode 100644 index 0000000..aa7d430 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/ForceSendCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameHistoryCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameHistoryCommand.class new file mode 100644 index 0000000..7712a47 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameHistoryCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueueCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueueCommand.class new file mode 100644 index 0000000..216bd86 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueueCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueuePauseCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueuePauseCommand.class new file mode 100644 index 0000000..523164d Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueuePauseCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueueRankedCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueueRankedCommand.class new file mode 100644 index 0000000..86b49b6 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/command/GameQueueRankedCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyNameTagAdapter.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyNameTagAdapter.class new file mode 100644 index 0000000..a3fdc33 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyNameTagAdapter.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter$LobbyScoreGetter.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter$LobbyScoreGetter.class new file mode 100644 index 0000000..59dbd8b Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter$LobbyScoreGetter.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter$LobbyTitleGetter.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter$LobbyTitleGetter.class new file mode 100644 index 0000000..5ff4896 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter$LobbyTitleGetter.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter.class new file mode 100644 index 0000000..566068d Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/engine/LobbyScoreboardAdapter.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/ItemHandler.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/ItemHandler.class new file mode 100644 index 0000000..b6ea22a Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/ItemHandler.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/Item.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/Item.class new file mode 100644 index 0000000..e7332ae Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/Item.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/CosmeticItem.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/CosmeticItem.class new file mode 100644 index 0000000..e23faf5 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/CosmeticItem.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/LeaderBoardItem.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/LeaderBoardItem.class new file mode 100644 index 0000000..c7f10f8 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/LeaderBoardItem.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/QueueItem.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/QueueItem.class new file mode 100644 index 0000000..08f2679 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/QueueItem.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/ReJoinItem.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/ReJoinItem.class new file mode 100644 index 0000000..f3b42de Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/ReJoinItem.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/SpectateItem.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/SpectateItem.class new file mode 100644 index 0000000..c482fc9 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/data/type/SpectateItem.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/listener/ItemListener.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/listener/ItemListener.class new file mode 100644 index 0000000..ed4f02f Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/listener/ItemListener.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/menu/LeaderBoardMenu.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/menu/LeaderBoardMenu.class new file mode 100644 index 0000000..a20c373 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/menu/LeaderBoardMenu.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/menu/SpectateMenu.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/menu/SpectateMenu.class new file mode 100644 index 0000000..c01a74a Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/item/menu/SpectateMenu.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/listener/DoubleJumpListener.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/listener/DoubleJumpListener.class new file mode 100644 index 0000000..90084cc Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/listener/DoubleJumpListener.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/listener/GeneralListener.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/listener/GeneralListener.class new file mode 100644 index 0000000..47165cc Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/listener/GeneralListener.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/PartyHandler.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/PartyHandler.class new file mode 100644 index 0000000..577ae2a Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/PartyHandler.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyChatCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyChatCommand.class new file mode 100644 index 0000000..f64f99a Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyChatCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyDisbandCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyDisbandCommand.class new file mode 100644 index 0000000..3899ca2 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyDisbandCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyInfoCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyInfoCommand.class new file mode 100644 index 0000000..62d125c Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyInfoCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyInviteCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyInviteCommand.class new file mode 100644 index 0000000..d22fbf1 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyInviteCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyJoinCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyJoinCommand.class new file mode 100644 index 0000000..ffbac31 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyJoinCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyKickCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyKickCommand.class new file mode 100644 index 0000000..dded6f8 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyKickCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyLeaderCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyLeaderCommand.class new file mode 100644 index 0000000..8d7955a Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyLeaderCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyLeaveCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyLeaveCommand.class new file mode 100644 index 0000000..ef51b83 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyLeaveCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyOpenCommand.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyOpenCommand.class new file mode 100644 index 0000000..0f51c9f Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/command/PartyOpenCommand.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/data/Party$Companion.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/data/Party$Companion.class new file mode 100644 index 0000000..ccfdaa5 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/data/Party$Companion.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/data/Party.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/data/Party.class new file mode 100644 index 0000000..03fa461 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/data/Party.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/listener/PartyListener.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/listener/PartyListener.class new file mode 100644 index 0000000..e610067 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/party/listener/PartyListener.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/QueueHandler.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/QueueHandler.class new file mode 100644 index 0000000..315e43c Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/QueueHandler.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/listener/QueueListener.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/listener/QueueListener.class new file mode 100644 index 0000000..f18292b Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/listener/QueueListener.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService$Companion.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService$Companion.class new file mode 100644 index 0000000..4f75477 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService$Companion.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService$run$$inlined$sortedByDescending$1.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService$run$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..1e694d8 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService$run$$inlined$sortedByDescending$1.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService.class new file mode 100644 index 0000000..47decf1 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/queue/service/QueueService.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/BungeeUtil.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/BungeeUtil.class new file mode 100644 index 0000000..b53a2c6 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/BungeeUtil.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/ConfigUtil.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/ConfigUtil.class new file mode 100644 index 0000000..d679115 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/ConfigUtil.class differ diff --git a/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/JsonConfig.class b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/JsonConfig.class new file mode 100644 index 0000000..8195f85 Binary files /dev/null and b/Engine/lobby/build/classes/kotlin/main/cc/fyre/engine/util/JsonConfig.class differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/build-history.bin b/Engine/lobby/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..90c9889 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/build-history.bin differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..0924d04 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..a333673 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..3cc751f Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..5ffc1b2 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..db213bc Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..00a3c41 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab new file mode 100644 index 0000000..b67fe7a Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream new file mode 100644 index 0000000..29ba2d0 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len new file mode 100644 index 0000000..eab8e32 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len new file mode 100644 index 0000000..bcf2523 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at new file mode 100644 index 0000000..28e8fd1 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i new file mode 100644 index 0000000..db1d2e9 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..c79af9b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..29ba2d0 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..eab8e32 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..bcf2523 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..674be37 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..db1d2e9 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab new file mode 100644 index 0000000..c8cecf1 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream new file mode 100644 index 0000000..5952d9b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len new file mode 100644 index 0000000..8d116c5 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len new file mode 100644 index 0000000..93a595b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at new file mode 100644 index 0000000..a35bdb4 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i new file mode 100644 index 0000000..860cd5b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..6c1b9fc Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..a63424d Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..7880f64 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..74768ff Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..e2f1dd3 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..33634a2 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..80dfd5b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..02befde Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..5ea822a Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..66444d2 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values new file mode 100644 index 0000000..9be58a2 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..c853033 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s new file mode 100644 index 0000000..365aae8 --- /dev/null +++ b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s @@ -0,0 +1 @@ +ê¢ \ No newline at end of file diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..05b29c5 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..e9b2bad Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..6139364 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..3cc751f Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..5ffc1b2 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..8a2411b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..532ee5f Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..51df2b5 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..b18d48e Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..6173a21 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..cf8a30a Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..7c7a1a6 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..bc72795 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..bc797d6 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..c47511a Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..3725a3d Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..fa43224 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..ed2744b Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..8e25fb0 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..79d3aa0 --- /dev/null +++ b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +62 +6 \ No newline at end of file diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..b23c38f Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..6139364 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..3cc751f Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..5ffc1b2 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..78c2df7 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..da16fa4 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..0cc5fec Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..78c8a48 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..1c69ee4 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..f6d81fe Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..d189565 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..9a32f1f Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..239b3ea Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..b3bd884 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..a28e3b5 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..a2515e8 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values new file mode 100644 index 0000000..d7c41bd Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..0c1f0fc Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s new file mode 100644 index 0000000..2edf5d9 --- /dev/null +++ b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s @@ -0,0 +1 @@ +ào \ No newline at end of file diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..e0a3571 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..4424406 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/Engine/lobby/build/kotlin/compileKotlin/last-build.bin b/Engine/lobby/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..3d42d60 Binary files /dev/null and b/Engine/lobby/build/kotlin/compileKotlin/last-build.bin differ diff --git a/Engine/lobby/build/libs/engine-lobby-1.0-SNAPSHOT.jar b/Engine/lobby/build/libs/engine-lobby-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..4255b86 Binary files /dev/null and b/Engine/lobby/build/libs/engine-lobby-1.0-SNAPSHOT.jar differ diff --git a/Engine/lobby/build/publications/shadow/pom-default.xml b/Engine/lobby/build/publications/shadow/pom-default.xml new file mode 100644 index 0000000..980f065 --- /dev/null +++ b/Engine/lobby/build/publications/shadow/pom-default.xml @@ -0,0 +1,8 @@ + + + 4.0.0 + cc.fyre.engine + lobby + 1.0-SNAPSHOT + + diff --git a/Engine/lobby/build/resources/main/plugin.yml b/Engine/lobby/build/resources/main/plugin.yml new file mode 100644 index 0000000..84a2e87 --- /dev/null +++ b/Engine/lobby/build/resources/main/plugin.yml @@ -0,0 +1,4 @@ +name: GameEngine +main: cc.fyre.engine.GameEngine +version: 1.0-SNAPSHOT +depend: [qLib,Kotlin] diff --git a/Engine/lobby/build/tmp/compileJava/source-classes-mapping.txt b/Engine/lobby/build/tmp/compileJava/source-classes-mapping.txt new file mode 100644 index 0000000..b18f6b4 --- /dev/null +++ b/Engine/lobby/build/tmp/compileJava/source-classes-mapping.txt @@ -0,0 +1,2 @@ +javafx/util/Pair.java + javafx.util.Pair diff --git a/Engine/lobby/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml b/Engine/lobby/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml new file mode 100644 index 0000000..d63d60c --- /dev/null +++ b/Engine/lobby/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml @@ -0,0 +1,12 @@ + + + cc.fyre.engine + lobby + + 1.0-SNAPSHOT + + 1.0-SNAPSHOT + + 20210829082623 + + diff --git a/Engine/lobby/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml b/Engine/lobby/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml new file mode 100644 index 0000000..fca5093 --- /dev/null +++ b/Engine/lobby/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml @@ -0,0 +1,24 @@ + + + cc.fyre.engine + lobby + 1.0-SNAPSHOT + + + true + + 20210829082623 + + + pom + 1.0-SNAPSHOT + 20210829082623 + + + jar + 1.0-SNAPSHOT + 20210829082623 + + + + diff --git a/Engine/lobby/build/tmp/shadowJar/MANIFEST.MF b/Engine/lobby/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Engine/lobby/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/GameEngine.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/GameEngine.kt new file mode 100644 index 0000000..3a65602 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/GameEngine.kt @@ -0,0 +1,82 @@ +package cc.fyre.engine + +import cc.fyre.engine.adapter.AdapterHandler +import cc.fyre.engine.command.* + +import cc.fyre.engine.item.ItemHandler +import cc.fyre.engine.listener.GeneralListener +import cc.fyre.engine.engine.LobbyNameTagAdapter +import cc.fyre.engine.party.PartyHandler +import cc.fyre.engine.queue.QueueHandler +import cc.fyre.engine.engine.LobbyScoreboardAdapter +import cc.fyre.engine.listener.DoubleJumpListener +import cc.fyre.engine.util.BungeeUtil +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.nametag.FrozenNametagHandler +import net.frozenorb.qlib.scoreboard.FrozenScoreboardHandler +import net.frozenorb.qlib.scoreboard.ScoreboardConfiguration +import org.bukkit.Difficulty + +import org.bukkit.plugin.java.JavaPlugin + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GameEngine : JavaPlugin() { + + lateinit var api: GameEngineAPI + lateinit var itemHandler: ItemHandler + lateinit var partyHandler: PartyHandler + lateinit var queueHandler: QueueHandler + lateinit var adapterHandler: AdapterHandler + + override fun onEnable() { + instance = this + + this.server.worlds.first().difficulty = Difficulty.PEACEFUL + + this.api = GameEngineAPI(this.findGameMode()) + + this.itemHandler = ItemHandler(this) + this.partyHandler = PartyHandler(this) + this.queueHandler = QueueHandler(this) + this.adapterHandler = AdapterHandler(this) + + this.server.pluginManager.registerEvents(GeneralListener(this),this) + this.server.pluginManager.registerEvents(DoubleJumpListener(this),this) + + this.logger.info("Loaded Game Engine on ${this.api.mode.displayName}.") + + FrozenCommandHandler.registerClass(EngineDumpCommand::class.java) + FrozenCommandHandler.registerClass(ForceSendCommand::class.java) + FrozenCommandHandler.registerClass(GameHistoryCommand::class.java) + FrozenCommandHandler.registerClass(GameQueueCommand::class.java) + FrozenCommandHandler.registerClass(GameQueuePauseCommand::class.java) + FrozenCommandHandler.registerClass(GameQueueRankedCommand::class.java) + + val configuration = ScoreboardConfiguration() + + configuration.titleGetter = LobbyScoreboardAdapter.LobbyTitleGetter + configuration.scoreGetter = LobbyScoreboardAdapter.LobbyScoreGetter + + //FrozenTabHandler.setLayoutProvider(LobbyTabAdapter) + FrozenNametagHandler.registerProvider(LobbyNameTagAdapter) + FrozenScoreboardHandler.setConfiguration(configuration) + + this.server.messenger.registerOutgoingPluginChannel(this,BungeeUtil.PROXY_CHANNEL) + } + + private fun findGameMode():GameEngineAPI.GameMode { + return GameEngineAPI.GameMode.BUNKERS + } + + companion object { + + lateinit var instance: GameEngine + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/AdapterHandler.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/AdapterHandler.kt new file mode 100644 index 0000000..6ff8a4a --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/AdapterHandler.kt @@ -0,0 +1,59 @@ +package cc.fyre.engine.adapter + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.adapter.command.LeaderBoardAddCommand +import cc.fyre.engine.adapter.data.LobbyAdapter +import cc.fyre.engine.adapter.data.config.AdapterConfig +import cc.fyre.engine.adapter.listener.AdapterListener +import cc.fyre.engine.adapter.service.LobbyUpdateService +import cc.fyre.engine.adapter.bunkers.BunkersAdapter +import cc.fyre.engine.adapter.command.LeaderBoardRefreshCommand +import cc.fyre.engine.util.ConfigUtil +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.tab.FrozenTabHandler +import org.bukkit.ChatColor +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +class AdapterHandler(private val instance: GameEngine) { + + val config = ConfigUtil.register("config",this.instance.name,this.instance.dataFolder,AdapterConfig()) + + val service = LobbyUpdateService(this.instance) + + val adapters = HashMap>() + + init { + this.adapters[GameEngineAPI.GameMode.BUNKERS] = BunkersAdapter(this.instance) + + FrozenTabHandler.setLayoutProvider(this.getAdapter().getTabLayout()) + FrozenCommandHandler.registerClass(LeaderBoardAddCommand::class.java) + FrozenCommandHandler.registerClass(LeaderBoardRefreshCommand::class.java) + + this.service.runTaskTimerAsynchronously(this.instance,0L,(5 * 60) * 20L) + this.instance.server.pluginManager.registerEvents(AdapterListener(this.instance),this.instance) + } + + fun getAdapter():LobbyAdapter<*> { + return this.adapters[this.instance.api.mode]!! + } + + companion object { + + val TOP_COLORS = hashMapOf( + 1 to ChatColor.DARK_GREEN, + 2 to ChatColor.GREEN, + 3 to ChatColor.GOLD/*, + 4 to ChatColor.YELLOW, + 5 to ChatColor.RED*/ + ) + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/BunkersAdapter.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/BunkersAdapter.kt new file mode 100644 index 0000000..25ba337 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/BunkersAdapter.kt @@ -0,0 +1,122 @@ +package cc.fyre.engine.adapter.bunkers + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.adapter.bunkers.menu.GameInfoMenu +import cc.fyre.engine.adapter.bunkers.menu.element.GameElement +import cc.fyre.engine.adapter.bunkers.menu.element.GameSeasonElement +import cc.fyre.engine.adapter.bunkers.menu.element.GameSpectateElement +import cc.fyre.engine.adapter.bunkers.menu.leaderboard.LeaderBoardElement +import cc.fyre.engine.adapter.data.LobbyAdapter +import cc.fyre.engine.adapter.bunkers.tab.BunkersTabLayout +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.game.data.type.BunkersGame +import cc.fyre.engine.profile.data.type.BunkersProfile +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import net.frozenorb.qlib.tab.provider.LayoutProvider +import org.bukkit.Bukkit +import java.lang.IllegalStateException +import java.util.* +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 05/02/2021 + * @author xanderume@gmail.com + */ +class BunkersAdapter(private val instance: GameEngine) : LobbyAdapter(GameEngineAPI.GameMode.BUNKERS) { + + override fun getGames(): HashMap> { + return GameEngine.instance.api.gameDataHandler.findByMode(GameEngineAPI.GameMode.BUNKERS) as HashMap> + } + + override fun getGames(season: Int): Collection { + + if (Bukkit.isPrimaryThread()){ + throw IllegalStateException("Cannot refresh on main thread.") + } + + return GameEngine.instance.api.gameDataHandler.findByMode(GameEngineAPI.GameMode.BUNKERS,season) + } + + override fun getGames(uuid: UUID):HashMap> { + + if (Bukkit.isPrimaryThread()){ + throw IllegalStateException("Cannot query on main thread.") + } + + return GameEngine.instance.api.gameDataHandler.findById(uuid,GameEngineAPI.GameMode.BUNKERS) as HashMap> + } + + override fun getGames(uuid: UUID,season: Int): Collection { + + if (Bukkit.isPrimaryThread()){ + throw IllegalStateException("Cannot query on main thread.") + } + + return GameEngine.instance.api.gameDataHandler.findById(uuid,GameEngineAPI.GameMode.BUNKERS,season) + } + + override fun getProfile(uuid: UUID): BunkersProfile { + + if (this.profiles.contains(uuid)) { + return this.profiles[uuid]!! + } + + if (Bukkit.isPrimaryThread()){ + throw IllegalStateException("Cannot query on main thread.") + } + + var toReturn = this.instance.api.profileHandler.findById(uuid,GameEngineAPI.GameMode.BUNKERS) as BunkersProfile? + + if (toReturn == null) { + toReturn = BunkersProfile(uuid) + } + + this.profiles[uuid] = toReturn + + return toReturn + } + + override fun getMatchButton(game: Game, games: Collection, cached: HashMap>):Button { + return GameElement(game as BunkersGame,games,cached) + } + + override fun getMatchInfoMenu(game: Game,games: Collection,cached: HashMap>):Menu { + return GameInfoMenu(game as BunkersGame,games,cached) + } + + override fun getSeasonButton(season: Int, games: Collection, cached: HashMap>):Button { + return GameSeasonElement(season,games,cached) + } + + override fun getSpectateButton(server: GameServer):Button { + return GameSpectateElement(server) + } + + override fun getLeaderboardButtons(): MutableMap { + + val toReturn = HashMap() + + toReturn[11] = LeaderBoardElement("oresMined") + toReturn[12] = LeaderBoardElement("kills") + toReturn[13] = LeaderBoardElement("totalWins") + toReturn[14] = LeaderBoardElement("deaths") + toReturn[15] = LeaderBoardElement("playTime") + + return toReturn + } + + override fun getTabLayout():LayoutProvider { + return BunkersTabLayout + } + + override fun isDuelSupported(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu.kt new file mode 100644 index 0000000..c6ce95e --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/GameInfoMenu.kt @@ -0,0 +1,102 @@ +package cc.fyre.engine.adapter.bunkers.menu + +import cc.fyre.engine.adapter.menu.GameHistoryMenu +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.game.data.type.BunkersGame +import cc.fyre.engine.profile.data.type.BunkersProfile +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import net.frozenorb.qlib.menu.buttons.BackButton +import net.frozenorb.qlib.util.ItemBuilder +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.ChatColor +import org.bukkit.DyeColor +import org.bukkit.Material +import org.bukkit.entity.Player +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 24/12/2020 + * @author xanderume@gmail.com + */ +class GameInfoMenu(private val game: BunkersGame,private val games: Collection,private val cached: HashMap>) : Menu() { + + override fun size(buttons: Map): Int { + return 6*9 + } + + override fun getTitle(player: Player): String { + return "Game Info" + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = hashMapOf() + + var i = 10 + + this.game.teams.sortedBy{it.name.length}.withIndex().forEach{ + + var x = i + + val team = it.value + val color = ChatColor.getByChar(team.color[1]) ?: ChatColor.WHITE + + val itemBuilder = ItemBuilder.of(Material.WOOL) + .name("$color${ChatColor.BOLD}${team.name}") + .addToLore(*arrayListOf( + "${ChatColor.GOLD}DTR: ${ChatColor.RED}${team.dtr}", + "${ChatColor.GOLD}Kills: ${ChatColor.RED}${team.players.sumBy{member -> this.game.getKills(member)}}", + "${ChatColor.GOLD}Deaths: ${ChatColor.RED}${team.players.sumBy{member -> this.game.getDeaths(member)}}" + ).toTypedArray()) + + if (team.players.contains(player.uniqueId)) { + //TODO itemBuilder.glow() + } + + toReturn[x++] = Button.fromItem(itemBuilder.build()) + + team.players.associateWith{member -> UUIDUtils.name(member)}.forEach{ member -> + + val lore = ArrayList() + + lore.add("${ChatColor.GOLD}Kills: ${ChatColor.RED}${this.game.getKills(member.key)}") + lore.add("${ChatColor.GOLD}Deaths: ${ChatColor.RED}${this.game.getDeaths(member.key)}") + lore.add("${ChatColor.GOLD}Ores Mined: ${ChatColor.RED}${this.game.getOresMined(member.key)}") + + toReturn[x++] = Button.fromItem(ItemBuilder.of(Material.SKULL_ITEM) + .name("${team.color}${member.value}${if (this.game.primaryClass.containsKey(member.key) && this.game.primaryClass[member.key] != null) " ${ChatColor.GRAY}[${this.game.getPrimaryClass(member.key)}]" else ""}") + .data(3) + .addToLore(*lore.toTypedArray()) + .build() + ) + } + + val lore = arrayListOf() + val classes = BunkersProfile.PvPClass.values().associate{pvpClass -> pvpClass to 0}.toMutableMap() + + team.players.filter{member -> this.game.primaryClass.containsKey(member)}.associateWith{member -> this.game.primaryClass[member]!!}.forEach{entry -> classes[entry.value] = (classes[entry.value] ?: 0) + 1} + classes.entries.sortedBy{pvpClass -> pvpClass.key.displayName.length}.forEach{pvpClass -> lore.add("${ChatColor.GOLD}${pvpClass.key.displayName}: ${ChatColor.RED}${pvpClass.value}")} + + toReturn[x] = Button.fromItem(ItemBuilder.of(Material.DIAMOND_HELMET) + .name("${ChatColor.AQUA}${ChatColor.BOLD}PvP Classes") + .addToLore(*lore.toTypedArray()) + .build() + ) + + i += 9 + } + + toReturn[49] = BackButton(GameHistoryMenu(this.games,this.cached)) + + return toReturn + } + + override fun isPlaceholder(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameElement.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameElement.kt new file mode 100644 index 0000000..77ce10a --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameElement.kt @@ -0,0 +1,57 @@ +package cc.fyre.engine.adapter.bunkers.menu.element + +import cc.fyre.engine.adapter.bunkers.menu.GameInfoMenu +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.game.data.type.BunkersGame +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.TimeUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project engine + * + * @date 06/02/2021 + * @author xanderume@gmail.com + */ +class GameElement(private val game: BunkersGame,private val games: Collection,private val cached: HashMap>) : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.GOLD}${TimeUtils.formatIntoCalendarString(Date(this.game.created))}" + } + + override fun getDescription(p0: Player?): MutableList { + + val lore = arrayListOf() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.YELLOW}Map: ${ChatColor.RED}${this.game.map}") + lore.add("${ChatColor.YELLOW}Time: ${ChatColor.RED}${TimeUtils.formatIntoHHMMSS((this.game.time / 1000L).toInt())}") + + val team = this.game.getWinningTeam() + + lore.add(" ") + lore.add("${ChatColor.YELLOW}Ranked: ${ChatColor.RED}${if (this.game.ranked) "Yes" else "No"}") + lore.add("${ChatColor.YELLOW}Winners: ${if (team != null) "${team.color}${ChatColor.BOLD}${team.name}" else "${ChatColor.RED}None"}") + lore.add(" ") + lore.add("${ChatColor.GREEN}Click to view more info.") + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun getMaterial(p0: Player?): Material { + return Material.WATCH + } + + override fun clicked(player: Player, slot: Int, clickType: ClickType?) { + GameInfoMenu(this.game,this.games,this.cached).openMenu(player) + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameSeasonElement.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameSeasonElement.kt new file mode 100644 index 0000000..410073b --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameSeasonElement.kt @@ -0,0 +1,50 @@ +package cc.fyre.engine.adapter.bunkers.menu.element + +import cc.fyre.engine.adapter.menu.GameHistoryMenu +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.game.data.type.BunkersGame +import net.frozenorb.qlib.menu.Button +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType + +/** + * @project engine + * + * @date 06/02/2021 + * @author xanderume@gmail.com + */ +class GameSeasonElement(private val season: Int,private val games: Collection,private val cached: HashMap>) : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.GOLD}${ChatColor.BOLD}Season ${this.season}" + } + + override fun getMaterial(p0: Player?): Material { + return Material.BEACON + } + + override fun getDescription(player: Player): MutableList { + val lore = ArrayList() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.YELLOW}Wins: ${ChatColor.RED}${this.games.count{(it as BunkersGame).getWinners().contains(player.uniqueId)}}") + lore.add("${ChatColor.YELLOW}Kills: ${ChatColor.RED}${this.games.sumBy{(it as BunkersGame).getKills(player.uniqueId)}}") + lore.add("${ChatColor.YELLOW}Deaths: ${ChatColor.RED}${this.games.sumBy{(it as BunkersGame).getDeaths(player.uniqueId)}}") + lore.add("${ChatColor.YELLOW}Ores Mined: ${ChatColor.RED}${this.games.sumBy{(it as BunkersGame).getOresMined(player.uniqueId)}}") + lore.add(" ") + lore.add("${ChatColor.YELLOW}Games Played: ${ChatColor.RED}${this.games.count{(it as BunkersGame).getPlayers().contains(player.uniqueId)}}") + lore.add(" ") + lore.add("${ChatColor.GREEN}Click to view all games.") + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun clicked(player: Player?, slot: Int, clickType: ClickType?) { + GameHistoryMenu(this.games,this.cached).openMenu(player) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameSpectateElement.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameSpectateElement.kt new file mode 100644 index 0000000..f341e77 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/element/GameSpectateElement.kt @@ -0,0 +1,68 @@ +package cc.fyre.engine.adapter.bunkers.menu.element + +import cc.fyre.engine.server.data.GameServer +import cc.fyre.engine.util.BungeeUtil +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.util.TimeUtils +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType + +/** + * @project engine + * + * @date 06/02/2021 + * @author xanderume@gmail.com + */ +class GameSpectateElement(private val server: GameServer) : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.GOLD}${ChatColor.BOLD}${this.server.id}" + } + + override fun getMaterial(p0: Player?): Material { + return Material.WATCH + } + + override fun getDescription(player: Player): MutableList { + val lore = ArrayList() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + lore.add("${ChatColor.YELLOW}Time: ${ChatColor.RED}${TimeUtils.formatIntoHHMMSS((this.server.metadata.get("GAME_TIME").asLong / 1000L).toInt())}") + lore.add("${ChatColor.YELLOW}Players: ${ChatColor.RED}${this.server.players.size}/${this.server.mode.requiredQueueSize}") + lore.add(" ") + lore.add("${ChatColor.RED}Red${ChatColor.GRAY}: ${this.server.metadata.get("RED_DTR").asString}") + lore.add("${ChatColor.BLUE}Blue${ChatColor.GRAY}: ${this.server.metadata.get("BLUE_DTR").asString}") + lore.add("${ChatColor.GREEN}Green${ChatColor.GRAY}: ${this.server.metadata.get("GREEN_DTR").asString}") + lore.add("${ChatColor.YELLOW}Yellow${ChatColor.GRAY}: ${this.server.metadata.get("YELLOW_DTR").asString}") + + if (this.server.metadata.has("CAP_ZONE_DATA")) { + + val json = this.server.metadata["CAP_ZONE_DATA"].asJsonObject + + lore.add(" ") + lore.add("${json["CAP_ZONE_NAME"].asString}${ChatColor.GRAY}: ${ChatColor.RED}${TimeUtils.formatIntoMMSS(json["CAP_ZONE_TIME"].asInt)}") + } + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + if (server.players.contains(player.uniqueId)) { + lore.add("${ChatColor.GREEN}Click to rejoin.") + } else { + lore.add("${ChatColor.GREEN}Click to spectate.") + } + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun clicked(player: Player, slot: Int, clickType: ClickType?) { + player.closeInventory() + BungeeUtil.sendToServer(player,this.server.id) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/leaderboard/LeaderBoardElement.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/leaderboard/LeaderBoardElement.kt new file mode 100644 index 0000000..9d0cac3 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/menu/leaderboard/LeaderBoardElement.kt @@ -0,0 +1,59 @@ +package cc.fyre.engine.adapter.bunkers.menu.leaderboard + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.adapter.AdapterHandler +import net.frozenorb.qlib.menu.Button +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 17/02/2021 + * @author xanderume@gmail.com + */ +class LeaderBoardElement(private val key: String) : Button() { + + private val entry = GameEngine.instance.adapterHandler.config.leaderboards.firstOrNull{it.key.equals(this.key,true)} + + override fun getName(p0: Player?): String { + return ChatColor.translateAlternateColorCodes('&',"${ChatColor.GOLD}${ChatColor.BOLD}${this.entry?.displayName ?: this.key}") + } + + override fun getMaterial(p0: Player?): Material { + return Material.NETHER_STAR + } + + override fun getDescription(p0: Player?): MutableList { + + val lore = arrayListOf() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + for (index in 0 until (this.entry?.limit ?: 10)) { + + val prefix = "${AdapterHandler.TOP_COLORS[index + 1] ?: ChatColor.GRAY}#${index + 1}" + + if (index == 3) { + lore.add(" ") + } + + val pair = GameEngine.instance.adapterHandler.service.leaderboard.get(this.entry?.key ?: this.key,index) + + if (pair == null) { + lore.add("$prefix ${ChatColor.WHITE}???${ChatColor.GRAY}: ${ChatColor.WHITE}0") + continue + } + + + lore.add("$prefix ${pair.second.first}${ChatColor.GRAY}: ${ChatColor.WHITE}${pair.second.second}") + } + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout.kt new file mode 100644 index 0000000..c5717f3 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/bunkers/tab/BunkersTabLayout.kt @@ -0,0 +1,95 @@ +package cc.fyre.engine.adapter.bunkers.tab + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.party.data.Party +import net.frozenorb.qlib.tab.construct.TabLayout +import net.frozenorb.qlib.tab.provider.LayoutProvider +import net.frozenorb.qlib.tab.util.TabUtils +import net.frozenorb.qlib.util.PlayerUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 03/02/2021 + * @author xanderume@gmail.com + */ +object BunkersTabLayout : LayoutProvider { + + var lastPlayerUpdate = 0L + + override fun provide(player: Player): TabLayout { + + val is18 = TabUtils.is18(player) + val toReturn = TabLayout.create(player) + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + toReturn.set(0,3,"${ChatColor.GRAY}Online: ${Bukkit.getServer().onlinePlayers.size}") + toReturn.set(1,1,"${ChatColor.GOLD}${ChatColor.BOLD}Bunkers") + toReturn.set(2,3,"${ChatColor.GRAY}Queue: ${GameEngine.instance.queueHandler.getSize()}") + toReturn.set(1,3,"${ChatColor.BLUE}${ChatColor.BOLD}Your Party") + + var y = 4 + + if (this.lastPlayerUpdate == 0L || (System.currentTimeMillis() - this.lastPlayerUpdate > 1500L)) { + + for (member in party.findMembers().sortedByDescending{party.leader == it.uniqueId}) { + + toReturn.set( + 1, + y++, + "${if (party.leader == member.uniqueId) ChatColor.GOLD else ChatColor.GRAY}${ChatColor.BOLD}${Party.SYMBOL}${ChatColor.BLUE}${member.name}" + ) + + } + + y++ + + var x = 0 + + Bukkit.getServer().onlinePlayers.filter{player.canSee(it) && !party.members.contains(it.uniqueId)}.forEach{ + + toReturn.set( + x, + y, + it + ) + + if ((!is18 && x == 2) || (is18 && x == 3)) { + x++ + } + + x = if (x > (if (is18) 3 else 2)) 0 else x++ + } + + toReturn.set(19,0,"${ChatColor.RED}store.cavepvp.org") + toReturn.set(19,2,"${ChatColor.RED}ts.cavepvp.org") + } + + // TODO + // 3 NAMES + // 4 TEAMS + // 5 TEAMS + // 6 KOTH + // 7 + // 8 Party: + // 9 1 + // 10 2 + // 12 3 + // 13 4 + // 14 5 + // 15 EMPTY + // 16 NAMES + // 17 TEAMS + // 18 TEAMS + // 19 KOTH + // 20 empty + + return toReturn + } + +} diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/command/LeaderBoardAddCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/command/LeaderBoardAddCommand.kt new file mode 100644 index 0000000..e3493ba --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/command/LeaderBoardAddCommand.kt @@ -0,0 +1,47 @@ +package cc.fyre.engine.adapter.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.adapter.data.board.LeaderBoardEntry +import cc.fyre.engine.util.ConfigUtil +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.apache.commons.lang.StringUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 05/02/2021 + * @author xanderume@gmail.com + */ +object LeaderBoardAddCommand { + + @JvmStatic + @Command(names = ["leaderboard add"],permission = "engine.command.leaderboard.add") + fun execute(sender: Player, @Param(name = "key")key: String, @Param(name ="limit")limit: Int, @Param(name = "displayName",wildcard = true)displayName: String) { + + Bukkit.getScheduler().runTaskAsynchronously(GameEngine.instance) { + + val document = GameEngine.instance.api.profileHandler.collection.find().first() + + if (document != null && !document.containsKey(key)) { + sender.sendMessage("${ChatColor.YELLOW}$key${ChatColor.RED} is not a key, available keys: ${StringUtils.join(document.keys.map{"${ChatColor.YELLOW}$it"}.toTypedArray(),"${ChatColor.RED}, ")}") + return@runTaskAsynchronously + } + + val entry = LeaderBoardEntry(key,limit,displayName,sender.location.clone()) + + GameEngine.instance.adapterHandler.config.leaderboards.add(entry) + ConfigUtil.save(GameEngine.instance.adapterHandler.config) + + entry.refresh() + + + sender.sendMessage("${ChatColor.GREEN}Added leaderboard entry for ${ChatColor.YELLOW}${displayName}${ChatColor.GREEN} with mongo key \"${ChatColor.YELLOW}$key${ChatColor.GREEN}\" and a limit of ${ChatColor.YELLOW}$limit${ChatColor.GREEN}.") + } + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/command/LeaderBoardRefreshCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/command/LeaderBoardRefreshCommand.kt new file mode 100644 index 0000000..82f9ff6 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/command/LeaderBoardRefreshCommand.kt @@ -0,0 +1,28 @@ +package cc.fyre.engine.adapter.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 11/02/2021 + * @author xanderume@gmail.com + */ +object LeaderBoardRefreshCommand { + + @JvmStatic + @Command(names = ["leaderboard refresh"],permission = "engine.command.leaderboard.refresh") + fun execute(sender: Player) { + + Bukkit.getScheduler().runTaskAsynchronously(GameEngine.instance) { + GameEngine.instance.server.broadcastMessage("${GameEngine.instance.api.mode.prefix}${ChatColor.GREEN} Leaderboards have been refreshed.") + GameEngine.instance.adapterHandler.config.leaderboards.forEach{it.refresh()} + } + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/LobbyAdapter.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/LobbyAdapter.kt new file mode 100644 index 0000000..a700655 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/LobbyAdapter.kt @@ -0,0 +1,45 @@ +package cc.fyre.engine.adapter.data + +import cc.fyre.engine.GameEngineAPI + +import cc.fyre.engine.game.data.Game +import cc.fyre.engine.profile.data.Profile +import cc.fyre.engine.server.data.GameServer +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import net.frozenorb.qlib.tab.construct.TabLayout +import net.frozenorb.qlib.tab.provider.LayoutProvider +import java.util.* +import java.util.concurrent.ConcurrentHashMap +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +abstract class LobbyAdapter(val mode: GameEngineAPI.GameMode) { + + val profiles = ConcurrentHashMap() + + abstract fun getGames():HashMap> + abstract fun getGames(season: Int):Collection + + abstract fun getGames(uuid: UUID):HashMap> + abstract fun getGames(uuid: UUID,season: Int):Collection + + abstract fun getProfile(uuid: UUID):ProfileType + + abstract fun getMatchButton(game: Game, games: Collection, cached: HashMap>):Button + + abstract fun getSeasonButton(season: Int, games: Collection, cached: HashMap>):Button + + abstract fun getMatchInfoMenu(game: Game,games: Collection,cached: HashMap>): Menu + abstract fun getSpectateButton(server: GameServer):Button + abstract fun getLeaderboardButtons():MutableMap + + abstract fun getTabLayout():LayoutProvider? + abstract fun isDuelSupported():Boolean +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/board/LeaderBoardEntry.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/board/LeaderBoardEntry.kt new file mode 100644 index 0000000..adeebe0 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/board/LeaderBoardEntry.kt @@ -0,0 +1,126 @@ +package cc.fyre.engine.adapter.data.board + +import cc.fyre.engine.GameEngine + +import cc.fyre.engine.adapter.AdapterHandler + +import com.mongodb.client.model.Filters +import com.mongodb.client.model.Sorts +import net.frozenorb.qlib.hologram.FrozenHologramHandler +import net.frozenorb.qlib.hologram.construct.Hologram +import net.frozenorb.qlib.util.UUIDUtils + +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.Location +import java.lang.IllegalStateException +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project engine + * + * @date 05/02/2021 + * @author xanderume@gmail.com + */ +class LeaderBoardEntry(val key: String,val limit: Int,val displayName: String,val location: Location) { + + @Transient + private var hologram: Hologram? = null + + fun refresh() { + + if (Bukkit.isPrimaryThread()){ + throw IllegalStateException("Cannot refresh on main thread.") + } + + val lines = ArrayList() + + lines.add("${ChatColor.RED}${ChatColor.BOLD}${this.displayName}") + lines.add("${ChatColor.GOLD}${ChatColor.BOLD}Leaderboard") + lines.add("blank") + + if (this.hologram == null) { + this.hologram = FrozenHologramHandler.createHologram() + .at(this.location) + .build() + + FrozenHologramHandler.getCache().add(this.hologram) + } + + if (this.hologram!!.location != this.location) { + this.hologram!!.destroy() + this.hologram = FrozenHologramHandler.createHologram().at(this.location).build() + this.hologram!!.send() + // qlib so fucking ass + } + + val list = GameEngine.instance.api.profileHandler.collection.find().sort(Sorts.descending(this.key)).limit(this.limit).toList() + + for (index in 0 until this.limit) { + + if (index == 3) { + lines.add("blank") + } + + val document = if (index > list.lastIndex) null else list[index] + + val value = if (this.key == "playTime") { + this.getPlayTimeFormat(document?.getInteger(this.key)?.toLong() ?: 0L) + } else { + document?.getInteger(this.key)?.toString() ?: "0" + } + + var name = "${ChatColor.WHITE}???" + + if (document != null) { + + val uuid = UUID.fromString(document.getString("_id")) + + name = UUIDUtils.name(uuid) + + GameEngine.instance.adapterHandler.service.leaderboard.put(this.key,index,Pair(uuid,Pair(name,value))) + } + + lines.add("${AdapterHandler.TOP_COLORS[index + 1] ?: ChatColor.GRAY}#${index + 1} $name${ChatColor.GRAY}: ${ChatColor.WHITE}$value") + } + + this.hologram!!.setLines(lines) + } + + + private fun getPlayTimeFormat(millis: Long): String { + + if (millis == 0L) { + return "0s" + } + + val secs = millis / 1000L + + val remainder = secs % 86400 + + val days = secs / 86400 + val hours = remainder / 3600 + val minutes = remainder / 60 - hours * 60 + val seconds = remainder % 3600 - minutes * 60 + + val fDays = if (days > 0) " ${days}d" else "" + + var fHours = "" + var fMinutes = "" + var fSeconds = "" + + if (days < 1) { + fHours = if (hours > 0) " ${hours}h" else "" + + if (hours < 1) { + fMinutes = if (minutes > 0) " ${minutes}m" else "" + fSeconds = if (seconds > 0) " ${minutes}s" else "" + } + + } + + return (fDays + fHours + fMinutes + fSeconds).trim { it <= ' ' } + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/config/AdapterConfig.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/config/AdapterConfig.kt new file mode 100644 index 0000000..cab39be --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/data/config/AdapterConfig.kt @@ -0,0 +1,18 @@ +package cc.fyre.engine.adapter.data.config + +import cc.fyre.engine.adapter.data.board.LeaderBoardEntry +import cc.fyre.engine.util.JsonConfig +import org.bukkit.Location + +/** + * @project engine + * + * @date 05/02/2021 + * @author xanderume@gmail.com + */ +class AdapterConfig : JsonConfig() { + + val parties = ArrayList() + val leaderboards = ArrayList() + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/listener/AdapterListener.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/listener/AdapterListener.kt new file mode 100644 index 0000000..36b4da1 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/listener/AdapterListener.kt @@ -0,0 +1,21 @@ +package cc.fyre.engine.adapter.listener + +import cc.fyre.engine.GameEngine +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerQuitEvent +/** + * @project engine + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +class AdapterListener(private val instance: GameEngine) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.adapterHandler.getAdapter().profiles.remove(event.player.uniqueId) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/menu/GameHistoryMenu.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/menu/GameHistoryMenu.kt new file mode 100644 index 0000000..ca3e29a --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/menu/GameHistoryMenu.kt @@ -0,0 +1,49 @@ +package cc.fyre.engine.adapter.menu + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.game.data.Game +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.buttons.BackButton +import net.frozenorb.qlib.menu.pagination.PaginatedMenu +import org.bukkit.Material +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +class GameHistoryMenu(private val games: Collection,private val cached: HashMap>) : PaginatedMenu() { + + override fun getPrePaginatedTitle(p0: Player?): String { + return "Game History" + } + + override fun getAllPagesButtons(p0: Player?): MutableMap { + + val toReturn = HashMap() + + this.games.sortedByDescending{it.created} + .withIndex() + .forEach{toReturn[it.index] = GameEngine.instance.adapterHandler.getAdapter().getMatchButton(it.value,this.games,this.cached)} + + return toReturn + } + + override fun getGlobalButtons(player: Player?): MutableMap { + + val toReturn = HashMap() + + for (i in 1..7) { + toReturn[i] = if (i == 4) BackButton(GameSeasonMenu(this.cached)) else Button.placeholder(Material.STAINED_GLASS_PANE,15) + } + + return toReturn + } + + override fun getMaxItemsPerPage(player: Player): Int { + return 2*9 + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/menu/GameSeasonMenu.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/menu/GameSeasonMenu.kt new file mode 100644 index 0000000..1b71d5f --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/menu/GameSeasonMenu.kt @@ -0,0 +1,45 @@ +package cc.fyre.engine.adapter.menu + +import cc.fyre.engine.GameEngine + +import cc.fyre.engine.game.data.Game +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 05/02/2021 + * @author xanderume@gmail.com + */ +class GameSeasonMenu(private val games: HashMap>) : Menu() { + + override fun size(buttons: Map): Int { + return 3*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.DARK_PURPLE}${ChatColor.BOLD}Game History" + } + + override fun isPlaceholder(): Boolean { + return true + } + + override fun getButtons(player: Player): MutableMap { + + val toReturn = HashMap() + + + var i = 10 + + for (entry in this.games.entries) { + toReturn[i++] = GameEngine.instance.adapterHandler.getAdapter().getSeasonButton(entry.key,entry.value,this.games) + } + + return toReturn + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/service/LobbyUpdateService.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/service/LobbyUpdateService.kt new file mode 100644 index 0000000..3900104 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/adapter/service/LobbyUpdateService.kt @@ -0,0 +1,26 @@ +package cc.fyre.engine.adapter.service + +import cc.fyre.engine.GameEngine +import com.google.common.collect.HashBasedTable + +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.* + +/** + * @project engine + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +class LobbyUpdateService(private val instance: GameEngine) : BukkitRunnable() { + + // what the fuck + val leaderboard = HashBasedTable.create>>() + + override fun run() { + this.instance.server.broadcastMessage("${this.instance.api.mode.prefix}${ChatColor.GREEN} Leaderboards have been refreshed.") + this.instance.adapterHandler.config.leaderboards.forEach{it.refresh()} + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/EngineDumpCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/EngineDumpCommand.kt new file mode 100644 index 0000000..c057303 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/EngineDumpCommand.kt @@ -0,0 +1,44 @@ +package cc.fyre.engine.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import net.frozenorb.qlib.command.Command +import mkremins.fanciful.FancyMessage +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +object EngineDumpCommand { + + @JvmStatic + @Command(names = ["engine dump"],permission = "op") + fun execute(sender: CommandSender) { + + val servers = GameEngine.instance.api.gameServerHandler.cache.filter{it.value.mode == GameEngine.instance.api.mode} + + if (servers.isEmpty()) { + sender.sendMessage("No game servers running.") + return + } + + servers.values.forEach{ + + val toolTip = FancyMessage("${ChatColor.YELLOW}${it.players.size} Players") + .then("\n${ChatColor.YELLOW}${it.spectators.size} Spectators") + .then("\n${ChatColor.YELLOW}${it.disqualified.size} Disqualified") + + if (it.metadata.entrySet().isNotEmpty()) { + toolTip.then("\n") + } + + for (metadata in it.metadata.entrySet()) { + toolTip.then("${ChatColor.BLUE}\n${metadata.key}: ${metadata.value}") + } + + FancyMessage("${it.id} [${it.mode.name}: ${it.port}] - [R: ${it.ranked}] [S: ${it.state.name}] - Hover to view metadata.") + .formattedTooltip(toolTip) + .send(sender) + } + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/ForceSendCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/ForceSendCommand.kt new file mode 100644 index 0000000..3861be9 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/ForceSendCommand.kt @@ -0,0 +1,23 @@ +package cc.fyre.engine.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +/** + * @project bunkers + * + * @date 04/08/2020 + * @author xanderume@gmail.com + */ +object ForceSendCommand { + + @JvmStatic + @Command(names = ["forcesend"],permission = "engine.command.forcesend") + fun execute(sender: CommandSender) { + sender.sendMessage("${ChatColor.GREEN}Enabling force queue..") + GameEngine.instance.queueHandler.force = true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameHistoryCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameHistoryCommand.kt new file mode 100644 index 0000000..ee13fd0 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameHistoryCommand.kt @@ -0,0 +1,71 @@ +package cc.fyre.engine.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.adapter.menu.GameSeasonMenu +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.UUIDUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project engine + * + * @date 23/12/2020 + * @author xanderume@gmail.com + */ +object GameHistoryCommand { + + + @JvmStatic + @Command(names = ["games"],permission = "engine.command.games") + fun execute(player: Player) { + + Bukkit.getScheduler().runTaskAsynchronously(GameEngine.instance) { + + val games = GameEngine.instance.adapterHandler.getAdapter().getGames() + + if (games.isEmpty()) { + player.sendMessage("${ChatColor.RED}No games have been played so far!") + return@runTaskAsynchronously + } + + GameSeasonMenu(games).openMenu(player) + return@runTaskAsynchronously + } + + } + + @JvmStatic + @Command(names = ["gamehistory","matchhistory"],permission = "") + fun execute2(player: Player,@Param(name = "player",defaultValue = "self")uuid: UUID) { + + Bukkit.getScheduler().runTaskAsynchronously(GameEngine.instance) { + + var target = uuid + + if (player.uniqueId != target && !player.hasPermission("engine.command.games")) { + target = player.uniqueId + } + + val games = GameEngine.instance.adapterHandler.getAdapter().getGames(target) + + if (games.isEmpty()) { + + if (player.uniqueId != target) { + player.sendMessage("${ChatColor.RED}${UUIDUtils.name(target)} has not played any games yet!") + return@runTaskAsynchronously + } + + player.sendMessage("${ChatColor.RED}You have not played any games yet!") + return@runTaskAsynchronously + } + + GameSeasonMenu(games).openMenu(player) + } + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueueCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueueCommand.kt new file mode 100644 index 0000000..70fbb44 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueueCommand.kt @@ -0,0 +1,66 @@ +package cc.fyre.engine.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.profile.data.type.BunkersProfile +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.util.TimeUtils +import org.apache.commons.lang.StringUtils + +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 16/12/2020 + * @author xanderume@gmail.com + */ +object GameQueueCommand { + + // Prevent spamming + private val cache = HashMap() + + @JvmStatic + @Command(names = ["gamequeue"],permission = "") + fun execute(player: Player) { + + if (this.cache.containsKey(player.uniqueId) && ((this.cache[player.uniqueId]!! + 1000L) - System.currentTimeMillis()) > 0) { + return + } + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.leader != player.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not the leader of this party!") + return + } + + if (party.members.size == 1 && !GameEngine.instance.queueHandler.isAbleToQueue(player)) { + player.sendMessage("${ChatColor.RED}You cannot join the queue right now, either rejoin your last game or wait until you have been disqualified.") + return + } + + val unable = party.findMembers().filter{!GameEngine.instance.queueHandler.isAbleToQueue(it)} + + if (unable.isNotEmpty()) { + player.sendMessage( + "${ChatColor.RED}Your party is unable to queue as ${StringUtils.join(unable.map{it.name}.toTypedArray())}" + + "${ChatColor.RED} ${if (unable.size == 1) "is" else "are"} still able to rejoin their last ranked game!" + ) + return + } + + this.cache[player.uniqueId] = System.currentTimeMillis() + + if (GameEngine.instance.queueHandler.isQueued(player)) { + GameEngine.instance.queueHandler.removeFromQueue(party) + return + } + + GameEngine.instance.queueHandler.addToQueue(party) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueuePauseCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueuePauseCommand.kt new file mode 100644 index 0000000..82d3f5c --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueuePauseCommand.kt @@ -0,0 +1,31 @@ +package cc.fyre.engine.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +/** + * @project engine + * + * @date 14/01/2021 + * @author xanderume@gmail.com + */ +object GameQueuePauseCommand { + + const val PERMISSION = "engine.command.queue.pause" + + @JvmStatic + @Command(names = ["gamequeue pause"],permission = PERMISSION) + fun execute(sender: CommandSender) { + GameEngine.instance.queueHandler.paused = !GameEngine.instance.queueHandler.paused + + if (GameEngine.instance.queueHandler.paused) { + sender.sendMessage("${ChatColor.GREEN}Queue has been paused.") + return + } + + sender.sendMessage("${ChatColor.RED}Queue has been un-paused.") + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueueRankedCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueueRankedCommand.kt new file mode 100644 index 0000000..b7d2b5b --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/command/GameQueueRankedCommand.kt @@ -0,0 +1,31 @@ +package cc.fyre.engine.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +/** + * @project engine + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +object GameQueueRankedCommand { + + const val PERMISSION = "engine.command.queue.ranked" + + @JvmStatic + @Command(names = ["gamequeue ranked"],permission = PERMISSION) + fun execute(sender: CommandSender) { + GameEngine.instance.queueHandler.ranked = !GameEngine.instance.queueHandler.ranked + + if (GameEngine.instance.queueHandler.ranked) { + sender.sendMessage("${ChatColor.GREEN}Ranked queue has been enabled.") + return + } + + sender.sendMessage("${ChatColor.RED}Ranked queue has been disabled.") + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/engine/LobbyNameTagAdapter.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/engine/LobbyNameTagAdapter.kt new file mode 100644 index 0000000..881712b --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/engine/LobbyNameTagAdapter.kt @@ -0,0 +1,39 @@ +package cc.fyre.engine.engine + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.party.data.Party +import net.frozenorb.qlib.nametag.NametagInfo +import net.frozenorb.qlib.nametag.NametagProvider +import org.bukkit.Bukkit + +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.event.Listener + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +object LobbyNameTagAdapter : NametagProvider("Engine - Lobby Nametags",1),Listener { + + init { + Bukkit.getServer().pluginManager.registerEvents(this,GameEngine.instance) + } + + override fun fetchNametag(player: Player, target: Player): NametagInfo { + + val color = ChatColor.WHITE + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size > 1 && party.members.contains(target.uniqueId)) { + return createNametag("${ChatColor.BLUE}${Party.SYMBOL}${color}","") + } + + return createNametag(color.toString(),"") + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/engine/LobbyScoreboardAdapter.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/engine/LobbyScoreboardAdapter.kt new file mode 100644 index 0000000..d2e786b --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/engine/LobbyScoreboardAdapter.kt @@ -0,0 +1,78 @@ +package cc.fyre.engine.engine + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.command.GameQueuePauseCommand +import net.frozenorb.qlib.autoreboot.AutoRebootHandler +import net.frozenorb.qlib.scoreboard.ScoreGetter +import net.frozenorb.qlib.scoreboard.TitleGetter +import net.frozenorb.qlib.util.TimeUtils +import net.minecraft.util.org.apache.commons.lang3.StringUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +object LobbyScoreboardAdapter { + + var DOTS = 1 + val LINE = "${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",20)}" + + init { + Bukkit.getServer().scheduler.runTaskTimer(GameEngine.instance,{ if (DOTS++ >= 3) DOTS = 0 },12L,12L) + } + + object LobbyTitleGetter : TitleGetter() { + + override fun getTitle(player: Player): String { + + var suffix = "${ChatColor.WHITE}${GameEngine.instance.api.mode.displayName}" + + val reboot = AutoRebootHandler.getRebootSecondsRemaining() + + if (AutoRebootHandler.isRebooting() && reboot > 0L && reboot <= 300) { + suffix = "${ChatColor.RED}${TimeUtils.formatIntoMMSS(reboot)}" + } + + return "${ChatColor.GOLD}${ChatColor.BOLD}MC-Market ${ChatColor.GRAY}┃ $suffix" + } + + } + + object LobbyScoreGetter : ScoreGetter { + + override fun getScores(toReturn: net.frozenorb.qlib.util.LinkedList,player: Player) { + + toReturn.add(LINE) + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + toReturn.add("${ChatColor.GOLD}${ChatColor.BOLD}Online${ChatColor.GRAY}: ${ChatColor.WHITE}${GameEngine.instance.server.onlinePlayers.size}") + toReturn.add("${ChatColor.DARK_PURPLE}${ChatColor.BOLD}Queue${ChatColor.GRAY}: ${ChatColor.WHITE}${GameEngine.instance.queueHandler.getSize()}") + + if (GameEngine.instance.queueHandler.paused && player.hasPermission(GameQueuePauseCommand.PERMISSION)) { + toReturn.add(" ") + toReturn.add("${ChatColor.YELLOW}${ChatColor.BOLD}Paused") + } + + if (GameEngine.instance.queueHandler.isQueued(party)) { + toReturn.add(" ") + toReturn.add("${ChatColor.GREEN}${ChatColor.BOLD}${ChatColor.ITALIC}In Queue${ChatColor.GREEN}${ChatColor.ITALIC}${StringUtils.repeat(".",DOTS)}") + } + + if (GameEngine.instance.queueHandler.ranked) { + toReturn.add(" ") + toReturn.add("${ChatColor.GRAY}${ChatColor.BOLD}Ranked Mode") + } + + // dark blue, qlib garbage + toReturn.add("${ChatColor.DARK_BLUE}$LINE") + } + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/ItemHandler.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/ItemHandler.kt new file mode 100644 index 0000000..714aa08 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/ItemHandler.kt @@ -0,0 +1,48 @@ +package cc.fyre.engine.item + +import cc.fyre.engine.item.data.Item +import cc.fyre.engine.item.listener.ItemListener +import cc.fyre.engine.GameEngine +import cc.fyre.engine.item.data.type.* + +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import kotlin.collections.HashSet + +/** + * @project hub + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +class ItemHandler(private val instance: GameEngine) { + + private val cache = HashSet() + + init { + this.cache.add(QueueItem()) + this.cache.add(ReJoinItem()) + this.cache.add(SpectateItem()) + this.cache.add(LeaderBoardItem()) + + this.instance.server.pluginManager.registerEvents(ItemListener(this.instance),this.instance) + } + + fun refreshItems(player: Player) { + this.refreshItems(player,true) + } + + fun refreshItems(player: Player,clear: Boolean) { + + if (clear) { + player.inventory.clear() + } + + this.cache.filter{it.hasPermission(player)}.forEach{player.inventory.setItem(it.getSlot(player),it.getItem(player))} + } + + fun findItemByItemStack(itemStack: ItemStack, player: Player):Item? { + return this.cache.firstOrNull{it.isSimilar(player,itemStack)} + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/Item.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/Item.kt new file mode 100644 index 0000000..facc825 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/Item.kt @@ -0,0 +1,46 @@ +package cc.fyre.engine.item.data + +import cc.fyre.engine.GameEngine +import org.bukkit.entity.Player + +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +abstract class Item { + + abstract fun getSlot(player: Player):Int + abstract fun getItem(player: Player):ItemStack + abstract fun onInteract(event: PlayerInteractEvent) + + open fun hasPermission(player: Player) = true + + fun isSimilar(player: Player,stack: ItemStack?): Boolean { + + if (stack == null) { + return false + } + + val created = this.getItem(player) + + if (stack.typeId != created.typeId) { + return false + } + + if (stack.hasItemMeta() != created.hasItemMeta()) { + return false + } + + if (!GameEngine.instance.server.itemFactory.equals(stack.itemMeta,created.itemMeta)) { + return false + } + + return true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/CosmeticItem.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/CosmeticItem.kt new file mode 100644 index 0000000..e479b48 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/CosmeticItem.kt @@ -0,0 +1,32 @@ +package cc.fyre.engine.item.data.type + +import cc.fyre.engine.item.data.Item +import net.frozenorb.qlib.util.ItemBuilder + +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project hub + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +class CosmeticItem : Item() { + + override fun getSlot(player: Player): Int { + return 8 + } + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.NETHER_STAR).name("${ChatColor.RED}» ${ChatColor.LIGHT_PURPLE}${ChatColor.BOLD}Cosmetics ${ChatColor.RED}«").build() + } + + override fun onInteract(event: PlayerInteractEvent) { + event.player.chat("/cosmetic") + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/LeaderBoardItem.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/LeaderBoardItem.kt new file mode 100644 index 0000000..23d4a20 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/LeaderBoardItem.kt @@ -0,0 +1,40 @@ +package cc.fyre.engine.item.data.type + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.item.data.Item +import cc.fyre.engine.item.menu.LeaderBoardMenu +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project engine + * + * @date 17/02/2021 + * @author xanderume@gmail.com + */ +class LeaderBoardItem : Item() { + + override fun getSlot(player: Player): Int { + return 8 + } + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.EMERALD).name("${ChatColor.RED}» ${ChatColor.DARK_GREEN}${ChatColor.BOLD}Leaderboard ${ChatColor.RED}«").build() + } + + override fun onInteract(event: PlayerInteractEvent) { + + if (GameEngine.instance.adapterHandler.config.leaderboards.isEmpty()) { + event.player.sendMessage("${ChatColor.RED}No leaderboards have been setup!") + return + } + + LeaderBoardMenu().openMenu(event.player) + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/QueueItem.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/QueueItem.kt new file mode 100644 index 0000000..53aec12 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/QueueItem.kt @@ -0,0 +1,41 @@ +package cc.fyre.engine.item.data.type + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.item.data.Item +import net.frozenorb.qlib.util.ItemBuilder + +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack +import java.util.* + +/** + * @project hub + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +class QueueItem : Item() { + + override fun getSlot(player: Player): Int { + return 0 + } + + override fun getItem(player: Player): ItemStack { + + val queued = GameEngine.instance.queueHandler.isQueued(player) + + return ItemBuilder.of(Material.INK_SACK).data(if (GameEngine.instance.queueHandler.isQueued(player)) 10 else 8).name("${ChatColor.RED}» ${if (queued) "${ChatColor.GRAY}${ChatColor.BOLD}Leave Queue" else "${ChatColor.GREEN}${ChatColor.BOLD}Join Queue"} ${ChatColor.RED}«").build() + } + + override fun hasPermission(player: Player): Boolean { + return true + } + + override fun onInteract(event: PlayerInteractEvent) { + event.player.chat("/gamequeue") + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/ReJoinItem.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/ReJoinItem.kt new file mode 100644 index 0000000..6a9a9bc --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/ReJoinItem.kt @@ -0,0 +1,49 @@ +package cc.fyre.engine.item.data.type + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.item.data.Item +import cc.fyre.engine.util.BungeeUtil +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project engine + * + * @date 15/12/2020 + * @author xanderume@gmail.com + */ +class ReJoinItem : Item() { + + override fun getSlot(player: Player): Int { + return 1 + } + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.MAGMA_CREAM).name("${ChatColor.RED}» ${ChatColor.GOLD}${ChatColor.BOLD}Rejoin Game ${ChatColor.RED}«").build() + } + + override fun onInteract(event: PlayerInteractEvent) { + + val game = GameEngine.instance.api.gameServerHandler.findLastGame(event.player.uniqueId) + + if (game == null) { + event.player.sendMessage("${ChatColor.RED}This game is no longer available!") + + GameEngine.instance.server.scheduler.runTaskLater(GameEngine.instance,{ + GameEngine.instance.itemHandler.refreshItems(event.player) + event.player.updateInventory() + },1L) + return + } + + BungeeUtil.sendToServer(event.player,game.id) + } + + override fun hasPermission(player: Player): Boolean { + return GameEngine.instance.partyHandler.findById(player.uniqueId).members.size <= 1 && GameEngine.instance.api.gameServerHandler.findLastGame(player.uniqueId) != null + } +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/SpectateItem.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/SpectateItem.kt new file mode 100644 index 0000000..5038e24 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/data/type/SpectateItem.kt @@ -0,0 +1,41 @@ +package cc.fyre.engine.item.data.type + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.item.data.Item +import cc.fyre.engine.item.menu.SpectateMenu +import net.frozenorb.qlib.util.ItemBuilder +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +class SpectateItem : Item() { + + override fun getSlot(player: Player): Int { + return 4 + } + + + override fun getItem(player: Player): ItemStack { + return ItemBuilder.of(Material.WATCH).name("${ChatColor.RED}» ${ChatColor.YELLOW}${ChatColor.BOLD}Spectate Game ${ChatColor.RED}«").build() + } + + override fun onInteract(event: PlayerInteractEvent) { + + if (GameEngine.instance.api.gameServerHandler.findSpectatableGames().isEmpty()) { + event.player.sendMessage("${ChatColor.RED}There are no games to spectate!") + return + } + + SpectateMenu().openMenu(event.player) + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/listener/ItemListener.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/listener/ItemListener.kt new file mode 100644 index 0000000..209db9e --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/listener/ItemListener.kt @@ -0,0 +1,46 @@ +package cc.fyre.engine.item.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.server.data.GameServer +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import com.google.gson.JsonObject +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener + +import org.bukkit.event.player.PlayerInteractEvent + +/** + * @project hub + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +class ItemListener(private val instance: GameEngine):Listener, ParasiteListener { + + init { + this.instance.api.databaseHandler.symbiote.addListener(this) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (!event.action.name.contains("RIGHT",true)) { + return + } + + if (event.item == null) { + return + } + + this.instance.itemHandler.findItemByItemStack(event.item,event.player)?.onInteract(event) + } + + @Parasite(GameServer.DELETE_ID) + fun onServerDelete(data: JsonObject) { + // If a game server ends and the player is in the lobby being able to rejoin the queue update their inventory. + this.instance.api.gson.fromJson(data,GameServer::class.java).players.mapNotNull{this.instance.server.getPlayer(it)}.forEach{this.instance.itemHandler.refreshItems(it)} + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/menu/LeaderBoardMenu.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/menu/LeaderBoardMenu.kt new file mode 100644 index 0000000..0b05330 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/menu/LeaderBoardMenu.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.item.menu + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.Menu +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 17/02/2021 + * @author xanderume@gmail.com + */ +class LeaderBoardMenu : Menu() { + + override fun size(buttons: Map): Int { + return 3*9 + } + + override fun getTitle(player: Player): String { + return "${ChatColor.DARK_GREEN}Leaderboard" + } + + override fun isPlaceholder(): Boolean { + return true + } + + override fun getButtons(p0: Player?): MutableMap { + return GameEngine.instance.adapterHandler.getAdapter().getLeaderboardButtons() + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/menu/SpectateMenu.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/menu/SpectateMenu.kt new file mode 100644 index 0000000..c9aa0ff --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/item/menu/SpectateMenu.kt @@ -0,0 +1,30 @@ +package cc.fyre.engine.item.menu + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.menu.Button +import net.frozenorb.qlib.menu.pagination.PaginatedMenu + +import org.bukkit.entity.Player + +class SpectateMenu : PaginatedMenu() { + + override fun getPrePaginatedTitle(p0: Player?): String { + return "Spectatable Games" + } + + override fun getAllPagesButtons(p0: Player?): MutableMap { + return GameEngine.instance.api.gameServerHandler.findSpectatableGames() + .withIndex() + .associate{it.index to GameEngine.instance.adapterHandler.getAdapter().getSpectateButton(it.value)} + .toMutableMap() + } + + override fun getMaxItemsPerPage(player: Player): Int { + return 9 + } + + override fun isAutoUpdate(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/listener/DoubleJumpListener.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/listener/DoubleJumpListener.kt new file mode 100644 index 0000000..6648fc0 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/listener/DoubleJumpListener.kt @@ -0,0 +1,104 @@ +package cc.fyre.engine.listener + +import cc.fyre.engine.GameEngine +import org.bukkit.Bukkit +import org.bukkit.Effect +import org.bukkit.GameMode +import org.bukkit.Sound +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityDamageEvent +import org.bukkit.event.player.PlayerMoveEvent +import org.bukkit.event.player.PlayerToggleFlightEvent +import org.bukkit.event.player.PlayerToggleSneakEvent +import java.util.* + +/** + * @project engine + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +class DoubleJumpListener(private val instance: GameEngine) : Listener { + + private val cache = hashSetOf() + + @EventHandler(priority = EventPriority.NORMAL) + fun onToggleFlight(event: PlayerToggleFlightEvent) { + + val player = event.player + + if (player.gameMode == GameMode.CREATIVE) { + return + } + + player.allowFlight = false + player.isFlying = false + + if (player.isInsideVehicle) { + event.isCancelled = true + return + } + + player.velocity = player.location.direction.multiply(2).setY(1.0) + + player.playSound(player.location,Sound.EXPLODE,1F,4F) + + + Bukkit.getServer().onlinePlayers.filter{it.canSee(player)}.forEach{ + it.playEffect(player.location,Effect.MOBSPAWNER_FLAMES,8) + } + + event.isCancelled = true + } + + + @EventHandler(priority = EventPriority.NORMAL) + fun onPlayerToggleSneak(event: PlayerToggleSneakEvent) { + + if (event.player.isOnGround || event.player.allowFlight || !this.cache.contains(event.player.uniqueId)) { + return + } + + event.player.velocity = event.player.location.direction.multiply(3.5) + event.player.playSound(event.player.location,Sound.WITHER_HURT,7.5F,7.5F) + + this.cache.remove(event.player.uniqueId) + } + + @EventHandler(priority = EventPriority.NORMAL) + fun onEntityDamage(event: EntityDamageEvent) { + + if (event.entity !is Player) { + return + } + if (event.cause != EntityDamageEvent.DamageCause.FALL) { + return + } + + val player = event.entity as Player + + player.allowFlight = true + + this.cache.add(player.uniqueId) + } + + @EventHandler(priority = EventPriority.NORMAL) + fun onPlayerMove(event: PlayerMoveEvent) { + + if (!event.player.isOnGround) { + return + } + if (event.player.allowFlight) { + return + } + + event.player.allowFlight = true + + this.cache.add(event.player.uniqueId) + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/listener/GeneralListener.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/listener/GeneralListener.kt new file mode 100644 index 0000000..f49aacf --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/listener/GeneralListener.kt @@ -0,0 +1,163 @@ +package cc.fyre.engine.listener + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.menu.Menu +import org.bukkit.GameMode +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.entity.* +import org.bukkit.event.hanging.HangingPlaceEvent +import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.player.* +import org.bukkit.event.weather.WeatherChangeEvent + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class GeneralListener(private val instance: GameEngine) : Listener { + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + event.player.health = 20.0 + event.player.foodLevel = 20 + event.player.saturation = 20.0F + + event.player.walkSpeed = 0.4F + + event.player.gameMode = GameMode.ADVENTURE + event.player.inventory.clear() + event.player.inventory.heldItemSlot = 0 + event.player.inventory.armorContents = null + + event.player.teleport(this.instance.server.getWorld("world").spawnLocation.add(0.5,0.0,0.5)) + + event.joinMessage = null + + this.instance.itemHandler.refreshItems(event.player) + } + + @EventHandler(priority = EventPriority.LOW) + private fun onQuit(event: PlayerQuitEvent) { + event.quitMessage = null + } + + + @EventHandler(priority = EventPriority.LOWEST) + private fun onFoodLevelChange(event: FoodLevelChangeEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onWeatherChange(event: WeatherChangeEvent) { + event.world.time = 6000 + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDropItem(event: PlayerDropItemEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerPickupItem(event: PlayerPickupItemEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onInventoryClick(event: InventoryClickEvent) { + + if (event.whoClicked !is Player) { + return + } + + if (event.whoClicked.gameMode == GameMode.CREATIVE) { + return + } + + if (Menu.currentlyOpenedMenus.containsKey(event.whoClicked.name)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onCreeperPower(event: CreeperPowerEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityExplode(event: EntityExplodeEvent) { + event.blockList().clear() + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onExplosionPrime(event: ExplosionPrimeEvent) { + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerMove(event: PlayerMoveEvent) { + + if (event.to.y > 50) { + return + } + + event.player.teleport(this.instance.server.getWorld("world").spawnLocation.add(0.5,0.0,0.5)) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onHangingPlace(event: HangingPlaceEvent) { + + if (event.player.gameMode == GameMode.CREATIVE) { + return + } + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/PartyHandler.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/PartyHandler.kt new file mode 100644 index 0000000..272a16f --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/PartyHandler.kt @@ -0,0 +1,51 @@ +package cc.fyre.engine.party + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.party.command.* +import cc.fyre.engine.party.data.Party +import cc.fyre.engine.party.listener.PartyListener +import net.frozenorb.qlib.command.FrozenCommandHandler +import java.util.* +import kotlin.collections.HashSet + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class PartyHandler(private val instance: GameEngine) { + + // technically everyone is in a party just if there's only one person in the party it won't show they are. + + var limit = 5 + val cache = HashSet() + + init { + + FrozenCommandHandler.registerClass(PartyChatCommand::class.java) + FrozenCommandHandler.registerClass(PartyOpenCommand::class.java) + FrozenCommandHandler.registerClass(PartyInfoCommand::class.java) + FrozenCommandHandler.registerClass(PartyJoinCommand::class.java) + FrozenCommandHandler.registerClass(PartyKickCommand::class.java) + FrozenCommandHandler.registerClass(PartyLeaveCommand::class.java) + FrozenCommandHandler.registerClass(PartyInviteCommand::class.java) + FrozenCommandHandler.registerClass(PartyLeaderCommand::class.java) + FrozenCommandHandler.registerClass(PartyDisbandCommand::class.java) + + this.instance.server.pluginManager.registerEvents(PartyListener(this.instance),this.instance) + } + + fun findById(id: UUID):Party { + return this.cache.firstOrNull{it.members.contains(id)} ?: Party(id) + } + + fun findByUuid(uuid: UUID):Party? { + return this.cache.firstOrNull{it.id == uuid} + } + + fun isInParty(uuid: UUID):Boolean { + return this.cache.firstOrNull{it.members.contains(uuid)}?.members?.size == 1 + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyChatCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyChatCommand.kt new file mode 100644 index 0000000..145d158 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyChatCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 13/08/2020 + * @author xanderume@gmail.com + */ +object PartyChatCommand { + + @JvmStatic + @Command(names = ["party chat","p chat"],permission = "") + fun execute(player: Player) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + party.chat[player.uniqueId] = !(party.chat[player.uniqueId] ?: false) + + player.sendMessage("${ChatColor.YELLOW}You are now talking in ${if (party.chat[player.uniqueId]!!) "${ChatColor.BLUE}party" else "${ChatColor.RED}public"}${ChatColor.YELLOW} chat.") + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyDisbandCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyDisbandCommand.kt new file mode 100644 index 0000000..979e91c --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyDisbandCommand.kt @@ -0,0 +1,37 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyDisbandCommand { + + @JvmStatic + @Command(names = ["party disband","p disband"],permission = "") + fun execute(player: Player) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + if (party.leader != player.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not the leader of this party.") + return + } + + party.disband() + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyInfoCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyInfoCommand.kt new file mode 100644 index 0000000..7c625eb --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyInfoCommand.kt @@ -0,0 +1,38 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyInfoCommand { + + @JvmStatic + @Command(names = ["party info","p info"],permission = "") + fun execute(player: Player,@Param(name = "player",defaultValue = "self")target: Player) { + + val party = GameEngine.instance.partyHandler.findById(target.uniqueId) + + if (party.members.size == 1) { + + if (player.uniqueId == target.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + player.sendMessage("${ChatColor.RED}${target.name} is not in a party!") + return + } + + party.sendInfo(player) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyInviteCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyInviteCommand.kt new file mode 100644 index 0000000..75d96fd --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyInviteCommand.kt @@ -0,0 +1,82 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.profile.data.type.BunkersProfile +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param + +import mkremins.fanciful.FancyMessage +import net.frozenorb.qlib.command.FrozenCommandHandler +import net.frozenorb.qlib.command.parameter.PlayerParameterType +import net.frozenorb.qlib.util.TimeUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyInviteCommand { + + @JvmStatic + @Command(names = ["party invite","p invite"],permission = "") + fun execute(player: Player,@Param(name = "player")argument: String) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.leader != player.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not the leader of this party.") + return + } + + if (player.isOp && argument == "**") { + + val message = FancyMessage("${ChatColor.AQUA}${player.name} has invited you to their party, click ") + + message.then("${ChatColor.YELLOW}here").tooltip("${ChatColor.GREEN}Click to join ${player.name}${ChatColor.GREEN}'s party!").command("/party join ${player.name}") + message.then("${ChatColor.AQUA} to join!") + + Bukkit.getServer().onlinePlayers.filter{!party.members.contains(it.uniqueId)}.forEach{ + message.send(it) + party.invites.add(it.uniqueId) + } + + party.sendMessage("${player.name} ${ChatColor.AQUA}has invited all online players.") + return + } + + val target = (FrozenCommandHandler.getParameterType(Player::class.java) as PlayerParameterType).transform(player,argument) + + if (party.members.contains(target.uniqueId)) { + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + player.sendMessage("${ChatColor.RED}${target.name} is already in your party.") + return + } + + if (party.invites.contains(target.uniqueId)) { + player.sendMessage("${ChatColor.RED}${target.name} has already been invited.") + return + } + + party.invites.add(target.uniqueId) + + val message = FancyMessage("${player.name}${ChatColor.AQUA} has invited you to their party, click ") + + message.then("${ChatColor.YELLOW}here").tooltip("${ChatColor.GREEN}Click to join ${player.name}${ChatColor.GREEN}'s party!").command("/party join ${player.name}") + message.then("${ChatColor.AQUA} to join!") + + message.send(target) + + party.findMembers().forEach{it.sendMessage("${target.name}${ChatColor.GREEN} has been invited to the party.")} + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyJoinCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyJoinCommand.kt new file mode 100644 index 0000000..57e0b8d --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyJoinCommand.kt @@ -0,0 +1,52 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.profile.data.type.BunkersProfile +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.TimeUtils +import net.frozenorb.qlib.util.UUIDUtils + + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyJoinCommand { + + @JvmStatic + @Command(names = ["party join","p join","party accept","p accept"],permission = "") + fun execute(player: Player,@Param(name = "player")target: Player) { + + val party = GameEngine.instance.partyHandler.findById(target.uniqueId) + + if (party.members.size == 1 && (!party.invites.contains(player.uniqueId) && !party.open)) { + player.sendMessage("${ChatColor.RED}${target.name} is not in a party!") + return + } + + if (party.isFull()) { + player.sendMessage("${ChatColor.RED}This party is full.") + return + } + + if (!party.canJoin(player.uniqueId)) { + player.sendMessage("${ChatColor.RED}You have not been invited this party.") + return + } + + party.addMember(player) + party.sendMessage("${ChatColor.GREEN}${player.name} has joined the party!") + + player.sendMessage("${ChatColor.GREEN}You have joined ${UUIDUtils.name(party.leader)}${ChatColor.GREEN}'s party!") + + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyKickCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyKickCommand.kt new file mode 100644 index 0000000..4f3fb11 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyKickCommand.kt @@ -0,0 +1,45 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyKickCommand { + + @JvmStatic + @Command(names = ["party kick","p kick"],permission = "") + fun execute(player: Player,@Param(name = "player")target: Player) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + if (party.leader != player.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not the leader of this party.") + return + } + + if (!party.members.contains(target.uniqueId)) { + player.sendMessage("${ChatColor.RED}${target.name} is not in your party!") + return + } + + party.removeMember(target) + party.sendMessage("${ChatColor.RED}${target.name} has been kicked from the party.") + + target.sendMessage("${ChatColor.RED}You have been kicked from the party.") + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyLeaderCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyLeaderCommand.kt new file mode 100644 index 0000000..7cc148d --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyLeaderCommand.kt @@ -0,0 +1,47 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyLeaderCommand { + + @JvmStatic + @Command(names = ["party leader","p leader","party promote","p promote"],permission = "") + fun execute(player: Player, @Param(name = "player")target: Player) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + if (party.leader != player.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not the leader of this party.") + return + } + + if (party.leader == target.uniqueId) { + player.sendMessage("${ChatColor.RED}You are already the leader of this party.") + return + } + + if (!party.members.contains(target.uniqueId)) { + player.sendMessage("${ChatColor.RED}${target.name} is not in your party!") + return + } + + party.setLeader(target) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyLeaveCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyLeaveCommand.kt new file mode 100644 index 0000000..22c4d99 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyLeaveCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +object PartyLeaveCommand { + + @JvmStatic + @Command(names = ["party leave","p leave"],permission = "") + fun execute(player: Player) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + party.removeMember(player) + party.sendMessage("${ChatColor.RED}${player.name} has left the party.") + } + + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyOpenCommand.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyOpenCommand.kt new file mode 100644 index 0000000..51bcf13 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/command/PartyOpenCommand.kt @@ -0,0 +1,36 @@ +package cc.fyre.engine.party.command + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.command.Command + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project engine + * + * @date 13/08/2020 + * @author xanderume@gmail.com + */ +object PartyOpenCommand { + + @JvmStatic + @Command(names = ["party open","p open"],permission = "") + fun execute(player: Player) { + + val party = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (party.members.size == 1) { + player.sendMessage("${ChatColor.RED}You are not in a party!") + return + } + + if (party.leader != player.uniqueId) { + player.sendMessage("${ChatColor.RED}You are not the leader of this party.") + return + } + + party.setPrivacy(!party.open) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/data/Party.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/data/Party.kt new file mode 100644 index 0000000..f65d711 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/data/Party.kt @@ -0,0 +1,167 @@ +package cc.fyre.engine.party.data + +import cc.fyre.engine.GameEngine +import net.frozenorb.qlib.nametag.FrozenNametagHandler +import net.frozenorb.qlib.util.UUIDUtils + +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import java.util.* +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class Party(var leader: UUID) { + + val id = UUID.randomUUID() + + var open = false + var joinedQueue = 0L + + val chat = HashMap() + val invites = ArrayList() + val members = ArrayList() + + init { + this.chat[this.leader] = false + this.members.add(this.leader) + } + + fun isFull():Boolean { + return this.members.size >= GameEngine.instance.partyHandler.limit + } + + fun canJoin(uuid: UUID):Boolean { + return this.invites.remove(uuid) || this.open + } + + fun sendInfo(sender: CommandSender) { + sender.sendMessage(LINE) + sender.sendMessage("${ChatColor.YELLOW}Leader: ${ChatColor.WHITE}${UUIDUtils.name(this.leader)}") + + if (this.members.size != 1) { + sender.sendMessage("${ChatColor.YELLOW}Members: ${ChatColor.RED}${StringUtils.join(this.findMembers() + .filter{ member -> member.uniqueId != this.leader} + .map{ member -> "${ChatColor.WHITE}UUIDUtils.name(member.uniqueId)"}.toTypedArray())}" + ) + } + + sender.sendMessage(LINE) + } + + fun sendMessage(vararg message: String) { + return this.members.mapNotNull{GameEngine.instance.server.getPlayer(it)}.forEach{it.sendMessage(message)} + } + + fun setPrivacy(open: Boolean) { + this.open = open + this.sendMessage("${ChatColor.AQUA}The party privacy has been set to ${if (open) "${ChatColor.GREEN}open" else "${ChatColor.RED}closed"}${ChatColor.AQUA}.") + } + + fun setLeader(player: Player) { + + if (player.uniqueId == this.leader) { + return + } + + val leader = GameEngine.instance.server.getPlayer(this.leader) + + this.leader = player.uniqueId + + if (leader != null) { + GameEngine.instance.itemHandler.refreshItems(leader) + } + + GameEngine.instance.itemHandler.refreshItems(player) + + this.findMembers().forEach{it.sendMessage("${ChatColor.AQUA}${player.name} has been promoted to the party leader.")} + } + + fun disband() { + GameEngine.instance.queueHandler.removeFromQueue(this) + + val members = this.findMembers() + + if (this.members.size != 1) { + this.sendMessage("${ChatColor.RED}${ChatColor.BOLD}The party has been disbanded.") + members.forEach{this.removeMember(it)} + } + + members.forEach{GameEngine.instance.itemHandler.refreshItems(it)} + + GameEngine.instance.partyHandler.cache.remove(this) + } + + fun removeMember(player: Player) { + + if (this.members.size == 1) { + GameEngine.instance.partyHandler.cache.remove(this) + return + } + + GameEngine.instance.partyHandler.cache.add(Party(player.uniqueId)) + + this.chat.remove(player.uniqueId) + this.members.remove(player.uniqueId) + + for (member in this.findMembers()) { + FrozenNametagHandler.reloadPlayer(player,member) + } + + GameEngine.instance.itemHandler.refreshItems(player) + + val leader = GameEngine.instance.server.getPlayer(this.leader) ?: return + + GameEngine.instance.itemHandler.refreshItems(leader) + } + + fun addMember(player: Player) { + + val previous = GameEngine.instance.partyHandler.findById(player.uniqueId) + + if (GameEngine.instance.queueHandler.isQueued(previous)) { + GameEngine.instance.queueHandler.removeFromQueue(previous) + } + + if (previous.members.size == 1) { + GameEngine.instance.partyHandler.cache.remove(previous) + } else { + previous.members.remove(player.uniqueId) + previous.setLeader(previous.findMembers().first()) + } + + this.chat[player.uniqueId] = true + this.members.add(player.uniqueId) + this.invites.remove(player.uniqueId) + + if (this.members.size == 2) { + GameEngine.instance.itemHandler.refreshItems(GameEngine.instance.server.getPlayer(this.leader)) + } + + GameEngine.instance.itemHandler.refreshItems(player) + + for (member in this.findMembers()) { + FrozenNametagHandler.reloadPlayer(player,member) + } + } + + fun findMembers():MutableSet { + return this.members.mapNotNull{GameEngine.instance.server.getPlayer(it)}.toMutableSet() + } + + companion object { + + val LINE = "${ChatColor.BLUE}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",40)}" + + const val SYMBOL = "✦" + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/listener/PartyListener.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/listener/PartyListener.kt new file mode 100644 index 0000000..443de94 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/party/listener/PartyListener.kt @@ -0,0 +1,74 @@ +package cc.fyre.engine.party.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.party.data.Party + +import org.bukkit.ChatColor +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.AsyncPlayerChatEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent + +/** + * @project engine + * + * @date 10/08/2020 + * @author xanderume@gmail.com + */ +class PartyListener(private val instance: GameEngine): Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerJoin(event: PlayerJoinEvent) { + this.instance.partyHandler.cache.add(Party(event.player.uniqueId)) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + val party = this.instance.partyHandler.findById(event.player.uniqueId) + + party.removeMember(event.player) + party.sendMessage("${ChatColor.RED}${event.player.name} has disconnected.") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onAsyncChat(event: AsyncPlayerChatEvent) { + + if (event.isCancelled) { + return + } + + val party = this.instance.partyHandler.findById(event.player.uniqueId) + + if (party.members.size == 1) { + return + } + + val partyPrefix = event.message[0] == '@' + val globalPrefix = event.message[0] == '!' + + if (partyPrefix || globalPrefix) { + + if (event.message.length == 1) { + event.player.sendMessage("${ChatColor.RED}You must supply a message.") + event.isCancelled = true + return + } + + event.message = event.message.substring(1).trim() + } + + if (partyPrefix || (party.chat[event.player.uniqueId] == true && !globalPrefix)) { + event.recipients.clear() + event.recipients.addAll(party.findMembers()) + + event.format = "${ChatColor.DARK_AQUA}(Party) ${event.player.name}:${ChatColor.YELLOW} ${event.message}" + return + } + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/QueueHandler.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/QueueHandler.kt new file mode 100644 index 0000000..abed31a --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/QueueHandler.kt @@ -0,0 +1,108 @@ +package cc.fyre.engine.queue + +import cc.fyre.engine.queue.listener.QueueListener +import cc.fyre.engine.queue.service.QueueService +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.party.data.Party +import cc.fyre.engine.server.data.GameServer +import cc.fyre.symbiote.Symbiote +import cc.fyre.symbiote.SymbioteAPI +import com.google.gson.JsonObject +import org.bukkit.ChatColor + +import org.bukkit.entity.Player +import java.util.* +import kotlin.collections.ArrayList + +import kotlin.collections.HashSet + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +class QueueHandler(private val instance: GameEngine) { + + var force = false + var paused = false + var ranked = false + + val cache = ArrayList() + + private var size = 0 + private var lastSizeUpdate = 0L + + private val service = QueueService(this.instance) + + init { + this.instance.server.scheduler.runTaskTimerAsynchronously(this.instance,this.service,20L,20L) + this.instance.server.pluginManager.registerEvents(QueueListener(this.instance),this.instance) + } + + fun isQueued(party: Party):Boolean { + return this.cache.contains(party) + } + + fun isQueued(player: Player):Boolean { + return this.cache.contains(this.instance.partyHandler.findById(player.uniqueId)) + } + + fun addToQueue(party: Party) { + + if (!this.cache.add(party)) { + return + } + + party.joinedQueue = System.currentTimeMillis() + party.findMembers().forEach{this.instance.itemHandler.refreshItems(it)} + } + + fun removeFromQueue(party: Party) { + + if (!this.cache.remove(party)) { + return + } + + party.joinedQueue = 0L + party.findMembers().forEach{this.instance.itemHandler.refreshItems(it)} + } + + fun getSize():Int { + + // prevent lag + if (this.lastSizeUpdate == 0L || (System.currentTimeMillis() - this.lastSizeUpdate > 500L)) { + this.size = this.cache.sumBy{it.members.size} + this.lastSizeUpdate = System.currentTimeMillis() + } + + return this.size + } + + fun isAbleToQueue(player: Player):Boolean { + + val game = this.instance.api.gameServerHandler.findLastGame(player.uniqueId) ?: return true + + if (this.ranked && game.ranked && !game.disqualified.contains(player.uniqueId)) { + return false + } + + return true + } + + fun sendGame(server: GameServer,parties: Collection,ranked: Boolean) { + this.cache.removeIf{parties.contains(it)} + + val payload = JsonObject() + + payload.addProperty("_id",server.id) + payload.addProperty("mode",server.mode.name) + payload.addProperty("ranked",ranked) + payload.addProperty("parties",SymbioteAPI.GSON.toJson(parties.map{it.members}.toList())) + + this.service.lastGame = System.currentTimeMillis() + this.instance.api.databaseHandler.symbiote.sendPacket(Symbiote(GameEngineAPI.GAME_DATA_PACKET,payload)) + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/listener/QueueListener.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/listener/QueueListener.kt new file mode 100644 index 0000000..4ef9a6f --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/listener/QueueListener.kt @@ -0,0 +1,58 @@ +package cc.fyre.engine.queue.listener + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.GameEngineAPI +import cc.fyre.engine.util.BungeeUtil +import cc.fyre.symbiote.Symbiote +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import com.google.gson.JsonObject +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.PlayerQuitEvent +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project bunkers + * + * @date 28/07/2020 + * @author xanderume@gmail.com + */ +class QueueListener(private val instance: GameEngine): Listener,ParasiteListener { + + init { + this.instance.api.databaseHandler.symbiote.addListener(this) + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.queueHandler.removeFromQueue(this.instance.partyHandler.findById(event.player.uniqueId)) + } + + @Parasite(GameEngineAPI.GAME_SEND_PACKET) + fun onPacketReceive(data: JsonObject) { + + if (GameEngineAPI.GameMode.valueOf(data["mode"].asString) != this.instance.api.mode) { + return + } + + val players = this.instance.api.gson.fromJson>(data["players"].asString,List::class.java) + .toCollection(ArrayList()) + .map{UUID.fromString(it)} + .mapNotNull{this.instance.server.getPlayer(it)} + + players.forEach{BungeeUtil.sendToServer(it,data["_id"].asString)} + + val payload = JsonObject() + + payload.addProperty("_id",data["_id"].asString) + payload.addProperty("mode",this.instance.api.mode.name) + payload.addProperty("players",this.instance.api.gson.toJson(players.map{it.uniqueId})) + + this.instance.api.databaseHandler.symbiote.sendPacket(Symbiote(GameEngineAPI.GAME_SENT_PACKET,payload)) + this.instance.queueHandler.force = false + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/service/QueueService.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/service/QueueService.kt new file mode 100644 index 0000000..f29a30f --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/queue/service/QueueService.kt @@ -0,0 +1,81 @@ +package cc.fyre.engine.queue.service + +import cc.fyre.engine.GameEngine +import cc.fyre.engine.party.data.Party + +import org.bukkit.ChatColor +import java.util.concurrent.TimeUnit + +/** + * @project bunkers + * + * @date 02/08/2020 + * @author xanderume@gmail.com + */ +class QueueService(private val instance: GameEngine) : Runnable { + + var lastGame = 0L + + override fun run() { + + if (this.instance.queueHandler.paused) { + return + } + + if (!this.instance.queueHandler.force && this.instance.queueHandler.getSize() < this.instance.api.mode.requiredQueueSize) { + return + } + + val game = this.instance.api.gameServerHandler.cache.values.firstOrNull{it.isAvailable() && it.mode == this.instance.api.mode} + + if (game == null) { + this.instance.logger.info("Unable to find available game..") + return + } + + if (this.lastGame != 0L && (System.currentTimeMillis() - this.lastGame <= START_DELAY)) { + return + } + + var count = 0 + val parties = ArrayList() + + for (party in this.instance.queueHandler.cache.filter{it.joinedQueue != 0L}.sortedByDescending{it.members.size}) { + + if (count >= this.instance.api.mode.requiredQueueSize) { + break + } + + party.members.removeIf{ + + if (count >= this.instance.api.mode.requiredQueueSize) { + + val player = this.instance.server.getPlayer(it) ?: return@removeIf true + + player.sendMessage("${ChatColor.RED}You have been removed since the game is full and your party joined later!") + + this.instance.partyHandler.cache.add(Party(player.uniqueId)) + return@removeIf true + } + + count++ + return@removeIf false + } + + parties.add(party) + + this.instance.partyHandler.cache.remove(party) + this.instance.queueHandler.cache.remove(party) + } + + this.instance.queueHandler.force = false + this.instance.queueHandler.sendGame(game,parties,this.instance.queueHandler.ranked) + } + + companion object { + + val START_DELAY = TimeUnit.SECONDS.toMillis(5L) + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/BungeeUtil.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/BungeeUtil.kt new file mode 100644 index 0000000..358c55a --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/BungeeUtil.kt @@ -0,0 +1,28 @@ +package cc.fyre.engine.util + +import cc.fyre.engine.GameEngine +import com.google.common.io.ByteStreams +import org.bukkit.entity.Player + +object BungeeUtil { + + const val PROXY_CHANNEL = "BungeeCord" + + @JvmStatic + fun sendToServer(player: Player,server: String) { + + try { + + val out = ByteStreams.newDataOutput() + + out.writeUTF("Connect") + out.writeUTF(server) + + player.sendPluginMessage(GameEngine.instance,PROXY_CHANNEL,out.toByteArray()) + } catch (e: Exception) { + e.printStackTrace() + } + + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/ConfigUtil.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/ConfigUtil.kt new file mode 100644 index 0000000..97644c0 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/ConfigUtil.kt @@ -0,0 +1,100 @@ +package cc.fyre.engine.util + +import net.frozenorb.qlib.qLib +import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonReader +import java.io.File +import java.io.FileReader +import java.io.FileWriter + +/** + * @project carnage + * + * @date 04/13/21 + * @author xanderume@gmail.com + */ +object ConfigUtil { + + private val cache = hashMapOf>() + private val byClass = hashMapOf,JsonConfig>() + + fun findByClass(clazz: Class<*>): JsonConfig? { + return this.byClass[clazz] + } + + fun findByPlugin(plugin: String):List { + return this.cache[plugin.toLowerCase()]?.values?.toList() ?: listOf() + } + + fun findByPluginAndName(plugin: String,name: String): JsonConfig? { + + if (!this.cache.containsKey(plugin.toLowerCase())) { + return null + } + + return this.cache[plugin.toLowerCase()]!![name.toLowerCase()] + } + + fun register(name: String,plugin: String,dataFolder: File,config: JsonConfig):T { + + if (!JsonConfig::class.java.isAssignableFrom(config::class.java)) { + throw IllegalStateException("${config::class.java.simpleName} is not a JsonConfig!") + } + + if (dataFolder.exists() && !dataFolder.isDirectory) { + throw IllegalStateException("Failed to load ${name}.json: ${dataFolder.name} is not a directory!") + } + + if (!dataFolder.exists()) { + dataFolder.mkdirs() + } + + val file = File("${dataFolder.absolutePath}/$name.json") + + val toReturn: T = if (!file.exists()) { + + val writer = FileWriter(file) + + try { + writer.write(qLib.GSON.toJson(config,config.javaClass)) + } catch (ex: Exception) { + ex.printStackTrace() + } + + writer.close() + + config as T + } else { + qLib.GSON.fromJson(JsonReader(FileReader(file)),config::class.java) + } + + if (toReturn !is JsonConfig) { + throw IllegalStateException("?") + } + + toReturn.file = file + + this.cache.putIfAbsent(plugin.toLowerCase(),hashMapOf()) + this.cache[plugin.toLowerCase()]!![name] = toReturn + this.byClass[config::class.java] = toReturn + + return toReturn + } + + fun save(config: JsonConfig) { + + if (config.file.exists()) { + config.file.delete() + } + + val writer = FileWriter(config.file) + + try { + writer.write(qLib.GSON.toJson(config)) + } catch (ex: Exception) { + ex.printStackTrace() + } + + writer.close() + } + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/JsonConfig.kt b/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/JsonConfig.kt new file mode 100644 index 0000000..def06a0 --- /dev/null +++ b/Engine/lobby/src/main/kotlin/cc/fyre/engine/util/JsonConfig.kt @@ -0,0 +1,15 @@ +package cc.fyre.engine.util + +import java.io.File + +/** + * @project carnage + * + * @date 24/01/2021 + * @author xanderume@gmail.com + */ +open class JsonConfig { + + @Transient lateinit var file: File + +} \ No newline at end of file diff --git a/Engine/lobby/src/main/resources/plugin.yml b/Engine/lobby/src/main/resources/plugin.yml new file mode 100644 index 0000000..84a2e87 --- /dev/null +++ b/Engine/lobby/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: GameEngine +main: cc.fyre.engine.GameEngine +version: 1.0-SNAPSHOT +depend: [qLib,Kotlin] diff --git a/Engine/settings.gradle b/Engine/settings.gradle new file mode 100644 index 0000000..4c11f46 --- /dev/null +++ b/Engine/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'engine' + +include 'api' +include 'game' +include 'lobby' diff --git a/HyBrid/.gradle/6.1.1/executionHistory/executionHistory.bin b/HyBrid/.gradle/6.1.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..3b98f56 Binary files /dev/null and b/HyBrid/.gradle/6.1.1/executionHistory/executionHistory.bin differ diff --git a/HyBrid/.gradle/6.1.1/executionHistory/executionHistory.lock b/HyBrid/.gradle/6.1.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..6b37d7e Binary files /dev/null and b/HyBrid/.gradle/6.1.1/executionHistory/executionHistory.lock differ diff --git a/HyBrid/.gradle/6.1.1/fileChanges/last-build.bin b/HyBrid/.gradle/6.1.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/HyBrid/.gradle/6.1.1/fileChanges/last-build.bin differ diff --git a/HyBrid/.gradle/6.1.1/fileContent/fileContent.lock b/HyBrid/.gradle/6.1.1/fileContent/fileContent.lock new file mode 100644 index 0000000..4de7469 Binary files /dev/null and b/HyBrid/.gradle/6.1.1/fileContent/fileContent.lock differ diff --git a/HyBrid/.gradle/6.1.1/fileHashes/fileHashes.bin b/HyBrid/.gradle/6.1.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..d1cf6c4 Binary files /dev/null and b/HyBrid/.gradle/6.1.1/fileHashes/fileHashes.bin differ diff --git a/HyBrid/.gradle/6.1.1/fileHashes/fileHashes.lock b/HyBrid/.gradle/6.1.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..ee61427 Binary files /dev/null and b/HyBrid/.gradle/6.1.1/fileHashes/fileHashes.lock differ diff --git a/HyBrid/.gradle/6.1.1/fileHashes/resourceHashesCache.bin b/HyBrid/.gradle/6.1.1/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..d947ac2 Binary files /dev/null and b/HyBrid/.gradle/6.1.1/fileHashes/resourceHashesCache.bin differ diff --git a/HyBrid/.gradle/6.1.1/gc.properties b/HyBrid/.gradle/6.1.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/HyBrid/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/HyBrid/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..ee767d6 Binary files /dev/null and b/HyBrid/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/HyBrid/.gradle/buildOutputCleanup/cache.properties b/HyBrid/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..2979e98 --- /dev/null +++ b/HyBrid/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Jan 28 23:56:58 EST 2021 +gradle.version=6.1.1 diff --git a/HyBrid/.gradle/buildOutputCleanup/outputFiles.bin b/HyBrid/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..b25a4ed Binary files /dev/null and b/HyBrid/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/HyBrid/.gradle/checksums/checksums.lock b/HyBrid/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..745ecda Binary files /dev/null and b/HyBrid/.gradle/checksums/checksums.lock differ diff --git a/HyBrid/.gradle/checksums/md5-checksums.bin b/HyBrid/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..3fd3d2a Binary files /dev/null and b/HyBrid/.gradle/checksums/md5-checksums.bin differ diff --git a/HyBrid/.gradle/checksums/sha1-checksums.bin b/HyBrid/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..d404b08 Binary files /dev/null and b/HyBrid/.gradle/checksums/sha1-checksums.bin differ diff --git a/HyBrid/.gradle/vcs-1/gc.properties b/HyBrid/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/HyBrid/.idea/.gitignore b/HyBrid/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/HyBrid/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/HyBrid/.idea/.name b/HyBrid/.idea/.name new file mode 100644 index 0000000..1b1c308 --- /dev/null +++ b/HyBrid/.idea/.name @@ -0,0 +1 @@ +hybrid \ No newline at end of file diff --git a/HyBrid/.idea/compiler.xml b/HyBrid/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/HyBrid/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/HyBrid/.idea/gradle.xml b/HyBrid/.idea/gradle.xml new file mode 100644 index 0000000..611e7c8 --- /dev/null +++ b/HyBrid/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/HyBrid/.idea/jarRepositories.xml b/HyBrid/.idea/jarRepositories.xml new file mode 100644 index 0000000..efbe156 --- /dev/null +++ b/HyBrid/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/HyBrid/.idea/misc.xml b/HyBrid/.idea/misc.xml new file mode 100644 index 0000000..b0051c8 --- /dev/null +++ b/HyBrid/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/HyBrid/.idea/vcs.xml b/HyBrid/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/HyBrid/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/HyBrid/build.gradle b/HyBrid/build.gradle new file mode 100644 index 0000000..fc5d1be --- /dev/null +++ b/HyBrid/build.gradle @@ -0,0 +1,56 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + id "org.jetbrains.kotlin.jvm" version "1.5.10" + id "com.github.johnrengelman.shadow" version "5.2.0" +} + +group = 'cc.fyre.hybrid' +version = '1.0-SNAPSHOT' +description = 'hybrid' + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + //compileOnly 'cc.fyre.venom:bukkit:1.0-SNAPSHOT' + //compileOnly 'net.frozenorb:qLib:LATEST' + //compileOnly 'net.hylist:spigot-server:1.7.10-R0.1-SNAPSHOT' + + compileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10' +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} \ No newline at end of file diff --git a/HyBrid/build/kotlin/compileKotlin/build-history.bin b/HyBrid/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..ddc741e Binary files /dev/null and b/HyBrid/build/kotlin/compileKotlin/build-history.bin differ diff --git a/HyBrid/build/kotlin/compileKotlin/dirty-sources.txt b/HyBrid/build/kotlin/compileKotlin/dirty-sources.txt new file mode 100644 index 0000000..9b9eb16 --- /dev/null +++ b/HyBrid/build/kotlin/compileKotlin/dirty-sources.txt @@ -0,0 +1,56 @@ +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\GamemodeCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\ThreadCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\listener\ChatListener.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\command\SlowChatCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\data\Warp.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\EnchantCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\command\WarpCreateCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\data\ChatProvider.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\listener\EssentialsListener.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\EssentialHandler.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\command\ClearChatCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\FeedCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\CraftCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\ClearInventoryCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\RenameCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\WarpHandler.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\SetSpawnCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\teleport\WorldCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\HatCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\FlyCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\PingCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\SpeedCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\command\WarpSetCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\command\WarpListCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\BroadcastCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\RepairCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\teleport\TeleportLocationCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\GiveCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\MobCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\entity\EntityPatchClearMobsCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\HealCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\ChatHandler.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\teleport\TeleportHereCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\MoreCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\HeadCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\data\provider\DefaultChatProvider.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\provider\WarpParameterProvider.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\data\ChatMessage.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\entity\EntityPatchClearAnimalsCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\SpawnCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\Hybrid.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\GarbageCollectCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\command\WarpCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\warp\command\WarpDeleteCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\chat\command\MuteChatCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\teleport\TopCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\entity\EntityPatchCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\EnderChestCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\teleport\BackCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\SudoCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\UptimeCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\DemoCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\SpawnerCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\inventory\CopyInventoryCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\teleport\TeleportCommand.kt +C:\Users\kiera\Documents\servers\fyrecc\sources\Hybrid\src\main\kotlin\cc\fyre\hybrid\essential\command\KillCommand.kt \ No newline at end of file diff --git a/HyBrid/build/libs/hybrid-1.0-SNAPSHOT.jar b/HyBrid/build/libs/hybrid-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..f77afd2 Binary files /dev/null and b/HyBrid/build/libs/hybrid-1.0-SNAPSHOT.jar differ diff --git a/HyBrid/build/libs/qLib-1.0-SNAPSHOT.jar b/HyBrid/build/libs/qLib-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..378246c Binary files /dev/null and b/HyBrid/build/libs/qLib-1.0-SNAPSHOT.jar differ diff --git a/HyBrid/build/libs/spigot-server-1.7.10-R0.1-SNAPSHOT.jar b/HyBrid/build/libs/spigot-server-1.7.10-R0.1-SNAPSHOT.jar new file mode 100644 index 0000000..1e0f6b6 Binary files /dev/null and b/HyBrid/build/libs/spigot-server-1.7.10-R0.1-SNAPSHOT.jar differ diff --git a/HyBrid/build/libs/venom-bukkit-1.0-SNAPSHOT.jar b/HyBrid/build/libs/venom-bukkit-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..8d79e30 Binary files /dev/null and b/HyBrid/build/libs/venom-bukkit-1.0-SNAPSHOT.jar differ diff --git a/HyBrid/build/publications/shadow/pom-default.xml b/HyBrid/build/publications/shadow/pom-default.xml new file mode 100644 index 0000000..a05a5eb --- /dev/null +++ b/HyBrid/build/publications/shadow/pom-default.xml @@ -0,0 +1,8 @@ + + + 4.0.0 + cc.fyre.hybrid + hybrid + 1.0-SNAPSHOT + + diff --git a/HyBrid/build/resources/main/plugin.yml b/HyBrid/build/resources/main/plugin.yml new file mode 100644 index 0000000..304e9a0 --- /dev/null +++ b/HyBrid/build/resources/main/plugin.yml @@ -0,0 +1,4 @@ +name: Hybrid +main: cc.fyre.hybrid.Hybrid +version: 1.0-SNAPSHOT +depend: [Venom,Hybrid] \ No newline at end of file diff --git a/HyBrid/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml b/HyBrid/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml new file mode 100644 index 0000000..9e8c32b --- /dev/null +++ b/HyBrid/build/tmp/publishShadowPublicationToMavenLocal/module-maven-metadata.xml @@ -0,0 +1,12 @@ + + + cc.fyre.hybrid + hybrid + + 1.0-SNAPSHOT + + 1.0-SNAPSHOT + + 20210919061132 + + diff --git a/HyBrid/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml b/HyBrid/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml new file mode 100644 index 0000000..2ee7742 --- /dev/null +++ b/HyBrid/build/tmp/publishShadowPublicationToMavenLocal/snapshot-maven-metadata.xml @@ -0,0 +1,24 @@ + + + cc.fyre.hybrid + hybrid + 1.0-SNAPSHOT + + + true + + 20210919061132 + + + jar + 1.0-SNAPSHOT + 20210919061132 + + + pom + 1.0-SNAPSHOT + 20210919061132 + + + + diff --git a/HyBrid/build/tmp/shadowJar/MANIFEST.MF b/HyBrid/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/HyBrid/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/HyBrid/gradle/wrapper/gradle-wrapper.jar b/HyBrid/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f3d88b1 Binary files /dev/null and b/HyBrid/gradle/wrapper/gradle-wrapper.jar differ diff --git a/HyBrid/gradle/wrapper/gradle-wrapper.properties b/HyBrid/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1b16c34 --- /dev/null +++ b/HyBrid/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/HyBrid/gradlew b/HyBrid/gradlew new file mode 100644 index 0000000..2fe81a7 --- /dev/null +++ b/HyBrid/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/HyBrid/gradlew.bat b/HyBrid/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/HyBrid/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/HyBrid/settings.gradle b/HyBrid/settings.gradle new file mode 100644 index 0000000..5a7267b --- /dev/null +++ b/HyBrid/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'hybrid' + diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/Hybrid.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/Hybrid.kt new file mode 100644 index 0000000..0b6cadb --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/Hybrid.kt @@ -0,0 +1,41 @@ +package cc.fyre.hybrid + +import cc.fyre.hybrid.chat.ChatHandler +import cc.fyre.hybrid.essential.EssentialHandler +import cc.fyre.hybrid.warp.WarpHandler +import net.frozenorb.qlib.command.FrozenCommandHandler +import org.bukkit.plugin.java.JavaPlugin + +/** + * @project hybrid + * + * @date 22/04/2020 + * @author xanderume@gmail.com + */ +class Hybrid : JavaPlugin() { + + lateinit var chatHandler: ChatHandler + lateinit var warpHandler: WarpHandler + lateinit var essentialHandler: EssentialHandler + + override fun onEnable() { + instance = this + + this.chatHandler = ChatHandler(this) + this.warpHandler = WarpHandler(this) + this.essentialHandler = EssentialHandler(this) + + FrozenCommandHandler.registerAll(this) + } + + override fun onDisable() { + this.warpHandler.dispose() + } + + companion object { + + lateinit var instance: Hybrid + + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/ChatHandler.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/ChatHandler.kt new file mode 100644 index 0000000..28d6938 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/ChatHandler.kt @@ -0,0 +1,135 @@ +package cc.fyre.hybrid.chat + +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.chat.data.ChatMessage +import cc.fyre.hybrid.chat.data.ChatProvider +import cc.fyre.hybrid.chat.data.provider.DefaultChatProvider +import cc.fyre.hybrid.chat.listener.ChatListener +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicInteger +import java.util.regex.Pattern +import kotlin.collections.ArrayList +import kotlin.collections.HashMap + + +/** + * @project hybrid + * + * @date 22/04/2020 + * @author xanderume@gmail.com + */ +class ChatHandler(private val instance: Hybrid):ChatProvider { + + val cache = HashMap>() + + val silenced = HashMap() + val warnings = HashMap() + + var muted = false + var slowed = 0L + + var provider: ChatProvider = DefaultChatProvider() + + init { + this.instance.server.pluginManager.registerEvents(ChatListener(this.instance),this.instance) + } + + fun isFiltered(message: String): Boolean { + + val replacedMessage = message.replace("(dot)", ".").replace("[dot]", ".").trim { it <= ' ' }.split(" ".toRegex()) + + if (replacedMessage.any{ADDRESS_FILTER.matcher(it.toLowerCase()).matches()} || replacedMessage.any{LINK_FILTER.matcher(it.toLowerCase()).matches() && !LINK_WHITELIST.contains(it.toLowerCase())}) { + return true + } + + //TODO: fix + //val filtered = replacedMessage.any{LINK_FILTER.matcher(it.toLowerCase()).matches()} + //val whitelisted = replacedMessage.any{Arrays.stream(LINK_WHITELIST).any{filter -> filter.matches(it.toLowerCase())}} + + return replacedMessage.any{FILTERABLE.contains(it)} + } + + //TODO: fix + fun isSpamming(player: Player):Boolean { + val messages = this.cache[player.uniqueId] ?: ArrayList() + + if (messages.size < 4) { + return false + } + + var same = false + val message = messages[0] + + for (i in 0..3) { + same = message.context == messages[i].context + } + + val timeDifference = message.time - messages[3].time + + return timeDifference < 5000L && same + } + + override fun shouldMuteApply(player: Player,message: String): Boolean { + return this.provider.shouldMuteApply(player,message) + } + + override fun shouldSlowApply(player: Player,message: String): Boolean { + return this.provider.shouldSlowApply(player,message) + } + + override fun shouldFilterApply(player: Player,message: String):Boolean { + return this.provider.shouldFilterApply(player,message) + } + + override fun shouldCheckForSpam(player: Player,message: String): Boolean { + return this.provider.shouldCheckForSpam(player,message) + } + + companion object { + + const val SPAM_WARNINGS = 10 + + val FILTER_PREFIX = "${ChatColor.RED}[Filter]" + + const val SPAM_BYPASS_PERMISSION = "hybrid.spam.bypass" + const val FILTER_BYPASS_PERMISSION = "hybrid.filter.bypass" + + val SPAM_SILENCE_DURATION = TimeUnit.SECONDS.toMillis(60L) + val SPAM_PUNISHMENT_DURATION = TimeUnit.HOURS.toMillis(24L) + + val LINK_FILTER: Pattern = Pattern.compile("^(http://www\\.|https://www\\.|http://|https://)?[a-z0-9]+([\\-.][a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$") + val ADDRESS_FILTER: Pattern = Pattern.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])([.,])){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$") + + val FILTERABLE = arrayListOf( + "retard", "sage", "hcrival", "sagepvp", "rival", "arcane", "velt", "viper", "faithful", "faggot", "static", "bomber" + ) + + val SHORT_MUTE = arrayListOf( + Pattern.compile("s+l+u+t",2), + Pattern.compile("r+e+t+a+r+d+e+d",2), + Pattern.compile("a+u+t+i+s+t+i+c",2), + Pattern.compile("a+u+t+i+s+m",2), + Pattern.compile("p+a+k+i",2), + Pattern.compile("\\d{1,3}[,.]\\d{1,3}[,.]\\d{1,3}[,.]\\d{1,3}",2) + ) + + val LONG_MUTE = arrayListOf( + Pattern.compile("n+[i1l|!]+gg+[e3]+r+",2), + Pattern.compile("b+e+a+n+e+r",2), + Pattern.compile("c+h+i+n+k",2), + Pattern.compile("t+e+r+r+o+i+s+t",2), + Pattern.compile("\\bk+y+[s$]+\\b",2), + Pattern.compile("k+i+l+l+ *y*o*u+r+ *s+e+l+f+",2), + Pattern.compile("c+o+o+n",2) + ) + + val LINK_WHITELIST = arrayListOf( + "cavepvp.org", "forums.cavepvp.org", "twitch.tv", "youtube.com", "youtu.be", "discord.gg", "twitter.com", "prnt.sc", "gyazo.com", "imgur.com" + ) + + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/ClearChatCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/ClearChatCommand.kt new file mode 100644 index 0000000..ea87982 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/ClearChatCommand.kt @@ -0,0 +1,41 @@ +package cc.fyre.hybrid.chat.command + +import net.frozenorb.qlib.command.Command +import cc.fyre.hybrid.Hybrid +import cc.fyre.venom.Venom +import cc.fyre.venom.profile.ProfileHandler +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 07/05/2020 + * @author xanderume@gmail.com + */ +object ClearChatCommand { + + const val PERMISSION = "command.clearchat" + + @JvmStatic + @Command(names = ["clearchat"],permission = PERMISSION,description = "Clear the chat for normal users") + fun execute(sender: CommandSender) { + + val senderUuid = if (sender is Player) sender.uniqueId else ProfileHandler.CONSOLE_UUID + val displayName = Venom.instance.api.grantHandler.findDisplayName(senderUuid,sender.name,Venom.instance.serverHandler.server) + + for (player in Hybrid.instance.server.onlinePlayers) { + + if (player.hasPermission(PERMISSION)) { + player.sendMessage("${ChatColor.LIGHT_PURPLE}Public chat has been cleared by $displayName${ChatColor.LIGHT_PURPLE}.") + continue + } + + repeat(100) { player.sendMessage("") } + } + + Hybrid.instance.server.consoleSender.sendMessage("${ChatColor.LIGHT_PURPLE}Public chat has been cleared by $displayName${ChatColor.LIGHT_PURPLE}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/MuteChatCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/MuteChatCommand.kt new file mode 100644 index 0000000..50cfe1d --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/MuteChatCommand.kt @@ -0,0 +1,35 @@ +package cc.fyre.hybrid.chat.command + +import net.frozenorb.qlib.command.Command +import cc.fyre.hybrid.Hybrid +import cc.fyre.venom.Venom +import cc.fyre.venom.profile.ProfileHandler +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 22/04/2020 + * @author xanderume@gmail.com + */ +object MuteChatCommand { + + const val PERMISSION = "command.mutechat" + const val BYPASS_PERMISSION = "$PERMISSION.bypass" + + @JvmStatic + @Command(names = ["mutechat"],permission = PERMISSION,description = "Restrict users from typing in chat!") + fun execute(sender: CommandSender) { + + val senderUuid = if (sender is Player) sender.uniqueId else ProfileHandler.CONSOLE_UUID + val displayName = Venom.instance.api.grantHandler.findDisplayName(senderUuid,sender.name,Venom.instance.serverHandler.server) + + Hybrid.instance.chatHandler.muted = !Hybrid.instance.chatHandler.muted + Hybrid.instance.server.onlinePlayers.forEach{it.sendMessage("${ChatColor.LIGHT_PURPLE}Public chat has been ${if (!Hybrid.instance.chatHandler.muted) "un-" else ""}muted" + "${if (it.hasPermission(PERMISSION)) " by $displayName${ChatColor.LIGHT_PURPLE}" else ""}.")} + + Hybrid.instance.server.consoleSender.sendMessage("${ChatColor.LIGHT_PURPLE}Public chat has been ${if (!Hybrid.instance.chatHandler.muted) "un-" else ""}muted by $displayName${ChatColor.LIGHT_PURPLE}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/SlowChatCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/SlowChatCommand.kt new file mode 100644 index 0000000..e7849a5 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/command/SlowChatCommand.kt @@ -0,0 +1,36 @@ +package cc.fyre.hybrid.chat.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.venom.Venom +import cc.fyre.venom.profile.ProfileHandler +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import java.util.concurrent.TimeUnit + +/** + * @project hybrid + * + * @date 22/04/2020 + * @author xanderume@gmail.com + */ +object SlowChatCommand { + + const val PERMISSION = "command.slowchat" + + @JvmStatic + @Command(names = ["slowchat"],permission = PERMISSION,description = "Slow users from typing in chat!") + fun execute(sender: CommandSender,@Param(name = "time",defaultValue = "0")time: Long) { + + val senderUuid = if (sender is Player) sender.uniqueId else ProfileHandler.CONSOLE_UUID + val displayName = Venom.instance.api.grantHandler.findDisplayName(senderUuid,sender.name,Venom.instance.serverHandler.server) + + Hybrid.instance.chatHandler.slowed = if (time == 0L && Hybrid.instance.chatHandler.slowed == 0L) TimeUnit.SECONDS.toMillis(5L) else time + Hybrid.instance.server.onlinePlayers.forEach{it.sendMessage("${ChatColor.LIGHT_PURPLE}Public chat has been ${if (Hybrid.instance.chatHandler.slowed == 0L) "un-" else ""}slowed" + "${if (it.hasPermission(PERMISSION)) " by $displayName${ChatColor.LIGHT_PURPLE}" else ""}.")} + + Hybrid.instance.server.consoleSender.sendMessage("${ChatColor.LIGHT_PURPLE}Public chat has been ${if (Hybrid.instance.chatHandler.slowed == 0L) "un-" else ""}slowed by $displayName${ChatColor.LIGHT_PURPLE}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/ChatMessage.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/ChatMessage.kt new file mode 100644 index 0000000..1161d3b --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/ChatMessage.kt @@ -0,0 +1,9 @@ +package cc.fyre.hybrid.chat.data + +/** + * @project hybrid + * + * @date 22/04/2020 + * @author xanderume@gmail.com + */ +class ChatMessage(val time: Long, val context: String) \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/ChatProvider.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/ChatProvider.kt new file mode 100644 index 0000000..15d37d7 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/ChatProvider.kt @@ -0,0 +1,18 @@ +package cc.fyre.hybrid.chat.data + +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 17/05/2020 + * @author xanderume@gmail.com + */ +interface ChatProvider { + + fun shouldMuteApply(player: Player,message: String):Boolean + fun shouldSlowApply(player: Player,message: String):Boolean + fun shouldFilterApply(player: Player,message: String):Boolean + fun shouldCheckForSpam(player: Player,message: String):Boolean + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/provider/DefaultChatProvider.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/provider/DefaultChatProvider.kt new file mode 100644 index 0000000..19bb9c1 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/data/provider/DefaultChatProvider.kt @@ -0,0 +1,30 @@ +package cc.fyre.hybrid.chat.data.provider + +import cc.fyre.hybrid.chat.data.ChatProvider +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 17/05/2020 + * @author xanderume@gmail.com + */ +class DefaultChatProvider : ChatProvider { + + override fun shouldMuteApply(player: Player, message: String): Boolean { + return true + } + + override fun shouldSlowApply(player: Player,message: String): Boolean { + return true + } + + override fun shouldFilterApply(player: Player,message: String):Boolean { + return true + } + + override fun shouldCheckForSpam(player: Player,message: String): Boolean { + return true + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/listener/ChatListener.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/listener/ChatListener.kt new file mode 100644 index 0000000..4d06cb3 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/chat/listener/ChatListener.kt @@ -0,0 +1,160 @@ +package cc.fyre.hybrid.chat.listener + +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.chat.ChatHandler +import cc.fyre.hybrid.chat.command.MuteChatCommand +import cc.fyre.hybrid.chat.command.SlowChatCommand +import cc.fyre.hybrid.chat.data.ChatMessage +import cc.fyre.venom.Venom +import cc.fyre.venom.profile.ProfileHandler +import cc.fyre.venom.punishment.data.Punishment +import cc.fyre.venom.util.PlayerUtil +import net.frozenorb.qlib.util.TimeUtils +import org.bukkit.ChatColor +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.AsyncPlayerChatEvent +import org.bukkit.event.player.PlayerJoinEvent +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicInteger + + +/** + * @project hybrid + * + * @date 22/04/2020 + * @author xanderume@gmail.com + */ +class ChatListener(private val instance: Hybrid) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + this.instance.chatHandler.cache.putIfAbsent(event.player.uniqueId,ArrayList()) + this.instance.chatHandler.warnings.putIfAbsent(event.player.uniqueId,AtomicInteger(ChatHandler.SPAM_WARNINGS)) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onAsyncChat(event: AsyncPlayerChatEvent) { + + if (event.isCancelled) { + return + } + + if (this.instance.chatHandler.muted && !event.player.hasPermission(MuteChatCommand.BYPASS_PERMISSION) && this.instance.chatHandler.shouldMuteApply(event.player,event.message)) { + event.player.sendMessage("${ChatColor.RED}Public chat is currently muted.") + event.isCancelled = true + return + } + + val messages = this.instance.chatHandler.cache[event.player.uniqueId]!! + + if (this.instance.chatHandler.slowed > 0 && !event.player.hasPermission(SlowChatCommand.PERMISSION) && this.instance.chatHandler.shouldSlowApply(event.player,event.message) && messages.isNotEmpty()) { + + val remaining = (messages.first().time + this.instance.chatHandler.slowed) - System.currentTimeMillis() + + if (remaining > 0) { + event.player.sendMessage("${ChatColor.RED}Public chat is currently slowed. You can only chat every ${TimeUtils.formatIntoDetailedString((this.instance.chatHandler.slowed / 1000).toInt())}.") + event.player.sendMessage("${ChatColor.RED}Please wait another ${ChatColor.BOLD}${TimeUtils.formatIntoMMSS((remaining / 1000).toInt())}${ChatColor.RED}.") + event.isCancelled = true + return + } + + } + + val profile = Venom.instance.api.profileHandler.findById(event.player.uniqueId) + + if (profile == null) { + event.player.sendMessage("${ChatColor.RED}There was an issue processing your chat message..") + return + } + + if (!profile.settings.viewGlobalChat) { + event.player.sendMessage("${ChatColor.RED}You have disabled viewing global chat.") + event.isCancelled = true + return + } + + if (!event.player.hasPermission(ChatHandler.FILTER_BYPASS_PERMISSION) && (this.instance.chatHandler.shouldFilterApply(event.player,event.message)) && (ChatHandler.SHORT_MUTE.any{it.matcher(event.message.replace(" ","")).find()})) { + event.isCancelled = true + Venom.instance.api.punishmentHandler.punish(Punishment.Type.MUTE,event.player.uniqueId,ProfileHandler.CONSOLE_UUID,"'${event.message}'",Venom.instance.serverHandler.serverID,TimeUnit.HOURS.toMillis(2L),true,Venom.instance.api.grantHandler.findDisplayName(event.player.uniqueId,event.player.name,Venom.instance.serverHandler.server),Venom.instance.api.grantHandler.findDisplayName(ProfileHandler.CONSOLE_UUID,Venom.instance.serverHandler.server)) + return + } + + if (!event.player.hasPermission(ChatHandler.FILTER_BYPASS_PERMISSION) && (this.instance.chatHandler.shouldFilterApply(event.player, event.message)) && ChatHandler.LONG_MUTE.any{it.matcher(event.message.replace(" ","")).find()}) { + event.isCancelled = true + Venom.instance.api.punishmentHandler.punish(Punishment.Type.MUTE,event.player.uniqueId,ProfileHandler.CONSOLE_UUID,"'${event.message}'",Venom.instance.serverHandler.serverID,TimeUnit.DAYS.toMillis(7L),true,Venom.instance.api.grantHandler.findDisplayName(event.player.uniqueId,event.player.name,Venom.instance.serverHandler.server),Venom.instance.api.grantHandler.findDisplayName(ProfileHandler.CONSOLE_UUID,Venom.instance.serverHandler.server)) + return + } + + if (!event.player.hasPermission(ChatHandler.FILTER_BYPASS_PERMISSION) && (this.instance.chatHandler.shouldFilterApply(event.player,event.message) && this.instance.chatHandler.isFiltered(event.message))) { + + val format = "${PlayerUtil.getDisplayName(profile.id,profile.name)}${ChatColor.WHITE}: ${event.message}" + + event.recipients.clear() + event.recipients.add(event.player) + + this.instance.server.onlinePlayers.filter{it.hasPermission(ChatHandler.FILTER_BYPASS_PERMISSION)}.forEach{it.sendMessage("${ChatHandler.FILTER_PREFIX}$format")} + + this.instance.server.consoleSender.sendMessage("${ChatColor.RED}[Filter]$format") + return + } + + if (event.player.hasPermission(ChatHandler.SPAM_BYPASS_PERMISSION)) { + return + } + + messages.add(0,ChatMessage(System.currentTimeMillis(),event.message)) + + val silenced = if (!this.instance.chatHandler.silenced.containsKey(event.player.uniqueId)) 0L else (this.instance.chatHandler.silenced[event.player.uniqueId]!! + ChatHandler.SPAM_SILENCE_DURATION) - System.currentTimeMillis() + + if (this.instance.chatHandler.shouldCheckForSpam(event.player,event.message) && silenced > 0L) { + event.isCancelled = true + + val warnings = this.instance.chatHandler.warnings[event.player.uniqueId]!! + + if (warnings.get() < 0) { + + val server = Venom.instance.serverHandler.server + + // No need to keep their data + this.instance.chatHandler.cache.remove(event.player.uniqueId) + this.instance.chatHandler.silenced.remove(event.player.uniqueId) + this.instance.chatHandler.warnings.remove(event.player.uniqueId) + + this.instance.server.scheduler.runTask(this.instance) { Venom.instance.api.punishmentHandler.punish(Punishment.Type.MUTE,event.player.uniqueId,ProfileHandler.CONSOLE_UUID,"Spam",server.id,ChatHandler.SPAM_PUNISHMENT_DURATION,true,Venom.instance.api.grantHandler.findDisplayName(event.player.uniqueId,event.player.name,server),Venom.instance.api.grantHandler.findDisplayName(ProfileHandler.CONSOLE_UUID,server)) } + return + } + + if (warnings.get() == 0) { + event.player.sendMessage("${ChatColor.DARK_RED}${ChatColor.BOLD}! THE NEXT MESSAGE YOU SEND WILL GET YOU BANNED !") + } else { + event.player.sendMessage("${ChatColor.RED}You are currently silenced for another ${ChatColor.YELLOW}${TimeUtils.formatIntoDetailedString((silenced / 1000).toInt())}${ChatColor.RED}.") + event.player.sendMessage("${ChatColor.RED}Continuing to use public chat will result in a ${ChatColor.YELLOW}${TimeUtils.formatIntoDetailedString((ChatHandler.SPAM_SILENCE_DURATION / 1000L).toInt())}${ChatColor.RED} mute!") + event.player.sendMessage("${ChatColor.RED}You have ${ChatColor.YELLOW}${warnings.get()} warning${if (warnings.get() == 1) "" else "s"}${ChatColor.RED} left.") + } + + warnings.decrementAndGet() + return + } + + + + if (this.instance.chatHandler.shouldCheckForSpam(event.player,event.message) && this.instance.chatHandler.isSpamming(event.player)) { + this.instance.chatHandler.silenced[event.player.uniqueId] = System.currentTimeMillis() + + event.player.sendMessage("${ChatColor.RED}You have been silenced for ${ChatColor.YELLOW}${TimeUtils.formatIntoDetailedString((ChatHandler.SPAM_SILENCE_DURATION / 1000L).toInt())}${ChatColor.RED} continuing to spam will result in a mute!") + + event.isCancelled = true + this.instance.server.onlinePlayers.filter{it.uniqueId != event.player.uniqueId && it.hasPermission(Punishment.Type.MUTE.permission(false))}.forEach{it.sendMessage("${ChatColor.RED}[Hybrid] ${Venom.instance.api.grantHandler.findDisplayName(event.player.uniqueId,event.player.name,Venom.instance.serverHandler.server)}${ChatColor.YELLOW} has been muted for spamming.")} + return + } + + if (messages.size <= 10) { + return + } + + messages.removeAt(messages.lastIndex) + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/EssentialHandler.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/EssentialHandler.kt new file mode 100644 index 0000000..2022806 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/EssentialHandler.kt @@ -0,0 +1,34 @@ +package cc.fyre.hybrid.essential + +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.essential.listener.EssentialsListener +import org.bukkit.Location +import org.bukkit.Material +import java.util.* +import kotlin.collections.HashMap + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +class EssentialHandler(private val instance: Hybrid) { + + val backCache = HashMap() + val initialized = System.currentTimeMillis() + + init { + this.instance.server.pluginManager.registerEvents(EssentialsListener(this.instance),this.instance) + } + + fun findBackLocation(uuid: UUID):Location? { + return this.backCache[uuid] + } + + companion object { + + val ITEM_RENAME_BLACKLIST = arrayListOf(Material.TRIPWIRE_HOOK,Material.GOLD_NUGGET) + + } +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/BroadcastCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/BroadcastCommand.kt new file mode 100644 index 0000000..7e30daf --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/BroadcastCommand.kt @@ -0,0 +1,23 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object BroadcastCommand { + + @JvmStatic + @Command(names = ["broadcast","bc","raw"],permission = "command.broadcast") + fun execute(sender: CommandSender,@Param(name = "message",wildcard = true)message: String) { + Hybrid.instance.server.broadcastMessage(ChatColor.translateAlternateColorCodes('&',message)) + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/CraftCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/CraftCommand.kt new file mode 100644 index 0000000..cd849dd --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/CraftCommand.kt @@ -0,0 +1,21 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command + +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object CraftCommand { + + @JvmStatic + @Command(names = ["craft","workbbench"],permission = "command.craft") + fun execute(player: Player) { + player.openWorkbench(player.location,true) + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/DemoCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/DemoCommand.kt new file mode 100644 index 0000000..4a3c7b4 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/DemoCommand.kt @@ -0,0 +1,31 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import net.minecraft.server.v1_7_R4.PacketPlayOutGameStateChange +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +object DemoCommand { + + @JvmStatic + @Command(names = ["demo"],hidden = true,permission = "command.demo",description = "Troll a player with the demo menu!") + fun execute(sender: CommandSender,@Param(name = "player")target: Player) { + + val packet = PacketPlayOutGameStateChange(5,0F) + + (target as CraftPlayer).handle.playerConnection.sendPacket(packet) + + sender.sendMessage("${ChatColor.LIGHT_PURPLE}Send demo packet to ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.LIGHT_PURPLE}..") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/EnchantCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/EnchantCommand.kt new file mode 100644 index 0000000..88083b3 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/EnchantCommand.kt @@ -0,0 +1,67 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import net.frozenorb.qlib.util.ItemUtils +import org.bukkit.ChatColor +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer +import org.bukkit.enchantments.Enchantment +import org.bukkit.entity.Player +import org.bukkit.event.enchantment.EnchantItemEvent + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object EnchantCommand { + + @JvmStatic + @Command(names = ["enchant","ench"],permission = "command.enchant") + fun execute(player: Player,@Param(name = "enchantment")enchant: Enchantment, @Param(name = "level")level: Int) { + + if (player.itemInHand == null) { + player.sendMessage("${ChatColor.RED}You are not holding an item.") + return + } + + if (level <= 0) { + + if (!player.itemInHand.containsEnchantment(enchant)) { + player.sendMessage("${ChatColor.RED}Your ${ChatColor.WHITE}${ItemUtils.getName(player.itemInHand)}${ChatColor.RED} does not have ${ChatColor.WHITE}${enchant.name}${ChatColor.RED} enchanted.") + return + } + + player.itemInHand.removeEnchantment(enchant) + player.sendMessage("${ChatColor.RED}You have removed ${ChatColor.WHITE}${enchant.name} ${ChatColor.RED}from your ${ChatColor.WHITE}${ItemUtils.getName(player.itemInHand)}${ChatColor.RED}.") + return + } + + if (!player.isOp) { + + if (!enchant.canEnchantItem(player.itemInHand)) { + player.sendMessage("${ChatColor.RED}You cannot enchant ${ChatColor.WHITE}${enchant.name} ${ChatColor.RED}on a ${ChatColor.WHITE}${ItemUtils.getName(player.itemInHand)}${ChatColor.RED}.") + return + } + + if (level > enchant.maxLevel) { + player.sendMessage("${ChatColor.RED}You cannot enchant above the enchant limit.") + return + } + + } + + player.itemInHand.addUnsafeEnchantment(enchant,level) + + val map = HashMap() + + map[enchant] = level + + Hybrid.instance.server.pluginManager.callEvent(EnchantItemEvent(player,player.openInventory,player.world.getBlockAt(player.location.blockX,player.location.blockY,player.location.blockZ),player.itemInHand,level,map,(player as CraftPlayer).handle.activeContainer.windowId)) + + player.sendMessage("${ChatColor.GOLD}You have enchanted ${ChatColor.WHITE}${enchant.name} $level${ChatColor.GOLD} on your ${ChatColor.WHITE}${ItemUtils.getName(player.itemInHand)}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/EnderChestCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/EnderChestCommand.kt new file mode 100644 index 0000000..57071f2 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/EnderChestCommand.kt @@ -0,0 +1,31 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object EnderChestCommand { + + const val PERMISSION = "command.enderchest" + + @JvmStatic + @Command(names = ["enderchest","echest"],permission = PERMISSION) + fun execute(sender: Player,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot open other people's enderchest.") + return + } + + sender.openInventory(target.enderChest) + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/FeedCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/FeedCommand.kt new file mode 100644 index 0000000..a0b2c91 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/FeedCommand.kt @@ -0,0 +1,40 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object FeedCommand { + + const val PERMISSION = "command.feed" + + @JvmStatic + @Command(names = ["feed"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot feed other people.") + return + } + + target.foodLevel = 20 + target.saturation = 20.0F + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}You have fed ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}You have been fed.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/FlyCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/FlyCommand.kt new file mode 100644 index 0000000..fb7b92a --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/FlyCommand.kt @@ -0,0 +1,39 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object FlyCommand { + + const val PERMISSION = "command.fly" + + @JvmStatic + @Command(names = ["fly","flight"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot toggle flight for other people.") + return + } + + target.allowFlight = !target.allowFlight + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}You have ${if (target.allowFlight) "${ChatColor.GREEN}enabled" else "${ChatColor.RED}disabled"} ${ChatColor.GOLD}flight for ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}Fly: ${if (target.allowFlight) "${ChatColor.GREEN}Enabled" else "${ChatColor.RED}Disabled"}") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/GamemodeCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/GamemodeCommand.kt new file mode 100644 index 0000000..90b08fe --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/GamemodeCommand.kt @@ -0,0 +1,59 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import net.minecraft.util.org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.GameMode +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object GamemodeCommand { + + const val PERMISSION = "command.gamemode" + + @JvmStatic + @Command(names = ["gamemodes","gms"],permission = PERMISSION) + fun survival(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + this.execute(sender,GameMode.SURVIVAL,target) + } + + @JvmStatic + @Command(names = ["gamemodec","gmc"],permission = PERMISSION) + fun creative(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + this.execute(sender,GameMode.CREATIVE,target) + } + + @JvmStatic + @Command(names = ["gamemodea","gma"],permission = PERMISSION) + fun adventure(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + this.execute(sender,GameMode.ADVENTURE,target) + } + + @JvmStatic + @Command(names = ["gamemode","gm"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "gamemode",defaultValue = "1")gameMode: GameMode,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot change gamemode for other players.") + return + } + + target.gameMode = gameMode + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}You have set ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s gamemode to ${ChatColor.WHITE}${StringUtils.capitalize(target.gameMode.name.toLowerCase())}${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}Your gamemode has been updated to ${ChatColor.WHITE}${StringUtils.capitalize(target.gameMode.name.toLowerCase())}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/GarbageCollectCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/GarbageCollectCommand.kt new file mode 100644 index 0000000..24c803c --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/GarbageCollectCommand.kt @@ -0,0 +1,27 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import kotlin.system.measureTimeMillis + +/** + * @project hybrid + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +object GarbageCollectCommand { + + @JvmStatic + @Command(names = ["garbagecollect","gc"],hidden = true,permission = "command.garbagecollect") + fun execute(sender: CommandSender) { + + val time = measureTimeMillis{ + Runtime.getRuntime().gc() + } + + sender.sendMessage("${ChatColor.GREEN}Executed garbage collection in ${ChatColor.YELLOW}${time}ms${ChatColor.GREEN}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/HeadCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/HeadCommand.kt new file mode 100644 index 0000000..a84836c --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/HeadCommand.kt @@ -0,0 +1,35 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import org.bukkit.inventory.meta.SkullMeta + + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object HeadCommand { + + @JvmStatic + @Command(names = ["head","skull"],permission = "piston.command.skull") + fun head(sender: Player,@Param(name = "name",defaultValue = "self")name: String) { + + val item = ItemStack(Material.SKULL_ITEM,1,3.toShort()) + + val meta = item.itemMeta as SkullMeta + + meta.owner = if (name == "self") sender.name else name + item.itemMeta = meta + + sender.inventory.addItem(item) + sender.sendMessage("${ChatColor.GOLD}You were given ${ChatColor.WHITE}${name}${ChatColor.GOLD}'s head.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/HealCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/HealCommand.kt new file mode 100644 index 0000000..9127915 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/HealCommand.kt @@ -0,0 +1,39 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object HealCommand { + + const val PERMISSION = "command.heal" + + @JvmStatic + @Command(names = ["heal"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot heal other people.") + return + } + + target.health = 20.0 + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}You have healed ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}You have been healed.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/KillCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/KillCommand.kt new file mode 100644 index 0000000..f9ecce2 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/KillCommand.kt @@ -0,0 +1,40 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object KillCommand { + + const val PERMISSION = "command.kill" + + @JvmStatic + @Command(names = ["kill"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot kill other people.") + return + } + + target.health = 0.0 + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}You have killed ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name, Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}You have been killed.") + } + + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/MobCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/MobCommand.kt new file mode 100644 index 0000000..b64f3ba --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/MobCommand.kt @@ -0,0 +1,74 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.EntityUtils +import org.bukkit.ChatColor +import org.bukkit.entity.EntityType +import org.bukkit.entity.Player +import java.util.* + + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object MobCommand { + + @JvmStatic + @Command(names = ["mob","spawnmob"],hidden = true,permission = "command.mob",description = "Spawn mobs! Supports stacking") + fun execute(sender: Player,@Param(name = "mob[,mob,mob...]")mobs: String,@Param(name = "amount",defaultValue = "1") amount: Int) { + + val split = mobs.split(",".toRegex()).toTypedArray() + val types: MutableList = ArrayList() + + for (part in split) { + + val type = EntityUtils.parse(part) + + if (type == null) { + sender.sendMessage("${ChatColor.RED}Mob '${ChatColor.YELLOW}${ChatColor.RED}' not found.") + return + } + + if (!type.isAlive) { + sender.sendMessage("${ChatColor.RED}Entity type '${ChatColor.YELLOW}${ChatColor.RED}' is not a valid mob.") + return + } + + + types.add(type) + } + if (sender.getTargetBlock(null,30) == null) { + sender.sendMessage(ChatColor.RED.toString() + "Please look at a block.") + return + } + + if (types.size == 0) { + sender.sendMessage(ChatColor.RED.toString() + "Idk how you got here but um... Nope.") + return + } + + val location = sender.getTargetBlock(null, 30).location.add(0.0,1.5,0.0) + var totalAmount = 0 + + for (i in 0 until amount) { + + val current = sender.world.spawnEntity(location,types[0]) + + ++totalAmount + + for (x in 1 until types.size) { + val newEntity = sender.world.spawnEntity(location,types[x]) + current.passenger = newEntity + ++totalAmount + } + + } + + sender.sendMessage("${ChatColor.GOLD}Spawned ${ChatColor.WHITE}$totalAmount ${ChatColor.GOLD}entities.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/PingCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/PingCommand.kt new file mode 100644 index 0000000..2cf1731 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/PingCommand.kt @@ -0,0 +1,25 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 27/04/2020 + * @author xanderume@gmail.com + */ +object PingCommand { + + @JvmStatic + @Command(names = ["ping","latency","connection"],permission = "") + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + sender.sendMessage("${if (sender is Player && sender.uniqueId == target.uniqueId) "${ChatColor.GOLD}Ping" else "${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s ping"}: ${ChatColor.WHITE}${(target as CraftPlayer).handle.ping}") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SetSpawnCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SetSpawnCommand.kt new file mode 100644 index 0000000..86af92c --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SetSpawnCommand.kt @@ -0,0 +1,52 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.block.BlockFace +import org.bukkit.entity.Player +import java.util.* +import kotlin.math.roundToInt + + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object SetSpawnCommand { + + private val FACES = arrayOf(BlockFace.WEST,BlockFace.NORTH_WEST,BlockFace.NORTH,BlockFace.NORTH_EAST,BlockFace.EAST,BlockFace.SOUTH_EAST,BlockFace.SOUTH,BlockFace.SOUTH_WEST) + private val NOTCHES = EnumMap(BlockFace::class.java) + + init { + this.FACES.forEach{this.NOTCHES[it] = this.NOTCHES.size} + } + + @JvmStatic + @Command(names = ["setspawn","setworldspawn"],permission = "command.setspawn") + fun execute(player: Player) { + player.world.setSpawnLocation(player.location.blockX,player.location.blockY,player.location.blockZ,this.faceToYaw(this.yawToFace(player.location.yaw)).toFloat(),0F) + player.sendMessage("${ChatColor.GOLD}Set the spawn location for ${ChatColor.WHITE}${player.world.name}${ChatColor.GOLD}.") + } + + private fun yawToFace(yaw: Float): BlockFace { + return this.FACES[((yaw / 45.0F).roundToInt() and 0x7)] + } + + private fun faceToYaw(face: BlockFace): Int { + + var angle = 45 * (this.NOTCHES[face] ?: 0) + + while (angle <= -180) { + angle += 360 + } + + while (angle > 180) { + angle -= 360 + } + + return angle + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpawnCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpawnCommand.kt new file mode 100644 index 0000000..455f025 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpawnCommand.kt @@ -0,0 +1,41 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.essential.command.teleport.TeleportHereCommand +import cc.fyre.venom.Venom + +import org.bukkit.ChatColor +import org.bukkit.World +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 16/09/2020 + * @author xanderume@gmail.com + */ +object SpawnCommand { + + @JvmStatic + @Command(names = ["spawn"],permission = "command.spawn") + fun execute(sender: CommandSender,@Param(name = "world",defaultValue = "self")world: World,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission(TeleportHereCommand.PERMISSION)) { + sender.sendMessage("${ChatColor.RED}You cannot teleport other players.") + return + } + + target.teleport(world.spawnLocation.add(0.5,0.5,0.5)) + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GREEN}Teleported ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GREEN} to spawn.") + return + } + + sender.sendMessage("${ChatColor.GREEN}Teleporting to spawn.") + + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpawnerCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpawnerCommand.kt new file mode 100644 index 0000000..bd51574 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpawnerCommand.kt @@ -0,0 +1,45 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.EntityUtils + +import org.bukkit.ChatColor +import org.bukkit.block.CreatureSpawner +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 16/09/2020 + * @author xanderume@gmail.com + */ +object SpawnerCommand { + + @JvmStatic + @Command(names = ["spawner"],permission = "hcf.command.spawner") + fun execute(sender: Player,@Param(name = "mob")mob: String) { + + val type = EntityUtils.parse(mob) + + if (type == null || !type.isAlive) { + sender.sendMessage("${ChatColor.RED}Mob ${ChatColor.YELLOW}$mob${ChatColor.RED} not found.") + return + } + + val block = sender.getTargetBlock(null, 5) + + if (block == null || block.state !is CreatureSpawner) { + sender.sendMessage("${ChatColor.RED}You are not looking at a spawner.") + return + } + + val creatureSpawner = block.state as CreatureSpawner + + creatureSpawner.spawnedType = type + creatureSpawner.update() + + sender.sendMessage("${ChatColor.YELLOW}Updated this spawner to a ${ChatColor.RED}${EntityUtils.getName(type)}${ChatColor.YELLOW} spawner.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpeedCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpeedCommand.kt new file mode 100644 index 0000000..1394f74 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SpeedCommand.kt @@ -0,0 +1,48 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import kotlin.math.max + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object SpeedCommand { + + const val MAX_SPEED = 1.0F + const val PERMISSION = "command.speed" + + @JvmStatic + @Command(names = ["speed","espeed"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "speed",defaultValue = "1")providedSpeed: Int,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot modify other people's speed.") + return + } + + val speed = if (providedSpeed > 10) 10 else providedSpeed + + if (speed <= 0) { + sender.sendMessage("${ChatColor.RED}Speed must be positive.") + return + } + + if (target.isFlying) target.flySpeed = (providedSpeed/10.0F) else target.walkSpeed = (providedSpeed/10.0F) + 0.1F + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}Set ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s ${if (target.isFlying) "fly" else "walk"} speed to ${ChatColor.WHITE}$speed${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}Your ${if (target.isFlying) "fly" else "walk"} speed has been set to ${ChatColor.WHITE}$speed${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SudoCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SudoCommand.kt new file mode 100644 index 0000000..ddca965 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/SudoCommand.kt @@ -0,0 +1,38 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import net.frozenorb.qlib.command.Flag +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object SudoCommand { + + @JvmStatic + @Command(names = ["sudo"],hidden = true,permission = "command.sudo") + fun execute(sender: CommandSender, @Flag(value = ["f","flag"],description = "Guarantee this command to execute (op)") force: Boolean, @Param(name = "player")target: Player, @Param(name = "command",wildcard = true)command: String) { + + val previously = target.isOp + + if (force && !target.isOp) { + target.isOp = true + } + + target.chat("/$command") + + if (force) { + target.isOp = previously + } + + sender.sendMessage("${ChatColor.GOLD}${if (force) "Made" else "Forced"} ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD} to execute ${ChatColor.WHITE}/$command${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/ThreadCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/ThreadCommand.kt new file mode 100644 index 0000000..dd7b0d1 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/ThreadCommand.kt @@ -0,0 +1,48 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import net.frozenorb.qlib.util.PaginatedOutput +import org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender + +/** + * @project hybrid + * + * @date 19/01/2021 + * @author xanderume@gmail.com + */ +object ThreadCommand { + + @JvmStatic + @Command(names = ["threads","threaddump","thread dump"],hidden = true,permission = "command.threaddump") + fun execute(sender: CommandSender,@Param(name = "page",defaultValue = "1")page: Int) { + + val output = object : PaginatedOutput(10) { + + override fun format(thread: Thread,index: Int):String { + return "${ChatColor.RED}${index + 1}. ${ChatColor.YELLOW}${thread.name} ${ChatColor.GOLD}[${getStateColor(thread.state)}${thread.state.name}${ChatColor.GOLD}] ${ChatColor.AQUA}[${thread.priority}] ${if (thread.isDaemon) "${ChatColor.DARK_AQUA}[Daemon]" else ""}" + } + + override fun getHeader(page: Int,maxPages: Int):String { + return "${ChatColor.RED}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",53)}" + } + + } + + output.display(sender,page,Thread.getAllStackTraces().keys.sortedWith(compareBy({it.priority},{it.name},{it.state}))) + sender.sendMessage("${ChatColor.RED}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",53)}") + } + + fun getStateColor(state: Thread.State):ChatColor { + return when (state) { + Thread.State.NEW -> ChatColor.DARK_GREEN + Thread.State.RUNNABLE -> ChatColor.GREEN + Thread.State.BLOCKED -> ChatColor.DARK_RED + Thread.State.WAITING -> ChatColor.WHITE + Thread.State.TIMED_WAITING -> ChatColor.LIGHT_PURPLE + Thread.State.TERMINATED -> ChatColor.RED + } + } +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/UptimeCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/UptimeCommand.kt new file mode 100644 index 0000000..f3e0abe --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/UptimeCommand.kt @@ -0,0 +1,37 @@ +package cc.fyre.hybrid.essential.command + +import net.frozenorb.qlib.command.Command +import cc.fyre.hybrid.Hybrid +import net.frozenorb.qlib.util.TimeUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import java.util.concurrent.TimeUnit + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object UptimeCommand { + + @JvmStatic + @Command(names = ["uptime","serveruptime"],hidden = true,permission = "command.uptime") + fun execute(sender: CommandSender) { + + val uptime = System.currentTimeMillis() - Hybrid.instance.essentialHandler.initialized + + val color = ChatColor.WHITE + + when { + + uptime >= TimeUnit.HOURS.toMillis(16L) -> ChatColor.YELLOW + uptime >= TimeUnit.HOURS.toMillis(24L) -> ChatColor.RED + uptime >= TimeUnit.HOURS.toMillis(48L) -> ChatColor.DARK_RED + + } + + sender.sendMessage("${ChatColor.GOLD}The server has been running for $color${TimeUtils.formatIntoDetailedString((uptime / 1000L).toInt())}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchClearAnimalsCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchClearAnimalsCommand.kt new file mode 100644 index 0000000..5b9c1d4 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchClearAnimalsCommand.kt @@ -0,0 +1,42 @@ +package cc.fyre.hybrid.essential.command.entity + +import net.frozenorb.qlib.command.Command +import cc.fyre.hybrid.Hybrid +import net.frozenorb.qlib.command.Flag +import net.frozenorb.qlib.util.EntityUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Animals + +/** + * @project hybrid + * + * @date 28/11/2020 + * @author xanderume@gmail.com + */ +object EntityPatchClearAnimalsCommand { + + @Command(names = ["entitypatch clearanimals","ep clearanimals"],hidden = true,permission = "${EntityPatchCommand.PERMISSION}.clearanimals") + fun clearMobs(sender: CommandSender, @Flag(value = ["d"])debug: Boolean) { + + var removed = 0 + + Hybrid.instance.server.worlds.forEach{world -> + + world.entities.filterIsInstance().forEach{ + + removed++ + + if (debug) { + sender.sendMessage("${ChatColor.GREEN}Cleared Animal: ${ChatColor.YELLOW}${EntityUtils.getName(it.type)}") + } + + it.remove() + } + + } + + sender.sendMessage("${ChatColor.GREEN}Cleared ${ChatColor.YELLOW}${removed}${ChatColor.GREEN} animals.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchClearMobsCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchClearMobsCommand.kt new file mode 100644 index 0000000..b2aaf93 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchClearMobsCommand.kt @@ -0,0 +1,44 @@ +package cc.fyre.hybrid.essential.command.entity + +import net.frozenorb.qlib.command.Command +import cc.fyre.hybrid.Hybrid +import net.frozenorb.qlib.command.Flag +import net.frozenorb.qlib.util.EntityUtils +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Monster +import java.util.concurrent.atomic.AtomicInteger + +/** + * @project hybrid + * + * @date 28/11/2020 + * @author xanderume@gmail.com + */ +object EntityPatchClearMobsCommand { + + @Command(names = ["entitypatch clearmobs","entitypatch cm","ep cm","ep clearmobs"],hidden = true,permission = "${EntityPatchCommand.PERMISSION}.clearmobs") + fun clearMobs(sender: CommandSender,@Flag(value = ["d"])debug: Boolean) { + + var removed = 0 + + Hybrid.instance.server.worlds.forEach{world -> + + world.entities.filterIsInstance().forEach{ + + removed++ + + if (debug) { + sender.sendMessage("${ChatColor.GREEN}Cleared Mob: ${ChatColor.YELLOW}${EntityUtils.getName(it.type)}") + } + + it.remove() + } + + } + + sender.sendMessage("${ChatColor.GREEN}Cleared ${ChatColor.YELLOW}${removed}${ChatColor.GREEN} mobs.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchCommand.kt new file mode 100644 index 0000000..b32beac --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/entity/EntityPatchCommand.kt @@ -0,0 +1,35 @@ +package cc.fyre.hybrid.essential.command.entity + +import net.frozenorb.qlib.command.Command +import cc.fyre.hybrid.Hybrid +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.* + +/** + * @project hybrid + * + * @date 16/09/2020 + * @author xanderume@gmail.com + */ +object EntityPatchCommand { + + const val PERMISSION = "command.entitypatch" + + @JvmStatic + @Command(names = ["entitypatch","ep","epca"],hidden = true,permission = PERMISSION) + fun execute(sender: CommandSender) { + + var removed = 0 + + Hybrid.instance.server.worlds.forEach{world -> + world.entities.filterNot{it is Player || it is Minecart || it is Wither || it is ItemFrame || it is EnderDragon || it is EnderPearl}.forEach{ + it.remove() + removed++ + } + } + + sender.sendMessage("${ChatColor.GREEN}Cleared ${ChatColor.YELLOW}$removed${ChatColor.GREEN} entities.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/ClearInventoryCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/ClearInventoryCommand.kt new file mode 100644 index 0000000..8029847 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/ClearInventoryCommand.kt @@ -0,0 +1,38 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.essential.command.teleport.WorldCommand +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import java.util.stream.Stream + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object ClearInventoryCommand { + + const val PERMISSION = "command.inventory.clear" + + @Command(names = ["clearinventory","clear","ci"],permission = "command.inventory.clear") + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")player: Player) { + + if (sender is Player && sender.uniqueId != player.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot clear other people's inventories.") + return + } + + player.inventory.clear() + player.inventory.armorContents = null + + player.updateInventory() + + sender.sendMessage("${ChatColor.GOLD}You have cleared ${if (sender is Player && sender.uniqueId == player.uniqueId) "your" else "${Venom.instance.api.grantHandler.findDisplayName(player.uniqueId,player.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s"}${ChatColor.GOLD} inventory.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/CopyInventoryCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/CopyInventoryCommand.kt new file mode 100644 index 0000000..a8be6b6 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/CopyInventoryCommand.kt @@ -0,0 +1,69 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.essential.command.teleport.TeleportHereCommand +import cc.fyre.venom.Venom +import org.bukkit.ChatColor + +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object CopyInventoryCommand { + + const val PERMISSION = "command.inventory.copy" + + @JvmStatic + @Command(names = ["copyinventory","copyinv","cpinv","cpfrom"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "player")target: Player,@Param(name = "target",defaultValue = "defaultValue")other: String) { + + if (sender is Player && other != "defaultValue" && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot copy a player's inventory to another person's inventory.") + return + } + + if (other != "defaultValue" && !sender.hasPermission(TeleportHereCommand.PERMISSION)) { + sender.sendMessage("${ChatColor.RED}No permission to teleport other players.") + return + } + + val second = if (other == "defaultValue") null else Hybrid.instance.server.getPlayer(other) + + if (second == null) { + + if (sender !is Player) { + sender.sendMessage("${ChatColor.RED}Usage: /copyinv ") + return + } + + if (other == "defaultValue") { + sender.inventory.contents = target.inventory.contents + sender.inventory.armorContents = target.inventory.armorContents + + sender.player.updateInventory() + + sender.sendMessage("${ChatColor.GOLD}You have copied ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s inventory.") + return + } + + sender.sendMessage("${ChatColor.RED}No player with the name ${ChatColor.YELLOW}${other}${ChatColor.RED} found.") + return + } + + second.inventory.contents = target.inventory.contents + second.inventory.armorContents = target.inventory.armorContents + + second.player.updateInventory() + + sender.sendMessage("${ChatColor.GOLD}You have copied ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s inventory to ${Venom.instance.api.grantHandler.findDisplayName(second.uniqueId,second.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/GiveCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/GiveCommand.kt new file mode 100644 index 0000000..b15c6d4 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/GiveCommand.kt @@ -0,0 +1,44 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param + +import cc.fyre.venom.Venom +import net.frozenorb.qlib.util.ItemUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object GiveCommand { + + const val PERMISSION = "command.give" + + @JvmStatic + @Command(names = ["give","item","i","get"],permission = PERMISSION) + fun execute(sender: CommandSender,@Param(name = "item")item: ItemStack,@Param(name = "amount",defaultValue = "1")amount: Int,@Param(name = "player",defaultValue = "self")target: Player) { + + if (amount < 1) { + sender.sendMessage("${ChatColor.RED}The amount must be greater than zero.") + return + } + + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot give items to other players.") + return + } + + item.amount = amount + + target.inventory.addItem(item) + + sender.sendMessage("${ChatColor.GOLD}Giving ${if (sender !is Player || sender.uniqueId == target.uniqueId) "yourself" else Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.WHITE} $amount${ChatColor.GOLD} of ${ChatColor.WHITE}${ItemUtils.getName(ItemStack(item.type))}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/HatCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/HatCommand.kt new file mode 100644 index 0000000..0fe13e9 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/HatCommand.kt @@ -0,0 +1,27 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object HatCommand { + + @JvmStatic + @Command(names = ["hat"],permission = "command.hat") + fun execute(player: Player) { + + if (player.itemInHand == null) { + player.sendMessage("${ChatColor.RED}You do not have anything in your hand.") + return + } + + player.inventory.helmet = player.itemInHand + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/MoreCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/MoreCommand.kt new file mode 100644 index 0000000..89869ba --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/MoreCommand.kt @@ -0,0 +1,31 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Flag +import org.bukkit.ChatColor +import org.bukkit.entity.Player + + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object MoreCommand { + + @JvmStatic + @Command(names = ["more", "stack"],permission = "command.more") + fun execute(player: Player,@Flag(value = ["b","bypass"])bypass: Boolean) { + + if (player.itemInHand == null) { + player.sendMessage(ChatColor.RED.toString() + "You are not holding an item.") + return + } + + player.itemInHand.amount = if (bypass) 64 else player.itemInHand.maxStackSize + player.sendMessage(ChatColor.GOLD.toString() + "There you go.") + } + + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/RenameCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/RenameCommand.kt new file mode 100644 index 0000000..6061cf1 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/RenameCommand.kt @@ -0,0 +1,42 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.essential.EssentialHandler +import net.frozenorb.qlib.util.ItemUtils +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object RenameCommand { + + @JvmStatic + @Command(names = ["rename"],permission = "command.rename") + fun execute(player: Player,@Param(name = "name",wildcard = true)name: String) { + + val itemStack = player.itemInHand + + if (itemStack == null) { + player.sendMessage("${ChatColor.RED}You are not holding an item.") + return + } + + if (EssentialHandler.ITEM_RENAME_BLACKLIST.any{it == itemStack.type}) { + player.sendMessage("${ChatColor.RED}You cannot rename this item!") + return + } + + val itemMeta = itemStack.itemMeta + + itemMeta.displayName = ChatColor.translateAlternateColorCodes('&',name) + itemStack.itemMeta = itemMeta + + player.sendMessage("${ChatColor.GOLD}Renamed your ${ChatColor.WHITE}${ItemUtils.getName(itemStack)}${ChatColor.GOLD} to ${ChatColor.WHITE}${ChatColor.translateAlternateColorCodes('&',name)}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/RepairCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/RepairCommand.kt new file mode 100644 index 0000000..af8ecae --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/inventory/RepairCommand.kt @@ -0,0 +1,42 @@ +package cc.fyre.hybrid.essential.command.inventory + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.util.ItemUtils +import org.bukkit.ChatColor +import org.bukkit.enchantments.Enchantment +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object RepairCommand { + + @JvmStatic + @Command(names = ["repair","fix"],permission = "command.repair") + fun execute(player: Player) { + + val item = player.itemInHand + + if (item == null) { + player.sendMessage("${ChatColor.RED}You are not holding an item.") + return + } + + if (!Enchantment.DURABILITY.canEnchantItem(item)) { + player.sendMessage("${ItemUtils.getName(item)}${ChatColor.RED} cannot be repaired.") + return + } + + if (item.durability == 0.toShort()) { + player.sendMessage("${ChatColor.RED}Your ${ChatColor.WHITE}${ItemUtils.getName(item)}${ChatColor.RED} already has max durability.") + return + } + + item.durability = 0 + player.sendMessage("${ChatColor.GOLD}Your ${ChatColor.WHITE}${ItemUtils.getName(item)}${ChatColor.GOLD} has been repaired.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/BackCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/BackCommand.kt new file mode 100644 index 0000000..4d6e7e6 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/BackCommand.kt @@ -0,0 +1,41 @@ +package cc.fyre.hybrid.essential.command.teleport + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid + +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object BackCommand { + + const val PERMISSION = "command.back" + + @JvmStatic + @Command(names = ["back"],permission = PERMISSION,description = "Teleport to your last location!") + fun execute(sender: Player,@Param(name = "player",defaultValue = "self")player: Player) { + + if (sender.uniqueId != player.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You teleport to other people's previous location.") + return + } + + val backLocation = Hybrid.instance.essentialHandler.findBackLocation(player.uniqueId) + + if (backLocation == null) { + sender.sendMessage("${ChatColor.RED}No previous location record.") + return + } + + sender.teleport(backLocation) + sender.sendMessage("${ChatColor.GOLD}Teleporting to ${if (sender.uniqueId == player.uniqueId) "your" else "${Venom.instance.api.grantHandler.findDisplayName(player.uniqueId,player.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}'s"}${ChatColor.GOLD} last recorded location.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportCommand.kt new file mode 100644 index 0000000..7e1b950 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportCommand.kt @@ -0,0 +1,65 @@ +package cc.fyre.hybrid.essential.command.teleport + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.venom.Venom +import net.frozenorb.qlib.command.Flag +import org.bukkit.ChatColor + +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object TeleportCommand { + + const val PERMISSION = "command.teleport" + + @JvmStatic + @Command(names = ["teleport","tpto","tp","goto"],permission = PERMISSION,description = "Teleport yourself or another player to someone.") + fun execute(sender: CommandSender, @Flag(value = ["s","silent"],description = "Silently teleport the player (staff members always get messaged)")silent: Boolean, @Param(name = "player")target: Player, @Param(name = "target",defaultValue = "defaultValue")other: String) { + + if (other != "defaultValue" && !sender.hasPermission(TeleportHereCommand.PERMISSION)) { + sender.sendMessage("${ChatColor.RED}No permission to teleport other players.") + return + } + + val second = if (other == "defaultValue") null else Hybrid.instance.server.getPlayer(other) + + if (second == null) { + + if (sender !is Player) { + sender.sendMessage("${ChatColor.RED}Usage: /tp ") + return + } + + if (other == "defaultValue") { + sender.teleport(target) + sender.sendMessage("${ChatColor.GOLD}Teleporting you to ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.RED}No player with the name ${ChatColor.YELLOW}${other}${ChatColor.RED} found.") + return + } + + if (target.uniqueId == second.uniqueId) { + sender.sendMessage("${ChatColor.RED}You cannot teleport the same player.") + return + } + + target.teleport(second) + + if (!silent || target.hasPermission(PERMISSION)) { + target.sendMessage("${ChatColor.GOLD}Teleporting you to ${Venom.instance.api.grantHandler.findDisplayName(second.uniqueId,second.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + } + + sender.sendMessage("${ChatColor.GOLD}Teleporting ${if (sender is Player && target.uniqueId == sender.uniqueId) "you" else Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD} to ${if (sender is Player && second.uniqueId == sender.uniqueId) "you" else Venom.instance.api.grantHandler.findDisplayName(second.uniqueId,second.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportHereCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportHereCommand.kt new file mode 100644 index 0000000..d3cfb60 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportHereCommand.kt @@ -0,0 +1,41 @@ +package cc.fyre.hybrid.essential.command.teleport + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import net.frozenorb.qlib.command.Flag +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ + +object TeleportHereCommand { + + const val PERMISSION = "command.teleport.here" + + @JvmStatic + @Command(names = ["teleporthere","tphere","bring","s"],permission = PERMISSION) + fun execute(player: Player, @Flag(value = ["s","silent"],description = "Silently teleport the player (staff members always get messaged)")silent: Boolean, @Param(name = "target")target: Player) { + + if (player.uniqueId == target.uniqueId) { + player.sendMessage("${ChatColor.RED}You cannot teleport yourself.") + return + } + + target.teleport(player) + + player.sendMessage("${ChatColor.GOLD}Teleporting ${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD} to you.") + + if (silent && !target.hasPermission(TeleportCommand.PERMISSION)) { + return + } + + target.sendMessage("${ChatColor.GOLD}Teleporting you to ${Venom.instance.api.grantHandler.findDisplayName(player.uniqueId,player.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportLocationCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportLocationCommand.kt new file mode 100644 index 0000000..945ab3d --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TeleportLocationCommand.kt @@ -0,0 +1,58 @@ +package cc.fyre.hybrid.essential.command.teleport + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.World +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object TeleportLocationCommand { + + const val PERMISSION = "command.teleport.location" + + @JvmStatic + @Command(names = ["teleportlocation","tplocation","teleportpos","tppos"],permission = PERMISSION,description = "Teleport to specified coordinates.") + fun execute(sender: CommandSender,@Param(name = "x")providedX: Double,@Param(name = "y")providedY: Double,@Param(name = "z")providedZ: Double,@Param(name = "player",defaultValue = "self")player: Player,@Param(name = "world",defaultValue = "defaultValue")providedWorld: String) { + + if (sender is Player && sender.uniqueId != player.uniqueId && !sender.hasPermission("${BackCommand.PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You cannot teleport other people to a location.") + return + } + + val world = Hybrid.instance.server.getWorld(providedWorld) ?: player.world + + var x = providedX + val y = providedY + var z = providedZ + + if (x % 1.0 == 0.0) { + x += if (z >= 0.0) 0.5 else -0.5 + } + + if (z % 1.0 == 0.0) { + z += if (x >= 0.0) 0.5 else -0.5 + } + + player.teleport(Location(world,x,y,z)) + + val location = "${ChatColor.LIGHT_PURPLE}[${ChatColor.YELLOW}${x}${ChatColor.WHITE}, ${ChatColor.YELLOW}${y}${ChatColor.WHITE}, ${ChatColor.YELLOW}${z}${ChatColor.LIGHT_PURPLE}]" + + if (sender !is Player || sender.uniqueId != player.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}Teleporting ${Venom.instance.api.grantHandler.findDisplayName(player.uniqueId,player.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD} to $location${ChatColor.GOLD}.") + return + } + + sender.sendMessage("${ChatColor.GOLD}Teleporting you to $location${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TopCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TopCommand.kt new file mode 100644 index 0000000..eb59371 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/TopCommand.kt @@ -0,0 +1,43 @@ +package cc.fyre.hybrid.essential.command.teleport + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.essential.command.EnderChestCommand +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 26/04/2020 + * @author xanderume@gmail.com + */ +object TopCommand { + + @JvmStatic + @Command(names = ["ascend","asc","top"],permission = "command.top") + fun execute(sender: CommandSender,@Param(name = "player",defaultValue = "self")target: Player) { + + if (sender is Player && sender.uniqueId != target.uniqueId && !target.hasPermission(TeleportHereCommand.PERMISSION)) { + sender.sendMessage("${ChatColor.RED}You cannot ascend other people.") + return + } + + val location = target.world.getHighestBlockAt(target.location).location + + location.yaw = target.location.yaw + location.pitch = target.location.pitch + + target.teleport(location) + + if (sender !is Player || sender.uniqueId != target.uniqueId) { + sender.sendMessage("${Venom.instance.api.grantHandler.findDisplayName(target.uniqueId,target.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD} has been ascended.") + return + } + + sender.sendMessage("${ChatColor.GOLD}You have been ascended.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/WorldCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/WorldCommand.kt new file mode 100644 index 0000000..892f6c8 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/command/teleport/WorldCommand.kt @@ -0,0 +1,45 @@ +package cc.fyre.hybrid.essential.command.teleport + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.Location +import org.bukkit.World +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import kotlin.math.abs + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +object WorldCommand { + + const val PERMISSION = "command.world" + + @JvmStatic + @Command(names = ["world"],permission = PERMISSION,description = "Teleport to a different world.") + fun execute(sender: CommandSender,@Param(name = "world")world: World,@Param(name = "player",defaultValue = "self")player: Player) { + + if (sender is Player && sender.uniqueId != player.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You teleport other people to a different world.") + return + } + + if (sender !is Player || sender.uniqueId != player.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}Teleporting ${Venom.instance.api.grantHandler.findDisplayName(player.uniqueId,player.name,Venom.instance.serverHandler.server)}${ChatColor.GOLD} to world ${ChatColor.WHITE}${world.name}${ChatColor.GOLD}.") + } + + val toNether = world.environment == World.Environment.NETHER + val fromNether = player.world.environment == World.Environment.NETHER + + val x = if (toNether && !fromNether && abs(player.location.x) >= 8) player.location.x / 8 else if (!toNether && fromNether) player.location.x * 8 else player.location.x + val z = if (toNether && !fromNether && abs(player.location.z) >= 8) player.location.z / 8 else if (!toNether && fromNether) player.location.z * 8 else player.location.z + + player.teleport(Location(world,x,player.location.y,z,player.location.yaw,player.location.pitch)) + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/listener/EssentialsListener.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/listener/EssentialsListener.kt new file mode 100644 index 0000000..72d4b9a --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/essential/listener/EssentialsListener.kt @@ -0,0 +1,125 @@ +package cc.fyre.hybrid.essential.listener + +import cc.fyre.hybrid.Hybrid +import cc.fyre.venom.Venom +import net.frozenorb.qlib.util.EntityUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.block.CreatureSpawner +import org.bukkit.block.Skull +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.block.SignChangeEvent +import org.bukkit.event.entity.PlayerDeathEvent +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent +import org.bukkit.event.player.PlayerTeleportEvent + + +/** + * @project hybrid + * + * @date 25/04/2020 + * @author xanderume@gmail.com + */ +class EssentialsListener(private val instance: Hybrid):Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + event.joinMessage = null + + this.instance.essentialHandler.backCache[event.player.uniqueId] = event.player.location + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + event.quitMessage = null + + this.instance.essentialHandler.backCache.remove(event.player.uniqueId) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerDeath(event: PlayerDeathEvent) { + this.instance.essentialHandler.backCache[event.entity.uniqueId] = event.entity.location + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerTeleport(event: PlayerTeleportEvent) { + + if (event.isCancelled) { + return + } + + if (event.cause == PlayerTeleportEvent.TeleportCause.ENDER_PEARL || event.cause == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || event.cause == PlayerTeleportEvent.TeleportCause.END_PORTAL) { + return + } + + this.instance.essentialHandler.backCache[event.player.uniqueId] = event.from + } + + @EventHandler(priority = EventPriority.MONITOR) + fun onSignChange(event: SignChangeEvent) { + + if (!event.player.isOp) { + return + } + + event.lines.indices.forEach{event.setLine(it,ChatColor.translateAlternateColorCodes('&',event.lines[it]))} + } + + @EventHandler(priority = EventPriority.MONITOR) + fun onPlayerInteract(event: PlayerInteractEvent) { + + if (event.isCancelled) { + return + } + + if (!event.hasBlock()) { + return + } + + if (event.clickedBlock.state !is Skull) { + return + } + + val owner = (event.clickedBlock.state as Skull).owner ?: return + + val uuid = Venom.instance.api.profileHandler.findId(owner) + + event.player.sendMessage("${ChatColor.YELLOW}This is the head of: ${if (uuid != null) Venom.instance.api.profileHandler.findName(uuid) else owner}") + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (event.isCancelled) { + return + } + + if (event.player.itemInHand.type != Material.MOB_SPAWNER) { + return + } + + if (!event.player.itemInHand.hasItemMeta() || !event.player.itemInHand.itemMeta.hasDisplayName()) { + return + } + + if (!event.player.itemInHand.itemMeta.displayName.contains(" Spawner",true)) { + return + } + + val type = EntityUtils.parse(event.player.itemInHand.itemMeta.displayName.split(" ")[0]) ?: return + + val spawner = event.block.state as CreatureSpawner + + spawner.spawnedType = type + spawner.update() + + event.player.sendMessage("${ChatColor.GREEN}You placed a ${ChatColor.YELLOW}${EntityUtils.getName(type)}${ChatColor.GREEN}spawner.") + } + + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/WarpHandler.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/WarpHandler.kt new file mode 100644 index 0000000..0e74e55 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/WarpHandler.kt @@ -0,0 +1,51 @@ +package cc.fyre.hybrid.warp + +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.warp.data.Warp +import net.frozenorb.qlib.qLib +import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonReader +import java.io.File +import java.io.FileReader +import java.io.FileWriter +import java.io.IOException + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +class WarpHandler(private val instance: Hybrid) { + + val cache = HashSet() + val container = File(this.instance.dataFolder,"warps") + + init { + + if (!this.container.exists()) this.container.mkdirs() + + this.container.listFiles()?.filterNotNull()?.filter{it.isFile && it.name.endsWith(".json")}!!.forEach{this.cache.add(qLib.GSON.fromJson(JsonReader(FileReader(it)),Warp::class.java))} + } + + fun findById(id: String):Warp? { + return this.cache.firstOrNull(){it.id.equals(id,true)} + } + + fun dispose() { + + this.cache.forEach{ + + val writer = FileWriter("${this.container.path}/${it.id}.json") + + try { + writer.write(qLib.GSON.toJson(it)) + } catch (ex: IOException) { + ex.printStackTrace() + } + + writer.close() + } + + this.cache.clear() + } +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpCommand.kt new file mode 100644 index 0000000..286ece4 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.hybrid.warp.command + +import net.frozenorb.qlib.command.Param + +import cc.fyre.hybrid.warp.data.Warp +import net.frozenorb.qlib.command.Command + +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +object WarpCommand { + + + @JvmStatic + @Command(names = ["warp"],permission = "command.warp") + fun execute(player: Player,@Param(name = "warp")warp: Warp) { + + if (!warp.hasPermission(player)) { + player.sendMessage("${ChatColor.RED}You do not have permission to teleport to this warp.") + return + } + + warp.teleport(player) + player.sendMessage("${ChatColor.GOLD}Warping to ${ChatColor.WHITE}${warp.id}${ChatColor.GOLD}..") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpCreateCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpCreateCommand.kt new file mode 100644 index 0000000..f983225 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpCreateCommand.kt @@ -0,0 +1,32 @@ +package cc.fyre.hybrid.warp.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.warp.data.Warp +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +object WarpCreateCommand { + + @JvmStatic + @Command(names = ["warp create"],permission = "command.warp.create") + fun execute(player: Player,@Param(name = "name")name: String) { + + if (Hybrid.instance.warpHandler.findById(name) != null) { + player.sendMessage("${ChatColor.RED}Warp ${ChatColor.YELLOW}${name}${ChatColor.RED} already exists.") + return + } + + Hybrid.instance.warpHandler.cache.add(Warp(name,player.uniqueId,player.location)) + + player.sendMessage("${ChatColor.GOLD}Created new warp ${ChatColor.WHITE}${name}${ChatColor.GOLD}.") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpDeleteCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpDeleteCommand.kt new file mode 100644 index 0000000..d77db89 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpDeleteCommand.kt @@ -0,0 +1,34 @@ +package cc.fyre.hybrid.warp.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.warp.data.Warp +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.io.File + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +object WarpDeleteCommand { + + @JvmStatic + @Command(names = ["warp delete"],permission = "command.warp.delete") + fun execute(player: Player,@Param(name = "warp")warp: Warp) { + + Hybrid.instance.server.scheduler.runTaskAsynchronously(Hybrid.instance) { + + Hybrid.instance.warpHandler.cache.remove(warp) + + File("${Hybrid.instance.warpHandler.container.path}/${warp.id}.json").delete() + + player.sendMessage("${ChatColor.RED}Deleted warp ${ChatColor.WHITE}${warp.id}${ChatColor.RED}.") + } + + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpListCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpListCommand.kt new file mode 100644 index 0000000..7e22c36 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpListCommand.kt @@ -0,0 +1,38 @@ +package cc.fyre.hybrid.warp.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.warp.data.Warp +import mkremins.fanciful.FancyMessage +import org.apache.commons.lang.StringUtils +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +object WarpListCommand { + + @JvmStatic + @Command(names = ["warp list","warps"],permission = "command.warp.list") + fun execute(player: Player) { + + if (Hybrid.instance.warpHandler.cache.isEmpty()) { + player.sendMessage("${ChatColor.RED}There are no warps.") + return + } + + player.sendMessage("${ChatColor.BLUE}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + Hybrid.instance.warpHandler.cache.filter{it.hasPermission(player)}.forEach{ + FancyMessage("${ChatColor.GRAY}->${ChatColor.WHITE} ${it.id}${ChatColor.GRAY} ${ChatColor.RED}[").then("${ChatColor.YELLOW}Teleport").tooltip("${ChatColor.GREEN}Click to teleport!").command("/warp ${it.id}").then("${ChatColor.RED}]").send(player) + } + + player.sendMessage("${ChatColor.BLUE}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpSetCommand.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpSetCommand.kt new file mode 100644 index 0000000..31342a7 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/command/WarpSetCommand.kt @@ -0,0 +1,29 @@ +package cc.fyre.hybrid.warp.command + +import net.frozenorb.qlib.command.Command +import net.frozenorb.qlib.command.Param + +import cc.fyre.hybrid.warp.data.Warp +import org.bukkit.ChatColor + +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ + +object WarpSetCommand { + + @JvmStatic + @Command(names = ["warp set"],permission = "command.warp.set") + fun execute(player: Player,@Param(name = "warp")warp: Warp) { + warp.location = player.location + + player.sendMessage("${ChatColor.GOLD}Updated location for warp ${ChatColor.WHITE}${warp.id}${ChatColor.GOLD}.") + } + + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/data/Warp.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/data/Warp.kt new file mode 100644 index 0000000..eb55786 --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/data/Warp.kt @@ -0,0 +1,28 @@ +package cc.fyre.hybrid.warp.data + +import com.google.gson.annotations.SerializedName +import org.bukkit.Location +import org.bukkit.entity.Player +import java.util.* + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +class Warp(@SerializedName("_id")val id: String,var owner: UUID,var location: Location) { + + fun teleport(player: Player) { + player.teleport(this.location.clone().add(0.5,0.0,0.5)) + } + + fun getPermission(): String { + return "warp.${this.id.toLowerCase()}" + } + + fun hasPermission(player: Player):Boolean { + return player.hasPermission(this.getPermission()) + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/provider/WarpParameterProvider.kt b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/provider/WarpParameterProvider.kt new file mode 100644 index 0000000..01c56df --- /dev/null +++ b/HyBrid/src/main/kotlin/cc/fyre/hybrid/warp/provider/WarpParameterProvider.kt @@ -0,0 +1,35 @@ +package cc.fyre.hybrid.warp.provider + +import cc.fyre.hybrid.Hybrid +import cc.fyre.hybrid.warp.data.Warp +import net.frozenorb.qlib.command.ParameterType +import net.minecraft.util.org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project hybrid + * + * @date 14/06/2020 + * @author xanderume@gmail.com + */ +class WarpParameterProvider : ParameterType { + + override fun transform(sender: CommandSender, source: String): Warp? { + + val toReturn = Hybrid.instance.warpHandler.findById(source) + + if (toReturn == null) { + sender.sendMessage("${ChatColor.RED}Warp ${ChatColor.YELLOW}$source${ChatColor.RED} does not exist.") + return null + } + + return toReturn + } + + override fun tabComplete(player: Player, flags: Set, source: String): List { + return Hybrid.instance.warpHandler.cache.filter{StringUtils.startsWithIgnoreCase(it.id,source)}.map{it.id}.toList() + } + +} \ No newline at end of file diff --git a/HyBrid/src/main/resources/plugin.yml b/HyBrid/src/main/resources/plugin.yml new file mode 100644 index 0000000..304e9a0 --- /dev/null +++ b/HyBrid/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: Hybrid +main: cc.fyre.hybrid.Hybrid +version: 1.0-SNAPSHOT +depend: [Venom,Hybrid] \ No newline at end of file diff --git a/Modsuite/.gradle/5.2.1/executionHistory/executionHistory.bin b/Modsuite/.gradle/5.2.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..586dca9 Binary files /dev/null and b/Modsuite/.gradle/5.2.1/executionHistory/executionHistory.bin differ diff --git a/Modsuite/.gradle/5.2.1/executionHistory/executionHistory.lock b/Modsuite/.gradle/5.2.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..7f6e30e Binary files /dev/null and b/Modsuite/.gradle/5.2.1/executionHistory/executionHistory.lock differ diff --git a/Modsuite/.gradle/5.2.1/fileChanges/last-build.bin b/Modsuite/.gradle/5.2.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Modsuite/.gradle/5.2.1/fileChanges/last-build.bin differ diff --git a/Modsuite/.gradle/5.2.1/fileContent/fileContent.lock b/Modsuite/.gradle/5.2.1/fileContent/fileContent.lock new file mode 100644 index 0000000..32656ff Binary files /dev/null and b/Modsuite/.gradle/5.2.1/fileContent/fileContent.lock differ diff --git a/Modsuite/.gradle/5.2.1/fileHashes/fileHashes.bin b/Modsuite/.gradle/5.2.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..443f55f Binary files /dev/null and b/Modsuite/.gradle/5.2.1/fileHashes/fileHashes.bin differ diff --git a/Modsuite/.gradle/5.2.1/fileHashes/fileHashes.lock b/Modsuite/.gradle/5.2.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..6d649b3 Binary files /dev/null and b/Modsuite/.gradle/5.2.1/fileHashes/fileHashes.lock differ diff --git a/Modsuite/.gradle/5.2.1/fileHashes/resourceHashesCache.bin b/Modsuite/.gradle/5.2.1/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..9223131 Binary files /dev/null and b/Modsuite/.gradle/5.2.1/fileHashes/resourceHashesCache.bin differ diff --git a/Modsuite/.gradle/5.2.1/gc.properties b/Modsuite/.gradle/5.2.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Modsuite/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Modsuite/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..3ed4291 Binary files /dev/null and b/Modsuite/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Modsuite/.gradle/buildOutputCleanup/cache.properties b/Modsuite/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..9db349b --- /dev/null +++ b/Modsuite/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Apr 14 23:51:44 CEST 2020 +gradle.version=5.2.1 diff --git a/Modsuite/.gradle/buildOutputCleanup/outputFiles.bin b/Modsuite/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..921b1fc Binary files /dev/null and b/Modsuite/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/Modsuite/.gradle/vcs-1/gc.properties b/Modsuite/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Modsuite/.idea/.gitignore b/Modsuite/.idea/.gitignore new file mode 100644 index 0000000..5c98b42 --- /dev/null +++ b/Modsuite/.idea/.gitignore @@ -0,0 +1,2 @@ +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/Modsuite/.idea/compiler.xml b/Modsuite/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/Modsuite/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Modsuite/.idea/dictionaries/xande.xml b/Modsuite/.idea/dictionaries/xande.xml new file mode 100644 index 0000000..bc55ab1 --- /dev/null +++ b/Modsuite/.idea/dictionaries/xande.xml @@ -0,0 +1,14 @@ + + + + bukkit + cooldown + cooldowns + gson + modsuite + mongo + symbiote + teleport + + + \ No newline at end of file diff --git a/Modsuite/.idea/gradle.xml b/Modsuite/.idea/gradle.xml new file mode 100644 index 0000000..c2e7b97 --- /dev/null +++ b/Modsuite/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/Modsuite/.idea/jarRepositories.xml b/Modsuite/.idea/jarRepositories.xml new file mode 100644 index 0000000..e284c41 --- /dev/null +++ b/Modsuite/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Modsuite/.idea/libraries-with-intellij-classes.xml b/Modsuite/.idea/libraries-with-intellij-classes.xml new file mode 100644 index 0000000..9fa3156 --- /dev/null +++ b/Modsuite/.idea/libraries-with-intellij-classes.xml @@ -0,0 +1,65 @@ + + + + + + \ No newline at end of file diff --git a/Modsuite/.idea/misc.xml b/Modsuite/.idea/misc.xml new file mode 100644 index 0000000..38167d7 --- /dev/null +++ b/Modsuite/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Modsuite/.idea/modsuite.iml b/Modsuite/.idea/modsuite.iml new file mode 100644 index 0000000..88feb57 --- /dev/null +++ b/Modsuite/.idea/modsuite.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Modsuite/.idea/vcs.xml b/Modsuite/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/Modsuite/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Modsuite/build.gradle b/Modsuite/build.gradle new file mode 100644 index 0000000..05d6d16 --- /dev/null +++ b/Modsuite/build.gradle @@ -0,0 +1,52 @@ +plugins { + id "org.jetbrains.kotlin.jvm" version "1.3.71" + id "com.github.johnrengelman.shadow" version "5.2.0" +} + +group = 'cc.fyre.modsuite' +version = '1.0-SNAPSHOT' +description = 'modsuite' + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + compileOnly 'cc.fyre.venom:bukkit:1.0-SNAPSHOT' + compileOnly 'cc.fyre.proton:proton:1.0-SNAPSHOT' + compileOnly 'cc.fyre:spigot-server:1.7.10-R0.1-SNAPSHOT' + compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.71" + compileOnly 'mkremins:fanciful:0.4.0-SNAPSHOT' +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} \ No newline at end of file diff --git a/Modsuite/build/classes/kotlin/main/META-INF/modsuite.kotlin_module b/Modsuite/build/classes/kotlin/main/META-INF/modsuite.kotlin_module new file mode 100644 index 0000000..a49347a Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/META-INF/modsuite.kotlin_module differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/ModSuite$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/ModSuite$Companion.class new file mode 100644 index 0000000..b1aa12e Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/ModSuite$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/ModSuite.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/ModSuite.class new file mode 100644 index 0000000..2ad0e78 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/ModSuite.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/StaffChatHandler$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/StaffChatHandler$Companion.class new file mode 100644 index 0000000..728e5c7 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/StaffChatHandler$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/StaffChatHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/StaffChatHandler.class new file mode 100644 index 0000000..3f8995a Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/StaffChatHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/AdminChatCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/AdminChatCommand.class new file mode 100644 index 0000000..e34e993 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/AdminChatCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/ManagementChatCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/ManagementChatCommand.class new file mode 100644 index 0000000..70a4691 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/ManagementChatCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/PartnerChatCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/PartnerChatCommand.class new file mode 100644 index 0000000..88c671b Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/PartnerChatCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/StaffChatCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/StaffChatCommand.class new file mode 100644 index 0000000..8e50ff0 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/command/StaffChatCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/data/StaffChatType.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/data/StaffChatType.class new file mode 100644 index 0000000..5609759 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/data/StaffChatType.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/listener/StaffChatListener$onAsyncChat$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/listener/StaffChatListener$onAsyncChat$1.class new file mode 100644 index 0000000..f3972bc Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/listener/StaffChatListener$onAsyncChat$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/listener/StaffChatListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/listener/StaffChatListener.class new file mode 100644 index 0000000..a0e491f Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/listener/StaffChatListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener$onStaffChat$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener$onStaffChat$1.class new file mode 100644 index 0000000..ee48707 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener$onStaffChat$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener.class new file mode 100644 index 0000000..e6a178e Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteReportCommand$execute$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteReportCommand$execute$1.class new file mode 100644 index 0000000..f97b940 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteReportCommand$execute$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteReportCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteReportCommand.class new file mode 100644 index 0000000..5eade7d Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteReportCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteRequestCommand$execute$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteRequestCommand$execute$1.class new file mode 100644 index 0000000..a6f6a84 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteRequestCommand$execute$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteRequestCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteRequestCommand.class new file mode 100644 index 0000000..99a444d Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/command/ModSuiteRequestCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/database/DatabaseHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/database/DatabaseHandler.class new file mode 100644 index 0000000..e66b263 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/database/DatabaseHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/FreezeHandler$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/FreezeHandler$Companion.class new file mode 100644 index 0000000..f8224e9 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/FreezeHandler$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/FreezeHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/FreezeHandler.class new file mode 100644 index 0000000..9795241 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/FreezeHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/command/FreezeCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/command/FreezeCommand.class new file mode 100644 index 0000000..4348690 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/command/FreezeCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent$Companion.class new file mode 100644 index 0000000..2daa3a8 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent.class new file mode 100644 index 0000000..b680756 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent$Companion.class new file mode 100644 index 0000000..3186f4c Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent.class new file mode 100644 index 0000000..362b4c9 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/listener/FreezeListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/listener/FreezeListener.class new file mode 100644 index 0000000..cd408be Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/freeze/listener/FreezeListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$Companion.class new file mode 100644 index 0000000..a632985 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$findItemByItemStack$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$findItemByItemStack$1.class new file mode 100644 index 0000000..825e66b Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$findItemByItemStack$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$teleport$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$teleport$1.class new file mode 100644 index 0000000..9c4356c Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler$teleport$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler.class new file mode 100644 index 0000000..3181ac6 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/ModModeHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/CanSeeCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/CanSeeCommand.class new file mode 100644 index 0000000..c67fdb4 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/CanSeeCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/InvseeCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/InvseeCommand.class new file mode 100644 index 0000000..bc19548 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/InvseeCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/ModModeCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/ModModeCommand.class new file mode 100644 index 0000000..a159553 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/ModModeCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/TeleportCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/TeleportCommand.class new file mode 100644 index 0000000..8d21e17 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/command/TeleportCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/ModItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/ModItem.class new file mode 100644 index 0000000..370c87c Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/ModItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CarpetItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CarpetItem.class new file mode 100644 index 0000000..ed517fc Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CarpetItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CompassItem$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CompassItem$Companion.class new file mode 100644 index 0000000..ac42e2b Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CompassItem$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CompassItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CompassItem.class new file mode 100644 index 0000000..0922e81 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/CompassItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/InspectItem$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/InspectItem$Companion.class new file mode 100644 index 0000000..776bd7c Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/InspectItem$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/InspectItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/InspectItem.class new file mode 100644 index 0000000..06dce18 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/InspectItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/OnlineStaffItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/OnlineStaffItem.class new file mode 100644 index 0000000..2c04dbc Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/OnlineStaffItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/RandomTPItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/RandomTPItem.class new file mode 100644 index 0000000..8a137ed Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/RandomTPItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/VanishItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/VanishItem.class new file mode 100644 index 0000000..e96c890 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/VanishItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/WorldEditItem$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/WorldEditItem$Companion.class new file mode 100644 index 0000000..1e7af1c Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/WorldEditItem$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/WorldEditItem.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/WorldEditItem.class new file mode 100644 index 0000000..b7fc504 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/data/item/WorldEditItem.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeEnterEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeEnterEvent$Companion.class new file mode 100644 index 0000000..20ce18a Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeEnterEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeEnterEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeEnterEvent.class new file mode 100644 index 0000000..693facd Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeEnterEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeLeaveEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeLeaveEvent$Companion.class new file mode 100644 index 0000000..eb701f9 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeLeaveEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeLeaveEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeLeaveEvent.class new file mode 100644 index 0000000..3ca7c43 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/event/ModModeLeaveEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/listener/ModModeListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/listener/ModModeListener.class new file mode 100644 index 0000000..5340225 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/listener/ModModeListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/listener/ModModeParasiteListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/listener/ModModeParasiteListener.class new file mode 100644 index 0000000..d9ee3ab Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/listener/ModModeParasiteListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/invsee/InventoryMenu.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/invsee/InventoryMenu.class new file mode 100644 index 0000000..6a0468f Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/invsee/InventoryMenu.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/invsee/element/ItemElement.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/invsee/element/ItemElement.class new file mode 100644 index 0000000..7f7149b Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/invsee/element/ItemElement.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu$getAllPagesButtons$$inlined$sortedBy$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu$getAllPagesButtons$$inlined$sortedBy$1.class new file mode 100644 index 0000000..01afd2e Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu$getAllPagesButtons$$inlined$sortedBy$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu.class new file mode 100644 index 0000000..3520517 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/element/OnlineStaffButton.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/element/OnlineStaffButton.class new file mode 100644 index 0000000..65a787f Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/mod/menu/staff/element/OnlineStaffButton.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$1.class new file mode 100644 index 0000000..c8fc16f Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$Companion.class new file mode 100644 index 0000000..460050d Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$findBySender$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$findBySender$1.class new file mode 100644 index 0000000..ccd6abc Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$findBySender$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$findByTarget$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$findByTarget$1.class new file mode 100644 index 0000000..c92ed11 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler$findByTarget$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler.class new file mode 100644 index 0000000..d8be8e0 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/ReportHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/command/ReportCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/command/ReportCommand.class new file mode 100644 index 0000000..252601f Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/command/ReportCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/command/ReportsCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/command/ReportsCommand.class new file mode 100644 index 0000000..5b7bbc1 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/command/ReportsCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/data/Report.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/data/Report.class new file mode 100644 index 0000000..fc228c6 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/data/Report.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/event/PlayerReportEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/event/PlayerReportEvent$Companion.class new file mode 100644 index 0000000..5e5a5e9 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/event/PlayerReportEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/event/PlayerReportEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/event/PlayerReportEvent.class new file mode 100644 index 0000000..184bc1b Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/event/PlayerReportEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/ReportsMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/ReportsMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..58440d3 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/ReportsMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/ReportsMenu.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/ReportsMenu.class new file mode 100644 index 0000000..a0dbc2e Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/ReportsMenu.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/element/ReportButton.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/element/ReportButton.class new file mode 100644 index 0000000..083f5e6 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/menu/element/ReportButton.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener$onReport$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener$onReport$1.class new file mode 100644 index 0000000..d145a53 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener$onReport$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener$onReportValue$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener$onReportValue$1.class new file mode 100644 index 0000000..c603076 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener$onReportValue$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener.class new file mode 100644 index 0000000..346235a Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/report/parasite/ReportParasiteListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$1.class new file mode 100644 index 0000000..cbfe23d Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$Companion.class new file mode 100644 index 0000000..7a9e209 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$findBySender$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$findBySender$1.class new file mode 100644 index 0000000..6cb6115 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler$findBySender$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler.class new file mode 100644 index 0000000..7adffd0 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/RequestHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestCommand.class new file mode 100644 index 0000000..384e8b8 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestsCommand$execute$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestsCommand$execute$1.class new file mode 100644 index 0000000..b656a2e Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestsCommand$execute$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestsCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestsCommand.class new file mode 100644 index 0000000..dfda6fa Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/command/RequestsCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/data/Request.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/data/Request.class new file mode 100644 index 0000000..e571560 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/data/Request.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/event/PlayerRequestEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/event/PlayerRequestEvent$Companion.class new file mode 100644 index 0000000..2126416 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/event/PlayerRequestEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/event/PlayerRequestEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/event/PlayerRequestEvent.class new file mode 100644 index 0000000..ebb6806 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/event/PlayerRequestEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/RequestsMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/RequestsMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class new file mode 100644 index 0000000..33aaee1 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/RequestsMenu$getAllPagesButtons$$inlined$sortedByDescending$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/RequestsMenu.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/RequestsMenu.class new file mode 100644 index 0000000..15c2899 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/RequestsMenu.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/element/RequestButton.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/element/RequestButton.class new file mode 100644 index 0000000..6a26d24 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/menu/element/RequestButton.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener$onRequest$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener$onRequest$1.class new file mode 100644 index 0000000..7787d82 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener$onRequest$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener$onRequestValue$1.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener$onRequestValue$1.class new file mode 100644 index 0000000..a10cbb8 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener$onRequestValue$1.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener.class new file mode 100644 index 0000000..1162920 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/request/parasite/RequestParasiteListener.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/VanishHandler.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/VanishHandler.class new file mode 100644 index 0000000..51c54f6 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/VanishHandler.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/command/VanishCommand.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/command/VanishCommand.class new file mode 100644 index 0000000..b917e1a Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/command/VanishCommand.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishEnterEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishEnterEvent$Companion.class new file mode 100644 index 0000000..4abd10c Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishEnterEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishEnterEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishEnterEvent.class new file mode 100644 index 0000000..029984b Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishEnterEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishLeaveEvent$Companion.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishLeaveEvent$Companion.class new file mode 100644 index 0000000..b01aa26 Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishLeaveEvent$Companion.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishLeaveEvent.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishLeaveEvent.class new file mode 100644 index 0000000..a1235df Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/event/VanishLeaveEvent.class differ diff --git a/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/listener/VanishListener.class b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/listener/VanishListener.class new file mode 100644 index 0000000..831afea Binary files /dev/null and b/Modsuite/build/classes/kotlin/main/cc/fyre/modsuite/vanish/listener/VanishListener.class differ diff --git a/Modsuite/build/kotlin/compileKotlin/build-history.bin b/Modsuite/build/kotlin/compileKotlin/build-history.bin new file mode 100644 index 0000000..56f1c59 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/build-history.bin differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab new file mode 100644 index 0000000..af38b7f Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream new file mode 100644 index 0000000..c848896 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len new file mode 100644 index 0000000..5fddf76 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len new file mode 100644 index 0000000..e933046 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at new file mode 100644 index 0000000..3ac4de2 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i new file mode 100644 index 0000000..e5aea13 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..bab8195 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..2ba9c01 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..6931129 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..ed45ee1 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..eaff17e Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..310d942 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab new file mode 100644 index 0000000..eae71df Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream new file mode 100644 index 0000000..9ea6da7 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len new file mode 100644 index 0000000..0de468d Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len new file mode 100644 index 0000000..09407ef Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at new file mode 100644 index 0000000..fabd352 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i new file mode 100644 index 0000000..49cab7c Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..a9a23f1 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..9b2ab20 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..4850edc Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..9d9c176 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..8c36d54 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..e34b909 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab new file mode 100644 index 0000000..74fa3de Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream new file mode 100644 index 0000000..9d22263 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..adbc080 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len new file mode 100644 index 0000000..7ce6409 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values new file mode 100644 index 0000000..8128309 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at new file mode 100644 index 0000000..8822a8b Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s new file mode 100644 index 0000000..53bdcbf --- /dev/null +++ b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.s @@ -0,0 +1 @@ +û“ \ No newline at end of file diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i new file mode 100644 index 0000000..64727f2 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab new file mode 100644 index 0000000..37d3bf8 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..c0dc11b Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..5fddf76 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..e933046 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..86b5c96 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..28e8655 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab new file mode 100644 index 0000000..afbe870 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream new file mode 100644 index 0000000..260fb1e Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len new file mode 100644 index 0000000..a67fcae Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len new file mode 100644 index 0000000..fd5292d Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at new file mode 100644 index 0000000..2f64591 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i new file mode 100644 index 0000000..5e28b47 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab new file mode 100644 index 0000000..7f80a14 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream new file mode 100644 index 0000000..da74930 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len new file mode 100644 index 0000000..6786b9a Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len new file mode 100644 index 0000000..b797c4d Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at new file mode 100644 index 0000000..8e6c6e6 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i new file mode 100644 index 0000000..da0bc1a Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab new file mode 100644 index 0000000..0487966 --- /dev/null +++ b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab @@ -0,0 +1,2 @@ +61 +2 \ No newline at end of file diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab new file mode 100644 index 0000000..00e2998 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..c0dc11b Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..5fddf76 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len new file mode 100644 index 0000000..e933046 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..b146f3a Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i new file mode 100644 index 0000000..c7d930a Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab new file mode 100644 index 0000000..477ce1b Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..2c31fb9 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..e4e5cbd Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len new file mode 100644 index 0000000..7bc863f Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..85ed6cd Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i new file mode 100644 index 0000000..e25993b Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab new file mode 100644 index 0000000..8f7101d Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream new file mode 100644 index 0000000..b9c8d46 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..9bd0b33 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len new file mode 100644 index 0000000..3e822dd Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values new file mode 100644 index 0000000..a11b439 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at new file mode 100644 index 0000000..eabd89b Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s new file mode 100644 index 0000000..cfe677f --- /dev/null +++ b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.s @@ -0,0 +1 @@ +Ýg \ No newline at end of file diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i new file mode 100644 index 0000000..d114be9 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i differ diff --git a/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len new file mode 100644 index 0000000..4424406 Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len differ diff --git a/Modsuite/build/kotlin/compileKotlin/last-build.bin b/Modsuite/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..61d8bba Binary files /dev/null and b/Modsuite/build/kotlin/compileKotlin/last-build.bin differ diff --git a/Modsuite/build/libs/modsuite-1.0-SNAPSHOT.jar b/Modsuite/build/libs/modsuite-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..ba658ff Binary files /dev/null and b/Modsuite/build/libs/modsuite-1.0-SNAPSHOT.jar differ diff --git a/Modsuite/build/publications/shadow/pom-default.xml b/Modsuite/build/publications/shadow/pom-default.xml new file mode 100644 index 0000000..bbda122 --- /dev/null +++ b/Modsuite/build/publications/shadow/pom-default.xml @@ -0,0 +1,8 @@ + + + 4.0.0 + cc.fyre.modsuite + modsuite + 1.0-SNAPSHOT + + diff --git a/Modsuite/build/resources/main/config.yml b/Modsuite/build/resources/main/config.yml new file mode 100644 index 0000000..e5127c3 --- /dev/null +++ b/Modsuite/build/resources/main/config.yml @@ -0,0 +1 @@ +modMode: true diff --git a/Modsuite/build/resources/main/plugin.yml b/Modsuite/build/resources/main/plugin.yml new file mode 100644 index 0000000..625bee8 --- /dev/null +++ b/Modsuite/build/resources/main/plugin.yml @@ -0,0 +1,4 @@ +name: ModSuite +main: cc.fyre.modsuite.ModSuite +version: 1.0-SNAPSHOT +depend: [Proton,Venom,Kotlin] diff --git a/Modsuite/build/tmp/shadowJar/MANIFEST.MF b/Modsuite/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/Modsuite/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/Modsuite/gradle/wrapper/gradle-wrapper.jar b/Modsuite/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..87b738c Binary files /dev/null and b/Modsuite/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Modsuite/gradle/wrapper/gradle-wrapper.properties b/Modsuite/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..44e7c4d --- /dev/null +++ b/Modsuite/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/Modsuite/gradlew b/Modsuite/gradlew new file mode 100644 index 0000000..2fe81a7 --- /dev/null +++ b/Modsuite/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/Modsuite/gradlew.bat b/Modsuite/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/Modsuite/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Modsuite/settings.gradle b/Modsuite/settings.gradle new file mode 100644 index 0000000..e2f46a0 --- /dev/null +++ b/Modsuite/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'modsuite' + diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/ModSuite.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/ModSuite.kt new file mode 100644 index 0000000..5035e73 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/ModSuite.kt @@ -0,0 +1,70 @@ +package cc.fyre.modsuite + +import cc.fyre.modsuite.chat.StaffChatHandler +import cc.fyre.modsuite.command.ModSuiteReportCommand +import cc.fyre.modsuite.command.ModSuiteRequestCommand +import cc.fyre.modsuite.database.DatabaseHandler +import cc.fyre.modsuite.freeze.FreezeHandler +import cc.fyre.modsuite.mod.ModModeHandler +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.request.RequestHandler +import cc.fyre.modsuite.vanish.VanishHandler +import cc.fyre.proton.Proton + +import com.google.gson.Gson +import com.google.gson.GsonBuilder +import com.google.gson.LongSerializationPolicy + +import org.bukkit.plugin.java.JavaPlugin + +/** + * @project modsuite + * + * @date 14/04/2020 + * @author xanderume@gmail.com + */ +class ModSuite : JavaPlugin() { + + val gson: Gson = GsonBuilder().setLongSerializationPolicy(LongSerializationPolicy.STRING).create() + + lateinit var databaseHandler: DatabaseHandler + + lateinit var reportHandler: ReportHandler + lateinit var requestHandler: RequestHandler + lateinit var staffChatHandler: StaffChatHandler + + lateinit var vanishHandler: VanishHandler + lateinit var freezeHandler: FreezeHandler + lateinit var modModeHandler: ModModeHandler + + override fun onEnable() { + instance = this + + this.saveDefaultConfig() + + this.databaseHandler = DatabaseHandler(this) + + this.reportHandler = ReportHandler(this) + this.requestHandler = RequestHandler(this) + this.staffChatHandler = StaffChatHandler(this) + + this.vanishHandler = VanishHandler(this) + this.freezeHandler = FreezeHandler(this) + this.modModeHandler = ModModeHandler(this) + + Proton.getInstance().commandHandler.registerClass(ModSuiteReportCommand::class.java) + Proton.getInstance().commandHandler.registerClass(ModSuiteRequestCommand::class.java) + } + + override fun onDisable() { + this.freezeHandler.dispose() + this.modModeHandler.dispose() + } + + companion object { + + lateinit var instance: ModSuite + + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/StaffChatHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/StaffChatHandler.kt new file mode 100644 index 0000000..cc58417 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/StaffChatHandler.kt @@ -0,0 +1,74 @@ +package cc.fyre.modsuite.chat + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.chat.command.* +import cc.fyre.modsuite.chat.data.StaffChatType +import cc.fyre.modsuite.chat.listener.StaffChatListener +import cc.fyre.modsuite.chat.parasite.StaffChatParasiteListener +import cc.fyre.proton.Proton +import cc.fyre.symbiote.Symbiote +import cc.fyre.venom.Venom +import cc.fyre.venom.VenomAPI +import com.google.gson.JsonObject +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +import kotlin.collections.HashMap + + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class StaffChatHandler(private val instance: ModSuite) { + + val cache = HashMap() + + init { + Proton.getInstance().commandHandler.registerClass(StaffChatCommand::class.java) + Proton.getInstance().commandHandler.registerClass(AdminChatCommand::class.java) + Proton.getInstance().commandHandler.registerClass(PartnerChatCommand::class.java) + Proton.getInstance().commandHandler.registerClass(ManagementChatCommand::class.java) + + this.instance.server.pluginManager.registerEvents(StaffChatListener(this.instance),this.instance) + + this.instance.databaseHandler.symbiote.addListener(StaffChatParasiteListener(this.instance)) + } + + fun isEnabled(uuid: UUID,type: StaffChatType): Boolean { + return this.cache.containsKey(uuid) && this.cache[uuid] == type + } + + fun setEnabled(player: Player,type: StaffChatType,value: Boolean) { + + if (value) { + this.cache[player.uniqueId] = type + } else { + if (this.cache.containsKey(player.uniqueId) && this.cache[player.uniqueId] == type) this.cache.remove(player.uniqueId) + } + + player.sendMessage("${ChatColor.GOLD}${type.formattedName}: ${if (this.isEnabled(player.uniqueId,type)) "${ChatColor.GREEN}Enabled" else "${ChatColor.RED}Disabled"}") + } + + fun sendMessage(type: StaffChatType,sender: String,message: String) { + + val jsonObject = JsonObject() + + jsonObject.addProperty("type",type.name) + jsonObject.addProperty("sender",sender) + jsonObject.addProperty("server",Venom.instance.serverHandler.server.id) + jsonObject.addProperty("message",message) + + this.instance.databaseHandler.symbiote.sendPacket(Symbiote(STAFF_CHAT_PACKET,jsonObject)) + } + + companion object { + + const val STAFF_CHAT_PACKET = "STAFF_CHAT_PACKET" + + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/AdminChatCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/AdminChatCommand.kt new file mode 100644 index 0000000..3ff6ccf --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/AdminChatCommand.kt @@ -0,0 +1,32 @@ +package cc.fyre.modsuite.chat.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.chat.data.StaffChatType +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 20/06/2020 + * @author xanderume@gmail.com + */ +object AdminChatCommand { + + const val PERMISSION = "command.adminchat" + + @JvmStatic + @Command(names = ["adminchat","ac"],async = true,hidden = true,permission = PERMISSION,description = "Send a message to other admins!") + fun execute(player: Player, @Parameter(name = "message",wildcard = true,defaultValue = StaffChatCommand.TOGGLE_KEYWORD)message: String) { + + if (message == StaffChatCommand.TOGGLE_KEYWORD) { + ModSuite.instance.staffChatHandler.setEnabled(player,StaffChatType.ADMIN,!ModSuite.instance.staffChatHandler.isEnabled(player.uniqueId,StaffChatType.ADMIN)) + return + } + + ModSuite.instance.staffChatHandler.sendMessage(StaffChatType.ADMIN,PlayerUtil.getDisplayName(player.uniqueId,player.name),message) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/ManagementChatCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/ManagementChatCommand.kt new file mode 100644 index 0000000..64c058f --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/ManagementChatCommand.kt @@ -0,0 +1,32 @@ +package cc.fyre.modsuite.chat.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.chat.data.StaffChatType +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 20/06/2020 + * @author xanderume@gmail.com + */ +object ManagementChatCommand { + + const val PERMISSION = "command.managementchat" + + @JvmStatic + @Command(names = ["managementchat","mc"],async = true,hidden = true,permission = PERMISSION,description = "Send a message to other managers!") + fun execute(player: Player, @Parameter(name = "message",wildcard = true,defaultValue = StaffChatCommand.TOGGLE_KEYWORD)message: String) { + + if (message == StaffChatCommand.TOGGLE_KEYWORD) { + ModSuite.instance.staffChatHandler.setEnabled(player,StaffChatType.MANAGEMENT,!ModSuite.instance.staffChatHandler.isEnabled(player.uniqueId,StaffChatType.MANAGEMENT)) + return + } + + ModSuite.instance.staffChatHandler.sendMessage(StaffChatType.MANAGEMENT,PlayerUtil.getDisplayName(player.uniqueId,player.name),message) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/PartnerChatCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/PartnerChatCommand.kt new file mode 100644 index 0000000..a1d4a40 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/PartnerChatCommand.kt @@ -0,0 +1,32 @@ +package cc.fyre.modsuite.chat.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.chat.data.StaffChatType +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 02/07/2020 + * @author xanderume@gmail.com + */ +object PartnerChatCommand { + + const val PERMISSION = "command.partnerchat" + + @JvmStatic + @Command(names = ["partnerchat","pc"],async = true,hidden = true,permission = PERMISSION,description = "Send a message to other partners!") + fun execute(player: Player, @Parameter(name = "message",wildcard = true,defaultValue = StaffChatCommand.TOGGLE_KEYWORD)message: String) { + + if (message == StaffChatCommand.TOGGLE_KEYWORD) { + ModSuite.instance.staffChatHandler.setEnabled(player,StaffChatType.MANAGEMENT,!ModSuite.instance.staffChatHandler.isEnabled(player.uniqueId,StaffChatType.MANAGEMENT)) + return + } + + ModSuite.instance.staffChatHandler.sendMessage(StaffChatType.MANAGEMENT,PlayerUtil.getDisplayName(player.uniqueId,player.name),message) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/StaffChatCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/StaffChatCommand.kt new file mode 100644 index 0000000..b5c288d --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/command/StaffChatCommand.kt @@ -0,0 +1,35 @@ +package cc.fyre.modsuite.chat.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.chat.data.StaffChatType +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter + +import cc.fyre.venom.util.PlayerUtil + +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +object StaffChatCommand { + + const val PERMISSION = "command.staffchat" + const val TOGGLE_KEYWORD = "T_0_G_G_L_E" + + @JvmStatic + @Command(names = ["staffchat","sc"],async = true,hidden = true,permission = PERMISSION,description = "Send a message to other staff!") + fun execute(player: Player, @Parameter(name = "message",wildcard = true,defaultValue = TOGGLE_KEYWORD)message: String) { + + if (message == TOGGLE_KEYWORD) { + ModSuite.instance.staffChatHandler.setEnabled(player,StaffChatType.NORMAL,!ModSuite.instance.staffChatHandler.isEnabled(player.uniqueId,StaffChatType.NORMAL)) + return + } + + ModSuite.instance.staffChatHandler.sendMessage(StaffChatType.NORMAL,PlayerUtil.getDisplayName(player.uniqueId,player.name),message) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/data/StaffChatType.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/data/StaffChatType.kt new file mode 100644 index 0000000..7fb18d2 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/data/StaffChatType.kt @@ -0,0 +1,36 @@ +package cc.fyre.modsuite.chat.data + +import cc.fyre.modsuite.chat.command.AdminChatCommand +import cc.fyre.modsuite.chat.command.ManagementChatCommand +import cc.fyre.modsuite.chat.command.PartnerChatCommand +import cc.fyre.modsuite.chat.command.StaffChatCommand +import cc.fyre.venom.Venom +import mkremins.fanciful.FancyMessage + +import org.bukkit.ChatColor + +/** + * @project modsuite + * + * @date 20/06/2020 + * @author xanderume@gmail.com + */ +enum class StaffChatType(private val prefix: String,val color: ChatColor,val formattedName: String,val permission: String) { + + NORMAL("${ChatColor.BLUE}[S]",ChatColor.AQUA,"SC",StaffChatCommand.PERMISSION), + PARTNER("${ChatColor.LIGHT_PURPLE}[Partner]",ChatColor.GRAY,"PC",PartnerChatCommand.PERMISSION), + ADMIN("${ChatColor.DARK_RED}[A]",ChatColor.RED,"AC",AdminChatCommand.PERMISSION), + MANAGEMENT("${ChatColor.DARK_PURPLE}[M]",ChatColor.LIGHT_PURPLE,"MC",ManagementChatCommand.PERMISSION); + + fun getMessage(sender: String,message: String,server: String):FancyMessage { + + val toReturn = FancyMessage("${this.prefix}${this.color}[").then(server).color(this.color) + + if (Venom.instance.serverHandler.serverID != server) { + toReturn.tooltip("${ChatColor.GREEN}Click to join ${ChatColor.WHITE}$server${ChatColor.GREEN}!") + toReturn.command("/server $server") + } + + return toReturn.then("${this.color}] ${sender}${ChatColor.GRAY}: ${ChatColor.WHITE}${message}") + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/listener/StaffChatListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/listener/StaffChatListener.kt new file mode 100644 index 0000000..7a7a430 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/listener/StaffChatListener.kt @@ -0,0 +1,35 @@ +package cc.fyre.modsuite.chat.listener + +import cc.fyre.modsuite.ModSuite +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.Bukkit +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.player.AsyncPlayerChatEvent + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class StaffChatListener(private val instance: ModSuite): Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onAsyncChat(event: AsyncPlayerChatEvent) { + + if (!this.instance.staffChatHandler.cache.containsKey(event.player.uniqueId)) { + return + } + + event.isCancelled = true + + Bukkit.getServer().scheduler.runTaskAsynchronously(this.instance) { + this.instance.staffChatHandler.sendMessage(this.instance.staffChatHandler.cache[event.player.uniqueId]!!,PlayerUtil.getDisplayName(event.player.uniqueId,event.player.name),event.message) + } + + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener.kt new file mode 100644 index 0000000..d508acf --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/chat/parasite/StaffChatParasiteListener.kt @@ -0,0 +1,48 @@ +package cc.fyre.modsuite.chat.parasite + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.chat.StaffChatHandler +import cc.fyre.modsuite.chat.data.StaffChatType + +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import cc.fyre.venom.Venom + +import com.google.gson.JsonObject +import org.bukkit.scheduler.BukkitRunnable + +import java.lang.NullPointerException + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class StaffChatParasiteListener(private val instance: ModSuite) : ParasiteListener { + + @Parasite(StaffChatHandler.STAFF_CHAT_PACKET) + fun onStaffChat(data: JsonObject) { + + val type: StaffChatType + + try { + type = StaffChatType.valueOf(data["type"].asString) + } catch (ex: NullPointerException) { + return + } + + val message = type.getMessage(data["sender"].asString,data["message"].asString,data["server"].asString) + + message.send(this.instance.server.consoleSender) + + object : BukkitRunnable() { + + override fun run() { + this@StaffChatParasiteListener.instance.server.onlinePlayers.filter{it.hasPermission(type.permission)}.forEach{message.send(it)} + } + + }.runTask(this.instance) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/command/ModSuiteReportCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/command/ModSuiteReportCommand.kt new file mode 100644 index 0000000..4dea0b9 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/command/ModSuiteReportCommand.kt @@ -0,0 +1,51 @@ +package cc.fyre.modsuite.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.request.RequestHandler +import cc.fyre.proton.Proton +import cc.fyre.proton.command.Command +import cc.fyre.symbiote.Symbiote +import cc.fyre.venom.Venom +import cc.fyre.venom.VenomAPI +import cc.fyre.venom.database.jedis.RedisCommand +import cc.fyre.venom.profile.ProfileHandler +import cc.fyre.venom.util.PlayerUtil +import com.google.gson.JsonObject +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import org.bukkit.scheduler.BukkitRunnable +import redis.clients.jedis.Jedis + +/** + * @project modsuite + * + * @date 31/12/2020 + * @author xanderume@gmail.com + */ +object ModSuiteReportCommand { + + const val PERMISSION = "command.modsuite.reports" + + @JvmStatic + @Command(names = ["modsuite reports"],async = true,permission = PERMISSION) + fun execute(sender: CommandSender) { + + val value = !ModSuite.instance.reportHandler.enabled + val payload = JsonObject() + + payload.addProperty("value",value) + payload.addProperty("displayName",PlayerUtil.getDisplayName(if (sender is Player) sender.uniqueId else ProfileHandler.CONSOLE_UUID,sender.name)) + + VenomAPI.instance.databaseHandler.runRedisCommand(object :RedisCommand { + + override fun execute(jedis: Jedis): Any { + return jedis.set(ReportHandler.ENABLED_KEY,value.toString()) + } + + }) + + ModSuite.instance.databaseHandler.symbiote.sendPacket(Symbiote(ReportHandler.REPORT_VALUE_PACKET,payload)) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/command/ModSuiteRequestCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/command/ModSuiteRequestCommand.kt new file mode 100644 index 0000000..75c5ffe --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/command/ModSuiteRequestCommand.kt @@ -0,0 +1,52 @@ +package cc.fyre.modsuite.command + + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.request.RequestHandler +import cc.fyre.proton.Proton +import cc.fyre.proton.command.Command +import cc.fyre.symbiote.Symbiote +import cc.fyre.venom.VenomAPI +import cc.fyre.venom.database.jedis.RedisCommand + +import cc.fyre.venom.profile.ProfileHandler +import cc.fyre.venom.util.PlayerUtil +import com.google.gson.JsonObject + +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import redis.clients.jedis.Jedis + +/** + * @project modsuite + * + * @date 31/12/2020 + * @author xanderume@gmail.com + */ +object ModSuiteRequestCommand { + + const val PERMISSION = "command.modsuite.requests" + + @JvmStatic + @Command(names = ["modsuite requests"],async = true,permission = PERMISSION) + fun execute(sender: CommandSender) { + + val value = !ModSuite.instance.requestHandler.enabled + val payload = JsonObject() + payload.addProperty("value",value) + payload.addProperty("displayName", + PlayerUtil.getDisplayName(if (sender is Player) sender.uniqueId else ProfileHandler.CONSOLE_UUID,sender.name)) + + VenomAPI.instance.databaseHandler.runRedisCommand(object : RedisCommand { + + override fun execute(jedis: Jedis): Any { + return jedis.set(RequestHandler.ENABLED_KEY,value.toString()) + } + + }) + + ModSuite.instance.databaseHandler.symbiote.sendPacket(Symbiote(RequestHandler.REQUEST_VALUE_PACKET,payload)) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/database/DatabaseHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/database/DatabaseHandler.kt new file mode 100644 index 0000000..91794d3 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/database/DatabaseHandler.kt @@ -0,0 +1,33 @@ +package cc.fyre.modsuite.database + +import cc.fyre.modsuite.ModSuite +import cc.fyre.symbiote.SymbioteAPI +import cc.fyre.symbiote.type.RedisSymbioteAPI +import cc.fyre.venom.Venom +import cc.fyre.venom.VenomAPI + +import cc.fyre.venom.database.jedis.CustomPoolConfig +import com.mongodb.MongoClient +import com.mongodb.MongoCredential +import com.mongodb.ServerAddress +import com.mongodb.client.MongoDatabase +import com.mongodb.client.model.UpdateOptions +import redis.clients.jedis.Jedis + +import redis.clients.jedis.JedisPool +/** + * @project venom + * + * @date 16/03/2020 + * @author xanderume@gmail.com + */ +class DatabaseHandler(private val instance: ModSuite) { + + val mongoDB = VenomAPI.instance.databaseHandler.mongoPool.getDatabase("modsuite") + val symbiote = if (VenomAPI.instance.databaseHandler.redis.isAuthenticationRequired()) { + RedisSymbioteAPI(VenomAPI.instance.databaseHandler.redisPool,"modsuite",VenomAPI.instance.databaseHandler.redis.password) + } else { + RedisSymbioteAPI(VenomAPI.instance.databaseHandler.redisPool,"modsuite") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/FreezeHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/FreezeHandler.kt new file mode 100644 index 0000000..c9956a9 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/FreezeHandler.kt @@ -0,0 +1,76 @@ +package cc.fyre.modsuite.freeze + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.freeze.command.FreezeCommand +import cc.fyre.modsuite.freeze.event.PlayerFreezeEvent +import cc.fyre.modsuite.freeze.event.PlayerUnfreezeEvent +import cc.fyre.modsuite.freeze.listener.FreezeListener +import cc.fyre.proton.Proton +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.potion.PotionEffect +import org.bukkit.potion.PotionEffectType +import org.bukkit.util.Vector +import java.util.* +import kotlin.collections.HashMap +import kotlin.collections.HashSet + +/** + * @project modsuite + * + * @date 27/04/2020 + * @author xanderume@gmail.com + */ +class FreezeHandler(private val instance: ModSuite) { + + private val cache = HashSet() + private val effects = HashMap>() + + init { + Proton.getInstance().commandHandler.registerClass(FreezeCommand::class.java) + + this.instance.server.pluginManager.registerEvents(FreezeListener(this.instance),this.instance) + } + + fun isFrozen(uuid: UUID):Boolean { + return this.cache.contains(uuid) + } + + fun setFrozen(player: Player,frozen: Boolean) { + player.sendMessage("${if (frozen) "${ChatColor.RED}" else "${ChatColor.GREEN}"}${ChatColor.BOLD}You have been ${if (frozen) "" else "un-"}frozen by a staff member.") + + if (frozen) { + this.effects[player.uniqueId] = player.activePotionEffects + + player.activePotionEffects.forEach{player.removePotionEffect(it.type)} + player.addPotionEffect(PotionEffect(PotionEffectType.JUMP,Integer.MAX_VALUE,128)) + + player.location.y = player.location.blockY.toDouble() + + player.velocity = Vector(0,0,0) + + this.cache.add(player.uniqueId) + + this.instance.server.pluginManager.callEvent(PlayerFreezeEvent(player)) + return + } + + player.removePotionEffect(PotionEffectType.JUMP) + + this.cache.remove(player.uniqueId) + this.effects.remove(player.uniqueId)!!.forEach{player.addPotionEffect(it)} + + this.instance.server.pluginManager.callEvent(PlayerUnfreezeEvent(player)) + } + + fun dispose() { + this.instance.server.onlinePlayers.filter{this.cache.contains(it.uniqueId)}.forEach{this.setFrozen(it,false)} + } + + companion object { + + val CANCEL_MESSAGE = "${ChatColor.RED}${ChatColor.BOLD}You cannot do this whilst frozen." + val WHITELISTED_COMMANDS = arrayListOf("message","msg","reply","r","tell","whisper","freeze","ss") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/command/FreezeCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/command/FreezeCommand.kt new file mode 100644 index 0000000..37a4c58 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/command/FreezeCommand.kt @@ -0,0 +1,33 @@ +package cc.fyre.modsuite.freeze.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +object FreezeCommand { + + const val PERMISSION = "command.freeze" + + @JvmStatic + @Command(names = ["freeze","ss"],hidden = true,permission = PERMISSION,description = "Freeze a player!") + fun execute(sender: CommandSender,@Parameter(name = "player")target: Player) { + + val frozen = ModSuite.instance.freezeHandler.isFrozen(target.uniqueId) + + ModSuite.instance.freezeHandler.setFrozen(target,!frozen) + + sender.sendMessage("${PlayerUtil.getDisplayName(target.uniqueId,target.name)}${ChatColor.GREEN} is ${if (frozen) "no longer" else "now"} frozen.") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent.kt new file mode 100644 index 0000000..ebd266a --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/event/PlayerFreezeEvent.kt @@ -0,0 +1,23 @@ +package cc.fyre.modsuite.freeze.event + +import org.bukkit.entity.Player +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class PlayerFreezeEvent(val player: Player) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent.kt new file mode 100644 index 0000000..074d47a --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/event/PlayerUnfreezeEvent.kt @@ -0,0 +1,23 @@ +package cc.fyre.modsuite.freeze.event + +import org.bukkit.entity.Player +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class PlayerUnfreezeEvent(val player: Player) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/listener/FreezeListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/listener/FreezeListener.kt new file mode 100644 index 0000000..3b2f818 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/freeze/listener/FreezeListener.kt @@ -0,0 +1,164 @@ +package cc.fyre.modsuite.freeze.listener + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.freeze.FreezeHandler +import cc.fyre.modsuite.freeze.command.FreezeCommand +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import mkremins.fanciful.FancyMessage +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.entity.EntityDamageEvent +import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.player.* +import org.bukkit.util.Vector + +/** + * @project modsuite + * + * @date 28/04/2020 + * @author xanderume@gmail.com + */ +class FreezeListener(private val instance: ModSuite) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerMove(event: PlayerMoveEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + if (event.from.x == event.to.x && event.from.z == event.to.z) { + return + } + + event.isCancelled + event.player.teleport(event.from) + event.player.velocity = Vector(0,0,0) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + this.instance.freezeHandler.setFrozen(event.player,false) + + val message = FancyMessage( + "${PlayerUtil.getDisplayName(event.player.uniqueId,event.player.name)}${ChatColor.DARK_RED}${ChatColor.BOLD} has logged out while frozen!") + .tooltip("${ChatColor.GREEN}Click to ban!") + .command("/ban ${event.player.name} perm Logged out while frozen") + + this.instance.server.onlinePlayers.filter{it.hasPermission(FreezeCommand.PERMISSION)}.forEach{ + it.sendMessage(" ") + message.send(it) + it.sendMessage(" ") + } + + + this.instance.server.consoleSender.sendMessage(" ") + message.send(this.instance.server.consoleSender) + this.instance.server.consoleSender.sendMessage(" ") + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onCommandExecute(event: PlayerCommandPreprocessEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + if (FreezeHandler.WHITELISTED_COMMANDS.any{it.equals(event.message.substring(1).split(" ")[0],true)}) { + return + } + + event.isCancelled = true + event.player.sendMessage(FreezeHandler.CANCEL_MESSAGE) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (event.entity !is Player || event.damager !is Player) { + return + } + + if (this.instance.freezeHandler.isFrozen(event.entity.uniqueId)) { + event.isCancelled = true + (event.damager as Player).sendMessage("${PlayerUtil.getDisplayName(event.entity.uniqueId,(event.entity as Player).name)}${ChatColor.RED} is currently frozen and cannot be damaged.") + return + } + + if (!this.instance.freezeHandler.isFrozen(event.damager.uniqueId)) { + return + } + + event.isCancelled = true + (event.damager as Player).sendMessage(FreezeHandler.CANCEL_MESSAGE) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onInventoryClick(event: InventoryClickEvent) { + + if (event.whoClicked !is Player || !this.instance.freezeHandler.isFrozen(event.whoClicked.uniqueId)) { + return + } + + event.isCancelled = true + (event.whoClicked as Player).sendMessage(FreezeHandler.CANCEL_MESSAGE) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onDropItem(event: PlayerDropItemEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + event.isCancelled = true + event.player.sendMessage(FreezeHandler.CANCEL_MESSAGE) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + event.isCancelled = true + event.player.updateInventory() + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + event.isCancelled = true + event.player.sendMessage(FreezeHandler.CANCEL_MESSAGE) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (!this.instance.freezeHandler.isFrozen(event.player.uniqueId)) { + return + } + + event.isCancelled = true + event.player.sendMessage(FreezeHandler.CANCEL_MESSAGE) + } + + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/ModModeHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/ModModeHandler.kt new file mode 100644 index 0000000..b114b87 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/ModModeHandler.kt @@ -0,0 +1,177 @@ +package cc.fyre.modsuite.mod + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.mod.command.CanSeeCommand +import cc.fyre.modsuite.mod.command.InvseeCommand +import cc.fyre.modsuite.mod.command.ModModeCommand +import cc.fyre.modsuite.mod.command.TeleportCommand +import cc.fyre.modsuite.mod.data.ModItem + +import cc.fyre.modsuite.mod.data.item.* +import cc.fyre.modsuite.mod.event.ModModeEnterEvent +import cc.fyre.modsuite.mod.event.ModModeLeaveEvent +import cc.fyre.modsuite.mod.listener.ModModeListener +import cc.fyre.modsuite.mod.listener.ModModeParasiteListener +import cc.fyre.proton.Proton +import cc.fyre.symbiote.Symbiote +import cc.fyre.venom.network.data.Server +import com.google.common.io.ByteStreams + +import com.google.gson.JsonObject +import org.bukkit.ChatColor +import org.bukkit.GameMode +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import java.util.* +import kotlin.collections.HashMap +import kotlin.collections.HashSet + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ModModeHandler(private val instance: ModSuite) { + + private val cache = HashSet() + private val items = HashSet() + + private val armor = HashMap>() + private val gameMode = HashMap() + private val inventories = HashMap>() + + init { + Proton.getInstance().commandHandler.registerClass(CanSeeCommand::class.java) + Proton.getInstance().commandHandler.registerClass(InvseeCommand::class.java) + Proton.getInstance().commandHandler.registerClass(TeleportCommand::class.java) + + if (this.instance.config.getBoolean("modMode")) { + + this.items.add(CarpetItem()) + this.items.add(CompassItem()) + this.items.add(InspectItem()) + this.items.add(WorldEditItem()) + this.items.add(RandomTPItem()) + this.items.add(OnlineStaffItem()) + this.items.add(VanishItem()) + + Proton.getInstance().commandHandler.registerClass(ModModeCommand::class.java) + + this.instance.server.pluginManager.registerEvents(ModModeListener(this.instance),this.instance) + + this.instance.server.onlinePlayers.filter{it.hasPermission(ModModeCommand.PERMISSION)}.forEach{this.setModMode(it,true)} + } + + this.instance.server.messenger.registerOutgoingPluginChannel(this.instance,"BungeeCord") + this.instance.databaseHandler.symbiote.addListener(ModModeParasiteListener(this.instance)) + } + + fun dispose() { + this.instance.server.onlinePlayers.filter{this.cache.contains(it.uniqueId)}.forEach{this.setModMode(it,false)} + } + + fun isInModMode(uuid: UUID):Boolean { + return this.cache.contains(uuid) + } + + fun setModMode(player: Player,modMode: Boolean) { + player.sendMessage("${ChatColor.GOLD}Mod Mode: ${if (modMode) "${ChatColor.GREEN}Enabled" else "${ChatColor.RED}Disabled"}") + + if (modMode) { + this.armor[player.uniqueId] = player.inventory.armorContents + this.gameMode[player.uniqueId] = player.gameMode + this.inventories[player.uniqueId] = player.inventory.contents + + player.inventory.clear() + player.inventory.armorContents = null + + player.gameMode = GameMode.CREATIVE + + this.instance.vanishHandler.setVanished(player,true,force = true) + + this.items.filter{it.allowed(player)}.forEach{player.inventory.setItem(it.slot(player),it.create(player))} + + player.updateInventory() + + this.cache.add(player.uniqueId) + + this.instance.server.pluginManager.callEvent(ModModeEnterEvent(player)) + return + } + + player.inventory.clear() + player.inventory.contents = this.inventories.remove(player.uniqueId) + player.inventory.armorContents = this.armor.remove(player.uniqueId) + + player.gameMode = this.gameMode.remove(player.uniqueId) + + player.updateInventory() + + this.cache.remove(player.uniqueId) + + this.instance.vanishHandler.setVanished(player,false, force = true) + + this.instance.server.pluginManager.callEvent(ModModeLeaveEvent(player)) + } + + fun updateItems(player: Player) { + + if (!this.cache.contains(player.uniqueId)) { + this.instance.logger.info("Tried to update items for ${player.name} but not in staff mode?") + return + } + + player.inventory.clear() + + this.items.filter{it.allowed(player)}.forEach{player.inventory.setItem(it.slot(player),it.create(player))} + + player.updateInventory() + } + + fun registerItem(item: ModItem) { + this.items.add(item) + } + + fun findItemByItemStack(itemStack: ItemStack,player: Player):Optional { + return this.items.stream().filter{it.isSimilar(player,itemStack)}.findFirst() + } + + fun teleport(player: Player,target: UUID,server: Server) { + + this.sendToServer(player,server.id) + + val jsonObject = JsonObject() + + jsonObject.addProperty("_id",player.uniqueId.toString()) + jsonObject.addProperty("target",target.toString()) + jsonObject.addProperty("server",server.id) + + this.instance.server.scheduler.runTaskLaterAsynchronously(this.instance,{ + this.instance.databaseHandler.symbiote.sendPacket(Symbiote(BUNGEE_TELEPORT,jsonObject)) + },20L) + } + + companion object { + + const val BUNGEE_TELEPORT = "PROXY_TELEPORT" + + } + + private fun sendToServer(player: Player,server: String) { + + try { + + val out = ByteStreams.newDataOutput() + + out.writeUTF("Connect") + out.writeUTF(server) + + player.sendPluginMessage(ModSuite.instance,"BungeeCord",out.toByteArray()) + } catch (e: Exception) { + e.printStackTrace() + } + + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/CanSeeCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/CanSeeCommand.kt new file mode 100644 index 0000000..02c6864 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/CanSeeCommand.kt @@ -0,0 +1,34 @@ +package cc.fyre.modsuite.mod.command + +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/05/2020 + * @author xanderume@gmail.com + */ +object CanSeeCommand { + + @JvmStatic + @Command(names = ["cansee"],hidden = true,permission = "command.cansee") + fun execute(sender: CommandSender,@Parameter(name = "player")player: Player,@Parameter(name = "target")target: Player) { + + val display = PlayerUtil.getDisplayName(player.uniqueId,player.name) + val targetDisplay = PlayerUtil.getDisplayName(target.uniqueId,target.name) + + if (player.canSee(target)) { + sender.sendMessage("$display ${ChatColor.GREEN}can see $targetDisplay${ChatColor.GREEN}.") + return + } + + sender.sendMessage("$display ${ChatColor.RED}cannot see $targetDisplay${ChatColor.RED}.") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/InvseeCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/InvseeCommand.kt new file mode 100644 index 0000000..d7dbb70 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/InvseeCommand.kt @@ -0,0 +1,25 @@ +package cc.fyre.modsuite.mod.command + +import cc.fyre.modsuite.mod.menu.invsee.InventoryMenu +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter + +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 17/05/2020 + * @author xanderume@gmail.com + */ +object InvseeCommand { + + const val PERMISSION = "command.invsee" + + @JvmStatic + @Command(names = ["invsee","inv"],hidden = true,permission = PERMISSION,description = "Enter or leave Mod Mode!") + fun execute(sender: Player,@Parameter(name = "player")target: Player) { + InventoryMenu(target).openMenu(sender) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/ModModeCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/ModModeCommand.kt new file mode 100644 index 0000000..1201c3a --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/ModModeCommand.kt @@ -0,0 +1,39 @@ +package cc.fyre.modsuite.mod.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter + +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +object ModModeCommand { + + const val PERMISSION = "command.modmode" + + @JvmStatic + @Command(names = ["modmode","modsuite","staffmode","mod","h","hackermode"],hidden = true,permission = PERMISSION,description = "Enter or leave Mod Mode!") + fun execute(sender: CommandSender,@Parameter(name = "player",defaultValue = "self")target: Player) { + if (sender is Player && sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You do not have permission to put other players into mod mode.") + return + } + + val modMode: Boolean = ModSuite.instance.modModeHandler.isInModMode(target.uniqueId) + + if (sender is Player && sender.uniqueId != target.uniqueId) { + sender.sendMessage("${ChatColor.GOLD}You have ${(if (modMode) "${ChatColor.RED}disabled" else "${ChatColor.GREEN}enabled")}${ChatColor.GOLD} mod mode for ${PlayerUtil.getDisplayName(target.uniqueId,target.name)}${ChatColor.GOLD}.") + } + + ModSuite.instance.modModeHandler.setModMode(target,!modMode) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/TeleportCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/TeleportCommand.kt new file mode 100644 index 0000000..b2cd7c8 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/command/TeleportCommand.kt @@ -0,0 +1,51 @@ +package cc.fyre.modsuite.mod.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.Venom +import cc.fyre.venom.VenomAPI +import org.bukkit.ChatColor + +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 22/07/2020 + * @author xanderume@gmail.com + */ +object TeleportCommand { + + const val PERMISSION = "command.teleport.bungee" + + @JvmStatic + @Command(names = ["bungeeteleport","bungeetpto","bungeetp","bungeegoto","proxyteleport","proxytpto","proxytp","proxygoto"],hidden = true,permission = PERMISSION) + fun execute(player: Player,@Parameter(name = "player")name: String) { + + val uuid = Venom.instance.api.profileHandler.findId(name) + + if (uuid == null) { + player.sendMessage("${ChatColor.RED}No player with the name ${ChatColor.YELLOW}$name${ChatColor.RED} found.") + return + } + + val target = ModSuite.instance.server.getPlayer(uuid) + + if (target != null) { + player.teleport(target) + return + } + + val server = VenomAPI.instance.networkHandler.findServer(uuid) + + if (server == null) { + player.sendMessage("${ChatColor.RED}No player with the name ${ChatColor.YELLOW}$name${ChatColor.RED} found.") + return + } + + ModSuite.instance.modModeHandler.teleport(player,uuid,server) + } + + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/ModItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/ModItem.kt new file mode 100644 index 0000000..1be3d88 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/ModItem.kt @@ -0,0 +1,47 @@ +package cc.fyre.modsuite.mod.data + +import cc.fyre.modsuite.ModSuite +import org.bukkit.entity.Player + +import org.bukkit.event.player.PlayerInteractEntityEvent +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +abstract class ModItem { + + abstract fun slot(player: Player):Int + abstract fun create(player: Player):ItemStack + abstract fun onInteract(event: PlayerInteractEvent) + + open fun allowed(player: Player):Boolean = true + open fun onInteractEntity(event: PlayerInteractEntityEvent) {} + + fun isSimilar(player: Player,stack: ItemStack?): Boolean { + + if (stack == null) { + return false + } + + val created = this.create(player) + + if (stack.typeId != created.typeId) { + return false + } + + if (stack.hasItemMeta() != created.hasItemMeta()) { + return false + } + + if (!ModSuite.instance.server.itemFactory.equals(stack.itemMeta,created.itemMeta)) { + return false + } + + return true + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/CarpetItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/CarpetItem.kt new file mode 100644 index 0000000..d7e39f7 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/CarpetItem.kt @@ -0,0 +1,29 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.modsuite.mod.data.ModItem +import cc.fyre.proton.util.ItemBuilder +import org.bukkit.DyeColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class CarpetItem : ModItem() { + + override fun slot(player: Player): Int { + return if (player.hasPermission(WorldEditItem.PERMISSION)) 3 else if (player.hasPermission(CompassItem.PERMISSION)) 2 else 0 + } + + override fun create(player: Player): ItemStack { + return ItemBuilder.of(Material.CARPET).name(" ").data(DyeColor.RED.dyeData.toShort()).build() + } + + override fun onInteract(event: PlayerInteractEvent) {} + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/CompassItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/CompassItem.kt new file mode 100644 index 0000000..bbd804f --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/CompassItem.kt @@ -0,0 +1,39 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.proton.util.ItemBuilder +import cc.fyre.modsuite.mod.data.ModItem +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class CompassItem : ModItem() { + + override fun slot(player: Player): Int { + return 0 + } + + override fun create(player: Player): ItemStack { + return ItemBuilder.of(Material.COMPASS).name("${ChatColor.AQUA}Compass").build() + } + + override fun allowed(player: Player): Boolean { + return player.hasPermission(PERMISSION) + } + + override fun onInteract(event: PlayerInteractEvent) {} + + companion object { + + const val PERMISSION = "worldedit.navigation.thru.tool" + + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/InspectItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/InspectItem.kt new file mode 100644 index 0000000..f79021e --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/InspectItem.kt @@ -0,0 +1,51 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.proton.util.ItemBuilder +import cc.fyre.modsuite.mod.data.ModItem +import cc.fyre.modsuite.mod.menu.invsee.InventoryMenu +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEntityEvent +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class InspectItem : ModItem() { + + override fun slot(player: Player): Int { + return 1 + } + + override fun create(player: Player): ItemStack { + return ItemBuilder.of(Material.BOOK).name("${ChatColor.AQUA}Inspection Book").build() + } + + override fun allowed(player: Player): Boolean { + return player.hasPermission(PERMISSION) + } + + override fun onInteract(event: PlayerInteractEvent) {} + + override fun onInteractEntity(event: PlayerInteractEntityEvent) { + + if (event.rightClicked !is Player) { + return + } + InventoryMenu(event.rightClicked as Player).openMenu(event.player) + //TODO: Own Menu! + // event.player.openInventory((event.rightClicked as Player).inventory) + } + + companion object { + + const val PERMISSION = "command.invsee" + + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/OnlineStaffItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/OnlineStaffItem.kt new file mode 100644 index 0000000..c3e4b5f --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/OnlineStaffItem.kt @@ -0,0 +1,38 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.proton.util.ItemBuilder +import cc.fyre.modsuite.mod.data.ModItem +import cc.fyre.modsuite.mod.menu.staff.OnlineStaffMenu +import cc.fyre.modsuite.vanish.command.VanishCommand +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class OnlineStaffItem : ModItem() { + + override fun slot(player: Player): Int { + return if (player.hasPermission(VanishCommand.PERMISSION)) 7 else 8 + } + + override fun create(player: Player): ItemStack { + return ItemBuilder.of(Material.SKULL_ITEM).name("${ChatColor.AQUA}Online Staff").data(3).build() + } + + override fun allowed(player: Player): Boolean { + return Venom.instance.api.grantHandler.findBestRank(player.uniqueId).isStaff() + } + + override fun onInteract(event: PlayerInteractEvent) { + OnlineStaffMenu().openMenu(event.player) + } + +} diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/RandomTPItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/RandomTPItem.kt new file mode 100644 index 0000000..6e14cdd --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/RandomTPItem.kt @@ -0,0 +1,31 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.modsuite.mod.data.ModItem +import cc.fyre.proton.util.ItemBuilder +import cc.fyre.modsuite.vanish.command.VanishCommand +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ + +class RandomTPItem : ModItem() { + + override fun slot(player: Player): Int { + return if (player.hasPermission(VanishCommand.PERMISSION)) 7 else 8 + } + + override fun create(player: Player): ItemStack { + return ItemBuilder.of(Material.DIAMOND).name("${ChatColor.AQUA}Random TP").build() + } + + override fun onInteract(event: PlayerInteractEvent) {} + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/VanishItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/VanishItem.kt new file mode 100644 index 0000000..b84f9d8 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/VanishItem.kt @@ -0,0 +1,41 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.proton.util.ItemBuilder +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.mod.data.ModItem +import cc.fyre.modsuite.vanish.command.VanishCommand +import org.bukkit.ChatColor +import org.bukkit.DyeColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class VanishItem : ModItem(){ + + override fun slot(player: Player): Int { + return 8 + } + + override fun create(player: Player): ItemStack { + + val vanished = ModSuite.instance.vanishHandler.isInVanish(player.uniqueId) + + return ItemBuilder.of(Material.INK_SACK).name("${ChatColor.AQUA}Become ${if (vanished) "Visible" else "Invisible"}").data((if (vanished) DyeColor.GRAY else DyeColor.LIME).dyeData.toShort()).build() + } + + override fun onInteract(event: PlayerInteractEvent) { + ModSuite.instance.vanishHandler.setVanished(event.player,!ModSuite.instance.vanishHandler.isInVanish(event.player.uniqueId),false) + } + + override fun allowed(player: Player): Boolean { + return player.hasPermission(VanishCommand.PERMISSION) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/WorldEditItem.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/WorldEditItem.kt new file mode 100644 index 0000000..0479223 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/data/item/WorldEditItem.kt @@ -0,0 +1,38 @@ +package cc.fyre.modsuite.mod.data.item + +import cc.fyre.proton.util.ItemBuilder +import cc.fyre.modsuite.mod.data.ModItem +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class WorldEditItem : ModItem() { + + override fun slot(player: Player): Int { + return 2 + } + + override fun create(player: Player): ItemStack { + return ItemBuilder.of(Material.WOOD_AXE).name("${ChatColor.AQUA}WorldEdit Wand").build() + } + + override fun onInteract(event: PlayerInteractEvent) {} + + override fun allowed(player: Player): Boolean { + return player.hasPermission(PERMISSION) + } + + companion object { + + const val PERMISSION = "worldedit.wand" + + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/event/ModModeEnterEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/event/ModModeEnterEvent.kt new file mode 100644 index 0000000..2882664 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/event/ModModeEnterEvent.kt @@ -0,0 +1,24 @@ +package cc.fyre.modsuite.mod.event + +import org.bukkit.entity.Player +import org.bukkit.event.Cancellable +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ModModeEnterEvent(val player: Player) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/event/ModModeLeaveEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/event/ModModeLeaveEvent.kt new file mode 100644 index 0000000..d99e292 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/event/ModModeLeaveEvent.kt @@ -0,0 +1,23 @@ +package cc.fyre.modsuite.mod.event + +import org.bukkit.entity.Player +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ModModeLeaveEvent(val player: Player) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/listener/ModModeListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/listener/ModModeListener.kt new file mode 100644 index 0000000..c05e9a7 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/listener/ModModeListener.kt @@ -0,0 +1,316 @@ +package cc.fyre.modsuite.mod.listener + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.mod.command.ModModeCommand +import cc.fyre.modsuite.mod.data.item.WorldEditItem +import cc.fyre.modsuite.mod.event.ModModeEnterEvent +import cc.fyre.modsuite.mod.event.ModModeLeaveEvent +import cc.fyre.venom.Venom +import cc.fyre.venom.permission.event.PermissionUpdateEvent +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent +import org.bukkit.event.block.BlockPlaceEvent +import org.bukkit.event.entity.* +import org.bukkit.event.hanging.HangingBreakByEntityEvent + +import org.bukkit.event.player.* +import org.bukkit.event.vehicle.VehicleDestroyEvent +import org.bukkit.event.vehicle.VehicleEntityCollisionEvent +import java.util.concurrent.ThreadLocalRandom +import java.util.stream.Collectors + + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ModModeListener(private val instance: ModSuite) : Listener { + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerJoin(event: PlayerJoinEvent) { + + if (!event.player.hasPermission(ModModeCommand.PERMISSION)) { + return + } + + this.instance.modModeHandler.setModMode(event.player,true) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + this.instance.modModeHandler.setModMode(event.player,false) + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPermissionUpdate(event: PermissionUpdateEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + this.instance.modModeHandler.updateItems(event.player) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteractEntity(event: PlayerInteractEntityEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + // disable for now, staff are a bunch of fucking annoying niggers especially fucking POQUU + /*if (event.player.itemInHand == null || event.player.itemInHand.type == Material.AIR) { + event.rightClicked.passenger = event.player + return + }*/ + + val optionalModItem = this.instance.modModeHandler.findItemByItemStack(event.player.itemInHand,event.player) + + if (!optionalModItem.isPresent) { + return + } + + optionalModItem.get().onInteractEntity(event) + + if (optionalModItem.get() is WorldEditItem) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (!event.action.name.contains("RIGHT",true)) { + return + } + + if (event.item == null) { + return + } + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + if (event.clickedBlock != null && !event.clickedBlock.type.isBlock) { + event.isCancelled = true + } + + if (event.item.type == Material.DIAMOND) { + + val players = this.instance.server.onlinePlayers.filter{!Venom.instance.api.grantHandler.findBestRank(it.uniqueId).isStaff()}.shuffled() + + if (players.isEmpty()) { + return + } + + event.player.teleport(players.random()) + return + } + + val optionalModItem = this.instance.modModeHandler.findItemByItemStack(event.item,event.player) + + if (!optionalModItem.isPresent) { + return + } + + optionalModItem.get().onInteract(event) + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockBreak(event: BlockBreakEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + event.player.sendMessage("${ChatColor.RED}${ChatColor.BOLD}You cannot break blocks whilst in mod mode!") + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onBlockPlace(event: BlockPlaceEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + event.player.sendMessage("${ChatColor.RED}${ChatColor.BOLD}You cannot place blocks whilst in mod mode!") + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamage(event: EntityDamageEvent) { + + if (event.entity !is Player) { + return + } + + if (!this.instance.modModeHandler.isInModMode(event.entity.uniqueId)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + + if (event.damager !is Player) { + return + } + + if (!this.instance.modModeHandler.isInModMode(event.damager.uniqueId)) { + return + } + + (event.damager as Player).sendMessage("${ChatColor.RED}${ChatColor.BOLD}You cannot do this whilst in mod mode!") + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onDropItem(event: PlayerDropItemEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + if (!this.instance.modModeHandler.findItemByItemStack(event.itemDrop.itemStack,event.player).isPresent) { + event.itemDrop.remove() + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPickupItem(event: PlayerPickupItemEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.player.uniqueId)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onFoodLevelChange(event: FoodLevelChangeEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.entity.uniqueId)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onEntityTarget(event: EntityTargetEvent) { + + if (event.target !is Player) { + return + } + + if (!this.instance.modModeHandler.isInModMode(event.target.uniqueId)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onPlayerDeath(event: PlayerDeathEvent) { + + if (!this.instance.modModeHandler.isInModMode(event.entity.uniqueId)) { + return + } + + event.drops.clear() + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onVehicleDestroy(event: VehicleDestroyEvent) { + + if (event.attacker !is Player || !this.instance.modModeHandler.isInModMode(event.attacker.uniqueId)) { + return + } + + (event.attacker as Player).sendMessage("${ChatColor.RED}${ChatColor.BOLD}You cannot destroy vehicles whilst in mod mode!") + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onVehicleEntityCollision(event: VehicleEntityCollisionEvent) { + + if (event.entity !is Player || !this.instance.modModeHandler.isInModMode(event.entity.uniqueId)) { + return + } + + event.isCancelled = true + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onHangingBreak(event: HangingBreakByEntityEvent) { + + if (event.remover !is Player || !this.instance.modModeHandler.isInModMode(event.remover.uniqueId)) { + return + } + + event.isCancelled = true + (event.remover as Player).sendMessage("${ChatColor.RED}${ChatColor.BOLD}You cannot break blocks whilst in mod mode!") + } + + @EventHandler(priority = EventPriority.LOWEST) + private fun onProjectileLaunch(event: ProjectileLaunchEvent) { + + if (event.entity.shooter !is Player) { + return + } + + if (!this.instance.modModeHandler.isInModMode(event.entity.uniqueId)) { + return + } + + event.isCancelled = true + (event.entity.shooter as Player).sendMessage("${ChatColor.RED}${ChatColor.BOLD}You cannot destroy vehicles whilst in mod mode!") + } + + /* + @EventHandler(priority = EventPriority.NORMAL) + private fun onModModeEnter(event: ModModeEnterEvent) { + + val packets = ArrayList() + + for (value in StaffModule.values()) { + packets.add(StaffModStatePacket(value,true)) + } + + packets.forEach{LunarClientAPI.instance.packetHandler.sendPacket(event.player,it)} + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onModModeLeave(event: ModModeLeaveEvent) { + + val packets = ArrayList() + + for (value in StaffModule.values()) { + packets.add(StaffModStatePacket(value,false)) + } + + packets.forEach{LunarClientAPI.instance.packetHandler.sendPacket(event.player,it)} + }*/ + +} diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/listener/ModModeParasiteListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/listener/ModModeParasiteListener.kt new file mode 100644 index 0000000..f3b235a --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/listener/ModModeParasiteListener.kt @@ -0,0 +1,44 @@ +package cc.fyre.modsuite.mod.listener + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.mod.ModModeHandler +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import cc.fyre.venom.Venom +import com.google.gson.JsonObject +import org.bukkit.ChatColor +import java.util.* + +/** + * @project modsuite + * + * @date 22/07/2020 + * @author xanderume@gmail.com + */ +class ModModeParasiteListener(private val instance: ModSuite) : ParasiteListener { + + @Parasite(ModModeHandler.BUNGEE_TELEPORT) + fun onTeleport(data: JsonObject) { + + if (data["server"].asString != Venom.instance.serverHandler.serverID) { + return + } + + val player = this.instance.server.getPlayer(UUID.fromString(data["_id"].asString)) + + if (player == null) { + this.instance.server.logger.info("Tried to teleport ${Venom.instance.api.profileHandler.findName(UUID.fromString(data["_id"].asString))} but is not online?") + return + } + + val target = this.instance.server.getPlayer(UUID.fromString(data["target"].asString)) + + if (target == null) { + player.sendMessage("${ChatColor.RED}The player you tried to teleport to is no longer online!") + return + } + + player.teleport(target) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/invsee/InventoryMenu.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/invsee/InventoryMenu.kt new file mode 100644 index 0000000..24073c4 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/invsee/InventoryMenu.kt @@ -0,0 +1,48 @@ +package cc.fyre.modsuite.mod.menu.invsee + +import cc.fyre.modsuite.mod.menu.invsee.element.ItemElement +import cc.fyre.proton.menu.Button +import cc.fyre.proton.menu.Menu +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 17/05/2020 + * @author xanderume@gmail.com + */ +class InventoryMenu(private val target: Player) : Menu() { + + private val displayName = PlayerUtil.getDisplayName(this.target.uniqueId,this.target.name) + + override fun onOpen(player: Player) { + player.sendMessage("${ChatColor.GOLD}Inspecting ${ChatColor.WHITE}${this.displayName}${ChatColor.GOLD}'s inventory.") + } + + override fun getTitle(player: Player): String { + return this.displayName + } + + override fun getButtons(p0: Player?): MutableMap { + + val toReturn = HashMap() + + for (content in this.target.inventory.contents) { + toReturn[toReturn.size] = ItemElement(content,this.target) + } + + for (content in this.target.inventory.armorContents.reversed().withIndex()) { + toReturn[36 + content.index] = ItemElement(content.value,this.target) + } + + return toReturn + } + + override fun isAutoUpdate(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/invsee/element/ItemElement.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/invsee/element/ItemElement.kt new file mode 100644 index 0000000..99b5afe --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/invsee/element/ItemElement.kt @@ -0,0 +1,57 @@ +package cc.fyre.modsuite.mod.menu.invsee.element + +import cc.fyre.modsuite.mod.command.InvseeCommand +import cc.fyre.proton.menu.Button +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType +import org.bukkit.event.inventory.InventoryAction +import org.bukkit.inventory.ItemStack + +/** + * @project modsuite + * + * @date 17/05/2020 + * @author xanderume@gmail.com + */ +class ItemElement(private val content: ItemStack?,val target: Player) : Button() { + + override fun getName(p0: Player?): String { + return this.content?.itemMeta?.displayName ?: this.content?.type?.name ?: "AIR" + } + + override fun getDescription(p0: Player?): MutableList { + return this.content?.itemMeta?.lore ?: arrayListOf() + } + + override fun getMaterial(p0: Player?): Material { + return this.content?.type ?: Material.AIR + } + + override fun getAmount(player: Player?): Int { + return this.content?.amount ?: 1 + } + + override fun getDamageValue(player: Player?): Byte { + return this.content?.durability?.toByte() ?: 0 + } + + override fun clicked(player: Player,slot: Int,clickType: ClickType?) { + + if (!this.target.isOnline) { + return + } + + if (!this.target.hasPermission("${InvseeCommand.PERMISSION}.advanced")) { + return + } + + if (this.target.uniqueId == player.uniqueId) { + return + } + + this.target.inventory.removeItem(this.content) + + player.inventory.addItem(this.content) + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu.kt new file mode 100644 index 0000000..db5a0ca --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/staff/OnlineStaffMenu.kt @@ -0,0 +1,36 @@ +package cc.fyre.modsuite.mod.menu.staff + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.mod.command.ModModeCommand +import cc.fyre.modsuite.mod.menu.staff.element.OnlineStaffButton +import cc.fyre.proton.menu.Button +import cc.fyre.proton.menu.pagination.PaginatedMenu +import cc.fyre.venom.Venom +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class OnlineStaffMenu : PaginatedMenu() { + + override fun getPrePaginatedTitle(p0: Player?): String { + return "Online Staff" + } + + override fun getAllPagesButtons(player: Player): MutableMap { + return ModSuite.instance.server.onlinePlayers + .sortedBy{Venom.instance.api.grantHandler.findBestRank(it.uniqueId).priority} + .filter{it.uniqueId != player.uniqueId && !it.isOp && it.hasPermission(ModModeCommand.PERMISSION)} + .withIndex() + .associate{it.index to OnlineStaffButton(it.value)} + .toMutableMap() + } + + override fun isAutoUpdate(): Boolean { + return true + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/staff/element/OnlineStaffButton.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/staff/element/OnlineStaffButton.kt new file mode 100644 index 0000000..1207134 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/mod/menu/staff/element/OnlineStaffButton.kt @@ -0,0 +1,61 @@ +package cc.fyre.modsuite.mod.menu.staff.element + +import cc.fyre.modsuite.ModSuite +import cc.fyre.proton.menu.Button + +import cc.fyre.venom.util.PlayerUtil +import org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.event.inventory.ClickType + + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class OnlineStaffButton(private val player: Player) : Button() { + + override fun clicked(player: Player,slot: Int,clickType: ClickType) { + + if (!player.hasPermission("command.teleport")) { + return + } + + player.teleport(this.player) + } + + override fun getName(p0: Player?): String { + return PlayerUtil.getDisplayName(this.player.uniqueId,this.player.name) + } + + override fun getDescription(p0: Player?): MutableList { + + val toReturn = ArrayList() + + toReturn.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + toReturn.add("${ChatColor.YELLOW}Vanish: ${ChatColor.RED}${if (ModSuite.instance.vanishHandler.isInVanish(this.player.uniqueId)) "Yes" else "No"}") + toReturn.add("${ChatColor.YELLOW}Mod Mode: ${ChatColor.RED}${if (ModSuite.instance.modModeHandler.isInModMode(this.player.uniqueId)) "Yes" else "No"}") + + if (player.hasPermission("command.teleport")) { + toReturn.add(" ") + toReturn.add("${ChatColor.RED}${ChatColor.BOLD}Click to teleport") + } + + toReturn.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return toReturn + } + + override fun getMaterial(p0: Player?): Material { + return Material.SKULL_ITEM + } + + override fun getDamageValue(player: Player?): Byte { + return 3 + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/ReportHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/ReportHandler.kt new file mode 100644 index 0000000..805247c --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/ReportHandler.kt @@ -0,0 +1,111 @@ +package cc.fyre.modsuite.report + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.command.ReportCommand + +import cc.fyre.modsuite.report.command.ReportsCommand +import cc.fyre.modsuite.report.data.Report +import cc.fyre.modsuite.report.parasite.ReportParasiteListener +import cc.fyre.proton.Proton + +import cc.fyre.symbiote.Symbiote +import cc.fyre.venom.VenomAPI +import cc.fyre.venom.database.DatabaseHandler +import cc.fyre.venom.database.jedis.RedisCommand +import com.mongodb.client.model.Filters +import com.mongodb.client.result.UpdateResult +import org.bson.Document +import org.bukkit.ChatColor +import redis.clients.jedis.Jedis +import java.util.* + +import java.util.concurrent.TimeUnit +import kotlin.collections.HashMap + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ReportHandler(private val instance: ModSuite) { + + var enabled = true + + private val cooldowns = HashMap() + private val collection = this.instance.databaseHandler.mongoDB.getCollection("reports") + + init { + this.enabled = VenomAPI.instance.databaseHandler.runRedisCommand(object : RedisCommand { + + override fun execute(jedis: Jedis): Boolean { + return jedis[ENABLED_KEY]?.toBoolean() ?: true + } + + })!! + + Proton.getInstance().commandHandler.registerClass(ReportCommand::class.java) + Proton.getInstance().commandHandler.registerClass(ReportsCommand::class.java) + + this.instance.databaseHandler.symbiote.addListener(ReportParasiteListener(this.instance)) + } + + fun findCount(uuid: UUID):Int { + return this.collection.countDocuments(Filters.eq("target",uuid.toString())).toInt() + } + + fun findBySender(sender: UUID):MutableSet { + return this.collection.find(Filters.eq("sender",sender.toString())).map{this.instance.gson.fromJson(it.toJson(),Report::class.java)}.toMutableSet() + } + + fun findByTarget(target: UUID):MutableSet { + return this.collection.find(Filters.eq("target",target.toString())).map{this.instance.gson.fromJson(it.toJson(),Report::class.java)}.toMutableSet() + } + + fun addCooldown(uuid: UUID) { + this.cooldowns[uuid] = System.currentTimeMillis() + } + + fun isOnCooldown(uuid: UUID):Boolean { + return this.cooldowns.containsKey(uuid) && ((this.cooldowns[uuid]!! + COOLDOWN) - System.currentTimeMillis()) > 0 + } + + fun findCooldown(uuid: UUID):Long { + return if (!this.cooldowns.containsKey(uuid)) 0L else (this.cooldowns[uuid]!! + COOLDOWN) - System.currentTimeMillis() + } + + fun report(report: Report,sender: UUID,senderDisplay: String,target: String,targetDisplay: String,amount: Int):UpdateResult { + + val toReturn = this.collection.updateOne(Document("_id",report.id.toString()),Document("\$set",Document.parse(this.instance.gson.toJson(report))), DatabaseHandler.UPDATE_OPTIONS) + + if (toReturn.wasAcknowledged()) { + + val jsonObject = ModSuite.instance.gson.toJsonTree(report).asJsonObject + + jsonObject.addProperty("amount",amount) + jsonObject.addProperty("sender",ChatColor.stripColor(senderDisplay)) + jsonObject.addProperty("target",target) + jsonObject.addProperty("senderUUID",sender.toString()) + jsonObject.addProperty("senderDisplay",senderDisplay) + jsonObject.addProperty("targetDisplay",targetDisplay) + + this.instance.databaseHandler.symbiote.sendPacket( + + Symbiote(REPORT_PACKET,jsonObject)) + } + + return toReturn + } + + companion object { + + val COOLDOWN = TimeUnit.MINUTES.toMillis(2L) + + const val ENABLED_KEY = "modsuite:reports" + const val VIEW_PERMISSION = "reports.view" + + const val REPORT_PACKET = "REPORT_PACKET" + const val REPORT_VALUE_PACKET = "REPORT_VALUE_PACKET" + + } +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/command/ReportCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/command/ReportCommand.kt new file mode 100644 index 0000000..e19b223 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/command/ReportCommand.kt @@ -0,0 +1,68 @@ +package cc.fyre.modsuite.report.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.data.Report + +import cc.fyre.modsuite.report.event.PlayerReportEvent +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter + +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import cc.fyre.venom.util.TimeUtil +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project modsuite + * + * @date 14/04/2020 + * @author xanderume@gmail.com + */ +object ReportCommand { + + @JvmStatic + @Command(names = ["report"],async = true,hidden = false,permission = "",description = "Report a user!") + fun execute(sender: Player,@Parameter(name = "player")target: Player,@Parameter(name = "reason",wildcard = true)reason: String) { + + if (sender.uniqueId == target.uniqueId) { + sender.sendMessage("${ChatColor.RED}You cannot report yourself.") + return + } + + if (!ModSuite.instance.reportHandler.enabled) { + sender.sendMessage("${ChatColor.RED}Reports are currently disabled.") + return + } + + val cooldown = ModSuite.instance.reportHandler.findCooldown(sender.uniqueId) + + if (cooldown > 0L) { + sender.sendMessage("${ChatColor.RED}You can report again in ${ChatColor.BOLD}${TimeUtil.formatIntoDetailedString(cooldown)}${ChatColor.RED}.") + return + } + + val event = PlayerReportEvent(sender,target,reason) + + ModSuite.instance.server.pluginManager.callEvent(event) + + if (event.isCancelled) { + return + } + + val amount = ModSuite.instance.reportHandler.findCount(target.uniqueId) + 1 + val senderDisplay = PlayerUtil.getDisplayName(sender.uniqueId,sender.name) + val targetDisplay = PlayerUtil.getDisplayName(target.uniqueId,target.name) + + if (!ModSuite.instance.reportHandler.report(Report(UUID.randomUUID(),sender.uniqueId,target.uniqueId,reason,Venom.instance.serverHandler.serverID),sender.uniqueId,senderDisplay,target.name,targetDisplay,amount).wasAcknowledged()) { + sender.sendMessage("${ChatColor.RED}There was an issue submitting your report..") + return + } + + ModSuite.instance.reportHandler.addCooldown(sender.uniqueId) + + sender.sendMessage("${ChatColor.GREEN}We have received your report.") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/command/ReportsCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/command/ReportsCommand.kt new file mode 100644 index 0000000..02e9722 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/command/ReportsCommand.kt @@ -0,0 +1,35 @@ +package cc.fyre.modsuite.report.command +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.report.menu.ReportsMenu +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter + +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@nogmail.com + */ +object ReportsCommand { + + @JvmStatic + @Command(names = ["reports"],async = true,hidden = true,permission = ReportHandler.VIEW_PERMISSION,description = "View a user's reports!") + fun execute(sender: Player,@Parameter(name = "player")uuid: UUID) { + + val reports = ModSuite.instance.reportHandler.findByTarget(uuid) + + if (reports.isEmpty()) { + sender.sendMessage("${PlayerUtil.getDisplayName(uuid)}${ChatColor.RED} has not been reported.") + return + } + + ReportsMenu(reports).openMenu(sender) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/data/Report.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/data/Report.kt new file mode 100644 index 0000000..7792c1e --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/data/Report.kt @@ -0,0 +1,16 @@ +package cc.fyre.modsuite.report.data + +import com.google.gson.annotations.SerializedName +import java.util.* + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class Report(@SerializedName("_id")val id: UUID, val sender: UUID, val target: UUID, val reason: String, val server: String) { + + val created = System.currentTimeMillis() + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/event/PlayerReportEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/event/PlayerReportEvent.kt new file mode 100644 index 0000000..93e6914 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/event/PlayerReportEvent.kt @@ -0,0 +1,35 @@ +package cc.fyre.modsuite.report.event + +import org.bukkit.entity.Player +import org.bukkit.event.Cancellable +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class PlayerReportEvent(val sender: Player,val target: Player,val reason: String) : Event(),Cancellable { + + private var cancelled = false + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + + + override fun isCancelled(): Boolean { + return this.cancelled + } + + override fun setCancelled(cancelled: Boolean) { + this.cancelled = cancelled + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/menu/ReportsMenu.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/menu/ReportsMenu.kt new file mode 100644 index 0000000..0695455 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/menu/ReportsMenu.kt @@ -0,0 +1,26 @@ +package cc.fyre.modsuite.report.menu + +import cc.fyre.modsuite.report.data.Report + +import cc.fyre.modsuite.report.menu.element.ReportButton +import cc.fyre.proton.menu.Button +import cc.fyre.proton.menu.pagination.PaginatedMenu +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ReportsMenu(private val reports: MutableSet) : PaginatedMenu() { + + override fun getPrePaginatedTitle(p0: Player?): String { + return "Reports" + } + + override fun getAllPagesButtons(p0: Player?): MutableMap { + return this.reports.sortedByDescending{it.created}.withIndex().associate{it.index to ReportButton(it.value)}.toMutableMap() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/menu/element/ReportButton.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/menu/element/ReportButton.kt new file mode 100644 index 0000000..cd334dd --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/menu/element/ReportButton.kt @@ -0,0 +1,44 @@ +package cc.fyre.modsuite.report.menu.element + +import cc.fyre.modsuite.report.data.Report +import cc.fyre.proton.menu.Button + +import cc.fyre.venom.Venom +import cc.fyre.venom.util.TimeUtil +import org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import java.util.* +import kotlin.collections.ArrayList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ReportButton(private val report: Report) : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.GOLD}${TimeUtil.formatIntoCalendarString(Date(this.report.created))}" + } + + override fun getDescription(p0: Player?): MutableList { + + val lore = ArrayList() + + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + lore.add("${ChatColor.YELLOW}By: ${ChatColor.RED}${Venom.instance.api.profileHandler.findName(this.report.sender)}") + lore.add("${ChatColor.YELLOW}Server: ${ChatColor.RED}${this.report.server}") + lore.add("${ChatColor.YELLOW}Reason: ${ChatColor.RED}${this.report.reason}") + lore.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return lore + } + + override fun getMaterial(p0: Player?): Material { + return Material.PAPER + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/parasite/ReportParasiteListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/parasite/ReportParasiteListener.kt new file mode 100644 index 0000000..a3786be --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/report/parasite/ReportParasiteListener.kt @@ -0,0 +1,75 @@ +package cc.fyre.modsuite.report.parasite + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.command.ModSuiteReportCommand +import cc.fyre.modsuite.command.ModSuiteRequestCommand +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.request.RequestHandler +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import cc.fyre.venom.Venom +import cc.fyre.venom.profile.data.Profile +import com.google.gson.JsonObject +import mkremins.fanciful.FancyMessage +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.* + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class ReportParasiteListener(private val instance: ModSuite) : ParasiteListener { + + @Parasite(ReportHandler.REPORT_VALUE_PACKET) + fun onReportValue(data: JsonObject) { + this.instance.reportHandler.enabled = data["value"].asBoolean + + object : BukkitRunnable() { + + override fun run() { + this@ReportParasiteListener.instance.server.onlinePlayers.filter{it.hasPermission(ModSuiteReportCommand.PERMISSION)}.forEach{it.sendMessage( + "${ChatColor.RED}[${ChatColor.YELLOW}!${ChatColor.RED}] ${data["displayName"].asString}${ChatColor.RED} has ${if (data["value"].asBoolean) "${ChatColor.GREEN}enabled" else "${ChatColor.RED}disabled"} ${ChatColor.RED}reports." + )} + } + + }.runTask(this.instance) + } + + + @Parasite(ReportHandler.REPORT_PACKET) + fun onReport(data: JsonObject) { + + val server = data["server"].asString + + val message = FancyMessage("${ChatColor.BLUE}[Report]${ChatColor.AQUA}[") + + message.then("${ChatColor.AQUA}${server}").tooltip("${ChatColor.GREEN}Click to join ${ChatColor.WHITE}$server${ChatColor.GREEN}!").command("/server $server") + message.then("${ChatColor.AQUA}] ") + + val senderDisplay = data["senderDisplay"].asString + val targetDisplay = data["targetDisplay"].asString + + message.then(senderDisplay).tooltip("${ChatColor.GREEN}Click to teleport to $senderDisplay${ChatColor.GREEN}!").command("/bungeetp ${data["sender"].asString}") + message.then("${ChatColor.GRAY} has reported ") + message.then(targetDisplay).tooltip("${ChatColor.GREEN}Click to teleport to $targetDisplay${ChatColor.GREEN}!").command("/bungeetp ${data["target"].asString}") + message.then(" ") + message.then("${ChatColor.AQUA}(${data["amount"].asInt})").tooltip("${ChatColor.GREEN}Click to view $targetDisplay${ChatColor.GREEN}'s reports!").command("/reports ${data["target"].asString}") + message.then("${ChatColor.GRAY}: ${ChatColor.WHITE}${data["reason"].asString}") + + message.send(this.instance.server.consoleSender) + + object : BukkitRunnable() { + + override fun run() { + this@ReportParasiteListener.instance.server.onlinePlayers.filter{it.hasPermission(ReportHandler.VIEW_PERMISSION)}.forEach{message.send(it)} + } + + }.runTask(this.instance) + + this.instance.reportHandler.addCooldown(UUID.fromString(data["senderUUID"].asString)) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/RequestHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/RequestHandler.kt new file mode 100644 index 0000000..e1f7ca7 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/RequestHandler.kt @@ -0,0 +1,102 @@ +package cc.fyre.modsuite.request + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.ReportHandler + +import cc.fyre.modsuite.request.command.RequestCommand +import cc.fyre.modsuite.request.command.RequestsCommand +import cc.fyre.modsuite.request.data.Request +import cc.fyre.modsuite.request.parasite.RequestParasiteListener +import cc.fyre.proton.Proton +import cc.fyre.symbiote.Symbiote +import cc.fyre.venom.VenomAPI +import cc.fyre.venom.database.DatabaseHandler +import cc.fyre.venom.database.jedis.RedisCommand +import com.mongodb.client.model.Filters +import com.mongodb.client.result.UpdateResult +import org.bson.Document +import org.bukkit.ChatColor +import redis.clients.jedis.Jedis +import java.util.* + +import java.util.concurrent.TimeUnit +import kotlin.collections.HashMap + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class RequestHandler(private val instance: ModSuite) { + + var enabled = true + + private val cooldowns = HashMap() + private val collection = this.instance.databaseHandler.mongoDB.getCollection("requests") + + init { + this.enabled = VenomAPI.instance.databaseHandler.runRedisCommand(object : RedisCommand { + + override fun execute(jedis: Jedis): Boolean { + return jedis[ENABLED_KEY]?.toBoolean() ?: true + } + + })!! + + Proton.getInstance().commandHandler.registerClass(RequestCommand::class.java) + Proton.getInstance().commandHandler.registerClass(RequestsCommand::class.java) + + this.instance.databaseHandler.symbiote.addListener(RequestParasiteListener(this.instance)) + } + + fun findBySender(sender: UUID):MutableSet { + return this.collection.find(Filters.eq("sender",sender.toString())).map{this.instance.gson.fromJson(it.toJson(),Request::class.java)}.toMutableSet() + } + + fun addCooldown(uuid: UUID) { + this.cooldowns[uuid] = System.currentTimeMillis() + } + + fun isOnCooldown(uuid: UUID):Boolean { + return this.cooldowns.containsKey(uuid) && ((this.cooldowns[uuid]!! + COOLDOWN) - System.currentTimeMillis()) > 0 + } + + fun findCooldown(uuid: UUID):Long { + return if (!this.cooldowns.containsKey(uuid)) 0L else (this.cooldowns[uuid]!! + COOLDOWN) - System.currentTimeMillis() + } + + fun request(request: Request,sender: UUID,senderDisplay: String):UpdateResult { + + val toReturn = this.collection.updateOne(Document("_id",request.id.toString()),Document("\$set",Document.parse(this.instance.gson.toJson(request))),DatabaseHandler.UPDATE_OPTIONS) + + if (toReturn.wasAcknowledged()) { + + val jsonObject = ModSuite.instance.gson.toJsonTree(request).asJsonObject + + jsonObject.addProperty("sender",ChatColor.stripColor(senderDisplay)) + jsonObject.addProperty("senderUUID",sender.toString()) + jsonObject.addProperty("senderDisplay",senderDisplay) + + this.instance.databaseHandler.symbiote.sendPacket(Symbiote(REQUEST_PACKET,jsonObject)) + } + + return toReturn + } + + fun isEnabled():Boolean { + return this.enabled + } + + companion object { + + val COOLDOWN = TimeUnit.MINUTES.toMillis(2L) + + const val ENABLED_KEY = "modsuite:requests" + const val VIEW_PERMISSION = "request.view" + + const val REQUEST_PACKET = "REQUEST_PACKET" + const val REQUEST_VALUE_PACKET = "REQUEST_VALUE_PACKET" + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/command/RequestCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/command/RequestCommand.kt new file mode 100644 index 0000000..5e16d65 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/command/RequestCommand.kt @@ -0,0 +1,62 @@ +package cc.fyre.modsuite.request.command + +import cc.fyre.modsuite.ModSuite + +import cc.fyre.modsuite.request.data.Request +import cc.fyre.modsuite.request.event.PlayerRequestEvent +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import cc.fyre.venom.util.TimeUtil +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project modsuite + * + * @date 14/04/2020 + * @author xanderume@gmail.com + */ +object RequestCommand { + + @JvmStatic + @Command(names = ["request","helpop"],async = true,hidden = false,permission = "",description = "Request assistance!") + fun execute(sender: Player,@Parameter(name = "reason",wildcard = true)reason: String) { + + if (!ModSuite.instance.requestHandler.enabled) { + sender.sendMessage("${ChatColor.RED}Requests are currently disabled.") + return + } + + val cooldown = ModSuite.instance.requestHandler.findCooldown(sender.uniqueId) + + if (cooldown > 0L) { + sender.sendMessage("${ChatColor.RED}You can request again in ${ChatColor.BOLD}${TimeUtil.formatIntoDetailedString(cooldown)}${ChatColor.RED}.") + return + } + + val event = PlayerRequestEvent(sender,reason) + + ModSuite.instance.server.pluginManager.callEvent(event) + + if (event.isCancelled) { + return + } + + + val senderDisplay = PlayerUtil.getDisplayName(sender.uniqueId,sender.name) + + if (!ModSuite.instance.requestHandler.request(Request(UUID.randomUUID(),sender.uniqueId,reason,Venom.instance.serverHandler.serverID),sender.uniqueId,senderDisplay).wasAcknowledged()) { + sender.sendMessage("${ChatColor.RED}There was an issue submitting your request..") + return + } + + ModSuite.instance.requestHandler.addCooldown(sender.uniqueId) + + sender.sendMessage("${ChatColor.GREEN}We have received your request.") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/command/RequestsCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/command/RequestsCommand.kt new file mode 100644 index 0000000..4a9654b --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/command/RequestsCommand.kt @@ -0,0 +1,42 @@ +package cc.fyre.modsuite.request.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.request.menu.RequestsMenu +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.Bukkit +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* + +/** + * @project modsuite + * + * @date 07/05/2020 + * @author xanderume@gmail.com + */ +object RequestsCommand { + + @JvmStatic + @Command(names = ["requests"],async = true,permission = ReportHandler.VIEW_PERMISSION,description = "View a user's requests!") + fun execute(sender: Player,@Parameter(name = "player")uuid: UUID) { + + Bukkit.getServer().scheduler.runTaskAsynchronously(Venom.instance) { + + val requests = ModSuite.instance.requestHandler.findBySender(uuid) + + if (requests.isEmpty()) { + sender.sendMessage("${PlayerUtil.getDisplayName(uuid)}${ChatColor.RED} has never requested assistance.") + return@runTaskAsynchronously + } + + RequestsMenu(requests).openMenu(sender) + } + + } + + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/data/Request.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/data/Request.kt new file mode 100644 index 0000000..49a8286 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/data/Request.kt @@ -0,0 +1,16 @@ +package cc.fyre.modsuite.request.data + +import com.google.gson.annotations.SerializedName +import java.util.* + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class Request(@SerializedName("_id")val id: UUID, val sender: UUID, val reason: String, val server: String) { + + val created = System.currentTimeMillis() + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/event/PlayerRequestEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/event/PlayerRequestEvent.kt new file mode 100644 index 0000000..1a1f937 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/event/PlayerRequestEvent.kt @@ -0,0 +1,35 @@ +package cc.fyre.modsuite.request.event + +import org.bukkit.entity.Player +import org.bukkit.event.Cancellable +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class PlayerRequestEvent(val sender: Player,val reason: String) : Event(),Cancellable { + + private var cancelled = false + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + + + override fun isCancelled(): Boolean { + return this.cancelled + } + + override fun setCancelled(cancelled: Boolean) { + this.cancelled = cancelled + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/menu/RequestsMenu.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/menu/RequestsMenu.kt new file mode 100644 index 0000000..3511339 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/menu/RequestsMenu.kt @@ -0,0 +1,25 @@ +package cc.fyre.modsuite.request.menu + +import cc.fyre.modsuite.request.data.Request +import cc.fyre.modsuite.request.menu.element.RequestButton +import cc.fyre.proton.menu.Button +import cc.fyre.proton.menu.pagination.PaginatedMenu +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class RequestsMenu(private val requests: MutableSet) : PaginatedMenu() { + + override fun getPrePaginatedTitle(p0: Player?): String { + return "Requests" + } + + override fun getAllPagesButtons(p0: Player?): MutableMap { + return this.requests.sortedByDescending{it.created}.withIndex().associate{it.index to RequestButton(it.value)}.toMutableMap() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/menu/element/RequestButton.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/menu/element/RequestButton.kt new file mode 100644 index 0000000..5c0d10d --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/menu/element/RequestButton.kt @@ -0,0 +1,43 @@ +package cc.fyre.modsuite.request.menu.element + +import cc.fyre.modsuite.request.data.Request +import cc.fyre.proton.menu.Button +import cc.fyre.proton.util.ItemBuilder + +import cc.fyre.venom.Venom +import cc.fyre.venom.util.TimeUtil +import org.apache.commons.lang3.StringUtils +import org.bukkit.ChatColor +import org.bukkit.Material +import org.bukkit.entity.Player +import java.util.* + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class RequestButton(private val request: Request) : Button() { + + override fun getName(p0: Player?): String { + return "${ChatColor.GOLD}${TimeUtil.formatIntoCalendarString(Date(this.request.created))}" + } + + override fun getDescription(p0: Player?): MutableList { + + val toReturn = arrayListOf() + + toReturn.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + toReturn.add("${ChatColor.YELLOW}Server: ${ChatColor.RED}${this.request.server}") + toReturn.add("${ChatColor.YELLOW}Reason: ${ChatColor.RED}${this.request.reason}") + toReturn.add("${ChatColor.GRAY}${ChatColor.STRIKETHROUGH}${StringUtils.repeat("-",18)}") + + return toReturn + } + + override fun getMaterial(p0: Player?): Material { + return Material.PAPER + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/parasite/RequestParasiteListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/parasite/RequestParasiteListener.kt new file mode 100644 index 0000000..01a324f --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/request/parasite/RequestParasiteListener.kt @@ -0,0 +1,68 @@ +package cc.fyre.modsuite.request.parasite + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.command.ModSuiteRequestCommand +import cc.fyre.modsuite.report.ReportHandler +import cc.fyre.modsuite.request.RequestHandler +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import cc.fyre.venom.Venom +import cc.fyre.venom.profile.data.Profile +import com.google.gson.JsonObject +import mkremins.fanciful.FancyMessage +import org.bukkit.ChatColor +import org.bukkit.scheduler.BukkitRunnable +import java.util.* + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class RequestParasiteListener(private val instance: ModSuite) : ParasiteListener { + + @Parasite(RequestHandler.REQUEST_VALUE_PACKET) + fun onRequestValue(data: JsonObject) { + this.instance.requestHandler.enabled = data["value"].asBoolean + + object : BukkitRunnable() { + + override fun run() { + this@RequestParasiteListener.instance.server.onlinePlayers.filter{it.hasPermission(ModSuiteRequestCommand.PERMISSION)}.forEach{it.sendMessage( + "${ChatColor.RED}[${ChatColor.YELLOW}!${ChatColor.RED}] ${data["displayName"].asString}${ChatColor.RED} has ${if (data["value"].asBoolean) "${ChatColor.GREEN}enabled" else "${ChatColor.RED}disabled"} ${ChatColor.RED}requests." + )} + } + + }.runTask(this.instance) + } + + @Parasite(RequestHandler.REQUEST_PACKET) + fun onRequest(data: JsonObject) { + + val server = data["server"].asString + + val message = FancyMessage("${ChatColor.BLUE}[Request]${ChatColor.AQUA}[") + + message.then("${ChatColor.AQUA}${server}").tooltip("${ChatColor.GREEN}Click to join ${ChatColor.WHITE}$server${ChatColor.GREEN}!").command("/server $server") + message.then("${ChatColor.AQUA}] ") + + val senderDisplay = data["senderDisplay"].asString + + message.then(senderDisplay).tooltip("${ChatColor.GREEN}Click to teleport to $senderDisplay${ChatColor.GREEN}!").command("/bungeetp ${data["sender"].asString}") + message.then("${ChatColor.GRAY} has requested assistance: ${ChatColor.WHITE}${data["reason"].asString}") + + message.send(this.instance.server.consoleSender) + + object : BukkitRunnable() { + + override fun run() { + this@RequestParasiteListener.instance.server.onlinePlayers.filter{it.hasPermission(RequestHandler.VIEW_PERMISSION)}.forEach{message.send(it)} + } + + }.runTask(this.instance) + + this.instance.requestHandler.addCooldown(UUID.fromString(data["senderUUID"].asString)) + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/VanishHandler.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/VanishHandler.kt new file mode 100644 index 0000000..a880bd2 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/VanishHandler.kt @@ -0,0 +1,93 @@ +package cc.fyre.modsuite.vanish + +import cc.fyre.modsuite.ModSuite + +import cc.fyre.modsuite.vanish.command.VanishCommand +import cc.fyre.modsuite.vanish.event.VanishEnterEvent +import cc.fyre.modsuite.vanish.event.VanishLeaveEvent +import cc.fyre.modsuite.vanish.listener.VanishListener +import cc.fyre.proton.Proton +import cc.fyre.venom.Venom +import org.bukkit.ChatColor +import org.bukkit.entity.Player +import java.util.* +import kotlin.collections.HashSet + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class VanishHandler(private val instance: ModSuite) { + + val cache = HashSet() + private val hidden = HashSet() + + init { + this.instance.server.pluginManager.registerEvents(VanishListener(this.instance),this.instance) + + Proton.getInstance().commandHandler.registerClass(VanishCommand::class.java) + } + + fun isHidden(uuid: UUID):Boolean { + return this.hidden.contains(uuid) + } + + fun setHidden(player: Player,hidden: Boolean) { + if (hidden) this.hidden.add(player.uniqueId) else this.hidden.remove(player.uniqueId) + } + + fun isInVanish(uuid: UUID):Boolean { + return this.cache.contains(uuid) + } + + fun setVanished(player: Player,vanish: Boolean,force: Boolean) { + this.setVanished(player,vanish,force,true) + } + + fun setVanished(player: Player,vanish: Boolean,force: Boolean,updateItems: Boolean) { + + val priority = Venom.instance.api.grantHandler.findBestRank(player.uniqueId).priority + + if (vanish) { + this.cache.add(player.uniqueId) + + this.instance.server.onlinePlayers.forEach{ + + val targetPriority = Venom.instance.api.grantHandler.findBestRank(it.uniqueId).priority + + if (this.cache.contains(it.uniqueId) && targetPriority <= priority) { + player.showPlayer(it) + } + + if (this.cache.contains(it.uniqueId) && targetPriority >= priority) { + it.showPlayer(player) + return@forEach + } + + it.hidePlayer(player) + } + + } else { + this.cache.remove(player.uniqueId) + this.instance.server.onlinePlayers.forEach{it.showPlayer(player)} + this.cache.mapNotNull{this.instance.server.getPlayer(it)}.forEach{player.hidePlayer(it)} + } + + if (updateItems && this.instance.modModeHandler.isInModMode(player.uniqueId)) { + this.instance.modModeHandler.updateItems(player) + } + + player.spigot().collidesWithEntities = !vanish + + this.instance.server.pluginManager.callEvent(if (vanish) VanishEnterEvent(player,force) else VanishLeaveEvent(player,force)) + + if (force) { + return + } + + player.sendMessage("${ChatColor.GOLD}Vanish: ${if (vanish) "${ChatColor.GREEN}Enabled" else "${ChatColor.RED}Disabled"}") + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/command/VanishCommand.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/command/VanishCommand.kt new file mode 100644 index 0000000..59bcbd8 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/command/VanishCommand.kt @@ -0,0 +1,43 @@ +package cc.fyre.modsuite.vanish.command + +import cc.fyre.modsuite.ModSuite +import cc.fyre.proton.command.Command +import cc.fyre.proton.command.param.Parameter + +import cc.fyre.venom.Venom +import cc.fyre.venom.util.PlayerUtil +import org.bukkit.ChatColor +import org.bukkit.entity.Player + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +object VanishCommand { + + const val PERMISSION = "command.vanish" + + @JvmStatic + @Command(names = ["vanish","v"],hidden = true,permission = PERMISSION,description = "Enter or leave vanish mode!") + fun execute(sender: Player, @Parameter(name = "player",defaultValue = "self")target: Player) { + + if (sender.uniqueId != target.uniqueId && !sender.hasPermission("${PERMISSION}.other")) { + sender.sendMessage("${ChatColor.RED}You do not have permission to vanish other players.") + return + } + + val vanish = ModSuite.instance.vanishHandler.isInVanish(target.uniqueId) + + if (sender.uniqueId != target.uniqueId) { + + sender.sendMessage("${ChatColor.GOLD}You have ${(if (vanish) "${ChatColor.RED}disabled" else "${ChatColor.GREEN}enabled")}${ChatColor.GOLD} vanish for ${PlayerUtil.getDisplayName(target.uniqueId,target.name)}${ChatColor.GOLD}.") + } + + ModSuite.instance.vanishHandler.setVanished(target,!vanish,false) + } + + + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/event/VanishEnterEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/event/VanishEnterEvent.kt new file mode 100644 index 0000000..e225bb3 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/event/VanishEnterEvent.kt @@ -0,0 +1,23 @@ +package cc.fyre.modsuite.vanish.event + +import org.bukkit.entity.Player +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class VanishEnterEvent(val player: Player,val force: Boolean) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/event/VanishLeaveEvent.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/event/VanishLeaveEvent.kt new file mode 100644 index 0000000..9278089 --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/event/VanishLeaveEvent.kt @@ -0,0 +1,23 @@ +package cc.fyre.modsuite.vanish.event + +import org.bukkit.entity.Player +import org.bukkit.event.Event +import org.bukkit.event.HandlerList + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class VanishLeaveEvent(val player: Player,val force: Boolean) : Event() { + + override fun getHandlers(): HandlerList { + return handlerList + } + + companion object { + @JvmStatic val handlerList = HandlerList() + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/listener/VanishListener.kt b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/listener/VanishListener.kt new file mode 100644 index 0000000..89e2f4e --- /dev/null +++ b/Modsuite/src/main/kotlin/cc/fyre/modsuite/vanish/listener/VanishListener.kt @@ -0,0 +1,76 @@ +package cc.fyre.modsuite.vanish.listener + +import cc.fyre.modsuite.ModSuite +import cc.fyre.modsuite.vanish.command.VanishCommand + +import org.bukkit.ChatColor +import org.bukkit.Sound +import org.bukkit.block.Chest + +import org.bukkit.event.EventHandler +import org.bukkit.event.EventPriority +import org.bukkit.event.Listener +import org.bukkit.event.block.Action + +import org.bukkit.event.player.PlayerInteractEvent +import org.bukkit.event.player.PlayerJoinEvent +import org.bukkit.event.player.PlayerQuitEvent + + +/** + * @project modsuite + * + * @date 15/04/2020 + * @author xanderume@gmail.com + */ +class VanishListener(private val instance: ModSuite) : Listener { + + @EventHandler(priority = EventPriority.LOWEST) + private fun onJoin(event: PlayerJoinEvent) { + + if (event.player.hasPermission(VanishCommand.PERMISSION)) { + return + } + + this.instance.vanishHandler.cache.mapNotNull{this.instance.server.getPlayer(it)}.forEach{event.player.hidePlayer(it)} + } + + @EventHandler(priority = EventPriority.MONITOR) + private fun onPlayerQuit(event: PlayerQuitEvent) { + this.instance.vanishHandler.setVanished(event.player,false,force = true,updateItems = false) + } + + @EventHandler(priority = EventPriority.NORMAL) + private fun onPlayerInteract(event: PlayerInteractEvent) { + + if (!this.instance.vanishHandler.isInVanish(event.player.uniqueId)) { + return + } + + if (event.action == Action.PHYSICAL) { + event.isCancelled = true + return + } + + if (!event.action.name.contains("RIGHT",true)) { + return + } + + if (!event.hasBlock() || event.clickedBlock.state !is Chest) { + return + } + + val chest = event.clickedBlock.state as Chest + + val inventory = this.instance.server.createInventory(chest.inventory.holder,chest.inventory.size,chest.inventory.title) + + inventory.contents = chest.inventory.contents + + event.player.openInventory(inventory) + event.player.sendMessage("${ChatColor.RED}Opening chest silently..") + event.player.playSound(chest.location,Sound.CHEST_OPEN,1.0F,1.0F) + + event.isCancelled = true + } + +} \ No newline at end of file diff --git a/Modsuite/src/main/resources/config.yml b/Modsuite/src/main/resources/config.yml new file mode 100644 index 0000000..e5127c3 --- /dev/null +++ b/Modsuite/src/main/resources/config.yml @@ -0,0 +1 @@ +modMode: true diff --git a/Modsuite/src/main/resources/plugin.yml b/Modsuite/src/main/resources/plugin.yml new file mode 100644 index 0000000..625bee8 --- /dev/null +++ b/Modsuite/src/main/resources/plugin.yml @@ -0,0 +1,4 @@ +name: ModSuite +main: cc.fyre.modsuite.ModSuite +version: 1.0-SNAPSHOT +depend: [Proton,Venom,Kotlin] diff --git a/Symbiote/build.gradle b/Symbiote/build.gradle new file mode 100644 index 0000000..b9e1a70 --- /dev/null +++ b/Symbiote/build.gradle @@ -0,0 +1,56 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +plugins { + id "org.jetbrains.kotlin.jvm" version "$kotlin_version" + id "com.github.johnrengelman.shadow" version "5.2.0" +} + +group = 'cc.fyre.symbiote' +version = '1.0-SNAPSHOT' +description = 'symbiote' + +targetCompatibility = '1.8' +sourceCompatibility = '1.8' + +shadowJar { + classifier = null + minimize() +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + + compile "redis.clients:jedis:$redis_version" + compile "com.google.code.gson:gson:$gson_version" + compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + +} + +apply plugin: "kotlin" +apply plugin: 'maven-publish' + +compileKotlin { + kotlinOptions.jvmTarget = '1.8' +} + +sourceSets { + main.java.srcDirs += 'src/main/kotlin/' +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + +publishing { + publications { + shadow(MavenPublication) { publication -> + project.shadow.component(publication) + } + } +} \ No newline at end of file diff --git a/Symbiote/gradle.properties b/Symbiote/gradle.properties new file mode 100644 index 0000000..3a557c4 --- /dev/null +++ b/Symbiote/gradle.properties @@ -0,0 +1,4 @@ +gson_version=2.8.5 +moshi_version=1.12.0 +redis_version=3.5.1 +kotlin_version=1.5.0 diff --git a/Symbiote/gradlew b/Symbiote/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/Symbiote/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/Symbiote/gradlew.bat b/Symbiote/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/Symbiote/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Symbiote/settings.gradle b/Symbiote/settings.gradle new file mode 100644 index 0000000..79d1b8e --- /dev/null +++ b/Symbiote/settings.gradle @@ -0,0 +1,5 @@ +/* + * This file was generated by the Gradle 'init' task. + */ + +rootProject.name = 'symbiote' diff --git a/Symbiote/src/main/kotlin/cc/fyre/symbiote/Symbiote.kt b/Symbiote/src/main/kotlin/cc/fyre/symbiote/Symbiote.kt new file mode 100644 index 0000000..9cab3bc --- /dev/null +++ b/Symbiote/src/main/kotlin/cc/fyre/symbiote/Symbiote.kt @@ -0,0 +1,26 @@ +package cc.fyre.symbiote + +import com.google.gson.JsonObject + +/** + * @project symbiote + * + * @date 19/03/2020 + * @author xanderume@gmail.com + */ +class Symbiote(val id: String,val data: JsonObject) { + + constructor(legacy: JsonObject):this(legacy["_id"].asString,legacy["data"].asJsonObject) + constructor(id: String,any: Any):this(id,SymbioteAPI.GSON.toJsonTree(any).asJsonObject) + + fun toJson():JsonObject { + + val toReturn = JsonObject() + + toReturn.addProperty("_id",this.id) + toReturn.add("data",this.data) + + return toReturn + } + +} diff --git a/Symbiote/src/main/kotlin/cc/fyre/symbiote/SymbioteAPI.kt b/Symbiote/src/main/kotlin/cc/fyre/symbiote/SymbioteAPI.kt new file mode 100644 index 0000000..8fd87c6 --- /dev/null +++ b/Symbiote/src/main/kotlin/cc/fyre/symbiote/SymbioteAPI.kt @@ -0,0 +1,67 @@ +package cc.fyre.symbiote + +import cc.fyre.symbiote.parasite.ParasiteData +import cc.fyre.symbiote.parasite.Parasite +import cc.fyre.symbiote.parasite.ParasiteListener +import com.google.gson.Gson +import com.google.gson.JsonObject +import com.google.gson.JsonParser + +/** + * @project symbiote + * + * @date 19/03/2020 + * @author xanderume@gmail.com + */ +abstract class SymbioteAPI(gson: Gson? = null,parser: JsonParser? = null) { + + protected val listeners = hashMapOf>() + protected val listenersByClass = hashMapOf,ArrayList>() + + protected abstract fun publish(symbiote: Symbiote):Boolean + + init { + + if (gson != null) { + GSON = gson + } + + if (parser != null) { + GSON_PARSER = parser + } + + } + + fun sendPacket(symbiote: Symbiote):Boolean { + return this.publish(symbiote) + } + + fun addListener(listener: ParasiteListener) { + + for (method in listener::class.java.declaredMethods) { + + val annotation = method.getDeclaredAnnotation(Parasite::class.java) + + if (annotation == null || !JsonObject::class.java.isAssignableFrom(method.parameterTypes.first())) { + continue + } + + val data = ParasiteData(listener,method,annotation.id) + + this.listeners.getOrPut(annotation.id.toLowerCase()) { arrayListOf() }.add(data) + this.listenersByClass.getOrPut(annotation::class.java) { arrayListOf() }.add(data) + } + + } + + fun removeListener(clazz: Class<*>) { + this.listenersByClass.remove(clazz)?.forEach{this.listeners[it.id.toLowerCase()]?.remove(it)} + } + + companion object { + + var GSON = Gson() + var GSON_PARSER = JsonParser() + + } +} \ No newline at end of file diff --git a/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/Parasite.kt b/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/Parasite.kt new file mode 100644 index 0000000..db77a46 --- /dev/null +++ b/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/Parasite.kt @@ -0,0 +1,11 @@ +package cc.fyre.symbiote.parasite + +/** + * @project symbiote + * + * @date 19/03/2020 + * @author xanderume@gmail.com + */ +@Target(AnnotationTarget.FUNCTION,AnnotationTarget.PROPERTY_GETTER,AnnotationTarget.PROPERTY_SETTER) +@Retention(AnnotationRetention.RUNTIME) +annotation class Parasite(val id: String) \ No newline at end of file diff --git a/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/ParasiteData.kt b/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/ParasiteData.kt new file mode 100644 index 0000000..ea1e16c --- /dev/null +++ b/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/ParasiteData.kt @@ -0,0 +1,11 @@ +package cc.fyre.symbiote.parasite + +import java.lang.reflect.Method + +/** + * @project symbiote + * + * @date 19/03/2020 + * @author xanderume@gmail.com + */ +data class ParasiteData(val instance: Any,val method: Method,val id: String) \ No newline at end of file diff --git a/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/ParasiteListener.kt b/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/ParasiteListener.kt new file mode 100644 index 0000000..823e8a0 --- /dev/null +++ b/Symbiote/src/main/kotlin/cc/fyre/symbiote/parasite/ParasiteListener.kt @@ -0,0 +1,9 @@ +package cc.fyre.symbiote.parasite + +/** + * @project symbiote + * + * @date 19/03/2020 + * @author xanderume@gmail.com + */ +interface ParasiteListener \ No newline at end of file diff --git a/Symbiote/src/main/kotlin/cc/fyre/symbiote/type/RedisSymbioteAPI.kt b/Symbiote/src/main/kotlin/cc/fyre/symbiote/type/RedisSymbioteAPI.kt new file mode 100644 index 0000000..f55d630 --- /dev/null +++ b/Symbiote/src/main/kotlin/cc/fyre/symbiote/type/RedisSymbioteAPI.kt @@ -0,0 +1,90 @@ +package cc.fyre.symbiote.type + +import cc.fyre.symbiote.Symbiote +import cc.fyre.symbiote.SymbioteAPI +import com.google.gson.Gson +import com.google.gson.JsonObject +import com.google.gson.JsonParseException +import com.google.gson.JsonParser + +import redis.clients.jedis.JedisPool +import redis.clients.jedis.JedisPubSub +import java.util.concurrent.ForkJoinPool + +/** + * @project symbiote + * + * @date 19/03/2020 + * @author xanderume@gmail.com + */ +class RedisSymbioteAPI(gson: Gson,private val pool: JedisPool,val channel: String,var password: String? = null) : SymbioteAPI(gson) { + + private val subscriber = SymbioteSubscriber(this) + + init { + ForkJoinPool.commonPool().execute{this.pool.resource.use{ + + if (this.password != null) { + it.auth(this.password) + } + + it.subscribe(this.subscriber,this.channel) + }} + } + + override fun publish(symbiote: Symbiote):Boolean { + + val payload = symbiote.toJson() + + try { + + this.pool.resource.use{ + + if (this.password != null) { + it.auth(this.password) + } + + return@use it.publish(this.channel,payload.toString()) + } + + } catch (ex: Exception) { + ex.printStackTrace() + return false + } + + return true + } + + class SymbioteSubscriber(private val api: RedisSymbioteAPI) : JedisPubSub() { + + override fun onMessage(channel: String,message: String) { + + if (channel != this.api.channel) { + return + } + + val json = try { + GSON_PARSER.parse(message).asJsonObject + //GSON.fromJson(message,JsonObject::class.java) + } catch (ex: JsonParseException) { + ex.printStackTrace() + return + } + + val symbiote = Symbiote(json!!) + + this.api.listeners[symbiote.id.toLowerCase()]?.forEach{ + + try { + it.method.invoke(it.instance,symbiote.data) + } catch (ex: Exception) { + ex.printStackTrace() + } + + } + + } + + } + +} \ No newline at end of file