Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.mcbukkitdev.EssentialsCmd;
- import org.bukkit.ChatColor;
- import org.bukkit.GameMode;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- public class gm implements CommandExecutor{
- //Main Plugin
- private main plugin;
- public gm(main instance){
- this.plugin = instance;
- }
- // Strings
- public static final String Prefix = ChatColor.GRAY + "[" + ChatColor.GOLD + "EssentialsCmd" + ChatColor.GRAY + "]";
- //Commands
- public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
- //Player = Sender
- Player p = (Player) sender;
- //Command: /gm
- if(cmd.getName().equalsIgnoreCase("gm")){
- if(p.hasPermission("ecmd.gm") || p.isOp() || p.hasPermission("ecmd.*")){
- if (args.length == 0) {
- p.sendMessage(Prefix + ChatColor.DARK_RED + "Please use: /gm <0|1>");
- }
- if (args[0].equals("0")){
- p.setGameMode(GameMode.SURVIVAL);
- p.sendMessage(Prefix + ChatColor.WHITE + " Your gamemode is now" + ChatColor.RED + " Survival");
- }
- if (args[0].equals("1")){
- p.setGameMode(GameMode.CREATIVE);
- p.sendMessage(Prefix + ChatColor.WHITE + " Your gamemode is now" + ChatColor.RED + " Creative");
- }
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement