This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from deveworld/feature/rebar
2.0.0 Release
- Loading branch information
Showing
17 changed files
with
871 additions
and
194 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,74 @@ | ||
package dev.worldsw.archKing | ||
|
||
import dev.worldsw.archKing.block.AKBlock | ||
import dev.worldsw.archKing.block.AKOverlapBlock | ||
import dev.worldsw.archKing.command.AKCommand | ||
import dev.worldsw.archKing.event.AKBlockEvent | ||
import dev.worldsw.archKing.recipe.AKRecipe | ||
import dev.worldsw.archKing.data.AKStorage | ||
import dev.worldsw.archKing.event.AKGypsumEvent | ||
import dev.worldsw.archKing.event.AKRebarEvent | ||
import dev.worldsw.archKing.event.AKStorageEvent | ||
import dev.worldsw.archKing.event.* | ||
import dev.worldsw.archKing.item.AKItem | ||
import dev.worldsw.archKing.rebar.AKRebar | ||
import org.bukkit.Bukkit | ||
import org.bukkit.command.TabCompleter | ||
import org.bukkit.event.Listener | ||
import org.bukkit.plugin.java.JavaPlugin | ||
|
||
class ArchKingPlugin: JavaPlugin(), Listener { | ||
lateinit var storage: AKStorage | ||
lateinit var akRebar: AKRebar | ||
lateinit var akItem: AKItem | ||
lateinit var akBlock: AKBlock | ||
lateinit var akOverlapBlock: AKOverlapBlock | ||
|
||
override fun onEnable() { | ||
akRebar = AKRebar(this) | ||
storage = AKStorage(this) | ||
|
||
storage.init() | ||
akItem = AKItem(this) | ||
akBlock = AKBlock(this) | ||
akOverlapBlock = AKOverlapBlock(this) | ||
AKRecipe(this) | ||
|
||
server.pluginManager.registerEvents(this, this) | ||
server.pluginManager.registerEvents(AKStorageEvent(this), this) | ||
server.pluginManager.registerEvents(AKRebarEvent(this), this) | ||
server.pluginManager.registerEvents(AKOverlapBlockEvent(this), this) | ||
server.pluginManager.registerEvents(AKGypsumEvent(this), this) | ||
server.pluginManager.registerEvents(AKBlockEvent(this), this) | ||
server.pluginManager.registerEvents(AKFallEvent(this), this) | ||
server.pluginManager.registerEvents(AKPaintEvent(this), this) | ||
|
||
val voidTabCompleter = TabCompleter { _, _, _, _ -> mutableListOf() } | ||
val commandList = listOf("archkingitem") | ||
val getAkiCommands = listOf("archkingitem") | ||
val commandList = listOf("akitem", "akgravity") | ||
commandList.forEach { | ||
getCommand(it)!!.setExecutor(AKCommand(this)) | ||
if (it in getAkiCommands) { | ||
getCommand(it)!!.tabCompleter = TabCompleter { _, _, label, args -> | ||
if (label.equals(it, true) && args.size == 1) { | ||
akItem.getAllProperties() | ||
} else { | ||
mutableListOf() | ||
when (it) { | ||
"akitem" -> { | ||
getCommand(it)!!.tabCompleter = TabCompleter { _, _, label, args -> | ||
if (label.equals(it, true) && args.size == 1) { | ||
akItem.getAllProperties() | ||
} else { | ||
mutableListOf() | ||
} | ||
} | ||
} | ||
} else { | ||
getCommand(it)!!.tabCompleter = voidTabCompleter | ||
|
||
"akgravity" -> { | ||
getCommand(it)!!.tabCompleter = TabCompleter { _, _, label, args -> | ||
if (label.equals(it, true) && args.size == 1) { | ||
mutableListOf("concrete", "wood") | ||
} else { | ||
mutableListOf() | ||
} | ||
} | ||
} | ||
|
||
else -> { | ||
getCommand(it)!!.tabCompleter = voidTabCompleter | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onDisable() { | ||
storage.saveData() | ||
Bukkit.getScheduler().cancelTasks(this) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.