mirror of
https://github.com/songoda/EpicHeads.git
synced 2024-11-29 14:06:29 +01:00
Updated to 2.2.2 (resolved some issues and patches).
This commit is contained in:
parent
c598442b3c
commit
2697193a81
@ -77,8 +77,8 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
|
||||
instance = this;
|
||||
if (Version.isBelow(Version.v1_8)) {
|
||||
print("&c-------------------------------------------------------------------");
|
||||
print("&c DeluxeHeads no longer supports versions below Minecraft 1.8.");
|
||||
print("&c Please switch to Heads version 1.15.1 or before. ");
|
||||
print("&c DeluxeHeads no longer supports versions below Minecraft 1.8. ");
|
||||
print("&c Please switch to Heads version 1.15.1 or before. ");
|
||||
print("&c-------------------------------------------------------------------");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
|
@ -33,31 +33,25 @@ public class CategoryCostCommand extends AbstractCommand {
|
||||
Lang.Command.Errors.mustBePlayer().send(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 2) {
|
||||
sendInvalidArgs(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("reset")) {
|
||||
InvModeType.CATEGORY_COST_REMOVE.open((Player) sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
double cost;
|
||||
|
||||
try {
|
||||
cost = Double.valueOf(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
Lang.Command.Errors.number(args[1]).send(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cost < 0) {
|
||||
Lang.Command.Errors.negative(args[1]).send(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
InvModeType.CATEGORY_COST.open((Player) sender).asType(CategoryCostMode.class).setCost(cost);
|
||||
return true;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import nl.marido.deluxeheads.DeluxeHeads;
|
||||
import nl.marido.deluxeheads.config.lang.Placeholder;
|
||||
import nl.marido.deluxeheads.menu.ui.item.Item;
|
||||
|
||||
@Deprecated
|
||||
public class Menu {
|
||||
|
||||
private Function<String, Boolean> FILTER_ECONOMY_LINES_OUT = line -> !line.contains("%cost%");
|
||||
|
@ -10,7 +10,6 @@ import nl.marido.deluxeheads.DeluxeHeads;
|
||||
import nl.marido.deluxeheads.config.ConfigFile;
|
||||
import nl.marido.deluxeheads.util.Clock;
|
||||
|
||||
@Deprecated
|
||||
public class MenuConfig {
|
||||
|
||||
private final ConfigurationSection defaults;
|
||||
@ -21,7 +20,6 @@ public class MenuConfig {
|
||||
public MenuConfig(ConfigFile configFile) {
|
||||
this.menus = new HashMap<>();
|
||||
this.defaultMenus = new HashMap<>();
|
||||
|
||||
this.configFile = configFile;
|
||||
this.defaults = loadDefaults();
|
||||
|
||||
|
@ -3,7 +3,6 @@ package nl.marido.deluxeheads.config.oldmenu;
|
||||
import nl.marido.deluxeheads.DeluxeHeads;
|
||||
import nl.marido.deluxeheads.oldmenu.InventoryType;
|
||||
|
||||
@Deprecated
|
||||
public class Menus {
|
||||
|
||||
public static final String SPLIT = "-";
|
||||
|
@ -11,9 +11,7 @@ public class ItemEconomy implements Economy {
|
||||
public boolean isItem(ItemStack itemStack) {
|
||||
if (itemStack == null)
|
||||
return false;
|
||||
|
||||
Item item = Item.create(itemStack).amount(1);
|
||||
|
||||
return item.equals(DeluxeHeads.getMainConfig().getItemEconomyItem());
|
||||
}
|
||||
|
||||
@ -46,31 +44,24 @@ public class ItemEconomy implements Economy {
|
||||
@Override
|
||||
public boolean hasBalance(Player player, double bal) {
|
||||
int amount = convertAmount(bal);
|
||||
|
||||
for (ItemStack item : player.getInventory().getContents()) {
|
||||
if (!isItem(item))
|
||||
continue;
|
||||
|
||||
if (amount <= item.getAmount())
|
||||
return true;
|
||||
|
||||
amount -= item.getAmount();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeBalance(Player player, double bal) {
|
||||
int amount = convertAmount(bal);
|
||||
|
||||
ItemStack[] contents = player.getInventory().getContents();
|
||||
for (int index = 0; index < contents.length; ++index) {
|
||||
ItemStack item = contents[index];
|
||||
|
||||
if (!isItem(item))
|
||||
continue;
|
||||
|
||||
if (amount >= item.getAmount()) {
|
||||
amount -= item.getAmount();
|
||||
contents[index] = null;
|
||||
@ -78,14 +69,11 @@ public class ItemEconomy implements Economy {
|
||||
item.setAmount(item.getAmount() - amount);
|
||||
amount = 0;
|
||||
}
|
||||
|
||||
if (amount == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (amount != 0)
|
||||
return false;
|
||||
|
||||
player.getInventory().setContents(contents);
|
||||
|
||||
return true;
|
||||
|
@ -42,11 +42,9 @@ public final class Item {
|
||||
Checks.ensureNonNull(type, "type");
|
||||
Checks.ensureTrue(amount > 0, "amount must be greater than 0");
|
||||
Checks.ensureTrue(damage >= 0, "damage must be greater than or equal to 0");
|
||||
|
||||
if (lore != null) {
|
||||
Checks.ensureArrayNonNull(lore, "lore");
|
||||
}
|
||||
|
||||
this.type = type;
|
||||
this.amount = amount;
|
||||
this.damage = damage;
|
||||
|
@ -26,7 +26,7 @@ public abstract class ExceptionDetailer {
|
||||
try {
|
||||
return appendInfo(exception, constructorStackTrace);
|
||||
} catch (Exception e) {
|
||||
new Exception("Exception appending info to exception", e).printStackTrace();
|
||||
new Exception("Exception appending info to exception ", e).printStackTrace();
|
||||
|
||||
constructorStackTrace.printStackTrace();
|
||||
|
||||
|
@ -3,7 +3,7 @@ main: nl.marido.deluxeheads.DeluxeHeads
|
||||
description: Enhance your server with over 17,000 awesome unique heads with amazing features.
|
||||
author: Marido
|
||||
website: https://marido.host/deluxeheads
|
||||
version: 2.2.1
|
||||
version: 2.2.2
|
||||
api-version: 1.13
|
||||
softdepend: [Vault, PlayerPoints, BlockStore]
|
||||
loadbefore: [DeluxeMenus]
|
||||
|
Loading…
Reference in New Issue
Block a user