Disable crafting tables

Discussion in 'Archived: Plugin Requests' started by xXSilverswordXx, Sep 22, 2014.

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

    xXSilverswordXx

    Suggested Name: Nocraft
    Suggested category: no clue

    No player (not even the admins) can open a crafting table when the plugin is installed.
    Right-clicking it does nothing.
    All there is to it.
     
  2. Offline

    Gerov

    Last edited by a moderator: Nov 1, 2016
    xXSilverswordXx likes this.
  3. Offline

    xXSilverswordXx

    thanks, it works and all except it puts a few errors in the console every now and then, it also seems to lag up a bit.
    "could not pass player interact event"
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    undeaD_D

    Gerov why would you test for a block when the play rightclicks air O,o seems wrong to me XD

    thats probably why errors come up in the console ...
     
    15987632 likes this.
  6. Offline

    Gerov

  7. Offline

    AronTheGamer

    @EventHandler void playerRightClick(PlayerInteractEvent e ) { if(e.getAction().equals( Action.RIGHT_CLICk_BLOCK ) && e.getClickedBlock().getType().equals(Material.CRAFTING_TABLE ) ) e.setCancelled( true ); }
     
  8. Offline

    xXSilverswordXx

    is it fixed
     
  9. Offline

    ChipDev

    Hey, pla ease don't put "SUPER SIMPLE" or stuff like that in the title, Maybe it isn't.. You aren't the one developing it! ;)
     
  10. Offline

    Crud41


    Chip, to be fair, you aren't a dev either. So you can't really comment on stuff like this. Also, leave the smart-assery to me, it is my job on here. That and making small plugins because I CBA to make full mini-games.
     
  11. Offline

    ChipDev

    What? Im not a Dev?
    You are incorrect.
     
    Skionz likes this.
  12. Offline

    mrCookieSlime

    *Looks at the Username* "ChipDev" You are totally not a dev...

    Crud41
    Just because he has not linked his BukkitDev account or has not published any Plugins, it does not mean that he does not know how to code. I know its not that obvious...
     
    Skionz likes this.
  13. Offline

    ChipDev

    Hah.
    Show Spoiler
    [​IMG]


    crap u r correct.
     
  14. Offline

    Crud41


    Just because someone has dev in their name, it does not instantly mean that they are a dev. Unless I see a linked account to devbukkit with plugins, I don't call them a "dev".
     
  15. Offline

    ChipDev

    Thats kinda stupid.
     
  16. Offline

    Crud41

  17. Offline

    ChipDev

  18. Offline

    Crud41

    In that case, may I see some of your work?
     
  19. Offline

    mrCookieSlime

    Crud41
    Correct, the Username does not proof that he is a dev. However I haven't seen someone with "dev" in their name who is not a dev...
    If you are not a dev, there is no reason to call yourself one...
     
    ChipDev likes this.
  20. Offline

    ChipDev


    Code:java
    1. package com.chip;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.DyeColor;
    9. import org.bukkit.GameMode;
    10. import org.bukkit.Material;
    11. import org.bukkit.command.Command;
    12. import org.bukkit.command.CommandSender;
    13. import org.bukkit.entity.Player;
    14. import org.bukkit.event.EventHandler;
    15. import org.bukkit.event.Listener;
    16. import org.bukkit.event.inventory.InventoryClickEvent;
    17. import org.bukkit.event.player.PlayerInteractEvent;
    18. import org.bukkit.event.player.PlayerJoinEvent;
    19. import org.bukkit.event.player.PlayerKickEvent;
    20. import org.bukkit.event.player.PlayerQuitEvent;
    21. import org.bukkit.inventory.Inventory;
    22. import org.bukkit.inventory.ItemStack;
    23. import org.bukkit.inventory.meta.ItemMeta;
    24. import org.bukkit.material.Wool;
    25. import org.bukkit.plugin.java.JavaPlugin;
    26.  
    27. import com.chip.WwII;
    28. public class Main extends JavaPlugin implements Listener {
    29. boolean full;
    30. boolean ingame;
    31. private String hub = ChatColor.YELLOW + "" + ChatColor.BOLD + "> >";
    32.  
    33. public void onGameStart(GameStartEvent e) {
    34. }
    35. public WwII nazis = new WwII("Nazis", ChatColor.BLUE, DyeColor.BLUE);
    36. public WwII onudans = new WwII("Onudans", ChatColor.RED, DyeColor.RED);
    37. //Game start <3
    38. public void onDisable() {
    39. saveConfig();
    40. }
    41. public void onEnable() {
    42. saveConfig();
    43. Bukkit.getPluginManager().registerEvents(this, this);
    44. getServer().broadcastMessage(ChatColor.RED + "Hub Enabled.");
    45. }
    46. @EventHandler
    47. //On join
    48. public void onJoin(PlayerJoinEvent e) {
    49. if(WwII.isInTeam(e.getPlayer().getName())) {
    50. WwII.getTeam(e.getPlayer()).getPlayers().remove(e.getPlayer().getName());
    51. }
    52. e.getPlayer().setGameMode(GameMode.ADVENTURE);
    53. if(!e.getPlayer().isOp()){
    54. e.getPlayer().getInventory().clear();
    55. }
    56. if(Bukkit.getOnlinePlayers().length >= 4) {
    57. ingame = true;
    58. full = true;
    59. WwII.startGame();
    60. }
    61. else{
    62. ingame = false;
    63. full = false;
    64. }
    65. e.setJoinMessage("");
    66. for(Player all : Bukkit.getOnlinePlayers()) {
    67. if(!all.getName().equalsIgnoreCase(e.getPlayer().getName())) {
    68. all.sendMessage(hub + ChatColor.GREEN + "" + ChatColor.BOLD + "+ " + e.getPlayer().getName());
    69. }
    70. }
    71. e.getPlayer().sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Welcome to the Hub, " + e.getPlayer().getName() + "!");
    72. e.getPlayer().sendMessage(ChatColor.YELLOW + "" + "Current beta game: WwII (World war 2)");
    73. if(ingame == false) {
    74. ItemStack work = new ItemStack(Material.WORKBENCH, 1);
    75. ItemMeta im = work.getItemMeta();
    76. im.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "Please select a team!");
    77. work.setItemMeta(im);
    78. e.getPlayer().getInventory().setItem(4, work);
    79. }
    80. if(ingame == true) {
    81. //oh god. Im not ready >.<
    82. }
    83. if(ingame == true && full == true) {
    84. e.getPlayer().setAllowFlight(true);
    85. e.getPlayer().setFlying(true);
    86. e.getPlayer().sendMessage(hub + ChatColor.RED + "You are a spectator.");
    87. }
    88. if(e.getPlayer().getName() != "Kanss") {
    89. if(getConfig().getBoolean("Locked") == true) {
    90. e.getPlayer().kickPlayer(ChatColor.BLUE + "You have been kicked: " + ChatColor.RED + "Server locked.");
    91. }
    92. }
    93. }
    94. //Player gets kicked
    95. @EventHandler
    96. public void onKick(PlayerKickEvent e) {
    97. if(WwII.isInTeam(e.getPlayer().getName())) {
    98. WwII.getTeam(e.getPlayer()).getPlayers().remove(e.getPlayer().getName());
    99. }
    100. if(getServer().getOnlinePlayers().length < 4) {
    101. full = false;
    102. }
    103. e.setLeaveMessage("");
    104. for(Player player : getServer().getOnlinePlayers()){
    105. player.sendMessage(hub + ChatColor.RED + "" + ChatColor.BOLD + "- " + e.getPlayer().getName());
    106. }
    107. if(getServer().getOnlinePlayers().length <= 1) {
    108. full = false;
    109. ingame = false;
    110. }
    111. }
    112. //Player leaves
    113. @EventHandler
    114. public void onLeave(PlayerQuitEvent e) {
    115. if(WwII.isInTeam(e.getPlayer().getName())){
    116. WwII.getTeam(e.getPlayer()).getPlayers().remove(e.getPlayer().getName());
    117. }
    118. if(getServer().getOnlinePlayers().length < 4) {
    119. full = false;
    120. }
    121. e.setQuitMessage("");
    122. for(Player player : getServer().getOnlinePlayers()){
    123. player.sendMessage(hub + ChatColor.RED + "" + ChatColor.BOLD + "- " + e.getPlayer().getName());
    124. }
    125. if(getServer().getOnlinePlayers().length <= 1) {
    126. full = false;
    127. ingame = false;
    128. }
    129. }
    130. @EventHandler
    131. public void onOpen(PlayerInteractEvent e) {
    132. ItemStack item = e.getItem();
    133. if(item.getItemMeta().getDisplayName().equals(ChatColor.GOLD + "" + ChatColor.BOLD + "Please select a team!")) {
    134. if(WwII.isInTeam(e.getPlayer().getName())) {
    135. WwII.getTeam(e.getPlayer()).getPlayers().remove(e.getPlayer().getName());
    136. }
    137. e.setCancelled(true);
    138. Inventory none = Bukkit.createInventory(null, 9, ChatColor.RED + "" + ChatColor.ITALIC + " Please select a team!");
    139. Wool red = new Wool(DyeColor.RED);
    140. ItemStack redwool = red.toItemStack();
    141. Wool blue = new Wool(DyeColor.BLUE);
    142. ItemStack bluewool = blue.toItemStack();
    143. ItemMeta two = bluewool.getItemMeta();
    144. ItemMeta three = redwool.getItemMeta();
    145. three.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Nazi's");
    146. List<String> list = new ArrayList<String>();
    147. list.add("We need some extra members!!");
    148. three.setLore(list);
    149. two.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "Onudan's");
    150. two.setLore(list);
    151. redwool.setItemMeta(three);
    152. bluewool.setItemMeta(two);
    153. none.setItem(2, redwool);
    154. none.setItem(6, bluewool);
    155. e.getPlayer().openInventory(none);
    156. }
    157. if(item.getItemMeta().getDisplayName().equals(ChatColor.RED + "Current team: " + ChatColor.RED + "" + ChatColor.BOLD + "Nazi's:" + ChatColor.GREEN + " Click to change.")) {
    158. e.setCancelled(true);
    159. Inventory nazi = Bukkit.createInventory(null, 9, ChatColor.GOLD + "" + ChatColor.BOLD + "nazi");
    160. Wool red = new Wool(DyeColor.RED);
    161. ItemStack redwool = red.toItemStack();
    162. Wool blue = new Wool(DyeColor.BLUE);
    163. ItemStack bluewool = blue.toItemStack();
    164. ItemMeta two = bluewool.getItemMeta();
    165. ItemMeta three = redwool.getItemMeta();
    166. three.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Nazi's");
    167. List<String> list = new ArrayList<String>();
    168. list.add("We need some extra members!!");
    169. three.setLore(list);
    170. two.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "Onudan's");
    171. two.setLore(list);
    172. redwool.setItemMeta(three);
    173. bluewool.setItemMeta(two);
    174. nazi.setItem(2, redwool);
    175. nazi.setItem(6, bluewool);
    176. e.getPlayer().openInventory(nazi);
    177. }
    178. if(item.getItemMeta().getDisplayName().equals(ChatColor.RED + "Current team: " + ChatColor.BLUE + "" + ChatColor.BOLD + "Onudan's:" + ChatColor.GREEN + " Click to change.")) {
    179. Inventory onu = Bukkit.createInventory(null, 9, ChatColor.GOLD + "" + ChatColor.BOLD + "onu");
    180. Wool red = new Wool(DyeColor.RED);
    181. ItemStack redwool = red.toItemStack();
    182. Wool blue = new Wool(DyeColor.BLUE);
    183. ItemStack bluewool = blue.toItemStack();
    184. ItemMeta two = bluewool.getItemMeta();
    185. ItemMeta three = redwool.getItemMeta();
    186. three.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Nazi's");
    187. List<String> list = new ArrayList<String>();
    188. list.add("We need some extra members!!");
    189. three.setLore(list);
    190. two.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "Onudan's");
    191. two.setLore(list);
    192. redwool.setItemMeta(three);
    193. bluewool.setItemMeta(two);
    194. onu.setItem(2, redwool);
    195. onu.setItem(6, bluewool);
    196. e.getPlayer().openInventory(onu);
    197. }
    198. }
    199. @EventHandler
    200. public void onInventoryClick(InventoryClickEvent e) {
    201. Player player = (Player) e.getWhoClicked();
    202. ItemStack clicked = e.getCurrentItem();
    203. if(WwII.isInTeam(player.getName())) {
    204. WwII.getTeam(player).getPlayers().remove(player.getName());
    205. }
    206. if (clicked.getItemMeta().getDisplayName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Nazi's")) {
    207. if(nazis.getPlayers().size() >= 2) {
    208. player.sendMessage(hub + ChatColor.GOLD + "" + ChatColor.BOLD + "That team is full! Sorry! And Jackson is weird!!");
    209. player.sendMessage(hub + ChatColor.RED + "nazi" + nazis.getPlayers());
    210. player.sendMessage(hub + ChatColor.BLUE + "onudan" + onudans.getPlayers());
    211. e.setCancelled(true);
    212. player.closeInventory();
    213. }else{
    214. e.setCancelled(true);
    215. player.closeInventory();
    216. WwII.join(player, nazis);
    217. player.sendMessage(hub + ChatColor.GOLD + "" + ChatColor.BOLD + "You joined the Nazi's team!");
    218. player.getInventory().clear();
    219. ItemStack workn = new ItemStack(Material.WORKBENCH);
    220. ItemMeta workim = workn.getItemMeta();
    221. workim.setDisplayName(ChatColor.RED + "Current team: " + ChatColor.RED + "" + ChatColor.BOLD + "Nazi's:" + ChatColor.GREEN + " Click to change.");
    222. workn.setItemMeta(workim);
    223. player.getInventory().setItem(4, workn);
    224. }
    225. }
    226. if(clicked.getItemMeta().getDisplayName().equals(ChatColor.BLUE + "" + ChatColor.BOLD + "Onudan's")) {
    227. if(onudans.getPlayers().size() >= 2) {
    228. player.sendMessage(hub + ChatColor.GOLD + "" + ChatColor.BOLD + "That team is full! Sorry! And Jackson is weird!!");
    229. e.setCancelled(true);
    230. player.closeInventory();
    231. }else{
    232. e.setCancelled(true);
    233. player.closeInventory();
    234. if(WwII.isInTeam(player.getName())) {
    235. WwII.getTeam(player).getPlayers().remove(player.getName());
    236. }
    237. WwII.join(player, onudans);
    238. player.sendMessage(hub + ChatColor.GOLD + "" + ChatColor.BOLD + "You joined the Onudan's team!");
    239. player.getInventory().clear();
    240. ItemStack worko = new ItemStack(Material.WORKBENCH);
    241. ItemMeta workimo = worko.getItemMeta();
    242. workimo.setDisplayName(ChatColor.RED + "Current team: " + ChatColor.BLUE + "" + ChatColor.BOLD + "Onudan's:" + ChatColor.GREEN + " Click to change.");
    243. worko.setItemMeta(workimo);
    244. player.getInventory().setItem(4, worko);
    245. }
    246. }
    247. }
    248. //Locking.
    249. @EventHandler
    250. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
    251. if(command.getName().equalsIgnoreCase("Unlock")) {
    252. if(sender.getName() != "Kanss") {
    253. sender.sendMessage(ChatColor.RED + "Cannot unlock.");
    254. }
    255. if(sender.getName() == "Kanss") {
    256. getConfig().set("Locked", false);
    257. }
    258. }
    259. if(command.getName().equalsIgnoreCase("Lock")) {
    260. if(sender.getName() != "Kanss") {
    261. sender.sendMessage(ChatColor.RED + "Cannot Lock.");
    262. }
    263. if(sender.getName() == "Kanss") {
    264. getConfig().set("Locked", true);
    265. }
    266. }
    267. return true;
    268. }
    269. }
    270.  

    Theres a main class of my guns plugin.
     
  21. Offline

    Crud41


    Believe me, I have seen plenty of fakers on here before. They come on here and just comment on other people's work. when you ask them what have they done, they have nothing to show for it. Ask them basic questions about java, they know not how to respond.

    I've been around this community since bukkit came out, I know there are two types of people:
    Devs
    And fake Devs who think that pretending like they know something about programming makes them instantly cool in some way.

    ChipDev Fair enough. I don't mean to seem like a jackass, but I hate fakers in the community. If I don't see any previous work of the person or plugins on dev bukkit, I just assume they are fakes.

    Although, you really need to brush up some of that code. I'll see you around.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  22. Offline

    mrCookieSlime

    Well, Im sorry if you have had such a bad experience with the Bukkit Community. But well, I have not seen fakers like that on here (Probably because Im just mainly active on the Plugin Requests Forum)
    But I agree, I have already seen People commenting and argumenting with Java even though they have no idea of Java. It may be annoying when people who cannot code say things like
    "This is impossible"
    ...

    EDIT: Dear lord, this is getting so offtopic...
     
  23. Offline

    timtower Administrator Administrator Moderator

    Why not get back on topic?
     
  24. Offline

    mrCookieSlime

    Well, the Request has already been filled but sometimes it happens that you get offtopic really quickly without even noticing it.

    So Crud41 We should probably leave this Thread alone now ^^
     
    Crud41 likes this.
  25. Offline

    ChipDev

    We probz spammed OP posters inbox XP
     
Thread Status:
Not open for further replies.

Share This Page