Merge branch 'development'

This commit is contained in:
Brianna 2020-03-19 20:08:00 -04:00
commit d54fc8cf85
21 changed files with 64 additions and 72 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,6 @@ import com.songoda.epicbosses.container.BossEntityContainer;
import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.utils.EntityFinder;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.Permission;
import com.songoda.epicbosses.utils.StringUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
@ -88,7 +87,7 @@ public class CommandCreate extends AbstractCommand {
@Override
public String getSyntax() {
return "create <[>name> <entity>";
return "create <name> <entity>";
}
@Override

View File

@ -3,7 +3,6 @@ package com.songoda.epicbosses.commands;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.epicbosses.managers.DebugManager;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.Permission;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -47,16 +46,16 @@ public class CommandDebug extends AbstractCommand {
@Override
public String getPermissionNode() {
return "boss.reload";
return "boss.debug";
}
@Override
public String getSyntax() {
return "reload";
return "debug";
}
@Override
public String getDescription() {
return "Reloads EpicBosses and its configurations.";
return "Toggles on and off the debug mode.";
}
}

View File

@ -105,7 +105,7 @@ public class CommandGiveEgg extends AbstractCommand {
@Override
public String getSyntax() {
return "giveegg <name> <player> [amount]";
return "give/giveegg <name> <player> [amount]";
}
@Override

View File

@ -39,7 +39,7 @@ public class CommandList extends AbstractCommand {
@Override
public String getSyntax() {
return "list";
return "list/show";
}
@Override

View File

@ -34,12 +34,12 @@ public class CommandMenu extends AbstractCommand {
@Override
public String getPermissionNode() {
return "menu";
return "boss.menu";
}
@Override
public String getSyntax() {
return null;
return "menu";
}
@Override

View File

@ -46,7 +46,7 @@ public class CommandShop extends AbstractCommand {
@Override
public String getSyntax() {
return "shop";
return "shop/buy/store";
}
@Override

View File

@ -39,7 +39,7 @@ public class CommandSkills extends AbstractCommand {
@Override
public String getSyntax() {
return "skills";
return "skills/skill";
}
@Override

View File

@ -111,12 +111,12 @@ public class ActiveBossHolder implements IActiveHolder {
.filter(e -> e.getValue() != null && e.getValue().getWorld().isChunkLoaded(
e.getValue().getLocation().getBlockX() >> 4,
e.getValue().getLocation().getBlockZ() >> 4))
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
// remove everything we can
toRemove.entrySet().stream().forEach(e -> {
e.getValue().remove();
livingEntityMap.remove(e.getKey());
toRemove.forEach((key, value) -> {
value.remove();
livingEntityMap.remove(key);
});
return true;

View File

@ -160,6 +160,7 @@ public class BossDeathListener implements Listener {
DeadBossHolder deadBossHolder = new DeadBossHolder(bossEntity, location, mapOfDamage, mapOfPercent);
BossDeathEvent bossDeathEvent = new BossDeathEvent(activeBossHolder, autoSpawn);
DropTable dropTable = this.bossEntityManager.getDropTable(bossEntity);
this.bossEntityManager.removeActiveBossHolder(activeBossHolder);
if (dropTable == null) {
Debug.FAILED_TO_FIND_DROP_TABLE.debug(activeBossHolder.getName(), bossEntity.getDrops().getDropTable());

View File

@ -13,9 +13,7 @@ import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
/**
@ -45,22 +43,25 @@ public class BossDamageListener implements Listener {
double damage = event.getDamage();
Player player = null;
if (activeBossHolder == null) {
if (activeBossHolder == null && livingEntity.getCustomName() != null) {
// Check to see if this was a boss and respawn it if so.
String convert = TextUtils.convertFromInvisibleString(livingEntity.getCustomName());
if (convert.startsWith("BOSS:")) {
String convert = livingEntity.getCustomName();
if (convert.toUpperCase().startsWith(TextUtils.convertToInvisibleString("BOSS:"))) {
String name = convert.split(":")[1];
BossEntity bossEntity = bossesFileManager.getBossEntity(name);
bossEntityManager.createActiveBossHolder(bossEntity, livingEntity.getLocation(), name, null);
if (bossEntity != null) {
bossEntityManager.createActiveBossHolder(bossEntity, livingEntity.getLocation(), name, null);
if (livingEntity.isInsideVehicle() && livingEntity.getVehicle() != null)
livingEntity.getVehicle().remove();
if (livingEntity.isInsideVehicle() && livingEntity.getVehicle() != null)
livingEntity.getVehicle().remove();
if (livingEntity.getPassenger() != null)
livingEntity.getPassenger().remove();
if (livingEntity.getPassenger() != null)
livingEntity.getPassenger().remove();
livingEntity.remove();
livingEntity.remove();
}
}
return;
}

View File

@ -3,10 +3,13 @@ package com.songoda.epicbosses.managers.files;
import com.songoda.epicbosses.EpicBosses;
import com.songoda.epicbosses.container.BossEntityContainer;
import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.entity.elements.EntityStatsElement;
import com.songoda.epicbosses.entity.elements.MainStatsElement;
import com.songoda.epicbosses.file.BossesFileHandler;
import com.songoda.epicbosses.utils.ILoadable;
import com.songoda.epicbosses.utils.IReloadable;
import com.songoda.epicbosses.utils.ISavable;
import com.songoda.epicbosses.utils.StringUtils;
import java.io.File;
import java.util.ArrayList;
@ -54,6 +57,15 @@ public class BossesFileManager implements ILoadable, ISavable, IReloadable {
}
public BossEntity getBossEntity(String name) {
for (Map.Entry<String, BossEntity> entry : this.bossEntityContainer.getData().entrySet()) {
for (EntityStatsElement entityStatsElement : entry.getValue().getEntityStats()) {
MainStatsElement mainStatsElement = entityStatsElement.getMainStats();
String customName = mainStatsElement.getDisplayName();
System.out.println(name + " : " + StringUtils.get().translateColor(customName));
if (StringUtils.get().translateColor(customName).equals(name))
return entry.getValue();
}
}
return this.bossEntityContainer.getData().getOrDefault(name, null);
}

View File

@ -10,6 +10,8 @@ import com.songoda.epicbosses.mechanics.IBossMechanic;
import com.songoda.epicbosses.utils.StringUtils;
import org.bukkit.entity.LivingEntity;
import java.util.Arrays;
/**
* @author Charles Cullen
* @version 1.0.0
@ -29,7 +31,7 @@ public class NameMechanic implements IBossMechanic {
if (livingEntity == null || customName == null) continue;
String formattedName = StringUtils.get().translateColor(customName);
livingEntity.setCustomName(TextUtils.convertToInvisibleString("BOSS:" + activeBossHolder.getName() + ":") + formattedName);
livingEntity.setCustomName(TextUtils.convertToInvisibleString("BOSS:") + formattedName);
livingEntity.setCustomNameVisible(true);
}

View File

@ -1,36 +0,0 @@
package com.songoda.epicbosses.utils;
import org.bukkit.command.CommandSender;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 04-Oct-18
*/
public enum Permission {
admin("boss.admin"),
create("boss.create"),
debug("boss.debug"),
edit("boss.edit"),
give("boss.give"),
help("boss.help"),
nearby("boss.nearby"),
reload("boss.reload"),
shop("boss.shop"),
time("boss.time");
private String permission;
Permission(String permission) {
this.permission = permission;
}
public boolean hasPermission(CommandSender commandSender) {
return commandSender.hasPermission(getPermission());
}
public String getPermission() {
return this.permission;
}
}

View File

@ -35,6 +35,16 @@ public class StringUtils {
return messages;
}
public String toNum(String s) {
StringBuilder t = new StringBuilder();
for (int i = 0; i < s.length(); ++i) {
char ch = s.charAt(i);
int n = (int)ch - (int)'a' + 1;
t.append(n);
}
return t.toString();
}
public String stripColor(String string) {
return ChatColor.stripColor(string);
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>EpicBosses</artifactId>
<groupId>com.songoda.epicbosses</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<groupId>com.songoda.epicbosses</groupId>
<artifactId>EpicBosses</artifactId>
<packaging>pom</packaging>
<version>1.2.9</version>
<version>1.2.10</version>
<modules>
<module>api-modules/FactionsM</module>
@ -16,7 +16,7 @@
</modules>
<properties>
<plugin.version>1.2.9</plugin.version>
<plugin.version>1.2.10</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.EpicBosses</plugin.main>
<plugin.author>Songoda</plugin.author>
@ -48,6 +48,10 @@
<id>private</id>
<url>http://repo.songoda.com/artifactory/private/</url>
</repository>
<repository>
<id>public</id>
<url>http://repo.songoda.com/artifactory/public/</url>
</repository>
</repositories>
<build>