v3.14.1.3

This commit is contained in:
rockyhawk64 2020-12-05 23:38:12 +11:00
parent 25f3fcf999
commit 2d55159924
7 changed files with 64 additions and 6 deletions

View File

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

View File

@ -101,7 +101,7 @@ public class CommandTags {
this.cancel(); this.cancel();
} }
}.runTaskTimer(plugin, 20*delaySeconds, 20); //20 ticks == 1 second }.runTaskTimer(plugin, 20*delaySeconds, 20); //20 ticks == 1 second
} else if (command.split("\\s")[0].equalsIgnoreCase("console=")) { }else if (command.split("\\s")[0].equalsIgnoreCase("console=")) {
//if player uses console= it will perform command in the console //if player uses console= it will perform command in the console
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("console=", "").trim()); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("console=", "").trim());
}else if (command.split("\\s")[0].equalsIgnoreCase("buy=")) { }else if (command.split("\\s")[0].equalsIgnoreCase("buy=")) {
@ -423,8 +423,11 @@ public class CommandTags {
plugin.debug(ss); plugin.debug(ss);
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command)); p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
} }
} else if (command.split("\\s")[0].equalsIgnoreCase("sudo=")) { }else if (command.split("\\s")[0].equalsIgnoreCase("send=")) {
//if player uses sudo= [command] //if player uses send= [message] to send a message as them
p.chat( command.replaceAll("send=", "").trim());
}else if (command.split("\\s")[0].equalsIgnoreCase("sudo=")) {
//if player uses sudo= [command] to send a command as them
p.chat( "/" + command.replaceAll("sudo=", "").trim()); p.chat( "/" + command.replaceAll("sudo=", "").trim());
} else { } else {
Bukkit.dispatchCommand(p, command); Bukkit.dispatchCommand(p, command);

View File

@ -6,6 +6,7 @@ import org.bukkit.Sound;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.List; import java.util.List;
@ -43,7 +44,11 @@ public class ExecuteOpenVoids {
return; return;
} }
//close the panel after the checks for permissions and worlds, so other panels can load //close the panel after the checks for permissions and worlds, so other panels can load
plugin.openPanels.closePanelsForLoader(p.getName()); if(!plugin.openPanels.hasPanelOpen(p.getName()) && p.getOpenInventory().getType() != InventoryType.CRAFTING){
p.closeInventory();
}else{
plugin.openPanels.closePanelsForLoader(p.getName());
}
try { try {
if (cf.contains("sound-on-open")) { if (cf.contains("sound-on-open")) {
//play sound when panel is opened //play sound when panel is opened

View File

@ -105,7 +105,12 @@ public class Commandpanelrefresher implements Listener {
try { try {
p.updateInventory(); p.updateInventory();
for (ItemStack playerContent : plugin.legacy.getStorageContents(p.getInventory())) { for (ItemStack playerContent : plugin.legacy.getStorageContents(p.getInventory())) {
//ensure the panel item is not a placeable item
int itemSlot = 0;
for (ItemStack panelContent : panelItemList) { for (ItemStack panelContent : panelItemList) {
if(cf.getStringList("item." + itemSlot + ".itemType").contains("placeable")){
continue;
}
if (playerContent != null && panelContent != null) { if (playerContent != null && panelContent != null) {
if (!playerContent.getType().equals(Material.matchMaterial("AIR")) && !panelContent.getType().equals(Material.matchMaterial("AIR"))) { if (!playerContent.getType().equals(Material.matchMaterial("AIR")) && !panelContent.getType().equals(Material.matchMaterial("AIR"))) {
if (playerContent.equals(panelContent)) { if (playerContent.equals(panelContent)) {
@ -123,6 +128,7 @@ public class Commandpanelrefresher implements Listener {
} }
} }
} }
itemSlot++;
} }
} }
}catch(Exception e){ }catch(Exception e){

View File

@ -0,0 +1,16 @@
package me.rockyhawk.commandpanels.ioclasses;
import me.rockyhawk.commandpanels.CommandPanels;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class GetItemInHand {
CommandPanels plugin;
public GetItemInHand(CommandPanels pl) {
this.plugin = pl;
}
public ItemStack itemInHand(Player p){
return p.getInventory().getItemInMainHand();
}
}

View File

@ -0,0 +1,17 @@
package me.rockyhawk.commandpanels.ioclasses;
import me.rockyhawk.commandpanels.CommandPanels;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class GetItemInHand_Legacy {
CommandPanels plugin;
public GetItemInHand_Legacy(CommandPanels pl) {
this.plugin = pl;
}
@SuppressWarnings("deprecation")
public ItemStack itemInHand(Player p){
return p.getInventory().getItemInHand();
}
}

View File

@ -1,6 +1,10 @@
package me.rockyhawk.commandpanels.openwithitem; package me.rockyhawk.commandpanels.openwithitem;
import me.rockyhawk.commandpanels.CommandPanels; import me.rockyhawk.commandpanels.CommandPanels;
import me.rockyhawk.commandpanels.ioclasses.GetItemInHand;
import me.rockyhawk.commandpanels.ioclasses.GetItemInHand_Legacy;
import me.rockyhawk.commandpanels.ioclasses.Sequence_1_14;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -350,7 +354,14 @@ public class UtilsOpenWithItem implements Listener {
}catch(Exception b){ }catch(Exception b){
return; return;
} }
ItemStack clicked = e.getPlayer().getInventory().getItemInMainHand();
ItemStack clicked;
if(Bukkit.getVersion().contains("1.8")){
clicked = new GetItemInHand_Legacy(plugin).itemInHand(p);
}else{
clicked = new GetItemInHand(plugin).itemInHand(p);
}
String tempName; String tempName;
ConfigurationSection tempFile; ConfigurationSection tempFile;
for(String[] panelName : plugin.panelNames){ for(String[] panelName : plugin.panelNames){