mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Nolonger spawn item in non-air block
Former-commit-id: 5f11acf6d52f61872e1f83ad6ce31ee267475aa8 [formerly 0eed4a03787e370882a150fff8d5a8f1e2cf2e0e] Former-commit-id: 6b3c7f4b8d9115c344e9eb158ae7f1deedd70efc
This commit is contained in:
1 parent
e3abe27eb1
commit
bfefb13a0c
4 files changed
+32
-11
No files matched your search
@@ -26,7 +26,7 @@ public class Tab implements TabCompleter {
|
||||
//Make all is low case
|
||||
}
|
||||
ArrayList<String> tabList = new ArrayList<>();
|
||||
if (args.length == 1 || args.length == 0) {
|
||||
if (args.length == 0) {
|
||||
if (sender.hasPermission("quickshop.unlimited"))
|
||||
tabList.add("unlimited");
|
||||
if (sender.hasPermission("quickshop.setowner"))
|
||||
@@ -58,28 +58,28 @@ public class Tab implements TabCompleter {
|
||||
if (sender.hasPermission("quickshop.paste"))
|
||||
tabList.add("paste");
|
||||
return tabList;
|
||||
} else if (args.length == 2) {
|
||||
if (args[1].equals("create") && sender.hasPermission("quickshop.create.sell")) {
|
||||
} else if (args.length == 1) {
|
||||
if (args[0].equals("create") && sender.hasPermission("quickshop.create.sell")) {
|
||||
tabList.add(MsgUtil.getMessage("tabcomplete.price"));
|
||||
}
|
||||
if (args[1].equals("price") && sender.hasPermission("quickshop.create.changeprice")) {
|
||||
if (args[0].equals("price") && sender.hasPermission("quickshop.create.changeprice")) {
|
||||
tabList.add(MsgUtil.getMessage("tabcomplete.price"));
|
||||
}
|
||||
if (args[1].equals("find") && sender.hasPermission("quickshop.find")) {
|
||||
if (args[0].equals("find") && sender.hasPermission("quickshop.find")) {
|
||||
tabList.add(MsgUtil.getMessage("tabcomplete.range"));
|
||||
}
|
||||
if (args[1].equals("refill") && sender.hasPermission("quickshop.refill")) {
|
||||
if (args[0].equals("refill") && sender.hasPermission("quickshop.refill")) {
|
||||
tabList.add(MsgUtil.getMessage("tabcomplete.amount"));
|
||||
}
|
||||
if (args[1].equals("staff") && sender.hasPermission("quickshop.staff")) {
|
||||
if (args[0].equals("staff") && sender.hasPermission("quickshop.staff")) {
|
||||
tabList.add("add");
|
||||
tabList.add("del");
|
||||
tabList.add("clear");
|
||||
}
|
||||
return tabList;
|
||||
} else if (args.length == 3) {
|
||||
if (args[1].equals("staff") && sender.hasPermission("quickshop.staff")) {
|
||||
if (args[2].equals("add") || args[2].equals("del")) {
|
||||
} else if (args.length == 2) {
|
||||
if (args[0].equals("staff") && sender.hasPermission("quickshop.staff")) {
|
||||
if (args[1].equals("add") || args[1].equals("del")) {
|
||||
if (plugin.getConfig().getBoolean("include-offlineplayer-list")) {
|
||||
//Include
|
||||
for (OfflinePlayer offlinePlayer : Bukkit.getOfflinePlayers()) {
|
||||
|
||||
@@ -688,7 +688,8 @@ public class ContainerShop implements Shop {
|
||||
} catch (Throwable t) {
|
||||
trans = false;
|
||||
}
|
||||
if (trans && this.getDisplayItem() == null) {
|
||||
|
||||
if (trans && Util.isAir(displayItem.getDisplayLocation().getBlock().getType()) && this.getDisplayItem() == null) {
|
||||
this.displayItem = new RealDisplayItem(this, this.getItem());
|
||||
this.getDisplayItem().spawn();
|
||||
}
|
||||
@@ -705,6 +706,10 @@ public class ContainerShop implements Shop {
|
||||
disItem.remove();
|
||||
return;
|
||||
}
|
||||
// if(!Util.isAir(dispLoc.getBlock().getType())){
|
||||
// disItem.remove();
|
||||
// return;
|
||||
// }
|
||||
if (disItem.getItem() == null) {
|
||||
disItem.removeDupe();
|
||||
disItem.spawn();
|
||||
|
||||
@@ -56,6 +56,8 @@ public class RealDisplayItem implements DisplayItem {
|
||||
if (shopDisplayItemSpawnEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (!Util.isAir(dispLoc.getBlock().getType()))
|
||||
return;
|
||||
this.item = shop.getLocation().getWorld().dropItem(dispLoc, this.iStack);
|
||||
this.item.setVelocity(new Vector(0, 0.1, 0));
|
||||
try {
|
||||
|
||||
@@ -945,6 +945,20 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAir(Material mat) {
|
||||
if (mat == Material.AIR)
|
||||
return true;
|
||||
try {
|
||||
if (mat == Material.CAVE_AIR)
|
||||
return true;
|
||||
if (mat == Material.VOID_AIR)
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print debug log when plugin running on dev mode.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user