mirror of
				https://github.com/5vl/Staff.git
				synced 2025-10-31 01:43:35 +00:00 
			
		
		
		
	Placeholderapi support, making config now
This commit is contained in:
		
							
								
								
									
										10
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -103,6 +103,10 @@ | ||||
|             <id>sonatype</id> | ||||
|             <url>https://oss.sonatype.org/content/groups/public/</url> | ||||
|         </repository> | ||||
|         <repository> | ||||
|             <id>placeholderapi</id> | ||||
|             <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url> | ||||
|         </repository> | ||||
|     </repositories> | ||||
|  | ||||
|     <dependencies> | ||||
| @@ -123,5 +127,11 @@ | ||||
|             <version>${kotlin.version}</version> | ||||
|             <scope>test</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>me.clip</groupId> | ||||
|             <artifactId>placeholderapi</artifactId> | ||||
|             <version>2.11.1</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
| </project> | ||||
|   | ||||
							
								
								
									
										7
									
								
								src/main/java/me/fivevl/staff/Config.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/main/java/me/fivevl/staff/Config.kt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| package me.fivevl.staff | ||||
|  | ||||
| import org.bukkit.configuration.file.FileConfiguration | ||||
|  | ||||
| object Config { | ||||
|     var config: FileConfiguration? = null | ||||
| } | ||||
| @@ -5,8 +5,10 @@ import org.bukkit.plugin.java.JavaPlugin | ||||
|  | ||||
| class Main : JavaPlugin() { | ||||
|     override fun onEnable() { | ||||
|         logger.info("Staff plugin enabled.") | ||||
|         saveDefaultConfig() | ||||
|         Config.config = config | ||||
|         getCommand("staffmode")!!.setExecutor(StaffModeCommand()) | ||||
|         logger.info("Staff plugin enabled.") | ||||
|     } | ||||
|  | ||||
|     override fun onDisable() { | ||||
| @@ -17,12 +19,11 @@ class Main : JavaPlugin() { | ||||
|     /* | ||||
|         FEATURES: | ||||
|             DONE: | ||||
|  | ||||
|                 - PlaceholderAPI support | ||||
|             NOT DONE: | ||||
|                 - Staff mode (Invisibility/vanish, fly, items) | ||||
|                 - Freeze (Command and freeze wand in staff mode) | ||||
|                 - Open inventory (Command and wand in staff mode) with permission for being able to edit it | ||||
|                 - Knockback Stick (Extra, useful to check if the player has no kb) | ||||
|                 - PlaceholderAPI support | ||||
|     */ | ||||
| } | ||||
|   | ||||
| @@ -1,7 +1,9 @@ | ||||
| package me.fivevl.staff | ||||
|  | ||||
|  | ||||
| import me.clip.placeholderapi.PlaceholderAPI | ||||
| import net.md_5.bungee.api.ChatColor | ||||
| import org.bukkit.entity.Player | ||||
| import java.util.regex.Pattern | ||||
|  | ||||
| object Utils { | ||||
| @@ -17,4 +19,7 @@ object Utils { | ||||
|         } | ||||
|         return ChatColor.translateAlternateColorCodes('&', s2) | ||||
|     } | ||||
|     fun getPlaceholders(p: Player?, s: String): String { | ||||
|         return PlaceholderAPI.setPlaceholders(p, s) | ||||
|     } | ||||
| } | ||||
| @@ -1,11 +1,18 @@ | ||||
| package me.fivevl.staff.commands | ||||
|  | ||||
| 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 StaffModeCommand : CommandExecutor { | ||||
|     override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean { | ||||
|         if (sender !is Player) { | ||||
|             sender.sendMessage(Utils.hex(Utils.getPlaceholders(null, "&cYou must be a player to use this command!"))) | ||||
|             return true | ||||
|         } | ||||
|         val p = sender.player | ||||
|         return true | ||||
|     } | ||||
| } | ||||
							
								
								
									
										1
									
								
								src/main/resources/config.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/main/resources/config.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| must-be-player: "&cYou must be a player to use this command!" | ||||
		Reference in New Issue
	
	Block a user
	 5vl
					5vl