Advertisement
Guest User

Mini-Blocks // 1.0

a guest
Jul 8th, 2015
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. package me._ug.main;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.entity.ArmorStand;
  6. import org.bukkit.entity.EntityType;
  7. import org.bukkit.inventory.ItemStack;
  8. import org.bukkit.util.EulerAngle;
  9.  
  10. public class groundItem {
  11.  
  12. /*
  13. *
  14. * CREATED BY: _Ug
  15. *
  16. * Anyone can use this code without any form of thanks. It is 100% free for the public. Enjoy!
  17. *
  18. */
  19.  
  20. //TODO replace main.pl with your plug-in. You do not need to have a time. To remove set removeTime to 0.
  21. public static void removeStand(final ArmorStand as, int removeTime){
  22. if(removeTime!=0){
  23. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(main.pl, new Runnable(){
  24.  
  25. @Override
  26. public void run() {
  27. as.remove();
  28. }
  29.  
  30. }, removeTime);
  31. }
  32. }
  33.  
  34. public static void spawnGroundItem(Location location, ItemStack item, boolean isBlock, boolean isTiny, int removeTime){
  35. if(!isBlock){
  36. if(!isTiny){
  37. Location l = new Location(location.getWorld(), location.getX()+.7,location.getBlockY() - .8,location.getZ()-.1);
  38. ArmorStand stand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
  39. stand.setVisible(false);
  40. stand.setArms(true);
  41. stand.setRightArmPose(new EulerAngle(0,1,0));
  42. stand.setItemInHand(item);
  43. stand.setGravity(false);
  44. stand.setCanPickupItems(false);
  45. stand.setSmall(false);
  46. removeStand(stand, removeTime);
  47. }else{
  48. Location l = new Location(location.getWorld(), location.getX()+.2,location.getBlockY() - .5,location.getZ()-.1);
  49. ArmorStand stand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
  50. stand.setVisible(false);
  51. stand.setArms(true);
  52. stand.setRightArmPose(new EulerAngle(-.35, 0, 0));
  53. stand.setItemInHand(item);
  54. stand.setGravity(false);
  55. stand.setCanPickupItems(false);
  56. stand.setSmall(true);
  57. removeStand(stand, removeTime);
  58.  
  59. }
  60. }else{
  61. if(!isTiny){
  62. Location l = new Location(location.getWorld(), location.getX()+.6,location.getBlockY() - .65,location.getZ()+.1);
  63. l.setYaw(45);
  64. ArmorStand stand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
  65. stand.setVisible(false);
  66. stand.setArms(true);
  67. stand.setRightArmPose(new EulerAngle(-.25,0,0));
  68. stand.setItemInHand(item);
  69. stand.setGravity(false);
  70. stand.setCanPickupItems(false);
  71. stand.setSmall(false);
  72. removeStand(stand, removeTime);
  73.  
  74. }else{
  75. Location l = new Location(location.getWorld(), location.getX()+.1,location.getBlockY() - .445,location.getZ());
  76. l.setYaw(45);
  77. ArmorStand stand = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
  78. stand.setVisible(false);
  79. stand.setArms(true);
  80. stand.setRightArmPose(new EulerAngle(-.6,0,0));
  81. stand.setItemInHand(item);
  82. stand.setGravity(false);
  83. stand.setCanPickupItems(false);
  84. stand.setSmall(true);
  85. removeStand(stand, removeTime);
  86.  
  87.  
  88. }
  89. }
  90. }
  91.  
  92.  
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement