This commit is contained in:
rockyhawk64 2021-10-24 14:49:09 +11:00
parent 156e5ccb83
commit 1cb26d35f3
4 changed files with 12 additions and 3 deletions

View File

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

View File

@ -82,6 +82,7 @@ public class Panel{
return plugin.itemCreate.makeCustomItemFromConfig(this,PanelPosition.Top,itemSection, p, true, true, false); return plugin.itemCreate.makeCustomItemFromConfig(this,PanelPosition.Top,itemSection, p, true, true, false);
} }
//NBT will equal to panelName:slot and the slot will be -1 if item is not stationery
public ItemStack getHotbarItem(Player p){ public ItemStack getHotbarItem(Player p){
ItemStack s = plugin.itemCreate.makeItemFromConfig(this,PanelPosition.Top,getHotbarSection(p), p, true, true, false); ItemStack s = plugin.itemCreate.makeItemFromConfig(this,PanelPosition.Top,getHotbarSection(p), p, true, true, false);
int slot = -1; int slot = -1;

View File

@ -71,7 +71,12 @@ public class BasicTags implements Listener {
if(e.name.equalsIgnoreCase("sound=")) { if(e.name.equalsIgnoreCase("sound=")) {
e.commandTagUsed(); e.commandTagUsed();
try { try {
if(e.args.length == 3){
//volume (0.0 to 1.0), pitch (0.5 to 2.0)
e.p.playSound(e.p.getLocation(), Sound.valueOf(e.args[0]), Float.parseFloat(e.args[1]), Float.parseFloat(e.args[2]));
}else{
e.p.playSound(e.p.getLocation(), Sound.valueOf(e.args[0]), 1F, 1F); e.p.playSound(e.p.getLocation(), Sound.valueOf(e.args[0]), 1F, 1F);
}
} catch (Exception s) { } catch (Exception s) {
plugin.debug(s, e.p); plugin.debug(s, e.p);
plugin.tex.sendMessage(e.p, plugin.config.getString("config.format.error") + " " + "commands: " + e.args[0]); plugin.tex.sendMessage(e.p, plugin.config.getString("config.format.error") + " " + "commands: " + e.args[0]);

View File

@ -120,8 +120,11 @@ public class HotbarItemLoader {
for(int i = 0; i <= 35; i++){ for(int i = 0; i <= 35; i++){
try { try {
if (plugin.nbt.getNBT(p.getInventory().getItem(i), "CommandPanelsHotbar") != null) { if (plugin.nbt.getNBT(p.getInventory().getItem(i), "CommandPanelsHotbar") != null) {
//do not remove items that are not stationary
if(!plugin.nbt.getNBT(p.getInventory().getItem(i), "CommandPanelsHotbar").endsWith("-1")) {
p.getInventory().setItem(i, new ItemStack(Material.AIR)); p.getInventory().setItem(i, new ItemStack(Material.AIR));
} }
}
}catch(NullPointerException | IllegalArgumentException ignore){} }catch(NullPointerException | IllegalArgumentException ignore){}
} }