feat: initial commit
This commit is contained in:
commit
80de826345
40 changed files with 1322 additions and 0 deletions
80
src/main/kotlin/xyz/atnrch/dragon/player/DragonPlayer.kt
Normal file
80
src/main/kotlin/xyz/atnrch/dragon/player/DragonPlayer.kt
Normal file
|
@ -0,0 +1,80 @@
|
|||
package xyz.atnrch.dragon.player
|
||||
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.ChatColor
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import xyz.atnrch.dragon.RunnerDragon
|
||||
import xyz.atnrch.dragon.teams.Team
|
||||
import xyz.haoshoku.nick.api.NickAPI
|
||||
import java.util.*
|
||||
|
||||
|
||||
class DragonPlayer(uuid: UUID) {
|
||||
val player = Bukkit.getPlayer(uuid)!!
|
||||
|
||||
fun updateHeaderFooter() {
|
||||
player.playerListHeader = """
|
||||
${RunnerDragon.TITLE}
|
||||
${ChatColor.DARK_PURPLE}${ChatColor.BOLD}Met@${ChatColor.DARK_AQUA}${ChatColor.BOLD}Gaming
|
||||
|
||||
${ChatColor.GOLD}Temps: ${ChatColor.RED}${formatDuration(RunnerDragon.TIME)}
|
||||
${ChatColor.GOLD}Vaches tuées: ${ChatColor.RED}${RunnerDragon.DEAD_COWS} ${ChatColor.GRAY}${ChatColor.ITALIC}(c'est horrible)
|
||||
|
||||
""".trimIndent()
|
||||
player.playerListFooter = """
|
||||
|
||||
${ChatColor.GOLD}${ChatColor.ITALIC}Plugin: ${ChatColor.BLUE}Ineanto ${ChatColor.DARK_GRAY}/ ${ChatColor.GOLD}${ChatColor.ITALIC}Concept: ${ChatColor.BLUE}Linkxss
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
fun sendMessage(message: String) {
|
||||
player.sendMessage("${ChatColor.WHITE}[${RunnerDragon.TITLE}${ChatColor.WHITE}] ${ChatColor.RESET}$message")
|
||||
}
|
||||
|
||||
fun getTeam(): Team? {
|
||||
return RunnerDragon.instance.teamManager.getPlayerTeam(player)
|
||||
}
|
||||
|
||||
fun setTeam(team: Team) {
|
||||
RunnerDragon.instance.teamManager.setPlayerTeam(player, team)
|
||||
}
|
||||
|
||||
fun impulse101() {
|
||||
player.gameMode = GameMode.SURVIVAL
|
||||
player.inventory.clear()
|
||||
player.health = 20.0
|
||||
player.foodLevel = 20
|
||||
player.activePotionEffects.clear()
|
||||
player.walkSpeed = 0.2f
|
||||
player.flySpeed = 0.1f
|
||||
player.exp = 0f
|
||||
player.level = 0
|
||||
player.totalExperience = 0
|
||||
}
|
||||
|
||||
fun setTeamItem(value: Boolean) {
|
||||
if (value) {
|
||||
val item = ItemStack(Material.CANDLE)
|
||||
val meta = item.itemMeta!!
|
||||
meta.setDisplayName("${ChatColor.GOLD}Choisir une équipe")
|
||||
item.itemMeta = meta
|
||||
player.inventory.setItem(4, item)
|
||||
} else {
|
||||
player.inventory.setItem(4, ItemStack(Material.AIR))
|
||||
}
|
||||
}
|
||||
|
||||
fun updateDisplayName() {
|
||||
NickAPI.nick(player, "${getTeam()!!.color.chatColor}${player.name}")
|
||||
NickAPI.refreshPlayer(player)
|
||||
}
|
||||
|
||||
private fun formatDuration(totalSeconds: Int): String {
|
||||
val hours = totalSeconds / 3600
|
||||
val minutes = (totalSeconds % 3600) / 60
|
||||
val seconds = totalSeconds % 60
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue