Fixed MustBe TL Error & Added Member F Upgrade
This commit is contained in:
parent
420d8e3321
commit
f8195caf06
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fupgrades.UpgradeType;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@ -75,16 +76,23 @@ public class CmdJoin extends FCommand {
|
||||
}
|
||||
return;
|
||||
}
|
||||
int level = faction.getUpgrade(UpgradeType.MEMBERS);
|
||||
|
||||
int limit = 0;
|
||||
|
||||
int altLimit = Conf.factionAltMemberLimit;
|
||||
if (level == 0) {
|
||||
limit = Conf.factionMemberLimit;
|
||||
} else {
|
||||
limit = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + level);
|
||||
}
|
||||
|
||||
if (limit > 0 && faction.getFPlayers().size() >= limit && !faction.altInvited(fme)) {
|
||||
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), limit, fplayer.describeTo(fme, false));
|
||||
return;
|
||||
}
|
||||
|
||||
int altLimit = Conf.factionAltMemberLimit;
|
||||
|
||||
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(fme)) {
|
||||
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), altLimit, fplayer.describeTo(fme, false));
|
||||
return;
|
||||
|
@ -7,6 +7,7 @@ import com.massivecraft.factions.SavageFactions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -43,6 +44,7 @@ public class FUpgradesGUI implements Listener {
|
||||
List<Integer> chestSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots");
|
||||
List<Integer> powerSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Power.PowerItem.slots");
|
||||
List<Integer> redSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots");
|
||||
List<Integer> memberSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Members.MembersItem.slots");
|
||||
|
||||
for (int i = 0; i < cropSlots.size(); i++)
|
||||
if (cropSlots.get(i) != -1) inventory.setItem(cropSlots.get(i), items[2]);
|
||||
@ -62,6 +64,9 @@ public class FUpgradesGUI implements Listener {
|
||||
for (int i = 0; i < redSlots.size(); i++)
|
||||
if (redSlots.get(i) != -1) inventory.setItem(redSlots.get(i), items[5]);
|
||||
|
||||
for (int i = 0; i < memberSlots.size(); i++)
|
||||
if (memberSlots.get(i) != -1) inventory.setItem(memberSlots.get(i), items[6]);
|
||||
|
||||
fme.getPlayer().openInventory(inventory);
|
||||
}
|
||||
|
||||
@ -80,6 +85,7 @@ public class FUpgradesGUI implements Listener {
|
||||
ItemStack spawnerItem = items[1];
|
||||
ItemStack powerItem = items[4];
|
||||
ItemStack redItem = items[5];
|
||||
ItemStack memberItem = items[6];
|
||||
|
||||
if (e.getCurrentItem().equals(cropItem)) {
|
||||
int cropLevel = fme.getFaction().getUpgrade(UpgradeType.CROP);
|
||||
@ -175,6 +181,17 @@ public class FUpgradesGUI implements Listener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if(e.getCurrentItem().equals(memberItem)){
|
||||
int memberLevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS) + 1;
|
||||
if(!SavageFactions.plugin.getConfig().isSet("fupgrades.MainMenu.Members.Cost.level-" + memberLevel)){
|
||||
return;
|
||||
}
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.Cost.level-" + memberLevel);
|
||||
if(hasMoney(fme, cost)){
|
||||
fme.getFaction().setUpgrade(UpgradeType.MEMBERS, memberLevel);
|
||||
fme.getPlayer().closeInventory();
|
||||
takeMoney(fme, cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -252,14 +269,14 @@ public class FUpgradesGUI implements Listener {
|
||||
short spawnerData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.SpawnerItem.Damage") + "");
|
||||
String spawnerName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Spawners.SpawnerItem.Name"));
|
||||
List<String> spawnerLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Spawners.SpawnerItem.Lore"));
|
||||
|
||||
List<Integer> spawnerSlots = SavageFactions.plugin.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots");
|
||||
int spawnerLevel = fme.getFaction().getUpgrade(UpgradeType.SPAWNER);
|
||||
|
||||
for (int i = 0; i <= spawnerLore.size() - 1; i++) {
|
||||
spawnerLore.set(i, spawnerLore.get(i).replace("{level}", spawnerLevel + ""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Material cropMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type"));
|
||||
int cropAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount");
|
||||
short cropData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + "");
|
||||
@ -326,6 +343,32 @@ public class FUpgradesGUI implements Listener {
|
||||
chestItem.setAmount(chestlevel);
|
||||
}
|
||||
|
||||
Material memberMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Type"));
|
||||
int memberAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Amount");
|
||||
short memberData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Members.MembersItem.Damage") + "");
|
||||
String memberName = SavageFactions.plugin.color(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Members.MembersItem.Name", "&e&lUpgrade Member Size"));
|
||||
List<String> memberLore = SavageFactions.plugin.colorList(SavageFactions.plugin.getConfig().getStringList("fupgrades.MainMenu.Members.MembersItem.Lore"));
|
||||
int memberlevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS);
|
||||
|
||||
for (int i = 0; i <= memberLore.size() - 1; i++) {
|
||||
String line = memberLore.get(i);
|
||||
line = line.replace("{level}", memberlevel + "");
|
||||
memberLore.set(i, line);
|
||||
}
|
||||
|
||||
ItemStack memberItem = SavageFactions.plugin.createItem(memberMaterial, memberAmt, memberData, memberName, memberLore);
|
||||
|
||||
if (memberlevel >= 1) {
|
||||
ItemMeta itemMeta = memberItem.getItemMeta();
|
||||
if (!SavageFactions.plugin.mc17) {
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
}
|
||||
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
|
||||
|
||||
memberItem.setItemMeta(itemMeta);
|
||||
memberItem.setAmount(memberlevel);
|
||||
}
|
||||
|
||||
Material powerMaterial = Material.getMaterial(SavageFactions.plugin.getConfig().getString("fupgrades.MainMenu.Power.PowerItem.Type"));
|
||||
int powerAmt = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Amount");
|
||||
short powerData = Short.parseShort(SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Power.PowerItem.Damage") + "");
|
||||
@ -381,7 +424,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
|
||||
|
||||
ItemStack[] items = {expItem, spawnerItem, cropItem, chestItem, powerItem, redItem};
|
||||
ItemStack[] items = {expItem, spawnerItem, cropItem, chestItem, powerItem, redItem, memberItem};
|
||||
return items;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.zcore.fupgrades;
|
||||
|
||||
public enum UpgradeType {
|
||||
|
||||
CHEST("Chest"), SPAWNER("Spawner"), EXP("Exp"), CROP("Crop"), POWER("Power"), REDSTONE("Redstone");
|
||||
CHEST("Chest"), SPAWNER("Spawner"), EXP("Exp"), CROP("Crop"), POWER("Power"), REDSTONE("Redstone"), MEMBERS("Members");
|
||||
|
||||
private String id;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public enum TL {
|
||||
ACTIONS_NOPERMISSIONPAIN("<b>It is painful to try to {action} in the territory of {faction}</b>"),
|
||||
ACTIONS_OWNEDTERRITORYDENY("<b>You cant do that in this territory, it is owned by {owners}</b>"),
|
||||
ACTIONS_OWNEDTERRITORYPAINDENY("<b>It is painful to try to {action} in this territory, it is owned by {owners}"),
|
||||
ACTIONS_MUSTBE("<b>You </b><h>must be {role}</h><b> to {action}.</b>"),
|
||||
ACTIONS_MUSTBE("<b>You<h>must be {role}<b> to {action}."),
|
||||
ACTIONS_NOSAMEROLE("<b>{role} can't control each other...</b>"),
|
||||
ACTIONS_NOFACTION("You are not member of any faction."),
|
||||
/**
|
||||
|
@ -920,7 +920,7 @@ fupgrades:
|
||||
- '&7&o(Chance to Grow Two Levels)'
|
||||
- ''
|
||||
- '&e&lTier'
|
||||
- '&f&l* &7Current Level: &n{level}'
|
||||
- '&f&l* &7Current Level: &3{level}/3'
|
||||
- ''
|
||||
- '&e&lPerks'
|
||||
- '&f&l* &7Level 1 - &f10% Chance'
|
||||
@ -951,7 +951,7 @@ fupgrades:
|
||||
- '&7Increased Vanilla XP gained from monsters.'
|
||||
- ''
|
||||
- '&e&lTier'
|
||||
- '&f&l* &7Current Level: &n{level}'
|
||||
- '&f&l* &7Current Level: &3{level}/3'
|
||||
- ''
|
||||
- '&e&lPerks'
|
||||
- '&f&l* &7Level 1 - &f1.5x Multiplier'
|
||||
@ -1032,7 +1032,7 @@ fupgrades:
|
||||
- '&7Decreased mob spawner delay in claims.'
|
||||
- ''
|
||||
- '&e&lTier'
|
||||
- '&f&l* &7Current Level: &n{level}'
|
||||
- '&f&l* &7Current Level: &3{level}/3'
|
||||
- ''
|
||||
- '&e&lPerks'
|
||||
- '&f&l* &7Level 1 - &f10% Lower Delay'
|
||||
@ -1064,7 +1064,7 @@ fupgrades:
|
||||
- '&7Increased Faction Chest Size.'
|
||||
- ''
|
||||
- '&e&lTier'
|
||||
- '&f&l* &7Current Level: &n{level}'
|
||||
- '&f&l* &7Current Level: &3{level}/3'
|
||||
- ''
|
||||
- '&e&lPerks'
|
||||
- '&f&l* &7Level 1 - &f2 Rows'
|
||||
@ -1077,7 +1077,37 @@ fupgrades:
|
||||
- '&e&lClick to &nUnlock'
|
||||
slots:
|
||||
- 40
|
||||
|
||||
Members:
|
||||
Members-Limit:
|
||||
level-1: 30
|
||||
level-2: 35
|
||||
level-3: 40
|
||||
Cost:
|
||||
level-1: 1000000
|
||||
level-2: 2000000
|
||||
level-3: 3000000
|
||||
MembersItem:
|
||||
Name: '&e&lUpgrade Faction Members'
|
||||
Type: PAPER
|
||||
Amount: 1
|
||||
Damage: 0
|
||||
Lore:
|
||||
- '&7Increased faction member limit.'
|
||||
- ''
|
||||
- '&e&lTier'
|
||||
- '&f&l* &7Current Level: &3{level}/3'
|
||||
- ''
|
||||
- '&e&lPerks'
|
||||
- '&f&l* &7Level 1 - &f30 Members'
|
||||
- '&7 - Cost: $1,000,000'
|
||||
- '&f&l* &7Level 2 - &f35 Members'
|
||||
- '&7 - Cost: $2,000,000'
|
||||
- '&f&l* &7Level 3 - &f40 Members'
|
||||
- '&7 - Cost: $3,000,000'
|
||||
- ''
|
||||
- '&e&lClick to &nUnlock'
|
||||
slots:
|
||||
- 22
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Banners | #
|
||||
|
Loading…
Reference in New Issue
Block a user