From f6cdb00c2985da76d05d5b8979612b8eda46ee74 Mon Sep 17 00:00:00 2001 From: 5vl Date: Thu, 5 May 2022 20:21:38 +0200 Subject: [PATCH] added config --- src/main/java/me/fivevl/deathban/Listener.kt | 20 ++++++++++++++++++++ src/main/java/me/fivevl/deathban/Main.kt | 5 ++++- src/main/resources/config.yml | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/fivevl/deathban/Listener.kt create mode 100644 src/main/resources/config.yml diff --git a/src/main/java/me/fivevl/deathban/Listener.kt b/src/main/java/me/fivevl/deathban/Listener.kt new file mode 100644 index 0000000..7611b65 --- /dev/null +++ b/src/main/java/me/fivevl/deathban/Listener.kt @@ -0,0 +1,20 @@ +package me.fivevl.deathban + +import org.bukkit.event.EventHandler +import org.bukkit.event.entity.PlayerDeathEvent + +class Listener(instance: Main) : org.bukkit.event.Listener { + private var permission = "" + private var message = "" + private var time = 0 + + init { + this.permission = instance.config.getString("bypass-permission")!! + this.time = instance.config.getInt("deathban-time") + this.message = instance.config.getString("deathban-message")!!.replace("%time%", time.toString()) + } + @EventHandler + fun onDeath(e: PlayerDeathEvent) { + + } +} \ No newline at end of file diff --git a/src/main/java/me/fivevl/deathban/Main.kt b/src/main/java/me/fivevl/deathban/Main.kt index 69d13d5..728162f 100644 --- a/src/main/java/me/fivevl/deathban/Main.kt +++ b/src/main/java/me/fivevl/deathban/Main.kt @@ -1,10 +1,13 @@ package me.fivevl.deathban +import org.bukkit.Bukkit import org.bukkit.plugin.java.JavaPlugin class Main : JavaPlugin() { override fun onEnable() { - // Plugin startup logic + logger.info("Deathban plugin by 5vl for u/SkiryHatesEmoji") + saveDefaultConfig() + Bukkit.getPluginManager().registerEvents(Listener(this), this) } override fun onDisable() { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..326c105 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,3 @@ +deathban-time: 90 #This is in minutes. +deathban-message: "You have been deathbanned for %time% minutes." #Message shown to the player when they are deathbanned. %time% is replaced with the time the player is deathbanned for. +bypass-permission: "deathban.bypass" #Permission required to bypass deathban.