Hey i am working on my server (new) called Hostel-Network and i am working on the Core plugin and i am stuck on the part with the changing the gamemode in the command executor class here is the GameModeCreative class: package HostelGamer.HostelNetworkCore; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class GameModeCreatetive implements CommandExecutor { private Main plugin; public void GameModeCreative(Main plugin) { this.plugin = plugin; } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = (Player) sender; if(cmd.getName().equalsIgnoreCase("Creative")){ if(player.hasPermission("HostelNetwork.Creative")){ player.getGameMode().CREATIVE. } else { player.sendMessage("[Hostel-Network] You Do Not Have Permission (HoselNetwork.Creative)"); } } return false; } } Thanks in Advance.
Try player.setGameMode(GameMode.CREATIVE) Oh, and inside the "if" that is checking for your command, return true so Bukkit knows you handled that command. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Example: [NOT TESTED] Code:java package com.ste.Help; import org.bukkit.Bukkit;import org.bukkit.ChatColor;import org.bukkit.GameMode;import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.entity.Player;import org.bukkit.plugin.java.JavaPlugin; public class Help extends JavaPlugin { public void onEnable() {Bukkit.getServer().getLogger().info("Help Enabled!");} public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player p = (Player) sender; if(cmd.getName().equalsIgnoreCase("Creative")) {if(p.hasPermission("HostelNetwork.Creative")) {p.setGameMode(GameMode.CREATIVE);} else {p.sendMessage(ChatColor.RED + "You Don't Have Permission BOY!");}}return true;} } EDIT: I added a ChatColor in and changed Player player to Player p = (Player) sender; EDIT#2: I changed it all up a bit. So it's different but does what yours does EDIT#3: Added return true; so Bukkit knows that you have done the command EDIT#4: Easy way I think compared to yours but we all have our difference in coding