mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-27 00:45:40 +01:00
!Moved SmartGive to MMOLib
This commit is contained in:
parent
1cb8f01a07
commit
187587a0d4
BIN
lib/MMOItems.jar
BIN
lib/MMOItems.jar
Binary file not shown.
BIN
lib/MMOLib.jar
BIN
lib/MMOLib.jar
Binary file not shown.
@ -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<>();
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user