Discussion in 'Spigot Plugin Development' started by harveycat1, May 31, 2017.

  1. I cant get this working to where it has a chance to drop a zombie when the chance is in it only works without it
    Code (Text):
    private Random rand = new Random();

      if (p.hasPermission("keymining.use") && p.getGameMode() == GameMode.SURVIVAL) {
         // The random odject i used is "if (rand.nextInt(101) <= 50)) {"
          if (e.getBlock().getType().equals(Material.STONE)) {
            org.bukkit.Location loc = e.getBlock().getLocation();
            createZombie(loc, 1);
  2. This tells us nothing. What is your problem?
  3. sorry forgot i wasnt in the add code it was my bad fixed it b4 u sent this
  4. So what do you think happens? I presume you're after a 50% chance, if so, this looks about right. Pretty sure Random#nextInt(n), where n is exclusive, as it counts from 0, so it would make 100 counts, and considering you're checking <= 50, this would check for 50% of the cases. I haven't work with randoms much, but Im sure thats how it works.
  5. it defiantly doesnt work as i have even tried putting it up to 100 to make it everytime but it still doesnt work

    EDIT: and i dont know why its doing it as i thought that method would work but it isnt any other really useful methods i could use?
  6. Print out what Random#nextInt produces. Debug.