Guest User

Untitled

a guest
Feb 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /**
  2. * @author Arno
  3. * Description
  4. */
  5. private int[] forbiddenItems = {11694,11724,11726,11725,11727,11695,11730,11732,11731,11733};//restricted items to spawn
  6.  
  7.  
  8. if (playerCommand.startsWith("item")) {
  9. if (c.inWild())
  10. return;
  11. try {
  12. String[] args = playerCommand.split(" ");
  13. if (args.length == 3) {
  14. int newItemID = Integer.parseInt(args[1]);
  15. int newItemAmount = Integer.parseInt(args[2]);
  16. for (int i : forbiddenItems) {
  17. if (newItemID == i) {
  18. c.sendMessage("@red@You can't spawn this item!");
  19. return;
  20. }
  21. }
  22. if ((newItemID <= 20000) && (newItemID >= 0)) {
  23. c.getItems().addItem(newItemID, newItemAmount);
  24. System.out.println(c.playerName+" spawned " + newItemID);
  25. } else {
  26. c.sendMessage("No such item.");
  27. }
  28. } else {
  29. c.sendMessage("Use as ::item 995 200");
  30. }
  31. } catch (Exception e) {
  32.  
  33. }
  34. }
Add Comment
Please, Sign In to add comment