3.0.0-SNAPSHOT-U34

+ Finished transferring and renaming all items to Songoda products
+ Continued work on Drop Tables
+ Added more configurable options for how drops work
+ Updated ServerUtils to log [EpicBosses] not [CustomBosses]
This commit is contained in:
AMinecraftDev 2018-10-27 02:34:48 +08:00
parent a1faea44e4
commit 001563e18d
18 changed files with 157 additions and 46 deletions

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>CustomBosses</artifactId>
<groupId>net.aminecraftdev.custombosses</groupId>
<version>3.0.0.0</version>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -15,7 +15,7 @@
<dependencies>
<dependency>
<groupId>net.aminecraftdev.custombosses</groupId>
<groupId>com.songoda.epicbosses</groupId>
<artifactId>FactionHelper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>CustomBosses</artifactId>
<groupId>net.aminecraftdev.custombosses</groupId>
<version>3.0.0.0</version>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -15,7 +15,7 @@
<dependencies>
<dependency>
<groupId>net.aminecraftdev.custombosses</groupId>
<groupId>com.songoda.epicbosses</groupId>
<artifactId>FactionHelper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>CustomBosses</artifactId>
<groupId>net.aminecraftdev.custombosses</groupId>
<version>3.0.0.0</version>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -15,7 +15,7 @@
<dependencies>
<dependency>
<groupId>net.aminecraftdev.custombosses</groupId>
<groupId>com.songoda.epicbosses</groupId>
<artifactId>FactionHelper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>CustomBosses</artifactId>
<groupId>net.aminecraftdev.custombosses</groupId>
<version>3.0.0.0</version>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -15,7 +15,7 @@
<dependencies>
<dependency>
<groupId>net.aminecraftdev.custombosses</groupId>
<groupId>com.songoda.epicbosses</groupId>
<artifactId>FactionHelper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>CustomBosses</artifactId>
<groupId>net.aminecraftdev.custombosses</groupId>
<version>3.0.0.0</version>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -82,6 +82,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<copy file="target/${build.finalName}.jar" tofile="D:/Servers/1.13/plugins/${build.finalName}.jar"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -4,5 +4,14 @@
],
"SKOnDeath": [
"broadcast this is the default command when the Skeleton King is defeated!"
],
"SKEco500": [
"eco give %player% 500"
],
"SKEco2500": [
"eco give %player% 2500"
],
"SKEco5000": [
"eco give %player% 5000"
]
}

View File

