forked from Upstream/CommandPanels
v3.14.1.3
This commit is contained in:
parent
25f3fcf999
commit
2d55159924
@ -1,4 +1,4 @@
|
||||
version: 3.14.1.2
|
||||
version: 3.14.1.3
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -101,7 +101,7 @@ public class CommandTags {
|
||||
this.cancel();
|
||||
}
|
||||
}.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
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("console=", "").trim());
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("buy=")) {
|
||||
@ -423,8 +423,11 @@ public class CommandTags {
|
||||
plugin.debug(ss);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("sudo=")) {
|
||||
//if player uses sudo= [command]
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("send=")) {
|
||||
//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());
|
||||
} else {
|
||||
Bukkit.dispatchCommand(p, command);
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,7 +44,11 @@ public class ExecuteOpenVoids {
|
||||
return;
|
||||
}
|
||||
//close the panel after the checks for permissions and worlds, so other panels can load
|
||||
if(!plugin.openPanels.hasPanelOpen(p.getName()) && p.getOpenInventory().getType() != InventoryType.CRAFTING){
|
||||
p.closeInventory();
|
||||
}else{
|
||||
plugin.openPanels.closePanelsForLoader(p.getName());
|
||||
}
|
||||
try {
|
||||
if (cf.contains("sound-on-open")) {
|
||||
//play sound when panel is opened
|
||||
|
@ -105,7 +105,12 @@ public class Commandpanelrefresher implements Listener {
|
||||
try {
|
||||
p.updateInventory();
|
||||
for (ItemStack playerContent : plugin.legacy.getStorageContents(p.getInventory())) {
|
||||
//ensure the panel item is not a placeable item
|
||||
int itemSlot = 0;
|
||||
for (ItemStack panelContent : panelItemList) {
|
||||
if(cf.getStringList("item." + itemSlot + ".itemType").contains("placeable")){
|
||||
continue;
|
||||
}
|
||||
if (playerContent != null && panelContent != null) {
|
||||
if (!playerContent.getType().equals(Material.matchMaterial("AIR")) && !panelContent.getType().equals(Material.matchMaterial("AIR"))) {
|
||||
if (playerContent.equals(panelContent)) {
|
||||
@ -123,6 +128,7 @@ public class Commandpanelrefresher implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
itemSlot++;
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
16
src/me/rockyhawk/commandpanels/ioclasses/GetItemInHand.java
Normal file
16
src/me/rockyhawk/commandpanels/ioclasses/GetItemInHand.java
Normal 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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
package me.rockyhawk.commandpanels.openwithitem;
|
||||
|
||||
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.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -350,7 +354,14 @@ public class UtilsOpenWithItem implements Listener {
|
||||
}catch(Exception b){
|
||||
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;
|
||||
ConfigurationSection tempFile;
|
||||
for(String[] panelName : plugin.panelNames){
|
||||
|
Loading…
Reference in New Issue
Block a user