Advertisement
KingLinux01

Untitled

Mar 22nd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. package me.KingLinux01;
  2.  
  3. import java.util.Arrays;
  4.  
  5. import org.bukkit.GameMode;
  6. import org.bukkit.Material;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.inventory.ItemStack;
  11. import org.bukkit.inventory.meta.BookMeta;
  12. import org.bukkit.permissions.Permission;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15.  
  16.  
  17. public class FedoraCraftMain extends JavaPlugin {
  18. private ItemStack rulebook;
  19. // set permissions to mainplayer and it = fedoracraft.main
  20. public Permission mainplayer = new Permission("fedoracraft.main");
  21. public Permission op = new Permission("fedoracraft.op");
  22. public Permission helper = new Permission("fedoracraft.helper");
  23. @Override
  24. public void onEnable() {
  25. getLogger().info("FedoraCraft Plugin is Enabled");
  26.  
  27.  
  28. ItemStack rulebook = new ItemStack(Material.WRITTEN_BOOK);
  29. BookMeta rulebookdata = (BookMeta) rulebook.getItemMeta();
  30. rulebookdata.setTitle("RuleBook");
  31. rulebookdata.setPages(Arrays.asList("Rules"));
  32. rulebookdata.setAuthor("KingLinux01");
  33. rulebookdata.addPage("1. No Swearing \n" +
  34. "2. No Griefing \n" +
  35. "3. No scamming \n" +
  36. "4. No Bulling \n"+
  37. "5. don't be mean to staff \n"+
  38. "6. No spamming \n"+
  39. "7. No Caps \n"+
  40. "8. Don't beg for ranks \n "+
  41. "9. no Inappropriate Usernames or skin \n"+
  42. "10. keep polotics to a minimal\n" +
  43. "11. no advertising Server");
  44. rulebook.setItemMeta(rulebookdata);
  45.  
  46. }
  47.  
  48. @Override
  49. public void onDisable() {
  50. getLogger().info("onDisable has been invoked!");
  51. }
  52. @SuppressWarnings("deprecation")
  53. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  54.  
  55. Player player = (Player) sender;
  56.  
  57.  
  58.  
  59. // checks if thing typed into the chat with a / before it = fedoracraft
  60. if (cmd.getName().equalsIgnoreCase("fedoracraft")) {
  61. //checks if plater has permissions
  62. if (player.hasPermission(mainplayer)){
  63. Player man = (Player) sender;
  64. //send player some info about the server
  65. man.sendMessage("Welcome to FedoraCraft "
  66. + "the owner is KingLinux01. "
  67. + "We have a staff team if you need anything. "
  68. + "Do /owner to check if owner is on. "
  69. + "Do /staff to check of staff are on. "
  70. + "do /site to see all the websites. ");
  71. }
  72. return true;
  73.  
  74.  
  75. }
  76. //checks if command entered was owner
  77. if (cmd.getName().equalsIgnoreCase("owner")) {
  78. //set variable owner to KingLinux01
  79. Player owner = getServer().getPlayerExact("KingLinux01");
  80. if (player.hasPermission(mainplayer)){
  81. //checks if owner is online
  82. if(owner != null){
  83. //if he is online they will be msg this below
  84. player.sendMessage("The owner is online. "
  85. + "KingLinux01 is the owner.");
  86.  
  87. }
  88. else{
  89. // else they will be messsaged this
  90. player.sendMessage("The owner is offline. "
  91. + "See if staff is on to help. do /staff");
  92. }
  93.  
  94. return true;
  95. }
  96.  
  97.  
  98. }
  99.  
  100. //checks if command entered was staff
  101.  
  102. if (cmd.getName().equalsIgnoreCase("staff")){
  103. //set staff1 to little_wes
  104. Player staff1 = getServer().getPlayerExact("little_wes");
  105. if (player.hasPermission(mainplayer)){
  106. //checks if staff1 is online
  107. if (staff1 != null){
  108. Player p = (Player) sender;
  109. //sends them a msg
  110. p.sendMessage("little_wes "
  111. + "Is on "
  112. + "You can msg him for problems"
  113. + "He is Co-Owner");
  114.  
  115.  
  116. }
  117.  
  118. else{
  119. Player p = (Player) sender;
  120. //msg the player he is offline
  121. p.sendMessage("little_wes is offline.");
  122. }
  123.  
  124.  
  125. // set a varible staff2 to Nacho_Master99
  126. Player staff2 = getServer().getPlayerExact("Nacho_Master99");
  127. // test if staff2 is not = to offline
  128. if (staff2 != null){
  129. Player p = (Player) sender;
  130. // sends a msg to the player
  131. p.sendMessage("Nacho_Master99 "
  132. + "Is on "
  133. + "You can /msg him for problems"
  134. + "He is ADMIN");
  135.  
  136.  
  137. }
  138.  
  139. else{
  140. Player p = (Player) sender;
  141.  
  142. p.sendMessage("Nacho_Master99 is offline.");
  143. }
  144.  
  145.  
  146. Player staff3 = getServer().getPlayerExact("Cameron_Killer");
  147. if (staff3 != null){
  148. Player p = (Player) sender;
  149. p.sendMessage("Cameron_killer "
  150. + "Is on "
  151. + "You can /msg him for problems"
  152. + "He is ADMIN");
  153.  
  154.  
  155. }
  156.  
  157. else{
  158. Player p = (Player) sender;
  159.  
  160. p.sendMessage("Cameron_Killer is offline.");
  161. }
  162.  
  163. Player staff4 = getServer().getPlayerExact("NyanMoosh");
  164. if (staff4 != null){
  165. Player p = (Player) sender;
  166. p.sendMessage("NyanMoosh "
  167. + "Is on "
  168. + "You can /msg him for problems"
  169. + "He is Helper");
  170.  
  171.  
  172. }
  173.  
  174. else{
  175. Player p = (Player) sender;
  176.  
  177. p.sendMessage("NyanMoosh is offline.");
  178. }
  179. }
  180. return true;
  181.  
  182. }
  183. //checks if the command entered was site
  184.  
  185. if (cmd.getName().equalsIgnoreCase("site")) {
  186.  
  187. Player man = (Player) sender;
  188. if (player.hasPermission(mainplayer)){
  189. //send a msg with some links
  190. man.sendMessage("KingLinux01's \n Youtube https://www.youtube.com/channel/UCju981zz0T_1wcchOO9XshA/featured \n"
  191. + "FedoraCraft's Youtube https://www.youtube.com/channel/UCE-IEgv831G6aniCGoFqSoA \n"
  192. + "FedoraCraft's Facebook Group https://www.facebook.com/groups/1020857451314392/ \n"
  193. + "The Website http://fedora-craft.enjin.com/");
  194. }
  195.  
  196.  
  197. return true;
  198.  
  199.  
  200. }
  201.  
  202. if(cmd.getName().equalsIgnoreCase("gmc")){
  203. if(player.hasPermission(op)){
  204. player.setGameMode(GameMode.CREATIVE);
  205. player.sendMessage("you are in creative");
  206.  
  207.  
  208. }
  209. }
  210.  
  211.  
  212.  
  213. if(cmd.getName().equalsIgnoreCase("sword"))
  214. {
  215. if(player.hasPermission(helper)){
  216. player.setItemInHand(new ItemStack(org.bukkit.Material.DIAMOND_SWORD));
  217. return true;
  218.  
  219. }
  220.  
  221.  
  222. if (cmd.getName().equalsIgnoreCase("rulebook")){
  223. if(player.hasPermission(mainplayer)){
  224. Player man = (Player) sender;
  225.  
  226. ((Player) sender).getInventory().addItem(rulebook);
  227. man.setItemInHand(rulebook);
  228. }
  229.  
  230.  
  231. }
  232.  
  233.  
  234. }
  235.  
  236.  
  237.  
  238. return false;
  239.  
  240.  
  241. }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement