1.5.6
This commit is contained in:
parent
8c75f6fd38
commit
1e6d0506f3
14 changed files with 395 additions and 6 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,7 +3,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = 'org.gsdistance'
|
||||
version = '1.5.5'
|
||||
version = '1.5.6'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -650,7 +650,7 @@ code + .copy-button {
|
|||
<script type="text/javascript">
|
||||
function configurationCacheProblems() { return (
|
||||
// begin-report-data
|
||||
{"diagnostics":[{"locations":[{}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.14.5/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('filteringCharset = <value>') instead."}]]},{"locations":[{"path":"/home/tyuxx/IdeaProjects/GrimmsServer/src/main/java/org/gsdistance/grimmsServer/Commands/MarketComand/BuyEnchantment.java"},{"taskPath":":compileJava"}],"problem":[{"text":"/home/tyuxx/IdeaProjects/GrimmsServer/src/main/java/org/gsdistance/grimmsServer/Commands/MarketComand/BuyEnchantment.java uses or overrides a deprecated API."}],"severity":"ADVICE","problemDetails":[{"text":"Note: /home/tyuxx/IdeaProjects/GrimmsServer/src/main/java/org/gsdistance/grimmsServer/Commands/MarketComand/BuyEnchantment.java uses or overrides a deprecated API."}],"contextualLabel":"/home/tyuxx/IdeaProjects/GrimmsServer/src/main/java/org/gsdistance/grimmsServer/Commands/MarketComand/BuyEnchantment.java uses or overrides a deprecated API.","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler.note.deprecated.filename","displayName":"/home/tyuxx/IdeaProjects/GrimmsServer/src/main/java/org/gsdistance/grimmsServer/Commands/MarketComand/BuyEnchantment.java uses or overrides a deprecated API."}]},{"locations":[{"path":"/home/tyuxx/IdeaProjects/GrimmsServer/src/main/java/org/gsdistance/grimmsServer/Commands/MarketComand/BuyEnchantment.java"},{"taskPath":":compileJava"}],"problem":[{"text":"Recompile with -Xlint:deprecation for details."}],"severity":"ADVICE","problemDetails":[{"text":"Note: Recompile with -Xlint:deprecation for details."}],"contextualLabel":"Recompile with -Xlint:deprecation for details.","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler.note.deprecated.recompile","displayName":"Recompile with -Xlint:deprecation for details."}]}],"problemsReport":{"totalProblemCount":3,"buildName":"GrimmsServer","requestedTasks":"build","documentationLink":"https://docs.gradle.org/8.14.5/userguide/reporting_problems.html","documentationLinkCaption":"Problem report","summaries":[]}}
|
||||
{"diagnostics":[{"locations":[{}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.14.5/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('filteringCharset = <value>') instead."}]]}],"problemsReport":{"totalProblemCount":1,"buildName":"GrimmsServer","requestedTasks":"build","documentationLink":"https://docs.gradle.org/8.14.5/userguide/reporting_problems.html","documentationLinkCaption":"Problem report","summaries":[]}}
|
||||
// end-report-data
|
||||
);}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -93,6 +93,21 @@ public class GUtilBaseCommand implements CommandExecutor {
|
|||
case "removetitle" -> {
|
||||
return RemoveTitle.subCommand(sender, args);
|
||||
}
|
||||
case "unlevelentity" -> {
|
||||
if (sender instanceof Player player) {
|
||||
return UnlevelEntity.subCommand(player, args);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case "levelentity" -> {
|
||||
if (sender instanceof Player player) {
|
||||
return LevelEntity.subCommand(player, args);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case "sudo" -> {
|
||||
return Sudo.subCommand(sender, args);
|
||||
}
|
||||
default -> {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.gsdistance.grimmsServer.Commands.GUtilCommand;
|
|||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
|
@ -11,6 +12,7 @@ import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -18,11 +20,43 @@ import java.util.stream.Stream;
|
|||
|
||||
public class GUtilTabCompleter implements TabCompleter {
|
||||
public static final List<String> defSubCommands = List.of("version", "setting", "spawn");
|
||||
public static final List<String> adminSubCommands = List.of("relic", "capability", "broadcast", "inventoryrestore", "fly", "god", "heal", "speed", "enderchest", "invsee", "addtitle", "removetitle");
|
||||
public static final List<String> adminSubCommands = List.of("relic", "capability", "broadcast", "inventoryrestore", "fly", "god", "heal", "speed", "enderchest", "invsee", "addtitle", "removetitle", "unlevelentity", "sudo", "levelentity");
|
||||
|
||||
public GUtilTabCompleter() {
|
||||
}
|
||||
|
||||
private CommandMap getCommandMap() {
|
||||
try {
|
||||
Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
commandMapField.setAccessible(true);
|
||||
return (CommandMap) commandMapField.get(Bukkit.getServer());
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new RuntimeException("Failed to get command map", e);
|
||||
}
|
||||
}
|
||||
|
||||
private TabCompleter getTabCompleter(Command command) {
|
||||
try {
|
||||
Field tabCompleterField = command.getClass().getDeclaredField("tabCompleter");
|
||||
tabCompleterField.setAccessible(true);
|
||||
return (TabCompleter) tabCompleterField.get(command);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private java.util.Map<String, Command> getKnownCommands(CommandMap commandMap) {
|
||||
try {
|
||||
Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands");
|
||||
knownCommandsField.setAccessible(true);
|
||||
@SuppressWarnings("unchecked")
|
||||
java.util.Map<String, Command> knownCommands = (java.util.Map<String, Command>) knownCommandsField.get(commandMap);
|
||||
return knownCommands;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
return new java.util.HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
List<String> subCommands = new ArrayList<>();
|
||||
|
|
@ -45,7 +79,7 @@ public class GUtilTabCompleter implements TabCompleter {
|
|||
case "setting" -> {
|
||||
return PlayerMetadata.getPlayerMetadata(player).settings.stream().toList();
|
||||
}
|
||||
case "inventoryrestore", "heal", "spawn", "enderchest", "invsee", "addtitle", "removetitle" -> {
|
||||
case "inventoryrestore", "heal", "spawn", "enderchest", "invsee", "addtitle", "removetitle", "sudo", "unlevelentity", "levelentity" -> {
|
||||
return Bukkit.getOnlinePlayers().stream()
|
||||
.map(Player::getName)
|
||||
.filter(name -> name.toLowerCase().startsWith(args[1].toLowerCase()))
|
||||
|
|
@ -106,10 +140,29 @@ public class GUtilTabCompleter implements TabCompleter {
|
|||
}
|
||||
return List.of();
|
||||
}
|
||||
case "sudo" -> {
|
||||
return getKnownCommands(getCommandMap()).keySet().stream()
|
||||
.filter(cmd -> cmd.startsWith(args[2].toLowerCase()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
default -> {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
} else if (args.length >= 3 && args[0].equalsIgnoreCase("sudo")) {
|
||||
// Handle nested tab completion for sudo command
|
||||
String commandName = args[2];
|
||||
org.bukkit.command.Command targetCommand = getCommandMap().getCommand(commandName);
|
||||
if (targetCommand != null) {
|
||||
TabCompleter tabCompleter = getTabCompleter(targetCommand);
|
||||
if (tabCompleter != null) {
|
||||
// Build the args array for the target command
|
||||
String[] targetArgs = new String[args.length - 3];
|
||||
System.arraycopy(args, 3, targetArgs, 0, targetArgs.length);
|
||||
return tabCompleter.onTabComplete(sender, targetCommand, commandName, targetArgs);
|
||||
}
|
||||
}
|
||||
return List.of();
|
||||
} else {
|
||||
return List.of();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GUtilCommand;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
import org.gsdistance.grimmsServer.Constructable.Entity.EntityMetadata;
|
||||
import org.gsdistance.grimmsServer.Manage.CustomEntityManager;
|
||||
|
||||
public class LevelEntity {
|
||||
public LevelEntity() {
|
||||
}
|
||||
|
||||
public static boolean subCommand(CommandSender sender, String[] args) {
|
||||
if (!sender.hasPermission("grimmsserver.util.admin")) {
|
||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length < 2) {
|
||||
// Force leveling on entity player is looking at
|
||||
RayTraceResult rayTrace = player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), 5);
|
||||
Entity targetEntity = rayTrace != null ? rayTrace.getHitEntity() : null;
|
||||
if (targetEntity == null) {
|
||||
sender.sendMessage(ChatColor.RED + "No entity found in range (5 blocks). Specify an entity UUID or look at an entity.");
|
||||
return false;
|
||||
}
|
||||
return applyLeveling(sender, targetEntity);
|
||||
} else {
|
||||
// Force leveling by UUID
|
||||
try {
|
||||
java.util.UUID uuid = java.util.UUID.fromString(args[1]);
|
||||
Entity targetEntity = null;
|
||||
for (Entity entity : player.getWorld().getEntities()) {
|
||||
if (entity.getUniqueId().equals(uuid)) {
|
||||
targetEntity = entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (targetEntity == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Entity with UUID " + args[1] + " not found in current world.");
|
||||
return false;
|
||||
}
|
||||
return applyLeveling(sender, targetEntity);
|
||||
} catch (IllegalArgumentException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid UUID format: " + args[1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You must be a player to use this command.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean applyLeveling(CommandSender sender, Entity entity) {
|
||||
// Register entity in the registry
|
||||
CustomEntityManager.registerEntity(entity);
|
||||
|
||||
// Get or create metadata and apply leveling
|
||||
EntityMetadata metadata = EntityMetadata.getEntityMetadata(entity);
|
||||
|
||||
if (entity instanceof LivingEntity livingEntity) {
|
||||
// Force re-apply leveling even if already leveled
|
||||
if (metadata.level > 1 || metadata.prestige > 1) {
|
||||
// Re-apply to refresh stats
|
||||
try {
|
||||
java.lang.reflect.Method applyLevelling = EntityMetadata.class.getDeclaredMethod("applyLevelling", LivingEntity.class, EntityMetadata.class);
|
||||
applyLevelling.setAccessible(true);
|
||||
applyLevelling.invoke(null, livingEntity, metadata);
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Warning: Could not re-apply leveling via reflection.");
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Forced leveling on entity: " + entity.getType().name() + " (Level: " + metadata.level + ", Prestige: " + metadata.prestige + ")");
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Entity registered but not a LivingEntity (no leveling applied).");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GUtilCommand;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Sudo {
|
||||
public Sudo() {
|
||||
}
|
||||
|
||||
public static boolean subCommand(CommandSender sender, String[] args) {
|
||||
if (!sender.hasPermission("grimmsserver.util.admin")) {
|
||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length < 3) {
|
||||
sender.sendMessage(ChatColor.RED + "Usage: /gutil sudo <player> <command>");
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = Bukkit.getPlayer(args[1]);
|
||||
if (target == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Player '" + args[1] + "' not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
StringBuilder commandBuilder = new StringBuilder();
|
||||
for (int i = 2; i < args.length; i++) {
|
||||
commandBuilder.append(args[i]);
|
||||
if (i < args.length - 1) {
|
||||
commandBuilder.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
String command = commandBuilder.toString();
|
||||
|
||||
try {
|
||||
boolean success = target.performCommand(command);
|
||||
if (success) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Made " + target.getName() + " execute: /" + command);
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "Failed to make " + target.getName() + " execute: /" + command);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.RED + "Error executing command: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package org.gsdistance.grimmsServer.Commands.GUtilCommand;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
import org.gsdistance.grimmsServer.Constructable.Entity.EntityMetadata;
|
||||
import org.gsdistance.grimmsServer.Manage.CustomEntityManager;
|
||||
|
||||
public class UnlevelEntity {
|
||||
public UnlevelEntity() {
|
||||
}
|
||||
|
||||
public static boolean subCommand(CommandSender sender, String[] args) {
|
||||
if (!sender.hasPermission("grimmsserver.util.admin")) {
|
||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length < 2) {
|
||||
// Remove leveling from entity player is looking at
|
||||
RayTraceResult rayTrace = player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), 5);
|
||||
Entity targetEntity = rayTrace != null ? rayTrace.getHitEntity() : null;
|
||||
if (targetEntity == null) {
|
||||
sender.sendMessage(ChatColor.RED + "No entity found in range (5 blocks). Specify an entity UUID or look at an entity.");
|
||||
return false;
|
||||
}
|
||||
return removeLeveling(sender, targetEntity);
|
||||
} else {
|
||||
// Remove leveling by UUID
|
||||
try {
|
||||
java.util.UUID uuid = java.util.UUID.fromString(args[1]);
|
||||
Entity targetEntity = null;
|
||||
for (Entity entity : player.getWorld().getEntities()) {
|
||||
if (entity.getUniqueId().equals(uuid)) {
|
||||
targetEntity = entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (targetEntity == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Entity with UUID " + args[1] + " not found in current world.");
|
||||
return false;
|
||||
}
|
||||
return removeLeveling(sender, targetEntity);
|
||||
} catch (IllegalArgumentException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid UUID format: " + args[1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "You must be a player to use this command.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean removeLeveling(CommandSender sender, Entity entity) {
|
||||
// Remove from registry
|
||||
CustomEntityManager.unregisterEntity(entity);
|
||||
|
||||
// Remove metadata file
|
||||
try {
|
||||
java.io.File metadataFile = new java.io.File(
|
||||
org.gsdistance.grimmsServer.GrimmsServer.instance.getDataFolder(),
|
||||
"entityMetadata/" + entity.getUniqueId() + ".json"
|
||||
);
|
||||
if (metadataFile.exists()) {
|
||||
metadataFile.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.YELLOW + "Warning: Could not delete metadata file.");
|
||||
}
|
||||
|
||||
// Remove from session storage
|
||||
org.gsdistance.grimmsServer.Data.PerSessionDataStorage.dataStore.remove("entityMetadata-" + entity.getUniqueId());
|
||||
|
||||
// Reset entity stats if it's a living entity
|
||||
if (entity instanceof LivingEntity livingEntity) {
|
||||
// Reset attributes to default values
|
||||
if (livingEntity.getAttribute(Attribute.MAX_HEALTH) != null) {
|
||||
livingEntity.getAttribute(Attribute.MAX_HEALTH).setBaseValue(livingEntity.getAttribute(Attribute.MAX_HEALTH).getDefaultValue());
|
||||
livingEntity.setHealth(livingEntity.getAttribute(Attribute.MAX_HEALTH).getValue());
|
||||
}
|
||||
if (livingEntity.getAttribute(Attribute.ARMOR) != null) {
|
||||
livingEntity.getAttribute(Attribute.ARMOR).setBaseValue(livingEntity.getAttribute(Attribute.ARMOR).getDefaultValue());
|
||||
}
|
||||
if (livingEntity.getAttribute(Attribute.ARMOR_TOUGHNESS) != null) {
|
||||
livingEntity.getAttribute(Attribute.ARMOR_TOUGHNESS).setBaseValue(livingEntity.getAttribute(Attribute.ARMOR_TOUGHNESS).getDefaultValue());
|
||||
}
|
||||
if (livingEntity.getAttribute(Attribute.ATTACK_DAMAGE) != null) {
|
||||
livingEntity.getAttribute(Attribute.ATTACK_DAMAGE).setBaseValue(livingEntity.getAttribute(Attribute.ATTACK_DAMAGE).getDefaultValue());
|
||||
}
|
||||
|
||||
// Reset custom name
|
||||
EntityMetadata metadata = EntityMetadata.getEntityMetadata(entity);
|
||||
if (metadata != null && metadata.originalName != null) {
|
||||
livingEntity.setCustomName(metadata.originalName);
|
||||
} else {
|
||||
livingEntity.setCustomName(null);
|
||||
}
|
||||
livingEntity.setCustomNameVisible(false);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Removed leveling from entity: " + entity.getType().name() + " (" + entity.getUniqueId() + ")");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
|||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Config.ActiveConfig;
|
||||
|
|
@ -64,7 +65,7 @@ public class EntityMetadata {
|
|||
GrimmsServer.logger.info("Created new EntityMetadata for " + entity.getUniqueId());
|
||||
}
|
||||
// Apply levelling when metadata is first created
|
||||
if (entity instanceof LivingEntity) {
|
||||
if (entity instanceof LivingEntity && entity.getType() != EntityType.PLAYER) {
|
||||
applyLevelling((LivingEntity) entity, metadata);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -154,6 +155,11 @@ public class EntityMetadata {
|
|||
livingEntity.getAttribute(Attribute.ARMOR).setBaseValue(armorBoost);
|
||||
}
|
||||
|
||||
if (livingEntity.getAttribute(Attribute.ARMOR_TOUGHNESS) != null) {
|
||||
double toughnessBoost = Math.cbrt(finalLevel) * Math.cbrt(totalPrestige);
|
||||
livingEntity.getAttribute(Attribute.ARMOR_TOUGHNESS).setBaseValue(toughnessBoost);
|
||||
}
|
||||
|
||||
if (livingEntity.getAttribute(Attribute.ATTACK_DAMAGE) != null) {
|
||||
double damageBoost = Math.cbrt(finalLevel) * Math.sqrt(totalPrestige);
|
||||
livingEntity.getAttribute(Attribute.ATTACK_DAMAGE).setBaseValue(
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public class PlayerTitles {
|
|||
for (Map.Entry<Long, String> entry : TitleGenerator.getAllKillTitles().entrySet()) {
|
||||
titles.put(entry.getKey().toString(), entry.getValue());
|
||||
}
|
||||
// Add descriptions for dynamic titles
|
||||
titles.putAll(TitleGenerator.getAllTitleDescriptions());
|
||||
}
|
||||
|
||||
public Set<String> getTitles() {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ public class TitleGenerator {
|
|||
private static final Map<String, String> moneyTitles = new HashMap<>();
|
||||
private static final Map<Long, String> blockBreakTitles = new HashMap<>();
|
||||
private static final Map<Long, String> killTitles = new HashMap<>();
|
||||
private static final Map<String, String> titleDescriptions = new HashMap<>();
|
||||
|
||||
static {
|
||||
// Money titles (powers of 10)
|
||||
|
|
@ -52,7 +53,7 @@ public class TitleGenerator {
|
|||
killTitles.put(10L, "Novice Hunter");
|
||||
killTitles.put(100L, "Hunter");
|
||||
killTitles.put(1000L, "Slayer");
|
||||
killTitles.put(10000L, "Executioner");
|
||||
killTitles.put(10000L, "Executioneer");
|
||||
killTitles.put(100000L, "Destroyer");
|
||||
killTitles.put(1000000L, "Godslayer");
|
||||
killTitles.put(10000000L, "World Ender");
|
||||
|
|
@ -64,6 +65,60 @@ public class TitleGenerator {
|
|||
killTitles.put(10000000000000L, "Reality Destroyer");
|
||||
killTitles.put(100000000000000L, "Void Consumer");
|
||||
killTitles.put(1000000000000000L, "Oblivion");
|
||||
|
||||
// Money title descriptions
|
||||
titleDescriptions.put("Pocket Change", "A small amount of money, but it's a start.");
|
||||
titleDescriptions.put("Coin Collector", "Starting to accumulate some wealth.");
|
||||
titleDescriptions.put("Wealthy", "You have a respectable amount of money.");
|
||||
titleDescriptions.put("Rich", "Money is no longer a concern for you.");
|
||||
titleDescriptions.put("Affluent", "You live a life of luxury and comfort.");
|
||||
titleDescriptions.put("Millionaire", "You've reached the first major milestone of wealth.");
|
||||
titleDescriptions.put("Multi-Millionaire", "Your wealth continues to grow exponentially.");
|
||||
titleDescriptions.put("Hundred-Millionaire", "You're among the wealthiest individuals.");
|
||||
titleDescriptions.put("Billionaire", "You've achieved extraordinary financial success.");
|
||||
titleDescriptions.put("Multi-Billionaire", "Your influence and wealth are immense.");
|
||||
titleDescriptions.put("Hundred-Billionaire", "You control vast economic resources.");
|
||||
titleDescriptions.put("Trillionaire", "Wealth beyond imagination.");
|
||||
titleDescriptions.put("Multi-Trillionaire", "Economic power on a global scale.");
|
||||
titleDescriptions.put("Hundred-Trillionaire", "Your wealth rivals entire nations.");
|
||||
titleDescriptions.put("Quadrillionaire", "Unprecedented accumulation of resources.");
|
||||
titleDescriptions.put("Multi-Quadrillionaire", "Wealth that defies comprehension.");
|
||||
titleDescriptions.put("Hundred-Quadrillionaire", "You possess more than can be counted.");
|
||||
titleDescriptions.put("Quintillionaire", "The pinnacle of financial achievement.");
|
||||
|
||||
// Block break title descriptions
|
||||
titleDescriptions.put("Novice Miner", "Just starting to break blocks.");
|
||||
titleDescriptions.put("Apprentice Miner", "Learning the ways of the mine.");
|
||||
titleDescriptions.put("Miner", "A dedicated worker in the mines.");
|
||||
titleDescriptions.put("Stone Breaker", "You've broken through many obstacles.");
|
||||
titleDescriptions.put("Master Miner", "Your mining skills are exceptional.");
|
||||
titleDescriptions.put("Legendary Miner", "Your mining prowess is the stuff of legends.");
|
||||
titleDescriptions.put("Earth Shatterer", "You've broken through the earth itself.");
|
||||
titleDescriptions.put("World Digger", "You've dug through entire worlds.");
|
||||
titleDescriptions.put("Void Miner", "You mine where others cannot reach.");
|
||||
titleDescriptions.put("Dimension Breaker", "You break through dimensional barriers.");
|
||||
titleDescriptions.put("Reality Shatterer", "Your mining transcends reality.");
|
||||
titleDescriptions.put("Universe Digger", "You've dug through the fabric of the universe.");
|
||||
titleDescriptions.put("Cosmic Miner", "You mine among the stars themselves.");
|
||||
titleDescriptions.put("Galaxy Breaker", "You break through entire galaxies.");
|
||||
titleDescriptions.put("Universal Miner", "You mine across all of existence.");
|
||||
|
||||
// Kill title descriptions
|
||||
titleDescriptions.put("Novice Hunter", "Just starting your hunting journey.");
|
||||
titleDescriptions.put("Hunter", "You've proven yourself as a capable hunter.");
|
||||
titleDescriptions.put("Slayer", "You've slain many foes in battle.");
|
||||
titleDescriptions.put("Executioneer", "You deliver final judgment to your enemies.");
|
||||
titleDescriptions.put("Destroyer", "You leave nothing but destruction in your wake.");
|
||||
titleDescriptions.put("Godslayer", "You've defeated beings of immense power.");
|
||||
titleDescriptions.put("World Ender", "You've brought about the end of worlds.");
|
||||
titleDescriptions.put("Mass Murderer", "Your kill count is truly staggering.");
|
||||
titleDescriptions.put("Genocidal", "You've eliminated entire populations.");
|
||||
titleDescriptions.put("Apocalypse Bringer", "You are the harbinger of doom.");
|
||||
titleDescriptions.put("Extinction Event", "You've caused the extinction of species.");
|
||||
titleDescriptions.put("Universe Ender", "You've ended entire universes.");
|
||||
titleDescriptions.put("Reality Destroyer", "You've torn apart the fabric of reality.");
|
||||
titleDescriptions.put("Void Consumer", "You consume all in your path, even the void.");
|
||||
titleDescriptions.put("Oblivion", "You are the end of all things.");
|
||||
}
|
||||
|
||||
public static List<String> getMoneyTitles(double money) {
|
||||
|
|
@ -111,4 +166,12 @@ public class TitleGenerator {
|
|||
public static Map<Long, String> getAllKillTitles() {
|
||||
return new HashMap<>(killTitles);
|
||||
}
|
||||
|
||||
public static Map<String, String> getAllTitleDescriptions() {
|
||||
return new HashMap<>(titleDescriptions);
|
||||
}
|
||||
|
||||
public static String getTitleDescription(String title) {
|
||||
return titleDescriptions.get(title);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue