Buy enchantment + Misc Update
This commit is contained in:
parent
53dbcb6800
commit
a24db4dbcd
41 changed files with 488 additions and 122 deletions
44
.github/workflows/gradle.yml
vendored
44
.github/workflows/gradle.yml
vendored
|
|
@ -21,20 +21,20 @@ jobs:
|
|||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
|
||||
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
|
||||
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
|
||||
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
|
||||
|
||||
- name: Build with Gradle Wrapper
|
||||
run: ./gradlew build
|
||||
- name: Build with Gradle Wrapper
|
||||
run: ./gradlew build
|
||||
|
||||
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
|
||||
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
|
||||
|
|
@ -54,14 +54,14 @@ jobs:
|
|||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
|
||||
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
|
||||
- name: Generate and submit dependency graph
|
||||
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
|
||||
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
|
||||
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
|
||||
- name: Generate and submit dependency graph
|
||||
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
|
||||
|
|
|
|||
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.
Binary file not shown.
|
|
@ -3,14 +3,14 @@ main: org.gsdistance.grimmsServer.GrimmsServer
|
|||
version: 1
|
||||
api-version: 1.16
|
||||
commands:
|
||||
logselfstats:
|
||||
logSelfStats:
|
||||
description: Displays the player's own stats including death count, money, and total kills.
|
||||
usage: /logselfstats
|
||||
permission: grimmsserver.logselfstats
|
||||
logworldstats:
|
||||
usage: /logSelfStats
|
||||
permission: grimmsserver.logSelfStats
|
||||
logWorldStats:
|
||||
description: Displays the world stats including total deaths, total kills, and total money.
|
||||
usage: /logworldstats
|
||||
permission: grimmsserver.logworldstats
|
||||
usage: /logWorldStats
|
||||
permission: grimmsserver.logWorldStats
|
||||
sellItem:
|
||||
description: Sells the main hand for a certain amount of money.
|
||||
usage: /sellItem
|
||||
|
|
@ -67,3 +67,66 @@ commands:
|
|||
description: Executes a player, requires title Executioner.
|
||||
usage: /executePlayer <player>
|
||||
permission: grimmsserver.execute
|
||||
buyEnchantment:
|
||||
description: Buys 1 level of <enchant> for money
|
||||
usage: /buyEnchantment <enchant>
|
||||
permission: grimmsserver.buyEnchantment
|
||||
logEnchantmentCosts:
|
||||
description: Displays the costs of all available
|
||||
usage: /logEnchantmentCosts
|
||||
permission: grimmsserver.logEnchantmentCosts
|
||||
permissions:
|
||||
grimmsserver.logSelfStats:
|
||||
description: Allows a player to log their own stats
|
||||
default: true
|
||||
grimmsserver.logWorldStats:
|
||||
description: Allows a player to log world stats
|
||||
default: true
|
||||
grimmsserver.sellItem:
|
||||
description: Allows a player to sell an item
|
||||
default: true
|
||||
grimmsserver.buyItem:
|
||||
description: Allows a player to buy an item
|
||||
default: true
|
||||
grimmsserver.getMarketStock:
|
||||
description: Allows a player to get market stock
|
||||
default: true
|
||||
grimmsserver.getMarket:
|
||||
description: Allows a player to get market information
|
||||
default: true
|
||||
grimmsserver.logLeaderboard:
|
||||
description: Allows a player to log the leaderboard
|
||||
default: true
|
||||
grimmsserver.sendMoney:
|
||||
description: Allows a player to send money to another player
|
||||
default: true
|
||||
grimmsserver.buyRipoff:
|
||||
description: Allows a player to buy an item at a higher price
|
||||
default: true
|
||||
grimmsserver.makeItemLevelable:
|
||||
description: Allows a player to make an item levelable
|
||||
default: true
|
||||
grimmsserver.setPlayerStat:
|
||||
description: Allows a player to set another player's stats
|
||||
default: op
|
||||
grimmsserver.logPlayerStats:
|
||||
description: Allows a player to log another player's stats
|
||||
default: op
|
||||
grimmsserver.logSelfTitles:
|
||||
description: Allows a player to log their own titles
|
||||
default: true
|
||||
grimmsserver.logPlayerTitles:
|
||||
description: Allows a player to log another player's titles
|
||||
default: true
|
||||
grimmsserver.addTitle:
|
||||
description: Allows a player to add a title to another player
|
||||
default: op
|
||||
grimmsserver.execute:
|
||||
description: Allows a player to execute another player
|
||||
default: op
|
||||
grimmsserver.buyEnchantment:
|
||||
description: Allows a player to buy an enchantment
|
||||
default: true
|
||||
grimmsserver.logEnchantmentCosts:
|
||||
description: Allows a player to log enchantment costs
|
||||
default: true
|
||||
Binary file not shown.
|
|
@ -11,21 +11,21 @@ public class AddTitle implements CommandExecutor {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if(args.length < 2){
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage("Usage: /addTitle <player> <title>");
|
||||
return false;
|
||||
}
|
||||
if(!PlayerTitles.titles.containsKey(args[1])){
|
||||
if (!PlayerTitles.titles.containsKey(args[1])) {
|
||||
sender.sendMessage("Title not found.");
|
||||
return false;
|
||||
}
|
||||
Player player = GrimmsServer.instance.getServer().getPlayer(args[0]);
|
||||
if(player == null){
|
||||
if (player == null) {
|
||||
sender.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
if(playerTitles.hasTitle(args[1])){
|
||||
if (playerTitles.hasTitle(args[1])) {
|
||||
sender.sendMessage("Player already has this title.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.gsdistance.grimmsServer.Data.EnchantBaseValues;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
public class BuyEnchantment implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if (args.length < 1) {
|
||||
sender.sendMessage("Usage: /buyEnchantment <enchant>");
|
||||
return false;
|
||||
}
|
||||
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(args[0].toLowerCase()));
|
||||
if (enchantment == null || !EnchantBaseValues.enchantBaseValues.containsKey(enchantment)) {
|
||||
sender.sendMessage("Enchantment not listed or nonexistent.");
|
||||
return false;
|
||||
}
|
||||
ItemStack itemToApply = ((Player) sender).getInventory().getItemInMainHand();
|
||||
if (itemToApply.getEnchantmentLevel(enchantment) >= enchantment.getMaxLevel()) {
|
||||
sender.sendMessage("Enchantment already maxed out.");
|
||||
return false;
|
||||
}
|
||||
PlayerStats playerStats = PlayerStats.getPlayerStats(((Player) sender));
|
||||
double cost = EnchantBaseValues.enchantBaseValues.get(enchantment) * (itemToApply.getEnchantmentLevel(enchantment) + 1);
|
||||
if ((Double) playerStats.getStat("money") < cost) {
|
||||
sender.sendMessage("Not enough money");
|
||||
return false;
|
||||
}
|
||||
itemToApply.addEnchantment(enchantment, itemToApply.getEnchantmentLevel(enchantment) + 1);
|
||||
playerStats.setStat("money", (Double) playerStats.getStat("money") - cost);
|
||||
sender.sendMessage("Upgraded the enchant " + enchantment.getKey() + " from " + (itemToApply.getEnchantmentLevel(enchantment) - 1) + " to " + itemToApply.getEnchantmentLevel(enchantment) + " for " + cost + " money.");
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("This command can only be run by a player.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.gsdistance.grimmsServer.Data.MarketBaseValues;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Data.MarketBaseValues;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
public class BuyRipoffItem implements CommandExecutor {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import org.gsdistance.grimmsServer.GrimmsServer;
|
|||
public class CommandRegistry {
|
||||
public static void registerCommands() {
|
||||
// Register all commands here
|
||||
GrimmsServer.instance.getCommand("logselfstats").setExecutor(new LogSelfStats());
|
||||
GrimmsServer.instance.getCommand("logworldstats").setExecutor(new LogWorldStats());
|
||||
GrimmsServer.instance.getCommand("logSelfStats").setExecutor(new LogSelfStats());
|
||||
GrimmsServer.instance.getCommand("logWorldStats").setExecutor(new LogWorldStats());
|
||||
GrimmsServer.instance.getCommand("sellItem").setExecutor(new SellItem());
|
||||
GrimmsServer.instance.getCommand("buyItem").setExecutor(new BuyItem());
|
||||
GrimmsServer.instance.getCommand("getMarketStock").setExecutor(new GetStockOfItem());
|
||||
|
|
@ -21,5 +21,7 @@ public class CommandRegistry {
|
|||
GrimmsServer.instance.getCommand("logPlayerTitles").setExecutor(new LogPlayerTitles());
|
||||
GrimmsServer.instance.getCommand("addTitle").setExecutor(new AddTitle());
|
||||
GrimmsServer.instance.getCommand("executePlayer").setExecutor(new ExecutePlayer());
|
||||
GrimmsServer.instance.getCommand("buyEnchantment").setExecutor(new BuyEnchantment());
|
||||
GrimmsServer.instance.getCommand("logEnchantmentCosts").setExecutor(new LogEnchantmentCosts());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.gsdistance.grimmsServer.Constructable.Market;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
|
|
@ -14,19 +11,19 @@ public class ExecutePlayer implements CommandExecutor {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if(args.length == 0){
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("Usage /executePlayer <player>");
|
||||
return false;
|
||||
}
|
||||
Player player = GrimmsServer.instance.getServer().getPlayer(args[0]);
|
||||
if(player == null){
|
||||
if (player == null) {
|
||||
sender.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
if(PlayerTitles.getPlayerTitles((Player) sender).hasTitle("Executioner")){
|
||||
if (PlayerTitles.getPlayerTitles((Player) sender).hasTitle("Executioner")) {
|
||||
player.sendMessage("You have been executed by " + ((Player) sender).getDisplayName());
|
||||
sender.sendMessage("You have executed " + player.getDisplayName());
|
||||
player.damage(player.getHealth()*10);
|
||||
player.damage(player.getHealth() * 10);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.gsdistance.grimmsServer.Data.EnchantBaseValues;
|
||||
|
||||
public class LogEnchantmentCosts implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
sender.sendMessage("__Enchant costs:");
|
||||
for (Enchantment enchantment : EnchantBaseValues.enchantBaseValues.keySet()) {
|
||||
sender.sendMessage("|" + enchantment.getKey() + ": " + EnchantBaseValues.enchantBaseValues.get(enchantment) + "*level");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,12 +11,12 @@ public class LogPlayerTitles implements CommandExecutor {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if(args.length == 0){
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("Please specify a player name.");
|
||||
return false;
|
||||
}
|
||||
Player player = GrimmsServer.instance.getServer().getPlayer(args[0]);
|
||||
if(player == null){
|
||||
if (player == null) {
|
||||
sender.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
public class LogSelfTitles implements CommandExecutor {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package org.gsdistance.grimmsServer.Commands;
|
||||
|
||||
import org.gsdistance.grimmsServer.Constructable.ItemLevelHandler;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Constructable.ItemLevelHandler;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
public class MakeItemLevelable implements CommandExecutor {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class SellItem implements CommandExecutor {
|
|||
if (sender instanceof Player) {
|
||||
Market market = Market.getMarket();
|
||||
ItemStack iS = ((Player) sender).getInventory().getItemInMainHand();
|
||||
if(iS.getType() == Material.AIR) {
|
||||
if (iS.getType() == Material.AIR) {
|
||||
sender.sendMessage("You are not holding anything.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class SendMoney implements CommandExecutor {
|
|||
sender.sendMessage("Player not found.");
|
||||
return false;
|
||||
}
|
||||
if(Double.parseDouble(args[1]) < 0) {
|
||||
if (Double.parseDouble(args[1]) < 0) {
|
||||
sender.sendMessage("You cannot send negative money.");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ItemLevelHandler {
|
|||
if (meta != null) {
|
||||
PersistentDataContainer data = meta.getPersistentDataContainer();
|
||||
double currentLevel = data.getOrDefault(levelKey, PersistentDataType.DOUBLE, 0.0);
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + currentLevel);
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + currentLevel);
|
||||
data.set(levelKey, PersistentDataType.DOUBLE, currentLevel + level);
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
|
|
@ -81,19 +81,19 @@ public class ItemLevelHandler {
|
|||
int levelUps = 0;
|
||||
while (exp > getXpToLevel()) {
|
||||
exp -= getXpToLevel();
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + getLevel());
|
||||
changeLevel(1);
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + getLevel());
|
||||
levelUps++;
|
||||
}
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + getLevel());
|
||||
setXp(exp);
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + getLevel());
|
||||
if (levelUps > 0) {
|
||||
player.sendMessage("Your " + item.getType().name().toLowerCase() + " has leveled up to " + getLevel() + "!");
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + getLevel());
|
||||
}
|
||||
GrimmsServer.logger.log(Level.INFO,"Current level: " + getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "Current level: " + getLevel());
|
||||
return levelUps;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package org.gsdistance.grimmsServer.Constructable;
|
||||
|
||||
import org.gsdistance.grimmsServer.Data.MarketBaseValues;
|
||||
import com.google.gson.Gson;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.gsdistance.grimmsServer.Data.MarketBaseValues;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
import org.gsdistance.grimmsServer.Stats.ServerStats;
|
||||
|
||||
|
|
@ -72,11 +72,14 @@ public class Market {
|
|||
if (items.get(item.getKey().toString()) == null) {
|
||||
return 0;
|
||||
} else {
|
||||
double rt = 0;
|
||||
long amount = items.get(item.getKey().toString());
|
||||
if (MarketBaseValues.marketBaseValues.containsKey(item)) {
|
||||
return Math.max(Math.max(0.25D, Math.floor(MarketBaseValues.marketBaseValues.get(item) / 100)), MarketBaseValues.marketBaseValues.get(item) - Math.sqrt(amount));
|
||||
rt = Math.max(Math.max(0.25D, Math.floor(MarketBaseValues.marketBaseValues.get(item) / 100)), MarketBaseValues.marketBaseValues.get(item) - Math.sqrt(amount));
|
||||
} else {
|
||||
rt = Math.max(0.25D, 25 - Math.sqrt(amount));
|
||||
}
|
||||
return Math.max(0.25D, 25 - Math.sqrt(amount));
|
||||
return rt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package org.gsdistance.grimmsServer.Constructable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Request {
|
||||
private UUID uuid;
|
||||
private Function<?, ?> onAccept;
|
||||
private LocalDateTime timestamp;
|
||||
|
||||
public Request(Function<?, ?> onAccept) {
|
||||
uuid = UUID.randomUUID();
|
||||
this.onAccept = onAccept;
|
||||
this.timestamp = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package org.gsdistance.grimmsServer.Data;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class EnchantBaseValues {
|
||||
public static final Map<Enchantment, Double> enchantBaseValues = Map.ofEntries(
|
||||
Map.entry(Enchantment.SHARPNESS, 3000.0),
|
||||
Map.entry(Enchantment.EFFICIENCY, 3500.0),
|
||||
Map.entry(Enchantment.KNOCKBACK, 2000.0),
|
||||
Map.entry(Enchantment.BANE_OF_ARTHROPODS, 2500.0),
|
||||
Map.entry(Enchantment.SMITE, 2500.0),
|
||||
Map.entry(Enchantment.BINDING_CURSE, 10000.0),
|
||||
Map.entry(Enchantment.VANISHING_CURSE, 10000.0),
|
||||
Map.entry(Enchantment.PROTECTION, 3500.0),
|
||||
Map.entry(Enchantment.BLAST_PROTECTION, 2500.0),
|
||||
Map.entry(Enchantment.PROJECTILE_PROTECTION, 2500.0),
|
||||
Map.entry(Enchantment.FIRE_PROTECTION, 2500.0),
|
||||
Map.entry(Enchantment.SWIFT_SNEAK, 2000.0),
|
||||
Map.entry(Enchantment.BREACH, 5000.0),
|
||||
Map.entry(Enchantment.DENSITY, 5000.0),
|
||||
Map.entry(Enchantment.MENDING, 12500.0),
|
||||
Map.entry(Enchantment.FEATHER_FALLING, 2500.0),
|
||||
Map.entry(Enchantment.RESPIRATION, 4750.0),
|
||||
Map.entry(Enchantment.AQUA_AFFINITY, 3000.0),
|
||||
Map.entry(Enchantment.THORNS, 5000.0),
|
||||
Map.entry(Enchantment.DEPTH_STRIDER, 4000.0),
|
||||
Map.entry(Enchantment.FROST_WALKER, 3500.0),
|
||||
Map.entry(Enchantment.FIRE_ASPECT, 4000.0),
|
||||
Map.entry(Enchantment.LOOTING, 4000.0),
|
||||
Map.entry(Enchantment.SWEEPING_EDGE, 4500.0),
|
||||
Map.entry(Enchantment.SILK_TOUCH, 5000.0),
|
||||
Map.entry(Enchantment.UNBREAKING, 4000.0),
|
||||
Map.entry(Enchantment.FORTUNE, 5500.0),
|
||||
Map.entry(Enchantment.POWER, 4500.0),
|
||||
Map.entry(Enchantment.PUNCH, 2000.0),
|
||||
Map.entry(Enchantment.FLAME, 4000.0),
|
||||
Map.entry(Enchantment.INFINITY, 9000.0),
|
||||
Map.entry(Enchantment.LUCK_OF_THE_SEA, 3500.0),
|
||||
Map.entry(Enchantment.LURE, 4500.0),
|
||||
Map.entry(Enchantment.LOYALTY, 6000.0),
|
||||
Map.entry(Enchantment.IMPALING, 2500.0),
|
||||
Map.entry(Enchantment.RIPTIDE, 6000.0),
|
||||
Map.entry(Enchantment.CHANNELING, 6000.0),
|
||||
Map.entry(Enchantment.MULTISHOT, 4500.0),
|
||||
Map.entry(Enchantment.QUICK_CHARGE, 4000.0),
|
||||
Map.entry(Enchantment.PIERCING, 5000.0),
|
||||
Map.entry(Enchantment.WIND_BURST, 5000.0),
|
||||
Map.entry(Enchantment.SOUL_SPEED, 3000.0)
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package org.gsdistance.grimmsServer.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PerSessionDataStorage {
|
||||
public static final Map<String, Object> dataStore = Map.ofEntries(
|
||||
Map.entry("defaultData", new Object())
|
||||
);
|
||||
}
|
||||
|
|
@ -5,38 +5,74 @@ import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
|||
import org.gsdistance.grimmsServer.Stats.PlayerTitles;
|
||||
|
||||
public class PlayerTitleManager {
|
||||
public static void killedPlayer(Player player){
|
||||
public static void killedPlayer(Player player) {
|
||||
PlayerTitles.getPlayerTitles(player).addTitle("Murderer");
|
||||
}
|
||||
public static void gotKilledByPlayer(Player player){
|
||||
|
||||
public static void gotKilledByPlayer(Player player) {
|
||||
PlayerTitles.getPlayerTitles(player).addTitle("Victim");
|
||||
}
|
||||
public static void killedDragon(Player player){
|
||||
|
||||
public static void killedDragon(Player player) {
|
||||
PlayerTitles.getPlayerTitles(player).addTitle("DragonSlayer");
|
||||
}
|
||||
public static void gotOnLeaderboard(Player player){
|
||||
|
||||
public static void gotOnLeaderboard(Player player) {
|
||||
PlayerTitles.getPlayerTitles(player).addTitle("Leader");
|
||||
}
|
||||
public static void joinedGame(Player player){
|
||||
|
||||
public static void joinedGame(Player player) {
|
||||
PlayerTitles.getPlayerTitles(player).addTitle("Newbie");
|
||||
}
|
||||
public static void checkTitles(Player player){
|
||||
|
||||
public static void checkTitles(Player player) {
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
if(playerTitles.getTitles().length > 5){
|
||||
if (playerTitles.getTitles().length > 5) {
|
||||
playerTitles.addTitle("Titlemaxxer");
|
||||
}
|
||||
}
|
||||
public static void checkForMoney(Player player){
|
||||
|
||||
public static void checkForMoney(Player player) {
|
||||
double money = (double) PlayerStats.getPlayerStats(player).getStat("money");
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
if(money >= 1000000.0){
|
||||
if (money > 100000.0) {
|
||||
playerTitles.addTitle("Richie");
|
||||
}
|
||||
if (money > 1000000.0) {
|
||||
playerTitles.addTitle("Millionaire");
|
||||
}
|
||||
if(money >= 1000000000.0){
|
||||
if (money > 1000000000.0) {
|
||||
playerTitles.addTitle("Billionaire");
|
||||
}
|
||||
if(money >= 1000000000000.0){
|
||||
if (money > 1000000000000.0) {
|
||||
playerTitles.addTitle("Trillionaire");
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkForBlockBreaks(Player player) {
|
||||
long blockBreakCount = (long) PlayerStats.getPlayerStats(player).getStat("block_break_count");
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
if (blockBreakCount > 1000) {
|
||||
playerTitles.addTitle("Miner");
|
||||
}
|
||||
if (blockBreakCount > 10000) {
|
||||
playerTitles.addTitle("Anti-block");
|
||||
}
|
||||
if (blockBreakCount > 100000) {
|
||||
playerTitles.addTitle("UltimateMiner");
|
||||
}
|
||||
}
|
||||
public static void checkForTotalKills(Player player) {
|
||||
long totalKills = (long) PlayerStats.getPlayerStats(player).getStat("total_kill_count");
|
||||
PlayerTitles playerTitles = PlayerTitles.getPlayerTitles(player);
|
||||
if (totalKills > 100) {
|
||||
playerTitles.addTitle("KillingMachine");
|
||||
}
|
||||
if (totalKills > 1000) {
|
||||
playerTitles.addTitle("ProGamer");
|
||||
}
|
||||
if (totalKills > 10000) {
|
||||
playerTitles.addTitle("Hitman");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package org.gsdistance.grimmsServer.Data;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class PluginDataStorage {
|
||||
private JavaPlugin plugin;
|
||||
private Gson jsonParser;
|
||||
|
||||
public PluginDataStorage(JavaPlugin plugin) {
|
||||
jsonParser = new Gson();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void saveData(Object object, Type objectType, String fileName, String addedPath) {
|
||||
File writeFolder = new File(plugin.getDataFolder().getPath() + addedPath);
|
||||
File file = new File(writeFolder.getPath() + fileName);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,13 +11,13 @@ import java.util.logging.Level;
|
|||
public class BlockBreakEvent {
|
||||
public static void Event(org.bukkit.event.block.BlockBreakEvent event) {
|
||||
if (event.getPlayer().getType() == org.bukkit.entity.EntityType.PLAYER) {
|
||||
PlayerStats.getPlayerStats(event.getPlayer()).changeStat("money", (int)Math.round(1 * PlayerLevelHandler.getLevelHandler(event.getPlayer()).getLesserMoneyMultiplier()));
|
||||
PlayerStats.getPlayerStats(event.getPlayer()).changeStat("tPoint", (int)Math.round(3 * PlayerLevelHandler.getLevelHandler(event.getPlayer()).getMoneyMultiplier()));
|
||||
PlayerStats.getPlayerStats(event.getPlayer()).changeStat("money", (int) Math.round(1 * PlayerLevelHandler.getLevelHandler(event.getPlayer()).getLesserMoneyMultiplier()));
|
||||
PlayerStats.getPlayerStats(event.getPlayer()).changeStat("tPoint", (int) Math.round(3 * PlayerLevelHandler.getLevelHandler(event.getPlayer()).getMoneyMultiplier()));
|
||||
PlayerStats.getPlayerStats(event.getPlayer()).changeStat("block_break_count", 1);
|
||||
PlayerLevelHandler.getLevelHandler(event.getPlayer()).addExp(3);
|
||||
if(ItemLevelHandler.isItemLevelable(event.getPlayer().getInventory().getItemInMainHand())){
|
||||
if (ItemLevelHandler.isItemLevelable(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||
ItemLevelHandler.getLevelHandler(event.getPlayer()).addXp(5);
|
||||
GrimmsServer.logger.log(Level.INFO,"xCurrent level: " + ItemLevelHandler.getLevelHandler(event.getPlayer()).getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "xCurrent level: " + ItemLevelHandler.getLevelHandler(event.getPlayer()).getLevel());
|
||||
}
|
||||
}
|
||||
WorldStats.getWorldStats(event.getBlock().getWorld()).changeStat("block_break_count", 1);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
package org.gsdistance.grimmsServer.Events;
|
||||
|
||||
import org.gsdistance.grimmsServer.Constructable.ItemLevelHandler;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.gsdistance.grimmsServer.Constructable.ItemLevelHandler;
|
||||
import org.gsdistance.grimmsServer.GrimmsServer;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class EntityDamageByEntityEvent {
|
||||
public static void Event(org.bukkit.event.entity.EntityDamageByEntityEvent event){
|
||||
if(event.getDamager().getType() == EntityType.PLAYER){
|
||||
if(ItemLevelHandler.isItemLevelable(((Player)event.getDamager()).getInventory().getItemInMainHand())){
|
||||
public static void Event(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
||||
if (event.getDamager().getType() == EntityType.PLAYER) {
|
||||
if (ItemLevelHandler.isItemLevelable(((Player) event.getDamager()).getInventory().getItemInMainHand())) {
|
||||
ItemLevelHandler.getLevelHandler((Player) event.getDamager()).addXp(event.getDamage());
|
||||
GrimmsServer.logger.log(Level.INFO,"xCurrent level: " + ItemLevelHandler.getLevelHandler((Player) event.getDamager()).getLevel());
|
||||
GrimmsServer.logger.log(Level.INFO, "xCurrent level: " + ItemLevelHandler.getLevelHandler((Player) event.getDamager()).getLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ public class EntityDeathEvent {
|
|||
WorldStats worldStats = WorldStats.getWorldStats(event.getEntity().getWorld());
|
||||
|
||||
playerStats.changeStat("total_kill_count", 1);
|
||||
playerStats.changeStat("money", (int)Math.round(3 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getLesserMoneyMultiplier()));
|
||||
playerStats.changeStat("tPoint", (int)Math.round(25 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getMoneyMultiplier()));
|
||||
playerStats.changeStat("money", (int) Math.round(3 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getLesserMoneyMultiplier()));
|
||||
playerStats.changeStat("tPoint", (int) Math.round(25 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getMoneyMultiplier()));
|
||||
worldStats.changeStat("wPoint", 40);
|
||||
PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).addExp(50);
|
||||
|
||||
if (event.getEntity().getType() == EntityType.PLAYER) {
|
||||
playerStats.changeStat("money", (int)Math.round(12 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getLesserMoneyMultiplier()));
|
||||
playerStats.changeStat("tPoint", (int)Math.round(50 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getMoneyMultiplier()));
|
||||
playerStats.changeStat("money", (int) Math.round(12 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getLesserMoneyMultiplier()));
|
||||
playerStats.changeStat("tPoint", (int) Math.round(50 * PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).getMoneyMultiplier()));
|
||||
worldStats.changeStat("wPoint", 110);
|
||||
PlayerLevelHandler.getLevelHandler(event.getEntity().getKiller()).addExp(150);
|
||||
PlayerTitleManager.killedPlayer(event.getEntity().getKiller());
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public class EventTrigger implements Listener {
|
||||
|
|
@ -23,12 +24,19 @@ public class EventTrigger implements Listener {
|
|||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
org.gsdistance.grimmsServer.Events.PlayerJoinEvent.Event(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
org.gsdistance.grimmsServer.Events.EntityDamageEvent.Event(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
org.gsdistance.grimmsServer.Events.EntityDamageByEntityEvent.Event(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChatUse(AsyncPlayerChatEvent event) {
|
||||
PlayerChatEvent.Event(event);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package org.gsdistance.grimmsServer.Events;
|
||||
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.gsdistance.grimmsServer.Stats.PlayerStats;
|
||||
|
||||
public class PlayerChatEvent {
|
||||
public static void Event(AsyncPlayerChatEvent event) {
|
||||
PlayerStats.getPlayerStats(event.getPlayer()).changeStat("sent_messages", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,9 @@ public class ServerStartupEvent {
|
|||
for (Player player : GrimmsServer.instance.getServer().getOnlinePlayers()) {
|
||||
PlayerStatLeaderBoard.getPlayerStatLeaderBoard().checkPlayer(player);
|
||||
PlayerTitleManager.checkForMoney(player);
|
||||
PlayerTitleManager.checkTitles(player);
|
||||
PlayerTitleManager.checkForBlockBreaks(player);
|
||||
PlayerTitleManager.checkForTotalKills(player);
|
||||
}
|
||||
}
|
||||
}, 100L, 1L);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.gsdistance.grimmsServer.GrimmsServer;
|
|||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -19,24 +20,26 @@ public class PlayerStatLeaderBoard {
|
|||
"tPoint", Double.class,
|
||||
"block_break_count", Long.class,
|
||||
"money", Double.class,
|
||||
"level", Integer.class
|
||||
"level", Integer.class,
|
||||
"sent_messages", Long.class
|
||||
);
|
||||
public Map<String, LeaderboardEntry> leaderboard;
|
||||
|
||||
public PlayerStatLeaderBoard() {
|
||||
this.leaderboard = Map.of(
|
||||
"total_kill_count", new LeaderboardEntry("None", 0),
|
||||
"death_count", new LeaderboardEntry("None", 0),
|
||||
"join_count", new LeaderboardEntry("None", 0),
|
||||
"tPoint", new LeaderboardEntry("None", 0),
|
||||
"block_break_count", new LeaderboardEntry("None", 0),
|
||||
"money", new LeaderboardEntry("None", 0),
|
||||
"level", new LeaderboardEntry("None", 0)
|
||||
);
|
||||
leaderboard = new HashMap<>();
|
||||
for (String stat : Stats.keySet()) {
|
||||
leaderboard.put(stat, new LeaderboardEntry("None", 0));
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayerStatLeaderBoard getPlayerStatLeaderBoard() {
|
||||
return new Gson().fromJson((String) ServerStats.getServerStats().getStat("leaderboard"), PlayerStatLeaderBoard.class);
|
||||
PlayerStatLeaderBoard playerStatLeaderBoard = new Gson().fromJson((String) ServerStats.getServerStats().getStat("leaderboard"), PlayerStatLeaderBoard.class);
|
||||
for (String stat : Stats.keySet()) {
|
||||
if (!playerStatLeaderBoard.leaderboard.containsKey(stat)) {
|
||||
playerStatLeaderBoard.leaderboard.put(stat, new LeaderboardEntry("None", 0));
|
||||
}
|
||||
}
|
||||
return playerStatLeaderBoard;
|
||||
}
|
||||
|
||||
public void savePlayerStatLeaderBoard() {
|
||||
|
|
@ -51,7 +54,7 @@ public class PlayerStatLeaderBoard {
|
|||
Number playerStatValue = (Number) playerStats.getStat(stat);
|
||||
Number leaderboardStatValue = leaderboard.get(stat).getStatValue();
|
||||
if (playerStatValue != null && playerStatValue.doubleValue() > leaderboardStatValue.doubleValue()) {
|
||||
if(!player.getName().equalsIgnoreCase(leaderboard.get(stat).getPlayerName())){
|
||||
if (!player.getName().equalsIgnoreCase(leaderboard.get(stat).getPlayerName())) {
|
||||
overtakes.add(stat);
|
||||
}
|
||||
leaderboard.put(stat, new LeaderboardEntry(player.getName(), playerStatValue.intValue()));
|
||||
|
|
@ -59,9 +62,9 @@ public class PlayerStatLeaderBoard {
|
|||
pass = true;
|
||||
}
|
||||
}
|
||||
if(pass){
|
||||
for (String stat : overtakes){
|
||||
GrimmsServer.instance.getServer().broadcastMessage("The leader of stat " + stat + " is now " + player.getDisplayName());
|
||||
if (pass) {
|
||||
for (String stat : overtakes) {
|
||||
GrimmsServer.instance.getServer().broadcastMessage("The leader of stat " + PlayerStats.StatNames.get(stat) + " is now " + player.getDisplayName());
|
||||
}
|
||||
PlayerTitleManager.gotOnLeaderboard(player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class PlayerStats {
|
|||
Stats.put("xp", PersistentDataType.DOUBLE);
|
||||
Stats.put("xp_required", PersistentDataType.DOUBLE);
|
||||
Stats.put("titles", PersistentDataType.STRING);
|
||||
Stats.put("sent_messages", PersistentDataType.LONG);
|
||||
}
|
||||
|
||||
public static final Dictionary<String, String> StatNames = new Hashtable<>();
|
||||
|
|
@ -42,6 +43,7 @@ public class PlayerStats {
|
|||
StatNames.put("xp", "Experience");
|
||||
StatNames.put("xp_required", "Experience Required");
|
||||
StatNames.put("titles", "Player Titles");
|
||||
StatNames.put("sent_messages", "Messages Sent");
|
||||
}
|
||||
|
||||
public static final List<String> StatOrder = List.of(
|
||||
|
|
@ -51,6 +53,7 @@ public class PlayerStats {
|
|||
"join_count",
|
||||
"tPoint",
|
||||
"block_break_count",
|
||||
"sent_messages",
|
||||
"level",
|
||||
"xp",
|
||||
"xp_required"
|
||||
|
|
@ -62,7 +65,7 @@ public class PlayerStats {
|
|||
public PlayerStats(JavaPlugin plugin, Player player) {
|
||||
this.plugin = plugin;
|
||||
this.dataContainer = player.getPersistentDataContainer();
|
||||
if(!hasExactStat("titles")){
|
||||
if (!hasExactStat("titles")) {
|
||||
setStat("titles", new Gson().toJson(new ArrayList<String>().toArray()));
|
||||
}
|
||||
}
|
||||
|
|
@ -80,12 +83,12 @@ public class PlayerStats {
|
|||
return dataContainer.getOrDefault(new NamespacedKey(plugin, stat), type, 0);
|
||||
}
|
||||
|
||||
public boolean hasStat(String stat){
|
||||
public boolean hasStat(String stat) {
|
||||
return dataContainer.has(new NamespacedKey(plugin, stat));
|
||||
}
|
||||
|
||||
public boolean hasExactStat(String stat){
|
||||
return dataContainer.has(new NamespacedKey(plugin,stat),Stats.get(stat));
|
||||
public boolean hasExactStat(String stat) {
|
||||
return dataContainer.has(new NamespacedKey(plugin, stat), Stats.get(stat));
|
||||
}
|
||||
|
||||
public void setStat(String stat, Object value) {
|
||||
|
|
|
|||
|
|
@ -10,32 +10,43 @@ import java.util.Map;
|
|||
public class PlayerTitles {
|
||||
private final String[] playerTitles;
|
||||
public static final Map<String, String> titles = Map.ofEntries(
|
||||
Map.entry("Dictator","The title of a dictator, not to be messed with."),
|
||||
Map.entry("Executioner","The title and power of execution."),
|
||||
Map.entry("Murderer","Someone whose crimes follow him till death."),
|
||||
Map.entry("Victim","Got murdered, unfortunate."),
|
||||
Map.entry("DragonSlayer","The fabled warrior to defeat the fabled dragon or something like that."),
|
||||
Map.entry("Newbie","Wowie! Joining the game gives a title!"),
|
||||
Map.entry("Millionaire","Wow, that's quite a lot ya' know!"),
|
||||
Map.entry("Billionaire","Capitalism at it's finest."),
|
||||
Map.entry("Trillionaire","Literally insane, no comment."),
|
||||
Map.entry("Dictator", "The title of a dictator, not to be messed with."),
|
||||
Map.entry("Executioner", "The title and power of execution."),
|
||||
Map.entry("Murderer", "Someone whose crimes follow him till death."),
|
||||
Map.entry("Victim", "Got murdered, unfortunate."),
|
||||
Map.entry("DragonSlayer", "The fabled warrior to defeat the fabled dragon or something like that."),
|
||||
Map.entry("Newbie", "Wowie! Joining the game gives a title!"),
|
||||
Map.entry("Richie", "Money talks, well at least that's what I've been told!"),
|
||||
Map.entry("Millionaire", "Wow, that's quite a lot ya' know!"),
|
||||
Map.entry("Billionaire", "Capitalism at it's finest."),
|
||||
Map.entry("Trillionaire", "Literally insane, no comment."),
|
||||
Map.entry("Miner", "Minin' to the earths core."),
|
||||
Map.entry("Anti-block", "DEMOLISH 10000 blocks"),
|
||||
Map.entry("UltimateMiner", "Mine 100000 blocks"),
|
||||
Map.entry("Titlemaxxer", "Get more than 5 titles"),
|
||||
Map.entry("Leader","You got on the leaderboard."),
|
||||
Map.entry("Null","Not a title bro.")
|
||||
Map.entry("KillingMachine", "Kill 100 things(?)."),
|
||||
Map.entry("ProGamer", "Kill 1000 things(?)."),
|
||||
Map.entry("Hitman", "Professional killerguy."),
|
||||
Map.entry("Leader", "You got on the leaderboard."),
|
||||
Map.entry("Null", "Not a title bro.")
|
||||
);
|
||||
private final Player player;
|
||||
|
||||
public PlayerTitles(Player player) {
|
||||
this.player = player;
|
||||
this.playerTitles = new Gson().fromJson((String) PlayerStats.getPlayerStats(player).getStat("titles"),String[].class);
|
||||
this.playerTitles = new Gson().fromJson((String) PlayerStats.getPlayerStats(player).getStat("titles"), String[].class);
|
||||
}
|
||||
|
||||
public static PlayerTitles getPlayerTitles(Player player) {
|
||||
return new PlayerTitles(player);
|
||||
}
|
||||
|
||||
public String[] getTitles() {
|
||||
return playerTitles;
|
||||
}
|
||||
|
||||
public void addTitle(String title) {
|
||||
if(!hasTitle(title)) {
|
||||
if (!hasTitle(title)) {
|
||||
String[] newTitles = new String[playerTitles.length + 1];
|
||||
System.arraycopy(playerTitles, 0, newTitles, 0, playerTitles.length);
|
||||
newTitles[playerTitles.length] = title;
|
||||
|
|
@ -44,6 +55,7 @@ public class PlayerTitles {
|
|||
PlayerTitleManager.checkTitles(player);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasTitle(String title) {
|
||||
for (String playerTitle : playerTitles) {
|
||||
if (playerTitle.equals(title)) {
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ main: org.gsdistance.grimmsServer.GrimmsServer
|
|||
version: ${version}
|
||||
api-version: 1.16
|
||||
commands:
|
||||
logselfstats:
|
||||
logSelfStats:
|
||||
description: Displays the player's own stats including death count, money, and total kills.
|
||||
usage: /logselfstats
|
||||
permission: grimmsserver.logselfstats
|
||||
logworldstats:
|
||||
usage: /logSelfStats
|
||||
permission: grimmsserver.logSelfStats
|
||||
logWorldStats:
|
||||
description: Displays the world stats including total deaths, total kills, and total money.
|
||||
usage: /logworldstats
|
||||
permission: grimmsserver.logworldstats
|
||||
usage: /logWorldStats
|
||||
permission: grimmsserver.logWorldStats
|
||||
sellItem:
|
||||
description: Sells the main hand for a certain amount of money.
|
||||
usage: /sellItem
|
||||
|
|
@ -67,3 +67,66 @@ commands:
|
|||
description: Executes a player, requires title Executioner.
|
||||
usage: /executePlayer <player>
|
||||
permission: grimmsserver.execute
|
||||
buyEnchantment:
|
||||
description: Buys 1 level of <enchant> for money
|
||||
usage: /buyEnchantment <enchant>
|
||||
permission: grimmsserver.buyEnchantment
|
||||
logEnchantmentCosts:
|
||||
description: Displays the costs of all available
|
||||
usage: /logEnchantmentCosts
|
||||
permission: grimmsserver.logEnchantmentCosts
|
||||
permissions:
|
||||
grimmsserver.logSelfStats:
|
||||
description: Allows a player to log their own stats
|
||||
default: true
|
||||
grimmsserver.logWorldStats:
|
||||
description: Allows a player to log world stats
|
||||
default: true
|
||||
grimmsserver.sellItem:
|
||||
description: Allows a player to sell an item
|
||||
default: true
|
||||
grimmsserver.buyItem:
|
||||
description: Allows a player to buy an item
|
||||
default: true
|
||||
grimmsserver.getMarketStock:
|
||||
description: Allows a player to get market stock
|
||||
default: true
|
||||
grimmsserver.getMarket:
|
||||
description: Allows a player to get market information
|
||||
default: true
|
||||
grimmsserver.logLeaderboard:
|
||||
description: Allows a player to log the leaderboard
|
||||
default: true
|
||||
grimmsserver.sendMoney:
|
||||
description: Allows a player to send money to another player
|
||||
default: true
|
||||
grimmsserver.buyRipoff:
|
||||
description: Allows a player to buy an item at a higher price
|
||||
default: true
|
||||
grimmsserver.makeItemLevelable:
|
||||
description: Allows a player to make an item levelable
|
||||
default: true
|
||||
grimmsserver.setPlayerStat:
|
||||
description: Allows a player to set another player's stats
|
||||
default: op
|
||||
grimmsserver.logPlayerStats:
|
||||
description: Allows a player to log another player's stats
|
||||
default: op
|
||||
grimmsserver.logSelfTitles:
|
||||
description: Allows a player to log their own titles
|
||||
default: true
|
||||
grimmsserver.logPlayerTitles:
|
||||
description: Allows a player to log another player's titles
|
||||
default: true
|
||||
grimmsserver.addTitle:
|
||||
description: Allows a player to add a title to another player
|
||||
default: op
|
||||
grimmsserver.execute:
|
||||
description: Allows a player to execute another player
|
||||
default: op
|
||||
grimmsserver.buyEnchantment:
|
||||
description: Allows a player to buy an enchantment
|
||||
default: true
|
||||
grimmsserver.logEnchantmentCosts:
|
||||
description: Allows a player to log enchantment costs
|
||||
default: true
|
||||
Loading…
Add table
Add a link
Reference in a new issue