Skip to content

Commit

Permalink
Merge pull request #48 from Grzybol/release-4.2.0
Browse files Browse the repository at this point in the history
- road to release 4.2.0 😎
  • Loading branch information
Grzybol authored Apr 9, 2024
2 parents 648c1c5 + 80fe767 commit cd7e3bb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 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.1.27-SNAPSHOT</version>
<version>4.1.30-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BetterElo</name>
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/betterbox/mine/game/betterelo/CustomMobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ static class CustomMob {
LivingEntity entity;
ItemStack helmet, chestplate, leggings, boots,weapon;
HashMap< Double,ItemStack> dropTable;
double armor, speed, attackDamage, EMKSchance;
double armor, speed, attackDamage, EMKSchance, attackSpeed;
int hp;
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, 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, double attackSpeed, Map<String, Object> customMetadata, String dropTableName, Boolean dropEMKS, double EMKSchance) {
this.plugin = plugin;
this.dropEMKS = dropEMKS;
this.EMKSchance = EMKSchance;
Expand All @@ -70,6 +70,7 @@ static class CustomMob {
this.dropTable = dropFileManager.loadCustomDrops(dropTableName);
this.armor = armor;
this.hp = hp;
this.attackSpeed = attackSpeed;
this.speed = speed;
this.attackDamage = attackDamage;
this.customMetadata = customMetadata;
Expand All @@ -91,7 +92,7 @@ public CustomMob cloneForSpawn(Location spawnLocation) {
this.helmet.clone(), this.chestplate.clone(),
this.leggings.clone(), this.boots.clone(), this.weapon.clone(),
this.armor, this.hp, this.speed,
this.attackDamage, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS,this.EMKSchance);
this.attackDamage,this.attackSpeed, new HashMap<>(this.customMetadata), this.dropTableName, this.dropEMKS,this.EMKSchance);
newMob.spawnMob(spawnLocation);
return newMob;
}
Expand All @@ -117,6 +118,7 @@ private void setupMob() {
entity.setHealth(hp);
entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed);
entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(attackDamage);
entity.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(attackSpeed);

entity.setCustomName(mobName);
entity.setCustomNameVisible(true);
Expand Down Expand Up @@ -410,7 +412,7 @@ public void spawnCustomMob(Location location, String spawnerName, String mobName
CustomMob newMob = templateMob.cloneForSpawn(adjustedLocation);
newMob.customMetadata.put("SpawnerName", spawnerName);
newMob.spawnerName = spawnerName;
newMob.dropTable = fileManager.loadCustomDrops(newMob.dropTableName);
//newMob.dropTable = fileManager.loadCustomDrops(newMob.dropTableName);
pluginLogger.log(PluginLogger.LogLevel.CUSTOM_MOBS, "CustomMobs.spawnCustomMob newMob.dropTablename: "+newMob.dropTableName+", newMob.dropTable: "+newMob.dropTable);
} else {
pluginLogger.log(PluginLogger.LogLevel.ERROR, "CustomMobs.spawnCustomMob failed, mob not found: " + mobName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
double attackDamage = mobData.getDouble("attackDamage");
double EKMSchance = 0.0f;
boolean dropEMKS = false;
double attackSpeed = 1;


if(mobData.contains("dropEMKS")){
Expand All @@ -260,6 +261,10 @@ public CustomMobs.CustomMob loadCustomMob(JavaPlugin plugin, FileRewardManager d
EKMSchance = mobData.getDouble("EMKSchance");
pluginLogger.log(PluginLogger.LogLevel.DEBUG, "CustomMobsFileManager.loadCustomMob loaded EKMSchance:" + EKMSchance);
}
if(mobData.contains("attackSpeed")){
attackSpeed = mobData.getDouble("AttackSpeed");
pluginLogger.log(PluginLogger.LogLevel.DEBUG, "CustomMobsFileManager.loadCustomMob loaded AttackSpeed:" + attackSpeed);
}
String entityTypeString = mobData.getString("type");
String mobName = mobData.getString("mobName");
String dropTableName = mobData.getString("dropTable");
Expand All @@ -273,7 +278,7 @@ 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, customMetadata, dropTableName, dropEMKS, EKMSchance);
CustomMobs.CustomMob customMob = new CustomMobs.CustomMob(plugin, this, mobName, entityType, helmet, chestplate, leggings, boots,weapon, armor, hp, speed, attackDamage,attackSpeed, customMetadata, dropTableName, dropEMKS, EKMSchance);
pluginLogger.log(PluginLogger.LogLevel.DROP,"CustomMobsFileManager.loadCustomMob customMob.dropTablename: "+customMob.dropTableName);

return customMob;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/betterbox/mine/game/betterelo/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ public void onMobDeath(EntityDeathEvent event) {
}
if(customMob.dropEMKS) {
double EMKSchance = 0.00;
EMKSchance = customMob.EMKSchance;
EMKSchance = customMob.EMKSchance/100;
double randomValue = Math.random();
pluginLogger.log(PluginLogger.LogLevel.DROP, "Event.onMobDeath EMKS drop chance: " + EMKSchance + ", randomValue: " + randomValue);
if (randomValue <= EMKSchance) {
Expand Down

0 comments on commit cd7e3bb

Please sign in to comment.