forked from never2nv/NVus_Prison
Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
1ef701b022 | |
|
6822f23dcc | |
|
d51b1570b9 | |
|
fe0833e570 | |
|
908149c5ec | |
|
b1d829a132 |
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>me.NVus</groupId>
|
<groupId>me.NVus</groupId>
|
||||||
<artifactId>NVus_Prison</artifactId>
|
<artifactId>NVus_Prison</artifactId>
|
||||||
<version>1.0.8</version>
|
<version>1.1.8</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>NVus_PrisonSetup</name>
|
<name>NVus_PrisonSetup</name>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package me.nvus.nvus_prison_setup.AutoSell;
|
||||||
|
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class EconomyHandler {
|
||||||
|
|
||||||
|
private Economy economy;
|
||||||
|
private MultiplierManager multiplierManager;
|
||||||
|
|
||||||
|
public EconomyHandler(Economy economy, MultiplierManager multiplierManager) {
|
||||||
|
this.economy = economy;
|
||||||
|
this.multiplierManager = multiplierManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void giveMoney(Player player, double amount) {
|
||||||
|
double multiplier = multiplierManager.getPlayerMultiplier(player.getUniqueId());
|
||||||
|
economy.depositPlayer(player, amount * multiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -19,9 +19,10 @@ public class AutoSellListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!player.hasPermission("nvus.prisoner") || !sellManager.isAutoSellEnabled(player)) {
|
// Added additional permission check
|
||||||
return;
|
if ((sellManager.isAutoSellEnabled(player)) ) {
|
||||||
}
|
|
||||||
sellManager.sellItems(player);
|
sellManager.sellItems(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
package me.nvus.nvus_prison_setup.AutoSell;
|
||||||
|
import me.nvus.nvus_prison_setup.PrisonSetup;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class MultiplierManager implements CommandExecutor {
|
||||||
|
|
||||||
|
private final PrisonSetup plugin;
|
||||||
|
private final Map<UUID, Double> multipliers = new HashMap<>();
|
||||||
|
|
||||||
|
// Store the scheduled tasks for removing multipliers
|
||||||
|
private final Map<UUID, BukkitTask> removalTasks = new HashMap<>();
|
||||||
|
|
||||||
|
public MultiplierManager(PrisonSetup plugin) {
|
||||||
|
this.plugin = plugin; // Store the passed plugin instance for later use
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (!sender.hasPermission("multiplier.use")) {
|
||||||
|
sender.sendMessage("You don't have permission to use this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length != 3) {
|
||||||
|
sender.sendMessage("Usage: /multiplier <player> <multiplier> <duration in minutes>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
if (target == null) {
|
||||||
|
sender.sendMessage("Player not found.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
double multiplier = Double.parseDouble(args[1]);
|
||||||
|
int duration = Integer.parseInt(args[2].replace("m", ""));
|
||||||
|
applyMultiplier(target, multiplier, duration);
|
||||||
|
sender.sendMessage("Applied a " + multiplier + "x multiplier to " + target.getName() + " for " + duration + " minutes.");
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
sender.sendMessage("Invalid number format.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyMultiplier(Player player, double multiplier, int duration) {
|
||||||
|
UUID playerId = player.getUniqueId();
|
||||||
|
// Cancel any existing removal task
|
||||||
|
if (removalTasks.containsKey(playerId)) {
|
||||||
|
removalTasks.get(playerId).cancel();
|
||||||
|
removalTasks.remove(playerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply the new multiplier
|
||||||
|
multipliers.put(playerId, multiplier);
|
||||||
|
|
||||||
|
// Schedule a new removal task
|
||||||
|
BukkitTask task = new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
multipliers.remove(playerId);
|
||||||
|
removalTasks.remove(playerId);
|
||||||
|
player.sendMessage("Your selling multiplier has expired.");
|
||||||
|
}
|
||||||
|
}.runTaskLater(plugin, duration * 60 * 20); // Convert minutes to ticks
|
||||||
|
|
||||||
|
// Store the task for potential cancellation
|
||||||
|
removalTasks.put(playerId, task);
|
||||||
|
|
||||||
|
player.sendMessage("Applied a " + multiplier + "x multiplier to you for " + duration + " minutes.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPlayerMultiplier(UUID playerUuid) {
|
||||||
|
return multipliers.getOrDefault(playerUuid, 1.0); // Default to 1.0, meaning no multiplier
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package me.nvus.nvus_prison_setup.AutoSell;
|
||||||
|
|
||||||
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
|
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
|
||||||
import me.nvus.nvus_prison_setup.PrisonSetup;
|
import me.nvus.nvus_prison_setup.PrisonSetup;
|
||||||
|
import me.nvus.nvus_prison_setup.AutoSell.MultiplierManager;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -18,29 +19,53 @@ import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
public class SellManager implements CommandExecutor {
|
public class SellManager implements CommandExecutor {
|
||||||
|
|
||||||
private final HashMap<UUID, Boolean> autoSellStatus = new HashMap<>();
|
private final HashMap<UUID, Boolean> autoSellStatus = new HashMap<>();
|
||||||
private final HashMap<Material, Double> prices = new HashMap<>();
|
private final HashMap<Material, Double> prices = new HashMap<>();
|
||||||
private final ConfigManager configManager;
|
|
||||||
|
|
||||||
public SellManager(ConfigManager configManager) {
|
private final Map<UUID, MultiplierInfo> playerMultipliers = new ConcurrentHashMap<>();
|
||||||
|
private final ConfigManager configManager;
|
||||||
|
private final MultiplierManager multiplierManager;
|
||||||
|
|
||||||
|
public SellManager(ConfigManager configManager, MultiplierManager multiplierManager) {
|
||||||
this.configManager = configManager;
|
this.configManager = configManager;
|
||||||
|
this.multiplierManager = multiplierManager;
|
||||||
loadPrices();
|
loadPrices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class MultiplierInfo {
|
||||||
|
double multiplier;
|
||||||
|
LocalDateTime expiryTime;
|
||||||
|
|
||||||
|
MultiplierInfo(double multiplier, int durationMinutes) {
|
||||||
|
this.multiplier = multiplier;
|
||||||
|
this.expiryTime = LocalDateTime.now().plusMinutes(durationMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isExpired() {
|
||||||
|
return LocalDateTime.now().isAfter(expiryTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage("Only players can use this command.");
|
sender.sendMessage(ChatColor.RED + "Only players can use this command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
// Admin Commands:
|
// Admin Commands:
|
||||||
if ("setprice".equalsIgnoreCase(command.getName())) {
|
if ("setprice".equalsIgnoreCase(label)) {
|
||||||
if (player.hasPermission("nvus.admin")) {
|
if (!player.hasPermission("nvus.admin")) {
|
||||||
|
player.sendMessage(ChatColor.RED + "You do not have permission to set prices.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /setprice <price>");
|
player.sendMessage(ChatColor.RED + "Usage: /setprice <price>");
|
||||||
return true;
|
return true;
|
||||||
|
@ -51,25 +76,34 @@ public class SellManager implements CommandExecutor {
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
player.sendMessage(ChatColor.RED + "Please provide a valid price.");
|
player.sendMessage(ChatColor.RED + "Please provide a valid price.");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
player.sendMessage(ChatColor.RED + "You do not have permission to set prices.");
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Player/Prisoner Commands:
|
// Player/Prisoner Commands:
|
||||||
switch (command.getName().toLowerCase()) {
|
switch (label.toLowerCase()) {
|
||||||
case "autosell":
|
case "autosell":
|
||||||
|
if (player.hasPermission("nvus.prisoner") || player.hasPermission("nvus.autosell")) {
|
||||||
toggleAutoSell(player);
|
toggleAutoSell(player);
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED + "You do not have permission to use /autosell.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "sellall":
|
case "sellall":
|
||||||
|
if (player.hasPermission("nvus.prisoner") || player.hasPermission("nvus.sellall")) {
|
||||||
sellItems(player);
|
sellItems(player);
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED + "You do not have permission to use /sellall.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// More commands in future? xD
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadPrices() {
|
private void loadPrices() {
|
||||||
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
|
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
|
||||||
ConfigurationSection pricesSection = itemPricesConfig.getConfigurationSection("Prices");
|
ConfigurationSection pricesSection = itemPricesConfig.getConfigurationSection("Prices");
|
||||||
|
@ -146,10 +180,10 @@ public class SellManager implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sellItems(Player player) {
|
public void sellItems(Player player) {
|
||||||
if (!player.hasPermission("nvus.prisoner")) {
|
// if (player.hasPermission("nvus.prisoner") || player.hasPermission("nvus.sellall")) {
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou do not have permission to use this command."));
|
// player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou do not have permission to use this command."));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
Map<Material, Integer> soldItems = new HashMap<>();
|
Map<Material, Integer> soldItems = new HashMap<>();
|
||||||
|
|
||||||
|
@ -170,11 +204,20 @@ public class SellManager implements CommandExecutor {
|
||||||
|
|
||||||
private void giveMoney(Player player, Material material, int quantity, double amount) {
|
private void giveMoney(Player player, Material material, int quantity, double amount) {
|
||||||
Economy economy = PrisonSetup.getEconomy();
|
Economy economy = PrisonSetup.getEconomy();
|
||||||
economy.depositPlayer(player, amount);
|
double multiplier = multiplierManager.getPlayerMultiplier(player.getUniqueId());
|
||||||
|
double finalAmount = amount * multiplier; // Apply the multiplier
|
||||||
|
economy.depositPlayer(player, finalAmount);
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
String.format("&a&lSold &d%dx &3%s &a&lfor $%.2f", quantity, material.toString().toLowerCase().replaceAll("_", " "), amount)));
|
String.format("&a&lSold &d%dx &3%s &a&lfor $%.2f", quantity, material.toString().toLowerCase().replaceAll("_", " "), finalAmount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private void giveMoney(Player player, Material material, int quantity, double amount) {
|
||||||
|
// Economy economy = PrisonSetup.getEconomy();
|
||||||
|
// economy.depositPlayer(player, amount);
|
||||||
|
// player.sendMessage(ChatColor.translateAlternateColorCodes('&',
|
||||||
|
// String.format("&a&lSold &d%dx &3%s &a&lfor $%.2f", quantity, material.toString().toLowerCase().replaceAll("_", " "), amount)));
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public void sellItems(Player player) {
|
// public void sellItems(Player player) {
|
||||||
|
|
|
@ -41,13 +41,21 @@ public class SettingsMenu implements Listener {
|
||||||
inv.setItem(4, createToggleItem(Material.LEVER, "Toggle AutoSwitch", config.getBoolean("AutoSwitch", true)));
|
inv.setItem(4, createToggleItem(Material.LEVER, "Toggle AutoSwitch", config.getBoolean("AutoSwitch", true)));
|
||||||
inv.setItem(5, createToggleItem(Material.IRON_PICKAXE, "Toggle ToolDamage", config.getBoolean("ToolDamage", false)));
|
inv.setItem(5, createToggleItem(Material.IRON_PICKAXE, "Toggle ToolDamage", config.getBoolean("ToolDamage", false)));
|
||||||
|
|
||||||
|
inv.setItem(7, createToggleItem(Material.IRON_BARS , "Toggle PrisonerGangs", false));
|
||||||
inv.setItem(8, createToggleItem(Material.BOOK, "Reload Configs", false));
|
inv.setItem(8, createToggleItem(Material.BOOK, "Reload Configs", false));
|
||||||
|
|
||||||
// Second Row
|
// Second Row
|
||||||
inv.setItem(9, createToggleItem(Material.GOLD_INGOT, "Toggle AutoSell", config.getBoolean("AutoSell", true)));
|
inv.setItem(9, createToggleItem(Material.GOLD_INGOT, "Toggle AutoSell", config.getBoolean("AutoSell", true)));
|
||||||
inv.setItem(10, createToggleItem(Material.GOLD_BLOCK, "Toggle SellAll", config.getBoolean("SellAll", true)));
|
inv.setItem(10, createToggleItem(Material.GOLD_BLOCK, "Toggle SellAll", config.getBoolean("SellAll", true)));
|
||||||
|
|
||||||
inv.setItem(11, createToggleItem(Material.OAK_SAPLING, "Toggle TreeFarm", config.getBoolean("TreeFarm", true)));
|
inv.setItem(12, createToggleItem(Material.OAK_SAPLING, "Toggle TreeFarm", config.getBoolean("TreeFarm", true)));
|
||||||
|
inv.setItem(13, createToggleItem(Material.SUNFLOWER, "Toggle PrisonerRanks", config.getBoolean("PrisonerRanks", true)));
|
||||||
|
|
||||||
|
inv.setItem(15, createToggleItem(Material.IRON_SHOVEL, "Toggle PrisonerKit", config.getBoolean("PrisonerKit", true)));
|
||||||
|
inv.setItem(16, createToggleItem(Material.BARRIER, "Toggle RestrictKitDrop", config.getBoolean("RestrictKitDrop", true)));
|
||||||
|
inv.setItem(17, createToggleItem(Material.BARRIER, "Toggle RestrictKitMove", config.getBoolean("RestrictKitMove", true)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
player.openInventory(inv);
|
player.openInventory(inv);
|
||||||
}
|
}
|
||||||
|
@ -102,10 +110,28 @@ public class SettingsMenu implements Listener {
|
||||||
toggleConfigOption(player, "AutoSwitch");
|
toggleConfigOption(player, "AutoSwitch");
|
||||||
} else if (displayName.contains("Toggle AutoSell")) {
|
} else if (displayName.contains("Toggle AutoSell")) {
|
||||||
toggleConfigOption(player, "AutoSell");
|
toggleConfigOption(player, "AutoSell");
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Requires a server restart to take effect. Or external plugin reload ie PlugManX");
|
||||||
} else if (displayName.contains("Toggle SellAll")) {
|
} else if (displayName.contains("Toggle SellAll")) {
|
||||||
toggleConfigOption(player, "SellAll");
|
toggleConfigOption(player, "SellAll");
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Requires a server restart to take effect. Or external plugin reload ie PlugManX");
|
||||||
} else if (displayName.contains("Toggle TreeFarm")) {
|
} else if (displayName.contains("Toggle TreeFarm")) {
|
||||||
toggleConfigOption(player, "TreeFarm");
|
toggleConfigOption(player, "TreeFarm");
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Requires a server restart to take effect. Or external plugin reload ie PlugManX");
|
||||||
|
} else if (displayName.contains("Toggle PrisonerGangs")) {
|
||||||
|
toggleConfigOption(player, "PrisonerGangs");
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Requires a server restart to take effect. Or external plugin reload ie PlugManX");
|
||||||
|
}
|
||||||
|
else if (displayName.contains("Toggle PrisonerRanks")) {
|
||||||
|
toggleConfigOption(player, "PrisonerRanks");
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Requires a server restart to take effect. Or external plugin reload ie PlugManX");
|
||||||
|
} else if (displayName.contains("Toggle PrisonerKit")) {
|
||||||
|
toggleConfigOption(player, "PrisonerKit");
|
||||||
|
} else if (displayName.contains("Toggle RestrictKitDrop")) {
|
||||||
|
toggleConfigOption(player, "RestrictKitDrop");
|
||||||
|
} else if (displayName.contains("Toggle RestrictKitMove")) {
|
||||||
|
toggleConfigOption(player, "RestrictKitMove");
|
||||||
|
} else if (displayName.contains("Toggle ToolDamage")) {
|
||||||
|
toggleConfigOption(player, "ToolDamage");
|
||||||
} else if (displayName.contains("Reload Configs")) {
|
} else if (displayName.contains("Reload Configs")) {
|
||||||
reloadConfigs(player);
|
reloadConfigs(player);
|
||||||
}
|
}
|
||||||
|
@ -139,6 +165,7 @@ public class SettingsMenu implements Listener {
|
||||||
configManager.reloadConfig("auto_switch.yml");
|
configManager.reloadConfig("auto_switch.yml");
|
||||||
configManager.reloadConfig("banned_items.yml");
|
configManager.reloadConfig("banned_items.yml");
|
||||||
configManager.reloadConfig("item_prices.yml");
|
configManager.reloadConfig("item_prices.yml");
|
||||||
|
configManager.reloadConfig("ranks.yml");
|
||||||
//configManager.saveConfig("config.yml");
|
//configManager.saveConfig("config.yml");
|
||||||
player.sendMessage(ChatColor.GREEN + "[NVus Prison] : Configuration files reloaded!");
|
player.sendMessage(ChatColor.GREEN + "[NVus Prison] : Configuration files reloaded!");
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -65,44 +66,125 @@ public class KitManager {
|
||||||
|
|
||||||
ItemStack item = new ItemStack(material);
|
ItemStack item = new ItemStack(material);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
// Configure item meta (name, lore, enchantments)...
|
||||||
// Set the display name if available
|
|
||||||
if (itemSpec.containsKey("name")) {
|
if (itemSpec.containsKey("name")) {
|
||||||
String name = ChatColor.translateAlternateColorCodes('&', (String) itemSpec.get("name"));
|
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', (String) itemSpec.get("name")));
|
||||||
meta.setDisplayName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set lore if available
|
|
||||||
if (itemSpec.containsKey("lore")) {
|
if (itemSpec.containsKey("lore")) {
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
for (String line : (List<String>) itemSpec.get("lore")) {
|
((List<String>) itemSpec.get("lore")).forEach(line -> lore.add(ChatColor.translateAlternateColorCodes('&', line)));
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
|
||||||
}
|
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set enchantments if available
|
|
||||||
if (itemSpec.containsKey("enchantments")) {
|
if (itemSpec.containsKey("enchantments")) {
|
||||||
Map<String, Integer> enchantments = (Map<String, Integer>) itemSpec.get("enchantments");
|
((Map<String, Integer>) itemSpec.get("enchantments")).forEach((enchant, level) -> meta.addEnchant(Enchantment.getByName(enchant.toUpperCase()), level, true));
|
||||||
for (Map.Entry<String, Integer> enchantmentEntry : enchantments.entrySet()) {
|
|
||||||
Enchantment enchantment = Enchantment.getByName(enchantmentEntry.getKey());
|
|
||||||
if (enchantment != null) {
|
|
||||||
meta.addEnchant(enchantment, enchantmentEntry.getValue(), true);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
// Set item in specified quickbar slot, if available
|
|
||||||
if (itemSpec.containsKey("slot")) {
|
if (itemSpec.containsKey("slot")) {
|
||||||
player.getInventory().setItem((Integer) itemSpec.get("slot"), item);
|
int slot = (Integer) itemSpec.get("slot");
|
||||||
|
ItemStack existingItem = player.getInventory().getItem(slot);
|
||||||
|
|
||||||
|
if (existingItem != null && existingItem.getType() != Material.AIR && !isPrisonerKitItem(existingItem)) {
|
||||||
|
moveItemToAvailableSlot(player, existingItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getInventory().setItem(slot, item);
|
||||||
} else {
|
} else {
|
||||||
player.getInventory().addItem(item);
|
player.getInventory().addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void moveItemToAvailableSlot(Player player, ItemStack item) {
|
||||||
|
// Attempt to move the existing item to an available slot
|
||||||
|
HashMap<Integer, ItemStack> overflow = player.getInventory().addItem(item);
|
||||||
|
if (!overflow.isEmpty()) {
|
||||||
|
// Check Ender Chest
|
||||||
|
if (player.getEnderChest().firstEmpty() != -1) {
|
||||||
|
player.getEnderChest().addItem(overflow.get(0));
|
||||||
|
player.sendMessage(ChatColor.YELLOW + "Your inventory was full, so an item was moved to your Ender Chest.");
|
||||||
|
} else {
|
||||||
|
// Drop the item at the player's location
|
||||||
|
player.getWorld().dropItemNaturally(player.getLocation(), overflow.get(0));
|
||||||
|
player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest were full, so an item was dropped on the ground.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public void givePrisonerKit(Player player) {
|
||||||
|
// if (!configManager.getBoolean("config.yml", "PrisonerKit", false)) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// FileConfiguration config = configManager.getConfig("config.yml");
|
||||||
|
// List<Map<?, ?>> kitItems = config.getMapList("PrisonerKitItems");
|
||||||
|
//
|
||||||
|
// for (Map<?, ?> itemSpec : kitItems) {
|
||||||
|
// Material material = Material.matchMaterial((String) itemSpec.get("item"));
|
||||||
|
// if (material == null) continue;
|
||||||
|
//
|
||||||
|
// ItemStack item = new ItemStack(material);
|
||||||
|
// ItemMeta meta = item.getItemMeta();
|
||||||
|
//
|
||||||
|
// // Configure item meta (name, lore, enchantments)...
|
||||||
|
// // This part remains the same as in your original method
|
||||||
|
//
|
||||||
|
// item.setItemMeta(meta);
|
||||||
|
//
|
||||||
|
// // Attempt to set the item in the specified slot
|
||||||
|
// if (itemSpec.containsKey("slot")) {
|
||||||
|
// int slot = (Integer) itemSpec.get("slot");
|
||||||
|
// ItemStack existingItem = player.getInventory().getItem(slot);
|
||||||
|
//
|
||||||
|
// // If the slot is occupied, try to find a new place for the existing item
|
||||||
|
// if (existingItem != null && existingItem.getType() != Material.AIR) {
|
||||||
|
// HashMap<Integer, ItemStack> failedItems = player.getInventory().addItem(existingItem);
|
||||||
|
//
|
||||||
|
// // If inventory is full, try ender chest or drop to the ground
|
||||||
|
// if (!failedItems.isEmpty()) {
|
||||||
|
// failedItems.forEach((integer, itemStack) -> {
|
||||||
|
// if (player.getEnderChest().firstEmpty() != -1) {
|
||||||
|
// player.getEnderChest().addItem(itemStack);
|
||||||
|
// player.sendMessage(ChatColor.YELLOW + "Some items were moved to your Ender Chest due to a full inventory.");
|
||||||
|
// } else {
|
||||||
|
// player.getWorld().dropItemNaturally(player.getLocation(), itemStack);
|
||||||
|
// player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest are full. Some items were dropped on the ground.");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Now we can safely place the kit item in the intended slot
|
||||||
|
// player.getInventory().setItem(slot, item);
|
||||||
|
// } else {
|
||||||
|
// // Slot is empty, just place the item there
|
||||||
|
// player.getInventory().setItem(slot, item);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // No specific slot defined, just add to inventory
|
||||||
|
// HashMap<Integer, ItemStack> failedItems = player.getInventory().addItem(item);
|
||||||
|
//
|
||||||
|
// // Handle full inventory as above
|
||||||
|
// if (!failedItems.isEmpty()) {
|
||||||
|
// failedItems.forEach((integer, itemStack) -> {
|
||||||
|
// if (player.getEnderChest().firstEmpty() != -1) {
|
||||||
|
// player.getEnderChest().addItem(itemStack);
|
||||||
|
// player.sendMessage(ChatColor.YELLOW + "Some items were moved to your Ender Chest due to a full inventory.");
|
||||||
|
// } else {
|
||||||
|
// player.getWorld().dropItemNaturally(player.getLocation(), itemStack);
|
||||||
|
// player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest are full. Some items were dropped on the ground.");
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package me.nvus.nvus_prison_setup.Kit.Listeners;
|
||||||
|
|
||||||
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
|
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
|
||||||
import me.nvus.nvus_prison_setup.Kit.KitManager;
|
import me.nvus.nvus_prison_setup.Kit.KitManager;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -91,7 +92,8 @@ public class KitListener implements Listener {
|
||||||
|
|
||||||
if (kitManager.isPrisonerKitItem(droppedItem)) {
|
if (kitManager.isPrisonerKitItem(droppedItem)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage("§c&lPER THE WARDEN: You cannot drop your prisoner kit items!");
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "§c&lPER THE WARDEN: You cannot drop your prisoner kit items!"));
|
||||||
|
// player.sendMessage("§c&lPER THE WARDEN: You cannot drop your prisoner kit items!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ public class KitListener implements Listener {
|
||||||
|
|
||||||
if (kitManager.isPrisonerKitItem(clickedItem)) {
|
if (kitManager.isPrisonerKitItem(clickedItem)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage("§cPER THE WARDEN: You cannot move your prisoner kit items!");
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "§c&lPER THE WARDEN: You cannot move your prisoner kit items!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class PlayerArmor implements Listener {
|
public class PlayerArmor implements Listener {
|
||||||
private final ConfigManager configManager;
|
private final ConfigManager configManager;
|
||||||
|
|
||||||
|
@ -27,25 +29,39 @@ public class PlayerArmor implements Listener {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (player.hasPermission("nvus.prisoner") && configManager.getConfig("config.yml").getBoolean("PrisonerArmor")) {
|
if (player.hasPermission("nvus.prisoner") && configManager.getConfig("config.yml").getBoolean("PrisonerArmor")) {
|
||||||
PlayerInventory inv = player.getInventory();
|
PlayerInventory inv = player.getInventory();
|
||||||
inv.setArmorContents(new ItemStack[]{
|
ItemStack[] currentArmor = inv.getArmorContents();
|
||||||
createArmor(Material.LEATHER_BOOTS, "Prisoner Boots"),
|
|
||||||
createArmor(Material.LEATHER_LEGGINGS, "Prisoner Leggings"),
|
for (int slot = 0; slot < currentArmor.length; slot++) {
|
||||||
createArmor(Material.LEATHER_CHESTPLATE, "Prisoner Chestplate"),
|
ItemStack armorPiece = currentArmor[slot];
|
||||||
createArmor(Material.LEATHER_HELMET, "Prisoner Helmet")
|
|
||||||
});
|
// Check if current armor piece is not a prisoner armor, if it's null or AIR (empty slot), or if it's already a prisoner armor piece
|
||||||
|
if (armorPiece != null && armorPiece.getType() != Material.AIR && !isPrisonerArmorItem(armorPiece)) {
|
||||||
|
// Move the non-prisoner armor piece safely before replacing
|
||||||
|
moveArmorToAvailableSlot(player, armorPiece, slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// After safely moving existing armor, equip new prisoner armor
|
||||||
|
equipPrisonerArmor(player);
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cPer The Warden: &6&lYou have been equipped with standard issue prisoner armor!"));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cPer The Warden: &6&lYou have been equipped with standard issue prisoner armor!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
|
if (!(event.getWhoClicked() instanceof Player)) return;
|
||||||
|
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
if (!player.hasPermission("nvus.prisoner")) return;
|
if (!player.hasPermission("nvus.prisoner")) return;
|
||||||
|
|
||||||
if (event.getClickedInventory() != null && (event.getClickedInventory().getType() == InventoryType.PLAYER || event.getClickedInventory().getType() == InventoryType.CRAFTING)) {
|
int slot = event.getSlot();
|
||||||
if (event.getSlotType() == InventoryType.SlotType.ARMOR || isArmorItem(event.getCurrentItem()) || isArmorItem(event.getCursor())) {
|
// Correct the slot checks for the inventory interaction
|
||||||
|
boolean isArmorInteraction = (slot >= 5 && slot <= 8) // Player inventory armor slots (1.8+)
|
||||||
|
|| (event.getClickedInventory() instanceof PlayerInventory && (slot == 39 || slot == 38 || slot == 37 || slot == 36)); // Correct slots for armor
|
||||||
|
|
||||||
|
if (isArmorInteraction && (isPrisonerArmorItem(event.getCurrentItem()) || isPrisonerArmorItem(event.getCursor()))) {
|
||||||
boolean restrictArmor = configManager.getConfig("config.yml").getBoolean("RestrictArmor");
|
boolean restrictArmor = configManager.getConfig("config.yml").getBoolean("RestrictArmor");
|
||||||
if (restrictArmor) {
|
if (restrictArmor) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -54,19 +70,21 @@ public class PlayerArmor implements Listener {
|
||||||
// If restrictArmor is false, allows the player to change armor freely.
|
// If restrictArmor is false, allows the player to change armor freely.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isArmorSlot(int slot) {
|
||||||
|
// Correct the method to align with how armor slots are identified in an InventoryClickEvent
|
||||||
|
return slot == 39 || slot == 38 || slot == 37 || slot == 36; // The slots for helmet, chestplate, leggings, and boots respectively.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Checks if the given item is a piece of prisoner armor.
|
// Checks if the given item is a piece of prisoner armor.
|
||||||
private boolean isArmorItem(ItemStack item) {
|
private boolean isPrisonerArmorItem(ItemStack item) {
|
||||||
if (item == null) {
|
if (item == null || !item.hasItemMeta()) return false;
|
||||||
return false;
|
|
||||||
}
|
String itemName = item.getItemMeta().getDisplayName();
|
||||||
Material type = item.getType();
|
// Adjust these checks based on how you identify prisoner armor items.
|
||||||
return type == Material.LEATHER_HELMET || type == Material.LEATHER_CHESTPLATE ||
|
return itemName != null && (itemName.contains("Prisoner Boots") || itemName.contains("Prisoner Leggings")
|
||||||
type == Material.LEATHER_LEGGINGS || type == Material.LEATHER_BOOTS ||
|
|| itemName.contains("Prisoner Chestplate") || itemName.contains("Prisoner Helmet"));
|
||||||
// Add checks for other armor materials if prisoners can have those
|
|
||||||
type == Material.CHAINMAIL_BOOTS || type == Material.IRON_HELMET;
|
|
||||||
// We can later add additional armor sets here if we allow customization of what is considered "prisoner armor".
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack createArmor(Material material, String name) {
|
private ItemStack createArmor(Material material, String name) {
|
||||||
|
@ -79,4 +97,37 @@ public class PlayerArmor implements Listener {
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void equipPrisonerArmor(Player player) {
|
||||||
|
ItemStack[] prisonerArmor = new ItemStack[]{
|
||||||
|
createArmor(Material.LEATHER_BOOTS, "Prisoner Boots"),
|
||||||
|
createArmor(Material.LEATHER_LEGGINGS, "Prisoner Leggings"),
|
||||||
|
createArmor(Material.LEATHER_CHESTPLATE, "Prisoner Chestplate"),
|
||||||
|
createArmor(Material.LEATHER_HELMET, "Prisoner Helmet")
|
||||||
|
};
|
||||||
|
player.getInventory().setArmorContents(prisonerArmor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void moveArmorToAvailableSlot(Player player, ItemStack armorPiece, int armorSlot) {
|
||||||
|
// Try to add the non-prisoner armor piece to the main inventory
|
||||||
|
HashMap<Integer, ItemStack> overflow = player.getInventory().addItem(armorPiece);
|
||||||
|
if (!overflow.isEmpty()) {
|
||||||
|
// Inventory was full, try the Ender Chest next
|
||||||
|
if (player.getEnderChest().firstEmpty() != -1) {
|
||||||
|
player.getEnderChest().addItem(overflow.get(0));
|
||||||
|
player.sendMessage(ChatColor.YELLOW + "Your inventory was full, so your " + armorPiece.getType() + " was moved to your Ender Chest.");
|
||||||
|
} else {
|
||||||
|
// Ender Chest was also full, drop the item at the player's location
|
||||||
|
player.getWorld().dropItemNaturally(player.getLocation(), overflow.get(0));
|
||||||
|
player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest were full, so your " + armorPiece.getType() + " was dropped on the ground.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Clear the original armor slot now that we've moved the item
|
||||||
|
player.getInventory().setItem(armorSlot + 36, new ItemStack(Material.AIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,11 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class PlayerSpawn implements Listener {
|
public class PlayerSpawn implements Listener {
|
||||||
private final ConfigManager configManager;
|
private final ConfigManager configManager;
|
||||||
|
|
||||||
|
@ -55,51 +58,72 @@ public class PlayerSpawn implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void equipPrisonerArmor(Player player) {
|
private void equipPrisonerArmor(Player player) {
|
||||||
// Create Prisoner Helmet
|
handleNonPrisonerArmorItems(player); // Ensure non-prisoner armor is handled before equipping new armor
|
||||||
ItemStack leatherHelmetPrison = new ItemStack(Material.LEATHER_HELMET);
|
|
||||||
LeatherArmorMeta helmetMeta = (LeatherArmorMeta) leatherHelmetPrison.getItemMeta();
|
// Define and equip standard prisoner armor
|
||||||
if (helmetMeta != null) {
|
ItemStack[] standardPrisonerArmor = new ItemStack[]{
|
||||||
helmetMeta.setColor(Color.ORANGE);
|
createArmor(Material.LEATHER_BOOTS, "Prisoner Boots"),
|
||||||
helmetMeta.setDisplayName(ChatColor.GOLD + "Prisoner Helmet");
|
createArmor(Material.LEATHER_LEGGINGS, "Prisoner Leggings"),
|
||||||
leatherHelmetPrison.setItemMeta(helmetMeta);
|
createArmor(Material.LEATHER_CHESTPLATE, "Prisoner Chestplate"),
|
||||||
|
createArmor(Material.LEATHER_HELMET, "Prisoner Helmet")
|
||||||
|
};
|
||||||
|
|
||||||
|
player.getInventory().setArmorContents(standardPrisonerArmor);
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cPer The Warden: &6&lYou have been equipped with standard issue prisoner armor!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Prisoner Chestplate
|
private ItemStack createArmor(Material material, String name) {
|
||||||
ItemStack leatherChestplatePrison = new ItemStack(Material.LEATHER_CHESTPLATE);
|
ItemStack item = new ItemStack(material);
|
||||||
LeatherArmorMeta chestplateMeta = (LeatherArmorMeta) leatherChestplatePrison.getItemMeta();
|
LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta();
|
||||||
if (chestplateMeta != null) {
|
if (meta != null) {
|
||||||
chestplateMeta.setColor(Color.ORANGE);
|
meta.setDisplayName(name);
|
||||||
chestplateMeta.setDisplayName(ChatColor.GOLD + "Prisoner Chestplate");
|
meta.setColor(Color.ORANGE); // Set the color for leather armor
|
||||||
leatherChestplatePrison.setItemMeta(chestplateMeta);
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Prisoner Leggings
|
private void handleNonPrisonerArmorItems(Player player) {
|
||||||
ItemStack leatherLeggingsPrison = new ItemStack(Material.LEATHER_LEGGINGS);
|
ItemStack[] armorContents = player.getInventory().getArmorContents();
|
||||||
LeatherArmorMeta leggingsMeta = (LeatherArmorMeta) leatherLeggingsPrison.getItemMeta();
|
|
||||||
if (leggingsMeta != null) {
|
for (int i = 0; i < armorContents.length; i++) {
|
||||||
leggingsMeta.setColor(Color.ORANGE);
|
ItemStack armorPiece = armorContents[i];
|
||||||
leggingsMeta.setDisplayName(ChatColor.GOLD + "Prisoner Leggings");
|
// Check if the armor piece is not part of the prisoner kit
|
||||||
leatherLeggingsPrison.setItemMeta(leggingsMeta);
|
if (armorPiece != null && armorPiece.getType() != Material.AIR && !isPrisonerArmorItem(armorPiece)) {
|
||||||
|
moveArmorToAvailableSlot(player, armorPiece);
|
||||||
|
armorContents[i] = new ItemStack(Material.AIR); // Remove the non-prisoner armor from the armor slot
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Prisoner Boots
|
// Update the player's armor contents after removals
|
||||||
ItemStack leatherBootsPrison = new ItemStack(Material.LEATHER_BOOTS);
|
player.getInventory().setArmorContents(armorContents);
|
||||||
LeatherArmorMeta bootsMeta = (LeatherArmorMeta) leatherBootsPrison.getItemMeta();
|
|
||||||
if (bootsMeta != null) {
|
|
||||||
bootsMeta.setColor(Color.ORANGE);
|
|
||||||
bootsMeta.setDisplayName(ChatColor.GOLD + "Prisoner Boots");
|
|
||||||
leatherBootsPrison.setItemMeta(bootsMeta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equip Prisoner Armor
|
private boolean isPrisonerArmorItem(ItemStack item) {
|
||||||
player.getInventory().setHelmet(leatherHelmetPrison);
|
if (item == null || !item.hasItemMeta()) return false;
|
||||||
player.getInventory().setChestplate(leatherChestplatePrison);
|
ItemMeta meta = item.getItemMeta();
|
||||||
player.getInventory().setLeggings(leatherLeggingsPrison);
|
String itemName = meta.getDisplayName();
|
||||||
player.getInventory().setBoots(leatherBootsPrison);
|
// Adjust the check based on your naming convention for prisoner armor
|
||||||
|
return itemName != null && itemName.contains("Prisoner");
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lPer The Warden: &6You've been given the default prisoner armor!"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void moveArmorToAvailableSlot(Player player, ItemStack armorPiece) {
|
||||||
|
// Attempt to move the existing armor piece to an available slot
|
||||||
|
HashMap<Integer, ItemStack> overflow = player.getInventory().addItem(armorPiece);
|
||||||
|
if (!overflow.isEmpty()) {
|
||||||
|
// Check Ender Chest
|
||||||
|
if (player.getEnderChest().firstEmpty() != -1) {
|
||||||
|
player.getEnderChest().addItem(overflow.get(0));
|
||||||
|
player.sendMessage(ChatColor.YELLOW + "Your inventory was full, so your armor was moved to your Ender Chest.");
|
||||||
|
} else {
|
||||||
|
// Drop the item at the player's location
|
||||||
|
player.getWorld().dropItemNaturally(player.getLocation(), overflow.get(0));
|
||||||
|
player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest were full, so your armor was dropped on the ground.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Destroy armor upon death etc.
|
// Destroy armor upon death etc.
|
||||||
private void destroyDefaultPrisonerArmor(Player player) {
|
private void destroyDefaultPrisonerArmor(Player player) {
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package me.nvus.nvus_prison_setup.Placeholders;
|
|
||||||
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CombinedPlaceholders extends PlaceholderExpansion {
|
|
||||||
private final PlaceholderManager placeholderManager;
|
|
||||||
|
|
||||||
public CombinedPlaceholders(PlaceholderManager placeholderManager) {
|
|
||||||
this.placeholderManager = placeholderManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "nvus";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthor() {
|
|
||||||
return "never2nv";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return "1.2";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String onPlaceholderRequest(Player player, String identifier) {
|
|
||||||
if (player == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (identifier) {
|
|
||||||
case "rank_current":
|
|
||||||
return placeholderManager.getCurrentRankName(player);
|
|
||||||
case "rank_next":
|
|
||||||
return placeholderManager.getNextRankName(player);
|
|
||||||
case "rank_cost":
|
|
||||||
double cost = placeholderManager.getNextRankCost(player);
|
|
||||||
return cost >= 0 ? String.format("$%.2f", cost) : "N/A";
|
|
||||||
case "gang_name":
|
|
||||||
return placeholderManager.getCurrentGangName(player);
|
|
||||||
case "gang_owner":
|
|
||||||
String gangName = placeholderManager.getCurrentGangName(player);
|
|
||||||
return placeholderManager.getGangOwnerName(gangName);
|
|
||||||
case "gang_members":
|
|
||||||
gangName = placeholderManager.getCurrentGangName(player);
|
|
||||||
return String.valueOf(placeholderManager.getGangMemberCount(gangName));
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -36,12 +36,12 @@ public class GangPlaceholders extends PlaceholderExpansion {
|
||||||
|
|
||||||
String gangName = gangManager.getCurrentGangName(player.getUniqueId());
|
String gangName = gangManager.getCurrentGangName(player.getUniqueId());
|
||||||
if (gangName == null) {
|
if (gangName == null) {
|
||||||
return "No Gang";
|
return " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
GangInfo gangInfo = gangManager.getGangInfo(gangName);
|
GangInfo gangInfo = gangManager.getGangInfo(gangName);
|
||||||
if (gangInfo == null) {
|
if (gangInfo == null) {
|
||||||
return "Gang information could not be retrieved.";
|
return " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (identifier) {
|
switch (identifier) {
|
||||||
|
|
|
@ -4,6 +4,10 @@ import me.nvus.nvus_prison_setup.Gangs.GangInfo;
|
||||||
import me.nvus.nvus_prison_setup.Gangs.GangManager;
|
import me.nvus.nvus_prison_setup.Gangs.GangManager;
|
||||||
import me.nvus.nvus_prison_setup.Ranks.Rank;
|
import me.nvus.nvus_prison_setup.Ranks.Rank;
|
||||||
import me.nvus.nvus_prison_setup.Ranks.RankManager;
|
import me.nvus.nvus_prison_setup.Ranks.RankManager;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlaceholderManager {
|
public class PlaceholderManager {
|
||||||
|
@ -39,8 +43,19 @@ public class PlaceholderManager {
|
||||||
return nextRank != null ? nextRank.getName() : "Max Rank";
|
return nextRank != null ? nextRank.getName() : "Max Rank";
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getNextRankCost(Player player) {
|
public String getNextRankCost(Player player) {
|
||||||
Rank nextRank = rankManager.getNextRank(player);
|
Rank nextRank = rankManager.getNextRank(player);
|
||||||
return nextRank != null ? nextRank.getCost() : -1;
|
if (nextRank != null) {
|
||||||
|
double cost = nextRank.getCost();
|
||||||
|
// Using the US locale as an example for currency formatting
|
||||||
|
NumberFormat currencyFormat = NumberFormat.getCurrencyInstance(Locale.US);
|
||||||
|
return currencyFormat.format(cost);
|
||||||
}
|
}
|
||||||
|
return "$0.00"; // or however you wish to indicate a null or zero value
|
||||||
|
}
|
||||||
|
|
||||||
|
// public double getNextRankCost(Player player) {
|
||||||
|
// Rank nextRank = rankManager.getNextRank(player);
|
||||||
|
// return nextRank != null ? nextRank.getCost() : -1;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
|
||||||
import me.nvus.nvus_prison_setup.Ranks.RankManager;
|
import me.nvus.nvus_prison_setup.Ranks.RankManager;
|
||||||
import me.nvus.nvus_prison_setup.Ranks.Rank;
|
import me.nvus.nvus_prison_setup.Ranks.Rank;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
public class RankPlaceholders extends PlaceholderExpansion {
|
public class RankPlaceholders extends PlaceholderExpansion {
|
||||||
|
|
||||||
private final RankManager rankManager;
|
private final RankManager rankManager;
|
||||||
|
@ -45,7 +47,16 @@ public class RankPlaceholders extends PlaceholderExpansion {
|
||||||
|
|
||||||
case "rank_cost":
|
case "rank_cost":
|
||||||
Rank rankForCost = rankManager.getNextRank(player);
|
Rank rankForCost = rankManager.getNextRank(player);
|
||||||
return rankForCost != null ? String.format("$%.2f", rankForCost.getCost()) : "N/A";
|
if (rankForCost != null) {
|
||||||
|
DecimalFormat decimalFormat = new DecimalFormat("$###,###.00");
|
||||||
|
return decimalFormat.format(rankForCost.getCost());
|
||||||
|
} else {
|
||||||
|
return "N/A";
|
||||||
|
}
|
||||||
|
|
||||||
|
// case "rank_cost":
|
||||||
|
// Rank rankForCost = rankManager.getNextRank(player);
|
||||||
|
// return rankForCost != null ? String.format("$%.2f", rankForCost.getCost()) : "N/A";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package me.nvus.nvus_prison_setup;
|
package me.nvus.nvus_prison_setup;
|
||||||
|
|
||||||
|
import me.nvus.nvus_prison_setup.AutoSell.MultiplierManager;
|
||||||
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
|
import me.nvus.nvus_prison_setup.Configs.ConfigManager;
|
||||||
import me.nvus.nvus_prison_setup.Kit.KitManager;
|
import me.nvus.nvus_prison_setup.Kit.KitManager;
|
||||||
import me.nvus.nvus_prison_setup.Configs.SettingsMenu;
|
import me.nvus.nvus_prison_setup.Configs.SettingsMenu;
|
||||||
|
@ -48,7 +49,9 @@ import java.sql.Statement;
|
||||||
|
|
||||||
public final class PrisonSetup extends JavaPlugin {
|
public final class PrisonSetup extends JavaPlugin {
|
||||||
|
|
||||||
|
private static PrisonSetup instance;
|
||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
|
private MultiplierManager multiplierManager;
|
||||||
private DatabaseManager dbManager;
|
private DatabaseManager dbManager;
|
||||||
private GangManager gangManager;
|
private GangManager gangManager;
|
||||||
|
|
||||||
|
@ -92,7 +95,7 @@ public final class PrisonSetup extends JavaPlugin {
|
||||||
|
|
||||||
// Check if Vault is installed, it's a hard dependency so disable plugin if not installed!
|
// Check if Vault is installed, it's a hard dependency so disable plugin if not installed!
|
||||||
if (!setupEconomy()) {
|
if (!setupEconomy()) {
|
||||||
getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
|
getLogger().severe(String.format("[%s] - Disabled! Vault needs to be installed!", getDescription().getName()));
|
||||||
getServer().getPluginManager().disablePlugin(this);
|
getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,22 +109,32 @@ public final class PrisonSetup extends JavaPlugin {
|
||||||
this.getCommand("nvus").setExecutor(new CommandListener(this, configManager));
|
this.getCommand("nvus").setExecutor(new CommandListener(this, configManager));
|
||||||
|
|
||||||
// Gang Related... GANG, GANG #LOLOLOLOL
|
// Gang Related... GANG, GANG #LOLOLOLOL
|
||||||
|
boolean gangsEnabled = configManager.getConfig("config.yml").getBoolean("PrisonerGangs", true);
|
||||||
|
if (gangsEnabled) {
|
||||||
this.getCommand("gang").setExecutor(new GangCommands(dbManager)); // Now correctly using initialized dbManager
|
this.getCommand("gang").setExecutor(new GangCommands(dbManager)); // Now correctly using initialized dbManager
|
||||||
// Register the Gangs placeholder expansion
|
// Register the Gangs placeholder expansion
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
// PlaceholderManager placeholderManager = new PlaceholderManager(gangManager, rankManager);
|
|
||||||
// new CombinedPlaceholders(placeholderManager).register();
|
|
||||||
new GangPlaceholders(gangManager).register();
|
new GangPlaceholders(gangManager).register();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Register the Auto Sell and Sell All Listeners
|
// Register the Auto Sell and Sell All Listeners
|
||||||
boolean autoSellEnabled = configManager.getConfig("config.yml").getBoolean("AutoSell", true);
|
boolean autoSellEnabled = configManager.getConfig("config.yml").getBoolean("AutoSell", true);
|
||||||
boolean sellAllEnabled = configManager.getConfig("config.yml").getBoolean("SellAll", true);
|
boolean sellAllEnabled = configManager.getConfig("config.yml").getBoolean("SellAll", true);
|
||||||
SellManager sellManager = new SellManager(configManager);
|
boolean sellMultiplierEnabled = configManager.getConfig("config.yml").getBoolean("SellMultiplier", true);
|
||||||
|
|
||||||
|
MultiplierManager multiplierManager = new MultiplierManager(this);
|
||||||
|
SellManager sellManager = new SellManager(configManager,multiplierManager);
|
||||||
|
this.getCommand("multiplier").setExecutor(multiplierManager);
|
||||||
this.getCommand("setprice").setExecutor(sellManager);
|
this.getCommand("setprice").setExecutor(sellManager);
|
||||||
|
|
||||||
|
// if (sellMultiplierEnabled) {
|
||||||
|
// this.getCommand("multiplier").setExecutor(new MultiplierManager(this));
|
||||||
|
// }
|
||||||
|
|
||||||
// If they are true, register the commands.
|
// If they are true, register the commands.
|
||||||
if (autoSellEnabled) {
|
if (autoSellEnabled) {
|
||||||
// Register the autosell command.
|
// Register the autosell command.
|
||||||
|
@ -262,4 +275,8 @@ public final class PrisonSetup extends JavaPlugin {
|
||||||
public GangManager getGangManager() {
|
public GangManager getGangManager() {
|
||||||
return gangManager;
|
return gangManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PrisonSetup getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
|
||||||
public class RankManager {
|
public class RankManager {
|
||||||
|
|
||||||
|
@ -36,7 +38,7 @@ public class RankManager {
|
||||||
public boolean rankUp(Player player) {
|
public boolean rankUp(Player player) {
|
||||||
Rank nextRank = getNextRank(player);
|
Rank nextRank = getNextRank(player);
|
||||||
if (nextRank == null) {
|
if (nextRank == null) {
|
||||||
player.sendMessage(ChatColor.RED + "You are already at the highest rank!");
|
player.sendMessage(ChatColor.RED + "You are already at the max rank!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,18 +48,50 @@ public class RankManager {
|
||||||
if (response.transactionSuccess()) {
|
if (response.transactionSuccess()) {
|
||||||
dbManager.updatePlayerRankData(player, nextRank);
|
dbManager.updatePlayerRankData(player, nextRank);
|
||||||
executeRankCommands(player, nextRank.getCommands());
|
executeRankCommands(player, nextRank.getCommands());
|
||||||
//player.sendMessage(ChatColor.GREEN + "Congratulations! You've been ranked up to " + nextRank.getName() + ".");
|
// Success message can also be formatted if needed
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + "Transaction failed: " + response.errorMessage);
|
player.sendMessage(ChatColor.RED + "Transaction failed: " + response.errorMessage);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + "You cannot afford to rank up. You need $" + nextRank.getCost() + ", but you only have $" + balance + ".");
|
DecimalFormat decimalFormat = new DecimalFormat("$###,###,###.00");
|
||||||
|
String formattedCost = decimalFormat.format(nextRank.getCost());
|
||||||
|
String formattedBalance = decimalFormat.format(balance);
|
||||||
|
player.sendMessage(" ");
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou cannot afford to rank up!"));
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6You need: &c" + formattedCost + "."));
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6But you only have: &a" + formattedBalance + "."));
|
||||||
|
player.sendMessage(" ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public boolean rankUp(Player player) {
|
||||||
|
// Rank nextRank = getNextRank(player);
|
||||||
|
// if (nextRank == null) {
|
||||||
|
// player.sendMessage(ChatColor.RED + "You are already at the max rank!");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// double balance = economy.getBalance(player);
|
||||||
|
// if (balance >= nextRank.getCost()) {
|
||||||
|
// EconomyResponse response = economy.withdrawPlayer(player, nextRank.getCost());
|
||||||
|
// if (response.transactionSuccess()) {
|
||||||
|
// dbManager.updatePlayerRankData(player, nextRank);
|
||||||
|
// executeRankCommands(player, nextRank.getCommands());
|
||||||
|
// //player.sendMessage(ChatColor.GREEN + "Congratulations! You've been ranked up to " + nextRank.getName() + ".");
|
||||||
|
// return true;
|
||||||
|
// } else {
|
||||||
|
// player.sendMessage(ChatColor.RED + "Transaction failed: " + response.errorMessage);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// player.sendMessage(ChatColor.RED + "You cannot afford to rank up. You need $" + nextRank.getCost() + ", but you only have $" + balance + ".");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private void executeRankCommands(Player player, List<String> commands) {
|
private void executeRankCommands(Player player, List<String> commands) {
|
||||||
if (commands == null || commands.isEmpty()) return;
|
if (commands == null || commands.isEmpty()) return;
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
|
@ -70,17 +104,34 @@ public class RankManager {
|
||||||
Rank currentRank = getCurrentRank(player);
|
Rank currentRank = getCurrentRank(player);
|
||||||
// Assuming you have a method to get all ranks sorted by cost
|
// Assuming you have a method to get all ranks sorted by cost
|
||||||
List<Rank> allRanks = dbManager.getAllRanksSorted();
|
List<Rank> allRanks = dbManager.getAllRanksSorted();
|
||||||
|
DecimalFormat decimalFormat = new DecimalFormat("$#,###.00");
|
||||||
for (Rank rank : allRanks) {
|
for (Rank rank : allRanks) {
|
||||||
ranksMessage.append(ChatColor.YELLOW).append(rank.getName())
|
ranksMessage.append(ChatColor.YELLOW).append(rank.getName())
|
||||||
.append(ChatColor.WHITE).append(" - $")
|
.append(ChatColor.WHITE).append(" - ")
|
||||||
.append(ChatColor.GREEN).append(rank.getCost()).append("\n");
|
.append(ChatColor.GREEN).append(decimalFormat.format(rank.getCost())).append("\n");
|
||||||
}
|
}
|
||||||
ranksMessage.append(ChatColor.GOLD + "\nYour current rank: " + ChatColor.YELLOW + currentRank.getName());
|
ranksMessage.append(ChatColor.GOLD + "\n<EFBFBD> Your current rank: " + ChatColor.YELLOW + currentRank.getName());
|
||||||
double balance = economy.getBalance(player);
|
double balance = economy.getBalance(player);
|
||||||
ranksMessage.append(ChatColor.GOLD + "\nYour balance: " + ChatColor.GREEN + "$" + balance);
|
ranksMessage.append(ChatColor.GOLD + "\n<EFBFBD> Your balance: " + ChatColor.GREEN + decimalFormat.format(balance));
|
||||||
return ranksMessage.toString();
|
return ranksMessage.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public String getRanksDisplay(Player player) {
|
||||||
|
// StringBuilder ranksMessage = new StringBuilder(ChatColor.GOLD + "Available Ranks:\n");
|
||||||
|
// Rank currentRank = getCurrentRank(player);
|
||||||
|
// // Assuming you have a method to get all ranks sorted by cost
|
||||||
|
// List<Rank> allRanks = dbManager.getAllRanksSorted();
|
||||||
|
// for (Rank rank : allRanks) {
|
||||||
|
// ranksMessage.append(ChatColor.YELLOW).append(rank.getName())
|
||||||
|
// .append(ChatColor.WHITE).append(" - $")
|
||||||
|
// .append(ChatColor.GREEN).append(rank.getCost()).append("\n");
|
||||||
|
// }
|
||||||
|
// ranksMessage.append(ChatColor.GOLD + "\n<EFBFBD> Your current rank: " + ChatColor.YELLOW + currentRank.getName());
|
||||||
|
// double balance = economy.getBalance(player);
|
||||||
|
// ranksMessage.append(ChatColor.GOLD + "\n<EFBFBD> Your balance: " + ChatColor.GREEN + "$" + balance);
|
||||||
|
// return ranksMessage.toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
public void assignDefaultRank(Player player) {
|
public void assignDefaultRank(Player player) {
|
||||||
dbManager.assignPlayerToDefaultRank(player);
|
dbManager.assignPlayerToDefaultRank(player);
|
||||||
|
|
|
@ -33,6 +33,11 @@ SellAll: true
|
||||||
# You can see material prices in the item_pricing.yml file or in-game using /sellprice <price> with an item in your hand.
|
# You can see material prices in the item_pricing.yml file or in-game using /sellprice <price> with an item in your hand.
|
||||||
# Only players/prisoners with the permission nvus.prisoner can use the /sellprice command and autosell toggle.
|
# Only players/prisoners with the permission nvus.prisoner can use the /sellprice command and autosell toggle.
|
||||||
|
|
||||||
|
# Should we allow the use of multipliers for selling items? ie 1.5x, 2x etc.
|
||||||
|
# These are admin commands that can be used by admins or other plugins like InfiniteVouchers etc. to give players a selling
|
||||||
|
# multiplier for a set amount of time. | /multiplier <player> 1.5 15m
|
||||||
|
SellMultiplier: True
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# ARMOR SETTINGS #
|
# ARMOR SETTINGS #
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
@ -115,10 +120,17 @@ TreeFarm: true
|
||||||
# PRISONER RANKS FEATURE #
|
# PRISONER RANKS FEATURE #
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
||||||
# Do you want to use the built-in /rankup and /maxrankup commands to rank prisoners up?
|
# Do you want to use the builand ht-in /rankup and /maxrankup commands to rank prisoners up?
|
||||||
# Can configure the ranks in the ranks.yml file!
|
# Can configure the ranks in the ranks.yml file!
|
||||||
PrisonerRanks: true
|
PrisonerRanks: true
|
||||||
|
|
||||||
|
########################################################################################
|
||||||
|
# PRISONER GANGS FEATURE #
|
||||||
|
########################################################################################
|
||||||
|
|
||||||
|
# Do you want to enable the Prisoner Gangs feature?
|
||||||
|
PrisonerGangs: true
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# DATABASE SETTINGS #
|
# DATABASE SETTINGS #
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
|
|
@ -59,6 +59,9 @@ commands:
|
||||||
usage: |
|
usage: |
|
||||||
/autosell - Toggle auto selling all eligible items in your inventory.
|
/autosell - Toggle auto selling all eligible items in your inventory.
|
||||||
aliases: [ automaticsell ]
|
aliases: [ automaticsell ]
|
||||||
|
multiplier:
|
||||||
|
description: Apply a selling multiplier to a player.
|
||||||
|
usage: /multiplier <player> <multiplier> <duration>
|
||||||
setprice:
|
setprice:
|
||||||
description: Set the price of the block being held in item_prices.yml. Set the price to 0 to remove it from the list!
|
description: Set the price of the block being held in item_prices.yml. Set the price to 0 to remove it from the list!
|
||||||
usage: |
|
usage: |
|
||||||
|
@ -85,3 +88,9 @@ permissions:
|
||||||
nvus.prisoner:
|
nvus.prisoner:
|
||||||
description: Allows access to NVus Prison prisoner features ie AutoSwitch,AutoSell,Restricting Armor etc.
|
description: Allows access to NVus Prison prisoner features ie AutoSwitch,AutoSell,Restricting Armor etc.
|
||||||
default: true
|
default: true
|
||||||
|
nvus.sellall:
|
||||||
|
description: Allows access to /sellall command, independent of nvus.prisoner permission.
|
||||||
|
default: false
|
||||||
|
nvus.autosell:
|
||||||
|
description: Allows access to /autosell command toggle, independent of nvus.prisoner permission.
|
||||||
|
default: false
|
Loading…
Reference in New Issue