prepare for trouble
This commit is contained in:
parent
fe9d2f658d
commit
e3483f1acc
3 changed files with 40 additions and 2 deletions
2
pom.xml
2
pom.xml
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>giants</groupId>
|
||||
<artifactId>giants</artifactId>
|
||||
<version>22.1.5</version>
|
||||
<version>22.1.6</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
|
|||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -48,6 +49,7 @@ public class Main extends JavaPlugin implements Listener {
|
|||
double expandUp;
|
||||
long refreshDelay;
|
||||
Map<PotionEffectType, Integer> effects = new HashMap<PotionEffectType, Integer>();
|
||||
Map<Material, List<Integer>> drops = new HashMap<Material, List<Integer>>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -79,7 +81,30 @@ public class Main extends JavaPlugin implements Listener {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (Object s : config.getList("drops", new ArrayList<Object>())) {
|
||||
try {
|
||||
String[] parts = ((String) s).split(":");
|
||||
/*
|
||||
TODO find a better way to do this
|
||||
if (!(StringUtils.isNumeric(parts[1]))) {
|
||||
throw new IllegalArgumentException(parts[1] + " is not a number");
|
||||
}
|
||||
*/
|
||||
Material material = Material.getMaterial(parts[0]);
|
||||
if (material == null) {
|
||||
throw new IllegalArgumentException(parts[0] + " is not a Material");
|
||||
}
|
||||
List<Integer> data = new ArrayList<Integer>();
|
||||
data.add(Integer.parseInt(drops[1]));
|
||||
data.add(Integer.parseInt(drops[2]));
|
||||
data.add(Integer.parseInt(drops[3]));
|
||||
drops.put(material, data);
|
||||
} catch (Exception e) {
|
||||
Bukkit.getLogger().severe("Exception while parsing " + s);
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
# If disabled, the giant won't move (but it will still attack)
|
||||
ai: true
|
||||
|
||||
# 0.5 is half a heart
|
||||
attackDamage: 1.0
|
||||
|
||||
# Spawning chance, from 0 to 1
|
||||
chance: 0.02
|
||||
|
||||
# Attack delay in ticks, smaller values will lag the server more
|
||||
hitDelay: 20
|
||||
|
||||
# 0 - attack only entities touching the giant, if too high the giant will hit through walls
|
||||
attackReach: 2
|
||||
|
||||
# Additional potion effects
|
||||
# type:amplifier (max 255)
|
||||
# See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
|
||||
|
@ -16,6 +21,14 @@ effects: []
|
|||
# - "JUMP:1"
|
||||
# - "REGENERATION:2"
|
||||
# - "HEALTH_BOOST:69"
|
||||
|
||||
# Custom drops
|
||||
# material:min quantity:max quantity:chance (percent, from 0 to 100)
|
||||
# See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
|
||||
# Set to [] to disable
|
||||
drops: []
|
||||
# - "APPLE:1:3:25"
|
||||
|
||||
# Head rotations, disabling can slightly improve performance
|
||||
headRotations: true
|
||||
refreshDelay: 20
|
||||
|
|
Loading…
Reference in a new issue