3.0.0-SNAPSHOT-U9

Implemented more mechanics, utilities, added the items.json system, moved the API into the out of the API module and into the core module
This commit is contained in:
AMinecraftDev 2018-06-03 22:11:13 +08:00
parent 37ab20b142
commit 22c3fc4765
38 changed files with 394 additions and 130 deletions

View File

@ -2,6 +2,7 @@
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.spigotmc:spigot:1.8.8">
<library name="Maven: com.spigotmc:spigot:1.12.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.8.8/spigot-1.8.8.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.12.1/spigot-1.12.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.8.8/spigot-1.8.8-javadoc.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.12.1/spigot-1.12.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.8.8/spigot-1.8.8-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/com/spigotmc/spigot/1.12.1/spigot-1.12.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -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.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -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.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -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.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -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.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -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.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -1,65 +0,0 @@
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 Short spawnerId;
@Expose private Boolean glowing;
public ItemStackHolder(String type, Short durability, String name, List<String> lore, List<String> enchants, String skullOwner, Short spawnerId, Boolean glowing) {
this.type = type;
this.durability = durability;
this.name = name;
this.lore = lore;
this.enchants = enchants;
this.skullOwner = skullOwner;
this.spawnerId = spawnerId;
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 Short getSpawnerId() {
return spawnerId;
}
public Boolean getIsGlowing() {
return glowing;
}
}

View File

@ -0,0 +1,41 @@
package net.aminecraftdev.custombosses.utils;
import org.junit.Test;
import java.util.*;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public class StringTest {
@Test
public void testReplaceList() {
List<String> list = new ArrayList<>(Arrays.asList("abcd {0}", "efg {1}", "hij {2}"));
Map<String, String> replaceMap = new HashMap<>();
replaceMap.put("{0}", "123");
replaceMap.put("{1}", "456");
replaceMap.put("{2}", "789");
System.out.println(list);
list.replaceAll(s -> replaceString(s, replaceMap));
System.out.println(list);
}
private String replaceString(String input, Map<String, String> replaceMap) {
if(replaceMap == null) return input;
for(String replaceKey : replaceMap.keySet()) {
if(input.contains(replaceKey)) {
input = input.replace(replaceKey, replaceMap.get(replaceKey));
}
}
return input;
}
}

View File

@ -9,7 +9,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -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.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -1,23 +0,0 @@
package net.aminecraftdev.custombosses.api;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 11-Mar-18
*
*/
public class BossAPI {
private static BossAPI instance;
public BossAPI() {
instance = this;
}
public static BossAPI get() {
return instance;
}
}

View File

@ -0,0 +1,19 @@
package net.aminecraftdev.custombosses.exception;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public class AlreadySetException extends RuntimeException {
public AlreadySetException() {
super();
}
public AlreadySetException(String message) {
super(message);
}
}

View File

@ -0,0 +1,33 @@
package net.aminecraftdev.custombosses.holder;
import lombok.Getter;
import net.aminecraftdev.custombosses.entity.BossEntity;
import net.aminecraftdev.custombosses.exception.AlreadySetException;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public class ActiveBossHolder {
@Getter private final BossEntity bossEntity;
@Getter private final Location location;
@Getter private LivingEntity livingEntity;
public ActiveBossHolder(BossEntity bossEntity, Location spawnLocation) {
this.location = spawnLocation;
this.bossEntity = bossEntity;
}
public void setLivingEntity(LivingEntity livingEntity) {
if(getLivingEntity() != null) {
throw new AlreadySetException("Tried to set a new LivingEntity while it's already set.");
} else {
this.livingEntity = livingEntity;
}
}
}

View File

