1.0.0-SNAPSHOT-U203c

+ Finished implementing the Legacy version
This commit is contained in:
Charles 2019-01-21 00:14:31 +08:00
parent ea848757d2
commit b2fd40eb1c
10 changed files with 50 additions and 52 deletions

8
TODO
View File

@ -1,11 +1,3 @@
00:30 -> Add HolographicDisplay/PlaceholderAPI support for custom placeholders on AutoSpawnInterval times
01:00 -> Add a new branch for the plugin and add support for Legacy version
-----------
1:30 hrs
------------------------------------- TO DO AFTER RELEASE ---------------------------------------------------
02:00 -> Randomly in the wilderness, bosses will spawn with x chance within coords as a player is loading chunks
00:45 -> Randomly from a spawner, bosses will spawn with x chance within coords when a spawner is spawning mobs of the same type

View File

@ -6,9 +6,12 @@
"1": {
"1": {
"items": {
"SKEco500": 30.0,
"SKEco2500": 50.0,
"SKEco5000": 10.0
"SKMainHand": 15.0,
"SKOffHand": 15.0,
"SKHelmet": 15.0,
"SKLeggings": 30.0,
"SKChestplate": 30.0,
"SKBoots": 30.0
},
"commands": {
"SKEco500": 30.0,

View File

@ -61,15 +61,15 @@
]
},
"SKHelmet": {
"type": "GOLDEN_HELMET",
"type": "GOLD_HELMET",
"enchants": [ "protection:4", "unbreaking:3" ]
},
"SKChestplate": {
"type": "GOLDEN_CHESTPLATE",
"type": "GOLD_CHESTPLATE",
"enchants": [ "protection:4", "unbreaking:3" ]
},
"SKLeggings": {
"type": "GOLDEN_LEGGINGS",
"type": "GOLD_LEGGINGS",
"enchants": [ "protection:4", "unbreaking:3" ]
},
"SKBoots": {
@ -81,7 +81,7 @@
"enchants": [ "sharpness:4", "unbreaking:3" ]
},
"SKOffHand": {
"type": "SHIELD"
"type": "STICK"
},
"SKCustomDrop1": {
"type": "STONE",

View File

@ -18,7 +18,7 @@ MainMenu:
Settings:
emptySpaceFiller: true
EmptySpaceFiller:
type: STAINED_THIN_GLASS
type: STAINED_GLASS_PANE
name: '&7'
Items:
'2':

View File

@ -36,7 +36,7 @@ public class EntityTypeEditorPanel extends SubVariablePanelHandler<BossEntity, E
@Override
public void fillPanel(Panel panel, BossEntity bossEntity, EntityStatsElement entityStatsElement) {
List<EntityType> list = Arrays.stream(EntityType.values()).filter(EntityType::isSpawnable).collect(Collectors.toList());
Map<EntityType, Material> filteredMap = getFilteredMap(list);
Map<EntityType, Short> filteredMap = getFilteredMap(list);
List<EntityType> filteredList = new ArrayList<>(filteredMap.keySet());
int maxPage = panel.getMaxPage(filteredMap);
@ -74,22 +74,15 @@ public class EntityTypeEditorPanel extends SubVariablePanelHandler<BossEntity, E
}
private Map<EntityType, Material> getFilteredMap(List<EntityType> entityTypes) {
Map<EntityType, Material> filteredMap = new HashMap<>();
private Map<EntityType, Short> getFilteredMap(List<EntityType> entityTypes) {
Map<EntityType, Short> filteredMap = new HashMap<>();
entityTypes.forEach(entityType -> {
String materialName = entityType + "_SPAWN_EGG";
Material material = Material.matchMaterial(materialName);
if(material == null) return;
filteredMap.put(entityType, material);
});
entityTypes.forEach(entityType -> filteredMap.put(entityType, entityType.getTypeId()));
return filteredMap;
}
private void loadPage(Panel panel, int requestedPage, Map<EntityType, Material> filteredMap, List<EntityType> filteredList, BossEntity bossEntity, EntityStatsElement entityStatsElement) {
private void loadPage(Panel panel, int requestedPage, Map<EntityType, Short> filteredMap, List<EntityType> filteredList, BossEntity bossEntity, EntityStatsElement entityStatsElement) {
String entityTypeValue = entityStatsElement.getMainStats().getEntityType();
ServerUtils.get().runTaskAsync(() -> panel.loadPage(requestedPage, ((slot, realisticSlot) -> {
@ -97,9 +90,7 @@ public class EntityTypeEditorPanel extends SubVariablePanelHandler<BossEntity, E
panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {});
} else {
EntityType entityType = filteredList.get(slot);
Material material = filteredMap.get(entityType);
ItemStack itemStack = new ItemStack(material);
ItemStack itemStack = new ItemStack(Material.MONSTER_EGG, filteredMap.get(entityType));
Map<String, String> replaceMap = new HashMap<>();
boolean found = false;

View File

@ -96,6 +96,8 @@ public abstract class DropTableRewardsListEditorPanel<SubVariable> extends SubVa
ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(this.itemsFileManager.getItemStackHolder(name));
if(itemStack == null || itemStack.getType() == Material.AIR) return;
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.DropTable.RewardList.name"), replaceMap);
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.DropTable.RewardList.lore"), replaceMap);

View File

@ -23,15 +23,15 @@ public enum EnchantFinder {
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.FROST_WALKER, "frost_walker", "frost walker"),
binding_curse("Curse of Binding", Enchantment.BINDING_CURSE, "binding_curse", "binding curse", "curse"),
frost_walker("Frost Walker", Enchantment.getByName("FROST_WALKER"), "frost_walker", "frost walker"),
binding_curse("Curse of Binding", Enchantment.getByName("BINDING_CURSE"), "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.SWEEPING_EDGE, "sweeping edge", "sweeping_edge"),
sweeping_edge("Sweeping Edge", Enchantment.getByName("SWEEPING_EDGE"), "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"),
@ -42,8 +42,8 @@ public enum EnchantFinder {
infinite("Infinite", Enchantment.ARROW_INFINITE, "infinite", "arrow_infinite", "arrow infinite"),
luck("Luck", Enchantment.LUCK, "luck"),
lure("Lure", Enchantment.LURE, "lure"),
mending("Mending", Enchantment.MENDING, "mending"),
curse_of_vanishing("Curse of Vanishing", Enchantment.VANISHING_CURSE, "vanishing", "vanishing curse", "vanishing_curse", "curseofvanishing", "vanishingcurse", "curse of vanishing", "curse_of_vanishing");
mending("Mending", Enchantment.getByName("MENDING"), "mending"),
curse_of_vanishing("Curse of Vanishing", Enchantment.getByName("VANISHING_CURSE"), "vanishing", "vanishing curse", "vanishing_curse", "curseofvanishing", "vanishingcurse", "curse of vanishing", "curse_of_vanishing");
@Getter private List<String> names = new ArrayList<>();
@Getter private Enchantment enchantment;

View File

@ -106,9 +106,11 @@ public class ItemStackConverter implements IReplaceableConverter<ItemStackHolder
public ItemStack from(ItemStackHolder itemStackHolder, Map<String, String> replaceMap) {
ItemStack itemStack = new ItemStack(Material.AIR);
if(itemStackHolder == null) return itemStack;
if(itemStackHolder.getType() == null) return itemStack;
Material material = this.materialConverter.from(itemStackHolder.getType());
String type = itemStackHolder.getType();
Material material = this.materialConverter.from(type);
if(material == null) return itemStack;
@ -120,6 +122,10 @@ public class ItemStackConverter implements IReplaceableConverter<ItemStackHolder
List<String> lore = itemStackHolder.getLore(), enchants = itemStackHolder.getEnchants();
Boolean isGlowing = itemStackHolder.getIsGlowing();
if(type.contains(":")) {
durability = Short.valueOf(type.split(":")[1]);
}
if(durability != null) itemStack.setDurability(durability);
if(enchants != null) itemStack.addUnsafeEnchantments(this.enchantConverter.from(enchants));

View File

@ -62,15 +62,6 @@ public class ItemStackUtils {
if(compoundData == null || compoundData.isEmpty()) return cloneStack;
// TODO
// ItemStack craftStack = NbtFactory.getCraftItemStack(cloneStack);
// NbtFactory.NbtCompound compound = NbtFactory.fromItemTag(craftStack);
//
// for(String s : compoundData.keySet()) {
// compound.put(s, compoundData.get(s));
// }
//
// return craftStack;
return cloneStack;
}
@ -87,17 +78,26 @@ public class ItemStackUtils {
String owner = configurationSection.getString("owner");
Map<Enchantment, Integer> map = new HashMap<>();
List<String> newLore = new ArrayList<>();
Material mat = getType(type);
short meta = 0;
boolean addGlow = false;
short meta = 0;
Material mat;
if(type instanceof String) {
String sType = (String) type;
if(NumberUtils.get().isInt(type)) {
mat = Material.getMaterial(NumberUtils.get().getInteger(type));
} else {
if(type.contains(":")) {
String[] split = type.split(":");
String typeSplit = split[0];
if(sType.contains(":")) {
String[] split = sType.split(":");
if(NumberUtils.get().isInt(typeSplit)) {
mat = Material.getMaterial(NumberUtils.get().getInteger(typeSplit));
} else {
mat = Material.getMaterial(typeSplit);
}
meta = Short.valueOf(split[1]);
} else {
mat = Material.getMaterial(type);
}
}

View File

@ -24,6 +24,10 @@ public class MaterialConverter implements IConverter<String, Material> {
input = split[0];
}
if(NumberUtils.get().isInt(input)) {
return Material.getMaterial(NumberUtils.get().getInteger(input));
}
return Material.matchMaterial(input);
}
}