Plugin category: I don't know, Admin Tools, Fun. I think Suggested name: Disguise What I want: I'd like to add No Enough Permission error message. Like ' You don't have enough permissions to use that command. '. I tried many ways but no one worked. Thank you! <3 Also, skim-reading is much easier with paragraphs! Ideas for commands: - Ideas for permissions: use.disguise When I'd like it by: - Sorry for my english. ! FILLED!
Here you go: (I just added two lines of code) Code: package com.mcsg.disg; import de.inventivegames.nickname.Nicks; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Random; import java.util.UUID; import org.bukkit.ChatColor; import org.bukkit.Server; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfigurationOptions; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitScheduler; public class Main extends JavaPlugin implements Listener { public void onEnable() { getConfig().options().copyDefaults(true); saveDefaultConfig(); saveConfig(); getServer().getPluginManager().registerEvents(this, this); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player o = (Player)sender; if (!(o.hasPermission("use.disguise") || o.hasPermission("use.disguisecheck") || o.hasPermission("admin.reload"))) { o.sendMessage(ChatColor.DARK_RED + "You do not have permission to do this."); } if ((cmd.getName().equalsIgnoreCase("d")) && (o.hasPermission("use.disguise"))) { setname(o); } if (cmd.getName().equalsIgnoreCase("rd")) { if ((args[0].equalsIgnoreCase("reload")) && (o.hasPermission("admin.reload"))) { reloadConfig(); String prefix = getConfig().getString("prefix").replace("&", "§"); o.sendMessage(prefix + " §aDisguise Config Reloaded !"); } if (args[0].equalsIgnoreCase("help")) { String prefix = getConfig().getString("prefix").replace("&", "§"); o.sendMessage(prefix + " §a§m------[ §6§lDisguise §a§m]-----"); o.sendMessage(prefix + " §9This Plugin Coded By §4wSparkles"); o.sendMessage(prefix + " §4§lWarning! §e§l/rd §ccommand is not working, only this command don`t work."); o.sendMessage(prefix + " §9For Disguise Help : §a/rd help"); o.sendMessage(prefix + " §9For Disguise Command : §a/d - /disguise"); o.sendMessage(prefix + " §9For UnDisguise Command : §a/ud - /undisguise "); o.sendMessage(prefix + " §9For Reload The Config : §a/rd reload"); } } if ((cmd.getName().equalsIgnoreCase("ud")) && (o.hasPermission("use.disguise"))) { Nicks.removeNick(o.getUniqueId()); Nicks.removeSkin(o.getUniqueId()); o.setPlayerListName(o.getName()); o.setDisplayName(o.getName()); String prefix = getConfig().getString("prefix").replace("&", "§"); o.sendMessage(prefix + " §9You have been undisguised§8."); } if (cmd.getName().equalsIgnoreCase("uuid")) { o.sendMessage(o.getUniqueId().toString()); } if ((cmd.getName().equalsIgnoreCase("dc")) && (o.hasPermission("use.disguisecheck"))) { final Player target = getServer().getPlayer(args[0]); final String isim = Nicks.getNick(target.getUniqueId()); final UUID skini = Nicks.getSkin(target.getUniqueId()); Nicks.removeNick(target.getUniqueId()); Nicks.removeSkin(target.getUniqueId()); target.setPlayerListName(target.getName()); String prefix = getConfig().getString("prefix").replace("&", "§"); o.sendMessage(prefix + " §8[§a§l" + target.getDisplayName() + "§8] §e§m->->->-> §8[§c" + target.getName() + "§8]"); getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { target.setPlayerListName(isim); Nicks.setCustomSkin(target.getUniqueId(), skini); Nicks.setNick(target.getUniqueId(), isim); } } , 20L); } return false; } public void setname(Player o) { List r_taunt = getConfig().getStringList("ak1"); Random rand = new Random(); int choice = rand.nextInt(r_taunt.size()); List ak2 = getConfig().getStringList("ak2"); Random rand1 = new Random(); int choice1 = rand1.nextInt(ak2.size()); List ak3 = getConfig().getStringList("ak3"); Random rand2 = new Random(); int choice2 = rand2.nextInt(ak3.size()); List skin = getConfig().getStringList("skins"); Random randskin = new Random(); int choiceskin = randskin.nextInt(skin.size()); String skinsec = (String)skin.get(choiceskin); Random random = new Random(); int sans1 = random.nextInt(2); if (sans1 == 1) { List list = getConfig().getStringList("dk"); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); String kayit = o.getName() + "-->" + (String)r_taunt.get(choice) + (String)ak2.get(choice1) + (String)ak3.get(choice2) + " " + dateFormat.format(date); List dkm = getConfig().getStringList("dk"); getConfig().createSection(kayit); String prefix = getConfig().getString("prefix").replace("&", "§"); o.sendMessage(prefix + " §c§lWarning! §cThis command is logged!"); o.sendMessage(prefix + " §cStaff can see your true username while using this command."); o.sendMessage(prefix + " §9You now appear as §a" + (String)r_taunt.get(choice) + (String)ak2.get(choice1) + (String)ak3.get(choice2)); o.sendMessage(prefix + " §9To undisguise, use §8[§e/undisguise§8]§f."); o.setDisplayName((String)r_taunt.get(choice) + (String)ak2.get(choice1) + (String)ak3.get(choice2)); o.setPlayerListName((String)r_taunt.get(choice) + (String)ak2.get(choice1) + (String)ak3.get(choice2)); Nicks.setNick(o.getUniqueId(), (String)r_taunt.get(choice) + (String)ak2.get(choice1) + (String)ak3.get(choice2)); Nicks.setSkin(o.getUniqueId(), skinsec); o.setPlayerListName((String)r_taunt.get(choice) + (String)ak2.get(choice1) + (String)ak3.get(choice2)); saveConfig(); } else if (sans1 == 0) { List dkm = getConfig().getStringList("dk"); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); String kayit = o.getName() + "-->" + (String)r_taunt.get(choice) + (String)ak2.get(choice1) + " " + dateFormat.format(date); getConfig().createSection(kayit); String prefix = getConfig().getString("prefix").replace("&", "§"); o.sendMessage(prefix + " §c§lWarning! §cThis command is logged!"); o.sendMessage(prefix + " §cStaff can see your true username while using this command."); o.sendMessage(prefix + " §9You now appear as §a" + (String)r_taunt.get(choice) + (String)ak2.get(choice1)); o.sendMessage(prefix + " §9To undisguise, use §8[§e/undisguise§8]§f."); o.setDisplayName((String)r_taunt.get(choice) + (String)ak2.get(choice1)); o.setPlayerListName((String)r_taunt.get(choice) + (String)ak2.get(choice1)); Nicks.setNick(o.getUniqueId(), (String)r_taunt.get(choice) + (String)ak2.get(choice1)); Nicks.setSkin(o.getUniqueId(), skinsec); o.setPlayerListName((String)r_taunt.get(choice) + (String)ak2.get(choice1)); saveConfig(); } } }