mirror of
https://github.com/songoda/EpicBosses.git
synced 2024-09-27 13:03:01 +02:00
3.0.0-SNAPSHOT-U8
Implemented EntityType handling and EntityTypeMechanic
This commit is contained in:
parent
4198b2f55b
commit
37ab20b142
@ -1,13 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.spigotmc:spigot:1.11.2">
|
||||
<library name="Maven: com.spigotmc:spigot:1.8.8">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.11.2/spigot-1.11.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.8.8/spigot-1.8.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.11.2/spigot-1.11.2-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.8.8/spigot-1.8.8-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.11.2/spigot-1.11.2-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.8.8/spigot-1.8.8-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_projectlombok_lombok_1_16_22.xml
Normal file
13
.idea/libraries/Maven__org_projectlombok_lombok_1_16_22.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.projectlombok:lombok:1.16.22">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.16.22/lombok-1.16.22.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.16.22/lombok-1.16.22-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.16.22/lombok-1.16.22-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -12,7 +12,7 @@
|
||||
<orderEntry type="module" module-name="FactionHelper" scope="PROVIDED" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.massivecraft.factions:Factions:2.9.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.massivecraft.massivecore:MassiveCore:2.9.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -32,5 +32,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -11,7 +11,7 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="FactionHelper" scope="PROVIDED" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.massivecraft:FactionsOne:1.2.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -31,5 +31,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -11,7 +11,7 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="FactionHelper" scope="PROVIDED" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.massivecraft.factions:FactionsUUID:1.6.9.5-U0.1.21" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -31,5 +31,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -11,7 +11,7 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="FactionHelper" scope="PROVIDED" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.redstoneore.legacyfactions:LegacyFactions:1.4.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -31,5 +31,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -12,7 +12,7 @@
|
||||
<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: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -30,5 +30,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,170 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -29,5 +29,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -18,7 +18,7 @@
|
||||
<orderEntry type="module" module-name="FactionsOne" />
|
||||
<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: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -38,5 +38,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -6,46 +6,23 @@
|
||||
"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": ""
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
},
|
||||
"SKChestplate": {
|
||||
"type": "gold_chestplate",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
},
|
||||
"SKLeggings": {
|
||||
"type": "gold_leggings",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
},
|
||||
"SKBoots": {
|
||||
"type": "diamond_boots",
|
||||
"durability": "",
|
||||
"name": "",
|
||||
"lore": [],
|
||||
"owner": "",
|
||||
"enchants": [ "protection:4", "unbreaking:3" ],
|
||||
"spawnerType": ""
|
||||
"enchants": [ "protection:4", "unbreaking:3" ]
|
||||
},
|
||||
"SKMainHand": {
|
||||
"type": "diamond_sword",
|
||||
|
@ -1,170 +0,0 @@
|
||||
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,74 @@
|
||||
package net.aminecraftdev.custombosses.entity;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.aminecraftdev.custombosses.entity.elements.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class BossEntity {
|
||||
|
||||
@Expose private final List<PotionElement> potions;
|
||||
@Expose private final MainStatsElement mainStats;
|
||||
@Expose private final EquipmentElement equipment;
|
||||
@Expose private final MessagesElement messages;
|
||||
@Expose private final CommandsElement commands;
|
||||
@Expose private final SkillsElement skills;
|
||||
@Expose private final HandsElement hands;
|
||||
@Expose private final DropsElement drops;
|
||||
|
||||
@Expose @Getter @Setter private String spawnItem;
|
||||
@Expose @Getter @Setter private boolean editing;
|
||||
|
||||
public BossEntity(boolean editing, MainStatsElement mainStats, String spawnItem, EquipmentElement equipment, HandsElement hands, List<PotionElement> potions,
|
||||
SkillsElement skills, DropsElement drops, MessagesElement messages, CommandsElement commands) {
|
||||
this.editing = editing;
|
||||
this.mainStats = mainStats;
|
||||
this.spawnItem = spawnItem;
|
||||
this.equipment = equipment;
|
||||
this.hands = hands;
|
||||
this.potions = potions;
|
||||
this.skills = skills;
|
||||
this.drops = drops;
|
||||
this.messages = messages;
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
public MainStatsElement getMainStats() {
|
||||
return mainStats;
|
||||
}
|
||||
|
||||
public EquipmentElement getEquipment() {
|
||||
return equipment;
|
||||
}
|
||||
|
||||
public HandsElement getHands() {
|
||||
return hands;
|
||||
}
|
||||
|
||||
public List<PotionElement> getPotions() {
|
||||
return potions;
|
||||
}
|
||||
|
||||
public SkillsElement getSkills() {
|
||||
return skills;
|
||||
}
|
||||
|
||||
public DropsElement getDrops() {
|
||||
return drops;
|
||||
}
|
||||
|
||||
public MessagesElement getMessages() {
|
||||
return messages;
|
||||
}
|
||||
|
||||
public CommandsElement getCommands() {
|
||||
return commands;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.entity.components;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 24-Apr-18
|
||||
*/
|
||||
public class SkillComponent {
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
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,20 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class CommandsElement {
|
||||
|
||||
@Expose @Getter @Setter private String onSpawn, onDeath;
|
||||
|
||||
public CommandsElement(String onSpawn, String onDeath) {
|
||||
this.onSpawn = onSpawn;
|
||||
this.onDeath = onDeath;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class DropsElement {
|
||||
|
||||
@Expose @Getter @Setter private boolean naturalDrops, dropExp;
|
||||
@Expose @Getter @Setter private String dropTable;
|
||||
|
||||
public DropsElement(boolean naturalDrops, boolean dropExp, String dropTable) {
|
||||
this.naturalDrops = naturalDrops;
|
||||
this.dropExp = dropExp;
|
||||
this.dropTable = dropTable;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class EquipmentElement {
|
||||
|
||||
@Expose @Getter @Setter private String helmet, chestplate, leggings, boots;
|
||||
|
||||
public EquipmentElement(String helmet, String chestplate, String leggings, String boots) {
|
||||
this.helmet = helmet;
|
||||
this.chestplate = chestplate;
|
||||
this.leggings = leggings;
|
||||
this.boots = boots;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class HandsElement {
|
||||
|
||||
@Expose @Getter @Setter private String mainHand, offHand;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class MainStatsElement {
|
||||
|
||||
@Expose @Getter @Setter private String entityType;
|
||||
@Expose @Getter @Setter private double health;
|
||||
@Expose @Getter @Setter private String displayName;
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class MessagesElement {
|
||||
|
||||
@Expose @Getter @Setter private String onSpawn, onDeath;
|
||||
@Expose @Getter @Setter private TauntElement taunts;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class PotionElement {
|
||||
|
||||
@Expose @Getter @Setter private String type;
|
||||
@Expose @Getter @Setter private int leve;
|
||||
@Expose @Getter @Setter private long duration;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class SkillsElement {
|
||||
|
||||
@Expose @Getter @Setter private double overallChance;
|
||||
@Expose @Getter @Setter private String masterMessage;
|
||||
@Expose @Getter @Setter private List<String> skills;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package net.aminecraftdev.custombosses.entity.elements;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 14-May-18
|
||||
*/
|
||||
public class TauntElement {
|
||||
|
||||
@Expose @Getter @Setter private int delay;
|
||||
@Expose @Getter @Setter private List<String> taunts;
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
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,22 +0,0 @@
|
||||
package net.aminecraftdev.custombosses.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.Debug;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 08-Mar-18
|
||||
*/
|
||||
public class ValidationHandler {
|
||||
|
||||
public static boolean isNull(Object object) {
|
||||
if(object == null) {
|
||||
Debug.NULL_CHECK.debug();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package net.aminecraftdev.custombosses.mechanics;
|
||||
|
||||
import net.aminecraftdev.custombosses.entity.elements.MainStatsElement;
|
||||
import net.aminecraftdev.custombosses.utils.EntityTypeUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class EntityTypeMechanic {
|
||||
|
||||
private static final EntityTypeMechanic instance = new EntityTypeMechanic();
|
||||
|
||||
public LivingEntity getBaseEntity(MainStatsElement mainStatsElement, Location location) {
|
||||
String bossEntityType = mainStatsElement.getEntityType();
|
||||
LivingEntity livingEntity;
|
||||
|
||||
try {
|
||||
livingEntity = EntityTypeUtil.get(bossEntityType, location);
|
||||
} catch (NullPointerException ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(livingEntity == null) {
|
||||
EntityType entityType = EntityType.valueOf(bossEntityType.toUpperCase());
|
||||
|
||||
try {
|
||||
livingEntity = (LivingEntity) location.getWorld().spawnEntity(location, entityType);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return livingEntity;
|
||||
}
|
||||
|
||||
public static EntityTypeMechanic get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import net.aminecraftdev.custombosses.utils.entity.handlers.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public enum EntityTypeUtil {
|
||||
|
||||
WITHER_SKELETON(new WitherSkeletonHandler()),
|
||||
ELDER_GUARDIAN(new ElderGuardianHandler()),
|
||||
KILLER_BUNNY(new KillerBunnyHandler()),
|
||||
ZOMBIE(new ZombieBabyHandler()),
|
||||
BABY_ZOMBIE(new ZombieBabyHandler()),
|
||||
PIG_ZOMBIE(new PigZombieHandler()),
|
||||
BABY_PIG_ZOMBIE(new PigZombieBabyHandler()),
|
||||
SLIME(new SlimeHandler()),
|
||||
MAGMA_CUBE(new MagmaCubeHandler()),
|
||||
VILLAGER(new VillagerHandler());
|
||||
|
||||
private ICustomEntityHandler entityHandler;
|
||||
|
||||
EntityTypeUtil(ICustomEntityHandler customEntityHandler) {
|
||||
this.entityHandler = customEntityHandler;
|
||||
}
|
||||
|
||||
private ICustomEntityHandler getEntityHandler() {
|
||||
return entityHandler;
|
||||
}
|
||||
|
||||
public static LivingEntity get(String entityType, Location spawnLocation) {
|
||||
for(EntityTypeUtil entityTypeUtil : values()) {
|
||||
if(entityType.toUpperCase().startsWith(entityTypeUtil.name())) return entityTypeUtil.getEntityHandler().getBaseEntity(entityType, spawnLocation);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package net.aminecraftdev.custombosses.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class ReflectionUtil {
|
||||
|
||||
private static ReflectionUtil instance = new ReflectionUtil();
|
||||
|
||||
private String nmsVersion;
|
||||
|
||||
private ReflectionUtil() {
|
||||
this.nmsVersion = Bukkit.getServer().getClass().getPackage().getName();
|
||||
this.nmsVersion = this.nmsVersion.substring(this.nmsVersion.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.nmsVersion;
|
||||
}
|
||||
|
||||
public Class<?> getNMSClass(String name) {
|
||||
try {
|
||||
return Class.forName("net.minecraft.server." + this.nmsVersion + "." + name);
|
||||
} catch(ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Class<?> getOBCClass(String name) {
|
||||
try {
|
||||
return Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + "." + name);
|
||||
} catch(ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ReflectionUtil get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public interface ICustomEntityHandler {
|
||||
|
||||
LivingEntity getBaseEntity(String entityType, Location spawnLocation);
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.ReflectionUtil;
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class ElderGuardianHandler implements ICustomEntityHandler {
|
||||
|
||||
private String version = ReflectionUtil.get().getVersion();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.version.startsWith("v1_11_") || this.version.startsWith("v1_12_")) {
|
||||
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.WITHER_SKELETON);
|
||||
} else {
|
||||
Skeleton skeleton = (Skeleton) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.SKELETON);
|
||||
skeleton.setSkeletonType(Skeleton.SkeletonType.WITHER);
|
||||
|
||||
return skeleton;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.ReflectionUtil;
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class KillerBunnyHandler implements ICustomEntityHandler {
|
||||
|
||||
private String version = ReflectionUtil.get().getVersion();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.version.startsWith("v1_7_") || this.version.startsWith("v1_6_")) {
|
||||
throw new NullPointerException("This feature is only implemented in version 1.8 and above of Minecraft.");
|
||||
}
|
||||
|
||||
Rabbit rabbit = (Rabbit) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.RABBIT);
|
||||
rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY);
|
||||
|
||||
return rabbit;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.MagmaCube;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class MagmaCubeHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
String[] split = entityType.split(":");
|
||||
int size = Integer.valueOf(split[1]);
|
||||
|
||||
MagmaCube magmaCube = (MagmaCube) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.MAGMA_CUBE);
|
||||
magmaCube.setSize(size);
|
||||
|
||||
return magmaCube;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class PigZombieBabyHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
PigZombie pigZombie = (PigZombie) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.PIG_ZOMBIE);
|
||||
pigZombie.setBaby(true);
|
||||
|
||||
return pigZombie;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class PigZombieHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
PigZombie pigZombie = (PigZombie) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.PIG_ZOMBIE);
|
||||
pigZombie.setBaby(false);
|
||||
|
||||
return pigZombie;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Slime;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class SlimeHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
String[] split = entityType.split(":");
|
||||
int size = Integer.valueOf(split[1]);
|
||||
|
||||
Slime slime = (Slime) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.SLIME);
|
||||
slime.setSize(size);
|
||||
|
||||
return slime;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Villager;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 02-Jun-18
|
||||
*/
|
||||
public class VillagerHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
Villager villager = (Villager) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.VILLAGER);
|
||||
String[] split = entityType.split(":");
|
||||
int size = Integer.valueOf(split[1]);
|
||||
Villager.Profession profession = Villager.Profession.getProfession(size);
|
||||
|
||||
if(profession == null) {
|
||||
throw new NullPointerException("Profession value is too high and does not represent an actual villager profession.");
|
||||
}
|
||||
|
||||
villager.setProfession(profession);
|
||||
return villager;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.ReflectionUtil;
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class WitherSkeletonHandler implements ICustomEntityHandler {
|
||||
|
||||
private String version = ReflectionUtil.get().getVersion();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.version.startsWith("v1_11_") || this.version.startsWith("v1_12_")) {
|
||||
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.WITHER_SKELETON);
|
||||
}
|
||||
|
||||
Skeleton skeleton = (Skeleton) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.SKELETON);
|
||||
skeleton.setSkeletonType(Skeleton.SkeletonType.WITHER);
|
||||
|
||||
return skeleton;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class ZombieBabyHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
Zombie zombie = (Zombie) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
|
||||
zombie.setBaby(true);
|
||||
|
||||
return zombie;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package net.aminecraftdev.custombosses.utils.entity.handlers;
|
||||
|
||||
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Jun-18
|
||||
*/
|
||||
public class ZombieHandler implements ICustomEntityHandler {
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
Zombie zombie = (Zombie) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ZOMBIE);
|
||||
zombie.setBaby(false);
|
||||
|
||||
return zombie;
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.11.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" 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" />
|
||||
@ -29,5 +29,6 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:10.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
|
||||
</component>
|
||||
</module>
|
8
pom.xml
8
pom.xml
@ -30,7 +30,7 @@
|
||||
<dependency>
|
||||
<groupId>com.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.11.2</version>
|
||||
<version>1.12.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -51,6 +51,12 @@
|
||||
<version>6.0.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.22</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
Loading…
Reference in New Issue
Block a user