✨마지막이 될수도 있는
This commit is contained in:
parent
e3393fdc4c
commit
a948a1ff08
@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "1.8.0"
|
||||
// id("io.papermc.paperweight.userdev") version "1.5.3"
|
||||
id("io.papermc.paperweight.userdev") version "1.5.3"
|
||||
}
|
||||
|
||||
group = "group.pvpconnect"
|
||||
@ -8,7 +8,7 @@ version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
// maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
|
||||
java {
|
||||
@ -17,8 +17,8 @@ java {
|
||||
|
||||
dependencies {
|
||||
testImplementation(kotlin("test"))
|
||||
compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
|
||||
// paperweight.paperDevBundle("1.19.2-R0.1-SNAPSHOT")
|
||||
// compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
|
||||
paperweight.paperDevBundle("1.19.2-R0.1-SNAPSHOT")
|
||||
implementation("io.github.monun:kommand-api:3.1.3")
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ class Main:JavaPlugin() {
|
||||
}
|
||||
|
||||
override fun onDisable() {
|
||||
combatData.save()
|
||||
schedule.cancel()
|
||||
}
|
||||
|
||||
@ -32,6 +33,8 @@ class Main:JavaPlugin() {
|
||||
CombatEvent(this,combatData)
|
||||
schedule = this.server.scheduler.runTaskTimerAsynchronously(this, Runnable {
|
||||
list.forEach{
|
||||
if(list[it.key] == null) return@forEach
|
||||
if(list[it.key]!!.third == null) return@forEach
|
||||
if(it.value.third!!/1000 + combatData.instance.getTime() <= System.currentTimeMillis()/1000){
|
||||
list[it.key] = Triple(false,null,null)
|
||||
}
|
||||
@ -39,7 +42,9 @@ class Main:JavaPlugin() {
|
||||
Bukkit.getOnlinePlayers().forEach{
|
||||
if(list[it.uniqueId] == null) return@forEach
|
||||
if(!list[it.uniqueId]!!.first) return@forEach
|
||||
it.sendActionBar(Component.text("${ChatColor.WHITE}${Bukkit.getPlayer(list[it.uniqueId]!!.second!!)!!.name}${ChatColor.RED}님과 전투중입니다! ${ChatColor.WHITE}${list[it.uniqueId]!!.third!! /1000 + combatData.instance.getTime() - System.currentTimeMillis()/1000}${ChatColor.RED}초 뒤 전투모드가 끝납니다!"))
|
||||
if(list[it.uniqueId]!!.second == null) return@forEach
|
||||
if(list[it.uniqueId]!!.third == null) return@forEach
|
||||
it.sendActionBar(Component.text("${ChatColor.WHITE}${Bukkit.getPlayer(list[it.uniqueId]!!.second!!)!!.name}${ChatColor.RED}${ChatColor.BOLD}님과 전투중입니다! ${ChatColor.RESET}${ChatColor.WHITE}${list[it.uniqueId]!!.third!! /1000 + combatData.instance.getTime() - System.currentTimeMillis()/1000}${ChatColor.RED}${ChatColor.BOLD}초 뒤 전투모드가 끝납니다!"))
|
||||
}
|
||||
},1L,1L)
|
||||
}
|
||||
|
@ -19,20 +19,20 @@ class CombatCmd(plugin:Plugin, val cd:CombatData) {
|
||||
val world: World by it
|
||||
val bool = cd.instance.getUseWorld(world.name)
|
||||
cd.instance.setUseWorld(world.name,!bool)
|
||||
sender.sendMessage("${ChatColor.BOLD}${ChatColor.GOLD}[${ChatColor.GREEN}✓${ChatColor.GOLD}] ${ChatColor.WHITE}${world.name}의 컴뱃 모드 사용이 ${if(!bool)"활성화 되었습니다!" else "비활성화 되었습니다!"}")
|
||||
}
|
||||
}
|
||||
}
|
||||
then("visiable"){
|
||||
then("world" to dimension()){
|
||||
executes {
|
||||
val world:World by it
|
||||
val bool = cd.instance.getCanSeeWorld(world.name)
|
||||
cd.instance.setCanSeeWorld(world.name,!bool)
|
||||
sender.sendMessage("${ChatColor.BOLD}${ChatColor.GOLD}[${ChatColor.GREEN}✓${ChatColor.GOLD}] ${ChatColor.WHITE}${world.name}의 컴뱃중 다른 사람 볼수있음이 ${if(!bool)"활성화 되었습니다!" else "비활성화 되었습니다!"}")
|
||||
sender.sendMessage("${ChatColor.BOLD}${ChatColor.GOLD}[${ChatColor.BOLD}${ChatColor.GREEN}✓${ChatColor.RESET}${ChatColor.GOLD}] ${ChatColor.WHITE}${world.name}의 컴뱃 모드 사용이 ${if(!bool)"활성화 되었습니다!" else "비활성화 되었습니다!"}")
|
||||
}
|
||||
}
|
||||
}
|
||||
// then("visiable"){
|
||||
// then("world" to dimension()){
|
||||
// executes {
|
||||
// val world:World by it
|
||||
// val bool = cd.instance.getCanSeeWorld(world.name)
|
||||
// cd.instance.setCanSeeWorld(world.name,!bool)
|
||||
// sender.sendMessage("${ChatColor.BOLD}${ChatColor.GOLD}[${ChatColor.GREEN}✓${ChatColor.GOLD}] ${ChatColor.WHITE}${world.name}의 컴뱃중 다른 사람 볼수있음이 ${if(!bool)"활성화 되었습니다!" else "비활성화 되었습니다!"}")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
then("time"){
|
||||
then("int" to int()){
|
||||
executes {
|
||||
@ -40,7 +40,7 @@ class CombatCmd(plugin:Plugin, val cd:CombatData) {
|
||||
val otime = cd.instance.getTime()
|
||||
val ctime = int
|
||||
cd.instance.setTime(ctime)
|
||||
sender.sendMessage("${ChatColor.BOLD}${ChatColor.GOLD}[${ChatColor.GREEN}✓${ChatColor.GOLD}] ${ChatColor.WHITE}컴뱃타임이 ${otime}초에서 ${ctime}초으로 변경되었습니다!")
|
||||
sender.sendMessage("${ChatColor.BOLD}${ChatColor.GOLD}[${ChatColor.BOLD}${ChatColor.GREEN}✓${ChatColor.RESET}${ChatColor.GOLD}] ${ChatColor.WHITE}컴뱃타임이 ${otime}초에서 ${ctime}초으로 변경되었습니다!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,11 @@ import group.pvpconnect.combat_f.data.CombatData
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.entity.EntityType
|
||||
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.PlayerCommandPreprocessEvent
|
||||
import org.bukkit.event.player.PlayerQuitEvent
|
||||
|
||||
@Suppress("unused")
|
||||
@ -17,30 +19,30 @@ class CombatEvent(private val plugin:Main, private val combatData: CombatData):L
|
||||
Bukkit.getPluginManager().registerEvents(this,plugin)
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onDamage(e:EntityDamageByEntityEvent){
|
||||
if(!combatData.instance.getUseWorld(e.entity.world.name)) return
|
||||
if(e.entityType != EntityType.PLAYER) return
|
||||
if(e.damager.type != EntityType.PLAYER) return
|
||||
plugin.instance.list[e.entity.uniqueId] = Triple(true,e.damager.uniqueId,System.currentTimeMillis())
|
||||
plugin.instance.list[e.damager.uniqueId] = Triple(true,e.entity.uniqueId,System.currentTimeMillis())
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onOtherDamage(e:EntityDamageByEntityEvent){
|
||||
if(!combatData.instance.getUseWorld(e.entity.world.name)) return
|
||||
if(e.entityType != EntityType.PLAYER) return
|
||||
if(e.damager.type != EntityType.PLAYER) return
|
||||
val list = plugin.instance.list[e.entity.uniqueId] ?: return
|
||||
if(!list.first) return
|
||||
if(list.second == e.damager.uniqueId) {
|
||||
val list = plugin.instance.list[e.entity.uniqueId]
|
||||
val dlist = plugin.instance.list[e.damager.uniqueId]
|
||||
if((dlist?.second != null) && (dlist.second != e.entity.uniqueId)){ e.isCancelled = true;return}
|
||||
if(list?.second != null && list.second != e.damager.uniqueId) {
|
||||
e.isCancelled = true
|
||||
return
|
||||
}
|
||||
plugin.instance.list[e.entity.uniqueId] = Triple(true,e.damager.uniqueId,System.currentTimeMillis())
|
||||
plugin.instance.list[e.damager.uniqueId] = Triple(true,e.entity.uniqueId,System.currentTimeMillis())
|
||||
return
|
||||
}else{
|
||||
e.isCancelled = true
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onCommand(e:PlayerCommandPreprocessEvent){
|
||||
if(listOf("l","lobby","home","spawn").any { e.message == it }){
|
||||
val list = plugin.instance.list[e.player.uniqueId] ?: return
|
||||
if(!list.first) return
|
||||
e.isCancelled = true
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user