Skip to content

Commit

Permalink
Merge pull request #68 from Grzybol/patch-4.30.1
Browse files Browse the repository at this point in the history
Patch 4.30.1
  • Loading branch information
Grzybol authored Jun 27, 2024
2 parents 3e1df98 + 8788100 commit 0efb8f3
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 40 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>betterbox.mine.game</groupId>
<artifactId>BetterElo</artifactId>
<version>4.3.28-SNAPSHOT</version>
<version>4.3.47-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BetterElo</name>
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/betterbox/mine/game/betterelo/CustomMobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ static class CustomMob {
//HashMap< Double,ItemStack> dropTable;
List<CustomMobsFileManager.DropItem> dropTable;
double armor, speed, attackDamage, EMKSchance;
int hp,attackSpeed;
int hp,attackSpeed,defense;
Map<String, Object> customMetadata; // Nowe pole do przechowywania niestandardowych metadanych
JavaPlugin plugin;
CustomMobsFileManager dropFileManager;

CustomMob(JavaPlugin plugin,CustomMobsFileManager dropFileManager, String mobName, EntityType entityType, ItemStack helmet, ItemStack chestplate, ItemStack leggings, ItemStack boots,ItemStack weapon, double armor, int hp, double speed, double attackDamage, int attackSpeed, Map<String, Object> customMetadata, String dropTableName, Boolean dropEMKS, double EMKSchance) {
CustomMob(JavaPlugin plugin,CustomMobsFileManager dropFileManager, String mobName, EntityType entityType, ItemStack helmet, ItemStack chestplate, ItemStack leggings, ItemStack boots,ItemStack weapon, double armor, int hp, double speed, double attackDamage, int attackSpeed, Map<String, Object> customMetadata, String dropTableName, Boolean dropEMKS, double EMKSchance, int defense) {
this.plugin = plugin;
this.dropEMKS = dropEMKS;
this.EMKSchance = EMKSchance;
Expand Down Expand Up @@ -82,11 +82,12 @@ static class CustomMob {
this.hp = hp;
this.attackSpeed = attackSpeed;
this.speed = speed;
this.defense = defense;
this.attackDamage = attackDamage;
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) {
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, int defense) {
this.plugin = plugin;
this.dropEMKS = dropEMKS;
this.EMKSchance = EMKSchance;
Expand All @@ -101,6 +102,7 @@ static class CustomMob {
this.hp = hp;
this.attackSpeed = attackSpeed;
this.speed = speed;
this.defense = defense;
this.attackDamage = attackDamage;
this.customMetadata = customMetadata;
//setupMob();
Expand All @@ -124,12 +126,12 @@ public CustomMob cloneForSpawn(Location spawnLocation, String mobType) {
this.helmet.clone(), this.chestplate.clone(),
this.leggings.clone(), this.boots.clone(), this.weapon.clone(),
this.armor, this.hp, this.speed,
this.attackDamage, this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS, this.EMKSchance);
this.attackDamage, this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS, this.EMKSchance, this.defense);
newMob.spawnMob(spawnLocation);
}else{
newMob = new CustomMob(this.plugin, this.dropFileManager, this.mobName, this.entityType,
this.armor, this.hp, this.speed,
this.attackDamage, this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS, this.EMKSchance);
this.attackDamage, this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS, this.EMKSchance, this.defense);
newMob.spawnMob(spawnLocation);
}
return newMob;
Expand Down Expand Up @@ -166,6 +168,8 @@ private void setupMob() {

// Ustawianie niestandardowych metadanych
customMetadata.forEach((key, value) -> entity.setMetadata(key, new FixedMetadataValue(plugin, value)));
entity.setMetadata("armor", new FixedMetadataValue(plugin, armor));
entity.setMetadata("defense", new FixedMetadataValue(plugin, defense));
}
public String getMobName() {
return this.mobName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,14 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
weapon = loadItemStack(mobData, "equipment.weapon");
}
// Wczytanie pozostałych danych
double armor = mobData.getDouble("armor");
double armor = 1;
int hp = mobData.getInt("hp");
double speed = mobData.getDouble("speed");
double attackDamage = mobData.getDouble("attackDamage");
double EKMSchance = 0.0d;
boolean dropEMKS = false;
int attackSpeed = 1;
int defense = 0;


if(mobData.contains("dropEMKS")){
Expand All @@ -276,6 +277,14 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
attackSpeed = mobData.getInt("attackSpeed");
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob loaded AttackSpeed:" + attackSpeed);
}
if(mobData.contains("defense")){
defense = mobData.getInt("defense");
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob loaded defense:" + defense);
}
if(mobData.contains("armor")){
armor = mobData.getDouble("armor");
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob loaded armor:" + armor);
}

String mobName = mobData.getString("mobName");
String dropTableName = mobData.getString("dropTable");
Expand All @@ -292,10 +301,10 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
CustomMobs.CustomMob customMob=null;
if (entityTypeString.equals("SKELETON")||entityTypeString.equals("ZOMBIE")){
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobsFileManager.loadCustomMob mob is ZOMBIE or SKELETON");
customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, helmet, chestplate, leggings, boots,weapon, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance);
customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, helmet, chestplate, leggings, boots,weapon, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance, defense);

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

}

Expand Down
Loading

0 comments on commit 0efb8f3

Please sign in to comment.