mirror of
				https://github.com/5vl/Staff.git
				synced 2025-10-31 02:03:39 +00:00 
			
		
		
		
	added items to items, invsee command. <3 minimessage!
This commit is contained in:
		| @@ -1,25 +1,25 @@ | ||||
| package me.fivevl.staff | ||||
|  | ||||
| import org.bukkit.configuration.file.FileConfiguration | ||||
|  | ||||
| object Config { | ||||
|     private fun getConfig(): FileConfiguration { | ||||
|         return Utils.getConfig() | ||||
|     } | ||||
|     val mustBePlayer = getConfig().getString("must-be-player")!! | ||||
|     val noPermission = getConfig().getString("no-permission")!! | ||||
|     val toggleStaffmodeOn = getConfig().getString("toggle-staffmode-on")!! | ||||
|     val toggleStaffmodeOff = getConfig().getString("toggle-staffmode-off")!! | ||||
|     val toggleVanishOn = getConfig().getString("toggle-vanish-on")!! | ||||
|     val toggleVanishOff = getConfig().getString("toggle-vanish-off")!! | ||||
|     val mustBePlayer = Utils.instance!!.config.getString("must-be-player")!! | ||||
|     val noPermission = Utils.instance!!.config.getString("no-permission")!! | ||||
|     val toggleStaffmodeOn = Utils.instance!!.config.getString("toggle-staffmode-on")!! | ||||
|     val toggleStaffmodeOff = Utils.instance!!.config.getString("toggle-staffmode-off")!! | ||||
|     val toggleVanishOn = Utils.instance!!.config.getString("toggle-vanish-on")!! | ||||
|     val toggleVanishOff = Utils.instance!!.config.getString("toggle-vanish-off")!! | ||||
|     val staffmodeHotbar = HashMap<Int, String>().apply { | ||||
|         getConfig().getConfigurationSection("staffmode-hotbar")?.getKeys(false)?.forEach { | ||||
|             put(it.toInt(), getConfig().getString("staffmode-hotbar.$it")!!) | ||||
|         Utils.instance!!.config.getConfigurationSection("staffmode-hotbar")?.getKeys(false)?.forEach { | ||||
|             put(it.toInt(), Utils.instance!!.config.getString("staffmode-hotbar.$it")!!) | ||||
|         } | ||||
|     } | ||||
|     val disableStaffmodeItem = getConfig().getString("items.DISABLE_STAFFMODE")!! | ||||
|     val freezeWandItem = getConfig().getString("items.FREEZE_WAND")!! | ||||
|     val inventoryWandItem = getConfig().getString("items.INVENTORY_WAND")!! | ||||
|     val kbStickItem = getConfig().getString("items.KB_STICK")!! | ||||
|     val vanishItem = getConfig().getString("items.VANISH_ITEM")!! | ||||
|     val disableStaffmodeItemName = Utils.instance!!.config.getString("items.DISABLE_STAFFMODE.name")!! | ||||
|     val freezeWandItemName = Utils.instance!!.config.getString("items.FREEZE_WAND.name")!! | ||||
|     val inventoryWandItemName = Utils.instance!!.config.getString("items.INVENTORY_WAND.name")!! | ||||
|     val kbStickItemName = Utils.instance!!.config.getString("items.KB_STICK.name")!! | ||||
|     val vanishItemName = Utils.instance!!.config.getString("items.VANISH_ITEM.name")!! | ||||
|     val disableStaffmodeItem = Utils.instance!!.config.getString("items.DISABLE_STAFFMODE.item")!! | ||||
|     val freezeWandItem = Utils.instance!!.config.getString("items.FREEZE_WAND.item")!! | ||||
|     val inventoryWandItem = Utils.instance!!.config.getString("items.INVENTORY_WAND.item")!! | ||||
|     val kbStickItem = Utils.instance!!.config.getString("items.KB_STICK.item")!! | ||||
|     val vanishItem = Utils.instance!!.config.getString("items.VANISH_ITEM.item")!! | ||||
| } | ||||
| @@ -1,6 +1,7 @@ | ||||
| package me.fivevl.staff | ||||
|  | ||||
| import org.bukkit.Material | ||||
| import org.bukkit.enchantments.Enchantment | ||||
| import org.bukkit.inventory.ItemStack | ||||
|  | ||||
| enum class Items(val item: ItemStack) { | ||||
| @@ -12,41 +13,42 @@ enum class Items(val item: ItemStack) { | ||||
| } | ||||
| @Suppress("deprecation") | ||||
| private fun getStaffmodeItem(): ItemStack { | ||||
|     val item = ItemStack(Material.LIME_DYE) | ||||
|     val item = ItemStack(Material.valueOf(Config.disableStaffmodeItem)) | ||||
|     val meta = item.itemMeta | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.disableStaffmodeItem))) | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.disableStaffmodeItemName))) | ||||
|     item.itemMeta = meta | ||||
|     return item | ||||
| } | ||||
| @Suppress("deprecation") | ||||
| private fun getFreezeWandItem(): ItemStack { | ||||
|     val item = ItemStack(Material.CHAIN) | ||||
|     val item = ItemStack(Material.valueOf(Config.freezeWandItem)) | ||||
|     val meta = item.itemMeta | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.freezeWandItem))) | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.freezeWandItemName))) | ||||
|     item.itemMeta = meta | ||||
|     return item | ||||
| } | ||||
| @Suppress("deprecation") | ||||
| private fun getInventoryWandItem(): ItemStack { | ||||
|     val item = ItemStack(Material.BLAZE_ROD) | ||||
|     val item = ItemStack(Material.valueOf(Config.inventoryWandItem)) | ||||
|     val meta = item.itemMeta | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.inventoryWandItem))) | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.inventoryWandItemName))) | ||||
|     item.itemMeta = meta | ||||
|     return item | ||||
| } | ||||
| @Suppress("deprecation") | ||||
| private fun getKbStickItem(): ItemStack { | ||||
|     val item = ItemStack(Material.STICK) | ||||
|     val item = ItemStack(Material.valueOf(Config.kbStickItem)) | ||||
|     val meta = item.itemMeta | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.kbStickItem))) | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.kbStickItemName))) | ||||
|     meta.addEnchant(Enchantment.KNOCKBACK, 10, true) | ||||
|     item.itemMeta = meta | ||||
|     return item | ||||
| } | ||||
| @Suppress("deprecation") | ||||
| private fun getVanishItem(): ItemStack { | ||||
|     val item = ItemStack(Material.BARRIER) | ||||
|     val item = ItemStack(Material.valueOf(Config.vanishItem)) | ||||
|     val meta = item.itemMeta | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.vanishItem))) | ||||
|     meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.vanishItemName))) | ||||
|     item.itemMeta = meta | ||||
|     return item | ||||
| } | ||||
| @@ -1,5 +1,6 @@ | ||||
| package me.fivevl.staff | ||||
|  | ||||
| import me.fivevl.staff.commands.InvseeCommand | ||||
| import me.fivevl.staff.commands.StaffModeCommand | ||||
| import me.fivevl.staff.commands.VanishCommand | ||||
| import me.fivevl.staff.listeners.JoinListener | ||||
| @@ -14,6 +15,7 @@ class Main : JavaPlugin() { | ||||
|  | ||||
|         getCommand("staffmode")!!.setExecutor(StaffModeCommand()) | ||||
|         getCommand("vanish")!!.setExecutor(VanishCommand()) | ||||
|         getCommand("invsee")!!.setExecutor(InvseeCommand()) | ||||
|  | ||||
|         Bukkit.getPluginManager().registerEvents(JoinListener(), this) | ||||
|         logger.info("Staff plugin enabled.") | ||||
|   | ||||
| @@ -6,14 +6,13 @@ import net.kyori.adventure.text.minimessage.MiniMessage | ||||
| import org.bukkit.Bukkit | ||||
| import org.bukkit.ChatColor | ||||
| import org.bukkit.Material | ||||
| import org.bukkit.configuration.file.FileConfiguration | ||||
| import org.bukkit.entity.Player | ||||
| import org.bukkit.inventory.Inventory | ||||
| import org.bukkit.inventory.ItemStack | ||||
| import org.bukkit.inventory.PlayerInventory | ||||
|  | ||||
| object Utils { | ||||
|     var instance: Main? = null | ||||
|     val inStaffmode = HashMap<Player, PlayerInventory>() | ||||
|     val inStaffmode = HashMap<Player, Inventory>() | ||||
|     val inVanish = ArrayList<Player>() | ||||
|     @Suppress("deprecation") | ||||
|     fun mm(s: String): Component { | ||||
| @@ -63,8 +62,4 @@ object Utils { | ||||
|             p.sendMessage(mm(getPlaceholders(p, Config.toggleVanishOn))) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     fun getConfig(): FileConfiguration { | ||||
|         return instance!!.config | ||||
|     } | ||||
| } | ||||
							
								
								
									
										27
									
								
								src/main/java/me/fivevl/staff/commands/InvseeCommand.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/main/java/me/fivevl/staff/commands/InvseeCommand.kt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| package me.fivevl.staff.commands | ||||
|  | ||||
| import me.fivevl.staff.Config | ||||
| import me.fivevl.staff.Utils | ||||
| import org.bukkit.command.Command | ||||
| import org.bukkit.command.CommandExecutor | ||||
| import org.bukkit.command.CommandSender | ||||
| import org.bukkit.entity.Player | ||||
|  | ||||
| class InvseeCommand : CommandExecutor { | ||||
|     override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean { | ||||
|         if (sender !is Player) { | ||||
|             sender.sendMessage(Utils.mm(Utils.getPlaceholders(null, Config.mustBePlayer))) | ||||
|             return true | ||||
|         } | ||||
|         val p = sender.player!! | ||||
|         if (!p.hasPermission("staff.invsee")) { | ||||
|             p.sendMessage(Utils.mm(Utils.getPlaceholders(p, Config.noPermission))) | ||||
|             return true | ||||
|         } | ||||
|         if (args.size != 1) { | ||||
|             p.sendMessage(Utils.mm("<red><hover:show_text:Click me to insert command!><click:suggest_command:/invsee >Usage: /invsee <player></click></hover></red>")) | ||||
|             return true | ||||
|         } | ||||
|         return true | ||||
|     } | ||||
| } | ||||
| @@ -10,25 +10,30 @@ toggle-fly-on: "<green>Toggled fly on!</green>" # Message shown when a player to | ||||
| toggle-fly-off: "<red>Toggled fly off!</red>" # Message shown when a player toggles fly off | ||||
|  | ||||
| # In this section of the config you can change the items given to you in staffmode. Please do not use colors here. | ||||
| 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" | ||||
| staffmode-hotbar: # List of items to give the player when they toggle staffmode, available items: "DISABLE_STAFFMODE", "FREEZE_WAND", "INVENTORY_WAND", "KB_STICK", "VANISH_ITEM" | ||||
|   1: "DISABLE_STAFFMODE" | ||||
|   2: "AIR" | ||||
|   2: "" | ||||
|   3: "FREEZE_WAND" | ||||
|   4: "AIR" | ||||
|   4: "" | ||||
|   5: "INVENTORY_WAND" | ||||
|   6: "AIR" | ||||
|   6: "" | ||||
|   7: "KB_STICK" | ||||
|   8: "AIR" | ||||
|   8: "" | ||||
|   9: "VANISH_ITEM" | ||||
| # For items, please use `&` color codes. | ||||
| items: | ||||
|     DISABLE_STAFFMODE: | ||||
|         name: "&cDisable Staffmode" | ||||
|     FREEZE_WAND: | ||||
|         name: "&cFreeze Wand" | ||||
|     INVENTORY_WAND: | ||||
|         name: "&cInventory Wand" | ||||
|     KB_STICK: | ||||
|         name: "&cKnockback Stick" | ||||
|     VANISH_ITEM: | ||||
|         name: "&cVanish" | ||||
|   DISABLE_STAFFMODE: | ||||
|     item: "LIME_DYE" | ||||
|     name: "&cDisable Staffmode" | ||||
|   FREEZE_WAND: | ||||
|     item: "CHAIN" | ||||
|     name: "&bFreeze Wand" | ||||
|   INVENTORY_WAND: | ||||
|     item: "BLAZE_ROD" | ||||
|     name: "&cInventory Wand" | ||||
|   KB_STICK: | ||||
|     item: "STICK" | ||||
|     name: "&cKnockback Stick" | ||||
|   VANISH_ITEM: | ||||
|     item: "BARRIER" | ||||
|     name: "&rVanish" | ||||
| @@ -13,3 +13,5 @@ commands: | ||||
|     description: Vanish from all players! | ||||
|     aliases: | ||||
|       - v | ||||
|   invsee: | ||||
|     description: View someones inventory. | ||||
		Reference in New Issue
	
	Block a user
	 5vl
					5vl