1.5r3 p1
This commit is contained in:
parent
5856a07c63
commit
45678728e6
26 changed files with 125 additions and 14 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -3,7 +3,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'org.gsdistance'
|
group = 'org.gsdistance'
|
||||||
version = '1.5r2'
|
version = '1.5r3'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
build/libs/GrimmsServer-1.5r3.jar
Normal file
BIN
build/libs/GrimmsServer-1.5r3.jar
Normal file
Binary file not shown.
|
|
@ -4,7 +4,7 @@ description: A spigot plugin made by Grimm and tyuXX, it adds player leveling, a
|
||||||
website: www.gsdistance.org
|
website: www.gsdistance.org
|
||||||
prefix: Grimm's
|
prefix: Grimm's
|
||||||
main: org.gsdistance.grimmsServer.GrimmsServer
|
main: org.gsdistance.grimmsServer.GrimmsServer
|
||||||
version: 1.5r2
|
version: 1.5r3
|
||||||
api-version: 1.20
|
api-version: 1.20
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
commands:
|
commands:
|
||||||
|
|
@ -95,6 +95,10 @@ commands:
|
||||||
description: Manage player decorations - set or clear decorative titles
|
description: Manage player decorations - set or clear decorative titles
|
||||||
usage: /gDeco <setdecotitle|cleardecotitle>
|
usage: /gDeco <setdecotitle|cleardecotitle>
|
||||||
permission: grimmsserver.gdeco
|
permission: grimmsserver.gdeco
|
||||||
|
gLevel:
|
||||||
|
description: Manage player level and prestige
|
||||||
|
usage: /gLevel <prestige>
|
||||||
|
permission: grimmsserver.glevel
|
||||||
permissions:
|
permissions:
|
||||||
grimmsserver.sendMoney:
|
grimmsserver.sendMoney:
|
||||||
description: Allows sending money to other players from your balance
|
description: Allows sending money to other players from your balance
|
||||||
|
|
@ -180,3 +184,6 @@ permissions:
|
||||||
grimmsserver.gdeco:
|
grimmsserver.gdeco:
|
||||||
description: Allows using player decoration options
|
description: Allows using player decoration options
|
||||||
default: true
|
default: true
|
||||||
|
grimmsserver.glevel:
|
||||||
|
description: Allows using player level and prestige commands
|
||||||
|
default: true
|
||||||
Binary file not shown.
|
|
@ -23,6 +23,7 @@ public class GDecoBaseCommand implements CommandExecutor {
|
||||||
yield SelectTitle.subCommand(player, args[1]);
|
yield SelectTitle.subCommand(player, args[1]);
|
||||||
}
|
}
|
||||||
case "cleartitle" -> SelectTitle.subCommand(player, "");
|
case "cleartitle" -> SelectTitle.subCommand(player, "");
|
||||||
|
case "toggleprestigedeco" -> TogglePrestigeDeco.subCommand(player);
|
||||||
default -> false;
|
default -> false;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GDecoTabCompleter implements TabCompleter {
|
public class GDecoTabCompleter implements TabCompleter {
|
||||||
public static final List<String> subCommands = List.of("selectTitle", "clearTitle");
|
public static final List<String> subCommands = List.of("selectTitle", "clearTitle", "togglePrestigeDeco");
|
||||||
|
|
||||||
public GDecoTabCompleter() {
|
public GDecoTabCompleter() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.gsdistance.grimmsServer.Commands.GDecoCommand;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.gsdistance.grimmsServer.Constructable.Player.PlayerMetadata;
|
||||||
|
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||||
|
|
||||||
|
public class TogglePrestigeDeco {
|
||||||
|
public static boolean subCommand(Player player) {
|
||||||
|
PlayerMetadata metadata = PlayerMetadata.getPlayerMetadata(player);
|
||||||
|
PlayerStats playerStats = PlayerStats.getPlayerStats(player);
|
||||||
|
|
||||||
|
int prestige = playerStats.getStat("prestige", Integer.class);
|
||||||
|
|
||||||
|
if (prestige == 0) {
|
||||||
|
player.sendMessage(ChatColor.RED + "You must have at least prestige 1 to use the prestige decoration.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata.showPrestigeDeco = !metadata.showPrestigeDeco;
|
||||||
|
metadata.saveToPDS();
|
||||||
|
|
||||||
|
if (metadata.showPrestigeDeco) {
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Prestige decoration enabled. Your chat messages will show [" + prestige + "] in dark purple.");
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Prestige decoration disabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,30 @@
|
||||||
package org.gsdistance.grimmsServer.Commands.GLevelCommand;
|
package org.gsdistance.grimmsServer.Commands.GLevelCommand;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class GLevelBaseCommand implements CommandExecutor {
|
public class GLevelBaseCommand implements CommandExecutor {
|
||||||
public GLevelBaseCommand() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Usage: /gLevel <prestige>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (args[0].toLowerCase()) {
|
||||||
|
case "prestige":
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command can only be used by players.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Prestige.subCommand((Player) sender);
|
||||||
|
default:
|
||||||
|
sender.sendMessage(ChatColor.RED + "Unknown subcommand. Usage: /gLevel <prestige>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,12 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GLevelTabCompleter implements TabCompleter {
|
public class GLevelTabCompleter implements TabCompleter {
|
||||||
public GLevelTabCompleter() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
|
||||||
|
if (strings.length == 1) {
|
||||||
|
return List.of("prestige");
|
||||||
|
}
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,39 @@
|
||||||
package org.gsdistance.grimmsServer.Commands.GLevelCommand;
|
package org.gsdistance.grimmsServer.Commands.GLevelCommand;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.gsdistance.grimmsServer.Constructable.Player.PlayerLevelHandler;
|
||||||
|
import org.gsdistance.grimmsServer.Manage.GeneralChatHandler;
|
||||||
|
import org.gsdistance.grimmsServer.Shared;
|
||||||
|
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||||
|
|
||||||
public class Prestige {
|
public class Prestige {
|
||||||
public static boolean subCommand(Player player) {
|
public static boolean subCommand(Player player) {
|
||||||
|
PlayerStats playerStats = PlayerStats.getPlayerStats(player);
|
||||||
|
PlayerLevelHandler levelHandler = PlayerLevelHandler.getLevelHandler(player);
|
||||||
|
|
||||||
|
int currentLevel = levelHandler.getLevel();
|
||||||
|
int currentPrestige = playerStats.getStat("prestige", Integer.class);
|
||||||
|
long requiredLevel = (currentPrestige + 1) * 15L;
|
||||||
|
|
||||||
|
if (currentLevel <= requiredLevel) {
|
||||||
|
player.sendMessage(ChatColor.RED + "You must be at least level " + requiredLevel + " to prestige.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int newPrestige = currentPrestige + 1;
|
||||||
|
long currentPrestigePoints = playerStats.getStat("prestigePoints", Long.class);
|
||||||
|
|
||||||
|
playerStats.setStat("prestige", newPrestige);
|
||||||
|
playerStats.setStat("prestigePoints", currentPrestigePoints + newPrestige);
|
||||||
|
playerStats.setStat("level", 0);
|
||||||
|
playerStats.setStat("xp", 0.0);
|
||||||
|
playerStats.setStat("xp_required", levelHandler.getXpToLevel());
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GREEN + "You have prestiged to prestige " + newPrestige + "!");
|
||||||
|
player.sendMessage(ChatColor.GOLD + "You received " + newPrestige + " prestige points. Total: " + (currentPrestigePoints + newPrestige));
|
||||||
|
Shared.Broadcast(ChatColor.DARK_PURPLE + "[" + player.getName() + "] has prestiged to " + newPrestige + "!", null);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ public class Market {
|
||||||
for (Enchantment e : enchantments.keySet()) {
|
for (Enchantment e : enchantments.keySet()) {
|
||||||
Double enchantValue = EnchantBaseValues.enchantBaseValues.get(e);
|
Double enchantValue = EnchantBaseValues.enchantBaseValues.get(e);
|
||||||
if (enchantValue != null) {
|
if (enchantValue != null) {
|
||||||
rt += enchantValue * (double) enchantments.get(e);
|
rt += enchantValue * Math.sqrt(enchantments.get(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ public class PlayerMetadata {
|
||||||
public List<String> settings;
|
public List<String> settings;
|
||||||
public String decoTitle;
|
public String decoTitle;
|
||||||
public boolean factionChatEnabled = false;
|
public boolean factionChatEnabled = false;
|
||||||
|
public boolean showPrestigeDeco = false;
|
||||||
|
|
||||||
public PlayerMetadata(Player player) {
|
public PlayerMetadata(Player player) {
|
||||||
this.rank = PlayerRank.DEFAULT;
|
this.rank = PlayerRank.DEFAULT;
|
||||||
|
|
@ -63,7 +64,6 @@ public class PlayerMetadata {
|
||||||
if (this.settings == null) {
|
if (this.settings == null) {
|
||||||
this.settings = new ArrayList<>();
|
this.settings = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logMetadata() {
|
public void logMetadata() {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import org.gsdistance.grimmsServer.Commands.GConfigCommand.GConfigBaseCommand;
|
||||||
import org.gsdistance.grimmsServer.Commands.GConfigCommand.GConfigTabCompleter;
|
import org.gsdistance.grimmsServer.Commands.GConfigCommand.GConfigTabCompleter;
|
||||||
import org.gsdistance.grimmsServer.Commands.GDecoCommand.GDecoBaseCommand;
|
import org.gsdistance.grimmsServer.Commands.GDecoCommand.GDecoBaseCommand;
|
||||||
import org.gsdistance.grimmsServer.Commands.GDecoCommand.GDecoTabCompleter;
|
import org.gsdistance.grimmsServer.Commands.GDecoCommand.GDecoTabCompleter;
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GLevelCommand.GLevelBaseCommand;
|
||||||
|
import org.gsdistance.grimmsServer.Commands.GLevelCommand.GLevelTabCompleter;
|
||||||
import org.gsdistance.grimmsServer.Commands.GDimensionCommand.GDimBaseCommand;
|
import org.gsdistance.grimmsServer.Commands.GDimensionCommand.GDimBaseCommand;
|
||||||
import org.gsdistance.grimmsServer.Commands.GDimensionCommand.GDimTabCompleter;
|
import org.gsdistance.grimmsServer.Commands.GDimensionCommand.GDimTabCompleter;
|
||||||
import org.gsdistance.grimmsServer.Commands.GFactionCommand.GFactionBaseCommand;
|
import org.gsdistance.grimmsServer.Commands.GFactionCommand.GFactionBaseCommand;
|
||||||
|
|
@ -119,6 +121,11 @@ public class CommandRegistry {
|
||||||
gDecoCmd.setExecutor(new GDecoBaseCommand());
|
gDecoCmd.setExecutor(new GDecoBaseCommand());
|
||||||
gDecoCmd.setTabCompleter(new GDecoTabCompleter());
|
gDecoCmd.setTabCompleter(new GDecoTabCompleter());
|
||||||
}
|
}
|
||||||
|
PluginCommand gLevelCmd = GrimmsServer.instance.getCommand("gLevel");
|
||||||
|
if (gLevelCmd != null) {
|
||||||
|
gLevelCmd.setExecutor(new GLevelBaseCommand());
|
||||||
|
gLevelCmd.setTabCompleter(new GLevelTabCompleter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean CanExecute(String command, Player player) {
|
public static boolean CanExecute(String command, Player player) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gsdistance.grimmsServer.Manage;
|
package org.gsdistance.grimmsServer.Manage;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.gsdistance.grimmsServer.Config.ActiveConfig;
|
import org.gsdistance.grimmsServer.Config.ActiveConfig;
|
||||||
|
|
@ -38,6 +39,7 @@ public class GeneralChatHandler {
|
||||||
|
|
||||||
public static String handleMessage(String message, Player player) {
|
public static String handleMessage(String message, Player player) {
|
||||||
PlayerMetadata metadata = PlayerMetadata.getPlayerMetadata(player);
|
PlayerMetadata metadata = PlayerMetadata.getPlayerMetadata(player);
|
||||||
|
PlayerStats playerStats = PlayerStats.getPlayerStats(player);
|
||||||
String nickname = metadata != null ? metadata.nickname : player.getName();
|
String nickname = metadata != null ? metadata.nickname : player.getName();
|
||||||
|
|
||||||
// Optimized: Don't fetch metadata twice
|
// Optimized: Don't fetch metadata twice
|
||||||
|
|
@ -45,6 +47,12 @@ public class GeneralChatHandler {
|
||||||
nickname = "(" + metadata.decoTitle + ") " + nickname;
|
nickname = "(" + metadata.decoTitle + ") " + nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int prestige = playerStats.getStat("prestige", Integer.class);
|
||||||
|
|
||||||
|
if (metadata != null && metadata.showPrestigeDeco && prestige > 0) {
|
||||||
|
nickname = ChatColor.DARK_PURPLE + "[" + prestige + "] " + ChatColor.RESET + nickname;
|
||||||
|
}
|
||||||
|
|
||||||
if (metadata != null) {
|
if (metadata != null) {
|
||||||
Faction faction = Faction.getFaction(metadata.factionUUID);
|
Faction faction = Faction.getFaction(metadata.factionUUID);
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,8 @@ public class PlayerStats {
|
||||||
Stats.put("jobTitle", PersistentDataType.STRING);
|
Stats.put("jobTitle", PersistentDataType.STRING);
|
||||||
Stats.put("pass", PersistentDataType.STRING);
|
Stats.put("pass", PersistentDataType.STRING);
|
||||||
Stats.put("autologin", PersistentDataType.BOOLEAN);
|
Stats.put("autologin", PersistentDataType.BOOLEAN);
|
||||||
|
Stats.put("prestige", PersistentDataType.INTEGER);
|
||||||
|
Stats.put("prestigePoints", PersistentDataType.LONG);
|
||||||
StatNames = new Hashtable();
|
StatNames = new Hashtable();
|
||||||
StatNames.put("death_count", "Death Count");
|
StatNames.put("death_count", "Death Count");
|
||||||
StatNames.put("money", "Money");
|
StatNames.put("money", "Money");
|
||||||
|
|
@ -127,7 +129,9 @@ public class PlayerStats {
|
||||||
StatNames.put("jobTitle", "Job");
|
StatNames.put("jobTitle", "Job");
|
||||||
StatNames.put("pass", "Password");
|
StatNames.put("pass", "Password");
|
||||||
StatNames.put("autologin", "Login Automatically");
|
StatNames.put("autologin", "Login Automatically");
|
||||||
StatOrder = List.of("death_count", "money", "total_kill_count", "join_count", "tPoint", "block_break_count", "sent_messages", "level", "xp", "xp_required", "intelligence", "jobTitle");
|
StatNames.put("prestige", "Prestige");
|
||||||
StatDefaultValues = Map.ofEntries(Map.entry("death_count", 0), Map.entry("money", (double) 0.0F), Map.entry("total_kill_count", 0), Map.entry("join_count", 0), Map.entry("tPoint", (double) 0.0F), Map.entry("block_break_count", 0L), Map.entry("level", 1), Map.entry("xp", (double) 0.0F), Map.entry("xp_required", (double) 100.0F), Map.entry("sent_messages", 0L), Map.entry("intelligence", (new Random()).nextInt(0, 100)), Map.entry("jobTitle", ""), Map.entry("pass", ""), Map.entry("autologin", false));
|
StatNames.put("prestigePoints", "Prestige Points");
|
||||||
|
StatOrder = List.of("death_count", "money", "total_kill_count", "join_count", "tPoint", "block_break_count", "sent_messages", "level", "xp", "xp_required", "intelligence", "jobTitle", "prestige", "prestigePoints");
|
||||||
|
StatDefaultValues = Map.ofEntries(Map.entry("death_count", 0), Map.entry("money", (double) 0.0F), Map.entry("total_kill_count", 0), Map.entry("join_count", 0), Map.entry("tPoint", (double) 0.0F), Map.entry("block_break_count", 0L), Map.entry("level", 1), Map.entry("xp", (double) 0.0F), Map.entry("xp_required", (double) 100.0F), Map.entry("sent_messages", 0L), Map.entry("intelligence", (new Random()).nextInt(0, 100)), Map.entry("jobTitle", ""), Map.entry("pass", ""), Map.entry("autologin", false), Map.entry("prestige", 0), Map.entry("prestigePoints", 0L));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,10 @@ commands:
|
||||||
description: Manage player decorations - set or clear decorative titles
|
description: Manage player decorations - set or clear decorative titles
|
||||||
usage: /gDeco <setdecotitle|cleardecotitle>
|
usage: /gDeco <setdecotitle|cleardecotitle>
|
||||||
permission: grimmsserver.gdeco
|
permission: grimmsserver.gdeco
|
||||||
|
gLevel:
|
||||||
|
description: Manage player level and prestige
|
||||||
|
usage: /gLevel <prestige>
|
||||||
|
permission: grimmsserver.glevel
|
||||||
permissions:
|
permissions:
|
||||||
grimmsserver.sendMoney:
|
grimmsserver.sendMoney:
|
||||||
description: Allows sending money to other players from your balance
|
description: Allows sending money to other players from your balance
|
||||||
|
|
@ -180,3 +184,6 @@ permissions:
|
||||||
grimmsserver.gdeco:
|
grimmsserver.gdeco:
|
||||||
description: Allows using player decoration options
|
description: Allows using player decoration options
|
||||||
default: true
|
default: true
|
||||||
|
grimmsserver.glevel:
|
||||||
|
description: Allows using player level and prestige commands
|
||||||
|
default: true
|
||||||
Loading…
Add table
Add a link
Reference in a new issue