mirror of
https://github.com/5vl/Staff.git
synced 2025-05-24 06:16:56 +00:00
am tired now bye gl
This commit is contained in:
parent
c74afd6316
commit
8bed238ca2
@ -12,4 +12,5 @@ object Config {
|
||||
put(it.toInt(), config?.getString("staffmode-hotbar.$it")!!)
|
||||
}
|
||||
}
|
||||
val toggleVanish = config?.getString("toggle-vanish")
|
||||
}
|
@ -1,13 +1,20 @@
|
||||
package me.fivevl.staff
|
||||
|
||||
import me.fivevl.staff.commands.StaffModeCommand
|
||||
import me.fivevl.staff.listeners.JoinListener
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
|
||||
class Main : JavaPlugin() {
|
||||
override fun onEnable() {
|
||||
Utils.instance = this
|
||||
|
||||
saveDefaultConfig()
|
||||
Config.config = config
|
||||
|
||||
getCommand("staffmode")!!.setExecutor(StaffModeCommand())
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(JoinListener(), this)
|
||||
logger.info("Staff plugin enabled.")
|
||||
}
|
||||
|
||||
@ -20,6 +27,7 @@ class Main : JavaPlugin() {
|
||||
FEATURES:
|
||||
DONE:
|
||||
- PlaceholderAPI support
|
||||
- Config
|
||||
NOT DONE:
|
||||
- Staff mode (Invisibility/vanish, fly, items)
|
||||
- Freeze (Command and freeze wand in staff mode)
|
||||
|
@ -2,6 +2,7 @@ package me.fivevl.staff
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI
|
||||
import net.md_5.bungee.api.ChatColor
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.inventory.ItemStack
|
||||
@ -9,7 +10,9 @@ import org.bukkit.inventory.PlayerInventory
|
||||
import java.util.regex.Pattern
|
||||
|
||||
object Utils {
|
||||
var instance: Main? = null
|
||||
private val inStaffmode = HashMap<Player, PlayerInventory>()
|
||||
val inVanish = ArrayList<Player>()
|
||||
@Suppress("deprecation")
|
||||
fun hex(s: String): String {
|
||||
var s2 = s
|
||||
@ -47,4 +50,20 @@ object Utils {
|
||||
}
|
||||
p.sendMessage(hex(getPlaceholders(p, Config.toggleStaffmode!!)))
|
||||
}
|
||||
|
||||
fun toggleVanish(p: Player) {
|
||||
if (inVanish.contains(p)) {
|
||||
for (ps in Bukkit.getOnlinePlayers()) {
|
||||
ps.showPlayer(instance!!, p)
|
||||
}
|
||||
inVanish.remove(p)
|
||||
p.sendMessage(hex(getPlaceholders(p, Config.toggleVanish!!)))
|
||||
} else {
|
||||
for (ps in Bukkit.getOnlinePlayers()) {
|
||||
ps.hidePlayer(instance!!, p)
|
||||
}
|
||||
inVanish.add(p)
|
||||
p.sendMessage(hex(getPlaceholders(p, Config.toggleVanish!!)))
|
||||
}
|
||||
}
|
||||
}
|
16
src/main/java/me/fivevl/staff/listeners/JoinListener.kt
Normal file
16
src/main/java/me/fivevl/staff/listeners/JoinListener.kt
Normal file
@ -0,0 +1,16 @@
|
||||
package me.fivevl.staff.listeners
|
||||
|
||||
import me.fivevl.staff.Utils
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.player.PlayerJoinEvent
|
||||
|
||||
class JoinListener : Listener {
|
||||
@EventHandler
|
||||
fun onJoin(e: PlayerJoinEvent) {
|
||||
val p = e.player
|
||||
for (ps in Utils.inVanish) {
|
||||
p.hidePlayer(Utils.instance!!, ps)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,11 @@
|
||||
# In this section of the config you can change all the messages in the plugin.
|
||||
must-be-player: "&cYou must be a player to use this command!" # Message shown when a player tries to use a command that requires them to be a player
|
||||
no-permission: "&cYou don't have permission to use this command!" # Message shown when a player tries to use a command that they don't have permission to use
|
||||
toggle-staffmode: "&aToggled staffmode!" # Message shown when a player toggles staffmode
|
||||
toggle-vanish: "&aToggled vanish!" # Message shown when a player toggles vanish
|
||||
toggle-fly: "&aToggled fly!" # Message shown when a player toggles fly
|
||||
|
||||
# In this section of the config you can change the items given to you in staffmode.
|
||||
staffmode-hotbar: # List of items to give the player when they toggle staffmode, available items: "AIR", "DISABLE_STAFFMODE", "FREEZE_WAND", "INVENTORY_WAND", "KB_STICK", "VANISH_ITEM"
|
||||
1: "AIR"
|
||||
2: "AIR"
|
||||
|
Loading…
x
Reference in New Issue
Block a user