@Override public boolean chargePlayerExact(ChargeType type, Player player, double customCost) { if (type.hasNoCostPermission(player)) { player.sendMessage( DragonTravel.getInstance().getMessagesHandler().getMessage("Messages.Payment.Free")); return true; } return removeItems(player, (int) customCost); }
@Override public boolean chargePlayer(ChargeType type, Player player) { if (type.hasNoCostPermission(player)) { player.sendMessage( DragonTravel.getInstance().getMessagesHandler().getMessage("Messages.Payment.Free")); return true; } int amount; switch (type) { case TRAVEL_TOSTATION: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.toStation"); break; case TRAVEL_TORANDOM: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.toRandom"); break; case TRAVEL_TOPLAYER: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.toPlayer"); break; case TRAVEL_TOCOORDINATES: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.toCoordinates"); break; case TRAVEL_TOHOME: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.toHome"); break; case TRAVEL_TOFACTIONHOME: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.toFactionhome"); break; case SETHOME: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.setHome"); break; case FLIGHT: amount = DragonTravel.getInstance().getConfig().getInt("Payment.Resources.Prices.Flight"); break; default: throw new UnsupportedOperationException( "ResourcesPaymentHandler doesn't know how to deal with a ChargeType of " + type.name() + ". Fix immediately!"); } return removeItems(player, amount); }