mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 17:23:42 +01:00 
			
		
		
		
	Update command registration for /mcgod
This commit is contained in:
		| @@ -8,6 +8,7 @@ import org.bukkit.command.PluginCommand; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.commands.admin.AddlevelsCommand; | ||||
| import com.gmail.nossr50.commands.admin.AddxpCommand; | ||||
| import com.gmail.nossr50.commands.admin.McgodCommand; | ||||
| import com.gmail.nossr50.locale.LocaleLoader; | ||||
| import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand; | ||||
| import com.gmail.nossr50.skills.archery.ArcheryCommand; | ||||
| @@ -131,4 +132,13 @@ public final class CommandRegistrationHelper { | ||||
|         command.setUsage(LocaleLoader.getString("Commands.Usage.3", "addxp", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]", "<" + LocaleLoader.getString("Commands.Usage.Skill") + ">", "<" + LocaleLoader.getString("Commands.Usage.XP") + ">")); | ||||
|         command.setExecutor(new AddxpCommand()); | ||||
|     } | ||||
|  | ||||
|     public static void registerMcgodCommand() { | ||||
|         PluginCommand command = mcMMO.p.getCommand("mcgod"); | ||||
|         command.setDescription(LocaleLoader.getString("Commands.Description.mcgod")); | ||||
|         command.setPermission("mcmmo.commands.mcgod"); | ||||
|         command.setPermissionMessage(permissionsMessage); | ||||
|         command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcgod", "[" + LocaleLoader.getString("Commands.Usage.Player") + "]")); | ||||
|         command.setExecutor(new McgodCommand()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -23,11 +23,7 @@ public class McgodCommand implements CommandExecutor { | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
|             if (!Permissions.mcgodCommand(sender)) { | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
|             profile = Users.getProfile((Player) sender); | ||||
|             profile = Users.getPlayer((Player) sender).getProfile(); | ||||
|  | ||||
|             if (profile == null) { | ||||
|                 sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist")); | ||||
| @@ -43,11 +39,13 @@ public class McgodCommand implements CommandExecutor { | ||||
|  | ||||
|             profile.toggleGodMode(); | ||||
|             return true; | ||||
|  | ||||
|         case 1: | ||||
|             if (!Permissions.hasPermission(sender, "mcmmo.commands.mcgod.others")) { | ||||
|                 sender.sendMessage(command.getPermissionMessage()); | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
|             McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]); | ||||
|  | ||||
|             // If the mcMMOPlayer doesn't exist, create a temporary profile and | ||||
| @@ -77,6 +75,7 @@ public class McgodCommand implements CommandExecutor { | ||||
|  | ||||
|             profile.toggleGodMode(); | ||||
|             return true; | ||||
|  | ||||
|         default: | ||||
|             return false; | ||||
|         } | ||||
|   | ||||
| @@ -25,7 +25,6 @@ import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory; | ||||
| import com.gmail.nossr50.chat.commands.ACommand; | ||||
| import com.gmail.nossr50.chat.commands.PCommand; | ||||
| import com.gmail.nossr50.commands.CommandRegistrationHelper; | ||||
| import com.gmail.nossr50.commands.admin.McgodCommand; | ||||
| import com.gmail.nossr50.commands.admin.McrefreshCommand; | ||||
| import com.gmail.nossr50.commands.admin.MmoeditCommand; | ||||
| import com.gmail.nossr50.commands.admin.SkillResetCommand; | ||||
| @@ -397,7 +396,7 @@ public class mcMMO extends JavaPlugin { | ||||
|         getCommand("mcremove").setExecutor(new McremoveCommand()); | ||||
|         getCommand("mcability").setExecutor(new McabilityCommand()); | ||||
|         getCommand("mcc").setExecutor(new MccCommand()); | ||||
|         getCommand("mcgod").setExecutor(new McgodCommand()); | ||||
|         CommandRegistrationHelper.registerMcgodCommand(); | ||||
|         getCommand("mcmmo").setExecutor(new McmmoCommand()); | ||||
|         getCommand("mcrefresh").setExecutor(new McrefreshCommand()); | ||||
|         getCommand("mctop").setExecutor(new MctopCommand()); | ||||
|   | ||||
| @@ -688,4 +688,5 @@ Smelting.SkillName=SMELTING | ||||
| #COMMAND DESCRIPTIONS | ||||
| Commands.Description.addlevels=Add mcMMO levels to a user | ||||
| Commands.Description.addxp=Add mcMMO XP to a user | ||||
| Commands.Description.mcgod=Toggles mcMMO god-mode on/off | ||||
| Commands.Description.Skill=Detailed mcMMO skill info for {0} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 GJ
					GJ