Skip to content
This repository was archived by the owner on Apr 21, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

./gradlew clean copyToServer

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/github/monun/survival/Whitelist.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import java.io.File
object Whitelist {
lateinit var allows: Set<String>


fun load(file: File) {
if (!file.exists()) {
file.createNewFile()
Expand All @@ -14,4 +15,6 @@ object Whitelist {
val lines = file.readLines()
allows = ImmutableSortedSet.copyOf(String.CASE_INSENSITIVE_ORDER, lines)
}


}
16 changes: 16 additions & 0 deletions src/main/kotlin/com/github/monun/survival/gosuBan.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.monun.survival

import com.google.common.collect.ImmutableSortedSet
import java.io.File

object Gosuban {
lateinit var denied: Set<String>

fun ban(file: File) {
if(!file.exists()) {
file.createNewFile()
}
val lines = file.readLines()
denied = ImmutableSortedSet.copyOf(String.CASE_INSENSITIVE_ORDER, lines)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ package com.github.monun.survival.plugin

import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent
import com.destroystokyo.paper.event.server.PaperServerListPingEvent
import com.github.monun.survival.Survival
import com.github.monun.survival.SurvivalConfig
import com.github.monun.survival.Whitelist
import com.github.monun.survival.survival
import com.github.monun.survival.*
import io.papermc.paper.event.player.AsyncChatEvent
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.TextColor
Expand Down Expand Up @@ -37,6 +34,8 @@ class EventListener(
val name = event.name
if (name in SurvivalConfig.defaultHumans || name in Whitelist.allows) return
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Component.text("다음 기회에 ㅜㅜ"))
if (name !in Gosuban.denied) return
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Component.text("고수 밴"))
}

@EventHandler(priority = EventPriority.LOWEST)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class SurvivalPlugin : JavaPlugin() {
val configFile = File(dataFolder, "config.yml")
SurvivalConfig.load(configFile)
Whitelist.load(File(dataFolder, "whitelist.txt"))
Gosuban.ban(File(dataFolder, "Gosuban.txt"))

setupRecipe()
setupCommands()
Expand Down Expand Up @@ -135,8 +136,7 @@ class SurvivalPlugin : JavaPlugin() {
isInvulnerable = true
setGravity(false)
}

if (nextInt(2) == 0) {
if (nextInt(10) <= 5) {
world.dropItem(loc, ItemStack(Material.NETHER_STAR))
} else {
world.spawn(loc.apply { y -= 0.25 }, ArmorStand::class.java).apply {
Expand Down