v3.14.4.4

This commit is contained in:
rockyhawk64 2020-12-29 21:59:36 +11:00
parent f630b180fb
commit 2652704a9d
3 changed files with 64 additions and 33 deletions

View File

@ -1,4 +1,4 @@
version: 3.14.4.3
version: 3.14.4.4
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -79,38 +79,46 @@ public class Utils implements Listener {
commands = commandsAfterSequence;
for (int i = 0; commands.size() - 1 >= i; i++) {
try {
if (commands.get(i).split("\\s")[0].equalsIgnoreCase("right=")) {
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("right=", "").trim());
commands.set(i, commands.get(i).replace("RIGHT=", "").trim());
if (e.isLeftClick() || (e.isShiftClick() && e.isLeftClick()) || (e.isShiftClick() && e.isRightClick())) {
continue;
switch(commands.get(i).split("\\s")[0]){
case "right=":{
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("right=", "").trim());
if (e.getClick() != ClickType.RIGHT) {
continue;
}
break;
}
} else if (commands.get(i).split("\\s")[0].equalsIgnoreCase("rightshift=")) {
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("rightshift=", "").trim());
commands.set(i, commands.get(i).replace("RIGHTSHIFT=", "").trim());
if (e.isLeftClick() || (!e.isShiftClick() && e.isRightClick())) {
continue;
case "rightshift=":{
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("rightshift=", "").trim());
if (e.getClick() != ClickType.SHIFT_RIGHT) {
continue;
}
break;
}
}
if (commands.get(i).split("\\s")[0].equalsIgnoreCase("left=")) {
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("left=", "").trim());
commands.set(i, commands.get(i).replace("LEFT=", "").trim());
if (e.isRightClick() || (e.isShiftClick() && e.isRightClick()) || (e.isShiftClick() && e.isLeftClick())) {
continue;
case "left=":{
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("left=", "").trim());
if (e.getClick() != ClickType.LEFT) {
continue;
}
break;
}
} else if (commands.get(i).split("\\s")[0].equalsIgnoreCase("leftshift=")) {
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("leftshift=", "").trim());
commands.set(i, commands.get(i).replace("LEFTSHIFT=", "").trim());
if (e.isRightClick() || (!e.isShiftClick() && e.isLeftClick())) {
continue;
case "leftshift=":{
//if commands is for right clicking, remove the 'right=' and continue
commands.set(i, commands.get(i).replace("leftshift=", "").trim());
if (e.getClick() != ClickType.SHIFT_LEFT) {
continue;
}
break;
}
case "middle=":{
commands.set(i, commands.get(i).replace("middle=", "").trim());
if (e.getClick() != ClickType.MIDDLE) {
continue;
}
break;
}
}
if (!e.isLeftClick() && !e.isRightClick()) {
continue;
}
} catch (Exception click) {
//skip if you can't do this

View File

@ -15,6 +15,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.io.File;
import java.util.Objects;
import java.util.UUID;
public class CommandTags {
CommandPanels plugin;
@ -42,17 +43,29 @@ public class CommandTags {
break;
}
case "set-data=":{
//this will overwrite data. set-data= [data point] [data value]
if(command.split("\\s").length == 4){
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2],true);
break;
}
//this will overwrite data. set-data= [data point] [data value] [optional player]
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2],true);
break;
}
case "add-data=":{
//this will not overwrite existing data. add-data= [data point] [data value]
if(command.split("\\s").length == 4){
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2],true);
break;
}
//this will not overwrite existing data. add-data= [data point] [data value] [optional player]
plugin.panelData.setUserData(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2],false);
break;
}
case "math-data=":{
//only works if data is number, goes math-data= [data point] [operator:number] eg, math-data= -1 OR /3
if(command.split("\\s").length == 4){
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2],true);
break;
}
//only works if data is number, goes math-data= [data point] [operator:number] [optional player] eg, math-data= -1 OR /3
plugin.panelData.doDataMath(p.getUniqueId(),command.split("\\s")[1],command.split("\\s")[2]);
break;
}
@ -62,7 +75,11 @@ public class CommandTags {
break;
}
case "del-data=":{
//this will remove data. del-data= [data point]
if(command.split("\\s").length == 3){
plugin.panelData.setUserData(getOffline(command.split("\\s")[3]),command.split("\\s")[1],command.split("\\s")[2],true);
break;
}
//this will remove data. del-data= [data point] [optional player]
plugin.panelData.delUserData(p.getUniqueId(),command.split("\\s")[1]);
break;
}
@ -522,6 +539,12 @@ public class CommandTags {
}
}
@SuppressWarnings("deprecation")
private UUID getOffline(String playerName){
//making this a separate function as it is long and deprecated
return Bukkit.getOfflinePlayer(playerName).getUniqueId();
}
@SuppressWarnings("deprecation")
public int commandPayWall(Player p, String command) { //return 0 means no funds, 1 is they passed and 2 means paywall is not this command
String tag = plugin.config.getString("config.format.tag") + " ";