mirror of
				https://github.com/PlaceholderAPI/PlaceholderAPI
				synced 2025-10-31 06:12:28 +01:00 
			
		
		
		
	Require a player be specified when using /papi parse command
This commit is contained in:
		| @@ -20,19 +20,19 @@ | ||||
|  */ | ||||
| package me.clip.placeholderapi.commands; | ||||
|  | ||||
| import java.util.Set; | ||||
| import me.clip.placeholderapi.PlaceholderAPI; | ||||
| import me.clip.placeholderapi.PlaceholderAPIPlugin; | ||||
| import me.clip.placeholderapi.expansion.PlaceholderExpansion; | ||||
| import me.clip.placeholderapi.util.Msg; | ||||
| import org.apache.commons.lang.StringUtils; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.OfflinePlayer; | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandExecutor; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
|  | ||||
| import java.util.Set; | ||||
|  | ||||
| public class PlaceholderAPICommands implements CommandExecutor { | ||||
|  | ||||
|   private PlaceholderAPIPlugin plugin; | ||||
| @@ -62,7 +62,7 @@ public class PlaceholderAPICommands implements CommandExecutor { | ||||
|             "&fList all placeholder expansions that are currently active", | ||||
|             "&b/papi info <placeholder name>", | ||||
|             "&fView information for a specific expansion", | ||||
| 				"&b/papi parse <...args>", | ||||
|             "&b/papi parse <(playername)/me> <...args>", | ||||
|             "&fParse a String with placeholders", | ||||
|             "&b/papi parserel <player one> <player two> <...args>", | ||||
|             "&fParse a String with relational placeholders", | ||||
| @@ -167,7 +167,7 @@ public class PlaceholderAPICommands implements CommandExecutor { | ||||
|         } | ||||
|  | ||||
|         return true; | ||||
| 			} else if (args.length > 1 && args[0].equalsIgnoreCase("parse")) { | ||||
|       } else if (args.length > 2 && args[0].equalsIgnoreCase("parse")) { | ||||
|  | ||||
|         if (!(s instanceof Player)) { | ||||
|           Msg.msg(s, "&cThis command can only be used in game!"); | ||||
| @@ -179,12 +179,20 @@ public class PlaceholderAPICommands implements CommandExecutor { | ||||
|           } | ||||
|         } | ||||
|  | ||||
| 				Player p = (Player) s; | ||||
|         OfflinePlayer pl = null; | ||||
|  | ||||
| 				String parse = StringUtils.join(args, " ", 1, args.length); | ||||
| 				 | ||||
| 				Msg.msg(s, "&r" + PlaceholderAPI.setPlaceholders(p, parse)); | ||||
|         if (args[1].equalsIgnoreCase("me")) { | ||||
|           pl = ((Player) s).getPlayer(); | ||||
|         } else { | ||||
|           pl = Bukkit.getOfflinePlayer(args[1]); | ||||
|         } | ||||
|  | ||||
|         if (pl == null || !pl.hasPlayedBefore()) { | ||||
|           Msg.msg(s, "&cFailed to find player: &f" + args[1]); | ||||
|           return true; | ||||
|         } | ||||
|         String parse = StringUtils.join(args, " ", 2, args.length); | ||||
|         Msg.msg(s, "&r" + PlaceholderAPI.setPlaceholders(pl, parse)); | ||||
|         return true; | ||||
|       } else if (args.length > 3 && args[0].equalsIgnoreCase("parserel")) { | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user