@ -1,8 +1,9 @@
package net.aminecraftdev.custombosses.mechanics;
import net.aminecraftdev.custombosses.entity.elements.MainStatsElement;
import net.aminecraftdev.custombosses.entity.BossEntity;
import net.aminecraftdev.custombosses.holder.ActiveBossHolder;
import net.aminecraftdev.custombosses.utils.EntityTypeUtil;
import org.bukkit.Location;
import net.aminecraftdev.custombosses.utils.IMechanic;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -11,35 +12,30 @@ import org.bukkit.entity.LivingEntity;
* @version 1.0.0
* @since 01-Jun-18
*/
public class EntityTypeMechanic {
public class EntityTypeMechanic implements IMechanic {
private static final EntityTypeMechanic instance = new EntityTypeMechanic();
public LivingEntity getBaseEntity(MainStatsElement mainStatsElement, Location location) {
String bossEntityType = mainStatsElement.getEntityType();
@Override
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
String bossEntityType = bossEntity.getMainStats().getEntityType();
LivingEntity livingEntity;
try {
livingEntity = EntityTypeUtil.get(bossEntityType, location);
livingEntity = EntityTypeUtil.get(bossEntityType, activeBossHolder.getLocation());
} catch (NullPointerException ex) {
return null;
return false;
}
if(livingEntity == null) {
EntityType entityType = EntityType.valueOf(bossEntityType.toUpperCase());
try {
livingEntity = (LivingEntity) location.getWorld().spawnEntity(location, entityType);
livingEntity = (LivingEntity) activeBossHolder.getLocation().getWorld().spawnEntity(activeBossHolder.getLocation(), entityType);
} catch (Exception ex) {
return null;
return false;
}
}
return livingEntity;
activeBossHolder.setLivingEntity(livingEntity);
return true;
}
public static EntityTypeMechanic get() {
return instance;
}
}

View File

@ -0,0 +1,46 @@
package net.aminecraftdev.custombosses.mechanics;
import net.aminecraftdev.custombosses.entity.BossEntity;
import net.aminecraftdev.custombosses.holder.ActiveBossHolder;
import net.aminecraftdev.custombosses.utils.Debug;
import net.aminecraftdev.custombosses.utils.IMechanic;
import net.aminecraftdev.custombosses.utils.StringUtils;
import net.aminecraftdev.custombosses.utils.reader.SpigotYmlReader;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 02-Jun-18
*/
public class StatsMechanic implements IMechanic {
@Override
public boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder) {
if(activeBossHolder.getLivingEntity() == null) return false;
LivingEntity livingEntity = activeBossHolder.getLivingEntity();
double maxHealthSetting = (double) SpigotYmlReader.get().getObject("settings.attribute.maxHealth.max");
double maxHealth = bossEntity.getMainStats().getHealth();
if(maxHealth > maxHealthSetting) {
Debug.MAX_HEALTH.debug(maxHealthSetting);
return false;
}
livingEntity.setMaxHealth(maxHealth);
livingEntity.setHealth(maxHealth);
String customName = bossEntity.getMainStats().getDisplayName();
if(customName != null) {
livingEntity.setCustomName(StringUtils.get().translateColor(customName));
livingEntity.setCustomNameVisible(true);
}
livingEntity.setRemoveWhenFarAway(false);
livingEntity.setCanPickupItems(false);
return true;
}
}

View File

