mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge remote-tracking branch 'upstream/master'
Conflicts: src/me/mrCookieSlime/Slimefun/listeners/AncientAltarListener.java
This commit is contained in:
commit
06e1424db1
@ -6,6 +6,7 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
@ -67,7 +68,7 @@ public class CSCoreLibLoader {
|
||||
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
final JSONArray array = (JSONArray) JSONValue.parse(reader.readLine());
|
||||
download = new URL((String) ((JSONObject) array.get(array.size() - 1)).get("downloadUrl"));
|
||||
download = traceURL(((String) ((JSONObject) array.get(array.size() - 1)).get("downloadUrl")).replace("https:", "http:"));
|
||||
file = new File("plugins/" + (String) ((JSONObject) array.get(array.size() - 1)).get("name") + ".jar");
|
||||
|
||||
return true;
|
||||
@ -83,6 +84,30 @@ public class CSCoreLibLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private URL traceURL(String location) throws IOException {
|
||||
HttpURLConnection connection = null;
|
||||
|
||||
while (true) {
|
||||
URL url = new URL(location);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.addRequestProperty("User-Agent", "Auto Updater (by mrCookieSlime)");
|
||||
|
||||
switch (connection.getResponseCode()) {
|
||||
case HttpURLConnection.HTTP_MOVED_PERM:
|
||||
case HttpURLConnection.HTTP_MOVED_TEMP:
|
||||
String loc = connection.getHeaderField("Location");
|
||||
location = new URL(new URL(location), loc).toExternalForm();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return connection.getURL();
|
||||
}
|
||||
|
||||
private void install() {
|
||||
BufferedInputStream input = null;
|
||||
FileOutputStream output = null;
|
||||
|
@ -1,5 +1,12 @@
|
||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||
@ -10,18 +17,13 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
|
||||
import me.mrCookieSlime.Slimefun.Setup.Messages;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.CargoNet;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
|
||||
private static final int[] border = {0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 22, 23, 24, 26, 27, 31, 32, 33, 34, 35, 36, 40, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
||||
@ -29,7 +31,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
public AdvancedCargoOutputNode(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
||||
super(category, item, name, recipeType, recipe, recipeOutput);
|
||||
|
||||
new BlockMenuPreset(name, "§cOutput Node") {
|
||||
new BlockMenuPreset(name, "§cOutput Node") {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
@ -41,7 +43,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
public void newInstance(final BlockMenu menu, final Block b) {
|
||||
try {
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-type") == null || BlockStorage.getBlockInfo(b, "filter-type").equals("whitelist")) {
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "§7Type: §rWhitelist", "", "§e> Click to change it to Blacklist"));
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "§7Type: §rWhitelist", "", "§e> Click to change it to Blacklist"));
|
||||
menu.addMenuClickHandler(15, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -53,7 +55,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL, (byte) 15), "§7Type: §8Blacklist", "", "§e> Click to change it to Whitelist"));
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL, (byte) 15), "§7Type: §8Blacklist", "", "§e> Click to change it to Whitelist"));
|
||||
menu.addMenuClickHandler(15, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -66,7 +68,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
}
|
||||
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-durability") == null || BlockStorage.getBlockInfo(b, "filter-durability").equals("false")) {
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.STONE_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §4\u2718", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.STONE_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §4\u2718", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.addMenuClickHandler(16, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -78,7 +80,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.GOLD_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §2\u2714", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.GOLD_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §2\u2714", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.addMenuClickHandler(16, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -91,7 +93,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
}
|
||||
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-lore") == null || BlockStorage.getBlockInfo(b, "filter-lore").equals("true")) {
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §2\u2714", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §2\u2714", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.addMenuClickHandler(25, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -103,7 +105,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §4\u2718", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §4\u2718", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.addMenuClickHandler(25, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -115,7 +117,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(41, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -134,7 +136,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))));
|
||||
|
||||
if (channel == 16) {
|
||||
menu.replaceExistingItem(42, new CustomItem(SlimefunItems.CHEST_TERMINAL, "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.replaceExistingItem(42, new CustomItem(SlimefunItems.CHEST_TERMINAL, "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(42, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -144,7 +146,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(42, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -154,7 +156,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(43, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -181,7 +183,11 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
return BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.cargo.bypass");
|
||||
boolean open = CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b) || p.hasPermission("slimefun.cargo.bypass");
|
||||
if (!open) {
|
||||
Messages.local.sendTranslation(p, "inventory.no-access", true);
|
||||
}
|
||||
return open;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -226,7 +232,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
preset.addItem(2, new CustomItem(new MaterialData(Material.PAPER), "§3Items", "", "§bPut in all Items you want to", "§bblacklist/whitelist"),
|
||||
preset.addItem(2, new CustomItem(new MaterialData(Material.PAPER), "§3Items", "", "§bPut in all Items you want to", "§bblacklist/whitelist"),
|
||||
new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,12 @@
|
||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||
@ -15,12 +22,6 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class CargoCraftingNode extends SlimefunItem {
|
||||
|
||||
private static final int[] border = {0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 25, 26, 27, 31, 32, 33, 34, 35, 36, 40, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
||||
@ -28,7 +29,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
public CargoCraftingNode(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, name, recipeType, recipe);
|
||||
|
||||
new BlockMenuPreset(name, "§3Input Node") {
|
||||
new BlockMenuPreset(name, "§3Input Node") {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
@ -39,7 +40,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
@Override
|
||||
public void newInstance(final BlockMenu menu, final Block b) {
|
||||
try {
|
||||
menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(41, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -52,7 +53,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
}
|
||||
});
|
||||
|
||||
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))))), "§bChannel ID: §3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")))) + 1)));
|
||||
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))))), "§bChannel ID: §3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")))) + 1)));
|
||||
menu.addMenuClickHandler(42, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -61,7 +62,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
}
|
||||
});
|
||||
|
||||
menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(43, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -81,7 +82,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
boolean open = BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.cargo.bypass");
|
||||
boolean open = CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b) || p.hasPermission("slimefun.cargo.bypass");
|
||||
if (!open) {
|
||||
Messages.local.sendTranslation(p, "inventory.no-access", true);
|
||||
}
|
||||
@ -126,7 +127,7 @@ public class CargoCraftingNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
preset.addItem(2, new CustomItem(new MaterialData(Material.WORKBENCH), "§eRecipe", "", "§bPut in the Recipe you want to craft"),
|
||||
preset.addItem(2, new CustomItem(new MaterialData(Material.WORKBENCH), "§eRecipe", "", "§bPut in the Recipe you want to craft"),
|
||||
new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,12 @@
|
||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||
@ -17,12 +24,6 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.CargoNet;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class CargoInputNode extends SlimefunItem {
|
||||
|
||||
private static final int[] border = {0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 22, 23, 26, 27, 31, 32, 33, 34, 35, 36, 40, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
||||
@ -30,7 +31,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
public CargoInputNode(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
||||
super(category, item, name, recipeType, recipe, recipeOutput);
|
||||
|
||||
new BlockMenuPreset(name, "§3Input Node") {
|
||||
new BlockMenuPreset(name, "§3Input Node") {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
@ -42,7 +43,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
public void newInstance(final BlockMenu menu, final Block b) {
|
||||
try {
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-type") == null || BlockStorage.getBlockInfo(b, "filter-type").equals("whitelist")) {
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "§7Type: §rWhitelist", "", "§e> Click to change it to Blacklist"));
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "§7Type: §rWhitelist", "", "§e> Click to change it to Blacklist"));
|
||||
menu.addMenuClickHandler(15, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -54,7 +55,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL, (byte) 15), "§7Type: §8Blacklist", "", "§e> Click to change it to Whitelist"));
|
||||
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL, (byte) 15), "§7Type: §8Blacklist", "", "§e> Click to change it to Whitelist"));
|
||||
menu.addMenuClickHandler(15, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -67,7 +68,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
}
|
||||
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-durability") == null || BlockStorage.getBlockInfo(b, "filter-durability").equals("false")) {
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.STONE_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §4\u2718", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.STONE_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §4\u2718", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.addMenuClickHandler(16, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -79,7 +80,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.GOLD_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §2\u2714", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.GOLD_SWORD, (byte) 20), "§7Include Sub-IDs/Durability: §2\u2714", "", "§e> Click to toggle whether the Durability has to match"));
|
||||
menu.addMenuClickHandler(16, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -92,7 +93,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
}
|
||||
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "round-robin") == null || BlockStorage.getBlockInfo(b, "round-robin").equals("false")) {
|
||||
menu.replaceExistingItem(24, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDc4ZjJiN2U1ZTc1NjM5ZWE3ZmI3OTZjMzVkMzY0YzRkZjI4YjQyNDNlNjZiNzYyNzdhYWRjZDYyNjEzMzcifX19"), "§7Round-Robin Mode: §4\u2718", "", "§e> Click to enable Round Robin Mode", "§e(Items will be equally distributed on the Channel)"));
|
||||
menu.replaceExistingItem(24, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDc4ZjJiN2U1ZTc1NjM5ZWE3ZmI3OTZjMzVkMzY0YzRkZjI4YjQyNDNlNjZiNzYyNzdhYWRjZDYyNjEzMzcifX19"), "§7Round-Robin Mode: §4\u2718", "", "§e> Click to enable Round Robin Mode", "§e(Items will be equally distributed on the Channel)"));
|
||||
menu.addMenuClickHandler(24, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -104,7 +105,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(24, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDc4ZjJiN2U1ZTc1NjM5ZWE3ZmI3OTZjMzVkMzY0YzRkZjI4YjQyNDNlNjZiNzYyNzdhYWRjZDYyNjEzMzcifX19"), "§7Round-Robin Mode: §2\u2714", "", "§e> Click to disable Round Robin Mode", "§e(Items will be equally distributed on the Channel)"));
|
||||
menu.replaceExistingItem(24, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDc4ZjJiN2U1ZTc1NjM5ZWE3ZmI3OTZjMzVkMzY0YzRkZjI4YjQyNDNlNjZiNzYyNzdhYWRjZDYyNjEzMzcifX19"), "§7Round-Robin Mode: §2\u2714", "", "§e> Click to disable Round Robin Mode", "§e(Items will be equally distributed on the Channel)"));
|
||||
menu.addMenuClickHandler(24, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -117,7 +118,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
}
|
||||
|
||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-lore") == null || BlockStorage.getBlockInfo(b, "filter-lore").equals("true")) {
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §2\u2714", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §2\u2714", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.addMenuClickHandler(25, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -129,7 +130,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §4\u2718", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "§7Include Lore: §4\u2718", "", "§e> Click to toggle whether the Lore has to match"));
|
||||
menu.addMenuClickHandler(25, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -141,7 +142,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.replaceExistingItem(41, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(41, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -160,7 +161,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))));
|
||||
|
||||
if (channel == 16) {
|
||||
menu.replaceExistingItem(42, new CustomItem(SlimefunItems.CHEST_TERMINAL, "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.replaceExistingItem(42, new CustomItem(SlimefunItems.CHEST_TERMINAL, "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(42, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -170,7 +171,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(42, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -180,7 +181,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.replaceExistingItem(43, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(43, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -207,7 +208,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
boolean open = BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.cargo.bypass");
|
||||
boolean open = CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b) || p.hasPermission("slimefun.cargo.bypass");
|
||||
if (!open) {
|
||||
Messages.local.sendTranslation(p, "inventory.no-access", true);
|
||||
}
|
||||
@ -257,7 +258,7 @@ public class CargoInputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
preset.addItem(2, new CustomItem(new MaterialData(Material.PAPER), "§3Items", "", "§bPut in all Items you want to", "§bblacklist/whitelist"),
|
||||
preset.addItem(2, new CustomItem(new MaterialData(Material.PAPER), "§3Items", "", "§bPut in all Items you want to", "§bblacklist/whitelist"),
|
||||
new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,12 @@
|
||||
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||
@ -17,12 +24,6 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.CargoNet;
|
||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class CargoOutputNode extends SlimefunItem {
|
||||
|
||||
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
|
||||
@ -30,7 +31,7 @@ public class CargoOutputNode extends SlimefunItem {
|
||||
public CargoOutputNode(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
|
||||
super(category, item, name, recipeType, recipe, recipeOutput);
|
||||
|
||||
new BlockMenuPreset(name, "§6Output Node") {
|
||||
new BlockMenuPreset(name, "§6Output Node") {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
@ -42,7 +43,7 @@ public class CargoOutputNode extends SlimefunItem {
|
||||
public void newInstance(final BlockMenu menu, final Block b) {
|
||||
try {
|
||||
|
||||
menu.replaceExistingItem(12, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.replaceExistingItem(12, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjI1OTliZDk4NjY1OWI4Y2UyYzQ5ODg1MjVjOTRlMTlkZGQzOWZhZDA4YTM4Mjg0YTE5N2YxYjcwNjc1YWNjIn19fQ=="), "§bChannel", "", "§e> Click to decrease the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(12, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -61,7 +62,7 @@ public class CargoOutputNode extends SlimefunItem {
|
||||
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))));
|
||||
|
||||
if (channel == 16) {
|
||||
menu.replaceExistingItem(13, new CustomItem(SlimefunItems.CHEST_TERMINAL, "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.replaceExistingItem(13, new CustomItem(SlimefunItems.CHEST_TERMINAL, "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(13, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -71,7 +72,7 @@ public class CargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
else {
|
||||
menu.replaceExistingItem(13, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.replaceExistingItem(13, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "§bChannel ID: §3" + (channel + 1)));
|
||||
menu.addMenuClickHandler(13, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -81,7 +82,7 @@ public class CargoOutputNode extends SlimefunItem {
|
||||
});
|
||||
}
|
||||
|
||||
menu.replaceExistingItem(14, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.replaceExistingItem(14, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzJmOTEwYzQ3ZGEwNDJlNGFhMjhhZjZjYzgxY2Y0OGFjNmNhZjM3ZGFiMzVmODhkYjk5M2FjY2I5ZGZlNTE2In19fQ=="), "§bChannel", "", "§e> Click to increase the Channel ID by 1"));
|
||||
menu.addMenuClickHandler(14, new MenuClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -108,7 +109,7 @@ public class CargoOutputNode extends SlimefunItem {
|
||||
|
||||
@Override
|
||||
public boolean canOpen(Block b, Player p) {
|
||||
boolean open = BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.cargo.bypass");
|
||||
boolean open = CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b) || p.hasPermission("slimefun.cargo.bypass");
|
||||
if (!open) {
|
||||
Messages.local.sendTranslation(p, "inventory.no-access", true);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -78,7 +77,7 @@ public class AncientAltarListener implements Listener {
|
||||
else if (item.getName().equals("ANCIENT_ALTAR")) {
|
||||
e.setCancelled(true);
|
||||
|
||||
ItemStack catalyst = e.getPlayer().getInventory().getItemInMainHand();
|
||||
ItemStack catalyst = new CustomItem(e.getPlayer().getInventory().getItemInMainHand(), 1);
|
||||
List<Block> pedestals = Pedestals.getPedestals(b);
|
||||
|
||||
if (!altars.contains(e.getClickedBlock())) {
|
||||
@ -146,7 +145,7 @@ public class AncientAltarListener implements Listener {
|
||||
if (stack != null && !stack.getType().equals(Material.AIR)) {
|
||||
PlayerInventory.consumeItemInHand(p);
|
||||
String nametag = StringUtils.formatItemName(stack, false);
|
||||
Item entity = b.getWorld().dropItem(b.getLocation().add(0.5, 1.2, 0.5), new CustomItem(new CustomItem(stack, 1), "§5§dALTAR §3Probe - §e" + System.nanoTime()));
|
||||
Item entity = b.getWorld().dropItem(b.getLocation().add(0.5, 1.2, 0.5), new CustomItem(new CustomItem(stack, 1), "§5§dALTAR §3Probe - §e" + System.nanoTime()));
|
||||
entity.setVelocity(new Vector(0, 0.1, 0));
|
||||
entity.setMetadata("no_pickup", new FixedMetadataValue(SlimefunStartup.instance, "altar_item"));
|
||||
entity.setCustomNameVisible(true);
|
||||
@ -158,16 +157,7 @@ public class AncientAltarListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPickup(PlayerPickupItemEvent e) {
|
||||
if (e.getItem().hasMetadata("no_pickup")) e.setCancelled(true);
|
||||
else if (!e.getItem().hasMetadata("no_pickup") && e.getItem().getItemStack().hasItemMeta() && e.getItem().getItemStack().getItemMeta().hasDisplayName() && e.getItem().getItemStack().getItemMeta().getDisplayName().startsWith("§5§dALTAR §3Probe - §e")) {
|
||||
e.setCancelled(true);
|
||||
e.getItem().remove();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMinecraftPickup(InventoryPickupItemEvent e) {
|
||||
if (e.getItem().hasMetadata("no_pickup")) e.setCancelled(true);
|
||||
else if (!e.getItem().hasMetadata("no_pickup") && e.getItem().getItemStack().hasItemMeta() && e.getItem().getItemStack().getItemMeta().hasDisplayName() && e.getItem().getItemStack().getItemMeta().getDisplayName().startsWith("§5§dALTAR §3Probe - §e")) {
|
||||
else if (!e.getItem().hasMetadata("no_pickup") && e.getItem().getItemStack().hasItemMeta() && e.getItem().getItemStack().getItemMeta().hasDisplayName() && e.getItem().getItemStack().getItemMeta().getDisplayName().startsWith("§5§dALTAR §3Probe - §e")) {
|
||||
e.setCancelled(true);
|
||||
e.getItem().remove();
|
||||
}
|
||||
|
@ -3,6 +3,29 @@ package me.mrCookieSlime.Slimefun.listeners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Variable;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.events.ItemUseEvent;
|
||||
@ -27,29 +50,6 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class ItemListener implements Listener {
|
||||
|
||||
public ItemListener(SlimefunStartup plugin) {
|
||||
@ -290,7 +290,9 @@ public class ItemListener implements Listener {
|
||||
@EventHandler
|
||||
public void onAnvil(InventoryClickEvent e) {
|
||||
if (e.getRawSlot() == 2 && e.getWhoClicked() instanceof Player && e.getInventory().getType() == InventoryType.ANVIL) {
|
||||
if (SlimefunItem.getByItem(e.getInventory().getContents()[0]) != null && !SlimefunItem.isDisabled(e.getInventory().getContents()[0]) && e.getInventory().getContents()[0].getType() != Material.ELYTRA) {
|
||||
if (SlimefunManager.isItemSimiliar(e.getInventory().getContents()[0], SlimefunItems.ELYTRA, true)) return;
|
||||
|
||||
if (SlimefunItem.getByItem(e.getInventory().getContents()[0]) != null && !SlimefunItem.isDisabled(e.getInventory().getContents()[0])) {
|
||||
e.setCancelled(true);
|
||||
Messages.local.sendTranslation((Player) e.getWhoClicked(), "anvil.not-working", true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user