This commit is contained in:
rockyhawk64 2021-07-14 21:51:20 +10:00
parent 84c83affab
commit 5a28956c8f
4 changed files with 24 additions and 16 deletions

View File

@ -25,6 +25,14 @@ panels:
- '&8Example Panel made by:' - '&8Example Panel made by:'
- '&8RockyHawk' - '&8RockyHawk'
'8': '8':
material: ENDER_PEARL
name: '&bOpen Player Browser'
lore:
- '&7The Player Browser requires'
- '&7PlaceholderAPI with the Math extension'
hasvalue0:
compare: '%math_0:_1+1%'
value: '2'
material: ENDER_PEARL material: ENDER_PEARL
name: '&bOpen Player Browser' name: '&bOpen Player Browser'
commands: commands:

View File

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

View File

@ -121,7 +121,7 @@ public class Placeholders {
String ip_port = identifier.replace("server-", ""); String ip_port = identifier.replace("server-", "");
Socket s = new Socket(); Socket s = new Socket();
try { try {
s.connect(new InetSocketAddress(ip_port.split(":")[0], Integer.parseInt(ip_port.split(":")[1])), plugin.config.getInt("config.server-ping-timeout")); s.connect(new InetSocketAddress(ip_port.split(":")[0], (int)Double.parseDouble(ip_port.split(":")[1])), plugin.config.getInt("config.server-ping-timeout"));
s.close(); s.close();
return "true"; return "true";
}catch (IOException ex){ }catch (IOException ex){
@ -134,7 +134,7 @@ public class Placeholders {
try { try {
String slot_key = identifier.replace("nbt-", ""); String slot_key = identifier.replace("nbt-", "");
String value; String value;
value = plugin.nbt.getNBT(p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(slot_key.split(":")[0])),slot_key.split(":")[1]); value = plugin.nbt.getNBT(p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(slot_key.split(":")[0])),slot_key.split(":")[1]);
if(value == null){ if(value == null){
value = "empty"; value = "empty";
} }
@ -152,10 +152,10 @@ public class Placeholders {
String matNumber = identifier.replace("material-", ""); String matNumber = identifier.replace("material-", "");
String material; String material;
try { try {
material = p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(matNumber)).getType().toString(); material = p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getType().toString();
if (plugin.legacy.LOCAL_VERSION.lessThanOrEqualTo(MinecraftVersions.v1_12)) { if (plugin.legacy.LOCAL_VERSION.lessThanOrEqualTo(MinecraftVersions.v1_12)) {
//add the ID to the end if it is legacy (eg, material:id) //add the ID to the end if it is legacy (eg, material:id)
material = material + ":" + p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(matNumber)).getType().getId(); material = material + ":" + p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getType().getId();
} }
} catch (NullPointerException er) { } catch (NullPointerException er) {
material = "AIR"; material = "AIR";
@ -172,7 +172,7 @@ public class Placeholders {
String matNumber = identifier.replace("stack-", ""); String matNumber = identifier.replace("stack-", "");
int amount; int amount;
try { try {
amount = p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(matNumber)).getAmount(); amount = p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getAmount();
} catch (NullPointerException er) { } catch (NullPointerException er) {
amount = 0; amount = 0;
} }
@ -188,7 +188,7 @@ public class Placeholders {
String matNumber = identifier.replace("modeldata-", ""); String matNumber = identifier.replace("modeldata-", "");
int modelData; int modelData;
try { try {
modelData = p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(matNumber)).getItemMeta().getCustomModelData(); modelData = p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber)).getItemMeta().getCustomModelData();
} catch (NullPointerException er) { } catch (NullPointerException er) {
modelData = 0; modelData = 0;
} }
@ -203,7 +203,7 @@ public class Placeholders {
try { try {
String matNumber = identifier.replace("damaged-", ""); String matNumber = identifier.replace("damaged-", "");
boolean damaged = false; boolean damaged = false;
ItemStack itm = p.getOpenInventory().getTopInventory().getItem(Integer.parseInt(matNumber)); ItemStack itm = p.getOpenInventory().getTopInventory().getItem((int)Double.parseDouble(matNumber));
try { try {
if(plugin.legacy.LOCAL_VERSION.lessThanOrEqualTo(MinecraftVersions.v1_15)){ if(plugin.legacy.LOCAL_VERSION.lessThanOrEqualTo(MinecraftVersions.v1_15)){
if(itm.getType().getMaxDurability() != 0) { if(itm.getType().getMaxDurability() != 0) {
@ -227,7 +227,7 @@ public class Placeholders {
try { try {
String matLocSlot = identifier.replace("identical-", ""); String matLocSlot = identifier.replace("identical-", "");
String matLoc = matLocSlot.split(",")[0]; String matLoc = matLocSlot.split(",")[0];
int matSlot = Integer.parseInt(matLocSlot.split(",")[1]); int matSlot = (int)Double.parseDouble(matLocSlot.split(",")[1]);
boolean isIdentical = false; boolean isIdentical = false;
ItemStack itm = p.getOpenInventory().getTopInventory().getItem(matSlot); ItemStack itm = p.getOpenInventory().getTopInventory().getItem(matSlot);
@ -268,8 +268,8 @@ public class Placeholders {
if(identifier.startsWith("random-")) { if(identifier.startsWith("random-")) {
try { try {
String min_max = identifier.replace("random-", ""); String min_max = identifier.replace("random-", "");
int min = Integer.parseInt(min_max.split(",")[0]); int min = (int)Double.parseDouble(min_max.split(",")[0]);
int max = Integer.parseInt(min_max.split(",")[1]); int max = (int)Double.parseDouble(min_max.split(",")[1]);
return String.valueOf(plugin.getRandomNumberInRange(min, max)); return String.valueOf(plugin.getRandomNumberInRange(min, max));
}catch (Exception ex){ }catch (Exception ex){
plugin.debug(ex,p); plugin.debug(ex,p);
@ -323,10 +323,10 @@ public class Placeholders {
try { try {
String playerLocation = identifier.replace("player-online-", ""); String playerLocation = identifier.replace("player-online-", "");
Player[] playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]); Player[] playerFind = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]);
if (Integer.parseInt(playerLocation) > playerFind.length) { if (Double.parseDouble(playerLocation) > playerFind.length) {
return plugin.tex.colour(Objects.requireNonNull(plugin.config.getString("config.format.offline"))); return plugin.tex.colour(Objects.requireNonNull(plugin.config.getString("config.format.offline")));
} else { } else {
return playerFind[Integer.parseInt(playerLocation) - 1].getName(); return playerFind[(int)(Double.parseDouble(playerLocation) - 1)].getName();
} }
}catch (Exception ex){ }catch (Exception ex){
plugin.debug(ex,p); plugin.debug(ex,p);

View File

@ -56,7 +56,7 @@ public class CommandPanelImport implements CommandExecutor {
} }
sender.sendMessage(plugin.tag + ChatColor.GREEN + "Finished downloading."); sender.sendMessage(plugin.tag + ChatColor.GREEN + "Finished downloading.");
} catch (Exception var22) { } catch (Exception var22) {
sender.sendMessage(ChatColor.RED + "Could not download panel."); sender.sendMessage(plugin.tag + ChatColor.RED + "Could not download panel.");
} finally { } finally {
try { try {
if (in != null) { if (in != null) {