SavageFactions 1.0.21-BETA-3

Tweaked fly disabler, hitting mobs wont disable it.
Fly bypass permisssions logic redone
issues with safezone fly and warzone fly fixed
Fixed click to claim in f map
Changed tooltips ot one line in map because of heavy load in areas with lots of claims
option to disable banners
Kicking throwing error cause of typo in lang file.
Tnt Bank limit added.
This commit is contained in:
Naman 2018-04-03 22:20:30 -05:00
parent 009e3e715c
commit f1bfe2e8c4
11 changed files with 80 additions and 102 deletions

View File

@ -21,7 +21,7 @@ public class Conf {
public static ChatColor colorEnemy = ChatColor.RED;
public static ChatColor colorPeaceful = ChatColor.GOLD;
public static ChatColor colorWilderness = ChatColor.GRAY;
public static ChatColor colorWilderness = ChatColor.GREEN;
public static ChatColor colorSafezone = ChatColor.GOLD;
public static ChatColor colorWar = ChatColor.DARK_RED;

View File

@ -145,6 +145,7 @@ public class P extends MPlugin {
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (version == 7) {
P.p.log("Version 1.7 found, disabling banner placement.");
mc17 = true;
}

View File

@ -30,6 +30,10 @@ public class CmdBanner extends FCommand {
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fbanners.Enabled")) {
return;
}
if (!fme.hasMoney(P.p.getConfig().getInt("fbanners.Banner-Cost", 5000))) {
msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);
return;
@ -42,7 +46,7 @@ public class CmdBanner extends FCommand {
public boolean hasMoney(FPlayer fme, int amt) {
Economy econ = P.p.getEcon();
if (econ.getBalance((Player) fme.getPlayer()) >= amt) {
if (econ.getBalance(fme.getPlayer()) >= amt) {
return true;
} else {
fme.msg(TL.COMMAND_BANNER_NOTENOUGHMONEY);

View File

@ -4,8 +4,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.*;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.util.Particles.ParticleEffect;
import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
@ -99,12 +99,30 @@ public class CmdFly extends FCommand {
}, 20L, 20L);
}
public boolean isInFlightChecker(Player player) {
if (flyMap.containsKey(player.getName())) {
private static boolean checkBypassPerms(FPlayer fplayer, Player player, Faction toFac) {
if (player.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) {
return true;
} else {
return false;
}
if (player.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
return true;
}
if (player.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) {
return true;
}
if (player.hasPermission("factions.fly.enemy") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ENEMY) {
return true;
}
if (player.hasPermission("factions.fly.ally") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ALLY) {
return true;
}
if (player.hasPermission("factions.fly.truce") && toFac.getRelationTo(fplayer.getFaction()) == Relation.TRUCE) {
return true;
}
return player.hasPermission("factions.fly.neutral") && toFac.getRelationTo(fplayer.getFaction()) == Relation.NEUTRAL;
}
public boolean isInFlightChecker(Player player) {
return flyMap.containsKey(player.getName());
}
@Override
@ -127,6 +145,7 @@ public class CmdFly extends FCommand {
return;
}
if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
Bukkit.broadcastMessage("oooooooow");
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
}
@ -142,13 +161,15 @@ public class CmdFly extends FCommand {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
}
if (!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL) {
if ((!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL && !isSystemFaction(toFac))) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
}
}
List<Entity> entities = me.getNearbyEntities(16,256,16);
for (int i = 0; i <= entities.size() -1;i++)
{
@ -165,87 +186,17 @@ public class CmdFly extends FCommand {
}
if (args.size() == 0) {
if (!fme.canFlyAtLocation() && !fme.isFlying()) {
if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.enemy") && toFac.getRelationTo(myFaction) == Relation.ENEMY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.ally") && toFac.getRelationTo(myFaction) == Relation.ALLY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.truce") && toFac.getRelationTo(myFaction) == Relation.TRUCE) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
} else if (!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
}
}
toggleFlight(!fme.isFlying(), me);
} else if (args.size() == 1) {
if (!fme.canFlyAtLocation() && argAsBool(0)) {
if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.enemy") && toFac.getRelationTo(myFaction) == Relation.ENEMY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.ally") && toFac.getRelationTo(myFaction) == Relation.ALLY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
} else if (!me.hasPermission("factions.fly.truce") && toFac.getRelationTo(myFaction) == Relation.TRUCE) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
} else if (!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
}
}
toggleFlight(argAsBool(0),me);
}
}
private static boolean checkBypassPerms(FPlayer fplayer, Player player, Faction toFac) {
if (player.hasPermission("factions.fly.wilderness") && toFac.isWilderness()){
return true;
}
if (player.hasPermission("factions.fly.warzone") && toFac.isWarZone()){
return true;
}
if (player.hasPermission("factions.fly.safezone") && toFac.isSafeZone()){
return true;
}
if (player.hasPermission("factions.fly.enemy") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ENEMY) {
return true;
}
if (player.hasPermission("factions.fly.ally") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ALLY) {
return true;
}
if (player.hasPermission("factions.fly.truce") && toFac.getRelationTo(fplayer.getFaction()) == Relation.TRUCE) {
return true;
}
if (player.hasPermission("factions.fly.neutral") && toFac.getRelationTo(fplayer.getFaction()) == Relation.NEUTRAL) {
return true;
}
return false;
public Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
}
public static void checkTaskState() {
@ -258,7 +209,6 @@ public class CmdFly extends FCommand {
private void toggleFlight(final boolean toggle, final Player player) {
if (!toggle) {
fme.setFlying(false);
flyMap.remove(player.getName());
return;
}

View File

@ -125,19 +125,17 @@ public class CmdKick extends FCommand {
}
toKickFaction.msg(TL.COMMAND_KICK_FACTION, fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
toKick.msg(TL.COMMAND_KICK_KICKED, fme.describeTo(toKick, true), toKickFaction.describeTo(toKick));
if (toKickFaction != myFaction) {
fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme));
}
if (Conf.logFactionKick) {
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
}
if (toKick.getRole() == Role.ADMIN) {
toKickFaction.promoteNewLeader();
}
toKickFaction.deinvite(toKick);
toKick.resetFactionData();
}

View File

@ -61,8 +61,13 @@ public class CmdTnt extends FCommand {
return;
}
ItemStack tnt = new ItemStack(Material.TNT, amount);
if (fme.getFaction().getTnt() + amount > P.p.getConfig().getInt("ftnt.Bank-Limit")) {
msg(TL.COMMAND_TNT_EXCEEDLIMIT);
return;
}
removeFromInventory(me.getInventory(), tnt);
me.updateInventory();
fme.getFaction().addTnt(amount);
fme.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS);
fme.sendMessage(P.p.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", fme.getFaction().getTnt() + "")));

View File

@ -109,6 +109,7 @@ public class FactionsEntityListener implements Listener {
return;
}
} else {
// this triggers if damagee is a player and damager is mob ( so like if a skeleton hits u )
if (damager instanceof Projectile) {
// this will trigger if the damager is a projectile
@ -129,6 +130,13 @@ public class FactionsEntityListener implements Listener {
}
}
} else {
//this one should trigger if something other than a player takes damage
if (damager instanceof Player) {
// now itll only go here if the damage is dealt by a player
return;
// we cancel it so fly isnt removed when you hit a mob etc
}
}
if (damagee != null && damagee instanceof Player) {
cancelFStuckTeleport((Player) damagee);
@ -244,6 +252,7 @@ public class FactionsEntityListener implements Listener {
}
}
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {

View File

@ -285,15 +285,15 @@ public abstract class MemoryBoard extends Board {
Relation relation = fplayer.getRelationTo(factionHere);
if (factionHere.isWilderness()) {
row.then("-").color(Conf.colorWilderness);
// Check for claimat position and if so, let them claim at ;D //TODO: Fix this
if (false) { //fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) {
row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx, dz))
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx, dz));
// Lol someone didnt add the x and z making it claim the wrong position Can i copyright this xD
if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) {
row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx + topLeft.getX(), dz + topLeft.getZ()))
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx + topLeft.getX(), dz + topLeft.getZ()));
}
} else if (factionHere.isSafeZone()) {
row.then("+").color(Conf.colorSafezone);
row.then("+").color(Conf.colorSafezone).tooltip(oneLineToolTip(factionHere, fplayer));
} else if (factionHere.isWarZone()) {
row.then("+").color(Conf.colorWar);
row.then("+").color(Conf.colorWar).tooltip(oneLineToolTip(factionHere, fplayer));
} else if (factionHere == faction || factionHere == factionLoc || relation.isAtLeast(Relation.ALLY) ||
(Conf.showNeutralFactionsOnMap && relation.equals(Relation.NEUTRAL)) ||
(Conf.showEnemyFactionsOnMap && relation.equals(Relation.ENEMY))) {
@ -302,7 +302,9 @@ public abstract class MemoryBoard extends Board {
}
char tag = fList.get(factionHere.getTag());
row.then(String.valueOf(tag)).color(factionHere.getColorTo(faction)).tooltip(getToolTip(factionHere, fplayer));
//row.then(String.valueOf(tag)).color(factionHere.getColorTo(faction)).tooltip(getToolTip(factionHere, fplayer));
//changed out with a performance friendly one line tooltip :D
row.then(String.valueOf(tag)).color(factionHere.getColorTo(faction)).tooltip(oneLineToolTip(factionHere, fplayer));
} else {
row.then("-").color(ChatColor.GRAY);
}
@ -323,6 +325,10 @@ public abstract class MemoryBoard extends Board {
return ret;
}
private List<String> oneLineToolTip(Faction faction, FPlayer to) {
return Arrays.asList(faction.describeTo(to));
}
private List<String> getToolTip(Faction faction, FPlayer to) {
List<String> ret = new ArrayList<>();
List<String> show = P.p.getConfig().getStringList("map");

View File

@ -172,6 +172,7 @@ public enum TL {
COMMAND_BANNER_NOTENOUGHMONEY("&c&l[!] &7You do&c not&7 have enough money"),
COMMAND_BANNER_MONEYTAKE("&c&l[!] $&c{amount} &7has been taken from your account."),
COMMAND_BANNER_SUCCESS("&c&l[!] &7You have created a &c&lWarBanner!"),
COMMAND_BANNER_DISABLED("&c&l[!] &7Buying&c warbanners&7 is &cdisabled!"),
COMMAND_TPBANNER_NOTSET("&c&l[!] &7Your faction &cdoes not &7have a &c&lWarBanner &7placed!"),
COMMAND_TPBANNER_SUCCESS("&c&l[!] &cTeleporting &7to your factions's &c&lWarBanner"),
@ -343,9 +344,9 @@ public enum TL {
COMMAND_KICK_NEGATIVEPOWER("&c&l[!]&7 You &ccannot &7kick that member until their power is &apositive&7."),
COMMAND_KICK_TOKICK("to kick someone from the faction"),
COMMAND_KICK_FORKICK("for kicking someone from the faction"),
COMMAND_KICK_FACTION("&c&l[!]&7 %1$s<i> kicked %2$s<i> from the faction!"), //message given to faction members
COMMAND_KICK_FACTION("&c&l[!]&7 %1$s&7 kicked %2$s&c from the faction!"), //message given to faction members
COMMAND_KICK_KICKS("&c&l[!]&7 You kicked &c%1$s&7 from the faction&c %2$s&7!"), //kicker perspective
COMMAND_KICK_KICKED("&c&l[!]&7 &c%1$s<i> &7kicked you from&c %2$&7!"), //kicked player perspective
COMMAND_KICK_KICKED("&c&l[!]&7 &c%1$s &7kicked you from&c %2$s&7!"), //kicked player perspective
COMMAND_KICK_DESCRIPTION("Kick a player from the faction"),
COMMAND_LIST_FACTIONLIST("&c&l[!]&7 Faction List "),
@ -553,12 +554,12 @@ public enum TL {
COMMAND_SETMAXVAULTS_SUCCESS("&aSet max vaults for &e%s &ato &b%d"),
COMMAND_VAULT_DESCRIPTION("Open your placed faction vault!"),
COMMAND_VAULT_INVALID("&cYour vault was either claimed, broken, or has not been placed yet."),
COMMAND_VAULT_OPENING("&cOpening faction vault."),
COMMAND_VAULT_INVALID("&c&l[!]&7 Your vault was either&c claimed&7, &cbroken&7, or has&c not been&7 placed yet."),
COMMAND_VAULT_OPENING("&c&l[!]&7 Opening faction vault."),
COMMAND_GETVAULT_ALREADYSET("&cVault has already been set!"),
COMMAND_GETVAULT_ALREADYHAVE("&cYou already have a vault in your inventory!"),
COMMAND_GETVAULT_CHESTNEAR("&cThere is a chest nearby"),
COMMAND_GETVAULT_ALREADYSET("&c&l[!]&7 Vault has already been set!"),
COMMAND_GETVAULT_ALREADYHAVE("&c&l[!]&7 You already have a vault in your inventory!"),
COMMAND_GETVAULT_CHESTNEAR("&c&l[!]&7 &7There is a chest &cnearby"),
COMMAND_GETVAULT_SUCCESS("&cSucessfully set vault."),
COMMAND_GETVAULT_INVALIDLOCATION("&cVault can only be placed in faction land!"),
COMMAND_GETVAULT_DESCRIPTION("Get the faction vault item!"),
@ -641,6 +642,7 @@ public enum TL {
COMMAND_TNT_DISABLED_MSG("&cThis command is disabled!"),
COMMAND_TNT_INVALID_NUM("The amount needs to be a number!"),
COMMAND_TNT_DEPOSIT_SUCCESS("&cSuccessfully deposited tnt."),
COMMAND_TNT_EXCEEDLIMIT("&cThis exceeds the bank limit!"),
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
@ -671,6 +673,7 @@ public enum TL {
COMMAND_UNCLAIMALL_UNCLAIMED("%1$s<i> unclaimed ALL of your faction's land."),
COMMAND_UNCLAIMALL_LOG("%1$s unclaimed everything for the faction: %2$s"),
COMMAND_UNCLAIMALL_DESCRIPTION("Unclaim all of your factions land"),
COMMAND_UNCLAIM_CLICKTOUNCLAIM("Click to unclaim &2(%1$d, %2$d)"),
COMMAND_VERSION_VERSION("<i>You are running %1$s"),
COMMAND_VERSION_DESCRIPTION("Show plugin and translation version information"),

View File

@ -643,6 +643,7 @@ frules:
############################################################
ftnt:
Enabled: true
Bank-Limit: 10000
############################################################
# +------------------------------------------------------+ #
@ -820,6 +821,7 @@ fupgrades:
- 16
fbanners:
Enabled: true
Item:
Name: '&e&l*&f&l*&e&l* &e&lWar Banner &7(Place) &e&l*&f&l*&e&l*'
Lore:

View File

@ -1,5 +1,5 @@
name: Factions
version: ${project.version}-SF-1.0.21-BETA-2
version: ${project.version}-SF-1.0.22
main: com.massivecraft.factions.P
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage]
softdepend: [PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]