Skip to content

Commit

Permalink
- fixed customMobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzybol committed Jun 21, 2024
1 parent e1cf09e commit 78d9d05
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
19 changes: 19 additions & 0 deletions src/main/java/betterbox/mine/game/betterelo/CustomMobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ static class CustomMob {
this.customMetadata = customMetadata;
//setupMob();
}
CustomMob(JavaPlugin plugin,CustomMobsFileManager dropFileManager, String mobName, EntityType entityType, double armor, int hp, double speed, double attackDamage, int attackSpeed, Map<String, Object> customMetadata, String dropTableName, Boolean dropEMKS, double EMKSchance) {
this.plugin = plugin;
this.dropEMKS = dropEMKS;
this.EMKSchance = EMKSchance;
this.mobName = mobName;
this.entity = entity;
this.entityType = entityType;
this.dropFileManager = dropFileManager;
this.dropTableName = dropTableName;
//this.dropTable = dropFileManager.loadCustomDrops(dropTableName);
this.dropTable = dropFileManager.loadCustomDropsv2(dropTableName);
this.armor = armor;
this.hp = hp;
this.attackSpeed = attackSpeed;
this.speed = speed;
this.attackDamage = attackDamage;
this.customMetadata = customMetadata;
//setupMob();
}

// Metoda do stworzenia i ustawienia encji moba
public void spawnMob(Location location) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,20 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d

try{
YamlConfiguration mobData = YamlConfiguration.loadConfiguration(mobFile);

// Wczytanie wyposażenia z pliku
ItemStack helmet = loadItemStack(mobData, "equipment.helmet");
ItemStack chestplate = loadItemStack(mobData, "equipment.chestplate");
ItemStack leggings = loadItemStack(mobData, "equipment.leggings");
ItemStack boots = loadItemStack(mobData, "equipment.boots");
ItemStack weapon = loadItemStack(mobData, "equipment.weapon");
String entityTypeString = mobData.getString("type");
ItemStack helmet=null;
ItemStack chestplate=null;
ItemStack leggings=null;
ItemStack boots=null;
ItemStack weapon=null;

if (entityTypeString.equals("SKELETON")||entityTypeString.equals("ZOMBIE")) {// Wczytanie wyposażenia z pliku
helmet = loadItemStack(mobData, "equipment.helmet");
chestplate = loadItemStack(mobData, "equipment.chestplate");
leggings = loadItemStack(mobData, "equipment.leggings");
boots = loadItemStack(mobData, "equipment.boots");
weapon = loadItemStack(mobData, "equipment.weapon");
}
// Wczytanie pozostałych danych
double armor = mobData.getDouble("armor");
int hp = mobData.getInt("hp");
Expand All @@ -268,7 +275,7 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
attackSpeed = mobData.getInt("attackSpeed");
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob loaded AttackSpeed:" + attackSpeed);
}
String entityTypeString = mobData.getString("type");

String mobName = mobData.getString("mobName");
String dropTableName = mobData.getString("dropTable");

Expand All @@ -281,7 +288,15 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d

// Utworzenie instancji CustomMob
// Zakładamy, że LivingEntity jest nullem, ponieważ tworzymy moba bez konkretnej encji w świecie
CustomMobs.CustomMob customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, helmet, chestplate, leggings, boots,weapon, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance);
CustomMobs.CustomMob customMob=null;
if (entityTypeString.equals("SKELETON")||entityTypeString.equals("ZOMBIE")){
customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, helmet, chestplate, leggings, boots,weapon, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance);

}else{
customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance);

}

pluginLogger.log(PluginLogger.LogLevel.DROP,"CustomMobsFileManager.loadCustomMob customMob.dropTablename: "+customMob.dropTableName);

return customMob;
Expand Down

0 comments on commit 78d9d05

Please sign in to comment.