fix drops
This commit is contained in:
parent
62dd5554eb
commit
8bb25e1021
2 changed files with 7 additions and 5 deletions
2
pom.xml
2
pom.xml
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>giants</groupId>
|
||||
<artifactId>giants</artifactId>
|
||||
<version>22.10.0</version>
|
||||
<version>22.10.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
|
|
@ -2,6 +2,7 @@ package pl.minecon724.giants;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -93,9 +94,10 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|||
for (Object o : config.getList("drops", new ArrayList<Object>())) {
|
||||
try {
|
||||
String[] parts = ((String) o).split(":");
|
||||
for (String s : parts) {
|
||||
getLogger().info(Arrays.asList(parts).subList(1, parts.length).toString());
|
||||
for (String s : Arrays.asList(parts).subList(1, parts.length)) {
|
||||
if (!isNumeric(s)) {
|
||||
throw new IllegalArgumentException(parts[1] + " is not a number");
|
||||
throw new IllegalArgumentException(s + " is not a number");
|
||||
}
|
||||
}
|
||||
Material material = Material.getMaterial(parts[0]);
|
||||
|
@ -177,8 +179,8 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|||
if (entity.getType() == EntityType.GIANT) {
|
||||
giants.remove(entity);
|
||||
for (Entry<Material, List<Integer>> d : drops.entrySet()) {
|
||||
int max = d.getValue().get(0);
|
||||
int min = d.getValue().get(1);
|
||||
int min = d.getValue().get(0);
|
||||
int max = d.getValue().get(1);
|
||||
ItemStack is = new ItemStack(d.getKey(), rnd.nextInt((max - min) + 1) + min);
|
||||
if (rnd.nextInt(100) < d.getValue().get(2)) {
|
||||
entity.getWorld().dropItemNaturally(entity.getLocation(), is);
|
||||
|
|
Loading…
Reference in a new issue