n'egger
This commit is contained in:
parent
0aa91add8a
commit
a45ce796ac
3 changed files with 37 additions and 19 deletions
|
@ -11,7 +11,7 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -21,5 +21,12 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -2,7 +2,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>giants</groupId>
|
<groupId>giants</groupId>
|
||||||
<artifactId>giants</artifactId>
|
<artifactId>giants</artifactId>
|
||||||
<version>22.2.4</version>
|
<version>22.9.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bstats</groupId>
|
<groupId>org.bstats</groupId>
|
||||||
<artifactId>bstats-bukkit</artifactId>
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>3.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -42,12 +42,11 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.4.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<relocations>
|
<relocations>
|
||||||
<relocation>
|
<relocation>
|
||||||
<pattern>org.bstats</pattern>
|
<pattern>org.bstats</pattern>
|
||||||
<!-- Replace this with your package! -->
|
|
||||||
<shadedPattern>pl.minecon724.giants</shadedPattern>
|
<shadedPattern>pl.minecon724.giants</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bstats.charts.SimplePie;
|
import org.bstats.charts.SimplePie;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -71,10 +70,10 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
||||||
attackDamage = config.getDouble("attackDamage", 1.0D);
|
attackDamage = config.getDouble("attackDamage", 1.0D);
|
||||||
attackReach = config.getDouble("attackReach", 2D);
|
attackReach = config.getDouble("attackReach", 2D);
|
||||||
expandUp = config.getDouble("expandUp", 0D);
|
expandUp = config.getDouble("expandUp", 0D);
|
||||||
for (Object s : config.getList("effects", new ArrayList<Object>())) {
|
for (Object o : config.getList("effects", new ArrayList<Object>())) {
|
||||||
try {
|
try {
|
||||||
String[] parts = ((String) s).split(":");
|
String[] parts = ((String) o).split(":");
|
||||||
if (!(StringUtils.isNumeric(parts[1]))) {
|
if (!isNumeric(parts[1])) {
|
||||||
throw new IllegalArgumentException(parts[1] + " is not a number");
|
throw new IllegalArgumentException(parts[1] + " is not a number");
|
||||||
}
|
}
|
||||||
PotionEffectType effectType = PotionEffectType.getByName(parts[0]);
|
PotionEffectType effectType = PotionEffectType.getByName(parts[0]);
|
||||||
|
@ -84,20 +83,19 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
||||||
Integer duration = Integer.valueOf(parts[1]);
|
Integer duration = Integer.valueOf(parts[1]);
|
||||||
effects.put(effectType, duration);
|
effects.put(effectType, duration);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getLogger().severe("Exception while parsing " + s);
|
Bukkit.getLogger().severe("Exception while parsing " + o);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Object s : config.getList("drops", new ArrayList<Object>())) {
|
for (Object o : config.getList("drops", new ArrayList<Object>())) {
|
||||||
try {
|
try {
|
||||||
String[] parts = ((String) s).split(":");
|
String[] parts = ((String) o).split(":");
|
||||||
/*
|
for (String s : parts) {
|
||||||
TODO find a better way to do this
|
if (!isNumeric(s)) {
|
||||||
if (!(StringUtils.isNumeric(parts[1]))) {
|
throw new IllegalArgumentException(parts[1] + " is not a number");
|
||||||
throw new IllegalArgumentException(parts[1] + " is not a number");
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
Material material = Material.getMaterial(parts[0]);
|
Material material = Material.getMaterial(parts[0]);
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
throw new IllegalArgumentException(parts[0] + " is not a Material");
|
throw new IllegalArgumentException(parts[0] + " is not a Material");
|
||||||
|
@ -108,7 +106,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
||||||
data.add(Integer.parseInt(parts[3]));
|
data.add(Integer.parseInt(parts[3]));
|
||||||
drops.put(material, data);
|
drops.put(material, data);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getLogger().severe("Exception while parsing " + s);
|
Bukkit.getLogger().severe("Exception while parsing " + o);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -198,6 +196,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
||||||
passenger.setInvulnerable(true);
|
passenger.setInvulnerable(true);
|
||||||
passenger.setPersistent(true);
|
passenger.setPersistent(true);
|
||||||
passenger.setMetadata("giant", new FixedMetadataValue(this, "y"));
|
passenger.setMetadata("giant", new FixedMetadataValue(this, "y"));
|
||||||
|
passenger.setHealth(Integer.MAX_VALUE);
|
||||||
entity.addPassenger(passenger);
|
entity.addPassenger(passenger);
|
||||||
}
|
}
|
||||||
for (Entry<PotionEffectType, Integer> t : effects.entrySet()) {
|
for (Entry<PotionEffectType, Integer> t : effects.entrySet()) {
|
||||||
|
@ -207,4 +206,17 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
||||||
giants.add(entity);
|
giants.add(entity);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sorry
|
||||||
|
public static boolean isNumeric(String strNum) {
|
||||||
|
if (strNum == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
double d = Double.parseDouble(strNum);
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue