1.1.6 - Added money boosters/selling multiplier commands which can be used with voucher plugins! Also added additional permissions (optional) for /autosell and /sellall to allow non-prisoners to still use thoe features!
This commit is contained in:
parent
d51b1570b9
commit
6822f23dcc
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>me.NVus</groupId>
|
||||
<artifactId>NVus_Prison</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.6</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>NVus_PrisonSetup</name>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.nvus.nvus_prison_setup.AutoSell.Listeners;
|
||||
|
||||
import me.nvus.nvus_prison_setup.AutoSell.SellManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -20,10 +19,10 @@ public class AutoSellListener implements Listener {
|
|||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!player.hasPermission("nvus.prisoner") || !player.hasPermission("nvus.autosell") || !sellManager.isAutoSellEnabled(player)) {
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou do not have permission to use this command."));
|
||||
return;
|
||||
}
|
||||
// Added additional permission check
|
||||
if ((sellManager.isAutoSellEnabled(player)) ) {
|
||||
sellManager.sellItems(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,16 +54,18 @@ public class SellManager implements CommandExecutor {
|
|||
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("Only players can use this command.");
|
||||
sender.sendMessage(ChatColor.RED + "Only players can use this command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
// Admin Commands:
|
||||
if ("setprice".equalsIgnoreCase(command.getName())) {
|
||||
if (player.hasPermission("nvus.admin")) {
|
||||
if ("setprice".equalsIgnoreCase(label)) {
|
||||
if (!player.hasPermission("nvus.admin")) {
|
||||
player.sendMessage(ChatColor.RED + "You do not have permission to set prices.");
|
||||
return true;
|
||||
}
|
||||
if (args.length != 1) {
|
||||
player.sendMessage(ChatColor.RED + "Usage: /setprice <price>");
|
||||
return true;
|
||||
|
@ -74,25 +76,34 @@ public class SellManager implements CommandExecutor {
|
|||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + "Please provide a valid price.");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "You do not have permission to set prices.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Player/Prisoner Commands:
|
||||
switch (command.getName().toLowerCase()) {
|
||||
switch (label.toLowerCase()) {
|
||||
case "autosell":
|
||||
if (player.hasPermission("nvus.prisoner") || player.hasPermission("nvus.autosell")) {
|
||||
toggleAutoSell(player);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "You do not have permission to use /autosell.");
|
||||
}
|
||||
break;
|
||||
case "sellall":
|
||||
if (player.hasPermission("nvus.prisoner") || player.hasPermission("nvus.sellall")) {
|
||||
sellItems(player);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "You do not have permission to use /sellall.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// More commands in future? xD
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void loadPrices() {
|
||||
FileConfiguration itemPricesConfig = configManager.getItemPricesConfig();
|
||||
ConfigurationSection pricesSection = itemPricesConfig.getConfigurationSection("Prices");
|
||||
|
@ -169,10 +180,10 @@ public class SellManager implements CommandExecutor {
|
|||
}
|
||||
|
||||
public void sellItems(Player player) {
|
||||
if (!player.hasPermission("nvus.prisoner") || !player.hasPermission("nvus.sellall")) {
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou do not have permission to use this command."));
|
||||
return;
|
||||
}
|
||||
// if (player.hasPermission("nvus.prisoner") || player.hasPermission("nvus.sellall")) {
|
||||
// player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lYou do not have permission to use this command."));
|
||||
// return;
|
||||
// }
|
||||
|
||||
Map<Material, Integer> soldItems = new HashMap<>();
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ TreeFarm: true
|
|||
# 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!
|
||||
PrisonerRanks: true
|
||||
|
||||
|
|
Loading…
Reference in New Issue