forked from Upstream/CommandPanels
3.17.4.0
This commit is contained in:
parent
d01d54fe43
commit
f35e96138d
@ -55,6 +55,9 @@ purchase:
|
||||
currency:
|
||||
success: '&aSuccessfully Bought For $%cp-args%'
|
||||
failure: '&cInsufficient Funds!'
|
||||
data:
|
||||
success: '&aSuccessfully Bought For $%cp-args%'
|
||||
failure: '&cInsufficient Funds!'
|
||||
tokens:
|
||||
success: '&aSuccessfully Bought For %cp-args% Tokens.'
|
||||
failure: '&cInsufficient Tokens!'
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 3.17.3.1
|
||||
version: 3.17.4.0
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -7,6 +7,8 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Commandpanelsdata implements CommandExecutor {
|
||||
CommandPanels plugin;
|
||||
public Commandpanelsdata(CommandPanels pl) { this.plugin = pl; }
|
||||
@ -14,24 +16,34 @@ public class Commandpanelsdata implements CommandExecutor {
|
||||
@EventHandler
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender.hasPermission("commandpanel.data")) {
|
||||
boolean sendPlayerMessage = true;
|
||||
//if the first argument is -s it will not send a message to the sender
|
||||
if(args[0].equalsIgnoreCase("-s")){
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
sendPlayerMessage = false;
|
||||
}
|
||||
if(args.length == 2){
|
||||
//for the clear command
|
||||
if(args[0].equals("clear")){
|
||||
plugin.panelData.clearData(plugin.panelData.getOffline(args[1]));
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Cleared all data for "
|
||||
+ ChatColor.WHITE + args[1]));
|
||||
if(sendPlayerMessage) {
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Cleared all data for "
|
||||
+ ChatColor.WHITE + args[1]));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}else if (args.length == 3){
|
||||
//for the remove command
|
||||
if(args[0].equals("remove")) {
|
||||
plugin.panelData.delUserData(plugin.panelData.getOffline(args[1]), args[2]);
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Removed "
|
||||
+ ChatColor.WHITE + args[2]
|
||||
+ ChatColor.GREEN + " from "
|
||||
+ ChatColor.WHITE + args[1]));
|
||||
if(sendPlayerMessage) {
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Removed "
|
||||
+ ChatColor.WHITE + args[2]
|
||||
+ ChatColor.GREEN + " from "
|
||||
+ ChatColor.WHITE + args[1]));
|
||||
}
|
||||
return true;
|
||||
}else if(args[0].equals("get")){
|
||||
//for the get command
|
||||
@ -44,23 +56,26 @@ public class Commandpanelsdata implements CommandExecutor {
|
||||
if(args[0].equals("set")){
|
||||
//for set command
|
||||
plugin.panelData.setUserData(plugin.panelData.getOffline(args[1]), args[2],args[3],true);
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Set "
|
||||
+ ChatColor.WHITE + args[2]
|
||||
+ ChatColor.GREEN + " to "
|
||||
+ ChatColor.WHITE + args[3]));
|
||||
return true;
|
||||
if(sendPlayerMessage) {
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Set "
|
||||
+ ChatColor.WHITE + args[2]
|
||||
+ ChatColor.GREEN + " to "
|
||||
+ ChatColor.WHITE + args[3]));
|
||||
}
|
||||
}else{
|
||||
//for add command
|
||||
plugin.panelData.setUserData(plugin.panelData.getOffline(args[1]), args[2],args[3],false);
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Set "
|
||||
+ ChatColor.WHITE + args[2]
|
||||
+ ChatColor.GREEN + " to "
|
||||
+ ChatColor.WHITE + args[3])
|
||||
+ ChatColor.GREEN + " if it did not exist already");
|
||||
return true;
|
||||
if(sendPlayerMessage) {
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag
|
||||
+ ChatColor.GREEN + "Set "
|
||||
+ ChatColor.WHITE + args[2]
|
||||
+ ChatColor.GREEN + " to "
|
||||
+ ChatColor.WHITE + args[3])
|
||||
+ ChatColor.GREEN + " if it did not exist already");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.RED + "Usage: /cpdata <set:add:get:remove:clear> <player> <data> [value]"));
|
||||
}else{
|
||||
|
@ -315,6 +315,24 @@ public class CommandTags {
|
||||
return PaywallOutput.Blocked;
|
||||
}
|
||||
}
|
||||
case "data-paywall=": {
|
||||
//if player uses data-paywall= <data> <amount>
|
||||
try {
|
||||
if (Double.parseDouble(plugin.panelData.getUserData(p.getUniqueId(),command.split("\\s")[1])) >= Double.parseDouble(command.split("\\s")[2])) {
|
||||
plugin.panelData.doDataMath(p.getUniqueId(),command.split("\\s")[1],"-" + plugin.tex.placeholdersNoColour(panel,PanelPosition.Top,p,command.split("\\s")[2]));
|
||||
//if the message is empty don't send
|
||||
plugin.tex.sendString(p,Objects.requireNonNull(plugin.config.getString("purchase.data.success")).replaceAll("%cp-args%", command.split("\\s")[2]));
|
||||
return PaywallOutput.Passed;
|
||||
} else {
|
||||
plugin.tex.sendString(p, plugin.config.getString("purchase.data.failure"));
|
||||
return PaywallOutput.Blocked;
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc,p);
|
||||
plugin.tex.sendString(p, tag + plugin.config.getString("config.format.error") + " " + "commands: " + command);
|
||||
return PaywallOutput.Blocked;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PaywallOutput.NotApplicable;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.rockyhawk.commandpanels.openwithitem;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.ioclasses.GetItemInHand;
|
||||
import me.rockyhawk.commandpanels.ioclasses.GetItemInHand_Legacy;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -18,7 +17,6 @@ import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class UtilsOpenWithItem implements Listener {
|
||||
|
Loading…
Reference in New Issue
Block a user