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