@ -35,16 +35,33 @@
"rewards": {
"giveRewards": {
"1": {
"items": {
"SKHelmet": 10.0,
"SKChestplate": 25.0,
"SKLeggings": 25.0,
"SKBoots": 25.0,
"SKMainHand": 10.0,
"SKOffHand": 10.0
"1": {
"items": {
"SKHelmet": 10.0,
"SKChestplate": 25.0,
"SKLeggings": 25.0,
"SKBoots": 25.0,
"SKMainHand": 10.0,
"SKOffHand": 10.0
},
"maxDrops": -1,
"randomDrops": false,
"requiredPercentage": 80.0
},
"maxDrops": -1,
"randomDrops": false
"2": {
"items": {
"SKCustomDrop1": 50.0,
"SKCustomDrop2": 50.0
},
"requiredPercentage": 50.0
},
"3": {
"items": {
"SKCustomDrop1": 100.0,
"SKCustomDrop2": 100.0
},
"requiredPercentage": 0.0
}
},
"2": {
"items": {

View File

@ -29,5 +29,19 @@
},
"SKOffHand": {
"type": "SHIELD"
},
"SKCustomDrop1": {
"type": "STONE",
"name": "&5Skeleton King Stone",
"lore": [
"&7This stone will bring you",
"&7great luck in battle."
]
},
"SKCustomDrop2": {
"type": "COMMAND",
"command": [
"SKEco500"
]
}
}

View File

@ -15,6 +15,6 @@ import java.util.Map;
*/
public class GiveTableElement extends RewardsTableElement {
@Expose @Getter @Setter private Map<String, GiveTableSubElement> giveRewards;
@Expose @Getter @Setter private Map<String, Map<String, GiveTableSubElement>> giveRewards;
}

View File

@ -16,5 +16,6 @@ public class GiveTableSubElement {
@Expose @Getter @Setter private Map<String, Double> items;
@Expose @Getter @Setter private Integer maxDrops;
@Expose @Getter @Setter private Boolean randomDrops;
@Expose @Getter @Setter private Double requiredPercentage;
}

View File

@ -14,14 +14,15 @@ import java.util.UUID;
*/
public class DeadBossHolder {
@Getter private final Map<UUID, Double> sortedDamageMap;
@Getter private final Map<UUID, Double> sortedDamageMap, percentageMap;
@Getter private final BossEntity bossEntity;
@Getter private final Location location;
public DeadBossHolder(BossEntity bossEntity, Location deathLocation, Map<UUID, Double> sortedDamageMap) {
public DeadBossHolder(BossEntity bossEntity, Location deathLocation, Map<UUID, Double> sortedDamageMap, Map<UUID, Double> percentageMap) {
this.location = deathLocation;
this.bossEntity = bossEntity;
this.sortedDamageMap = sortedDamageMap;
this.percentageMap = percentageMap;
}
}

View File

@ -19,10 +19,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
* @author Charles Cullen

View File

@ -2,16 +2,22 @@ package com.songoda.epicbosses.managers;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.droptable.elements.GiveTableElement;
import com.songoda.epicbosses.droptable.elements.GiveTableSubElement;
import com.songoda.epicbosses.droptable.elements.SprayTableElement;
import com.songoda.epicbosses.holder.DeadBossHolder;
import com.songoda.epicbosses.managers.files.ItemsFileManager;
import com.songoda.epicbosses.utils.Debug;
import com.songoda.epicbosses.utils.NumberUtils;
import com.songoda.epicbosses.utils.RandomUtils;
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* @author Charles Cullen
@ -21,9 +27,11 @@ import java.util.Map;
public class BossDropTableManager {
private ItemsFileManager itemsFileManager;
private BossEntityManager bossEntityManager;
public BossDropTableManager(CustomBosses plugin) {
this.itemsFileManager = plugin.getItemStackManager();
this.bossEntityManager = plugin.getBossEntityManager();
}
public List<ItemStack> getSprayItems(SprayTableElement sprayTableElement) {
@ -66,4 +74,34 @@ public class BossDropTableManager {
return customDrops;
}
public void handleGiveTable(GiveTableElement giveTableElement, DeadBossHolder deadBossHolder) {
Map<String, Map<String, GiveTableSubElement>> rewards = giveTableElement.getGiveRewards();
Map<UUID, Double> mapOfDamage = deadBossHolder.getSortedDamageMap();
List<UUID> positions = new ArrayList<>(mapOfDamage.keySet());
rewards.forEach((positionString, lootMap) -> {
if(!NumberUtils.get().isInt(positionString)) {
Debug.DROP_TABLE_FAILED_INVALID_NUMBER.debug(positionString);
return;
}
int position = NumberUtils.get().getInteger(positionString);
if(positions.size() < position) return;
UUID uuid = positions.get(position);
double percentage = this.bossEntityManager.getPercentage(activeBossHolder, entry.getKey());
lootMap.forEach((key, subElement) -> {
Double requiredPercentage = subElement.getRequiredPercentage();
Boolean randomDrops = subElement.getRandomDrops();
if(requiredPercentage == null) requiredPercentage = 0.0D;
if(randomDrops == null) randomDrops = false;
});
});
}
}

View File

@ -214,6 +214,20 @@ public class BossEntityManager {
return playerDamage / onePercent;
}
public double getPercentage(DeadBossHolder deadBossHolder, UUID uuid) {
Map<UUID, Double> damagingUsers = deadBossHolder.getSortedDamageMap();
double totalDamage = 0.0;
for(Double damage : damagingUsers.values()) {
if(damage != null) totalDamage += damage;
}
double playerDamage = damagingUsers.get(uuid);
double onePercent = totalDamage / 100;
return playerDamage / onePercent;
}
public DropTable getDropTable(BossEntity bossEntity) {
return this.dropTableFileManager.getDropTable(bossEntity.getDrops().getDropTable());
}

View File

@ -32,6 +32,8 @@ public enum Debug {
FAILED_TO_LOAD_COMMANDS("The commands name that is provided ({0}) doesn't exist or wasn't found."),
FAILED_TO_CREATE_ACTIVE_BOSS_HOLDER("Something went wrong while trying to create an active boss holder for someone who is trying to spawn a boss."),
DROP_TABLE_FAILED_INVALID_NUMBER("The specified position ({0}) on the drop table is not a valid number."),
MECHANIC_TYPE_NOT_STORED("This mechanic type is not stored, therefore will not be applied. Valid mechanic types are IOptionalMechanic and IPrimaryMechanic.");
private static CustomBosses PLUGIN;

View File

@ -28,15 +28,15 @@ public class ServerUtils {
}
public void logError(String log) {
log("&c[CustomBosses] Error - &7" + log);
log("&c[EpicBosses] Error - &7" + log);
}
public void logWarn(String log) {
log("&e[CustomBosses] Warn - &7" + log);
log("&e[EpicBosses] Warn - &7" + log);
}
public void logDebug(String log) {
log("&d[CustomBosses] Debug - &7" + log);
log("&d[EpicBosses] Debug - &7" + log);
}
public BukkitTask runTask(Runnable runnable) {

View File

@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>CustomBosses</artifactId>
<groupId>net.aminecraftdev.custombosses</groupId>
<version>3.0.0.0</version>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

10
pom.xml
View File

@ -4,10 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.aminecraftdev.custombosses</groupId>
<artifactId>CustomBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<artifactId>EpicBosses</artifactId>
<packaging>pom</packaging>
<version>3.0.0.0</version>
<version>1.0.0</version>
<modules>
<module>api-modules/FactionsM</module>
@ -19,8 +19,8 @@
</modules>
<properties>
<plugin.version>3.0.0-SNAPSHOT-U33</plugin.version>
<plugin.name>CustomBosses</plugin.name>
<plugin.version>1.0.0-SNAPSHOT-U34</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>
</properties>