Config Generation Issue!

Discussion in 'Plugin Development' started by xManfro, Aug 16, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    xManfro

    My default configuration file is different to the generated file!


    My default config is this


    Code:
    ###########################################################################
    #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^##
    #|                                Help!                                    |#
    #________________________________________________________________________##
    ###########################################################################
     
    # Default configuration file for PlayerVanish - xManfro
    # Change what ever you would like. Only change the text after the colon.
    # After you save each change you have to reload the server for the changes to take place!
    # DO NOT
    #    - Delete any text before the colon!
    #    - Add any text other than text after a colon.
     
    #------------------------------------------------------------------------##
    #|                                Permissions!                            |#
    #------------------------------------------------------------------------##
     
    # By changing these configurations you will change the text that each of the options control
    prefix: PlayerVanish
     
    # ONLY CHANGE THE TEXT AFTER THE ChatColor.  If you change anything else it will not work!
    prefixcolor: RED
     
    permission-error: Sorry, you do not have permission to execute this command!
     
    command-error: Sorry, this command does not exist! Use /pv help for all commands.
     
    join-message: All players have been hidden. Use the item given to you to toggle player visiblity.
     
    fake-leave-message: has left the game.
     
    fake-join-message: has joined the game.
    

    And the generated config is this.

    Code:
    #
    # Default configuration file for PlayerVanish - xManfro
    # Change what ever you would like. Only change the text after the colon.
    # After you save each change you have to reload the server for the changes to take place!
    # DO NOT
    prefix: PlayerVanish
    prefix-color: RED
    permission-error: Sorry, you do not have permission to execute this command!
    command-error: Sorry, this command does not exist! Use /pv help for all commands.
    join-message: All players have been hidden. Use the item given to you to toggle player visiblity.
    fake-leave-message: has left the game.
    fake-join-message: has joined the game.
    

    My main class
    Code:java
    1. package com.name.vanish;
    2.  
    3. // import java.util.Arrays;
    4.  
    5. // import java.util.ArrayList;
    6. // import java.util.List;
    7.  
    8. import java.util.ArrayList;
    9. import java.util.List;
    10. import java.util.logging.Logger;
    11.  
    12. // import net.gravitydevelopment.updater.Updater;
    13.  
    14. import org.bukkit.Bukkit;
    15. import org.bukkit.ChatColor;
    16. // import org.bukkit.Material;
    17. // import org.bukkit.Material;
    18. import org.bukkit.entity.Player;
    19. // import org.bukkit.event.EventHandler;
    20. import org.bukkit.event.Listener;
    21.  
    22. // import org.bukkit.inventory.ItemStack;
    23. // import org.bukkit.inventory.meta.BookMeta;
    24. // import org.bukkit.event.player.PlayerJoinEvent;
    25. // import org.bukkit.inventory.ItemStack;
    26. import org.bukkit.plugin.PluginDescriptionFile;
    27. import org.bukkit.plugin.java.JavaPlugin;
    28. import org.bukkit.potion.PotionEffect;
    29. import org.bukkit.potion.PotionEffectType;
    30.  
    31. public class PlayerVanish extends JavaPlugin implements Listener {
    32.  
    33. // @EventHandler
    34. // public void onPlayerJoin(PlayerJoinEvent e) {
    35. // Player player = e.getPlayer();
    36. // e.setJoinMessage(ChatColor.GRAY + "[" + ChatColor.RED +
    37. // getConfig().getString("prefix")
    38. // + ChatColor.GRAY + "] " + ChatColor.GOLD +
    39. // getConfig().getString("join-message"));
    40. // hideAllPlayers(player);
    41. // ItemStack visiblity = new ItemStack(Material.NETHER_STAR);
    42. //
    43. //
    44. //
    45. //
    46. //
    47. // }
    48.  
    49. PluginDescriptionFile pdfFile = null;
    50.  
    51. List<String> toggled = new ArrayList<String>();
    52.  
    53. ArrayList<Player> cooldown = new ArrayList<Player>();
    54.  
    55. ChatColor prefixcolour = ChatColor.valueOf("RED");
    56.  
    57. /*
    58.   * This does not work // Updater updater = new Updater(this, 82674,
    59.   * this.getFile(), Updater.UpdateType.DEFAULT, false);
    60.   */
    61. private static PlayerVanish plugin;
    62. public final Logger logger = Logger.getLogger("Minecraft");
    63.  
    64. public void onEnable() {
    65.  
    66. plugin = this;
    67.  
    68. // getCommand("show").setExecutor(new CommandHandler());
    69. // getCommand("hide").setExecutor(new CommandHandler());
    70. getCommand("pv").setExecutor(new CommandHandler());
    71. // getCommand("about").setExecutor(new CommandHandler());
    72. // getCommand("pvo").setExecutor(new CommandHandler());
    73. // getCommand("ip").setExecutor(new CommandHandler());
    74.  
    75.  
    76. this.logger.info("[PlayerVanish] "
    77. + "Edit the config to change certain aspects of the plugin! Check the plugins folder to find it!");
    78.  
    79. pdfFile = this.getDescription();
    80.  
    81. getConfig().options().copyDefaults(true);
    82. saveConfig();
    83. }
    84.  
    85. // @EventHandler
    86. // public void onPlayerJoin(PlayerJoinEvent event) {
    87. // Player player = event.getPlayer();
    88. // event.setJoinMessage(ChatColor.GRAY + "[" + ChatColor.RED
    89. // + "PlayerVanish" + ChatColor.GRAY + "] " + ChatColor.GOLD
    90. // + "Hello " + player.getName() + ", Players have been hidden."
    91. // + ChatColor.AQUA + "Use /show to show players.");
    92. // hideAllPlayers(player);
    93. // }
    94.  
    95. public void hideAllPlayers(Player player) {
    96. for (Player p : Bukkit.getOnlinePlayers())
    97. player.hidePlayer(p);
    98. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    99. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    100. + ChatColor.GOLD + "Hello " + player.getName()
    101. + ", Players have now been hidden." + ChatColor.DARK_BLUE
    102. + "Use /pv show to show players.");
    103. }
    104.  
    105. public void showAllPlayers(Player player) {
    106. for (Player p : Bukkit.getOnlinePlayers())
    107. player.showPlayer(p);
    108. player.sendMessage(ChatColor.GRAY
    109. + "["
    110. + ChatColor.RED
    111. // Change the prefix in the config.
    112. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    113. + ChatColor.GOLD + "Hello " + player.getName()
    114. + ", Players have now been shown. " + ChatColor.DARK_BLUE
    115. + "Use /pv hide to hide players.");
    116. }
    117.  
    118. public void sendMessage(Player player) {
    119. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "Name"
    120. + ChatColor.GRAY + "] " + ChatColor.GREEN + pdfFile.getName());
    121. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "Version"
    122. + ChatColor.GRAY + "] " + ChatColor.GREEN
    123. + pdfFile.getVersion());
    124. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "Coder"
    125. + ChatColor.GRAY + "] " + ChatColor.BLUE + "xManfro");
    126. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "Description"
    127. + ChatColor.GRAY + "] " + ChatColor.GREEN
    128. + pdfFile.getDescription());
    129.  
    130. }
    131.  
    132. public void sendMessage2(Player player) {
    133.  
    134. player.sendMessage(ChatColor.GRAY
    135. + "["
    136. + ChatColor.RED
    137. // Change the prefix in the config.
    138. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    139. + ChatColor.GOLD + "Hello " + player.getName()
    140. + ", Your IP Address is: " + ChatColor.RED
    141. + player.getAddress().getAddress());
    142. }
    143.  
    144. public void SendPermissionError(Player sender) {
    145. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    146. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    147. + ChatColor.DARK_GREEN
    148. + getConfig().getString("permission-error"));
    149. }
    150.  
    151. public void SendCommandError(Player sender) {
    152. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    153. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    154. + ChatColor.DARK_GREEN + getConfig().getString("command-error"));
    155.  
    156. }
    157.  
    158. public void sendMessage3(Player sender) {
    159. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    160. + "PlayerVanish Commands" + ChatColor.GRAY + "]\n"
    161. + ChatColor.GOLD + ChatColor.BOLD + "-/pv hide "
    162. + ChatColor.BLUE + "Hides all players!\n" + ChatColor.GOLD
    163. + ChatColor.BOLD + "-/pv show " + ChatColor.BLUE
    164. + "Shows all players!\n" + ChatColor.GOLD + ChatColor.BOLD
    165. + "-/pv ip " + ChatColor.BLUE + "Gives you your ip!\n"
    166. + ChatColor.GOLD + ChatColor.BOLD + "-/pv about "
    167. + ChatColor.BLUE + "Gives a description of the plugin\n"
    168. + ChatColor.GOLD + ChatColor.BOLD + "-/pv owner "
    169. + ChatColor.BLUE + "Gives a book explaining permissions\n"
    170. + ChatColor.GOLD + ChatColor.BOLD + "-/pv info "
    171. + ChatColor.BLUE + "Gives information about you!\n"
    172. + ChatColor.GOLD + ChatColor.BOLD + "-/pv sinfo "
    173. + ChatColor.BLUE + "Gives information about the server!\n"
    174. + ChatColor.GOLD + ChatColor.BOLD + "-/pv fleave "
    175. + ChatColor.BLUE + "Sends a fake leave message!\n"
    176. + ChatColor.GOLD + ChatColor.BOLD + "-/pv fjoin "
    177. + ChatColor.BLUE + "Sends a fake join message!\n");
    178.  
    179. }
    180.  
    181. public void SendCommandErrorPV(Player sender) {
    182. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    183. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    184. + ChatColor.DARK_RED + "Hello " + sender.getName() + ", "
    185. + ChatColor.GOLD + "Use /pv help for all the commands.");
    186.  
    187. }
    188.  
    189. public void sendMessage4(Player sender) {
    190. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    191. + "Player Information" + ChatColor.GRAY + "] " + ChatColor.GOLD
    192. + "\nHealth: " + ChatColor.RED + sender.getHealth()
    193. + ChatColor.GOLD + "\nXP Level: " + ChatColor.RED
    194. + sender.getLevel() + ChatColor.GOLD + "\nHunger: "
    195. + ChatColor.RED + sender.getFoodLevel() + ChatColor.GOLD
    196. + "\nSaturation: " + ChatColor.RED + sender.getSaturation()
    197. + ChatColor.GOLD + "\nGamemode: " + ChatColor.RED
    198. + sender.getGameMode() + ChatColor.GOLD + "\nFlight: "
    199. + ChatColor.RED + sender.getAllowFlight() + ChatColor.GOLD
    200. + "\nItem In Hand: " + ChatColor.RED + sender.getItemInHand());
    201.  
    202. }
    203.  
    204. // public void sendMessage6(Player player) {
    205. // player.sendMessage(ChatColor.GRAY
    206. // + "["
    207. // + ChatColor.RED
    208. // + getConfig().getString("prefix")
    209. // + ChatColor.GRAY
    210. // + "] "
    211. // + ChatColor.GOLD
    212. // + "You have been given the owners manual of PlayerVanish");
    213. // ItemStack book1 = new ItemStack(Material.WRITTEN_BOOK);
    214. // BookMeta bm1 = (BookMeta) book1.getItemMeta();
    215. //
    216. // bm1.setPages(Arrays
    217. // .asList(
    218. //
    219. // ChatColor.RED
    220. // + "Server Owners and Admins. Use "
    221. // + ChatColor.BLACK
    222. // + ChatColor.BOLD
    223. // + "pv.hide "
    224. // + ChatColor.RED
    225. // + "and "
    226. // + ChatColor.BLACK
    227. // + ChatColor.BOLD
    228. // + "pv.show "
    229. // + ChatColor.RED
    230. // + "to give permissions to hide and show players.\n\n"
    231. // + ChatColor.DARK_BLUE
    232. // + "Other commands -->",
    233. //
    234. // ChatColor.RED
    235. // + "Use "
    236. // + ChatColor.BLACK
    237. // + ChatColor.BOLD
    238. // + "pv.owner "
    239. // + ChatColor.RED
    240. // + "and "
    241. // + ChatColor.BLACK
    242. // + ChatColor.BOLD
    243. // + "pv.ip "
    244. // + ChatColor.RED
    245. // + "To allow usage of /pv ip and /pv owner. "
    246. // +
    247. // "/pv owner should only be allowed to admins or who you deem necessary."));
    248. //
    249. // bm1.setAuthor("xManfro");
    250. // bm1.setTitle("PlayerVanish Owner Manual");
    251. // bm1.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD
    252. // + "PlayerVanish Owner Manual");
    253. // book1.setItemMeta(bm1);
    254. // ((Player) player).getInventory().addItem(book1);
    255. //
    256. // }
    257.  
    258. public static PlayerVanish getInstance() {
    259. return plugin;
    260.  
    261. }
    262.  
    263. public void sendMessage5(Player sender) {
    264. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    265. + "Server Information" + ChatColor.GRAY + "] " + ChatColor.RED
    266. + "\n\nBukkit Version: " + ChatColor.GOLD
    267. + Bukkit.getBukkitVersion() + ChatColor.RED + "\nServer IP: "
    268. + ChatColor.GOLD + Bukkit.getIp() + ChatColor.RED
    269. + "\nWorld Type: " + ChatColor.GOLD + Bukkit.getWorldType());
    270.  
    271. }
    272.  
    273. // public boolean sendMessage8(final Player player) {
    274. //
    275. //
    276. //
    277. //
    278. // if (player.hasPermission("pv.toggle")) {
    279. // if (cooldown.contains(player)) {
    280. // if (!(player instanceof Player)) {
    281. // player.sendMessage(ChatColor.RED
    282. // + "You must be a player to perform this command!");
    283. // return true;
    284. // }
    285. //
    286. // if (toggled.contains(player.getName())) {
    287. // player.sendMessage(ChatColor.GOLD
    288. // + "Players are now visible");
    289. // for (Player p : Bukkit.getOnlinePlayers())
    290. // player.showPlayer(p);
    291. // cooldown.add(player);
    292. // Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new
    293. // Runnable() {
    294. // public void run() {
    295. // cooldown.remove(player);
    296. // }
    297. // }, 100);
    298. // toggled.remove(player.getName());
    299. // return true;
    300. // }
    301. //
    302. // player.sendMessage(ChatColor.GOLD
    303. // + "Players are now hidden");
    304. // for (Player p : Bukkit.getOnlinePlayers())
    305. // player.hidePlayer(p);
    306. // toggled.add(player.getName());
    307. // return true;
    308. //
    309. // }
    310. // player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    311. // + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    312. // + ChatColor.BLUE + "You must wait until you can re use that command!");
    313. // }
    314. //
    315. // return true;
    316. // }
    317.  
    318. public boolean sendMessage7(Player player) {
    319. if (!(player instanceof Player)) {
    320. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    321. + getConfig().getString("prefix") + ChatColor.RED
    322. + "You must be a player to perform this command!");
    323. return false;
    324. }
    325.  
    326. if (toggled.contains(player.getName())) {
    327. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    328. + getConfig().getString("prefix") + ChatColor.GOLD
    329. + "Players are now visible");
    330. for (Player p : Bukkit.getOnlinePlayers())
    331. player.showPlayer(p);
    332. toggled.remove(player.getName());
    333. return true;
    334. }
    335.  
    336. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    337. + getConfig().getString("prefix") + ChatColor.GOLD
    338. + "Players are now hidden");
    339. for (Player p : Bukkit.getOnlinePlayers())
    340. player.hidePlayer(p);
    341. toggled.add(player.getName());
    342. return true;
    343.  
    344. }
    345.  
    346. public void sendMessage9(Player player) {
    347.  
    348. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    349. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    350. + ChatColor.GOLD + "You are now invisible.");
    351. Bukkit.broadcastMessage(ChatColor.YELLOW + player.getDisplayName()
    352. + " " + getConfig().getString("fake-leave-message"));
    353. player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,
    354. 200000, 1));
    355. player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60,
    356. 3));
    357. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60,
    358. 3));
    359.  
    360. }
    361.  
    362. public void sendMessage10(Player player) {
    363.  
    364. player.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED
    365. + getConfig().getString("prefix") + ChatColor.GRAY + "] "
    366. + ChatColor.GOLD + "You are now visible.");
    367. Bukkit.broadcastMessage(ChatColor.YELLOW + player.getDisplayName()
    368. + " " + getConfig().getString("fake-join-message"));
    369.  
    370. player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60,
    371. 3));
    372. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60,
    373. 3));
    374. player.removePotionEffect(PotionEffectType.INVISIBILITY);
    375. }
    376.  
    377. }
    378.  


    And my command handler
    Code:java
    1. package com.name.vanish;
    2.  
    3. // import java.util.Arrays;
    4.  
    5. import java.util.ArrayList;
    6. import java.util.List;
    7.  
    8. // import org.bukkit.Bukkit;
    9. import org.bukkit.ChatColor;
    10. // import org.bukkit.Material;
    11. import org.bukkit.command.Command;
    12. import org.bukkit.command.CommandExecutor;
    13. import org.bukkit.command.CommandSender;
    14. import org.bukkit.entity.Player;
    15. // import org.bukkit.inventory.ItemStack;
    16. // import org.bukkit.inventory.meta.BookMeta;
    17. // import org.bukkit.potion.PotionEffect;
    18. // import org.bukkit.potion.PotionEffectType;
    19. // import org.bukkit.event.EventHandler;
    20. // import org.bukkit.event.player.PlayerJoinEvent;
    21. //
    22.  
    23. public class CommandHandler implements CommandExecutor {
    24.  
    25. List<String> toggled = new ArrayList<String>();
    26.  
    27.  
    28. public boolean onCommand(CommandSender sender, Command cmd, String label,
    29. String[] args) {
    30.  
    31. if (!(sender instanceof Player)) {
    32. sender.sendMessage(ChatColor.BLUE + "PLAYER ONLY COMMAND!");
    33. return false;
    34. }
    35. PlayerVanish pvInst = PlayerVanish.getInstance();
    36. Player player = (Player) sender;
    37.  
    38. if (label.equalsIgnoreCase("pv")
    39. || label.equalsIgnoreCase("playervanish")) {
    40.  
    41. if (args.length < 1) {
    42.  
    43. pvInst.SendCommandError(player);
    44.  
    45. return true;
    46. }
    47. switch (args[0].toLowerCase()) {
    48.  
    49. case "sinfo":
    50. if (player.hasPermission("pv.serverinfo")) {
    51. pvInst.sendMessage5(player);
    52. } else {
    53. pvInst.SendPermissionError(player);
    54. }
    55. break;
    56.  
    57. case "info":
    58. if (player.hasPermission("pv.info")) {
    59.  
    60. pvInst.sendMessage4(player);
    61. } else {
    62. pvInst.SendPermissionError(player);
    63. }
    64. break;
    65.  
    66. case "about":
    67. pvInst.sendMessage(player);
    68. break;
    69. case "hide":
    70. if (player.hasPermission("pv.hide")) {
    71. pvInst.hideAllPlayers(player);
    72. } else {
    73. pvInst.SendPermissionError(player);
    74. }
    75. break;
    76. case "show":
    77. if (player.hasPermission("pv.show")) {
    78. pvInst.showAllPlayers(player);
    79. } else {
    80. pvInst.SendPermissionError(player);
    81. }
    82. break;
    83. case "ip":
    84. if (player.hasPermission("pv.ip")) {
    85. pvInst.sendMessage2(player);
    86. } else {
    87. pvInst.SendPermissionError(player);
    88. }
    89. break;
    90. case "help":
    91. pvInst.sendMessage3(player);
    92. break;
    93.  
    94. case "toggle":
    95. if (player.hasPermission("pv.toggle")) {
    96.  
    97.  
    98.  
    99. pvInst.sendMessage7(player);
    100. } else {
    101. pvInst.SendPermissionError(player);
    102. }
    103. break;
    104. case "test":
    105. // if (player.hasPermission("pv.test")) {
    106. // pvInst.sendMessage8(player);
    107. // } else {
    108. // pvInst.SendPermissionError(player);
    109. // }
    110. // break;
    111. // case "owner":
    112. // if (player.hasPermission("pv.owner")) {
    113. //
    114. //
    115. // pvInst.sendMessage6(player);
    116. //
    117. //
    118. //
    119. // ItemStack book1 = new ItemStack(Material.WRITTEN_BOOK);
    120. // BookMeta bm1 = (BookMeta) book1.getItemMeta();
    121. //
    122. // bm1.setPages(Arrays
    123. // .asList(
    124. //
    125. // ChatColor.RED
    126. // + "Server Owners and Admins. Use "
    127. // + ChatColor.BLACK
    128. // + ChatColor.BOLD
    129. // + "pv.hide "
    130. // + ChatColor.RED
    131. // + "and "
    132. // + ChatColor.BLACK
    133. // + ChatColor.BOLD
    134. // + "pv.show "
    135. // + ChatColor.RED
    136. // + "to give permissions to hide and show players.\n\n"
    137. // + ChatColor.DARK_BLUE
    138. // + "Other commands -->",
    139. //
    140. // ChatColor.RED
    141. // + "Use "
    142. // + ChatColor.BLACK
    143. // + ChatColor.BOLD
    144. // + "pv.owner "
    145. // + ChatColor.RED
    146. // + "and "
    147. // + ChatColor.BLACK
    148. // + ChatColor.BOLD
    149. // + "pv.ip "
    150. // + ChatColor.RED
    151. // + "To allow usage of /pv ip and /pv owner. "
    152. // +
    153. // "/pv owner should only be allowed to admins or who you deem necessary."));
    154. //
    155. // bm1.setAuthor("xManfro");
    156. // bm1.setTitle("PlayerVanish Owner Manual");
    157. // bm1.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD
    158. // + "PlayerVanish Owner Manual");
    159. // book1.setItemMeta(bm1);
    160. // ((Player) s).getInventory().addItem(book1);
    161. //
    162. //
    163. // } else {
    164. // pvInst.SendCommandError(player);
    165. // }
    166. // break;
    167. case "fleave":
    168. if (player.hasPermission("pv.fleave")) {
    169.  
    170. pvInst.sendMessage9(player);
    171.  
    172. } else {
    173. pvInst.SendPermissionError(player);
    174. }
    175. break;
    176.  
    177. case "fjoin":
    178. if (player.hasPermission("pv.fjoin")) {
    179.  
    180. pvInst.sendMessage10(player);
    181.  
    182. } else {
    183. pvInst.SendPermissionError(player);
    184. }
    185. break;
    186.  
    187. default:
    188. pvInst.SendCommandError(player);
    189. break;
    190.  
    191. }
    192. return true;
    193. }
    194. return false;
    195. }
    196. }
    197.  
    198. // THIS IS IN CASE OF LATER NEEDS
    199.  
    200. // // if (label.equalsIgnoreCase("ip"))
    201. // if (player.hasPermission("pv.ip")) {
    202. // PlayerVanish.getInstance().sendMessage1(player);
    203. // } else {
    204. //
    205. //
    206. //
    207. //
    208. // }
    209. // // if (label.equalsIgnoreCase("hide") || label.equalsIgnoreCase("hd"))
    210. // if (player.hasPermission("pv.hide")) {
    211. // PlayerVanish.getInstance().hideAllPlayers(player);
    212. // } else {
    213. // sender.sendMessage(ChatColor.GRAY
    214. // + "["
    215. // + ChatColor.RED
    216. // + "PlayerVanish"
    217. // + ChatColor.GRAY
    218. // + "] "
    219. // + ChatColor.DARK_RED
    220. // + "Sorry "
    221. // + player.getName()
    222. // + ", You do not have permission to execute that command.");
    223. // }
    224. // // if (label.equalsIgnoreCase("show") || label.equalsIgnoreCase("sh"))
    225. // if (player.hasPermission("pv.show")) {
    226. // PlayerVanish.getInstance().showAllPlayers(player);
    227. //
    228. // } else {
    229. // sender.sendMessage(ChatColor.GRAY
    230. // + "["
    231. // + ChatColor.RED
    232. // + "PlayerVanish"
    233. // + ChatColor.GRAY
    234. // + "] "
    235. // + ChatColor.DARK_RED
    236. // + "Sorry "
    237. // + player.getName()
    238. // + ", You do not have permission to execute that command.");
    239. // }
    240. // // if (label.equalsIgnoreCase("about"))
    241. // // PlayerVanish.getInstance().sendMessage(player);
    242. //
    243. // // if (label.equalsIgnoreCase("pv")
    244. // // || label.equalsIgnoreCase("playervanish"))
    245. // if (player.hasPermission("pv.pv")) {
    246. //
    247. // ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
    248. // BookMeta bm = (BookMeta) book.getItemMeta();
    249. //
    250. // bm.setPages(Arrays
    251. // .asList(ChatColor.GREEN
    252. // + ""
    253. // + ChatColor.BOLD
    254. // + ""
    255. // + ChatColor.UNDERLINE
    256. // + "Hello, PlayerVanish is my first plugin! I hope you enjoy it!\n\n"
    257. // + ChatColor.DARK_BLUE
    258. // + ""
    259. // + ChatColor.ITALIC
    260. // + "Use /hide to hide players and /show to show players.\n\n"
    261. // + ChatColor.BLUE
    262. // + "/about will give a description of the plugin.\n"
    263. // + "/pvo will give the owners a description of the permissions.",
    264. //
    265. // ChatColor.DARK_AQUA + "Nothing here.",
    266. // ChatColor.DARK_AQUA + "Just kidding -->",
    267. // ChatColor.DARK_AQUA + "I wasn't kidding :D"));
    268. // bm.setAuthor("TheManfrord");
    269. // bm.setTitle("PlayerVanish");
    270. // bm.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD
    271. // + "PlayerVanish");
    272. // book.setItemMeta(bm);
    273. // ((Player) sender).getInventory().addItem(book);
    274. // } else {
    275. // sender.sendMessage(ChatColor.GRAY
    276. // + "["
    277. // + ChatColor.RED
    278. // + "PlayerVanish"
    279. // + ChatColor.GRAY
    280. // + "] "
    281. // + ChatColor.DARK_RED
    282. // + "Sorry "
    283. // + player.getName()
    284. // + ", You do not have permission to execute that command.");
    285. // }
    286. //
    287. // // if (label.equalsIgnoreCase("pvo"))
    288. // if (player.hasPermission("pv.pvo")) {
    289. //
    290. // ItemStack book1 = new ItemStack(Material.WRITTEN_BOOK);
    291. // BookMeta bm1 = (BookMeta) book1.getItemMeta();
    292. //
    293. // bm1.setPages(Arrays
    294. // .asList(
    295. //
    296. // ChatColor.DARK_RED
    297. // + "Server Owners and Admins. Use "
    298. // + ChatColor.BLACK
    299. // + ChatColor.BOLD
    300. // + "pv.hide "
    301. // + ChatColor.DARK_RED
    302. // + "and "
    303. // + ChatColor.BLACK
    304. // + ChatColor.BOLD
    305. // + "pv.show "
    306. // + ChatColor.DARK_RED
    307. // + "to give permissions to hide and show players.\n\n"
    308. // + ChatColor.DARK_RED
    309. // + "Use "
    310. // + ChatColor.BLACK
    311. // + ChatColor.BOLD
    312. // + "pv.pv "
    313. // + ChatColor.DARK_RED
    314. // + "and "
    315. // + ChatColor.BLACK
    316. // + ChatColor.BOLD
    317. // + "pv.pvo "
    318. // + ChatColor.DARK_RED
    319. // + "to give permissions to use /pv and /pvo.\n"
    320. // + ChatColor.DARK_BLUE
    321. // +
    322. // "If players have permission hide and show they should be allowed /pv!"));
    323. //
    324. // bm1.setAuthor("TheManfrord");
    325. // bm1.setTitle("PlayerVanish Owners Help");
    326. // bm1.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD
    327. // + "PlayerVanish Owners Help");
    328. // book1.setItemMeta(bm1);
    329. // ((Player) sender).getInventory().addItem(book1);
    330. //
    331. // } else {
    332. // sender.sendMessage(ChatColor.GRAY
    333. // + "["
    334. // + ChatColor.RED
    335. // + "PlayerVanish"
    336. // + ChatColor.GRAY
    337. // + "] "
    338. // + ChatColor.DARK_RED
    339. // +
    340. // "No permission to execute this command. Contact an admin if you think this is a problem!");
    341. //
    342. // }
    343. //
    344. // return false;
    345. // }
    346. // }
     
  2. Offline

    mine-care

    DJSkepter is once again right :) may I ask why you comment out the imports?
     
  3. Offline

    EnderTroll68

    To elaborate on what they said, the way Bukkit works is that it can't save a yml file and keep the comments when doing so from a YamlConfiguration in your code. It is just the way it is. If you want to have a file you can change, and one that has comments, separate them. Have one file that is only changed from the files, and one that can be changed from in game. That is how I handle it
     
Thread Status:
Not open for further replies.

Share This Page