Version change

This commit is contained in:
ProSavage 2018-10-17 16:32:47 -05:00
parent f425663563
commit 4c89fff7de
2 changed files with 898 additions and 899 deletions

View File

@ -17,7 +17,6 @@ import com.massivecraft.factions.util.FactionGUI;
import com.massivecraft.factions.util.Particles.ParticleEffect; import com.massivecraft.factions.util.Particles.ParticleEffect;
import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.factions.util.VisualizeUtil;
import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.Permissable;
import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.persist.MemoryFPlayer; import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
@ -95,8 +94,8 @@ public class FactionsPlayerListener implements Listener {
Relation rel = myFaction.getRelationTo(otherFaction); Relation rel = myFaction.getRelationTo(otherFaction);
// Also cancel if player doesn't have ownership rights for this claim // Also cancel if player doesn't have ownership rights for this claim
if (Conf.ownedAreasEnabled && myFaction == otherFaction && !myFaction.playerHasOwnershipRights(me, loc)) { if (Conf.ownedAreasEnabled && myFaction == otherFaction && ! myFaction.playerHasOwnershipRights(me, loc)) {
if (!justCheck) { if (! justCheck) {
me.msg("<b>You can't use that in this territory, it is owned by: " + otherFaction.getOwnerListString(loc)); me.msg("<b>You can't use that in this territory, it is owned by: " + otherFaction.getOwnerListString(loc));
} }
return false; return false;
@ -106,41 +105,41 @@ public class FactionsPlayerListener implements Listener {
} }
if (otherFaction.hasPlayersOnline()) { if (otherFaction.hasPlayersOnline()) {
if (!Conf.territoryDenyUseageMaterials.contains(material)) { if (! Conf.territoryDenyUseageMaterials.contains(material)) {
return true; // Item isn't one we're preventing for online factions. return true; // Item isn't one we're preventing for online factions.
} }
} else { } else {
if (!Conf.territoryDenyUseageMaterialsWhenOffline.contains(material)) { if (! Conf.territoryDenyUseageMaterialsWhenOffline.contains(material)) {
return true; // Item isn't one we're preventing for offline factions. return true; // Item isn't one we're preventing for offline factions.
} }
} }
if (otherFaction.isWilderness()) { if (otherFaction.isWilderness()) {
if (!Conf.wildernessDenyUseage || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) { if (! Conf.wildernessDenyUseage || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) {
return true; // This is not faction territory. Use whatever you like here. return true; // This is not faction territory. Use whatever you like here.
} }
if (!justCheck) { if (! justCheck) {
me.msg(TL.PLAYER_USE_WILDERNESS, TextUtil.getMaterialName(material)); me.msg(TL.PLAYER_USE_WILDERNESS, TextUtil.getMaterialName(material));
} }
return false; return false;
} else if (otherFaction.isSafeZone()) { } else if (otherFaction.isSafeZone()) {
if (!Conf.safeZoneDenyUseage || Permission.MANAGE_SAFE_ZONE.has(player)) { if (! Conf.safeZoneDenyUseage || Permission.MANAGE_SAFE_ZONE.has(player)) {
return true; return true;
} }
if (!justCheck) { if (! justCheck) {
me.msg(TL.PLAYER_USE_SAFEZONE, TextUtil.getMaterialName(material)); me.msg(TL.PLAYER_USE_SAFEZONE, TextUtil.getMaterialName(material));
} }
return false; return false;
} else if (otherFaction.isWarZone()) { } else if (otherFaction.isWarZone()) {
if (!Conf.warZoneDenyUseage || Permission.MANAGE_WAR_ZONE.has(player)) { if (! Conf.warZoneDenyUseage || Permission.MANAGE_WAR_ZONE.has(player)) {
return true; return true;
} }
if (!justCheck) { if (! justCheck) {
me.msg(TL.PLAYER_USE_WARZONE, TextUtil.getMaterialName(material)); me.msg(TL.PLAYER_USE_WARZONE, TextUtil.getMaterialName(material));
} }
@ -149,7 +148,7 @@ public class FactionsPlayerListener implements Listener {
// Cancel if we are not in our own territory // Cancel if we are not in our own territory
if (rel.confDenyUseage()) { if (rel.confDenyUseage()) {
if (!justCheck) { if (! justCheck) {
me.msg(TL.PLAYER_USE_TERRITORY, TextUtil.getMaterialName(material), otherFaction.getTag(myFaction)); me.msg(TL.PLAYER_USE_TERRITORY, TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
} }
@ -159,9 +158,9 @@ public class FactionsPlayerListener implements Listener {
Access access = otherFaction.getAccess(me, PermissableAction.ITEM); Access access = otherFaction.getAccess(me, PermissableAction.ITEM);
if (access != null && access != Access.UNDEFINED) { if (access != null && access != Access.UNDEFINED) {
// TODO: Update this once new access values are added other than just allow / deny. // TODO: Update this once new access values are added other than just allow / deny.
if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) { if ((myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) {
return true; return true;
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) { } else if (myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && ! myFaction.getOwnerListString(loc).contains(player.getName())) {
me.msg("<b>You can't use items in this territory, it is owned by: " + myFaction.getOwnerListString(loc)); me.msg("<b>You can't use items in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
return false; return false;
} else if (access == Access.DENY) { } else if (access == Access.DENY) {
@ -192,7 +191,7 @@ public class FactionsPlayerListener implements Listener {
// no door/chest/whatever protection in wilderness, war zones, or safe zones // no door/chest/whatever protection in wilderness, war zones, or safe zones
if (!otherFaction.isNormal()) { if (! otherFaction.isNormal()) {
return true; return true;
} }
@ -200,7 +199,7 @@ public class FactionsPlayerListener implements Listener {
return true; return true;
} }
if (!rel.isMember() || !otherFaction.playerHasOwnershipRights(me, loc) && player.getItemInHand().getType() != null) { if (! rel.isMember() || ! otherFaction.playerHasOwnershipRights(me, loc) && player.getItemInHand().getType() != null) {
if (player.getItemInHand().getType().toString().toUpperCase().contains("DOOR")) { if (player.getItemInHand().getType().toString().toUpperCase().contains("DOOR")) {
return false; return false;
@ -294,11 +293,11 @@ public class FactionsPlayerListener implements Listener {
// We only care about some material types. // We only care about some material types.
if (otherFaction.hasPlayersOnline()) { if (otherFaction.hasPlayersOnline()) {
if (!Conf.territoryProtectedMaterials.contains(material)) { if (! Conf.territoryProtectedMaterials.contains(material)) {
return true; return true;
} }
} else { } else {
if (!Conf.territoryProtectedMaterialsWhenOffline.contains(material)) { if (! Conf.territoryProtectedMaterialsWhenOffline.contains(material)) {
return true; return true;
} }
} }
@ -306,8 +305,9 @@ public class FactionsPlayerListener implements Listener {
Access access = otherFaction.getAccess(me, action); Access access = otherFaction.getAccess(me, action);
boolean doTerritoryEnemyProtectedCheck = true; boolean doTerritoryEnemyProtectedCheck = true;
if (action.equals(PermissableAction.CONTAINER) || if (action.equals(PermissableAction.CONTAINER) ||
action.equals(PermissableAction.DOOR)) { (action.equals(PermissableAction.DOOR))) {
if (access == Access.ALLOW) { if (access == Access.ALLOW) {
doTerritoryEnemyProtectedCheck = false; doTerritoryEnemyProtectedCheck = false;
} }
@ -318,7 +318,7 @@ public class FactionsPlayerListener implements Listener {
if (doTerritoryEnemyProtectedCheck) { if (doTerritoryEnemyProtectedCheck) {
// You may use any block unless it is another faction's territory... // You may use any block unless it is another faction's territory...
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials) || (rel.isTruce() && Conf.territoryTruceProtectMaterials)) { if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials) || (rel.isTruce() && Conf.territoryTruceProtectMaterials)) {
if (!justCheck) { if (! justCheck) {
me.msg(TL.PLAYER_USE_TERRITORY, (material == P.p.SOIL ? "trample " : "use ") + TextUtil.getMaterialName(material), otherFaction.getTag(myFaction)); me.msg(TL.PLAYER_USE_TERRITORY, (material == P.p.SOIL ? "trample " : "use ") + TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
} }
return false; return false;
@ -326,12 +326,11 @@ public class FactionsPlayerListener implements Listener {
} }
if (access != Access.ALLOW && me.getRole() != Role.ADMIN) { if (access != Access.ALLOW && me.getRole() != Role.ADMIN) {
// TODO: Update this once new access values are added other than just allow / deny. // TODO: Update this once new access values are added other than just allow / deny.
if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) { if ((myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) {
return true; return true;
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) { } else if (myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && ! myFaction.getOwnerListString(loc).contains(player.getName())) {
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc)); me.msg("<b>You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
return false; return false;
} else if (access == Access.DENY) { } else if (access == Access.DENY) {
@ -360,8 +359,8 @@ public class FactionsPlayerListener implements Listener {
} }
if (me.hasFaction() && if (me.hasFaction() &&
!me.isAdminBypassing() && ! me.isAdminBypassing() &&
!Conf.permanentFactionMemberDenyCommands.isEmpty() && ! Conf.permanentFactionMemberDenyCommands.isEmpty() &&
me.getFaction().isPermanent() && me.getFaction().isPermanent() &&
isCommandInList(fullCmd, shortCmd, Conf.permanentFactionMemberDenyCommands.iterator())) { isCommandInList(fullCmd, shortCmd, Conf.permanentFactionMemberDenyCommands.iterator())) {
me.msg(TL.PLAYER_COMMAND_PERMANENT, fullCmd); me.msg(TL.PLAYER_COMMAND_PERMANENT, fullCmd);
@ -369,28 +368,28 @@ public class FactionsPlayerListener implements Listener {
} }
Faction at = Board.getInstance().getFactionAt(new FLocation(player.getLocation())); Faction at = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
if (at.isWilderness() && !Conf.wildernessDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.wildernessDenyCommands.iterator())) { if (at.isWilderness() && ! Conf.wildernessDenyCommands.isEmpty() && ! me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.wildernessDenyCommands.iterator())) {
me.msg(TL.PLAYER_COMMAND_WILDERNESS, fullCmd); me.msg(TL.PLAYER_COMMAND_WILDERNESS, fullCmd);
return true; return true;
} }
Relation rel = at.getRelationTo(me); Relation rel = at.getRelationTo(me);
if (at.isNormal() && rel.isAlly() && !Conf.territoryAllyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryAllyDenyCommands.iterator())) { if (at.isNormal() && rel.isAlly() && ! Conf.territoryAllyDenyCommands.isEmpty() && ! me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryAllyDenyCommands.iterator())) {
me.msg(TL.PLAYER_COMMAND_ALLY, fullCmd); me.msg(TL.PLAYER_COMMAND_ALLY, fullCmd);
return false; return false;
} }
if (at.isNormal() && rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) { if (at.isNormal() && rel.isNeutral() && ! Conf.territoryNeutralDenyCommands.isEmpty() && ! me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) {
me.msg(TL.PLAYER_COMMAND_NEUTRAL, fullCmd); me.msg(TL.PLAYER_COMMAND_NEUTRAL, fullCmd);
return true; return true;
} }
if (at.isNormal() && rel.isEnemy() && !Conf.territoryEnemyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryEnemyDenyCommands.iterator())) { if (at.isNormal() && rel.isEnemy() && ! Conf.territoryEnemyDenyCommands.isEmpty() && ! me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryEnemyDenyCommands.iterator())) {
me.msg(TL.PLAYER_COMMAND_ENEMY, fullCmd); me.msg(TL.PLAYER_COMMAND_ENEMY, fullCmd);
return true; return true;
} }
if (at.isWarZone() && !Conf.warzoneDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.warzoneDenyCommands.iterator())) { if (at.isWarZone() && ! Conf.warzoneDenyCommands.isEmpty() && ! me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.warzoneDenyCommands.iterator())) {
me.msg(TL.PLAYER_COMMAND_WARZONE, fullCmd); me.msg(TL.PLAYER_COMMAND_WARZONE, fullCmd);
return true; return true;
} }
@ -415,7 +414,7 @@ public class FactionsPlayerListener implements Listener {
return false; return false;
} }
@EventHandler(priority = EventPriority.NORMAL) @EventHandler (priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
initPlayer(event.getPlayer()); initPlayer(event.getPlayer());
} }
@ -450,7 +449,7 @@ public class FactionsPlayerListener implements Listener {
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
if (!myFaction.isWilderness()) { if (! myFaction.isWilderness()) {
for (FPlayer other : myFaction.getFPlayersWhereOnline(true)) { for (FPlayer other : myFaction.getFPlayersWhereOnline(true)) {
if (other != me && other.isMonitoringJoins()) { if (other != me && other.isMonitoringJoins()) {
other.msg(TL.FACTION_LOGIN, me.getName()); other.msg(TL.FACTION_LOGIN, me.getName());
@ -469,19 +468,19 @@ public class FactionsPlayerListener implements Listener {
}, 180L); }, 180L);
if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) { if (me.isSpyingChat() && ! player.hasPermission(Permission.CHATSPY.node)) {
me.setSpyingChat(false); me.setSpyingChat(false);
P.p.log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName()); P.p.log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName());
} }
if (me.isAdminBypassing() && !player.hasPermission(Permission.BYPASS.node)) { if (me.isAdminBypassing() && ! player.hasPermission(Permission.BYPASS.node)) {
me.setIsAdminBypassing(false); me.setIsAdminBypassing(false);
P.p.log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName()); P.p.log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName());
} }
// If they have the permission, don't let them autoleave. Bad inverted setter :\ // If they have the permission, don't let them autoleave. Bad inverted setter :\
me.setAutoLeave(!player.hasPermission(Permission.AUTO_LEAVE_BYPASS.node)); me.setAutoLeave(! player.hasPermission(Permission.AUTO_LEAVE_BYPASS.node));
me.setTakeFallDamage(true); me.setTakeFallDamage(true);
} }
@ -498,7 +497,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.NORMAL) @EventHandler (priority = EventPriority.NORMAL)
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
@ -517,11 +516,11 @@ public class FactionsPlayerListener implements Listener {
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
if (!myFaction.isWilderness()) { if (! myFaction.isWilderness()) {
myFaction.memberLoggedOff(); myFaction.memberLoggedOff();
} }
if (!myFaction.isWilderness()) { if (! myFaction.isWilderness()) {
for (FPlayer player : myFaction.getFPlayersWhereOnline(true)) { for (FPlayer player : myFaction.getFPlayersWhereOnline(true)) {
if (player != me && player.isMonitoringJoins()) { if (player != me && player.isMonitoringJoins()) {
player.msg(TL.FACTION_LOGOUT, me.getName()); player.msg(TL.FACTION_LOGOUT, me.getName());
@ -552,12 +551,12 @@ public class FactionsPlayerListener implements Listener {
me.setFlying(true); me.setFlying(true);
CmdFly.flyMap.put(me.getName(), true); CmdFly.flyMap.put(me.getName(), true);
if (CmdFly.id == -1) { if (CmdFly.id == - 1) {
if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) { if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) {
CmdFly.startParticles(); CmdFly.startParticles();
} }
} }
if (CmdFly.flyid == -1) { if (CmdFly.flyid == - 1) {
CmdFly.startFlyCheck(); CmdFly.startFlyCheck();
} }
} }
@ -568,12 +567,12 @@ public class FactionsPlayerListener implements Listener {
public void onInspect(PlayerInteractEvent e) { public void onInspect(PlayerInteractEvent e) {
if (e.getAction().name().contains("BLOCK")) { if (e.getAction().name().contains("BLOCK")) {
FPlayer fplayer = FPlayers.getInstance().getByPlayer(e.getPlayer()); FPlayer fplayer = FPlayers.getInstance().getByPlayer(e.getPlayer());
if (!fplayer.isInspectMode()) { if (! fplayer.isInspectMode()) {
return; return;
} }
e.setCancelled(true); e.setCancelled(true);
if (!fplayer.isAdminBypassing()) { if (! fplayer.isAdminBypassing()) {
if (!fplayer.hasFaction()) { if (! fplayer.hasFaction()) {
fplayer.setInspectMode(false); fplayer.setInspectMode(false);
fplayer.msg(TL.COMMAND_INSPECT_DISABLED_NOFAC); fplayer.msg(TL.COMMAND_INSPECT_DISABLED_NOFAC);
return; return;
@ -628,8 +627,7 @@ public class FactionsPlayerListener implements Listener {
} }
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) { public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer me = FPlayers.getInstance().getByPlayer(player); FPlayer me = FPlayers.getInstance().getByPlayer(player);
@ -675,8 +673,8 @@ public class FactionsPlayerListener implements Listener {
title = parseAllPlaceholders(title, factionTo, player); title = parseAllPlaceholders(title, factionTo, player);
String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
subTitle = parseAllPlaceholders(subTitle, factionTo, player); subTitle = parseAllPlaceholders(subTitle, factionTo, player);
if (!P.p.mc17) { if (! P.p.mc17) {
if (!P.p.mc18) { if (! P.p.mc18) {
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle), P.p.getConfig().getInt("Title.Options.FadeInTime"), me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle), P.p.getConfig().getInt("Title.Options.FadeInTime"),
P.p.getConfig().getInt("Title.Options.ShowTime"), P.p.getConfig().getInt("Title.Options.ShowTime"),
P.p.getConfig().getInt("Title.Options.FadeOutTime")); P.p.getConfig().getInt("Title.Options.FadeOutTime"));
@ -689,13 +687,13 @@ public class FactionsPlayerListener implements Listener {
} }
if (!P.p.factionsFlight) { if (! P.p.factionsFlight) {
return; return;
} }
// enable fly :) // enable fly :)
if (me.hasFaction() && !me.isFlying()) { if (me.hasFaction() && ! me.isFlying()) {
if (factionTo == me.getFaction()) { if (factionTo == me.getFaction()) {
enableFly(me); enableFly(me);
} }
@ -707,7 +705,7 @@ public class FactionsPlayerListener implements Listener {
(relationTo == Relation.ENEMY && me.canflyinEnemy()) || (relationTo == Relation.ENEMY && me.canflyinEnemy()) ||
(relationTo == Relation.ALLY && me.canflyinAlly()) || (relationTo == Relation.ALLY && me.canflyinAlly()) ||
(relationTo == Relation.TRUCE && me.canflyinTruce()) || (relationTo == Relation.TRUCE && me.canflyinTruce()) ||
(relationTo == Relation.NEUTRAL && me.canflyinNeutral() && !isSystemFaction(factionTo))) { (relationTo == Relation.NEUTRAL && me.canflyinNeutral() && ! isSystemFaction(factionTo))) {
enableFly(me); enableFly(me);
} }
@ -729,15 +727,15 @@ public class FactionsPlayerListener implements Listener {
String ownersTo = myFaction.getOwnerListString(to); String ownersTo = myFaction.getOwnerListString(to);
if (changedFaction) { if (changedFaction) {
me.sendFactionHereMessage(factionFrom); me.sendFactionHereMessage(factionFrom);
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) { if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && ! ownersTo.isEmpty()) {
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo)); me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
} }
} else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && !myFaction.isWilderness()) { } else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && ! myFaction.isWilderness()) {
String ownersFrom = myFaction.getOwnerListString(from); String ownersFrom = myFaction.getOwnerListString(from);
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) { if (Conf.ownedMessageByChunk || ! ownersFrom.equals(ownersTo)) {
if (!ownersTo.isEmpty()) { if (! ownersTo.isEmpty()) {
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo)); me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
} else if (!TL.GENERIC_PUBLICLAND.toString().isEmpty()) { } else if (! TL.GENERIC_PUBLICLAND.toString().isEmpty()) {
me.sendMessage(TL.GENERIC_PUBLICLAND.toString()); me.sendMessage(TL.GENERIC_PUBLICLAND.toString());
} }
} }
@ -747,19 +745,19 @@ public class FactionsPlayerListener implements Listener {
if (me.getAutoClaimFor() != null) { if (me.getAutoClaimFor() != null) {
me.attemptClaim(me.getAutoClaimFor(), event.getTo(), true); me.attemptClaim(me.getAutoClaimFor(), event.getTo(), true);
} else if (me.isAutoSafeClaimEnabled()) { } else if (me.isAutoSafeClaimEnabled()) {
if (!Permission.MANAGE_SAFE_ZONE.has(player)) { if (! Permission.MANAGE_SAFE_ZONE.has(player)) {
me.setIsAutoSafeClaimEnabled(false); me.setIsAutoSafeClaimEnabled(false);
} else { } else {
if (!Board.getInstance().getFactionAt(to).isSafeZone()) { if (! Board.getInstance().getFactionAt(to).isSafeZone()) {
Board.getInstance().setFactionAt(Factions.getInstance().getSafeZone(), to); Board.getInstance().setFactionAt(Factions.getInstance().getSafeZone(), to);
me.msg(TL.PLAYER_SAFEAUTO); me.msg(TL.PLAYER_SAFEAUTO);
} }
} }
} else if (me.isAutoWarClaimEnabled()) { } else if (me.isAutoWarClaimEnabled()) {
if (!Permission.MANAGE_WAR_ZONE.has(player)) { if (! Permission.MANAGE_WAR_ZONE.has(player)) {
me.setIsAutoWarClaimEnabled(false); me.setIsAutoWarClaimEnabled(false);
} else { } else {
if (!Board.getInstance().getFactionAt(to).isWarZone()) { if (! Board.getInstance().getFactionAt(to).isWarZone()) {
Board.getInstance().setFactionAt(Factions.getInstance().getWarZone(), to); Board.getInstance().setFactionAt(Factions.getInstance().getWarZone(), to);
me.msg(TL.PLAYER_WARAUTO); me.msg(TL.PLAYER_WARAUTO);
} }
@ -882,7 +880,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
/// Prevents the use of montster eggs in oned land. /// Prevents the use of montster eggs in oned land.
/*if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { /*if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
@ -914,7 +912,7 @@ public class FactionsPlayerListener implements Listener {
return; // clicked in air, apparently return; // clicked in air, apparently
} }
if (!canPlayerUseBlock(player, block, false)) { if (! canPlayerUseBlock(player, block, false)) {
event.setCancelled(true); event.setCancelled(true);
if (Conf.handleExploitInteractionSpam) { if (Conf.handleExploitInteractionSpam) {
String name = player.getName(); String name = player.getName();
@ -937,11 +935,12 @@ public class FactionsPlayerListener implements Listener {
return; // only interested on right-clicks for below return; // only interested on right-clicks for below
} }
if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) { if (! playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.HIGH)
@EventHandler (priority = EventPriority.HIGH)
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
@ -951,34 +950,34 @@ public class FactionsPlayerListener implements Listener {
if (Conf.homesEnabled && if (Conf.homesEnabled &&
Conf.homesTeleportToOnDeath && Conf.homesTeleportToOnDeath &&
home != null && home != null &&
(Conf.homesRespawnFromNoPowerLossWorlds || !Conf.worldsNoPowerLoss.contains(event.getPlayer().getWorld().getName()))) { (Conf.homesRespawnFromNoPowerLossWorlds || ! Conf.worldsNoPowerLoss.contains(event.getPlayer().getWorld().getName()))) {
event.setRespawnLocation(home); event.setRespawnLocation(home);
} }
} }
// For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected), // For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected),
// but these separate bucket events below always fire without fail // but these separate bucket events below always fire without fail
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
Block block = event.getBlockClicked(); Block block = event.getBlockClicked();
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!playerCanUseItemHere(player, block.getLocation(), event.getBucket(), false)) { if (! playerCanUseItemHere(player, block.getLocation(), event.getBucket(), false)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event) { public void onPlayerBucketFill(PlayerBucketFillEvent event) {
Block block = event.getBlockClicked(); Block block = event.getBlockClicked();
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!playerCanUseItemHere(player, block.getLocation(), event.getBucket(), false)) { if (! playerCanUseItemHere(player, block.getLocation(), event.getBucket(), false)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler (priority = EventPriority.HIGH)
public void onPlayerInteractGUI(InventoryClickEvent event) { public void onPlayerInteractGUI(InventoryClickEvent event) {
if (event.getClickedInventory() == null) { if (event.getClickedInventory() == null) {
return; return;
@ -989,14 +988,14 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler (priority = EventPriority.HIGH)
public void onPlayerMoveGUI(InventoryDragEvent event) { public void onPlayerMoveGUI(InventoryDragEvent event) {
if (event.getInventory().getHolder() instanceof FactionGUI) { if (event.getInventory().getHolder() instanceof FactionGUI) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerKick(PlayerKickEvent event) { public void onPlayerKick(PlayerKickEvent event) {
FPlayer badGuy = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer badGuy = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (badGuy == null) { if (badGuy == null) {
@ -1014,12 +1013,12 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
final public void onFactionJoin(FPlayerJoinEvent event) { final public void onFactionJoin(FPlayerJoinEvent event) {
FTeamWrapper.applyUpdatesLater(event.getFaction()); FTeamWrapper.applyUpdatesLater(event.getFaction());
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFactionLeave(FPlayerLeaveEvent event) { public void onFactionLeave(FPlayerLeaveEvent event) {
FTeamWrapper.applyUpdatesLater(event.getFaction()); FTeamWrapper.applyUpdatesLater(event.getFaction());
} }

View File

@ -1,5 +1,5 @@
name: Factions name: Factions
version: ${project.version}-1.4-RC-2 version: ${project.version}-1.4-RC-3
api-version: 1.13 api-version: 1.13
main: com.massivecraft.factions.P main: com.massivecraft.factions.P
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, AL56AF50] authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage, AL56AF50]