mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-02-02 04:01:21 +01:00
3.0.0-SNAPSHOT-U6
This commit is contained in:
parent
28ec270364
commit
364466b665
@ -6,6 +6,7 @@
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="Core" />
|
||||
<module name="FactionHelper" />
|
||||
<module name="FactionsM" />
|
||||
<module name="FactionsOne" />
|
||||
@ -13,16 +14,10 @@
|
||||
<module name="LegacyFactions" />
|
||||
<module name="PluginAPI" />
|
||||
</profile>
|
||||
<profile name="Annotation profile for CustomBosses" enabled="true">
|
||||
<sourceOutputDir name="../../target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="../../target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="Core" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="Core" target="1.8" />
|
||||
<module name="custombosses" target="1.5" />
|
||||
<module name="custombosses" target="1.8" />
|
||||
<module name="FactionHelper" target="1.8" />
|
||||
<module name="FactionsM" target="1.8" />
|
||||
<module name="FactionsOne" target="1.8" />
|
||||
|
13
.idea/libraries/Maven__junit_junit_4_12.xml
Normal file
13
.idea/libraries/Maven__junit_junit_4_12.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: junit:junit:4.12">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
Normal file
13
.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -33,37 +33,4 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${plugin.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -27,37 +27,4 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${plugin.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -27,37 +27,4 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${plugin.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -27,37 +27,4 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${plugin.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -5,17 +5,18 @@
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:VaultAPI:1.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.9-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
|
@ -13,37 +13,12 @@
|
||||
<artifactId>PluginAPI</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${plugin.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,90 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author AMinecraftDev
|
||||
* @version 1.0.0
|
||||
* @since 14-Nov-17
|
||||
*/
|
||||
public enum EnchantFinder {
|
||||
|
||||
protection("Protection", Enchantment.PROTECTION_ENVIRONMENTAL, "protection", "protection_environmental"),
|
||||
fire_protection("Fire Protection", Enchantment.PROTECTION_FIRE, "fire protection", "fireprot", "fireprotection", "protection_fire"),
|
||||
feather_falling("Feather Falling", Enchantment.PROTECTION_FALL, "feather falling", "featherfalling", "feather_falling", "protectionfall", "protection_fall"),
|
||||
blast_protection("Blast Protection", Enchantment.PROTECTION_EXPLOSIONS, "blast protection", "blastprotect", "blastprotection", "blast_protection", "protection_explosions"),
|
||||
projectile_protection("Projectile Protection", Enchantment.PROTECTION_PROJECTILE, "projectile protection", "projprotect", "projectileprotect", "projectileprotection", "projectile_protection", "protection_projectile"),
|
||||
respiration("Respiration", Enchantment.OXYGEN, "oxygen", "respiration"),
|
||||
aqua_affinity("Aqua Affinity", Enchantment.WATER_WORKER, "water_worker", "water worker", "aquaaffinity", "aqua_affinity", "aqua affinity"),
|
||||
thorns("Thorns", Enchantment.THORNS, "thorns"),
|
||||
depth_strider("Depth Strider", Enchantment.DEPTH_STRIDER, "depth_strider", "depth strider"),
|
||||
frost_walker("Frost Walker", Enchantment.getById(9), "frost_walker", "frost walker"),
|
||||
binding_curse("Curse of Binding", Enchantment.getById(10), "binding_curse", "binding curse", "curse"),
|
||||
sharpness("Sharpness", Enchantment.DAMAGE_ALL, "sharpness", "damage", "damage all", "damage_all"),
|
||||
smite("Smite", Enchantment.DAMAGE_UNDEAD, "smite", "damage_undead", "damage undead"),
|
||||
bane_of_arthropods("Bane of Arthropods", Enchantment.DAMAGE_ARTHROPODS, "damage_arthropods", "arthropods", "bane_of_arthropods", "bane of arthropods"),
|
||||
knockback("Knockback", Enchantment.KNOCKBACK, "knockback"),
|
||||
fire_aspect("Fire Aspect", Enchantment.FIRE_ASPECT, "fire aspect", "fire_aspect", "fireaspect"),
|
||||
looting("Looting", Enchantment.LOOT_BONUS_MOBS, "looting", "loot bonus mobs", "loot_bonus_mobs"),
|
||||
sweeping_edge("Sweeping Edge", Enchantment.getById(22), "sweeping edge", "sweeping_edge"),
|
||||
efficiency("Efficiency", Enchantment.DIG_SPEED, "efficiency", "dig speed", "dig_speed", "digspeed"),
|
||||
silk_touch("Silk Touch", Enchantment.SILK_TOUCH, "silk touch", "silk_touch", "silktouch", "silk"),
|
||||
unbreaking("Unbreaking", Enchantment.DURABILITY, "durability", "unbreaking"),
|
||||
fortune("Fortune", Enchantment.LOOT_BONUS_BLOCKS, "fortune", "loot_bonus_blocks", "loot bonus blocks"),
|
||||
power("Power", Enchantment.ARROW_DAMAGE, "power", "arrow_damage", "arrow damage"),
|
||||
punch("Punch", Enchantment.ARROW_KNOCKBACK, "punch", "arrow_knockback", "arrow knockback"),
|
||||
flame("Flame", Enchantment.ARROW_FIRE, "flame", "arrow_fire", "arrow fire"),
|
||||
infinite("Infinite", Enchantment.ARROW_INFINITE, "infinite", "arrow_infinite", "arrow infinite"),
|
||||
luck("Luck", Enchantment.LUCK, "luck"),
|
||||
lure("Lure", Enchantment.LURE, "lure"),
|
||||
mending("Mending", Enchantment.getById(70), "mending"),
|
||||
curse_of_vanishing("Curse of Vanishing", Enchantment.getById(71), "vanishing", "vanishing curse", "vanishing_curse", "curseofvanishing", "vanishingcurse", "curse of vanishing", "curse_of_vanishing");
|
||||
|
||||
private Enchantment enchantment;
|
||||
private String fancyName;
|
||||
private List<String> names = new ArrayList<>();
|
||||
|
||||
EnchantFinder(String fancyName, Enchantment enchantment, String... names) {
|
||||
this.fancyName = fancyName;
|
||||
this.enchantment = enchantment;
|
||||
this.names.addAll(Arrays.asList(names));
|
||||
}
|
||||
|
||||
public Enchantment getEnchantment() {
|
||||
return enchantment;
|
||||
}
|
||||
|
||||
public List<String> getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
public String getFancyName() {
|
||||
return fancyName;
|
||||
}
|
||||
|
||||
public static EnchantFinder getByName(String name) {
|
||||
for(EnchantFinder enchantFinder : values()) {
|
||||
List<String> names = enchantFinder.getNames();
|
||||
|
||||
for(String s : names) {
|
||||
if(s.equalsIgnoreCase(name)) return enchantFinder;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EnchantFinder getByEnchant(Enchantment enchantment) {
|
||||
for(EnchantFinder enchantFinder : values()) {
|
||||
Enchantment enchantFinderEnchant = enchantFinder.getEnchantment();
|
||||
|
||||
if(enchantFinderEnchant.equals(enchantment)) return enchantFinder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public interface IConverter<OutputObject, InputObject> {
|
||||
|
||||
OutputObject to(InputObject inputObject);
|
||||
|
||||
InputObject from(OutputObject outputObject);
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public interface IReloadable {
|
||||
|
||||
void reload();
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class NumberUtils {
|
||||
|
||||
private static NumberUtils INSTANCE = new NumberUtils();
|
||||
|
||||
public boolean isInt(String string) {
|
||||
try {
|
||||
Integer.valueOf(string);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isDouble(String string) {
|
||||
try {
|
||||
Double.valueOf(string);
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static NumberUtils get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class StringUtils {
|
||||
|
||||
private static StringUtils INSTANCE = new StringUtils();
|
||||
|
||||
public String stripColor(String string) {
|
||||
return ChatColor.stripColor(string);
|
||||
}
|
||||
|
||||
public String translateColor(String string) {
|
||||
return ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
|
||||
public static StringUtils get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package net.aminecraftdev.custombosses.utils.file;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public interface IFileHandler<ReturnObject> {
|
||||
|
||||
ReturnObject loadFile(File file);
|
||||
|
||||
void saveFile(File file, ReturnObject returnObject);
|
||||
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package net.aminecraftdev.custombosses.utils.file;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.DigestInputStream;
|
||||
import java.security.DigestOutputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* @author drtshock
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ManagedFile {
|
||||
|
||||
private static final int BUFFERSIZE = 1024 * 8;
|
||||
private final transient File file;
|
||||
|
||||
public ManagedFile(final String filename, final JavaPlugin javaPlugin) {
|
||||
file = new File(javaPlugin.getDataFolder(), filename);
|
||||
|
||||
if (file.exists()) {
|
||||
try {
|
||||
if (checkForVersion(file, javaPlugin.getDescription().getVersion()) && !file.delete()) {
|
||||
throw new IOException("Could not delete file " + file.toString());
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
copyResourceAscii("/" + filename, file);
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "items.csv could not be loaded.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyResourceAscii(final String resourceName, final File file) throws IOException {
|
||||
final InputStreamReader reader = new InputStreamReader(ManagedFile.class.getResourceAsStream(resourceName));
|
||||
try {
|
||||
final MessageDigest digest = getDigest();
|
||||
final DigestOutputStream digestStream = new DigestOutputStream(new FileOutputStream(file), digest);
|
||||
try {
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(digestStream);
|
||||
try {
|
||||
final char[] buffer = new char[BUFFERSIZE];
|
||||
do {
|
||||
final int length = reader.read(buffer);
|
||||
if (length >= 0) {
|
||||
writer.write(buffer, 0, length);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
writer.write("\n");
|
||||
writer.flush();
|
||||
final BigInteger hashInt = new BigInteger(1, digest.digest());
|
||||
digestStream.on(false);
|
||||
digestStream.write('#');
|
||||
digestStream.write(hashInt.toString(16).getBytes());
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
} finally {
|
||||
digestStream.close();
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkForVersion(final File file, final String version) throws IOException {
|
||||
if (file.length() < 33) {
|
||||
return false;
|
||||
}
|
||||
final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
|
||||
try {
|
||||
final byte[] buffer = new byte[(int) file.length()];
|
||||
int position = 0;
|
||||
do {
|
||||
final int length = bis.read(buffer, position, Math.min((int) file.length() - position, BUFFERSIZE));
|
||||
if (length < 0) {
|
||||
break;
|
||||
}
|
||||
position += length;
|
||||
} while (position < file.length());
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
|
||||
if (bais.skip(file.length() - 33) != file.length() - 33) {
|
||||
return false;
|
||||
}
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(bais));
|
||||
try {
|
||||
String hash = reader.readLine();
|
||||
if (hash != null && hash.matches("#[a-f0-9]{32}")) {
|
||||
hash = hash.substring(1);
|
||||
bais.reset();
|
||||
final String versionline = reader.readLine();
|
||||
if (versionline != null && versionline.matches("#version: .+")) {
|
||||
final String versioncheck = versionline.substring(10);
|
||||
if (!versioncheck.equalsIgnoreCase(version)) {
|
||||
bais.reset();
|
||||
final MessageDigest digest = getDigest();
|
||||
final DigestInputStream digestStream = new DigestInputStream(bais, digest);
|
||||
try {
|
||||
final byte[] bytes = new byte[(int) file.length() - 33];
|
||||
digestStream.read(bytes);
|
||||
final BigInteger correct = new BigInteger(hash, 16);
|
||||
final BigInteger test = new BigInteger(1, digest.digest());
|
||||
if (correct.equals(test)) {
|
||||
return true;
|
||||
} else {
|
||||
Bukkit.getLogger().warning("File " + file.toString() + " has been modified by user and file version differs, please update the file manually.");
|
||||
}
|
||||
} finally {
|
||||
digestStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
} finally {
|
||||
bis.close();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static MessageDigest getDigest() throws IOException {
|
||||
try {
|
||||
return MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getLines() {
|
||||
try {
|
||||
final BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
try {
|
||||
final List<String> lines = new ArrayList<String>();
|
||||
do {
|
||||
final String line = reader.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
} else {
|
||||
lines.add(line);
|
||||
}
|
||||
} while (true);
|
||||
return lines;
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.EnchantFinder;
|
||||
import net.aminecraftdev.custombosses.utils.IConverter;
|
||||
import net.aminecraftdev.custombosses.utils.StringUtils;
|
||||
import net.aminecraftdev.custombosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemStackConverter implements IConverter<ItemStackHolder, ItemStack> {
|
||||
|
||||
private static final StringUtils STRING_UTILS = new StringUtils();
|
||||
|
||||
@Override
|
||||
public ItemStackHolder to(ItemStack itemStack) {
|
||||
Material material = itemStack.getType();
|
||||
Short durability = itemStack.getDurability();
|
||||
String type = null, name = null, skullOwner = null, spawnerType = null;
|
||||
List<String> lore = null, enchants = null;
|
||||
|
||||
if(durability == 0) {
|
||||
durability = null;
|
||||
}
|
||||
|
||||
if(itemStack.hasItemMeta()) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta.hasDisplayName()) {
|
||||
name = STRING_UTILS.stripColor(itemMeta.getDisplayName());
|
||||
}
|
||||
|
||||
if(itemMeta.hasLore()) {
|
||||
lore = new ArrayList<>();
|
||||
|
||||
for(String string : itemMeta.getLore()) {
|
||||
lore.add(STRING_UTILS.stripColor(string));
|
||||
}
|
||||
}
|
||||
|
||||
if(itemMeta.hasEnchants()) {
|
||||
enchants = new ArrayList<>();
|
||||
|
||||
for(Map.Entry<Enchantment, Integer> entry : itemMeta.getEnchants().entrySet()) {
|
||||
int level = entry.getValue();
|
||||
Enchantment enchantment = entry.getKey();
|
||||
EnchantFinder enchantFinder = EnchantFinder.getByEnchant(enchantment);
|
||||
|
||||
if(enchantFinder == null) {
|
||||
throw new EnumConstantNotPresentException(EnchantFinder.class, "EnchantFinder couldn't find a value for " + enchantment.getName() + ". Please report this to @AMinecraftDev so he can fix it.");
|
||||
}
|
||||
|
||||
enchants.add(enchantFinder.getFancyName() + ":" + level);
|
||||
}
|
||||
}
|
||||
|
||||
if(itemMeta instanceof SkullMeta) {
|
||||
SkullMeta skullMeta = (SkullMeta) itemMeta;
|
||||
|
||||
if(skullMeta.hasOwner()) {
|
||||
skullOwner = skullMeta.getOwner();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ItemStackHolder(type, durability, name, lore, enchants, skullOwner, spawnerType, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack from(ItemStackHolder itemStackHolder) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import net.aminecraftdev.custombosses.utils.file.IFileHandler;
|
||||
import net.aminecraftdev.custombosses.utils.itemstack.holder.ItemStackHolder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemStackFileHandler implements IFileHandler<Map<String, ItemStackHolder>> {
|
||||
|
||||
private static final Gson GSON = new GsonBuilder()
|
||||
.setPrettyPrinting()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.create();
|
||||
|
||||
@Override
|
||||
public Map<String, ItemStackHolder> loadFile(File file) {
|
||||
Map<String, ItemStackHolder> itemStackHolderMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
FileReader fileReader = new FileReader(file);
|
||||
JsonObject jsonObject = GSON.fromJson(fileReader, JsonObject.class);
|
||||
|
||||
fileReader.close();
|
||||
|
||||
if(jsonObject != null) {
|
||||
jsonObject.entrySet().forEach(entry -> {
|
||||
String id = entry.getKey();
|
||||
ItemStackHolder itemStackHolder = GSON.fromJson(entry.getValue(), ItemStackHolder.class);
|
||||
|
||||
itemStackHolderMap.put(id, itemStackHolder);
|
||||
});
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return itemStackHolderMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveFile(File file, Map<String, ItemStackHolder> map) {
|
||||
try {
|
||||
FileWriter fileWriter = new FileWriter(file);
|
||||
Type type = new TypeToken<Map<String, ItemStackHolder>>(){}.getType();
|
||||
|
||||
fileWriter.write(GSON.toJson(new HashMap<>(map), type));
|
||||
fileWriter.flush();
|
||||
fileWriter.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.NumberUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemStackUtils {
|
||||
|
||||
private static final Pattern SPLIT_PATTERN = Pattern.compile("((.*)[:+',;.](\\d+))");
|
||||
private static final NumberUtils NUMBER_UTILS = new NumberUtils();
|
||||
|
||||
public ItemStack getItemStackByString(String id) {
|
||||
int itemId = 0;
|
||||
short metaData = 0;
|
||||
String itemName;
|
||||
|
||||
Matcher matcher = SPLIT_PATTERN.matcher(id);
|
||||
|
||||
if(matcher.matches()) {
|
||||
itemName = matcher.group(2);
|
||||
metaData = Short.parseShort(matcher.group(3));
|
||||
} else {
|
||||
itemName = id;
|
||||
}
|
||||
|
||||
if(NUMBER_UTILS.isInt(itemName)) {
|
||||
itemId = Integer.parseInt(itemName);
|
||||
} else if(NUMBER_UTILS.isInt(id)) {
|
||||
itemId = Integer.parseInt(id);
|
||||
} else {
|
||||
itemName = itemName.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
Material material = Material.getMaterial(itemId);
|
||||
|
||||
if(material == null) {
|
||||
material = Material.getMaterial(itemName);
|
||||
}
|
||||
|
||||
if(material == null) material = Material.AIR;
|
||||
|
||||
return new ItemStack(material, 1, metaData);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack.holder;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemStackHolder {
|
||||
|
||||
@Expose private String type;
|
||||
@Expose private Short durability;
|
||||
@Expose private String name;
|
||||
@Expose private List<String> lore;
|
||||
@Expose private List<String> enchants;
|
||||
@Expose private String skullOwner;
|
||||
@Expose private String spawnerType;
|
||||
@Expose private Boolean glowing;
|
||||
|
||||
public ItemStackHolder(String type, Short durability, String name, List<String> lore, List<String> enchants, String skullOwner, String spawnerType, Boolean glowing) {
|
||||
this.type = type;
|
||||
this.durability = durability;
|
||||
this.name = name;
|
||||
this.lore = lore;
|
||||
this.enchants = enchants;
|
||||
this.skullOwner = skullOwner;
|
||||
this.spawnerType = spawnerType;
|
||||
this.glowing = glowing;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Short getDurability() {
|
||||
return durability;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<String> getLore() {
|
||||
return lore;
|
||||
}
|
||||
|
||||
public List<String> getEnchants() {
|
||||
return enchants;
|
||||
}
|
||||
|
||||
public String getSkullOwner() {
|
||||
return skullOwner;
|
||||
}
|
||||
|
||||
public String getSpawnerType() {
|
||||
return spawnerType;
|
||||
}
|
||||
|
||||
public Boolean getIsGlowing() {
|
||||
return glowing;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack.repository;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemData {
|
||||
|
||||
private final int itemNo;
|
||||
private final short itemData;
|
||||
|
||||
protected ItemData(final int itemNo, final short itemData) {
|
||||
this.itemNo = itemNo;
|
||||
this.itemData = itemData;
|
||||
}
|
||||
|
||||
private int getItemNo() {
|
||||
return itemNo;
|
||||
}
|
||||
|
||||
private short getItemData() {
|
||||
return itemData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (31 * itemNo) ^ itemData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(o instanceof ItemData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemData pairo = (ItemData) o;
|
||||
return this.itemNo == pairo.getItemNo() && this.itemData == pairo.getItemData();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,208 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack.repository;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.IReloadable;
|
||||
import net.aminecraftdev.custombosses.utils.NumberUtils;
|
||||
import net.aminecraftdev.custombosses.utils.file.ManagedFile;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemStackRepository implements IReloadable {
|
||||
|
||||
private static ItemStackRepository instance;
|
||||
|
||||
private final Pattern csvSplitPattern = Pattern.compile("(\"([^\"]*)\"|[^,]*)(,|$)");
|
||||
private final Pattern splitPattern = Pattern.compile("((.*)[:+',;.](\\d+))");
|
||||
private final Map<String, Integer> items = new HashMap<>();
|
||||
private final Map<ItemData, List<String>> names = new HashMap<>();
|
||||
private final Map<ItemData, String> primaryName = new HashMap<>();
|
||||
private final Map<String, Short> durabilities = new HashMap<>();
|
||||
private final Map<String, String> nbtData = new HashMap<>();
|
||||
private final ManagedFile file;
|
||||
|
||||
public ItemStackRepository(JavaPlugin javaPlugin) {
|
||||
instance = this;
|
||||
|
||||
file = new ManagedFile("items.csv", javaPlugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
final List<String> lines = file.getLines();
|
||||
|
||||
if (lines.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
durabilities.clear();
|
||||
items.clear();
|
||||
names.clear();
|
||||
primaryName.clear();
|
||||
|
||||
for (String line : lines) {
|
||||
if (line.length() > 0 && line.charAt(0) == '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
String itemName = null;
|
||||
int numeric = -1;
|
||||
short data = 0;
|
||||
String nbt = null;
|
||||
|
||||
int col = 0;
|
||||
Matcher matcher = csvSplitPattern.matcher(line);
|
||||
while (matcher.find()) {
|
||||
String match = matcher.group(1);
|
||||
if (StringUtils.stripToNull(match) == null) {
|
||||
continue;
|
||||
}
|
||||
match = StringUtils.strip(match.trim(), "\"");
|
||||
switch (col) {
|
||||
case 0:
|
||||
itemName = match.toLowerCase(Locale.ENGLISH);
|
||||
break;
|
||||
case 1:
|
||||
numeric = Integer.parseInt(match);
|
||||
break;
|
||||
case 2:
|
||||
data = Short.parseShort(match);
|
||||
break;
|
||||
case 3:
|
||||
nbt = StringUtils.stripToNull(match);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
col++;
|
||||
}
|
||||
// Invalid row
|
||||
if (itemName == null || numeric < 0) {
|
||||
continue;
|
||||
}
|
||||
durabilities.put(itemName, data);
|
||||
items.put(itemName, numeric);
|
||||
if (nbt != null) {
|
||||
nbtData.put(itemName, nbt);
|
||||
}
|
||||
|
||||
ItemData itemData = new ItemData(numeric, data);
|
||||
if (names.containsKey(itemData)) {
|
||||
List<String> nameList = names.get(itemData);
|
||||
nameList.add(itemName);
|
||||
} else {
|
||||
List<String> nameList = new ArrayList<>();
|
||||
nameList.add(itemName);
|
||||
names.put(itemData, nameList);
|
||||
primaryName.put(itemData, itemName);
|
||||
}
|
||||
}
|
||||
|
||||
for (List<String> nameList : names.values()) {
|
||||
nameList.sort(LengthCompare.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(String id, int quantity) {
|
||||
ItemStack itemStack = getItemStack(id.toLowerCase(Locale.ENGLISH));
|
||||
|
||||
itemStack.setAmount(quantity);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack(String id) {
|
||||
int itemid = 0;
|
||||
String itemname;
|
||||
short metaData = 0;
|
||||
Matcher parts = splitPattern.matcher(id);
|
||||
if (parts.matches()) {
|
||||
itemname = parts.group(2);
|
||||
metaData = Short.parseShort(parts.group(3));
|
||||
} else {
|
||||
itemname = id;
|
||||
}
|
||||
|
||||
if (NumberUtils.get().isInt(itemname)) {
|
||||
itemid = Integer.parseInt(itemname);
|
||||
} else if (NumberUtils.get().isInt(id)) {
|
||||
itemid = Integer.parseInt(id);
|
||||
} else {
|
||||
itemname = itemname.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
if (itemid < 1) {
|
||||
if (items.containsKey(itemname)) {
|
||||
itemid = items.get(itemname);
|
||||
if (durabilities.containsKey(itemname) && metaData == 0) {
|
||||
metaData = durabilities.get(itemname);
|
||||
}
|
||||
} else if (Material.getMaterial(itemname.toUpperCase(Locale.ENGLISH)) != null) {
|
||||
Material bMaterial = Material.getMaterial(itemname.toUpperCase(Locale.ENGLISH));
|
||||
itemid = bMaterial.getId();
|
||||
} else {
|
||||
try {
|
||||
Material bMaterial = Bukkit.getUnsafe().getMaterialFromInternalName(itemname.toLowerCase(Locale.ENGLISH));
|
||||
itemid = bMaterial.getId();
|
||||
} catch (Throwable throwable) {
|
||||
// throw new Exception(tl("unknownItemName", itemname), throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemid < 1) {
|
||||
// throw new Exception(tl("unknownItemName", itemname));
|
||||
}
|
||||
|
||||
final Material mat = Material.getMaterial(itemid);
|
||||
if (mat == null) {
|
||||
// throw new Exception(tl("unknownItemId", itemid));
|
||||
}
|
||||
ItemStack retval = new ItemStack(mat);
|
||||
if (nbtData.containsKey(itemname)) {
|
||||
String nbt = nbtData.get(itemname);
|
||||
if (nbt.startsWith("*")) {
|
||||
nbt = nbtData.get(nbt.substring(1));
|
||||
}
|
||||
// retval = ess.getServer().getUnsafe().modifyItemStack(retval, nbt);
|
||||
}
|
||||
if (mat == Material.MOB_SPAWNER) {
|
||||
if (metaData == 0) metaData = EntityType.PIG.getTypeId();
|
||||
try {
|
||||
// retval = ess.getSpawnerProvider().setEntityType(retval, EntityType.fromId(metaData));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// throw new Exception("Can't spawn entity ID " + metaData + " from mob spawners.");
|
||||
}
|
||||
} else if (mat == Material.MONSTER_EGG) {
|
||||
EntityType type;
|
||||
try {
|
||||
type = EntityType.fromId(metaData);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// throw new Exception("Can't spawn entity ID " + metaData + " from spawn eggs.");
|
||||
}
|
||||
// retval = ess.getSpawnEggProvider().createEggItem(type);
|
||||
} else if (mat.name().endsWith("POTION")) {
|
||||
// && ReflUtil.getNmsVersionObject().isLowerThan(ReflUtil.V1_11_R1)) { // Only apply this to pre-1.11 as items.csv might only work in 1.11
|
||||
// retval = ess.getPotionMetaProvider().createPotionItem(mat, metaData);
|
||||
} else {
|
||||
retval.setDurability(metaData);
|
||||
}
|
||||
retval.setAmount(mat.getMaxStackSize());
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static ItemStackRepository get() {
|
||||
return instance;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.aminecraftdev.custombosses.utils.itemstack.repository;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class LengthCompare implements Comparator<String> {
|
||||
|
||||
protected static final LengthCompare INSTANCE = new LengthCompare();
|
||||
|
||||
private LengthCompare() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return o1.length() - o2.length();
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.itemstack.ItemStackUtils;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 28-Apr-18
|
||||
*/
|
||||
public class ItemStackUtilsTest {
|
||||
|
||||
private ItemStackUtils itemStackUtils;
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
this.itemStackUtils = new ItemStackUtils();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getItemStackId() {
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
System.out.println("Testing 'getItemStackId'...");
|
||||
|
||||
ItemStack itemStack = this.itemStackUtils.getItemStackByString("diamondhelmet");
|
||||
|
||||
System.out.println("type > " + itemStack.getType());
|
||||
System.out.println("durability > " + itemStack.getDurability());
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
61
jars/bosses.json
Normal file
61
jars/bosses.json
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"SkeletonKing": {
|
||||
"editing": false,
|
||||
"mainStats": {
|
||||
"entityType": "SKELETON",
|
||||
"health": 500,
|
||||
"displayName": "&6&lSkeleton King Boss"
|
||||
},
|
||||
"spawnItem": "SKSpawnEgg",
|
||||
"equipment": {
|
||||
"helmet": "SKHelmet",
|
||||
"chestplate": "SKChestplate",
|
||||
"leggings": "SKLeggings",
|
||||
"boots": "SKBoots"
|
||||
},
|
||||
"hands": {
|
||||
"mainHand": "SKMainHand",
|
||||
"offHand": "SKOffHand"
|
||||
},
|
||||
"potions": [
|
||||
{
|
||||
"type": "resistance",
|
||||
"level": 3,
|
||||
"duration": -1
|
||||
},
|
||||
{
|
||||
"type": "speed",
|
||||
"level": 1,
|
||||
"duration": 500
|
||||
}
|
||||
],
|
||||
"skills": {
|
||||
"overallChance": 35.5,
|
||||
"masterMessage": "SKMainSkillMessage",
|
||||
"skills": [
|
||||
"KNOCKBACK1",
|
||||
"CAGE1"
|
||||
]
|
||||
},
|
||||
"drops": {
|
||||
"naturalDrops": false,
|
||||
"dropExp": false,
|
||||
"dropTable": "SKTable"
|
||||
},
|
||||
"messages": {
|
||||
"onSpawn": "SKOnSpawn",
|
||||
"onDeath": "SKOnDeath",
|
||||
"taunts": {
|
||||
"delay": 60,
|
||||
"taunts": [
|
||||
"SKTaunt1",
|
||||
"SKTaunt2"
|
||||
]
|
||||
}
|
||||
},
|
||||
"commands": {
|
||||
"onSpawn": "SKOnSpawn",
|
||||
"onDeath": "SKOnDeath"
|
||||
}
|
||||
}
|
||||
}
|
57
jars/items.json
Normal file
57
jars/items.json
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"SKSpawnItem": {
|
||||
"type": "383",
|
||||
"durability": "51",
|
||||
"name": "&6&lSkeleton King Boss Spawn Egg",
|
||||
"lore": [
|
||||
"&7Right click a block to spawn",
|
||||
"&7the boss as that location."
|
||||
],
|
||||
"skullOwner": "",
|
||||
"enchants": [],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKHelmet": {
|
||||
"type": "gold_helmet",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKChestplate": {
|
||||
"type": "gold_chestplate",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKLeggings": {
|
||||
"type": "gold_leggings",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKBoots": {
|
||||
"type": "diamond_boots",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKMainHand": {
|
||||
"type": "diamond_sword",
|
||||
"enchants": [ "sharpness:4", "unbreaking:3" ]
|
||||
},
|
||||
"SKOffHand": {
|
||||
"type": "shield"
|
||||
}
|
||||
}
|
@ -1,19 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/../../target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/../../target/test-classes" />
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources-json" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources-yml" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="PluginAPI" />
|
||||
<orderEntry type="module" module-name="FactionHelper" />
|
||||
<orderEntry type="module" module-name="FactionsM" />
|
||||
<orderEntry type="module" module-name="FactionsUUID" />
|
||||
<orderEntry type="module" module-name="FactionsOne" />
|
||||
<orderEntry type="module" module-name="PluginAPI" />
|
||||
<orderEntry type="module" module-name="FactionsUUID" />
|
||||
<orderEntry type="module" module-name="LegacyFactions" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:VaultAPI:1.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.9-R0.1-SNAPSHOT" level="project" />
|
||||
|
@ -15,74 +15,56 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionsM</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionsUUID</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<artifactId>FactionsOne</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aminecraftdev.custombosses</groupId>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>PluginAPI</artifactId>
|
||||
<version>3.0.0.0</version>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionsM</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency><dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionsOne</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionsUUID</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>LegacyFactions</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>../../target</directory>
|
||||
<finalName>CustomBosses-${plugin.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/resources/</directory>
|
||||
<includes>
|
||||
<include>*.json</include>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<showDeprecation>false</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@ -94,5 +76,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
3
plugin-modules/Core/resources-json/autospawns.json
Normal file
3
plugin-modules/Core/resources-json/autospawns.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
61
plugin-modules/Core/resources-json/bosses.json
Normal file
61
plugin-modules/Core/resources-json/bosses.json
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"SkeletonKing": {
|
||||
"editing": false,
|
||||
"mainStats": {
|
||||
"entityType": "SKELETON",
|
||||
"health": 500,
|
||||
"displayName": "&6&lSkeleton King Boss"
|
||||
},
|
||||
"spawnItem": "SKSpawnEgg",
|
||||
"equipment": {
|
||||
"helmet": "SKHelmet",
|
||||
"chestplate": "SKChestplate",
|
||||
"leggings": "SKLeggings",
|
||||
"boots": "SKBoots"
|
||||
},
|
||||
"hands": {
|
||||
"mainHand": "SKMainHand",
|
||||
"offHand": "SKOffHand"
|
||||
},
|
||||
"potions": [
|
||||
{
|
||||
"type": "resistance",
|
||||
"level": 3,
|
||||
"duration": -1
|
||||
},
|
||||
{
|
||||
"type": "speed",
|
||||
"level": 1,
|
||||
"duration": 500
|
||||
}
|
||||
],
|
||||
"skills": {
|
||||
"overallChance": 35.5,
|
||||
"masterMessage": "SKMainSkillMessage",
|
||||
"skills": [
|
||||
"KNOCKBACK1",
|
||||
"CAGE1"
|
||||
]
|
||||
},
|
||||
"drops": {
|
||||
"naturalDrops": false,
|
||||
"dropExp": false,
|
||||
"dropTable": "SKTable"
|
||||
},
|
||||
"messages": {
|
||||
"onSpawn": "SKOnSpawn",
|
||||
"onDeath": "SKOnDeath",
|
||||
"taunts": {
|
||||
"delay": 60,
|
||||
"taunts": [
|
||||
"SKTaunt1",
|
||||
"SKTaunt2"
|
||||
]
|
||||
}
|
||||
},
|
||||
"commands": {
|
||||
"onSpawn": "SKOnSpawn",
|
||||
"onDeath": "SKOnDeath"
|
||||
}
|
||||
}
|
||||
}
|
57
plugin-modules/Core/resources-json/items.json
Normal file
57
plugin-modules/Core/resources-json/items.json
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"SKSpawnItem": {
|
||||
"type": "383",
|
||||
"durability": "51",
|
||||
"name": "&6&lSkeleton King Boss Spawn Egg",
|
||||
"lore": [
|
||||
"&7Right click a block to spawn",
|
||||
"&7the boss as that location."
|
||||
],
|
||||
"skullOwner": "",
|
||||
"enchants": [],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKHelmet": {
|
||||
"type": "gold_helmet",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKChestplate": {
|
||||
"type": "gold_chestplate",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKLeggings": {
|
||||
"type": "gold_leggings",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKBoots": {
|
||||
"type": "diamond_boots",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
},
|
||||
"SKMainHand": {
|
||||
"type": "diamond_sword",
|
||||
"enchants": [ "sharpness:4", "unbreaking:3" ]
|
||||
},
|
||||
"SKOffHand": {
|
||||
"type": "shield"
|
||||
}
|
||||
}
|
8
plugin-modules/Core/resources-yml/config.yml
Normal file
8
plugin-modules/Core/resources-yml/config.yml
Normal file
@ -0,0 +1,8 @@
|
||||
Hooks:
|
||||
ASkyBlock: false
|
||||
Factions: false
|
||||
StackMob: false
|
||||
WorldEdit: true
|
||||
WorldGuard: true
|
||||
Menu:
|
||||
enabledBlock: EMERALD_BLOCK
|
677
plugin-modules/Core/resources-yml/editor.yml
Normal file
677
plugin-modules/Core/resources-yml/editor.yml
Normal file
@ -0,0 +1,677 @@
|
||||
# MainPanel: # panel name #
|
||||
# name: '&b&l{boss} Editor' # panel display name #
|
||||
# slots: 45 # panel size #
|
||||
# Settings: # settings section #
|
||||
# emptySpaceFiller: true # fill in empty space #
|
||||
# fillTo: 0 # fill to slot #
|
||||
# backButton: false # use back button #
|
||||
# exitButton: false # use exit button #
|
||||
# EmptySpaceFiller: # empty space filler itemstack #
|
||||
# type: '160:0' # empty space filler type #
|
||||
# name: '&7' # empty space filler name #
|
||||
# Buttons: # buttons section #
|
||||
# BackButton: 9 # back button slot #
|
||||
# ExitButton: 9 # exit button slot #
|
||||
|
||||
MainPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 45
|
||||
Settings:
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: '160:0'
|
||||
name: '&7'
|
||||
Items:
|
||||
'12':
|
||||
type: DIAMOND
|
||||
name: '&c&lDrops Manager'
|
||||
lore:
|
||||
- '&7Click here to manage the drop table'
|
||||
- '&7that is attached to this boss.'
|
||||
Button: Drops
|
||||
'14':
|
||||
type: DIAMOND_HELMET
|
||||
name: '&c&lEquipment Manager'
|
||||
lore:
|
||||
- '&7Click here to manage the equipment'
|
||||
- '&7that the boss has equipped.'
|
||||
Button: Equipment
|
||||
'16':
|
||||
type: BONE
|
||||
name: '&a&lTargeting Manager'
|
||||
lore:
|
||||
- '&7Click here to edit how the boss handles'
|
||||
- '&7targeting of players and mobs.'
|
||||
Button: Targeting
|
||||
'22':
|
||||
type: BOW
|
||||
name: '&c&lWeapon Manager'
|
||||
lore:
|
||||
- '&7Click here to manage the weapon(s)'
|
||||
- '&7that the boss has equipped.'
|
||||
Button: Weapon
|
||||
'23':
|
||||
type: BARRIER
|
||||
name: '&c&l!&4&l!&c&l! &4&lWARNING &c&l!&4&l!&c&l!'
|
||||
lore:
|
||||
- '&7While editing is enabled for this boss'
|
||||
- '&7no one will be able to spawn it, nor'
|
||||
- '&7will it spawn naturally.'
|
||||
'24':
|
||||
type: BLAZE_POWDER
|
||||
name: '&c&lSkill Manager'
|
||||
lore:
|
||||
- '&7Click here to manage the assigned'
|
||||
- '&7skill(s) the boss has and their occurrence'
|
||||
- '&7chances.'
|
||||
Button: Skill
|
||||
'32':
|
||||
type: '351:4'
|
||||
name: '&a&lStatistics Manager'
|
||||
lore:
|
||||
- '&7Click here to edit the statistics of the'
|
||||
- '&7boss, including things like: health,'
|
||||
- '&7potion effects, commands on spawn, etc.'
|
||||
Button: Stats
|
||||
'39':
|
||||
type: REDSTONE
|
||||
name: '&a&lParticle Manager'
|
||||
lore:
|
||||
- '&7Click here to manage the particles the'
|
||||
- '&7boss has equipped during certain events.'
|
||||
Button: Particle
|
||||
'41':
|
||||
type: GRASS
|
||||
name: '&a&lSpawning Manager'
|
||||
lore:
|
||||
- '&7Click here to edit how the boss handles'
|
||||
- '&7spawning.'
|
||||
Button: Spawning
|
||||
'43':
|
||||
type: BOOK
|
||||
name: '&a&lText Manager'
|
||||
lore:
|
||||
- '&7Click here to edit the taunts, sayings,'
|
||||
- '&7etc. for this boss.'
|
||||
Button: Text
|
||||
DropsPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&b&lSelected Drop Table'
|
||||
lore:
|
||||
- '&7The current selected drop'
|
||||
- '&7table is: &b{dropTable}&7.'
|
||||
- '&7'
|
||||
- '&b&lHints'
|
||||
- '&b&l* &7If this shows N/A it means'
|
||||
- '&7 there was an issue loading the'
|
||||
- '&7 previous table, or it doesn''t'
|
||||
- '&7 have one selected.'
|
||||
- '&b&l* &7Click here to go straight to the'
|
||||
- '&7 editing screen of the drop table.'
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of drop tables.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lCreate a new Drop Table'
|
||||
lore:
|
||||
- '&7Click here to create a new drop'
|
||||
- '&7table. It will automatically be'
|
||||
- '&7assigned to this boss when created.'
|
||||
Button: CreateDropTable
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of drop tables.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: BOOK
|
||||
name: '&c&lDrops Guide'
|
||||
lore:
|
||||
- '&7When selecting the drop table for this custom boss'
|
||||
- '&7you can either choose from one of the above listed'
|
||||
- '&7pre-configured drop tables or you can make a'
|
||||
- '&7new one for this boss.'
|
||||
- '&7'
|
||||
- '&c&lHints'
|
||||
- '&c&l* &7The currently selected drop table will be shown'
|
||||
- '&7 with an emerald which states so.'
|
||||
- '&c&l* &7Every d rop table from every boss will be listed'
|
||||
- '&7 here as an available drop table.'
|
||||
EquipmentPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 9
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: '160:0'
|
||||
name: '&7'
|
||||
Buttons:
|
||||
BackButton: 9
|
||||
Items:
|
||||
'2':
|
||||
type: DIAMOND_HELMET
|
||||
name: '&c&lHelmet'
|
||||
lore:
|
||||
- '&7Click here to change the'
|
||||
- '&7helmet for the &f{boss}'
|
||||
- '&7or add one from your'
|
||||
- '&7inventory.'
|
||||
Button: Helmet
|
||||
'3':
|
||||
type: DIAMOND_CHESTPLATE
|
||||
name: '&c&lChestplate'
|
||||
lore:
|
||||
- '&7Click here to change the'
|
||||
- '&7chestplate for the &f{boss}'
|
||||
- '&7or add one from your'
|
||||
- '&7inventory.'
|
||||
Button: Chestplate
|
||||
'4':
|
||||
type: DIAMOND_LEGGINGS
|
||||
name: '&c&lLeggings'
|
||||
lore:
|
||||
- '&7Click here to change the'
|
||||
- '&7leggings for the &f{boss}'
|
||||
- '&7or add one from your'
|
||||
- '&7inventory.'
|
||||
Button: Leggings
|
||||
'5':
|
||||
type: DIAMOND_BOOTS
|
||||
name: '&c&lBoots'
|
||||
lore:
|
||||
- '&7Click here to change the'
|
||||
- '&7boots for the &f{boss}'
|
||||
- '&7or add one from your'
|
||||
- '&7inventory.'
|
||||
Button: Boots
|
||||
'8':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
'9':
|
||||
type: BOOK
|
||||
name: '&c&lEquipment Guide'
|
||||
lore:
|
||||
- '&7here you can choose what equipment'
|
||||
- '&7this boss has. To choose simply click'
|
||||
- '&7the desired piece, then click one of'
|
||||
- '&7the preset pieces or click the diamond'
|
||||
- '&7block to add a new piece from your'
|
||||
- '&7inventory.'
|
||||
HelmetPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
backButton: true
|
||||
Buttons:
|
||||
BackButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&c&lRemove'
|
||||
lore:
|
||||
- '&7click here to remove the'
|
||||
- '&7currently equipped helmet.'
|
||||
Button: Remove
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of helmets.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lAdd New Helmet'
|
||||
lore:
|
||||
- '&7Click here to add a new'
|
||||
- '&7helmet which you have in your'
|
||||
- '&7inventory.'
|
||||
Button: AddNew
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of helmets.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
ChestplatePanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
backButton: true
|
||||
Buttons:
|
||||
BackButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&c&lRemove'
|
||||
lore:
|
||||
- '&7click here to remove the'
|
||||
- '&7currently equipped chestplate.'
|
||||
Button: Remove
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of chestplates.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lAdd New Chestplate'
|
||||
lore:
|
||||
- '&7Click here to add a new'
|
||||
- '&7chestplate which you have in your'
|
||||
- '&7inventory.'
|
||||
Button: AddNew
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of chestplates.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
LeggingsPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
backButton: true
|
||||
Buttons:
|
||||
BackButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&c&lRemove'
|
||||
lore:
|
||||
- '&7click here to remove the'
|
||||
- '&7currently equipped {type}.'
|
||||
Button: Remove
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of leggings.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lAdd New Leggings'
|
||||
lore:
|
||||
- '&7Click here to add a new'
|
||||
- '&7leggings which you have in your'
|
||||
- '&7inventory.'
|
||||
Button: AddNew
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of leggings.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
BootsPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
backButton: true
|
||||
Buttons:
|
||||
BackButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&c&lRemove'
|
||||
lore:
|
||||
- '&7click here to remove the'
|
||||
- '&7currently equipped {type}.'
|
||||
Button: Remove
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of boots.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lAdd New Boots'
|
||||
lore:
|
||||
- '&7Click here to add a new'
|
||||
- '&7boots which you have in your'
|
||||
- '&7inventory.'
|
||||
Button: AddNew
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of boots.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
TargetingPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 27
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: '160:0'
|
||||
name: '&7'
|
||||
Buttons:
|
||||
BackButton: 27
|
||||
Items:
|
||||
'5':
|
||||
type: REDSTONE_BLOCK
|
||||
name: '&e&lSpawner'
|
||||
lore:
|
||||
- '&7This target system will only'
|
||||
- '&7target the player who spawned'
|
||||
- '&7the boss.'
|
||||
TargetingSystem: Spawner
|
||||
'12':
|
||||
type: REDSTONE_BLOCK
|
||||
name: '&e&lLast Damage'
|
||||
lore:
|
||||
- '&7This target system will'
|
||||
- '&7target the last player that'
|
||||
- '&7damaged the boss and update'
|
||||
- '&7every time someone hits the'
|
||||
- '&7boss.'
|
||||
TargetingSystem: LastDamage
|
||||
'16':
|
||||
type: REDSTONE_BLOCK
|
||||
name: '&e&lTop Damage'
|
||||
lore:
|
||||
- '&7This target system will'
|
||||
- '&7target the player who has'
|
||||
- '&7the most damage that is'
|
||||
- '&7nearby.'
|
||||
TargetingSystem: TopDamage
|
||||
'23':
|
||||
type: BOOK
|
||||
name: '&c&lTargeting Guide'
|
||||
lore:
|
||||
- '&7Here you can choose how'
|
||||
- '&7the boss handles targeting'
|
||||
- '&7of players.'
|
||||
'27':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
WeaponPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 9
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: '160:0'
|
||||
name: '&7'
|
||||
Buttons:
|
||||
BackButton: 9
|
||||
Items:
|
||||
'1':
|
||||
type: BOOK
|
||||
name: '&c&lWeapons Guide'
|
||||
lore:
|
||||
- '&7here you can choose what weapons'
|
||||
- '&7this boss has. To choose simply click'
|
||||
- '&7the desired hand, then click one of'
|
||||
- '&7the preset weapons or click the diamond'
|
||||
- '&7block to add a new weapon from your'
|
||||
- '&7inventory.'
|
||||
'4':
|
||||
type: DIAMOND_SWORD
|
||||
name: '&c&lMain Hand'
|
||||
lore:
|
||||
- '&7Click here to modify the'
|
||||
- '&7main hand for the &f{boss}&7.'
|
||||
Button: MainHand
|
||||
'6':
|
||||
type: SHIELD
|
||||
name: '&c&lOff Hand'
|
||||
lore:
|
||||
- '&7Click here to modify the'
|
||||
- '&7off hand for the &f{boss}&7.'
|
||||
Button: OffHand
|
||||
'9':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
MainHandPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
backButton: true
|
||||
Buttons:
|
||||
BackButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&c&lRemove'
|
||||
lore:
|
||||
- '&7click here to remove the'
|
||||
- '&7currently equipped main hand.'
|
||||
Button: Remove
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of weapons.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lAdd New Weapon'
|
||||
lore:
|
||||
- '&7Click here to add a new'
|
||||
- '&7weapon which you have in your'
|
||||
- '&7inventory.'
|
||||
Button: AddNew
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of weapons.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
OffHandPanel:
|
||||
name: '&b&l{boss} Editor'
|
||||
slots: 54
|
||||
Settings:
|
||||
fillTo: 45
|
||||
backButton: true
|
||||
Buttons:
|
||||
BackButton: 54
|
||||
Items:
|
||||
'46':
|
||||
type: DIAMOND
|
||||
name: '&c&lRemove'
|
||||
lore:
|
||||
- '&7click here to remove the'
|
||||
- '&7currently equipped off hand.'
|
||||
Button: Remove
|
||||
'47':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'48':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'49':
|
||||
type: ARROW
|
||||
name: '&e&l&m<-&e&l Previous Page'
|
||||
lore:
|
||||
- '&7Click here to go to the previous'
|
||||
- '&7page of weapons.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
PreviousPage: true
|
||||
'50':
|
||||
type: DIAMOND_BLOCK
|
||||
name: '&a&lAdd New Weapon'
|
||||
lore:
|
||||
- '&7Click here to add a new'
|
||||
- '&7weapon which you have in your'
|
||||
- '&7inventory.'
|
||||
Button: AddNew
|
||||
'51':
|
||||
type: ARROW
|
||||
name: '&e&lNext Page &e&l&m->'
|
||||
lore:
|
||||
- '&7Click here to go to the next'
|
||||
- '&7page of weapons.'
|
||||
- '&7'
|
||||
- '&7Currently viewing page &e{currentPage}/{maxPages}&7.'
|
||||
NextPage: true
|
||||
'52':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'53':
|
||||
type: STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
'54':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
@ -1,33 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders;
|
||||
|
||||
import net.aminecraftdev.custombosses.builders.base.CustomEntityBuilder;
|
||||
import net.aminecraftdev.custombosses.builders.entity.ISpawnItemBuilderComponent;
|
||||
import net.aminecraftdev.custombosses.entities.CustomBoss;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 30-Mar-18
|
||||
*/
|
||||
public class CustomBossBuilder extends CustomEntityBuilder<CustomBoss> implements ISpawnItemBuilderComponent {
|
||||
|
||||
private ItemStack spawnItem = null;
|
||||
|
||||
public CustomBossBuilder(String identifier) {
|
||||
super(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpawnItem(ItemStack itemStack) {
|
||||
this.spawnItem = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomBoss build() {
|
||||
if(this.health <= 0) return null;
|
||||
|
||||
return new CustomBoss(this.identifier, this.potionEffects, this.equipment, this.customSkills, this.canDropHand, this.canDropEquipment, this.description, this.mainHand, this.offHand, this.entityType, this.displayName, this.health, this.spawnItem);
|
||||
}
|
||||
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.base;
|
||||
|
||||
import net.aminecraftdev.custombosses.builders.entity.*;
|
||||
import net.aminecraftdev.custombosses.utils.IBuilder;
|
||||
import net.aminecraftdev.custombosses.utils.identifier.IIdentifier;
|
||||
import net.aminecraftdev.custombosses.utils.identifier.Identifier;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public abstract class CustomEntityBuilder<T> implements IIdentifier, IBuilder<T>, IStatsBuilderComponent, IEquipmentBuilderComponent, IHandBuilderComponent, IPotionBuilderComponent, ISkillBuilderComponent {
|
||||
|
||||
protected final List<PotionEffect> potionEffects = new ArrayList<>();
|
||||
protected final Map<Integer, ItemStack> equipment = new HashMap<>();
|
||||
protected final List<Object> customSkills = new ArrayList<>();
|
||||
protected final Identifier<String> identifier;
|
||||
|
||||
protected boolean canDropHand = true, canDropEquipment = true;
|
||||
protected List<String> description = new ArrayList<>();
|
||||
protected ItemStack mainHand = null, offHand = null;
|
||||
protected EntityType entityType = null;
|
||||
protected String displayName = null;
|
||||
protected double health = 0;
|
||||
|
||||
public CustomEntityBuilder(String identifier) {
|
||||
this.identifier = new Identifier<>(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier<String> getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArmor(int slot, ItemStack itemStack) {
|
||||
if(slot > 4 || slot < 1) return;
|
||||
|
||||
this.equipment.put(slot, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCanDropEquipment(boolean bool) {
|
||||
this.canDropEquipment = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainHand(ItemStack itemStack) {
|
||||
this.mainHand = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffHand(ItemStack itemStack) {
|
||||
this.offHand = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCanDropHands(boolean bool) {
|
||||
this.canDropHand = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPotionEffect(PotionEffect potionEffect) {
|
||||
this.potionEffects.add(potionEffect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePotionEffect(PotionEffect potionEffect) {
|
||||
this.potionEffects.remove(potionEffect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSkill(Object object) {
|
||||
this.customSkills.add(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSkill(Object object) {
|
||||
this.customSkills.remove(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntityType(EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxHealth(double health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(List<String> description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.entity;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public interface IEquipmentBuilderComponent {
|
||||
|
||||
void setArmor(int slot, ItemStack itemStack);
|
||||
|
||||
void setCanDropEquipment(boolean bool);
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.entity;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public interface IHandBuilderComponent {
|
||||
|
||||
void setMainHand(ItemStack itemStack);
|
||||
|
||||
void setOffHand(ItemStack itemStack);
|
||||
|
||||
void setCanDropHands(boolean bool);
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.entity;
|
||||
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public interface IPotionBuilderComponent {
|
||||
|
||||
void addPotionEffect(PotionEffect potionEffect);
|
||||
|
||||
void removePotionEffect(PotionEffect potionEffect);
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.entity;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public interface ISkillBuilderComponent {
|
||||
|
||||
void addSkill(Object object);
|
||||
|
||||
void removeSkill(Object object);
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.entity;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 30-Mar-18
|
||||
*/
|
||||
public interface ISpawnItemBuilderComponent {
|
||||
|
||||
void setSpawnItem(ItemStack itemStack);
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.builders.entity;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public interface IStatsBuilderComponent {
|
||||
|
||||
void setEntityType(EntityType entityType);
|
||||
|
||||
void setMaxHealth(double health);
|
||||
|
||||
void setDisplayName(String displayName);
|
||||
|
||||
void setDescription(List<String> description);
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.entities;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.base.CustomEntity;
|
||||
import net.aminecraftdev.custombosses.utils.identifier.Identifier;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 30-Mar-18
|
||||
*/
|
||||
public class CustomBoss extends CustomEntity {
|
||||
|
||||
private ItemStack spawnItemStack;
|
||||
private boolean isEditing;
|
||||
|
||||
public CustomBoss(Identifier<String> identifier, List<PotionEffect> potionEffects, Map<Integer, ItemStack> equipment, List<Object> customSkills, boolean canDropHand, boolean canDropEquipment, List<String> description, ItemStack mainHand, ItemStack offHand, EntityType entityType, String displayName, double health, ItemStack spawnItem) {
|
||||
super(identifier, potionEffects, equipment, customSkills, canDropHand, canDropEquipment, description, mainHand, offHand, entityType, displayName, health);
|
||||
|
||||
this.isEditing = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleEditing(boolean bool) {
|
||||
this.isEditing = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openEditor(Player player) {
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.entities;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 30-Mar-18
|
||||
*/
|
||||
public class CustomMinion {
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.entities.base;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.IEditor;
|
||||
import net.aminecraftdev.custombosses.utils.identifier.IIdentifier;
|
||||
import net.aminecraftdev.custombosses.utils.identifier.Identifier;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Mar-18
|
||||
*/
|
||||
public abstract class CustomEntity implements IIdentifier, IEditor {
|
||||
|
||||
private final boolean canDropHand, canDropEquipment;
|
||||
private final Map<Integer, ItemStack> equipment;
|
||||
private final List<PotionEffect> potionEffects;
|
||||
private final List<Object> customSkills;
|
||||
private final List<String> description;
|
||||
private final Identifier<String> identifier;
|
||||
private final ItemStack mainHand, offHand;
|
||||
private final EntityType entityType;
|
||||
private final String displayName;
|
||||
private final double health;
|
||||
|
||||
public CustomEntity(Identifier<String> identifier, List<PotionEffect> potionEffects, Map<Integer, ItemStack> equipment, List<Object> customSkills, boolean canDropHand, boolean canDropEquipment, List<String> description, ItemStack mainHand, ItemStack offHand, EntityType entityType, String displayName, double health) {
|
||||
this.identifier = identifier;
|
||||
|
||||
this.entityType = entityType;
|
||||
this.health = health;
|
||||
this.displayName = displayName;
|
||||
this.mainHand = mainHand;
|
||||
this.offHand = offHand;
|
||||
this.description = description;
|
||||
this.customSkills = customSkills;
|
||||
this.potionEffects = potionEffects;
|
||||
this.equipment = equipment;
|
||||
this.canDropHand = canDropHand;
|
||||
this.canDropEquipment = canDropEquipment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier<String> getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package net.aminecraftdev.custombosses.entity;
|
||||
|
||||
import net.aminecraftdev.custombosses.entity.components.*;
|
||||
import net.aminecraftdev.custombosses.entity.interfaces.IBaseEntity;
|
||||
import net.aminecraftdev.custombosses.utils.Debug;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Apr-18
|
||||
*/
|
||||
public class BaseEntity implements IBaseEntity {
|
||||
|
||||
private final SpawnItemComponent spawnItemComponent;
|
||||
private final EquipmentComponent equipmentComponent;
|
||||
private final EditorComponent editorComponent;
|
||||
private final PotionComponent potionComponent;
|
||||
private final SkillComponent skillComponent;
|
||||
private final StatsComponent statsComponent;
|
||||
private final HandComponent handComponent;
|
||||
private final String identifier;
|
||||
|
||||
public BaseEntity(String identifier, SpawnItemComponent spawnItemComponent, EquipmentComponent equipmentComponent, PotionComponent potionComponent,
|
||||
SkillComponent skillComponent, StatsComponent statsComponent, HandComponent handComponent, EditorComponent editorComponent) {
|
||||
this.spawnItemComponent = spawnItemComponent;
|
||||
this.equipmentComponent = equipmentComponent;
|
||||
this.editorComponent = editorComponent;
|
||||
this.potionComponent = potionComponent;
|
||||
this.skillComponent = skillComponent;
|
||||
this.statsComponent = statsComponent;
|
||||
this.handComponent = handComponent;
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EditorComponent getEditorComponent() {
|
||||
return editorComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipmentComponent getEquipmentComponent() {
|
||||
return equipmentComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandComponent getHandComponent() {
|
||||
return handComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionComponent getPotionComponent() {
|
||||
return potionComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkillComponent getSkillComponent() {
|
||||
return skillComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnItemComponent getSpawnItemComponent() {
|
||||
return spawnItemComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsComponent getStatsComponent() {
|
||||
return statsComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity spawn(Location location) {
|
||||
if(!getEditorComponent().isEditable()) {
|
||||
Debug.ATTEMPTED_TO_SPAWN_WHILE_DISABLED.debug(getIdentifier());
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
//---------------------------
|
||||
//
|
||||
// BASIC STATS HANDLING
|
||||
//
|
||||
//---------------------------
|
||||
//
|
||||
|
||||
if(!getStatsComponent().hasEntityType()) {
|
||||
Debug.NULL_ENTITY_TYPE.debug(getIdentifier());
|
||||
return null;
|
||||
}
|
||||
|
||||
LivingEntity livingEntity = (LivingEntity) location.getWorld().spawn(location, getStatsComponent().getEntityType().getEntityClass());
|
||||
|
||||
if(getStatsComponent().hasDisplayName()) {
|
||||
//TODO: Handle setting invisible armor stand names if set in config
|
||||
livingEntity.setCustomName(getStatsComponent().getDisplayName());
|
||||
livingEntity.setCustomNameVisible(true);
|
||||
}
|
||||
|
||||
if(getStatsComponent().hasMaxHealth()) {
|
||||
livingEntity.setHealth(getStatsComponent().getMaxHealth());
|
||||
}
|
||||
|
||||
livingEntity.setRemoveWhenFarAway(false);
|
||||
livingEntity.setCanPickupItems(false);
|
||||
|
||||
//
|
||||
//---------------------------
|
||||
//
|
||||
// EQUIPMENT HANDLING
|
||||
//
|
||||
//---------------------------
|
||||
//
|
||||
|
||||
boolean canDrop = getEquipmentComponent().canDropEquipment();
|
||||
|
||||
if(getEquipmentComponent().hasHelmet()) {
|
||||
if(!canDrop) livingEntity.getEquipment().setHelmetDropChance(0F);
|
||||
|
||||
livingEntity.getEquipment().setHelmet(getEquipmentComponent().getHelmet());
|
||||
}
|
||||
|
||||
if(getEquipmentComponent().hasChestplate()) {
|
||||
if(!canDrop) livingEntity.getEquipment().setChestplateDropChance(0F);
|
||||
|
||||
livingEntity.getEquipment().setChestplate(getEquipmentComponent().getChestplate());
|
||||
}
|
||||
|
||||
if(getEquipmentComponent().hasLeggings()) {
|
||||
if(!canDrop) livingEntity.getEquipment().setLeggingsDropChance(0F);
|
||||
|
||||
livingEntity.getEquipment().setLeggings(getEquipmentComponent().getLeggings());
|
||||
}
|
||||
|
||||
if(getEquipmentComponent().hasBoots()) {
|
||||
if(!canDrop) livingEntity.getEquipment().setBootsDropChance(0F);
|
||||
|
||||
livingEntity.getEquipment().setBoots(getEquipmentComponent().getBoots());
|
||||
}
|
||||
|
||||
//
|
||||
//---------------------------
|
||||
//
|
||||
// HAND HANDLING
|
||||
//
|
||||
//---------------------------
|
||||
//
|
||||
|
||||
//TODO: Can handle offhand ticket
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killAll() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killAll(World world) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class EditorComponent {
|
||||
|
||||
private boolean editable = false;
|
||||
|
||||
public void setIsEditable(boolean bool) {
|
||||
this.editable = bool;
|
||||
}
|
||||
|
||||
public boolean isEditable() {
|
||||
return this.editable;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class EquipmentComponent {
|
||||
|
||||
private final EditorComponent editorComponent;
|
||||
|
||||
private ItemStack helmet = null, chestplate = null, leggings = null, boots = null;
|
||||
private boolean dropEquipment = false;
|
||||
|
||||
public EquipmentComponent(EditorComponent editorComponent) {
|
||||
this.editorComponent = editorComponent;
|
||||
}
|
||||
|
||||
public boolean setHelmet(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.helmet = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasHelmet() {
|
||||
return this.helmet != null;
|
||||
}
|
||||
|
||||
public ItemStack getHelmet() {
|
||||
return this.helmet;
|
||||
}
|
||||
|
||||
public boolean setChestplate(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.chestplate = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasChestplate() {
|
||||
return this.chestplate != null;
|
||||
}
|
||||
|
||||
public ItemStack getChestplate() {
|
||||
return this.chestplate;
|
||||
}
|
||||
|
||||
public boolean setLeggings(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.leggings = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasLeggings() {
|
||||
return this.leggings != null;
|
||||
}
|
||||
|
||||
public ItemStack getLeggings() {
|
||||
return this.leggings;
|
||||
}
|
||||
|
||||
public boolean setBoots(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.boots = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasBoots() {
|
||||
return this.boots != null;
|
||||
}
|
||||
|
||||
public ItemStack getBoots() {
|
||||
return this.boots;
|
||||
}
|
||||
|
||||
public boolean setCanDropEquipment(boolean bool) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.dropEquipment = bool;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canDropEquipment() {
|
||||
return this.dropEquipment;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class HandComponent {
|
||||
|
||||
private final EditorComponent editorComponent;
|
||||
|
||||
private ItemStack mainHand = null, offHand = null;
|
||||
private boolean dropHands = false;
|
||||
|
||||
public HandComponent(EditorComponent editorComponent) {
|
||||
this.editorComponent = editorComponent;
|
||||
}
|
||||
|
||||
public boolean setMainHand(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.mainHand = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getMainHand() {
|
||||
return this.mainHand;
|
||||
}
|
||||
|
||||
public boolean setOffHand(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.offHand = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getOffHand() {
|
||||
return this.offHand;
|
||||
}
|
||||
|
||||
public boolean setCanDropHands(boolean bool) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.dropHands = bool;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canDropHands() {
|
||||
return this.dropHands;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class PotionComponent {
|
||||
|
||||
private final EditorComponent editorComponent;
|
||||
|
||||
private List<PotionEffect> potionEffects = new ArrayList<>();
|
||||
|
||||
public PotionComponent(EditorComponent editorComponent) {
|
||||
this.editorComponent = editorComponent;
|
||||
}
|
||||
|
||||
public boolean addPotionEffect(PotionEffect potionEffect) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.potionEffects.add(potionEffect);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<PotionEffect> getPotionEffects() {
|
||||
return this.potionEffects;
|
||||
}
|
||||
|
||||
public boolean removePotionEffect(PotionEffect potionEffect) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.potionEffects.remove(potionEffect);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class SkillComponent {
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class SpawnItemComponent {
|
||||
|
||||
private final EditorComponent editorComponent;
|
||||
|
||||
private ItemStack spawnItem = null;
|
||||
|
||||
public SpawnItemComponent(EditorComponent editorComponent) {
|
||||
this.editorComponent = editorComponent;
|
||||
}
|
||||
|
||||
public boolean setSpawnItem(ItemStack itemStack) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.spawnItem = itemStack;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getSpawnItem() {
|
||||
return this.spawnItem;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Apr-18
|
||||
*/
|
||||
public class StatsComponent {
|
||||
|
||||
private final EditorComponent editorComponent;
|
||||
|
||||
private List<String> description = new ArrayList<>();
|
||||
private EntityType entityType = null;
|
||||
private String displayName = null;
|
||||
private double maxHealth = 0.0;
|
||||
|
||||
public StatsComponent(EditorComponent editorComponent) {
|
||||
this.editorComponent = editorComponent;
|
||||
}
|
||||
|
||||
public boolean setEntityType(EntityType entityType) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.entityType = entityType;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasEntityType() {
|
||||
return this.entityType != null;
|
||||
}
|
||||
|
||||
public EntityType getEntityType() {
|
||||
return this.entityType;
|
||||
}
|
||||
|
||||
public boolean setMaxHealth(double health) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.maxHealth = health;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasMaxHealth() {
|
||||
return this.maxHealth != 0;
|
||||
}
|
||||
|
||||
public double getMaxHealth() {
|
||||
return this.maxHealth;
|
||||
}
|
||||
|
||||
public boolean setDisplayName(String displayName) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.displayName = displayName;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasDisplayName() {
|
||||
return this.displayName != null;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public boolean setDescription(List<String> description) {
|
||||
if(!this.editorComponent.isEditable()) return false;
|
||||
|
||||
this.description = description;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasDescription() {
|
||||
return !this.description.isEmpty();
|
||||
}
|
||||
|
||||
public List<String> getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package net.aminecraftdev.custombosses.entity.interfaces;
|
||||
|
||||
import net.aminecraftdev.custombosses.entity.components.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 25-Apr-18
|
||||
*/
|
||||
public interface IBaseEntity {
|
||||
|
||||
//BASE ENTITY COMPONENTS
|
||||
EditorComponent getEditorComponent();
|
||||
|
||||
EquipmentComponent getEquipmentComponent();
|
||||
|
||||
HandComponent getHandComponent();
|
||||
|
||||
PotionComponent getPotionComponent();
|
||||
|
||||
SkillComponent getSkillComponent();
|
||||
|
||||
SpawnItemComponent getSpawnItemComponent();
|
||||
|
||||
StatsComponent getStatsComponent();
|
||||
|
||||
//BASE ENTITY FUNCTIONS
|
||||
String getIdentifier();
|
||||
|
||||
LivingEntity spawn(Location location);
|
||||
|
||||
void killAll();
|
||||
|
||||
void killAll(World world);
|
||||
|
||||
}
|
@ -1,174 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.models;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.identifier.IIdentifier;
|
||||
import net.aminecraftdev.custombosses.handlers.ValidationHandler;
|
||||
import net.aminecraftdev.custombosses.utils.models.IEquipmentHandler;
|
||||
import net.aminecraftdev.custombosses.utils.models.IPotionHandler;
|
||||
import net.aminecraftdev.custombosses.utils.models.ISkillHandler;
|
||||
import net.aminecraftdev.custombosses.utils.models.IStatsHandler;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author AMinecraftDev
|
||||
* @version 1.0.0
|
||||
* @since 06-Sep-17
|
||||
*/
|
||||
public class CustomEntityModel implements IIdentifier, IStatsHandler, IEquipmentHandler, ISkillHandler, IPotionHandler {
|
||||
|
||||
private List<PotionEffect> defaultPotionEffects = new ArrayList<>();
|
||||
private Map<Integer, ItemStack> equipment = new HashMap<>();
|
||||
private List<CustomSkillModel> skillModels = new ArrayList<>();
|
||||
private List<String> description = new ArrayList<>();
|
||||
|
||||
private String identifier, displayName;
|
||||
private ItemStack mainHand, offHand;
|
||||
private boolean canDropEquipment;
|
||||
private EntityType entityType;
|
||||
private double health;
|
||||
|
||||
public CustomEntityModel(EntityType entityType, double health, String identifier) {
|
||||
this(entityType, new HashMap<>(), null, new ArrayList<>(), null, null, identifier, health, null, false);
|
||||
}
|
||||
|
||||
public CustomEntityModel(EntityType entityType, Map<Integer, ItemStack> equipment, List<String> description, List<PotionEffect> defaultPotionEffects, ItemStack itemStackInMainHand, ItemStack itemStackInOffHand, String identifier, double health, String name, boolean canDropEquipment) {
|
||||
this.identifier = identifier;
|
||||
|
||||
try {
|
||||
setEntityType(entityType);
|
||||
setDescription(description);
|
||||
setMainHand(itemStackInMainHand);
|
||||
setOffHand(itemStackInOffHand);
|
||||
setMaxHealth(health);
|
||||
setDisplayName(name);
|
||||
setCanDropEquipment(canDropEquipment);
|
||||
|
||||
defaultPotionEffects.forEach(this::addPotionEffect);
|
||||
equipment.forEach(this::setArmor);
|
||||
} catch (IllegalArgumentException ex) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainHand(ItemStack itemStack) {
|
||||
if(ValidationHandler.isNull(itemStack)) return;
|
||||
|
||||
this.mainHand = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getMainHand() {
|
||||
return this.mainHand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffHand(ItemStack itemStack) {
|
||||
if(ValidationHandler.isNull(itemStack)) return;
|
||||
|
||||
this.offHand = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOffHand() {
|
||||
return this.offHand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArmor(int slot, ItemStack itemStack) {
|
||||
if(ValidationHandler.isNull(itemStack)) return;
|
||||
|
||||
this.equipment.put(slot, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, ItemStack> getArmor() {
|
||||
return this.equipment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCanDropEquipment(boolean bool) {
|
||||
this.canDropEquipment = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropEquipment() {
|
||||
return this.canDropEquipment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPotionEffect(PotionEffect potionEffect) {
|
||||
if(ValidationHandler.isNull(potionEffect)) return;
|
||||
|
||||
this.defaultPotionEffects.add(potionEffect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PotionEffect> getPotionEffects() {
|
||||
return this.defaultPotionEffects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSkill(CustomSkillModel skillModel) {
|
||||
if(ValidationHandler.isNull(skillModel)) return;
|
||||
|
||||
this.skillModels.add(skillModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomSkillModel> getSkills() {
|
||||
return this.skillModels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntityType(EntityType entityType) {
|
||||
if(ValidationHandler.isNull(entityType)) return;
|
||||
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getEntityType() {
|
||||
return this.entityType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxHealth(double health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxHealth() {
|
||||
return this.health;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String displayName) {
|
||||
if(ValidationHandler.isNull(displayName)) return;
|
||||
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(List<String> description) {
|
||||
if(ValidationHandler.isNull(description)) return;
|
||||
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.models;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 12-Mar-18
|
||||
*/
|
||||
public class CustomSkillModel {
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.skills;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.SkillComponent;
|
||||
import net.aminecraftdev.custombosses.utils.identifier.IIdentifier;
|
||||
import net.aminecraftdev.custombosses.skills.enums.SkillTarget;
|
||||
import net.aminecraftdev.custombosses.skills.enums.SkillType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 11-Mar-18
|
||||
*/
|
||||
public abstract class CustomSkill implements IIdentifier {
|
||||
|
||||
private String name, showName, customMessage;
|
||||
private List<String> linkedSkills;
|
||||
private SkillTarget skillTarget;
|
||||
private SkillType skillType;
|
||||
private boolean isGroup;
|
||||
private int radius;
|
||||
|
||||
public CustomSkill(SkillComponent skillComponent) {
|
||||
this.name = skillComponent.getName();
|
||||
this.radius = skillComponent.getRadius();
|
||||
this.skillTarget = skillComponent.getSkillTarget();
|
||||
this.skillType = skillComponent.getSkillType();
|
||||
this.showName = skillComponent.getShowName();
|
||||
this.customMessage = skillComponent.getCustomMessage();
|
||||
this.linkedSkills = skillComponent.getSkillGroupComponent().getConnectedSkills();
|
||||
this.isGroup = skillComponent.getSkillGroupComponent().isGroup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public SkillTarget getSkillTarget() {
|
||||
return skillTarget;
|
||||
}
|
||||
|
||||
public void setSkillTarget(SkillTarget skillTarget) {
|
||||
this.skillTarget = skillTarget;
|
||||
}
|
||||
|
||||
public SkillType getSkillType() {
|
||||
return skillType;
|
||||
}
|
||||
|
||||
public void setSkillType(SkillType skillType) {
|
||||
this.skillType = skillType;
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(int radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public String getShowName() {
|
||||
return showName;
|
||||
}
|
||||
|
||||
public void setShowName(String showName) {
|
||||
this.showName = showName;
|
||||
}
|
||||
|
||||
public String getCustomMessage() {
|
||||
return customMessage;
|
||||
}
|
||||
|
||||
public void setCustomMessage(String customMessage) {
|
||||
this.customMessage = customMessage;
|
||||
}
|
||||
|
||||
public boolean isGroup() {
|
||||
return isGroup;
|
||||
}
|
||||
|
||||
public void setGroup(boolean group) {
|
||||
isGroup = group;
|
||||
}
|
||||
|
||||
public List<String> getLinkedSkills() {
|
||||
return linkedSkills;
|
||||
}
|
||||
|
||||
public void setLinkedSkills(List<String> linkedSkills) {
|
||||
this.linkedSkills = linkedSkills;
|
||||
}
|
||||
|
||||
public abstract void execute(Player player);
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.skills.enums;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public enum SkillTarget {
|
||||
|
||||
BOSS,
|
||||
RANDOM,
|
||||
ONE,
|
||||
NEARBY
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.skills.enums;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public enum SkillType {
|
||||
|
||||
COMMAND,
|
||||
POTION,
|
||||
CUSTOM
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.skills.types;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.SkillComponent;
|
||||
import net.aminecraftdev.custombosses.skills.CustomSkill;
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.data.CommandSkillData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 12-Mar-18
|
||||
*/
|
||||
public class CommandSkill extends CustomSkill {
|
||||
|
||||
private List<String> commands;
|
||||
|
||||
public CommandSkill(SkillComponent skillComponent, CommandSkillData commandSkillData) {
|
||||
super(skillComponent);
|
||||
|
||||
this.commands = commandSkillData.getCommands();
|
||||
}
|
||||
|
||||
public List<String> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public void setCommands(List<String> commands) {
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
for(String s : getCommands()) {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s.replace("%player%", player.getName()));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.skills.types;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.SkillComponent;
|
||||
import net.aminecraftdev.custombosses.skills.CustomSkill;
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.data.PotionSkillData;
|
||||
import net.aminecraftdev.custombosses.utils.parser.PotionParser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 12-Mar-18
|
||||
*/
|
||||
public class PotionSkill extends CustomSkill {
|
||||
|
||||
private List<PotionEffect> potionEffects;
|
||||
|
||||
public PotionSkill(SkillComponent skillComponent, PotionSkillData potionSkillData) {
|
||||
super(skillComponent);
|
||||
|
||||
this.potionEffects = new ArrayList<>();
|
||||
|
||||
potionSkillData.getPotionEffects().forEach(potionEffectComponent -> this.potionEffects.add(new PotionParser(potionEffectComponent).parse()));
|
||||
}
|
||||
|
||||
public void setPotionEffects(List<PotionEffect> potionEffects) {
|
||||
this.potionEffects = potionEffects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player player) {
|
||||
for(PotionEffect potionEffect : this.potionEffects) {
|
||||
player.addPotionEffect(potionEffect);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,13 +2,7 @@ package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseSkillData;
|
||||
import net.aminecraftdev.custombosses.skills.enums.SkillTarget;
|
||||
import net.aminecraftdev.custombosses.skills.enums.SkillType;
|
||||
import net.aminecraftdev.custombosses.utils.adapters.PotionEffectTypeAdapter;
|
||||
import net.aminecraftdev.custombosses.utils.adapters.SkillDataAdapter;
|
||||
import net.aminecraftdev.custombosses.utils.adapters.SkillTargetAdapter;
|
||||
import net.aminecraftdev.custombosses.utils.adapters.SkillTypeAdapter;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
@ -22,9 +16,6 @@ public class BossesGson {
|
||||
.setPrettyPrinting()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.registerTypeAdapter(PotionEffectType.class, new PotionEffectTypeAdapter())
|
||||
.registerTypeAdapter(BaseSkillData.class, new SkillDataAdapter())
|
||||
.registerTypeAdapter(SkillTarget.class, new SkillTargetAdapter())
|
||||
.registerTypeAdapter(SkillType.class, new SkillTypeAdapter())
|
||||
.create();
|
||||
|
||||
public static Gson get() {
|
||||
|
@ -7,7 +7,10 @@ package net.aminecraftdev.custombosses.utils;
|
||||
*/
|
||||
public enum Debug {
|
||||
|
||||
NULL_CHECK("An object was found as null when it should not be null.");
|
||||
NULL_CHECK("An object was found as null when it should not be null."),
|
||||
NULL_ENTITY_TYPE("The {0} boss or minion has got an invalid entity type."),
|
||||
|
||||
ATTEMPTED_TO_SPAWN_WHILE_DISABLED("The {0} boss/minion attempted to spawn while editing is enabled.");
|
||||
|
||||
private String message;
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 30-Mar-18
|
||||
*/
|
||||
public interface IEditor {
|
||||
|
||||
void toggleEditing(boolean bool);
|
||||
|
||||
void openEditor(Player player);
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.adapters;
|
||||
|
||||
import com.google.gson.*;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseSkillData;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseAdapter;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 11-Mar-18
|
||||
*/
|
||||
public class SkillDataAdapter implements BaseAdapter<BaseSkillData> {
|
||||
|
||||
@Override
|
||||
public BaseSkillData deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
final JsonObject member = (JsonObject) jsonElement;
|
||||
final JsonElement typeString = get(member, "type");
|
||||
final JsonElement data = get(member, "data");
|
||||
final Type actualType = typeForName(typeString);
|
||||
|
||||
return jsonDeserializationContext.deserialize(data, actualType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(BaseSkillData baseSkillData, Type type, JsonSerializationContext jsonSerializationContext) {
|
||||
final JsonObject jsonObject = new JsonObject();
|
||||
|
||||
jsonObject.addProperty("type", baseSkillData.getClass().getName());
|
||||
jsonObject.add("data", jsonSerializationContext.serialize(baseSkillData));
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
private Type typeForName(final JsonElement typeElem) {
|
||||
try {
|
||||
return Class.forName(typeElem.getAsString());
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new JsonParseException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private JsonElement get(final JsonObject wrapper, final String memberName) {
|
||||
final JsonElement elem = wrapper.get(memberName);
|
||||
|
||||
if (elem == null) {
|
||||
throw new JsonParseException(
|
||||
"no '" + memberName + "' member found in json file.");
|
||||
}
|
||||
return elem;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.adapters;
|
||||
|
||||
import com.google.gson.*;
|
||||
import net.aminecraftdev.custombosses.skills.enums.SkillTarget;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseAdapter;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 11-Mar-18
|
||||
*/
|
||||
public class SkillTargetAdapter implements BaseAdapter<SkillTarget> {
|
||||
|
||||
@Override
|
||||
public SkillTarget deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
String target = jsonElement.getAsString();
|
||||
|
||||
try {
|
||||
return SkillTarget.valueOf(target);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(SkillTarget skillTarget, Type type, JsonSerializationContext jsonSerializationContext) {
|
||||
return new JsonPrimitive(skillTarget.name().toUpperCase());
|
||||
}
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.adapters;
|
||||
|
||||
import com.google.gson.*;
|
||||
import net.aminecraftdev.custombosses.skills.enums.SkillType;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseAdapter;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 11-Mar-18
|
||||
*/
|
||||
public class SkillTypeAdapter implements BaseAdapter<SkillType> {
|
||||
|
||||
@Override
|
||||
public SkillType deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
String target = jsonElement.getAsString();
|
||||
|
||||
try {
|
||||
return SkillType.valueOf(target);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(SkillType skillTarget, Type type, JsonSerializationContext jsonSerializationContext) {
|
||||
return new JsonPrimitive(skillTarget.name().toUpperCase());
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.base;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 11-Mar-18
|
||||
*/
|
||||
public class BaseSkillData {}
|
@ -1,12 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.identifier;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public interface IIdentifier {
|
||||
|
||||
Identifier<String> getIdentifier();
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.identifier;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 30-Mar-18
|
||||
*/
|
||||
public class Identifier<T> {
|
||||
|
||||
private T identifier;
|
||||
|
||||
public Identifier(T newIdentity) {
|
||||
this.identifier = newIdentity;
|
||||
}
|
||||
|
||||
public T getIdentifier() {
|
||||
return this.identifier;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.models;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public interface IEquipmentHandler {
|
||||
|
||||
void setMainHand(ItemStack itemStack);
|
||||
|
||||
ItemStack getMainHand();
|
||||
|
||||
void setOffHand(ItemStack itemStack);
|
||||
|
||||
ItemStack getOffHand();
|
||||
|
||||
void setArmor(int slot, ItemStack itemStack);
|
||||
|
||||
Map<Integer, ItemStack> getArmor();
|
||||
|
||||
void setCanDropEquipment(boolean bool);
|
||||
|
||||
boolean canDropEquipment();
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.models;
|
||||
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public interface IPotionHandler {
|
||||
|
||||
void addPotionEffect(PotionEffect potionEffect);
|
||||
|
||||
List<PotionEffect> getPotionEffects();
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.models;
|
||||
|
||||
import net.aminecraftdev.custombosses.models.CustomSkillModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public interface ISkillHandler {
|
||||
|
||||
void addSkill(CustomSkillModel skillModel);
|
||||
|
||||
List<CustomSkillModel> getSkills();
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.models;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public interface IStatsHandler {
|
||||
|
||||
void setEntityType(EntityType entityType);
|
||||
|
||||
EntityType getEntityType();
|
||||
|
||||
void setMaxHealth(double health);
|
||||
|
||||
double getMaxHealth();
|
||||
|
||||
void setDisplayName(String displayName);
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
void setDescription(List<String> description);
|
||||
|
||||
List<String> getDescription();
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.parser;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.components.PotionEffectComponent;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseParser;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 11-Mar-18
|
||||
*/
|
||||
public class PotionParser extends BaseParser<PotionEffectComponent, PotionEffect> {
|
||||
|
||||
public PotionParser(PotionEffectComponent potionEffectComponent) {
|
||||
super(potionEffectComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionEffect parse() {
|
||||
int duration = this.input.getDuration();
|
||||
int level = this.input.getLevel();
|
||||
PotionEffectType potionEffectType = this.input.getPotionEffectType();
|
||||
|
||||
if(duration == -1) {
|
||||
duration = 15000;
|
||||
}
|
||||
|
||||
return new PotionEffect(potionEffectType, duration*20, level-1);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.parser.skills;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.SkillComponent;
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.data.CommandSkillData;
|
||||
import net.aminecraftdev.custombosses.skills.types.CommandSkill;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseParser;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 12-Mar-18
|
||||
*/
|
||||
public class CommandSkillParser extends BaseParser<SkillComponent, CommandSkill> {
|
||||
|
||||
public CommandSkillParser(SkillComponent skillComponent) {
|
||||
super(skillComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandSkill parse() {
|
||||
if(this.input.getSkillData() instanceof CommandSkillData) {
|
||||
CommandSkillData commandSkillData = (CommandSkillData) this.input.getSkillData();
|
||||
|
||||
return new CommandSkill(this.input, commandSkillData);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.utils.parser.skills;
|
||||
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.SkillComponent;
|
||||
import net.aminecraftdev.custombosses.entities.components.skills.data.PotionSkillData;
|
||||
import net.aminecraftdev.custombosses.skills.types.PotionSkill;
|
||||
import net.aminecraftdev.custombosses.utils.base.BaseParser;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 12-Mar-18
|
||||
*/
|
||||
public class PotionSkillParser extends BaseParser<SkillComponent, PotionSkill> {
|
||||
|
||||
public PotionSkillParser(SkillComponent skillComponent) {
|
||||
super(skillComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionSkill parse() {
|
||||
if(this.input.getSkillData() instanceof PotionSkillData) {
|
||||
PotionSkillData potionSkillData = (PotionSkillData) this.input.getSkillData();
|
||||
|
||||
return new PotionSkill(this.input, potionSkillData);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -11,38 +11,4 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<sourceDirectory>${basedir}/src/</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
171
pom.xml
171
pom.xml
@ -20,7 +20,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<plugin.version>3.0.0-SNAPSHOT-U5</plugin.version>
|
||||
<plugin.version>3.0.0-SNAPSHOT-U6</plugin.version>
|
||||
<plugin.name>CustomBosses</plugin.name>
|
||||
<plugin.main>net.aminecraftdev.custombosses.CustomBosses</plugin.main>
|
||||
<plugin.author>AMinecraftDev</plugin.author>
|
||||
@ -60,4 +60,173 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test</testSourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sun</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${java.home}/../lib/tools.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<inherited>false</inherited>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<outputDirectory>jars</outputDirectory>
|
||||
<stripVersion>true</stripVersion>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionHelper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionsM</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionsOne</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>FactionsUUID</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>LegacyFactions</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>Core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
<inherited>false</inherited>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${basedir}/jars</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>plugin-modules/Core/resources-json</directory>
|
||||
<includes>
|
||||
<include>*.json</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>plugin.yml</exclude>
|
||||
</excludes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>plugin-modules/Core/resources-yml</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>items.csv</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>plugin.yml</exclude>
|
||||
</excludes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<inherited>false</inherited>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>${basedir}</directory>
|
||||
<includes>
|
||||
<include>jars/**</include>
|
||||
|
||||
<!-- Following folders clear Ant build directories -->
|
||||
<include>build/**</include>
|
||||
<include>dist/**</include>
|
||||
</includes>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<configuration>
|
||||
<deployAtEnd>true</deployAtEnd>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources-json</directory>
|
||||
<includes>
|
||||
<include>*.json</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>resources-yml</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>*.csv</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user