Spawning Mobs on crosshair

Discussion in 'Plugin Development' started by 1poseidon3, Feb 18, 2014.

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

    1poseidon3

    Hello. I am making a plugin this will spawn a mob at the command sender's crosshair. I cant find anything wrong with my code but every time I run it on my test server I get the "An internal error has occurred" message. I am going to post the code here because I have no idea what is wrong with it.
    Code:java
    1. @SuppressWarnings("deprecation")
    2. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    3. Player player = (Player) sender;
    4. if(cmd.getName().equalsIgnoreCase("animalspawn")) {
    5. Player target = Bukkit.getServer().getPlayer(args[1]);
    6. World world = target.getWorld();
    7. Location TargetLocation = target.getLocation();
    8. Block block = player.getTargetBlock(null, 100);
    9. Location bl = block.getLocation();
    10. if (!sender.hasPermission("animalspawner.animalspawn")) {
    11. sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
    12. }
    13. if(args.length == 1) {
    14. if(args[0].equalsIgnoreCase("wolf")){
    15. world.spawnCreature(bl, EntityType.WOLF);
    16. }else if(args[0].equalsIgnoreCase("pig")){
    17. world.spawnCreature(bl, EntityType.PIG);
    18. }else if(args[0].equalsIgnoreCase("pigzombie")){
    19. world.spawnCreature(bl, EntityType.PIG_ZOMBIE);
    20. }else if(args[0].equalsIgnoreCase("cow")){
    21. world.spawnCreature(bl, EntityType.COW);
    22. }else if(args[0].equalsIgnoreCase("blaze")){
    23. world.spawnCreature(bl, EntityType.BLAZE);
    24. }else if(args[0].equalsIgnoreCase("cavespider")){
    25. world.spawnCreature(bl, EntityType.CAVE_SPIDER);
    26. }else if(args[0].equalsIgnoreCase("chicken")){
    27. world.spawnCreature(bl, EntityType.CHICKEN);
    28. }else if(args[0].equalsIgnoreCase("creeper")){
    29. world.spawnCreature(bl, EntityType.CREEPER);
    30. }else if(args[0].equalsIgnoreCase("enderdragon")){
    31. world.spawnCreature(bl, EntityType.ENDER_DRAGON);
    32. }else if(args[0].equalsIgnoreCase("enderman")){
    33. world.spawnCreature(bl, EntityType.ENDERMAN);
    34. }else if(args[0].equalsIgnoreCase("ghast")){
    35. world.spawnCreature(bl, EntityType.GHAST);
    36. }else if(args[0].equalsIgnoreCase("giant")){
    37. world.spawnCreature(bl, EntityType.GIANT);
    38. }else if(args[0].equalsIgnoreCase("ironGolem")){
    39. world.spawnCreature(bl, EntityType.IRON_GOLEM);
    40. }else if(args[0].equalsIgnoreCase("magmaCube")){
    41. world.spawnCreature(bl, EntityType.MAGMA_CUBE);
    42. }else if(args[0].equalsIgnoreCase("ocelot")){
    43. world.spawnCreature(bl, EntityType.OCELOT);
    44. }else if(args[0].equalsIgnoreCase("sheep")){
    45. world.spawnCreature(bl, EntityType.SHEEP);
    46. }else if(args[0].equalsIgnoreCase("silverFish")){
    47. world.spawnCreature(bl, EntityType.SILVERFISH);
    48. }else if(args[0].equalsIgnoreCase("skeleton")){
    49. world.spawnCreature(bl, EntityType.SKELETON);
    50. }else if(args[0].equalsIgnoreCase("slime")){
    51. world.spawnCreature(bl, EntityType.SLIME);
    52. }else if(args[0].equalsIgnoreCase("spider")){
    53. world.spawnCreature(bl, EntityType.SPIDER);
    54. }else if(args[0].equalsIgnoreCase("squid")){
    55. world.spawnCreature(bl, EntityType.SQUID);
    56. }else if(args[0].equalsIgnoreCase("villager")){
    57. world.spawnCreature(bl, EntityType.VILLAGER);
    58. }else if(args[0].equalsIgnoreCase("zombie")){
    59. world.spawnCreature(bl, EntityType.ZOMBIE);
    60. }else if(args[0].equalsIgnoreCase("list") || args.length == 0) {
    61. sender.sendMessage(ChatColor.GREEN + "Blaze, CaveSpider, Chicken, Cow, Creeper, EnderDragon, Enderman, Ghast, Giant, IronGolem, MagmaCube, Ocelot, Sheep, SilverFish, Skeleton, Slime, Spider, Villager, Zombie");
    62. }
    63. }else if(args.length > 2){
    64. player.sendMessage(ChatColor.RED + "/animalspawn <Mob> [Player]");
    65. }


    There is a bit more to my code but it is for another command and therefor irrelevant. If anyone knows what I am doing wrong please tell me! Thanks!
     
  2. Offline

    Ch4t4r

    Please post the stacktrace here
     
  3. Offline

    caseif

  4. Offline

    1poseidon3

    I already know how to read them but thank you for suggesting this. It may help others.

    In the stacktrace it refers to line 30 as the problem which I believe in the code above is line 5. I cannot copy the stack trace as it is a local server and the console does not allow me to copy what is in it. I did owever realise that the error happens when I do not specify a player. The problem is, when I don't specify a player, I want an animal to spawn at my crosshair (where i am looking) but instead it gives me an error. What am I doing wrong? The command should look like this: /animalspawn <Entity> [Player]
     
  5. Offline

    calebbfmv

    Most likely, without seeing the st, it is an ArrayIndexOutOfBoundsException, which happens when you require a certain amount of an Array (in this case String[]) but what you do doesn't fit inside of the array. So, this would be a simple fix of adding:
    Code:
    if(args.length >= 1) {
      String ent = args[0]; //Arrays start at 0;
      if(args.length == 1){
        //they only specified a mob
      } else if(args.length == 2){
      //  the specified a player and a mob
     
  6. Offline

    1poseidon3

    Haha actually that is the exact error! I was about to edit my post saying that was the error but you already specified it,so thanks! I have not tried your fix yet but where would I put it in my code exactly?
     
  7. Offline

    xTrollxDudex

    1poseidon3
    If you are on windows, click the top left corner in the overlay and a menu pops up. Go to edit and mark. Click and Drag the cursor over are are you want to copy. Or take a screenshot and upload file, or put it in imgur or imageshack.

    You need to add that after you check the command. Then replace all the // stuff with your code.
     
  8. Offline

    caseif

    Apologies for my abrupt response. I had assumed that you didn't since you only said that there were errors. I had been going through posts where the problem was basically a simple NPE, and was quick to judge your problem as well. I was kind of having a bad morning. Sorry. :p
     
  9. Offline

    calebbfmv

    What he said.

    Not Shady, but Troll

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

    1poseidon3

    haha its fine. We all have bad mornings. :p

    Alright ill try that and report back. Thanks!

    Alright my problem is now bigger. I am still getting the internal error and now it is not spawning the mob at all. It used to spawn the mob at my crosshair when I typed in "/animalspawn pig 1poseidon3" but now it won't spawn anything at all. I will put the full code here.
    Code:java
    1. package me.poseidontechnologies.animalspawner;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.Location;
    6. import org.bukkit.World;
    7. import org.bukkit.block.Block;
    8. import org.bukkit.command.Command;
    9. import org.bukkit.command.CommandSender;
    10. import org.bukkit.entity.EntityType;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. public class AnimalSpawner extends JavaPlugin {
    15. public String name = "AnimalSpawner";
    16. public double version = 1.0;
    17.  
    18. public void onEnable() {
    19. Bukkit.getServer().getLogger().info(name + " " + version + " enabled!");
    20. }
    21.  
    22. public void onDisable() {
    23. Bukkit.getServer().getLogger().info(name + " " + version + " disabled!");
    24. }
    25.  
    26. @SuppressWarnings("deprecation")
    27. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    28. Player player = (Player) sender;
    29. if(cmd.getName().equalsIgnoreCase("animalspawn") || cmd.getName().equalsIgnoreCase("as")) {
    30. Player target = Bukkit.getServer().getPlayer(args[1]);
    31. World world = target.getWorld();
    32. Location TargetLocation = target.getLocation();
    33. Block block = player.getTargetBlock(null, 100);
    34. Location bl = block.getLocation();
    35. if (!sender.hasPermission("animalspawner.animalspawn")) {
    36. sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
    37. }
    38. if (args.length >= 1) {
    39. @SuppressWarnings("unused")
    40. String ent = args[0];
    41. if (args.length == 1) {
    42. if(args[0].equalsIgnoreCase("wolf")){
    43. world.spawnCreature(bl, EntityType.WOLF);
    44. }else if(args[0].equalsIgnoreCase("pig")){
    45. world.spawnCreature(bl, EntityType.PIG);
    46. }else if(args[0].equalsIgnoreCase("pigzombie")){
    47. world.spawnCreature(bl, EntityType.PIG_ZOMBIE);
    48. }else if(args[0].equalsIgnoreCase("cow")){
    49. world.spawnCreature(bl, EntityType.COW);
    50. }else if(args[0].equalsIgnoreCase("blaze")){
    51. world.spawnCreature(bl, EntityType.BLAZE);
    52. }else if(args[0].equalsIgnoreCase("cavespider")){
    53. world.spawnCreature(bl, EntityType.CAVE_SPIDER);
    54. }else if(args[0].equalsIgnoreCase("chicken")){
    55. world.spawnCreature(bl, EntityType.CHICKEN);
    56. }else if(args[0].equalsIgnoreCase("creeper")){
    57. world.spawnCreature(bl, EntityType.CREEPER);
    58. }else if(args[0].equalsIgnoreCase("enderdragon")){
    59. world.spawnCreature(bl, EntityType.ENDER_DRAGON);
    60. }else if(args[0].equalsIgnoreCase("enderman")){
    61. world.spawnCreature(bl, EntityType.ENDERMAN);
    62. }else if(args[0].equalsIgnoreCase("ghast")){
    63. world.spawnCreature(bl, EntityType.GHAST);
    64. }else if(args[0].equalsIgnoreCase("giant")){
    65. world.spawnCreature(bl, EntityType.GIANT);
    66. }else if(args[0].equalsIgnoreCase("ironGolem")){
    67. world.spawnCreature(bl, EntityType.IRON_GOLEM);
    68. }else if(args[0].equalsIgnoreCase("magmaCube")){
    69. world.spawnCreature(bl, EntityType.MAGMA_CUBE);
    70. }else if(args[0].equalsIgnoreCase("ocelot")){
    71. world.spawnCreature(bl, EntityType.OCELOT);
    72. }else if(args[0].equalsIgnoreCase("sheep")){
    73. world.spawnCreature(bl, EntityType.SHEEP);
    74. }else if(args[0].equalsIgnoreCase("silverFish")){
    75. world.spawnCreature(bl, EntityType.SILVERFISH);
    76. }else if(args[0].equalsIgnoreCase("skeleton")){
    77. world.spawnCreature(bl, EntityType.SKELETON);
    78. }else if(args[0].equalsIgnoreCase("slime")){
    79. world.spawnCreature(bl, EntityType.SLIME);
    80. }else if(args[0].equalsIgnoreCase("spider")){
    81. world.spawnCreature(bl, EntityType.SPIDER);
    82. }else if(args[0].equalsIgnoreCase("squid")){
    83. world.spawnCreature(bl, EntityType.SQUID);
    84. }else if(args[0].equalsIgnoreCase("villager")){
    85. world.spawnCreature(bl, EntityType.VILLAGER);
    86. }else if(args[0].equalsIgnoreCase("zombie")){
    87. world.spawnCreature(bl, EntityType.ZOMBIE);
    88. }else if(args[0].equalsIgnoreCase("list") || args.length == 0) {
    89. sender.sendMessage(ChatColor.GREEN + "Blaze, CaveSpider, Chicken, Cow, Creeper, EnderDragon, Enderman, Ghast, Giant, IronGolem, MagmaCube, Ocelot, Sheep, SilverFish, Skeleton, Slime, Spider, Villager, Zombie");
    90. }else{
    91. player.sendMessage(ChatColor.RED + "/animalspawn <Mob> [Player]");
    92. if (args.length == 2) {
    93. if(args[0].equalsIgnoreCase("wolf")){
    94. world.spawnCreature(TargetLocation, EntityType.WOLF);
    95. }else if(args[0].equalsIgnoreCase("pig")){
    96. world.spawnCreature(TargetLocation, EntityType.PIG);
    97. }else if(args[0].equalsIgnoreCase("pigzombie")){
    98. world.spawnCreature(TargetLocation, EntityType.PIG_ZOMBIE);
    99. }else if(args[0].equalsIgnoreCase("cow")){
    100. world.spawnCreature(TargetLocation, EntityType.COW);
    101. }else if(args[0].equalsIgnoreCase("blaze")){
    102. world.spawnCreature(TargetLocation, EntityType.BLAZE);
    103. }else if(args[0].equalsIgnoreCase("cavespider")){
    104. world.spawnCreature(TargetLocation, EntityType.CAVE_SPIDER);
    105. }else if(args[0].equalsIgnoreCase("chicken")){
    106. world.spawnCreature(TargetLocation, EntityType.CHICKEN);
    107. }else if(args[0].equalsIgnoreCase("creeper")){
    108. world.spawnCreature(TargetLocation, EntityType.CREEPER);
    109. }else if(args[0].equalsIgnoreCase("enderdragon")){
    110. world.spawnCreature(TargetLocation, EntityType.ENDER_DRAGON);
    111. }else if(args[0].equalsIgnoreCase("enderman")){
    112. world.spawnCreature(TargetLocation, EntityType.ENDERMAN);
    113. }else if(args[0].equalsIgnoreCase("ghast")){
    114. world.spawnCreature(TargetLocation, EntityType.GHAST);
    115. }else if(args[0].equalsIgnoreCase("giant")){
    116. world.spawnCreature(TargetLocation, EntityType.GIANT);
    117. }else if(args[0].equalsIgnoreCase("irongolem")){
    118. world.spawnCreature(TargetLocation, EntityType.IRON_GOLEM);
    119. }else if(args[0].equalsIgnoreCase("magmacube")){
    120. world.spawnCreature(TargetLocation, EntityType.MAGMA_CUBE);
    121. }else if(args[0].equalsIgnoreCase("ocelot")){
    122. world.spawnCreature(TargetLocation, EntityType.OCELOT);
    123. }else if(args[0].equalsIgnoreCase("sheep")){
    124. world.spawnCreature(TargetLocation, EntityType.SHEEP);
    125. }else if(args[0].equalsIgnoreCase("silverfish")){
    126. world.spawnCreature(TargetLocation, EntityType.SILVERFISH);
    127. }else if(args[0].equalsIgnoreCase("skeleton")){
    128. world.spawnCreature(TargetLocation, EntityType.SKELETON);
    129. }else if(args[0].equalsIgnoreCase("slime")){
    130. world.spawnCreature(TargetLocation, EntityType.SLIME);
    131. }else if(args[0].equalsIgnoreCase("spider")){
    132. world.spawnCreature(TargetLocation, EntityType.SPIDER);
    133. }else if(args[0].equalsIgnoreCase("squid")){
    134. world.spawnCreature(TargetLocation, EntityType.SQUID);
    135. }else if(args[0].equalsIgnoreCase("villager")){
    136. world.spawnCreature(TargetLocation, EntityType.VILLAGER);
    137. }else if(args[0].equalsIgnoreCase("zombie")){
    138. world.spawnCreature(TargetLocation, EntityType.ZOMBIE);
    139. }
    140. }
    141. }
    142. return true;
    143. }
    144. }
    145. return true;
    146. }
    147. return true;
    148. }
    149. }


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

    Garris0n

    Well what's the error?
     
  12. Offline

    1poseidon3


     
  13. 1poseidon3
    You said that was the old error. We need the new error. That code you showed us doesn't have the fix someone has already posted.
     
  14. Offline

    Gater12

    1poseidon3 You need to check to make sure the args size is 2, BEFORE you set the target to args[1]. Right now, the code will say target is the player in args[1] (Regardless of how many arguments) but if say I only had one arugument, then it would chew out the server saying "ArrayIndexOutOfBoundsException" because there is NO args[1].
     
  15. Offline

    1poseidon3

    I tried to incorporate the fix but I'm not exactly sure how to do so. The error is still the same error (ArrayIndexOutOfBoundsException) I was having last time except now the mob is not spawning at all.
     
  16. Offline

    Garris0n

    You're getting the target without checking the length of the arguments.
     
  17. Offline

    1poseidon3

    Worked PERFECTLY! Everything is fixed except for one thing (and I had predicted this would happen). With the spawning mobs at the player crosshair block location, instead of the mob spawning on the block the mob sometimes spawn IN the block. This is probably a quick and simple fix and I was wondering if anyone would have the answer. Thanks guys you have all been a really great help to me!
     
  18. Offline

    Jaker232

    1poseidon3 You want to add one on the Y axis to prevent this.
     
  19. Offline

    Garris0n

    location.add(0, 1, 0)
     
  20. Offline

    Gater12

  21. Here, let me do that for you, 1poseidon3.

    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    2. if(cmd.getName().equalsIgnoreCase("animalspawn") || cmd.getName().equalsIgnoreCase("as")) {
    3. //this is just a mess. consider revising.
    4. Player p = null;
    5. if(args.length == 1) {
    6. p = this.getServer().getPlayerExact(args[1]);
    7. } else {
    8. p = this.getServer().getPlayerExact(sender.getName());
    9. }
    10. World world = null;
    11. Location TargetLocation = null;
    12. Block block = null;
    13. Location bl = null;
    14. if(p != null) {
    15. world = p.getWorld();
    16. TargetLocation = p.getLocation();
    17. block = p.getTargetBlock(null, 100);
    18. bl = block.getLocation();
    19. }
    20. if (!sender.hasPermission("animalspawner.animalspawn")) {
    21. //this is going to tell them they don't have permission and then let them use the command. derp.
    22. sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
    23. }
    24. if (args.length >= 1) {
    25. if (args.length == 1) {
    26. if(args[0].equalsIgnoreCase("wolf")){
    27. //consider using this way of spawning mobs. it's not deprecated.
    28. world.spawn(bl, Wolf.class);
    29. }else if(args[0].equalsIgnoreCase("pig")){
    30. world.spawnCreature(bl, EntityType.PIG);
    31. }else if(args[0].equalsIgnoreCase("pigzombie")){
    32. world.spawnCreature(bl, EntityType.PIG_ZOMBIE);
    33. }else if(args[0].equalsIgnoreCase("cow")){
    34. world.spawnCreature(bl, EntityType.COW);
    35. }else if(args[0].equalsIgnoreCase("blaze")){
    36. world.spawnCreature(bl, EntityType.BLAZE);
    37. }else if(args[0].equalsIgnoreCase("cavespider")){
    38. world.spawnCreature(bl, EntityType.CAVE_SPIDER);
    39. }else if(args[0].equalsIgnoreCase("chicken")){
    40. world.spawnCreature(bl, EntityType.CHICKEN);
    41. }else if(args[0].equalsIgnoreCase("creeper")){
    42. world.spawnCreature(bl, EntityType.CREEPER);
    43. }else if(args[0].equalsIgnoreCase("enderdragon")){
    44. world.spawnCreature(bl, EntityType.ENDER_DRAGON);
    45. }else if(args[0].equalsIgnoreCase("enderman")){
    46. world.spawnCreature(bl, EntityType.ENDERMAN);
    47. }else if(args[0].equalsIgnoreCase("ghast")){
    48. world.spawnCreature(bl, EntityType.GHAST);
    49. }else if(args[0].equalsIgnoreCase("giant")){
    50. world.spawnCreature(bl, EntityType.GIANT);
    51. }else if(args[0].equalsIgnoreCase("ironGolem")){
    52. world.spawnCreature(bl, EntityType.IRON_GOLEM);
    53. }else if(args[0].equalsIgnoreCase("magmaCube")){
    54. world.spawnCreature(bl, EntityType.MAGMA_CUBE);
    55. }else if(args[0].equalsIgnoreCase("ocelot")){
    56. world.spawnCreature(bl, EntityType.OCELOT);
    57. }else if(args[0].equalsIgnoreCase("sheep")){
    58. world.spawnCreature(bl, EntityType.SHEEP);
    59. }else if(args[0].equalsIgnoreCase("silverFish")){
    60. world.spawnCreature(bl, EntityType.SILVERFISH);
    61. }else if(args[0].equalsIgnoreCase("skeleton")){
    62. world.spawnCreature(bl, EntityType.SKELETON);
    63. }else if(args[0].equalsIgnoreCase("slime")){
    64. world.spawnCreature(bl, EntityType.SLIME);
    65. }else if(args[0].equalsIgnoreCase("spider")){
    66. world.spawnCreature(bl, EntityType.SPIDER);
    67. }else if(args[0].equalsIgnoreCase("squid")){
    68. world.spawnCreature(bl, EntityType.SQUID);
    69. }else if(args[0].equalsIgnoreCase("villager")){
    70. world.spawnCreature(bl, EntityType.VILLAGER);
    71. }else if(args[0].equalsIgnoreCase("zombie")){
    72. world.spawnCreature(bl, EntityType.ZOMBIE);
    73. }else if(args[0].equalsIgnoreCase("list") || args.length == 0) {
    74. sender.sendMessage(ChatColor.GREEN + "Blaze, CaveSpider, Chicken, Cow, Creeper, EnderDragon, Enderman, Ghast, Giant, IronGolem, MagmaCube, Ocelot, Sheep, SilverFish, Skeleton, Slime, Spider, Villager, Zombie");
    75. }else{
    76. p.sendMessage(ChatColor.RED + "/animalspawn <Mob> [Player]");
    77. if (args.length == 2) {
    78. if(args[0].equalsIgnoreCase("wolf")){
    79. world.spawnCreature(TargetLocation, EntityType.WOLF);
    80. }else if(args[0].equalsIgnoreCase("pig")){
    81. world.spawnCreature(TargetLocation, EntityType.PIG);
    82. }else if(args[0].equalsIgnoreCase("pigzombie")){
    83. world.spawnCreature(TargetLocation, EntityType.PIG_ZOMBIE);
    84. }else if(args[0].equalsIgnoreCase("cow")){
    85. world.spawnCreature(TargetLocation, EntityType.COW);
    86. }else if(args[0].equalsIgnoreCase("blaze")){
    87. world.spawnCreature(TargetLocation, EntityType.BLAZE);
    88. }else if(args[0].equalsIgnoreCase("cavespider")){
    89. world.spawnCreature(TargetLocation, EntityType.CAVE_SPIDER);
    90. }else if(args[0].equalsIgnoreCase("chicken")){
    91. world.spawnCreature(TargetLocation, EntityType.CHICKEN);
    92. }else if(args[0].equalsIgnoreCase("creeper")){
    93. world.spawnCreature(TargetLocation, EntityType.CREEPER);
    94. }else if(args[0].equalsIgnoreCase("enderdragon")){
    95. world.spawnCreature(TargetLocation, EntityType.ENDER_DRAGON);
    96. }else if(args[0].equalsIgnoreCase("enderman")){
    97. world.spawnCreature(TargetLocation, EntityType.ENDERMAN);
    98. }else if(args[0].equalsIgnoreCase("ghast")){
    99. world.spawnCreature(TargetLocation, EntityType.GHAST);
    100. }else if(args[0].equalsIgnoreCase("giant")){
    101. world.spawnCreature(TargetLocation, EntityType.GIANT);
    102. }else if(args[0].equalsIgnoreCase("irongolem")){
    103. world.spawnCreature(TargetLocation, EntityType.IRON_GOLEM);
    104. }else if(args[0].equalsIgnoreCase("magmacube")){
    105. world.spawnCreature(TargetLocation, EntityType.MAGMA_CUBE);
    106. }else if(args[0].equalsIgnoreCase("ocelot")){
    107. world.spawnCreature(TargetLocation, EntityType.OCELOT);
    108. }else if(args[0].equalsIgnoreCase("sheep")){
    109. world.spawnCreature(TargetLocation, EntityType.SHEEP);
    110. }else if(args[0].equalsIgnoreCase("silverfish")){
    111. world.spawnCreature(TargetLocation, EntityType.SILVERFISH);
    112. }else if(args[0].equalsIgnoreCase("skeleton")){
    113. world.spawnCreature(TargetLocation, EntityType.SKELETON);
    114. }else if(args[0].equalsIgnoreCase("slime")){
    115. world.spawnCreature(TargetLocation, EntityType.SLIME);
    116. }else if(args[0].equalsIgnoreCase("spider")){
    117. world.spawnCreature(TargetLocation, EntityType.SPIDER);
    118. }else if(args[0].equalsIgnoreCase("squid")){
    119. world.spawnCreature(TargetLocation, EntityType.SQUID);
    120. }else if(args[0].equalsIgnoreCase("villager")){
    121. world.spawnCreature(TargetLocation, EntityType.VILLAGER);
    122. }else if(args[0].equalsIgnoreCase("zombie")){
    123. world.spawnCreature(TargetLocation, EntityType.ZOMBIE);
    124. }
    125. }
    126. }
    127. return true;
    128. }
    129. }
    130. return true;
    131. }
    132. return true;
    133. }


    Please review my comments.
     
  22. Offline

    1poseidon3

    Perfect, just didn't know what to use and where but you guys helped a ton. Thanks guys you were all super helpful!

    You posted just as I did my thanks but you redid my whole code so I just have to add you in here. I can't thank you guys enough for the help you have given me.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
    Gater12 and Jaker232 like this.
Thread Status:
Not open for further replies.

Share This Page