Added Warp, DamageIncrease & Reduction, and TNT F Upgrades
This commit is contained in:
parent
7f988031ca
commit
82d2971b65
@ -23,6 +23,13 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public interface Faction extends EconomyParticipator {
|
public interface Faction extends EconomyParticipator {
|
||||||
|
|
||||||
|
int getWarpsLimit();
|
||||||
|
|
||||||
|
void setWarpsLimit(int limit);
|
||||||
|
|
||||||
|
int getTntBankLimit();
|
||||||
|
|
||||||
|
void setTntBankLimit(int limit);
|
||||||
|
|
||||||
int getWallCheckMinutes();
|
int getWallCheckMinutes();
|
||||||
|
|
||||||
|
@ -267,13 +267,9 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
new FactionsExploitListener(),
|
new FactionsExploitListener(),
|
||||||
new FactionsBlockListener(),
|
new FactionsBlockListener(),
|
||||||
new FUpgradesGUI(),
|
new FUpgradesGUI(),
|
||||||
new EXPUpgrade(),
|
|
||||||
new CropUpgrades(),
|
|
||||||
new RedstoneUpgrade(),
|
|
||||||
new ShopClickPersistence(),
|
new ShopClickPersistence(),
|
||||||
new MissionHandler(this),
|
new MissionHandler(this),
|
||||||
new ChestLogsHandler(),
|
new ChestLogsHandler()
|
||||||
new SpawnerUpgrades()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (Listener eventListener : eventsListener)
|
for (Listener eventListener : eventsListener)
|
||||||
|
@ -9,57 +9,42 @@ import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
|||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdSetFWarp extends FCommand {
|
public class CmdSetFWarp extends FCommand {
|
||||||
|
|
||||||
public CmdSetFWarp() {
|
public CmdSetFWarp() {
|
||||||
super();
|
|
||||||
|
|
||||||
this.aliases.add("setwarp");
|
this.aliases.add("setwarp");
|
||||||
this.aliases.add("sw");
|
this.aliases.add("sw");
|
||||||
this.requiredArgs.add("warp name");
|
this.requiredArgs.add("warp name");
|
||||||
this.optionalArgs.put("password", "password");
|
this.optionalArgs.put("password", "password");
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.SETWARP).playerOnly().memberOnly().withAction(PermissableAction.SETWARP).build();
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.SETWARP)
|
|
||||||
.playerOnly()
|
|
||||||
.memberOnly()
|
|
||||||
.withAction(PermissableAction.SETWARP)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!(context.fPlayer.getRelationToLocation() == Relation.MEMBER)) {
|
if (context.fPlayer.getRelationToLocation() != Relation.MEMBER) {
|
||||||
context.msg(TL.COMMAND_SETFWARP_NOTCLAIMED);
|
context.msg(TL.COMMAND_SETFWARP_NOTCLAIMED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String warp = context.argAsString(0);
|
String warp = context.argAsString(0);
|
||||||
|
|
||||||
// Checks if warp with same name already exists and ignores maxWarp check if it does.
|
|
||||||
boolean warpExists = context.faction.isWarp(warp);
|
boolean warpExists = context.faction.isWarp(warp);
|
||||||
|
int maxWarps = context.faction.getWarpsLimit();
|
||||||
int maxWarps = FactionsPlugin.getInstance().getConfig().getInt("max-warps", 5);
|
|
||||||
boolean tooManyWarps = maxWarps <= context.faction.getWarps().size();
|
boolean tooManyWarps = maxWarps <= context.faction.getWarps().size();
|
||||||
if (tooManyWarps && !warpExists) {
|
if (tooManyWarps && !warpExists) {
|
||||||
context.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
|
context.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!this.transact(context.fPlayer, context)) {
|
||||||
if (!transact(context.fPlayer, context)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String password = context.argAsString(1);
|
String password = context.argAsString(1);
|
||||||
|
|
||||||
LazyLocation loc = new LazyLocation(context.player.getLocation());
|
LazyLocation loc = new LazyLocation(context.player.getLocation());
|
||||||
context.faction.setWarp(warp, loc);
|
context.faction.setWarp(warp, loc);
|
||||||
if (password != null) {
|
if (password != null) {
|
||||||
context.faction.setWarpPassword(warp, password);
|
context.faction.setWarpPassword(warp, password);
|
||||||
}
|
}
|
||||||
context.msg(TL.COMMAND_SETFWARP_SET, warp, password != null ? password : "");
|
context.msg(TL.COMMAND_SETFWARP_SET, warp, (password != null) ? password : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean transact(FPlayer player, CommandContext context) {
|
private boolean transact(FPlayer player, CommandContext context) {
|
||||||
return !FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || context.payForCommand(FactionsPlugin.getInstance().getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString());
|
return !FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || context.payForCommand(FactionsPlugin.getInstance().getConfig().getDouble("warp-cost.setwarp", 5.0), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,7 +115,7 @@ public class CmdTnt extends FCommand {
|
|||||||
context.msg(TL.GENERIC_ARGS_TOOFEW);
|
context.msg(TL.GENERIC_ARGS_TOOFEW);
|
||||||
context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION);
|
context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION);
|
||||||
}
|
}
|
||||||
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + ""));
|
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{bankSize}", context.faction.getTntBankLimit() + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
package com.massivecraft.factions.zcore.fupgrades;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
|
||||||
import org.bukkit.CropState;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
|
||||||
import org.bukkit.material.Crops;
|
|
||||||
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class CropUpgrades implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onCropGrow(BlockGrowEvent e) {
|
|
||||||
FLocation floc = new FLocation(e.getBlock().getLocation());
|
|
||||||
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
|
||||||
|
|
||||||
if (!factionAtLoc.isWilderness()) {
|
|
||||||
int level = factionAtLoc.getUpgrade(UpgradeType.CROP);
|
|
||||||
if (level != 0) {
|
|
||||||
int chance = -1;
|
|
||||||
|
|
||||||
switch (level) {
|
|
||||||
case 1:
|
|
||||||
chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chance >= 0) {
|
|
||||||
int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
|
||||||
if (randomNum <= chance)
|
|
||||||
growCrop(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void growCrop(BlockGrowEvent e) {
|
|
||||||
|
|
||||||
if (e.getBlock().getType().equals(XMaterial.WHEAT.parseMaterial())) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
Crops c = new Crops(CropState.RIPE);
|
|
||||||
BlockState bs = e.getBlock().getState();
|
|
||||||
bs.setData(c);
|
|
||||||
bs.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
Block below = e.getBlock().getLocation().subtract(0, 1, 0).getBlock();
|
|
||||||
|
|
||||||
if (below.getType() == XMaterial.SUGAR_CANE.parseMaterial()) {
|
|
||||||
Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
|
|
||||||
|
|
||||||
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
|
|
||||||
above.setType(XMaterial.SUGAR_CANE.parseMaterial());
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (below.getType() == Material.CACTUS) {
|
|
||||||
Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
|
|
||||||
|
|
||||||
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
|
|
||||||
above.setType(Material.CACTUS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package com.massivecraft.factions.zcore.fupgrades;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
|
||||||
|
|
||||||
public class EXPUpgrade implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onDeath(EntityDeathEvent e) {
|
|
||||||
Entity killer = e.getEntity().getKiller();
|
|
||||||
|
|
||||||
if (killer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
FLocation floc = new FLocation(e.getEntity().getLocation());
|
|
||||||
Faction faction = Board.getInstance().getFactionAt(floc);
|
|
||||||
|
|
||||||
if (!faction.isWilderness()) {
|
|
||||||
int level = faction.getUpgrade(UpgradeType.EXP);
|
|
||||||
if (level != 0) {
|
|
||||||
|
|
||||||
double multiplier = -1;
|
|
||||||
|
|
||||||
switch (level) {
|
|
||||||
case 1:
|
|
||||||
multiplier = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
multiplier = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
multiplier = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (multiplier >= 0)
|
|
||||||
spawnMoreExp(e, multiplier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void spawnMoreExp(EntityDeathEvent e, double multiplier) {
|
|
||||||
double newExp = e.getDroppedExp() * multiplier;
|
|
||||||
e.setDroppedExp((int) newExp);
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,6 +41,10 @@ public class FUpgradesGUI implements Listener {
|
|||||||
List<Integer> powerSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Power.PowerItem.slots");
|
List<Integer> powerSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Power.PowerItem.slots");
|
||||||
List<Integer> redSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots");
|
List<Integer> redSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots");
|
||||||
List<Integer> memberSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Members.MembersItem.slots");
|
List<Integer> memberSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Members.MembersItem.slots");
|
||||||
|
List<Integer> reductSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.DamageReduct.ReduceItem.slots");
|
||||||
|
List<Integer> increaseSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.DamageIncrease.IncreaseItem.slots");
|
||||||
|
List<Integer> tntSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.TNT.TntItem.slots");
|
||||||
|
List<Integer> warpSlots = FactionsPlugin.getInstance().getConfig().getIntegerList("fupgrades.MainMenu.Warps.WarpItem.slots");
|
||||||
|
|
||||||
for (Integer cropSlot : cropSlots) if (cropSlot != -1) inventory.setItem(cropSlot, items[2]);
|
for (Integer cropSlot : cropSlots) if (cropSlot != -1) inventory.setItem(cropSlot, items[2]);
|
||||||
|
|
||||||
@ -56,6 +60,14 @@ public class FUpgradesGUI implements Listener {
|
|||||||
|
|
||||||
for (Integer memberSlot : memberSlots) if (memberSlot != -1) inventory.setItem(memberSlot, items[6]);
|
for (Integer memberSlot : memberSlots) if (memberSlot != -1) inventory.setItem(memberSlot, items[6]);
|
||||||
|
|
||||||
|
for (Integer reduceSlot : reductSlots) if (reduceSlot != -1) inventory.setItem(reduceSlot, items[7]);
|
||||||
|
|
||||||
|
for (Integer increaseSlot : increaseSlots) if (increaseSlot != -1) inventory.setItem(increaseSlot, items[8]);
|
||||||
|
|
||||||
|
for(Integer tntSlot : tntSlots) if(tntSlot != -1) inventory.setItem(tntSlot, items[9]);
|
||||||
|
|
||||||
|
for(Integer warpSlot : warpSlots) if(warpSlot != -1) inventory.setItem(warpSlot, items[10]);
|
||||||
|
|
||||||
fme.getPlayer().openInventory(inventory);
|
fme.getPlayer().openInventory(inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +87,10 @@ public class FUpgradesGUI implements Listener {
|
|||||||
ItemStack powerItem = items[4];
|
ItemStack powerItem = items[4];
|
||||||
ItemStack redItem = items[5];
|
ItemStack redItem = items[5];
|
||||||
ItemStack memberItem = items[6];
|
ItemStack memberItem = items[6];
|
||||||
|
ItemStack reduceItem = items[7];
|
||||||
|
ItemStack increaseItem = items[8];
|
||||||
|
ItemStack tntItem = items[9];
|
||||||
|
ItemStack warpItem = items[10];
|
||||||
|
|
||||||
if (e.getCurrentItem().equals(cropItem)) {
|
if (e.getCurrentItem().equals(cropItem)) {
|
||||||
int cropLevel = fme.getFaction().getUpgrade(UpgradeType.CROP);
|
int cropLevel = fme.getFaction().getUpgrade(UpgradeType.CROP);
|
||||||
@ -181,6 +197,52 @@ public class FUpgradesGUI implements Listener {
|
|||||||
fme.getPlayer().closeInventory();
|
fme.getPlayer().closeInventory();
|
||||||
takeMoney(fme, cost);
|
takeMoney(fme, cost);
|
||||||
}
|
}
|
||||||
|
} else if (e.getCurrentItem().equals(reduceItem)) {
|
||||||
|
int reduceLevel = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE) + 1;
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().isSet("fupgrades.MainMenu.DamageReduct.Cost.level-" + reduceLevel)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.Cost.level-" + reduceLevel);
|
||||||
|
if (hasMoney(fme, cost)) {
|
||||||
|
fme.getFaction().setUpgrade(UpgradeType.DAMAGEDECREASE, reduceLevel);
|
||||||
|
fme.getPlayer().closeInventory();
|
||||||
|
takeMoney(fme, cost);
|
||||||
|
}
|
||||||
|
} else if (e.getCurrentItem().equals(increaseItem)) {
|
||||||
|
int increaseLevel = fme.getFaction().getUpgrade(UpgradeType.DAMAGEINCREASE) + 1;
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().isSet("fupgrades.MainMenu.DamageIncrease.Cost.level-" + increaseLevel)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.Cost.level-" + increaseLevel);
|
||||||
|
if (hasMoney(fme, cost)) {
|
||||||
|
fme.getFaction().setUpgrade(UpgradeType.DAMAGEINCREASE, increaseLevel);
|
||||||
|
fme.getPlayer().closeInventory();
|
||||||
|
takeMoney(fme, cost);
|
||||||
|
}
|
||||||
|
} else if(e.getCurrentItem().equals(tntItem)){
|
||||||
|
int tntLevel = fme.getFaction().getUpgrade(UpgradeType.TNT) + 1;
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().isSet("fupgrades.MainMenu.TNT.Cost.level-" + tntLevel)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.Cost.level-" + tntLevel);
|
||||||
|
if (hasMoney(fme, cost)) {
|
||||||
|
fme.getFaction().setUpgrade(UpgradeType.TNT, tntLevel);
|
||||||
|
fme.getPlayer().closeInventory();
|
||||||
|
takeMoney(fme, cost);
|
||||||
|
updateTntBanks(fme.getFaction());
|
||||||
|
}
|
||||||
|
} else if(e.getCurrentItem().equals(warpItem)){
|
||||||
|
int warpLevel = fme.getFaction().getUpgrade(UpgradeType.WARP) + 1;
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().isSet("fupgrades.MainMenu.Warps.Cost.level-" + warpLevel)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.Cost.level-" + warpLevel);
|
||||||
|
if (hasMoney(fme, cost)) {
|
||||||
|
fme.getFaction().setUpgrade(UpgradeType.WARP, warpLevel);
|
||||||
|
fme.getPlayer().closeInventory();
|
||||||
|
takeMoney(fme, cost);
|
||||||
|
setWarpLimit(fme.getFaction());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,11 +469,130 @@ public class FUpgradesGUI implements Listener {
|
|||||||
}
|
}
|
||||||
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
||||||
redItem.setItemMeta(itemMeta);
|
redItem.setItemMeta(itemMeta);
|
||||||
|
|
||||||
redItem.setAmount(redLevel);
|
redItem.setAmount(redLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ItemStack[]{expItem, spawnerItem, cropItem, chestItem, powerItem, redItem, memberItem};
|
Material reduceMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Type"));
|
||||||
|
int reduceAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.ReduceItem.Amount");
|
||||||
|
short reduceData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageReduct.ReduceItem.Damage") + "");
|
||||||
|
String reduceName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageReduct.ReduceItem.Name"));
|
||||||
|
List<String> reduceLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.DamageReduct.ReduceItem.Lore"));
|
||||||
|
int reduceLevel = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
||||||
|
|
||||||
|
for (int i = 0; i <= reduceLore.size() - 1; i++) {
|
||||||
|
String line = reduceLore.get(i);
|
||||||
|
line = line.replace("{level}", reduceLevel + "");
|
||||||
|
reduceLore.set(i, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack reduceItem = FactionsPlugin.getInstance().createItem(reduceMaterial, reduceAmt, reduceData, reduceName, reduceLore);
|
||||||
|
reduceItem.getItemMeta().setLore(reduceLore);
|
||||||
|
|
||||||
|
if (reduceLevel >= 1) {
|
||||||
|
ItemMeta itemMeta = reduceItem.getItemMeta();
|
||||||
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
}
|
||||||
|
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
||||||
|
reduceItem.setItemMeta(itemMeta);
|
||||||
|
|
||||||
|
reduceItem.setAmount(reduceLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
Material increaseMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Type"));
|
||||||
|
int increaseAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Amount");
|
||||||
|
short increaseData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Damage") + "");
|
||||||
|
String increaseName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Name"));
|
||||||
|
List<String> increaseLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.DamageIncrease.IncreaseItem.Lore"));
|
||||||
|
int increaseLevel = fme.getFaction().getUpgrade(UpgradeType.DAMAGEINCREASE);
|
||||||
|
|
||||||
|
for (int i = 0; i <= increaseLore.size() - 1; i++) {
|
||||||
|
String line = increaseLore.get(i);
|
||||||
|
line = line.replace("{level}", increaseLevel + "");
|
||||||
|
increaseLore.set(i, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack increaseItem = FactionsPlugin.getInstance().createItem(increaseMaterial, increaseAmt, increaseData, increaseName, increaseLore);
|
||||||
|
increaseItem.getItemMeta().setLore(increaseLore);
|
||||||
|
|
||||||
|
if (increaseLevel >= 1) {
|
||||||
|
ItemMeta itemMeta = increaseItem.getItemMeta();
|
||||||
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
}
|
||||||
|
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
||||||
|
increaseItem.setItemMeta(itemMeta);
|
||||||
|
|
||||||
|
increaseItem.setAmount(increaseLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
Material tntMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.TNT.TntItem.Type"));
|
||||||
|
int tntAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.TntItem.Amount");
|
||||||
|
short tntData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.TntItem.Damage") + "");
|
||||||
|
String tntName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.TNT.TntItem.Name"));
|
||||||
|
List<String> tntLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.TNT.TntItem.Lore"));
|
||||||
|
int tntLevel = fme.getFaction().getUpgrade(UpgradeType.TNT);
|
||||||
|
|
||||||
|
for (int i = 0; i <= tntLore.size() - 1; i++) {
|
||||||
|
String line = tntLore.get(i);
|
||||||
|
line = line.replace("{level}", tntLevel + "");
|
||||||
|
tntLore.set(i, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack tntItem = FactionsPlugin.getInstance().createItem(tntMaterial, tntAmt, tntData, tntName, tntLore);
|
||||||
|
tntItem.getItemMeta().setLore(tntLore);
|
||||||
|
|
||||||
|
if (tntLevel >= 1) {
|
||||||
|
ItemMeta itemMeta = tntItem.getItemMeta();
|
||||||
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
}
|
||||||
|
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
||||||
|
tntItem.setItemMeta(itemMeta);
|
||||||
|
|
||||||
|
tntItem.setAmount(tntLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
Material warpMaterial = Material.getMaterial(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Type"));
|
||||||
|
int warpAmt = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.WarpItem.Amount");
|
||||||
|
short warpData = Short.parseShort(FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.WarpItem.Damage") + "");
|
||||||
|
String warpName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fupgrades.MainMenu.Warps.WarpItem.Name"));
|
||||||
|
List<String> warpLore = FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fupgrades.MainMenu.Warps.WarpItem.Lore"));
|
||||||
|
int warpLevel = fme.getFaction().getUpgrade(UpgradeType.WARP);
|
||||||
|
|
||||||
|
for (int i = 0; i <= warpLore.size() - 1; i++) {
|
||||||
|
String line = warpLore.get(i);
|
||||||
|
line = line.replace("{level}", warpLevel + "");
|
||||||
|
warpLore.set(i, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack warpItem = FactionsPlugin.getInstance().createItem(warpMaterial, warpAmt, warpData, warpName, warpLore);
|
||||||
|
warpItem.getItemMeta().setLore(warpLore);
|
||||||
|
|
||||||
|
if (warpLevel >= 1) {
|
||||||
|
ItemMeta itemMeta = warpItem.getItemMeta();
|
||||||
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
}
|
||||||
|
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
||||||
|
warpItem.setItemMeta(itemMeta);
|
||||||
|
|
||||||
|
warpItem.setAmount(warpLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ItemStack[]{expItem, spawnerItem, cropItem, chestItem, powerItem, redItem, memberItem, reduceItem, increaseItem, tntItem, warpItem};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTntBanks(Faction faction) {
|
||||||
|
int level = faction.getUpgrade(UpgradeType.TNT);
|
||||||
|
int size = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.TNT.tnt-limit.level-" + (level + 1));
|
||||||
|
faction.setTntBankLimit(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setWarpLimit(Faction faction) {
|
||||||
|
int level = faction.getUpgrade(UpgradeType.WARP);
|
||||||
|
int size = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Warps.warp-limit.level-" + (level + 1));
|
||||||
|
faction.setWarpsLimit(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasMoney(FPlayer fme, int amt) {
|
private boolean hasMoney(FPlayer fme, int amt) {
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
package com.massivecraft.factions.zcore.fupgrades;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RedstoneUpgrade implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onWaterRedstone(BlockFromToEvent e) {
|
|
||||||
List<String> unbreakable = FactionsPlugin.getInstance().getConfig().getStringList("no-water-destroy.Item-List");
|
|
||||||
String block = e.getToBlock().getType().toString();
|
|
||||||
FLocation floc = new FLocation(e.getToBlock().getLocation());
|
|
||||||
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
|
||||||
|
|
||||||
if (!factionAtLoc.isWilderness()) {
|
|
||||||
int level = factionAtLoc.getUpgrade(UpgradeType.REDSTONE);
|
|
||||||
if (level != 0) {
|
|
||||||
if (level == 1) {
|
|
||||||
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Cost");
|
|
||||||
}
|
|
||||||
if (unbreakable.contains(block)) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.massivecraft.factions.zcore.fupgrades;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.SpawnerSpawnEvent;
|
|
||||||
|
|
||||||
public class SpawnerUpgrades implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onSpawn(SpawnerSpawnEvent e) {
|
|
||||||
FLocation floc = new FLocation(e.getLocation());
|
|
||||||
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
|
||||||
|
|
||||||
if (!factionAtLoc.isWilderness()) {
|
|
||||||
int level = factionAtLoc.getUpgrade(UpgradeType.SPAWNER);
|
|
||||||
if (level != 0) {
|
|
||||||
switch (level) {
|
|
||||||
case 1:
|
|
||||||
lowerSpawnerDelay(e, FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1"));
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
lowerSpawnerDelay(e, FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2"));
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
lowerSpawnerDelay(e, FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lowerSpawnerDelay(SpawnerSpawnEvent e, double multiplier) {
|
|
||||||
int lowerby = (int) Math.round(e.getSpawner().getDelay() * multiplier);
|
|
||||||
e.getSpawner().setDelay(e.getSpawner().getDelay() - lowerby);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -2,7 +2,17 @@ package com.massivecraft.factions.zcore.fupgrades;
|
|||||||
|
|
||||||
public enum UpgradeType {
|
public enum UpgradeType {
|
||||||
|
|
||||||
CHEST("Chest"), SPAWNER("Spawner"), EXP("Exp"), CROP("Crop"), POWER("Power"), REDSTONE("Redstone"), MEMBERS("Members");
|
CHEST("Chest"),
|
||||||
|
SPAWNER("Spawner"),
|
||||||
|
EXP("Exp"),
|
||||||
|
CROP("Crop"),
|
||||||
|
POWER("Power"),
|
||||||
|
REDSTONE("Redstone"),
|
||||||
|
MEMBERS("Members"),
|
||||||
|
TNT("TNT"),
|
||||||
|
WARP("Warps"),
|
||||||
|
DAMAGEINCREASE("DamageIncrease"),
|
||||||
|
DAMAGEDECREASE("DamageDecrease");
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@ -0,0 +1,174 @@
|
|||||||
|
package com.massivecraft.factions.zcore.fupgrades;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
|
import org.bukkit.CropState;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
|
import org.bukkit.event.block.BlockGrowEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||||
|
import org.bukkit.material.Crops;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
public class UpgradesListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onDeath(EntityDeathEvent e) {
|
||||||
|
Entity killer = e.getEntity().getKiller();
|
||||||
|
if (killer == null || !(killer instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FLocation floc = new FLocation(e.getEntity().getLocation());
|
||||||
|
Faction faction = Board.getInstance().getFactionAt(floc);
|
||||||
|
if (!faction.isWilderness()) {
|
||||||
|
int level = faction.getUpgrade(UpgradeType.EXP);
|
||||||
|
double multiplier = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-" + level);
|
||||||
|
if (level != 0 && multiplier > 0.0) {
|
||||||
|
this.spawnMoreExp(e, multiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spawnMoreExp(EntityDeathEvent e, double multiplier) {
|
||||||
|
double newExp = e.getDroppedExp() * multiplier;
|
||||||
|
e.setDroppedExp((int) newExp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSpawn(SpawnerSpawnEvent e) {
|
||||||
|
FLocation floc = new FLocation(e.getLocation());
|
||||||
|
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
||||||
|
if (!factionAtLoc.isWilderness()) {
|
||||||
|
int level = factionAtLoc.getUpgrade(UpgradeType.SPAWNER);
|
||||||
|
if (level == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.lowerSpawnerDelay(e, FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.Spawners.Spawner-Boost.level-" + level));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lowerSpawnerDelay(SpawnerSpawnEvent e, double multiplier) {
|
||||||
|
int lowerby = (int) Math.round(e.getSpawner().getDelay() * multiplier);
|
||||||
|
e.getSpawner().setDelay(e.getSpawner().getDelay() - lowerby);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onCropGrow( BlockGrowEvent e) {
|
||||||
|
FLocation floc = new FLocation(e.getBlock().getLocation());
|
||||||
|
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
||||||
|
if (!factionAtLoc.isWilderness()) {
|
||||||
|
int level = factionAtLoc.getUpgrade(UpgradeType.CROP);
|
||||||
|
int chance = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-" + level);
|
||||||
|
if (level == 0 || chance == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int randomNum = ThreadLocalRandom.current().nextInt(1, 101);
|
||||||
|
if (randomNum <= chance) {
|
||||||
|
this.growCrop(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void growCrop( BlockGrowEvent e) {
|
||||||
|
if (e.getBlock().getType().equals(XMaterial.WHEAT.parseMaterial())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
Crops c = new Crops(CropState.RIPE);
|
||||||
|
BlockState bs = e.getBlock().getState();
|
||||||
|
bs.setData(c);
|
||||||
|
bs.update();
|
||||||
|
}
|
||||||
|
Block below = e.getBlock().getLocation().subtract(0.0, 1.0, 0.0).getBlock();
|
||||||
|
if (below.getType() == XMaterial.SUGAR_CANE.parseMaterial()) {
|
||||||
|
Block above = e.getBlock().getLocation().add(0.0, 1.0, 0.0).getBlock();
|
||||||
|
if (above.getType() == Material.AIR && above.getLocation().add(0.0, -2.0, 0.0).getBlock().getType() != Material.AIR) {
|
||||||
|
above.setType(XMaterial.SUGAR_CANE.parseMaterial());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (below.getType() == Material.CACTUS) {
|
||||||
|
Block above = e.getBlock().getLocation().add(0.0, 1.0, 0.0).getBlock();
|
||||||
|
if (above.getType() == Material.AIR && above.getLocation().add(0.0, -2.0, 0.0).getBlock().getType() != Material.AIR) {
|
||||||
|
above.setType(Material.CACTUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public static void onDamageReduction(EntityDamageByEntityEvent e) {
|
||||||
|
if (e.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
|
if (fme == null || dame == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||||
|
if (dame.getFaction() == fme.getFaction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double damage = e.getDamage();
|
||||||
|
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEDECREASE);
|
||||||
|
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageReduction.DamageReductionPercent.level-" + level);
|
||||||
|
e.setDamage(damage - damage / 100.0 * increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onWaterRedstone(BlockFromToEvent e) {
|
||||||
|
List<String> unbreakable = FactionsPlugin.getInstance().getConfig().getStringList("no-water-destroy.Item-List");
|
||||||
|
String block = e.getToBlock().getType().toString();
|
||||||
|
FLocation floc = new FLocation(e.getToBlock().getLocation());
|
||||||
|
Faction factionAtLoc = Board.getInstance().getFactionAt(floc);
|
||||||
|
|
||||||
|
if (!factionAtLoc.isWilderness()) {
|
||||||
|
int level = factionAtLoc.getUpgrade(UpgradeType.REDSTONE);
|
||||||
|
if (level != 0) {
|
||||||
|
if (level == 1) {
|
||||||
|
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Redstone.Cost");
|
||||||
|
}
|
||||||
|
if (unbreakable.contains(block)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public static void onDamageIncrease(EntityDamageByEntityEvent e) {
|
||||||
|
if (e == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
|
if (fme == null || dame == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||||
|
if (dame.getFaction() == fme.getFaction()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double damage = e.getDamage();
|
||||||
|
int level = fme.getFaction().getUpgrade(UpgradeType.DAMAGEINCREASE);
|
||||||
|
double increase = FactionsPlugin.getInstance().getConfig().getDouble("fupgrades.MainMenu.DamageIncrease.DamageIncreasePercent.level-" + level);
|
||||||
|
e.setDamage(damage + damage / 100.0 * increase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -80,6 +80,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
private Map<UUID, Integer> playerWallCheckCount;
|
private Map<UUID, Integer> playerWallCheckCount;
|
||||||
private Map<UUID, Integer> playerBufferCheckCount;
|
private Map<UUID, Integer> playerBufferCheckCount;
|
||||||
private boolean weeWoo;
|
private boolean weeWoo;
|
||||||
|
private int tntBankSize;
|
||||||
|
private int warpLimit;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -452,6 +454,33 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
bannerSerialized = banner.serialize();
|
bannerSerialized = banner.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWarpsLimit() {
|
||||||
|
if (warpLimit == 0) {
|
||||||
|
return FactionsPlugin.getInstance().getConfig().getInt("max-warps");
|
||||||
|
}
|
||||||
|
return warpLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWarpsLimit(int warpLimit) {
|
||||||
|
this.warpLimit = warpLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTntBankLimit() {
|
||||||
|
if (tntBankSize == 0) {
|
||||||
|
return FactionsPlugin.getInstance().getConfig().getInt("ftnt.Bank-Limit");
|
||||||
|
}
|
||||||
|
return tntBankSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTntBankLimit(int newLimit) {
|
||||||
|
tntBankSize = newLimit;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getBanner() {
|
public ItemStack getBanner() {
|
||||||
if (bannerSerialized == null) {
|
if (bannerSerialized == null) {
|
||||||
|
@ -844,7 +844,7 @@ public enum TL {
|
|||||||
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
|
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
|
||||||
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
|
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
|
||||||
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
|
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
|
||||||
COMMAND_TNT_AMOUNT("&cYour faction has {amount} tnt in the tnt bank."),
|
COMMAND_TNT_AMOUNT("&cYour faction has {amount} tnt out of {bankSize} in the tnt bank."),
|
||||||
COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"),
|
COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"),
|
||||||
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
|
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
|
||||||
COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."),
|
COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."),
|
||||||
|
@ -918,7 +918,7 @@ fupgrades:
|
|||||||
level-3: 3000000
|
level-3: 3000000
|
||||||
PowerItem:
|
PowerItem:
|
||||||
Name: '&c&lFaction Power'
|
Name: '&c&lFaction Power'
|
||||||
Type: DIAMOND_SWORD
|
Type: NETHER_STAR
|
||||||
Amount: 1
|
Amount: 1
|
||||||
Damage: 0
|
Damage: 0
|
||||||
Lore:
|
Lore:
|
||||||
@ -942,7 +942,7 @@ fupgrades:
|
|||||||
Redstone:
|
Redstone:
|
||||||
Cost: 1000000
|
Cost: 1000000
|
||||||
RedstoneItem:
|
RedstoneItem:
|
||||||
Name: '&c&lUnbreakable Redstone'
|
Name: '&c&lUnbreakable Redstone'
|
||||||
Type: REDSTONE
|
Type: REDSTONE
|
||||||
Amount: 1
|
Amount: 1
|
||||||
Damage: 0
|
Damage: 0
|
||||||
@ -988,6 +988,134 @@ fupgrades:
|
|||||||
- '&e&lClick to &nUnlock'
|
- '&e&lClick to &nUnlock'
|
||||||
slots:
|
slots:
|
||||||
- 24
|
- 24
|
||||||
|
DamageReduct:
|
||||||
|
DamageReductPercent:
|
||||||
|
level-1: 3
|
||||||
|
level-2: 5
|
||||||
|
level-3: 7
|
||||||
|
Cost:
|
||||||
|
level-1: 2000000
|
||||||
|
level-2: 4000000
|
||||||
|
level-3: 6000000
|
||||||
|
ReduceItem:
|
||||||
|
Name: '&c&lDamage Reduction Upgrade'
|
||||||
|
Type: DIAMOND_CHESTPLATE
|
||||||
|
Amount: 1
|
||||||
|
Damage: 0
|
||||||
|
Lore:
|
||||||
|
- '&7Reduce the amount of damage taken'
|
||||||
|
- '&7in your faction claims.'
|
||||||
|
- ''
|
||||||
|
- '&c&lTier'
|
||||||
|
- '&f&l* &7Current Level: &3{level}/3'
|
||||||
|
- ''
|
||||||
|
- '&c&lPerks'
|
||||||
|
- '&f&l* &7Level 1 - &7((&f-3% Damage Per Hit&7))'
|
||||||
|
- '&7 - Cost: $2,000,000'
|
||||||
|
- '&f&l* &7Level 2 - &7((&f-5% Damage Per Hit&7))'
|
||||||
|
- '&7 - Cost: $4,000,000'
|
||||||
|
- '&f&l* &7Level 3 - &7((&f-7% Damage Per Hit&7))'
|
||||||
|
- '&7 - Cost: $6,000,000'
|
||||||
|
- ''
|
||||||
|
- '&e&lClick to &nUnlock'
|
||||||
|
slots:
|
||||||
|
- 0
|
||||||
|
DamageIncrease:
|
||||||
|
DamageIncreasePercent:
|
||||||
|
level-1: 3
|
||||||
|
level-2: 5
|
||||||
|
level-3: 7
|
||||||
|
Cost:
|
||||||
|
level-1: 2000000
|
||||||
|
level-2: 4000000
|
||||||
|
level-3: 6000000
|
||||||
|
IncreaseItem:
|
||||||
|
Name: '&c&lDamage Increase Upgrade'
|
||||||
|
Type: DIAMOND_SWORD
|
||||||
|
Amount: 1
|
||||||
|
Damage: 0
|
||||||
|
Lore:
|
||||||
|
- '&7Increase the amount of damage given'
|
||||||
|
- '&7in your faction claims.'
|
||||||
|
- ''
|
||||||
|
- '&c&lTier'
|
||||||
|
- '&f&l* &7Current Level: &3{level}/3'
|
||||||
|
- ''
|
||||||
|
- '&c&lPerks'
|
||||||
|
- '&f&l* &7Level 1 - &7((&f+3% Damage Per Hit&7))'
|
||||||
|
- '&7 - Cost: $2,000,000'
|
||||||
|
- '&f&l* &7Level 2 - &7((&f+5% Damage Per Hit&7))'
|
||||||
|
- '&7 - Cost: $4,000,000'
|
||||||
|
- '&f&l* &7Level 3 - &7((&f+7% Damage Per Hit&7))'
|
||||||
|
- '&7 - Cost: $6,000,000'
|
||||||
|
- ''
|
||||||
|
- '&e&lClick to &nUnlock'
|
||||||
|
slots:
|
||||||
|
- 8
|
||||||
|
TNT:
|
||||||
|
tnt-limit:
|
||||||
|
level-1: 500000
|
||||||
|
level-2: 1000000
|
||||||
|
level-3: 2000000
|
||||||
|
Cost:
|
||||||
|
level-1: 2000000
|
||||||
|
level-2: 4000000
|
||||||
|
level-3: 6000000
|
||||||
|
TntItem:
|
||||||
|
Name: '&c&lTNT Bank Upgrade'
|
||||||
|
Type: TNT
|
||||||
|
Amount: 1
|
||||||
|
Damage: 0
|
||||||
|
Lore:
|
||||||
|
- '&7Upgrade Your tnt bank limit,'
|
||||||
|
- '&7to be eligible to store more tnt.'
|
||||||
|
- ''
|
||||||
|
- '&c&lTier'
|
||||||
|
- '&f&l* &7Current Level: &3{level}/3'
|
||||||
|
- ''
|
||||||
|
- '&c&lPerks'
|
||||||
|
- '&f&l* &7Level 1 - &f500,000 TNT'
|
||||||
|
- '&7 - Cost: $2,000,000'
|
||||||
|
- '&f&l* &7Level 2 - &f1,000,000 TNT'
|
||||||
|
- '&7 - Cost: $4,000,000'
|
||||||
|
- '&f&l* &7Level 3 - &f2,000,000 TNT'
|
||||||
|
- '&7 - Cost: $6,000,000'
|
||||||
|
- ''
|
||||||
|
- '&e&lClick to &nUnlock'
|
||||||
|
slots:
|
||||||
|
- 36
|
||||||
|
Warps:
|
||||||
|
warp-limit:
|
||||||
|
level-1: 3
|
||||||
|
level-2: 4
|
||||||
|
level-3: 5
|
||||||
|
Cost:
|
||||||
|
level-1: 1000000
|
||||||
|
level-2: 2000000
|
||||||
|
level-3: 3000000
|
||||||
|
WarpItem:
|
||||||
|
Name: '&c&lWarp Upgrade'
|
||||||
|
Type: EYE_OF_ENDER
|
||||||
|
Amount: 1
|
||||||
|
Damage: 0
|
||||||
|
Lore:
|
||||||
|
- '&7Upgrade Your warp limit,'
|
||||||
|
- '&7to be able to set more warps.'
|
||||||
|
- ''
|
||||||
|
- '&c&lTier'
|
||||||
|
- '&f&l* &7Current Level: &3{level}/3'
|
||||||
|
- ''
|
||||||
|
- '&c&lPerks'
|
||||||
|
- '&f&l* &7Level 1 - &f3 Warps'
|
||||||
|
- '&7 - Cost: $1,000,000'
|
||||||
|
- '&f&l* &7Level 2 - &f4 Warps'
|
||||||
|
- '&7 - Cost: $2,000,000'
|
||||||
|
- '&f&l* &7Level 3 - &f5 Warps'
|
||||||
|
- '&7 - Cost: $3,000,000'
|
||||||
|
- ''
|
||||||
|
- '&e&lClick to &nUnlock'
|
||||||
|
slots:
|
||||||
|
- 44
|
||||||
Chest:
|
Chest:
|
||||||
Chest-Size:
|
Chest-Size:
|
||||||
# This is rows
|
# This is rows
|
||||||
|
Loading…
Reference in New Issue
Block a user