@ -10,6 +10,8 @@ public enum Debug {
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."),
MAX_HEALTH("You cannot set the max health higher than {0}. You can adjust your max health in the spigot.yml file and restart your server to increase this."),
ATTEMPTED_TO_SPAWN_WHILE_DISABLED("The {0} boss/minion attempted to spawn while editing is enabled.");
private String message;

View File

@ -0,0 +1,12 @@
package net.aminecraftdev.custombosses.utils;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public interface ILoadable {
void load();
}

View File

@ -0,0 +1,15 @@
package net.aminecraftdev.custombosses.utils;
import net.aminecraftdev.custombosses.entity.BossEntity;
import net.aminecraftdev.custombosses.holder.ActiveBossHolder;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 02-Jun-18
*/
public interface IMechanic {
boolean applyMechanic(BossEntity bossEntity, ActiveBossHolder activeBossHolder);
}

View File

@ -3,7 +3,7 @@ package net.aminecraftdev.custombosses.utils;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 28-Apr-18
* @since 03-Jun-18
*/
public interface IReloadable {

View File

@ -0,0 +1,14 @@
package net.aminecraftdev.custombosses.utils;
import java.util.Map;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public interface IReplaceableConverter<OutputObject, InputObject> extends IConverter<OutputObject, InputObject> {
InputObject from(OutputObject outputObject, Map<String, String> replaceMap);
}

View File

@ -0,0 +1,12 @@
package net.aminecraftdev.custombosses.utils;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public interface ISavable {
void save();
}

View File

@ -0,0 +1,12 @@
package net.aminecraftdev.custombosses.utils;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public interface IYmlReader {
Object getObject(String path);
}

View File

@ -213,7 +213,6 @@ public class NbtFactory {
/**
* Save the content of a NBT compound to a stream.
* <p>
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
* @param stream - the output stream.
* @param option - whether or not to compress the output.
* @throws IOException If anything went wrong.
@ -408,7 +407,6 @@ public class NbtFactory {
/**
* Load the content of a file from a stream.
* <p>
* Use {@link Files#newInputStreamSupplier(File)} to provide a stream from a file.
* @param stream - the stream supplier.
* @param option - whether or not to decompress the input stream.
* @return The decoded NBT compound.
@ -440,7 +438,6 @@ public class NbtFactory {
/**
* Save the content of a NBT compound to a stream.
* <p>
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
* @param source - the NBT compound to save.
* @param stream - the stream.
* @param option - whether or not to compress the output.

View File

@ -0,0 +1,42 @@
package net.aminecraftdev.custombosses.utils.file;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 28-Apr-18
*/
public class FileUtils {
private static FileUtils INSTANCE = new FileUtils();
public void saveFile(File file, FileConfiguration fileConfiguration) {
try {
fileConfiguration.save(file);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void createFile(File file) {
try {
file.createNewFile();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public FileConfiguration loadFile(File file) {
return YamlConfiguration.loadConfiguration(file);
}
public static FileUtils get() {
return INSTANCE;
}
}

View File

@ -1,11 +1,12 @@
package net.aminecraftdev.custombosses.utils.itemstack;
import net.aminecraftdev.custombosses.utils.IConverter;
import net.aminecraftdev.custombosses.utils.IReplaceableConverter;
import net.aminecraftdev.custombosses.utils.StringUtils;
import net.aminecraftdev.custombosses.utils.factory.NbtFactory;
import net.aminecraftdev.custombosses.utils.itemstack.converters.EnchantConverter;
import net.aminecraftdev.custombosses.utils.itemstack.holder.ItemStackHolder;
import net.aminecraftdev.custombosses.utils.itemstack.converters.MaterialConverter;
import net.aminecraftdev.custombosses.utils.itemstack.holder.ItemStackHolder;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
@ -17,13 +18,14 @@ 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> {
public class ItemStackConverter implements IReplaceableConverter<ItemStackHolder, ItemStack> {
private MaterialConverter materialConverter;
private EnchantConverter enchantConverter;
@ -36,6 +38,7 @@ public class ItemStackConverter implements IConverter<ItemStackHolder, ItemStack
@Override
public ItemStackHolder to(ItemStack itemStack) {
Material material = itemStack.getType();
int amount = itemStack.getAmount();
Short durability = itemStack.getDurability(), spawnerId = null;
String type, name = null, skullOwner = null;
List<String> lore = null, enchants = null;
@ -93,11 +96,16 @@ public class ItemStackConverter implements IConverter<ItemStackHolder, ItemStack
if(compound.containsKey("ench")) isGlowing = true;
}
return new ItemStackHolder(type, durability, name, lore, enchants, skullOwner, spawnerId, isGlowing);
return new ItemStackHolder(amount, type, durability, name, lore, enchants, skullOwner, spawnerId, isGlowing);
}
@Override
public ItemStack from(ItemStackHolder itemStackHolder) {
return from(itemStackHolder, null);
}
@Override
public ItemStack from(ItemStackHolder itemStackHolder, Map<String, String> replaceMap) {
ItemStack itemStack = new ItemStack(Material.AIR);
if(itemStackHolder.getType() == null) return itemStack;
@ -119,14 +127,30 @@ public class ItemStackConverter implements IConverter<ItemStackHolder, ItemStack
if(name != null || skullOwner != null || lore != null || spawnerId != null) {
ItemMeta itemMeta = itemStack.getItemMeta();
if(name != null) itemMeta.setDisplayName(StringUtils.get().translateColor(name));
if(lore != null) {
List<String> newLore = new ArrayList<>();
//-----------
// SET NAME
//-----------
if(name != null) {
name = StringUtils.get().translateColor(name);
lore.forEach(string ->newLore.add(StringUtils.get().translateColor(string)));
itemMeta.setLore(newLore);
itemMeta.setDisplayName(replaceString(name, replaceMap));
}
//-----------
// SET LORE
//-----------
if(lore != null) {
List<String> replacedLore = new ArrayList<>(lore);
replacedLore.replaceAll(s -> s.replace('&', '§'));
replacedLore.replaceAll(s -> replaceString(s, replaceMap));
itemMeta.setLore(replacedLore);
}
//----------------------------------------------
// SET OWNER, SPAWNER ID, OR UPDATE ITEM META
//----------------------------------------------
if(skullOwner != null) {
SkullMeta skullMeta = (SkullMeta) itemMeta;
@ -155,4 +179,16 @@ public class ItemStackConverter implements IConverter<ItemStackHolder, ItemStack
return itemStack;
}
private String replaceString(String input, Map<String, String> replaceMap) {
if(replaceMap == null) return input;
for(String replaceKey : replaceMap.keySet()) {
if(input.contains(replaceKey)) {
input = input.replace(replaceKey, replaceMap.get(replaceKey));
}
}
return input;
}
}

View File

@ -0,0 +1,37 @@
package net.aminecraftdev.custombosses.utils.itemstack.holder;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import java.util.List;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 03-Jun-18
*/
public class ItemStackHolder {
@Expose @Getter private Integer amount;
@Expose @Getter private String type;
@Expose @Getter private Short durability;
@Expose @Getter private String name;
@Expose @Getter private List<String> lore;
@Expose @Getter private List<String> enchants;
@Expose @Getter private String skullOwner;
@Expose @Getter private Short spawnerId;
@Expose @Getter private Boolean isGlowing;
public ItemStackHolder(Integer amount, String type, Short durability, String name, List<String> lore, List<String> enchants, String skullOwner, Short spawnerId, Boolean isGlowing) {
this.amount = amount;
this.type = type;
this.durability = durability;
this.name = name;
this.lore = lore;
this.enchants = enchants;
this.skullOwner = skullOwner;
this.spawnerId = spawnerId;
this.isGlowing = isGlowing;
}
}

View File

@ -0,0 +1,37 @@
package net.aminecraftdev.custombosses.utils.reader;
import net.aminecraftdev.custombosses.utils.IYmlReader;
import net.aminecraftdev.custombosses.utils.file.FileUtils;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import java.io.File;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 02-Jun-18
*/
public class SpigotYmlReader implements IYmlReader {
private static SpigotYmlReader instance = new SpigotYmlReader();
private FileConfiguration spigotConfig;
private SpigotYmlReader() {
File serverFile = Bukkit.getWorldContainer().getParentFile();
File spigotFile = new File(serverFile, "spigot.yml");
this.spigotConfig = FileUtils.get().loadFile(spigotFile);
}
@Override
public Object getObject(String path) {
return this.spigotConfig.get(path);
}
public static SpigotYmlReader get() {
return instance;
}
}

View File

@ -9,7 +9,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.spigotmc:spigot:1.12.1" 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" />

View File

@ -20,7 +20,7 @@
</modules>
<properties>
<plugin.version>3.0.0-SNAPSHOT-U7</plugin.version>
<plugin.version>3.0.0-SNAPSHOT-U9</plugin.version>
<plugin.name>CustomBosses</plugin.name>
<plugin.main>net.aminecraftdev.custombosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>