!Moved SmartGive to MMOLib

This commit is contained in:
Indyuce 2020-04-08 16:53:52 +02:00
parent 1cb8f01a07
commit 187587a0d4
8 changed files with 5 additions and 37 deletions

Binary file not shown.

Binary file not shown.

View File

@ -18,7 +18,7 @@ import org.bukkit.inventory.ItemStack;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.util.item.CurrencyItem;
import net.Indyuce.mmocore.api.util.item.SmartGive;
import net.mmogroup.mmolib.api.util.SmartGive;
public class Withdraw implements Listener {
private static final Set<UUID> withdrawing = new HashSet<>();

View File

@ -4,8 +4,8 @@ import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.util.item.SmartGive;
import net.mmogroup.mmolib.api.MMOLineConfig;
import net.mmogroup.mmolib.api.util.SmartGive;
public class ItemTrigger extends Trigger {
private final Material material;

View File

@ -1,32 +0,0 @@
package net.Indyuce.mmocore.api.util.item;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class SmartGive {
private final Inventory inv;
private final Location loc;
public SmartGive(Player player) {
inv = player.getInventory();
loc = player.getLocation();
}
/*
* either give directly the item to the player or drops it on the ground if
* there is not enough space in the player inventory.
*/
public void give(ItemStack... item) {
for (ItemStack drop : inv.addItem(item).values())
loc.getWorld().dropItem(loc, drop);
}
public void give(List<ItemStack> item) {
for (ItemStack drop : inv.addItem(item.toArray(new ItemStack[item.size()])).values())
loc.getWorld().dropItem(loc, drop);
}
}

View File

@ -6,10 +6,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.util.item.CurrencyItem;
import net.Indyuce.mmocore.api.util.item.SmartGive;
import net.Indyuce.mmocore.command.api.CommandEnd;
import net.Indyuce.mmocore.command.api.CommandMap;
import net.Indyuce.mmocore.command.api.Parameter;
import net.mmogroup.mmolib.api.util.SmartGive;
public class CoinsCommandMap extends CommandEnd {
public CoinsCommandMap(CommandMap parent) {

View File

@ -8,10 +8,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.Indyuce.mmocore.api.util.item.CurrencyItem;
import net.Indyuce.mmocore.api.util.item.SmartGive;
import net.Indyuce.mmocore.command.api.CommandEnd;
import net.Indyuce.mmocore.command.api.CommandMap;
import net.Indyuce.mmocore.command.api.Parameter;
import net.mmogroup.mmolib.api.util.SmartGive;
public class NoteCommandMap extends CommandEnd {
public NoteCommandMap(CommandMap parent) {

View File

@ -13,9 +13,9 @@ import org.bukkit.scheduler.BukkitRunnable;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
import net.Indyuce.mmocore.api.util.item.ConfigItem;
import net.Indyuce.mmocore.api.util.item.SmartGive;
import net.Indyuce.mmocore.gui.api.PluginInventory;
import net.mmogroup.mmolib.api.item.NBTItem;
import net.mmogroup.mmolib.api.util.SmartGive;
public class DepositMenu extends PluginInventory {
private ItemStack depositItem;