Unused imports

This commit is contained in:
James Peters 2020-10-24 15:19:04 +01:00
parent 858964c59c
commit fbeeb14a8e
15 changed files with 88 additions and 46 deletions

View File

@ -0,0 +1,86 @@
package com.jamesdpeters.minecraft.chests.v1_16_R2;
import com.jamesdpeters.minecraft.chests.CraftingProvider;
import net.minecraft.server.v1_16_R2.Container;
import net.minecraft.server.v1_16_R2.EntityHuman;
import net.minecraft.server.v1_16_R2.IRecipe;
import net.minecraft.server.v1_16_R2.InventoryCrafting;
import net.minecraft.server.v1_16_R2.RecipeCrafting;
import net.minecraft.server.v1_16_R2.Recipes;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_16_R2.CraftServer;
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import java.util.List;
import java.util.Optional;
public class Crafting implements CraftingProvider {
@Override
public ItemStack craft(World world, List<ItemStack> items) {
Container container = new Container(null, -1) {
@Override
public InventoryView getBukkitView() {
return null;
}
@Override
public boolean canUse(EntityHuman entityHuman) {
return false;
}
};
InventoryCrafting crafting = new InventoryCrafting(container, 3, 3);
for (int i = 0; i < items.size(); i++) {
crafting.setItem(i, CraftItemStack.asNMSCopy(items.get(i)));
}
CraftServer server = (CraftServer) Bukkit.getServer();
CraftWorld craftWorld = (CraftWorld) world;
Optional<RecipeCrafting> optional = server.getServer().getCraftingManager().craft(Recipes.CRAFTING, crafting, craftWorld.getHandle());
net.minecraft.server.v1_16_R2.ItemStack itemstack = net.minecraft.server.v1_16_R2.ItemStack.b;
if (optional.isPresent()) {
RecipeCrafting recipeCrafting = optional.get();
itemstack = recipeCrafting.a(crafting);
}
return CraftItemStack.asBukkitCopy(itemstack);
}
@Override
public Recipe getRecipe(World world, List<ItemStack> items) {
Container container = new Container(null, -1) {
@Override
public InventoryView getBukkitView() {
return null;
}
@Override
public boolean canUse(EntityHuman entityHuman) {
return false;
}
};
InventoryCrafting crafting = new InventoryCrafting(container, 3, 3);
for (int i = 0; i < items.size(); i++) {
if(i >= 9) break; // ItemList cant contain more than 9 items.
crafting.setItem(i, CraftItemStack.asNMSCopy(items.get(i)));
}
CraftServer server = (CraftServer) Bukkit.getServer();
CraftWorld craftWorld = (CraftWorld) world;
Optional<RecipeCrafting> optional = server.getServer().getCraftingManager().craft(Recipes.CRAFTING, crafting, craftWorld.getHandle());
return optional.map(IRecipe::toBukkitRecipe).orElse(null);
}
}

View File

@ -1,8 +1,8 @@
package com.jamesdpeters.minecraft.chests.commands;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.menus.ChestLinkMenu;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.menus.ChestLinkMenu;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.misc.Utils;

View File

@ -2,11 +2,8 @@ package com.jamesdpeters.minecraft.chests.commands;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.api.ApiSpecific;
import com.jamesdpeters.minecraft.chests.menus.PartyMenu;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.maventemplates.BuildConstants;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.menus.PartyMenu;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.party.PartyUtils;
import org.bukkit.Bukkit;

View File

@ -1,7 +1,5 @@
package com.jamesdpeters.minecraft.chests.lang;
import org.bukkit.ChatColor;
import java.text.MessageFormat;
public enum Message {

View File

@ -5,12 +5,10 @@ import com.jamesdpeters.minecraft.chests.api.ApiSpecific;
import com.jamesdpeters.minecraft.chests.filters.HopperFilter;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.runnables.VirtualChestToHopper;
import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.serialize.PluginConfig;
import com.jamesdpeters.minecraft.chests.serialize.SpigotConfig;
import com.jamesdpeters.minecraft.chests.storage.chestlink.ChestLinkStorage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -25,12 +23,8 @@ import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.List;
public class HopperListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)

View File

@ -3,27 +3,18 @@ package com.jamesdpeters.minecraft.chests.listeners;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.interfaces.VirtualCraftingHolder;
import com.jamesdpeters.minecraft.chests.interfaces.VirtualInventoryHolder;
import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.sort.InventorySorter;
import com.jamesdpeters.minecraft.chests.storage.autocraft.AutoCraftingStorage;
import com.jamesdpeters.minecraft.chests.storage.chestlink.ChestLinkStorage;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
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.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryInteractEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;

View File

@ -1,26 +1,15 @@
package com.jamesdpeters.minecraft.chests.menus;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.lang.Message;
import com.jamesdpeters.minecraft.chests.misc.ItemBuilder;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.party.PartyUtils;
import fr.minuskube.inv.ClickableItem;
import fr.minuskube.inv.ItemClickData;
import fr.minuskube.inv.SmartInventory;
import fr.minuskube.inv.content.InventoryContents;
import fr.minuskube.inv.content.InventoryProvider;
import net.wesjd.anvilgui.AnvilGUI;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
public class AcceptDialogMenu implements InventoryProvider {

View File

@ -2,7 +2,6 @@ package com.jamesdpeters.minecraft.chests.menus;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.misc.ItemBuilder;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.storage.chestlink.ChestLinkStorage;
import fr.minuskube.inv.ClickableItem;

View File

@ -2,10 +2,8 @@ package com.jamesdpeters.minecraft.chests.menus;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.misc.ItemBuilder;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.party.PartyInvite;
import com.jamesdpeters.minecraft.chests.party.PartyUtils;
import com.jamesdpeters.minecraft.chests.party.PlayerParty;
import fr.minuskube.inv.ClickableItem;
import fr.minuskube.inv.SmartInventory;
import fr.minuskube.inv.content.InventoryContents;

View File

@ -2,7 +2,6 @@ package com.jamesdpeters.minecraft.chests.menus;
import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
import com.jamesdpeters.minecraft.chests.misc.ItemBuilder;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.party.PartyUtils;
import com.jamesdpeters.minecraft.chests.party.PlayerParty;
import fr.minuskube.inv.ClickableItem;
@ -14,12 +13,10 @@ import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class PartySelectorMenu implements InventoryProvider {

View File

@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
public class PlayerSelectorMenu implements InventoryProvider {

View File

@ -7,7 +7,6 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;

View File

@ -13,7 +13,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.Consumer;
@SerializableAs("PlayerPartyStorage")
public class PlayerPartyStorage implements ConfigurationSerializable {

View File

@ -10,7 +10,6 @@ import com.jamesdpeters.minecraft.chests.serialize.ConfigStorage;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageInfo;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageMessages;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageType;
import com.jamesdpeters.minecraft.chests.storage.chestlink.ChestLinkStorage;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -19,7 +18,6 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.Arrays;

View File

@ -10,7 +10,6 @@ import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.serialize.ConfigStorage;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageMessages;
import com.jamesdpeters.minecraft.chests.storage.abstracts.StorageType;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
@ -21,7 +20,6 @@ import org.bukkit.block.Chest;
import org.bukkit.block.Container;
import org.bukkit.block.data.Directional;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.Collections;