File tree Expand file tree Collapse file tree
src/main/kotlin/io/github/grassproject/control Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ plugins {
77}
88
99group = " io.github.grassproject"
10- version = " 0.1 "
10+ version = " 0.2 "
1111
1212repositories {
1313 mavenCentral()
@@ -22,7 +22,6 @@ repositories {
2222dependencies {
2323 compileOnly(" io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT" )
2424 compileOnly(" com.github.GrassProject.GPFramework:Core:0.3-RC1" )
25-
2625}
2726
2827kotlin {
Original file line number Diff line number Diff line change 11package io.github.grassproject.control
22
3- import io.github.grassproject.control.module.ModuleHandler
3+ import io.github.grassproject.control.module.*
44import io.github.grassproject.framework.core.GPPlugin
55
66class GPControlPlugin : GPPlugin () {
77
8+ private val modules = listOf (
9+ FarmProtectModule (),
10+ JoinQuitMessageModule (),
11+ FrostWalkerModule ()
12+ )
13+
814 override fun load () {}
915
1016 override fun enable () {
1117 saveDefaultConfig()
18+ reloadConfig()
1219
13- ModuleHandler . modules.forEach { module ->
14- if (config.getBoolean(" modules.${module.name} " , false )) {
20+ modules.forEach { module ->
21+ if (config.getBoolean(" modules.${module.name} " , true )) {
1522 module.apply (this )
1623 logger.info(" ${module.name} module enabled" )
1724 }
1825 }
26+
1927 }
2028
2129 override fun disable () {}
Original file line number Diff line number Diff line change 11package io.github.grassproject.control.module
22
3+ import net.kyori.adventure.text.Component
34import org.bukkit.event.EventHandler
45import org.bukkit.event.player.PlayerJoinEvent
56import org.bukkit.event.player.PlayerQuitEvent
@@ -8,11 +9,11 @@ class JoinQuitMessageModule : ModuleHandler("join-quit-message") {
89
910 @EventHandler
1011 fun PlayerJoinEvent.on () {
11- joinMessage(null )
12+ joinMessage(Component .empty() )
1213 }
1314
1415 @EventHandler
1516 fun PlayerQuitEvent.on () {
16- quitMessage(null )
17+ quitMessage(Component .empty() )
1718 }
1819}
Original file line number Diff line number Diff line change @@ -4,15 +4,6 @@ import io.github.grassproject.framework.core.GPPlugin
44import org.bukkit.event.Listener
55
66abstract class ModuleHandler (val name : String ) : Listener {
7-
8- companion object {
9- val modules = mutableListOf<ModuleHandler >()
10- }
11-
12- init {
13- modules.add(this )
14- }
15-
167 open fun apply (plugin : GPPlugin ) {
178 plugin.registerListener(this )
189 }
You can’t perform that action at this time.
0 commit comments