diff --git a/pom.xml b/pom.xml
index 53c38a3b..79697667 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,16 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
-
-
-
- net.knarcraft
+ com.massivecraft.factions
Factions
jar
@@ -26,8 +18,8 @@
UTF-8
- 17
- 17
+ 16
+ 16
@@ -36,8 +28,8 @@
https://hub.spigotmc.org/nexus/content/repositories/snapshots/
- vault-repo
- http://nexus.hc.to/content/repositories/pub_releases
+ jitpack.io
+ https://jitpack.io
engine-hub-repo
@@ -59,7 +51,7 @@
org.spigotmc
spigot-api
- 1.19.1-R0.1-SNAPSHOT
+ 1.19.4-R0.1-SNAPSHOT
@@ -67,7 +59,7 @@
MassiveCore
RELEASE
system
- lib\MassiveCore.jar
+ ${project.basedir}\lib\MassiveCore.jar
@@ -93,9 +85,10 @@
- net.milkbowl.vault
+ com.github.MilkBowl
VaultAPI
1.7
+ provided
@@ -103,7 +96,7 @@
lwc
RELEASE
system
- lib\LWC.jar
+ ${project.basedir}\lib\LWC.jar
@@ -118,7 +111,7 @@
VentureChat
RELEASE
system
- lib\VentureChat.jar
+ ${project.basedir}\lib\VentureChat.jar
@@ -146,8 +139,8 @@
maven-compiler-plugin
3.7.0
-
- 17
+
+ 16
diff --git a/src/main/java/com/massivecraft/factions/ExtractorFactionAccountId.java b/src/main/java/com/massivecraft/factions/ExtractorFactionAccountId.java
index eea6977c..54017c6d 100644
--- a/src/main/java/com/massivecraft/factions/ExtractorFactionAccountId.java
+++ b/src/main/java/com/massivecraft/factions/ExtractorFactionAccountId.java
@@ -22,9 +22,9 @@ public class ExtractorFactionAccountId implements Extractor {
public Object extract(Object o) {
if (o instanceof Faction) {
String factionId = ((Faction) o).getId();
- if (factionId == null) {
- return null;
- }
+ if (factionId == null) {
+ return null;
+ }
return Factions.FACTION_MONEY_ACCOUNT_ID_PREFIX + factionId;
}
diff --git a/src/main/java/com/massivecraft/factions/FactionsIndex.java b/src/main/java/com/massivecraft/factions/FactionsIndex.java
index d98c5c0c..d0d9d3c7 100644
--- a/src/main/java/com/massivecraft/factions/FactionsIndex.java
+++ b/src/main/java/com/massivecraft/factions/FactionsIndex.java
@@ -51,12 +51,12 @@ public class FactionsIndex {
// -------------------------------------------- //
private boolean isConnected(MPlayer mplayer, Faction faction) {
- if (mplayer == null) {
- throw new NullPointerException("mplayer");
- }
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (mplayer == null) {
+ throw new NullPointerException("mplayer");
+ }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
return mplayer.getFaction() == faction;
}
@@ -78,20 +78,20 @@ public class FactionsIndex {
// -------------------------------------------- //
public synchronized void updateAll() {
- if (!MPlayerColl.get().isActive()) {
- throw new IllegalStateException("The MPlayerColl is not yet fully activated.");
- }
+ if (!MPlayerColl.get().isActive()) {
+ throw new IllegalStateException("The MPlayerColl is not yet fully activated.");
+ }
MPlayerColl.get().getAll().forEach(this::update);
}
public synchronized void update(MPlayer mplayer) {
- if (mplayer == null) {
- throw new NullPointerException("mplayer");
- }
- if (!FactionColl.get().isActive()) {
- throw new IllegalStateException("The FactionColl is not yet fully activated.");
- }
+ if (mplayer == null) {
+ throw new NullPointerException("mplayer");
+ }
+ if (!FactionColl.get().isActive()) {
+ throw new IllegalStateException("The FactionColl is not yet fully activated.");
+ }
// TODO: This is not optimal but here we remove a player from the index when
// the mplayer object is deattached. Optimally it should be removed
@@ -110,12 +110,12 @@ public class FactionsIndex {
Faction factionIndexed = this.getFaction(mplayer);
Set factions = new MassiveSet<>();
- if (factionActual != null) {
- factions.add(factionActual);
- }
- if (factionIndexed != null) {
- factions.add(factionIndexed);
- }
+ if (factionActual != null) {
+ factions.add(factionActual);
+ }
+ if (factionIndexed != null) {
+ factions.add(factionIndexed);
+ }
for (Faction faction : factions) {
boolean connected = this.isConnected(mplayer, faction);
@@ -130,9 +130,9 @@ public class FactionsIndex {
}
public synchronized void update(Faction faction) {
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.getMPlayers(faction).forEach(this::update);
}
diff --git a/src/main/java/com/massivecraft/factions/TerritoryAccess.java b/src/main/java/com/massivecraft/factions/TerritoryAccess.java
index 63b74b46..81d6babd 100644
--- a/src/main/java/com/massivecraft/factions/TerritoryAccess.java
+++ b/src/main/java/com/massivecraft/factions/TerritoryAccess.java
@@ -117,12 +117,12 @@ public class TerritoryAccess {
}
private TerritoryAccess(String hostFactionId, Boolean hostFactionAllowed, Collection grantedIds, String chunkName) {
- if (hostFactionId == null) {
- throw new NullPointerException("hostFactionId");
- }
- if (grantedIds == null) {
- throw new NullPointerException("grantedIds");
- }
+ if (hostFactionId == null) {
+ throw new NullPointerException("hostFactionId");
+ }
+ if (grantedIds == null) {
+ throw new NullPointerException("grantedIds");
+ }
this.hostFactionId = hostFactionId;
Set grantedIdsInner = new MassiveSet<>();
@@ -142,19 +142,19 @@ public class TerritoryAccess {
// -------------------------------------------- //
public static TerritoryAccess valueOf(String hostFactionId, Boolean hostFactionAllowed, Collection grantedIds, String chunkName) {
- if (hostFactionId == null) {
- throw new NullPointerException("hostFactionId");
- }
- if (grantedIds == null) {
- throw new NullPointerException("grantedIds");
- }
+ if (hostFactionId == null) {
+ throw new NullPointerException("hostFactionId");
+ }
+ if (grantedIds == null) {
+ throw new NullPointerException("grantedIds");
+ }
return new TerritoryAccess(hostFactionId, hostFactionAllowed, grantedIds, chunkName);
}
public static TerritoryAccess valueOf(String hostFactionId) {
- if (hostFactionId == null) {
- throw new NullPointerException("hostFactionId");
- }
+ if (hostFactionId == null) {
+ throw new NullPointerException("hostFactionId");
+ }
return valueOf(hostFactionId, null, Collections.emptySet(), null);
}
@@ -167,9 +167,9 @@ public class TerritoryAccess {
}
public boolean isGranted(String permableId) {
- if (permableId.equals(this.hostFactionId)) {
- return this.isHostFactionAllowed();
- }
+ if (permableId.equals(this.hostFactionId)) {
+ return this.isHostFactionAllowed();
+ }
return this.getGrantedIds().contains(permableId);
}
@@ -184,26 +184,26 @@ public class TerritoryAccess {
// -------------------------------------------- //
public AccessStatus getTerritoryAccess(MPlayer mplayer) {
- if (isGranted(mplayer.getId())) {
- return AccessStatus.ELEVATED;
- }
- if (isGranted(mplayer.getRank().getId())) {
- return AccessStatus.ELEVATED;
- }
+ if (isGranted(mplayer.getId())) {
+ return AccessStatus.ELEVATED;
+ }
+ if (isGranted(mplayer.getRank().getId())) {
+ return AccessStatus.ELEVATED;
+ }
if (this.getHostFactionId().equals(mplayer.getFaction().getId())) {
- if (this.isHostFactionAllowed()) {
- return AccessStatus.STANDARD;
- } else {
- return AccessStatus.DECREASED;
- }
+ if (this.isHostFactionAllowed()) {
+ return AccessStatus.STANDARD;
+ } else {
+ return AccessStatus.DECREASED;
+ }
+ }
+ if (isGranted(mplayer.getFaction().getId())) {
+ return AccessStatus.ELEVATED;
+ }
+ if (isGranted(RelationUtil.getRelationOfThatToMe(mplayer, this.getHostFaction()).toString())) {
+ return AccessStatus.ELEVATED;
}
- if (isGranted(mplayer.getFaction().getId())) {
- return AccessStatus.ELEVATED;
- }
- if (isGranted(RelationUtil.getRelationOfThatToMe(mplayer, this.getHostFaction()).toString())) {
- return AccessStatus.ELEVATED;
- }
return AccessStatus.STANDARD;
}
diff --git a/src/main/java/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java b/src/main/java/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java
index 8802b8db..ba2428cf 100644
--- a/src/main/java/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java
+++ b/src/main/java/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java
@@ -68,28 +68,28 @@ public class TerritoryAccessAdapter implements JsonDeserializer
hostFactionId = element.getAsString();
element = obj.get(HOST_FACTION_ALLOWED);
- if (element != null) {
- hostFactionAllowed = element.getAsBoolean();
- }
+ if (element != null) {
+ hostFactionAllowed = element.getAsBoolean();
+ }
element = obj.get(GRANTED_IDS);
- if (element != null) {
- grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
- }
+ if (element != null) {
+ grantedIds = context.deserialize(element, SET_OF_STRING_TYPE);
+ }
element = obj.get(CHUNK_NAME);
- if (element != null) {
- chunkName = element.getAsString();
- }
+ if (element != null) {
+ chunkName = element.getAsString();
+ }
return TerritoryAccess.valueOf(hostFactionId, hostFactionAllowed, grantedIds, chunkName);
}
@Override
public JsonElement serialize(TerritoryAccess src, Type typeOfSrc, JsonSerializationContext context) {
- if (src == null) {
- return null;
- }
+ if (src == null) {
+ return null;
+ }
// isDefault <=> simple hostFactionId string
if (src.isDefault()) {
diff --git a/src/main/java/com/massivecraft/factions/chat/modifier/ChatModifierRp.java b/src/main/java/com/massivecraft/factions/chat/modifier/ChatModifierRp.java
index 072aecab..43c6475f 100644
--- a/src/main/java/com/massivecraft/factions/chat/modifier/ChatModifierRp.java
+++ b/src/main/java/com/massivecraft/factions/chat/modifier/ChatModifierRp.java
@@ -24,9 +24,9 @@ public class ChatModifierRp extends ChatModifier {
@Override
public String getModified(String subject, CommandSender sender, CommandSender recipient) {
- if (subject.equals("")) {
- return subject;
- }
+ if (subject.equals("")) {
+ return subject;
+ }
return subject + " ";
}
diff --git a/src/main/java/com/massivecraft/factions/chat/tag/ChatTagName.java b/src/main/java/com/massivecraft/factions/chat/tag/ChatTagName.java
index 8bffe129..b3320157 100644
--- a/src/main/java/com/massivecraft/factions/chat/tag/ChatTagName.java
+++ b/src/main/java/com/massivecraft/factions/chat/tag/ChatTagName.java
@@ -31,9 +31,9 @@ public class ChatTagName extends ChatTag {
// No "force"
Faction faction = usender.getFaction();
- if (faction.isNone()) {
- return "";
- }
+ if (faction.isNone()) {
+ return "";
+ }
return faction.getName();
}
diff --git a/src/main/java/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java b/src/main/java/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java
index 6bd754a2..373b3240 100644
--- a/src/main/java/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java
+++ b/src/main/java/com/massivecraft/factions/chat/tag/ChatTagRelcolor.java
@@ -26,9 +26,9 @@ public class ChatTagRelcolor extends ChatTag {
@Override
public String getReplacement(CommandSender sender, CommandSender recipient) {
// Opt out if no recipient
- if (recipient == null) {
- return null;
- }
+ if (recipient == null) {
+ return null;
+ }
// Get entities
MPlayer usender = MPlayer.get(sender);
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessInspect.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessInspect.java
index 09613314..ee947309 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessInspect.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessInspect.java
@@ -45,9 +45,9 @@ public class CmdFactionsAccessInspect extends FactionsCommand {
// Check if they have access perms, unless they are checking for their own access
if (mpermable != msender && mpermable != msenderFaction && mpermable != msender.getRank()) {
- if (!MPerm.getPermAccess().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermAccess().has(msender, faction, true)) {
+ return;
+ }
}
// Turn into id->chunks
@@ -60,9 +60,9 @@ public class CmdFactionsAccessInspect extends FactionsCommand {
.filter(e -> e.getValue().isGranted(mpermable))
.map(Entry::getKey)
.collect(Collectors.toSet());
- if (!chunks.isEmpty()) {
- world2Chunks.put(worldId, chunks);
- }
+ if (!chunks.isEmpty()) {
+ world2Chunks.put(worldId, chunks);
+ }
}
if (world2Chunks.isEmpty()) {
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetX.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetX.java
index 3ddac6c4..a08c703a 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetX.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsAccessSetX.java
@@ -52,9 +52,9 @@ public abstract class CmdFactionsAccessSetX extends CmdFactionsAccessAbstract {
final MPermable mpermable = this.getMPermable(hostFaction);
final Set chunks = this.getChunks();
- if (chunks == null) {
- throw new NullPointerException("chunks");
- }
+ if (chunks == null) {
+ throw new NullPointerException("chunks");
+ }
// Apply / Inform
setAccess(chunks, mpermable, this.isGranting());
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java
index e4882e02..ee3c0412 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsClean.java
@@ -54,9 +54,9 @@ public class CmdFactionsClean extends FactionsCommand {
int ret = 0;
for (MPlayer mplayer : MPlayerColl.get().getAll()) {
- if (!mplayer.isFactionOrphan()) {
- continue;
- }
+ if (!mplayer.isFactionOrphan()) {
+ continue;
+ }
mplayer.resetFactionData();
ret += 1;
@@ -70,9 +70,9 @@ public class CmdFactionsClean extends FactionsCommand {
for (Faction faction : FactionColl.get().getAll()) {
EntityInternalMap invitations = faction.getInvitations();
- if (invitations.isEmpty()) {
- continue;
- }
+ if (invitations.isEmpty()) {
+ continue;
+ }
ret += invitations.size();
Set invitationIds = new MassiveSet<>(invitations.keySet());
@@ -93,9 +93,9 @@ public class CmdFactionsClean extends FactionsCommand {
for (Iterator> iterator = faction.getRelationWishes().entrySet().iterator(); iterator.hasNext(); ) {
Entry entry = iterator.next();
String factionId = entry.getKey();
- if (FactionColl.get().containsId(factionId)) {
- continue;
- }
+ if (FactionColl.get().containsId(factionId)) {
+ continue;
+ }
iterator.remove();
ret += 1;
@@ -115,9 +115,9 @@ public class CmdFactionsClean extends FactionsCommand {
TerritoryAccess territoryAccess = entry.getValue();
String factionId = territoryAccess.getHostFactionId();
- if (FactionColl.get().containsId(factionId)) {
- continue;
- }
+ if (FactionColl.get().containsId(factionId)) {
+ continue;
+ }
board.removeAt(ps);
ret += 1;
@@ -137,9 +137,9 @@ public class CmdFactionsClean extends FactionsCommand {
boolean changed = false;
for (String grantedIds : territoryAccess.getGrantedIds()) {
- if (MPerm.idToMPermableOptional(grantedIds).isPresent()) {
- continue;
- }
+ if (MPerm.idToMPermableOptional(grantedIds).isPresent()) {
+ continue;
+ }
territoryAccess = territoryAccess.withGrantedId(grantedIds, false);
ret += 1;
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java
index 59f694ce..9415c5e3 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsCreate.java
@@ -45,9 +45,9 @@ public class CmdFactionsCreate extends FactionsCommand {
// Event
EventFactionsCreate createEvent = new EventFactionsCreate(sender, factionId, newName);
createEvent.run();
- if (createEvent.isCancelled()) {
- return;
- }
+ if (createEvent.isCancelled()) {
+ return;
+ }
// Apply
Faction faction = FactionColl.get().create(factionId);
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java
index d0df6d30..9fc837b3 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsDisband.java
@@ -38,14 +38,14 @@ public class CmdFactionsDisband extends FactionsCommand {
Faction faction = this.readArg();
String confirmationString = this.readArg(null);
- if (MConf.get().requireConfirmationForFactionDisbanding) {
- ConfirmationUtil.tryConfirm(this);
- }
+ if (MConf.get().requireConfirmationForFactionDisbanding) {
+ ConfirmationUtil.tryConfirm(this);
+ }
// MPerm
- if (!MPerm.getPermDisband().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermDisband().has(msender, faction, true)) {
+ return;
+ }
// Verify
if (faction.getFlag(MFlag.getFlagPermanent())) {
@@ -55,9 +55,9 @@ public class CmdFactionsDisband extends FactionsCommand {
// Event
EventFactionsDisband event = new EventFactionsDisband(me, faction);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
// Merged Apply and Inform
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java
index 58e57dd6..84791fbd 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsFly.java
@@ -45,14 +45,14 @@ public class CmdFactionsFly extends MassiveCommandToggle {
public void setValue(boolean value) throws MassiveException {
MPlayer mplayer = MPlayer.get(sender);
Player player = me;
- if (player == null) {
- throw new MassiveException().addMsg("Could not find player.");
- }
+ if (player == null) {
+ throw new MassiveException().addMsg("Could not find player.");
+ }
PS ps = PS.valueOf(player);
- if (value) {
- EngineFly.canFlyInTerritoryOrThrow(mplayer, ps);
- }
+ if (value) {
+ EngineFly.canFlyInTerritoryOrThrow(mplayer, ps);
+ }
mplayer.setFlying(value);
EngineMassiveCorePlayerUpdate.update(player, false);
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteAdd.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteAdd.java
index a59af1c0..51ea4f8c 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteAdd.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteAdd.java
@@ -37,9 +37,9 @@ public class CmdFactionsInviteAdd extends FactionsCommand {
long creationMillis = System.currentTimeMillis();
// MPerm
- if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
+ return;
+ }
for (MPlayer mplayer : mplayers) {
// Already member?
@@ -55,9 +55,9 @@ public class CmdFactionsInviteAdd extends FactionsCommand {
// Event
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, isInvited);
event.run();
- if (event.isCancelled()) {
- continue;
- }
+ if (event.isCancelled()) {
+ continue;
+ }
isInvited = event.isNewInvited();
// Inform
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteList.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteList.java
index 62270407..fbfdda56 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteList.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteList.java
@@ -42,14 +42,14 @@ public class CmdFactionsInviteList extends FactionsCommand {
Faction faction = this.readArg(msenderFaction);
- if (faction != msenderFaction && !Perm.INVITE_LIST_OTHER.has(sender, true)) {
- return;
- }
+ if (faction != msenderFaction && !Perm.INVITE_LIST_OTHER.has(sender, true)) {
+ return;
+ }
// MPerm
- if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
+ return;
+ }
// Pager Create
final List> invitations = new MassiveList<>(faction.getInvitations().entrySet());
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java
index c47ed221..ad460f50 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsInviteRemove.java
@@ -50,9 +50,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
}
// MPerm
- if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermInvite().has(msender, msenderFaction, true)) {
+ return;
+ }
for (MPlayer mplayer : mplayers) {
// Already member?
@@ -79,9 +79,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
// Event
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, isInvited);
event.run();
- if (event.isCancelled()) {
- continue;
- }
+ if (event.isCancelled()) {
+ continue;
+ }
isInvited = event.isNewInvited();
// Inform Player
@@ -96,9 +96,9 @@ public class CmdFactionsInviteRemove extends FactionsCommand {
msenderFaction.uninvite(mplayer);
// If all, we do this at last. So we only do it once.
- if (!all) {
- msenderFaction.changed();
- }
+ if (!all) {
+ msenderFaction.changed();
+ }
} else {
// Mson
String command = CmdFactions.get().cmdFactionsInvite.cmdFactionsInviteAdd.getCommandLine(mplayer.getName());
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java
index 8e3f7fef..30e966cb 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsMoneyBalance.java
@@ -28,9 +28,9 @@ public class CmdFactionsMoneyBalance extends FactionsCommand {
public void perform() throws MassiveException {
Faction faction = this.readArg(msenderFaction);
- if (faction != msenderFaction && !Perm.MONEY_BALANCE_ANY.has(sender, true)) {
- return;
- }
+ if (faction != msenderFaction && !Perm.MONEY_BALANCE_ANY.has(sender, true)) {
+ return;
+ }
Econ.sendBalanceInfo(msender, faction);
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsName.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsName.java
index 6220d9fb..eca063b4 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsName.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsName.java
@@ -29,16 +29,16 @@ public class CmdFactionsName extends FactionsCommand {
Faction faction = this.readArg(msenderFaction);
// MPerm
- if (!MPerm.getPermName().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermName().has(msender, faction, true)) {
+ return;
+ }
// Event
EventFactionsNameChange event = new EventFactionsNameChange(sender, faction, newName);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
newName = event.getNewName();
// Apply
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermSet.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermSet.java
index 5d43cc7b..109f18b3 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermSet.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermSet.java
@@ -38,9 +38,9 @@ public class CmdFactionsPermSet extends FactionsCommand {
MPerm.MPermable permable = TypeMPermable.get(faction).read(this.argAt(1), sender);
// Do the sender have the right to change perms for this faction?
- if (!MPerm.getPermPerms().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermPerms().has(msender, faction, true)) {
+ return;
+ }
// Is this perm editable?
if (!msender.isOverriding() && !perm.isEditable()) {
@@ -54,9 +54,9 @@ public class CmdFactionsPermSet extends FactionsCommand {
// Event
EventFactionsPermChange event = new EventFactionsPermChange(sender, faction, perm, permable, value);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
value = event.getNewValue();
// Apply
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermView.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermView.java
index 5c049f41..010b0170 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermView.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPermView.java
@@ -45,9 +45,9 @@ public class CmdFactionsPermView extends FactionsCommand {
List perms = new MassiveList<>();
for (MPerm mperm : MPerm.getAll()) {
- if (faction.isPermitted(permable.getId(), mperm.getId())) {
- perms.add(mperm);
- }
+ if (faction.isPermitted(permable.getId(), mperm.getId())) {
+ perms.add(mperm);
+ }
}
if (perms.isEmpty()) {
@@ -66,13 +66,13 @@ public class CmdFactionsPermView extends FactionsCommand {
List msons = new MassiveList<>();
- if (mplayer.getFaction() != faction) {
- msons.add(Mson.parse("[faction]").command(this, mplayer.getFaction().getName(), faction.getName()));
- }
+ if (mplayer.getFaction() != faction) {
+ msons.add(Mson.parse("[faction]").command(this, mplayer.getFaction().getName(), faction.getName()));
+ }
msons.add(Mson.parse("[rank]").command(this, mplayer.getFaction().getName() + "-" + mplayer.getRank().getName(), faction.getName()));
- if (mplayer.getFaction() != faction) {
- msons.add(Mson.parse("[relation]").command(this, faction.getRelationTo(mplayer).toString(), faction.getName()));
- }
+ if (mplayer.getFaction() != faction) {
+ msons.add(Mson.parse("[relation]").command(this, faction.getRelationTo(mplayer).toString(), faction.getName()));
+ }
Mson msons2 = Mson.implode(msons, Mson.SPACE);
message(mson(mson("Commands: ").color(ChatColor.YELLOW), msons2));
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRankSet.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRankSet.java
index 42a1b039..430a0471 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRankSet.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRankSet.java
@@ -76,9 +76,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
// Event
EventFactionsRankChange event = new EventFactionsRankChange(sender, target, rank);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
rank = event.getNewRank();
// Change the rank.
@@ -136,9 +136,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
private void ensureAllowed() throws MassiveException {
// People with permission don't follow the normal rules.
- if (msender.isOverriding()) {
- return;
- }
+ if (msender.isOverriding()) {
+ return;
+ }
// If somone gets the leadership of wilderness (Which has happened before).
// We can at least try to limit their powers.
@@ -205,9 +205,9 @@ public class CmdFactionsRankSet extends FactionsCommand {
// Event
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, msender, endFaction, MembershipChangeReason.RANK);
membershipChangeEvent.run();
- if (membershipChangeEvent.isCancelled()) {
- throw new MassiveException();
- }
+ if (membershipChangeEvent.isCancelled()) {
+ throw new MassiveException();
+ }
// Apply
target.resetFactionData();
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java
index 72a36dd5..d7fc4b9e 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsRelationSet.java
@@ -34,9 +34,9 @@ public class CmdFactionsRelationSet extends FactionsCommand {
Rel newRelation = this.readArg();
// MPerm
- if (!MPerm.getPermRel().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermRel().has(msender, msenderFaction, true)) {
+ return;
+ }
// Verify
if (otherFaction == msenderFaction) {
@@ -49,9 +49,9 @@ public class CmdFactionsRelationSet extends FactionsCommand {
// Event
EventFactionsRelationChange event = new EventFactionsRelationChange(sender, msenderFaction, otherFaction, newRelation);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
newRelation = event.getNewRelation();
// try to set the new relation
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxFaction.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxFaction.java
index ee254c67..bf4fd3af 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxFaction.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTaxFaction.java
@@ -51,21 +51,21 @@ public class CmdFactionsTaxFaction extends FactionsCommand {
MPlayer mplayer = MPlayer.get(id);
String name;
- if (Faction.IDENTIFIER_TAX_BASE.equals(id)) {
- name = "Default";
- } else if (rank != null) {
- name = rank.getName();
- } else if (mplayer != null) {
- name = mplayer.getDisplayName(msender);
- } else {
- continue;
- }
+ if (Faction.IDENTIFIER_TAX_BASE.equals(id)) {
+ name = "Default";
+ } else if (rank != null) {
+ name = rank.getName();
+ } else if (mplayer != null) {
+ name = mplayer.getDisplayName(msender);
+ } else {
+ continue;
+ }
anyTax = true;
msg("%s: %.2f", name, tax);
}
- if (!anyTax) {
- msg("No players in this faction pays taxes.");
- }
+ if (!anyTax) {
+ msg("No players in this faction pays taxes.");
+ }
}
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java
index 3962eba5..69b0929f 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java
@@ -30,9 +30,9 @@ public class CmdFactionsTerritorytitles extends FactionsCommand {
@Override
public Visibility getVisibility() {
// We hide the command if titles aren't available.
- if (!MixinTitle.get().isAvailable()) {
- return Visibility.INVISIBLE;
- }
+ if (!MixinTitle.get().isAvailable()) {
+ return Visibility.INVISIBLE;
+ }
return super.getVisibility();
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteCreate.java
index f95973eb..140bcea2 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteCreate.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteCreate.java
@@ -33,9 +33,9 @@ public class CmdFactionsVoteCreate extends FactionsCommandWarp {
List options = this.readArg();
// MPerm
- if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
+ return;
+ }
if (msenderFaction.getVoteByName(name).isPresent()) {
throw new MassiveException().addMsg("There is already a vote called %s.", name);
@@ -44,9 +44,9 @@ public class CmdFactionsVoteCreate extends FactionsCommandWarp {
// Make sure there are no duplicated
List options2 = new MassiveList<>();
for (String str : options) {
- if (options2.stream().anyMatch(str::equalsIgnoreCase)) {
- continue;
- }
+ if (options2.stream().anyMatch(str::equalsIgnoreCase)) {
+ continue;
+ }
options2.add(str);
}
@@ -56,9 +56,9 @@ public class CmdFactionsVoteCreate extends FactionsCommandWarp {
// Event
EventFactionsVoteAdd event = new EventFactionsVoteAdd(sender, msenderFaction, vote);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
vote = event.getVote();
// Apply
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteDo.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteDo.java
index f7ce9142..828fdc1b 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteDo.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteDo.java
@@ -28,9 +28,9 @@ public class CmdFactionsVoteDo extends FactionsCommandWarp {
String option = this.readArg();
// Any and MPerm
- if (!MPerm.getPermVote().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermVote().has(msender, msenderFaction, true)) {
+ return;
+ }
if (vote.getOptions().stream().noneMatch(option::equalsIgnoreCase)) {
throw new MassiveException().addMsg("No option in %s matches %s.", vote.getName(), option);
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteRemove.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteRemove.java
index c688cd4b..6aa10cb0 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteRemove.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsVoteRemove.java
@@ -26,16 +26,16 @@ public class CmdFactionsVoteRemove extends FactionsCommandWarp {
Vote vote = TypeVote.get(msenderFaction).read(this.arg(), sender);
// Any and MPerm
- if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
- return;
- }
+ if (!MPerm.getPermCreateVote().has(msender, msenderFaction, true)) {
+ return;
+ }
// Event
EventFactionsVoteRemove event = new EventFactionsVoteRemove(sender, msenderFaction, vote);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
vote = event.getVote();
// Apply
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsWarpGo.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsWarpGo.java
index b2765c18..bbda40ee 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsWarpGo.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsWarpGo.java
@@ -51,14 +51,14 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
String warpDesc = Txt.parse("%s in %s", warp.getName(), faction.describeTo(msender, false));
// Must be valid
- if (!warp.verifyIsValid()) {
- return;
- }
+ if (!warp.verifyIsValid()) {
+ return;
+ }
// Any and MPerm
- if (!MPerm.getPermWarp().has(msender, faction, true)) {
- return;
- }
+ if (!MPerm.getPermWarp().has(msender, faction, true)) {
+ return;
+ }
if (!MConf.get().warpsTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory()) {
throw new MassiveException().addMsg("You cannot teleport to %s while in the territory of an enemy faction.", warp);
@@ -94,18 +94,18 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
double z = locationHere.getZ();
for (Player p : w.getPlayers()) {
- if (MUtil.isntPlayer(p)) {
- continue;
- }
+ if (MUtil.isntPlayer(p)) {
+ continue;
+ }
- if (!p.isOnline() || p.isDead() || p == me || p.getWorld() != w) {
- continue;
- }
+ if (!p.isOnline() || p.isDead() || p == me || p.getWorld() != w) {
+ continue;
+ }
MPlayer fp = MPlayer.get(p);
- if (msender.getRelationTo(fp) != Rel.ENEMY) {
- continue;
- }
+ if (msender.getRelationTo(fp) != Rel.ENEMY) {
+ continue;
+ }
Location l = p.getLocation();
double dx = Math.abs(x - l.getX());
@@ -114,9 +114,9 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
double max = MConf.get().warpsTeleportAllowedEnemyDistance;
// box-shaped distance check
- if (dx > max || dy > max || dz > max) {
- continue;
- }
+ if (dx > max || dy > max || dz > max) {
+ continue;
+ }
throw new MassiveException().addMsg("You cannot teleport to %s while an enemy is within %f blocks of you.", warpDesc, max);
}
@@ -125,9 +125,9 @@ public class CmdFactionsWarpGo extends FactionsCommandWarp {
// Event
EventFactionsWarpTeleport event = new EventFactionsWarpTeleport(sender, warp);
event.run();
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
+ }
// Apply
try {
diff --git a/src/main/java/com/massivecraft/factions/cmd/req/ReqHasFaction.java b/src/main/java/com/massivecraft/factions/cmd/req/ReqHasFaction.java
index b34ed30f..c927a864 100644
--- a/src/main/java/com/massivecraft/factions/cmd/req/ReqHasFaction.java
+++ b/src/main/java/com/massivecraft/factions/cmd/req/ReqHasFaction.java
@@ -30,9 +30,9 @@ public class ReqHasFaction extends RequirementAbstract {
@Override
public boolean apply(CommandSender sender, MassiveCommand command) {
- if (MUtil.isntSender(sender)) {
- return false;
- }
+ if (MUtil.isntSender(sender)) {
+ return false;
+ }
MPlayer mplayer = MPlayer.get(sender);
return mplayer.hasFaction();
diff --git a/src/main/java/com/massivecraft/factions/cmd/req/ReqHasntFaction.java b/src/main/java/com/massivecraft/factions/cmd/req/ReqHasntFaction.java
index 58ae6862..47a08759 100644
--- a/src/main/java/com/massivecraft/factions/cmd/req/ReqHasntFaction.java
+++ b/src/main/java/com/massivecraft/factions/cmd/req/ReqHasntFaction.java
@@ -30,9 +30,9 @@ public class ReqHasntFaction extends RequirementAbstract {
@Override
public boolean apply(CommandSender sender, MassiveCommand command) {
- if (MUtil.isntSender(sender)) {
- return true;
- }
+ if (MUtil.isntSender(sender)) {
+ return true;
+ }
MPlayer mplayer = MPlayer.get(sender);
return !mplayer.hasFaction();
diff --git a/src/main/java/com/massivecraft/factions/cmd/req/ReqRankIsAtLeast.java b/src/main/java/com/massivecraft/factions/cmd/req/ReqRankIsAtLeast.java
index 32919e4a..93e2bc6b 100644
--- a/src/main/java/com/massivecraft/factions/cmd/req/ReqRankIsAtLeast.java
+++ b/src/main/java/com/massivecraft/factions/cmd/req/ReqRankIsAtLeast.java
@@ -43,9 +43,9 @@ public class ReqRankIsAtLeast extends RequirementAbstract {
@Override
public boolean apply(CommandSender sender, MassiveCommand command) {
- if (MUtil.isntSender(sender)) {
- return false;
- }
+ if (MUtil.isntSender(sender)) {
+ return false;
+ }
MPlayer mplayer = MPlayer.get(sender);
return mplayer.getRank().isAtLeast(this.getRank());
diff --git a/src/main/java/com/massivecraft/factions/cmd/type/TypeEntityInternalFaction.java b/src/main/java/com/massivecraft/factions/cmd/type/TypeEntityInternalFaction.java
index ab100b3c..3a02a8f1 100644
--- a/src/main/java/com/massivecraft/factions/cmd/type/TypeEntityInternalFaction.java
+++ b/src/main/java/com/massivecraft/factions/cmd/type/TypeEntityInternalFaction.java
@@ -26,9 +26,9 @@ public abstract class TypeEntityInternalFaction> ext
protected TypeEntityInternalFaction(Class clazz, Faction faction) {
super(clazz);
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.faction = faction;
@@ -54,18 +54,18 @@ public abstract class TypeEntityInternalFaction> ext
@Override
public boolean isValid(String arg, CommandSender sender) {
// In the generic case accept all
- if (this.getAll().isEmpty()) {
- return true;
- } else {
- return super.isValid(arg, sender);
- }
+ if (this.getAll().isEmpty()) {
+ return true;
+ } else {
+ return super.isValid(arg, sender);
+ }
}
@Override
public Collection getTabList(CommandSender sender, String arg) {
- if (this.getFaction() != null) {
- return super.getTabList(sender, arg);
- }
+ if (this.getFaction() != null) {
+ return super.getTabList(sender, arg);
+ }
// Default to tab list for the sender
Faction faction = MPlayer.get(sender).getFaction();
diff --git a/src/main/java/com/massivecraft/factions/cmd/type/TypeMPermable.java b/src/main/java/com/massivecraft/factions/cmd/type/TypeMPermable.java
index c27c1ae3..de4612c1 100644
--- a/src/main/java/com/massivecraft/factions/cmd/type/TypeMPermable.java
+++ b/src/main/java/com/massivecraft/factions/cmd/type/TypeMPermable.java
@@ -38,9 +38,9 @@ public class TypeMPermable extends TypeAbstract {
public TypeMPermable(Faction faction) {
super(MPerm.MPermable.class);
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.faction = faction;
}
@@ -121,9 +121,9 @@ public class TypeMPermable extends TypeAbstract {
public Collection getTabList(CommandSender sender, String arg) {
List ret = new MassiveList<>();
Faction faction = this.getFaction();
- if (faction == null) {
- faction = MPlayer.get(sender).getFaction();
- }
+ if (faction == null) {
+ faction = MPlayer.get(sender).getFaction();
+ }
// Always add ranks, relations, other factions and other players
ret.addAll(faction.getRanks().getAll().stream().map(Rank::getName).collect(Collectors.toList()));
@@ -135,12 +135,12 @@ public class TypeMPermable extends TypeAbstract {
if (arg.length() >= 2) {
for (Faction f : FactionColl.get().getAll()) {
String name = f.getName();
- if (arg.length() <= name.length() && !name.toLowerCase().startsWith(arg.toLowerCase())) {
- continue;
- }
- if (arg.length() > name.length() && !arg.toLowerCase().startsWith(name.toLowerCase())) {
- continue;
- }
+ if (arg.length() <= name.length() && !name.toLowerCase().startsWith(arg.toLowerCase())) {
+ continue;
+ }
+ if (arg.length() > name.length() && !arg.toLowerCase().startsWith(name.toLowerCase())) {
+ continue;
+ }
ret.addAll(f.getRanks().getAll().stream().map(r -> name + "-" + r.getName()).collect(Collectors.toList()));
}
@@ -182,11 +182,11 @@ public class TypeMPermable extends TypeAbstract {
@Override
public boolean isValid(String arg, CommandSender sender) {
// In the generic case accept all
- if (this.getFaction() == null) {
- return true;
- } else {
- return super.isValid(arg, sender);
- }
+ if (this.getFaction() == null) {
+ return true;
+ } else {
+ return super.isValid(arg, sender);
+ }
}
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/type/TypeRank.java b/src/main/java/com/massivecraft/factions/cmd/type/TypeRank.java
index 2cb01c7e..fff348fa 100644
--- a/src/main/java/com/massivecraft/factions/cmd/type/TypeRank.java
+++ b/src/main/java/com/massivecraft/factions/cmd/type/TypeRank.java
@@ -77,13 +77,13 @@ public class TypeRank extends TypeEntityInternalFaction {
if (this.currentRank != null) {
// You can't use "promote" to make someone leader.
Rank promote = getPromote(currentRank);
- if (value == promote && !promote.isLeader()) {
- names.add("promote");
- }
+ if (value == promote && !promote.isLeader()) {
+ names.add("promote");
+ }
- if (value == getDemote(currentRank)) {
- names.add("demote");
- }
+ if (value == getDemote(currentRank)) {
+ names.add("demote");
+ }
}
return names;
@@ -92,15 +92,15 @@ public class TypeRank extends TypeEntityInternalFaction {
private static Rank getPromote(Rank rank) {
Rank ret = null;
for (Rank r : rank.getFaction().getRanks().getAll()) {
- if (rank == r) {
- continue;
- }
- if (rank.isMoreThan(r)) {
- continue;
- }
- if (ret != null && ret.isLessThan(r)) {
- continue;
- }
+ if (rank == r) {
+ continue;
+ }
+ if (rank.isMoreThan(r)) {
+ continue;
+ }
+ if (ret != null && ret.isLessThan(r)) {
+ continue;
+ }
ret = r;
}
@@ -110,15 +110,15 @@ public class TypeRank extends TypeEntityInternalFaction {
private static Rank getDemote(Rank rank) {
Rank ret = null;
for (Rank r : rank.getFaction().getRanks().getAll()) {
- if (rank == r) {
- continue;
- }
- if (rank.isLessThan(r)) {
- continue;
- }
- if (ret != null && ret.isMoreThan(r)) {
- continue;
- }
+ if (rank == r) {
+ continue;
+ }
+ if (rank.isLessThan(r)) {
+ continue;
+ }
+ if (ret != null && ret.isMoreThan(r)) {
+ continue;
+ }
ret = r;
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/type/TypeTaxable.java b/src/main/java/com/massivecraft/factions/cmd/type/TypeTaxable.java
index a7810190..d1a8dbad 100644
--- a/src/main/java/com/massivecraft/factions/cmd/type/TypeTaxable.java
+++ b/src/main/java/com/massivecraft/factions/cmd/type/TypeTaxable.java
@@ -37,9 +37,9 @@ public class TypeTaxable extends TypeAbstract {
public TypeTaxable(Faction faction) {
super(String.class);
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
this.faction = faction;
}
@@ -90,9 +90,9 @@ public class TypeTaxable extends TypeAbstract {
public Collection getTabList(CommandSender sender, String arg) {
List ret = new MassiveList<>();
Faction faction = this.getFaction();
- if (faction == null) {
- faction = MPlayer.get(sender).getFaction();
- }
+ if (faction == null) {
+ faction = MPlayer.get(sender).getFaction();
+ }
// Always add ranks, relations, other factions and other players
ret.addAll(faction.getRanks().getAll().stream().map(Rank::getName).collect(Collectors.toList()));
@@ -124,11 +124,11 @@ public class TypeTaxable extends TypeAbstract {
@Override
public boolean isValid(String arg, CommandSender sender) {
// In the generic case accept all
- if (this.getFaction() == null) {
- return true;
- } else {
- return super.isValid(arg, sender);
- }
+ if (this.getFaction() == null) {
+ return true;
+ } else {
+ return super.isValid(arg, sender);
+ }
}
}
diff --git a/src/main/java/com/massivecraft/factions/comparator/ComparatorFactionList.java b/src/main/java/com/massivecraft/factions/comparator/ComparatorFactionList.java
index fc812853..46de1b2a 100644
--- a/src/main/java/com/massivecraft/factions/comparator/ComparatorFactionList.java
+++ b/src/main/java/com/massivecraft/factions/comparator/ComparatorFactionList.java
@@ -38,27 +38,27 @@ public class ComparatorFactionList extends ComparatorAbstract {
@Override
public int compareInner(Faction f1, Faction f2) {
// None a.k.a. Wilderness
- if (f1.isNone() && f2.isNone()) {
- return 0;
- }
- if (f1.isNone()) {
- return -1;
- }
- if (f2.isNone()) {
- return 1;
- }
+ if (f1.isNone() && f2.isNone()) {
+ return 0;
+ }
+ if (f1.isNone()) {
+ return -1;
+ }
+ if (f2.isNone()) {
+ return 1;
+ }
// Players Online
int ret = f2.getMPlayersWhereOnlineTo(this.getWatcher()).size() - f1.getMPlayersWhereOnlineTo(this.getWatcher()).size();
- if (ret != 0) {
- return ret;
- }
+ if (ret != 0) {
+ return ret;
+ }
// Players Total
ret = f2.getMPlayers().size() - f1.getMPlayers().size();
- if (ret != 0) {
- return ret;
- }
+ if (ret != 0) {
+ return ret;
+ }
// Tie by Id
return ComparatorComparable.get().compare(f1.getId(), f2.getId());
diff --git a/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java b/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java
index 6612e06d..285abb55 100644
--- a/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java
+++ b/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerInactivity.java
@@ -30,13 +30,13 @@ public class ComparatorMPlayerInactivity extends ComparatorAbstract imp
boolean o1 = m1.isOnline();
boolean o2 = m2.isOnline();
- if (o1 && o2) {
- return 0;
- } else if (o1) {
- return -1;
- } else if (o2) {
- return +1;
- }
+ if (o1 && o2) {
+ return 0;
+ } else if (o1) {
+ return -1;
+ } else if (o2) {
+ return +1;
+ }
// Inactivity Time
long r1 = m1.getLastActivityMillis();
diff --git a/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java b/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java
index 2ddc6805..05e19d4b 100644
--- a/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java
+++ b/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerPower.java
@@ -28,9 +28,9 @@ public class ComparatorMPlayerPower extends ComparatorAbstract implemen
public int compareInner(MPlayer m1, MPlayer m2) {
// Power
int ret = m1.getPowerRounded() - m2.getPowerRounded();
- if (ret != 0) {
- return ret;
- }
+ if (ret != 0) {
+ return ret;
+ }
// MaxPower
return m1.getPowerMaxRounded() - m2.getPowerMaxRounded();
diff --git a/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java b/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java
index 71199bc1..04a37aa2 100644
--- a/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java
+++ b/src/main/java/com/massivecraft/factions/comparator/ComparatorMPlayerRole.java
@@ -28,9 +28,9 @@ public class ComparatorMPlayerRole extends ComparatorAbstract implement
@Override
public int compareInner(MPlayer m1, MPlayer m2) {
// Rank
- if (m1.getFaction() != m2.getFaction()) {
- throw new IllegalArgumentException("Noncomparable players");
- }
+ if (m1.getFaction() != m2.getFaction()) {
+ throw new IllegalArgumentException("Noncomparable players");
+ }
Rank r1 = m1.getRank();
Rank r2 = m2.getRank();
return r2.getPriority() - r1.getPriority();
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java b/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java
index e6a654dc..5306c785 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineCanCombatHappen.java
@@ -44,9 +44,9 @@ public class EngineCanCombatHappen extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(EntityDamageByEntityEvent event) {
- if (this.canCombatDamageHappen(event, true)) {
- return;
- }
+ if (this.canCombatDamageHappen(event, true)) {
+ return;
+ }
event.setCancelled(true);
Entity damager = event.getDamager();
@@ -61,32 +61,32 @@ public class EngineCanCombatHappen extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(EntityCombustByEntityEvent event) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0D);
- if (this.canCombatDamageHappen(sub, false)) {
- return;
- }
+ if (this.canCombatDamageHappen(sub, false)) {
+ return;
+ }
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(PotionSplashEvent event) {
// If a harmful potion is splashing ...
- if (!MUtil.isHarmfulPotion(event.getPotion())) {
- return;
- }
+ if (!MUtil.isHarmfulPotion(event.getPotion())) {
+ return;
+ }
ProjectileSource projectileSource = event.getPotion().getShooter();
- if (!(projectileSource instanceof Entity)) {
- return;
- }
+ if (!(projectileSource instanceof Entity)) {
+ return;
+ }
Entity thrower = (Entity) projectileSource;
// ... scan through affected entities to make sure they're all valid targets.
for (LivingEntity affectedEntity : event.getAffectedEntities()) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(thrower, affectedEntity, EntityDamageEvent.DamageCause.CUSTOM, 0D);
- if (this.canCombatDamageHappen(sub, true)) {
- continue;
- }
+ if (this.canCombatDamageHappen(sub, true)) {
+ continue;
+ }
// affected entity list doesn't accept modification (iter.remove() is a no-go), but this works
event.setIntensity(affectedEntity, 0.0);
@@ -96,14 +96,14 @@ public class EngineCanCombatHappen extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void canCombatDamageHappen(AreaEffectCloudApplyEvent event) {
// If a harmful potion effect cloud is present ...
- if (!MUtil.isHarmfulPotion(event.getEntity().getBasePotionData().getType().getEffectType())) {
- return;
- }
+ if (!MUtil.isHarmfulPotion(event.getEntity().getBasePotionData().getType().getEffectType())) {
+ return;
+ }
ProjectileSource projectileSource = event.getEntity().getSource();
- if (!(projectileSource instanceof Entity)) {
- return;
- }
+ if (!(projectileSource instanceof Entity)) {
+ return;
+ }
Entity thrower = (Entity) projectileSource;
@@ -114,9 +114,9 @@ public class EngineCanCombatHappen extends Engine {
for (LivingEntity affectedEntity : event.getAffectedEntities()) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(thrower, affectedEntity, EntityDamageEvent.DamageCause.CUSTOM, 0D);
// Notification disabled due to the iterating nature of effect clouds.
- if (EngineCanCombatHappen.get().canCombatDamageHappen(sub, false)) {
- continue;
- }
+ if (EngineCanCombatHappen.get().canCombatDamageHappen(sub, false)) {
+ continue;
+ }
affectedList.add(affectedEntity);
}
@@ -137,9 +137,9 @@ public class EngineCanCombatHappen extends Engine {
// If the defender is a player ...
Entity edefender = event.getEntity();
- if (MUtil.isntPlayer(edefender)) {
- return true;
- }
+ if (MUtil.isntPlayer(edefender)) {
+ return true;
+ }
Player defender = (Player) edefender;
MPlayer mdefender = MPlayer.get(edefender);
@@ -148,9 +148,9 @@ public class EngineCanCombatHappen extends Engine {
// (we check null here since there may not be an attacker)
// (lack of attacker situations can be caused by other bukkit plugins)
- if (eattacker != null && eattacker.equals(edefender)) {
- return true;
- }
+ if (eattacker != null && eattacker.equals(edefender)) {
+ return true;
+ }
// ... gather defender PS and faction information ...
PS defenderPs = PS.valueOf(defender.getLocation());
@@ -160,9 +160,9 @@ public class EngineCanCombatHappen extends Engine {
if (MUtil.isPlayer(eattacker)) {
MPlayer mplayer = MPlayer.get(eattacker);
- if (mplayer != null && mplayer.isOverriding()) {
- return true;
- }
+ if (mplayer != null && mplayer.isOverriding()) {
+ return true;
+ }
}
// ... PVP flag may cause a damage block ...
@@ -184,16 +184,16 @@ public class EngineCanCombatHappen extends Engine {
}
// ... and if the attacker is a player ...
- if (MUtil.isntPlayer(eattacker)) {
- return true;
- }
+ if (MUtil.isntPlayer(eattacker)) {
+ return true;
+ }
Player attacker = (Player) eattacker;
MPlayer uattacker = MPlayer.get(attacker);
// ... does this player bypass all protection? ...
- if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) {
- return true;
- }
+ if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) {
+ return true;
+ }
// ... gather attacker PS and faction information ...
PS attackerPs = PS.valueOf(attacker.getLocation());
@@ -204,25 +204,25 @@ public class EngineCanCombatHappen extends Engine {
// NOTE: This check is probably not that important but we could keep it anyways.
if (attackerPsFaction.getFlag(MFlag.getFlagPvp()) == false) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.PEACEFUL_LAND, event);
- if (!ret && notify) {
- uattacker.msg("PVP is disabled in %s.", attackerPsFaction.describeTo(uattacker));
- }
+ if (!ret && notify) {
+ uattacker.msg("PVP is disabled in %s.", attackerPsFaction.describeTo(uattacker));
+ }
return ret;
}
// ... are PVP rules completely ignored in this world? ...
- if (!MConf.get().worldsPvpRulesEnabled.contains(defenderPs.getWorld())) {
- return true;
- }
+ if (!MConf.get().worldsPvpRulesEnabled.contains(defenderPs.getWorld())) {
+ return true;
+ }
Faction defendFaction = mdefender.getFaction();
Faction attackFaction = uattacker.getFaction();
if (attackFaction.isNone() && MConf.get().disablePVPForFactionlessPlayers) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FACTIONLESS, event);
- if (!ret && notify) {
- uattacker.msg("You can't hurt other players until you join a faction.");
- }
+ if (!ret && notify) {
+ uattacker.msg("You can't hurt other players until you join a faction.");
+ }
return ret;
} else if (defendFaction.isNone()) {
if (defenderPsFaction == attackFaction && MConf.get().enablePVPAgainstFactionlessInAttackersLand) {
@@ -230,9 +230,9 @@ public class EngineCanCombatHappen extends Engine {
return true;
} else if (MConf.get().disablePVPForFactionlessPlayers) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FACTIONLESS, event);
- if (!ret && notify) {
- uattacker.msg("You can't hurt players who are not currently in a faction.");
- }
+ if (!ret && notify) {
+ uattacker.msg("You can't hurt players who are not currently in a faction.");
+ }
return ret;
} else if (attackFaction.isNone() && MConf.get().enablePVPBetweenFactionlessPlayers) {
// Allow factionless vs factionless
@@ -245,9 +245,9 @@ public class EngineCanCombatHappen extends Engine {
// Check the relation
if (relation.isFriend() && defenderPsFaction.getFlag(MFlag.getFlagFriendlyire()) == false) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FRIENDLYFIRE, event);
- if (!ret && notify) {
- uattacker.msg("You can't hurt %s.", relation.getDescPlayerMany());
- }
+ if (!ret && notify) {
+ uattacker.msg("You can't hurt %s.", relation.getDescPlayerMany());
+ }
return ret;
}
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineChunkChange.java b/src/main/java/com/massivecraft/factions/engine/EngineChunkChange.java
index 0e36976e..85bfb088 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineChunkChange.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineChunkChange.java
@@ -60,9 +60,9 @@ public class EngineChunkChange extends Engine {
final Set chunks = event.getChunks();
// Override Mode? Sure!
- if (mplayer.isOverriding()) {
- return;
- }
+ if (mplayer.isOverriding()) {
+ return;
+ }
// CALC: Is there at least one normal faction among the current ones?
boolean currentFactionsContainsAtLeastOneNormal = false;
@@ -156,9 +156,9 @@ public class EngineChunkChange extends Engine {
// HOW: Next we check if the new faction has permission to claim nearby the nearby factions.
MPerm claimnear = MPerm.getPermClaimnear();
for (Faction nearbyFaction : nearbyFactions) {
- if (claimnear.has(mplayer, nearbyFaction, true)) {
- continue;
- }
+ if (claimnear.has(mplayer, nearbyFaction, true)) {
+ continue;
+ }
event.setCancelled(true);
return;
}
@@ -217,14 +217,14 @@ public class EngineChunkChange extends Engine {
Set oldChunks = entry.getValue();
// ... that is an actual faction ...
- if (oldFaction.isNone()) {
- continue;
- }
+ if (oldFaction.isNone()) {
+ continue;
+ }
// ... for which the mplayer lacks permission ...
- if (MPerm.getPermTerritory().has(mplayer, oldFaction, false)) {
- continue;
- }
+ if (MPerm.getPermTerritory().has(mplayer, oldFaction, false)) {
+ continue;
+ }
// ... consider all reasons to forbid "overclaiming/warclaiming" ...
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineCleanInactivity.java b/src/main/java/com/massivecraft/factions/engine/EngineCleanInactivity.java
index cc275e0e..e01480a3 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineCleanInactivity.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineCleanInactivity.java
@@ -29,9 +29,9 @@ public class EngineCleanInactivity extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void ageBonus(EventMassiveCorePlayerCleanInactivityToleranceMillis event) {
- if (event.getColl() != MPlayerColl.get()) {
- return;
- }
+ if (event.getColl() != MPlayerColl.get()) {
+ return;
+ }
applyPlayerAgeBonus(event);
applyFactionAgeBonus(event);
@@ -47,9 +47,9 @@ public class EngineCleanInactivity extends Engine {
// Calculate the Bonus!
Long bonus = calculateBonus(age, MConf.get().cleanInactivityToleranceMillisPlayerAgeToBonus);
- if (bonus == null) {
- return;
- }
+ if (bonus == null) {
+ return;
+ }
// Apply
event.getToleranceCauseMillis().put("Player Age Bonus", bonus);
@@ -65,30 +65,30 @@ public class EngineCleanInactivity extends Engine {
// Calculate the Bonus!
Long bonus = calculateBonus(age, MConf.get().cleanInactivityToleranceMillisFactionAgeToBonus);
- if (bonus == null) {
- return;
- }
+ if (bonus == null) {
+ return;
+ }
// Apply
event.getToleranceCauseMillis().put("Faction Age Bonus", bonus);
}
private Long calculateBonus(long age, Map ageToBonus) {
- if (ageToBonus.isEmpty()) {
- return null;
- }
+ if (ageToBonus.isEmpty()) {
+ return null;
+ }
Long bonus = 0L;
for (Entry entry : ageToBonus.entrySet()) {
Long key = entry.getKey();
- if (key == null) {
- continue;
- }
+ if (key == null) {
+ continue;
+ }
Long value = entry.getValue();
- if (value == null) {
- continue;
- }
+ if (value == null) {
+ continue;
+ }
if (age >= key) {
bonus = value;
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineDenyCommands.java b/src/main/java/com/massivecraft/factions/engine/EngineDenyCommands.java
index 8b362eb5..274edc78 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineDenyCommands.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineDenyCommands.java
@@ -36,15 +36,15 @@ public class EngineDenyCommands extends Engine {
public void denyCommands(PlayerCommandPreprocessEvent event) {
// If a player is trying to run a command ...
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(player);
// ... and the player is not overriding ...
- if (mplayer.isOverriding()) {
- return;
- }
+ if (mplayer.isOverriding()) {
+ return;
+ }
// ... clean up the command ...
String command = event.getMessage();
@@ -72,19 +72,19 @@ public class EngineDenyCommands extends Engine {
if (MConf.get().denyCommandsDistance > -1 && !MConf.get().denyCommandsDistanceBypassIn.contains(factionAtRel)) {
for (Player otherplayer : player.getWorld().getPlayers()) {
MPlayer othermplayer = MPlayer.get(otherplayer);
- if (othermplayer == mplayer) {
- continue;
- }
+ if (othermplayer == mplayer) {
+ continue;
+ }
double distance = player.getLocation().distance(otherplayer.getLocation());
- if (MConf.get().denyCommandsDistance > distance) {
- continue;
- }
+ if (MConf.get().denyCommandsDistance > distance) {
+ continue;
+ }
Rel playerRel = mplayer.getRelationTo(othermplayer);
- if (!MConf.get().denyCommandsDistanceRelation.containsKey(playerRel)) {
- continue;
- }
+ if (!MConf.get().denyCommandsDistanceRelation.containsKey(playerRel)) {
+ continue;
+ }
String desc = playerRel.getDescPlayerOne();
@@ -95,17 +95,17 @@ public class EngineDenyCommands extends Engine {
}
// ... if there is no relation here then there are no further checks ...
- if (factionAtRel == null) {
- return;
- }
+ if (factionAtRel == null) {
+ return;
+ }
List deniedCommands = MConf.get().denyCommandsTerritoryRelation.get(factionAtRel);
- if (deniedCommands == null) {
- return;
- }
- if (!MUtil.containsCommand(command, deniedCommands)) {
- return;
- }
+ if (deniedCommands == null) {
+ return;
+ }
+ if (!MUtil.containsCommand(command, deniedCommands)) {
+ return;
+ }
mplayer.msg("You can't use \"/%s\" in %s territory.", command, Txt.getNicedEnum(factionAtRel));
event.setCancelled(true);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java b/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java
index b43cca1d..13975966 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineDenyTeleport.java
@@ -45,9 +45,9 @@ public class EngineDenyTeleport extends Engine {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void canTeleportHappen(PlayerTeleportEvent event) {
Entry entry = shouldBeCancelled(event);
- if (entry == null) {
- return;
- }
+ if (entry == null) {
+ return;
+ }
event.setCancelled(true);
@@ -56,18 +56,18 @@ public class EngineDenyTeleport extends Engine {
String teleportDesc = Txt.getNicedEnum(cause);
String denyDesc = "";
- if (deny == TerritoryType.ENEMY) {
- denyDesc = "enemy";
- }
- if (deny == TerritoryType.WILDERNESS) {
- denyDesc = "wilderness";
- }
- if (deny == TerritoryType.OWN) {
- denyDesc = "your own";
- }
- if (deny == TerritoryType.OTHER) {
- denyDesc = "other faction's";
- }
+ if (deny == TerritoryType.ENEMY) {
+ denyDesc = "enemy";
+ }
+ if (deny == TerritoryType.WILDERNESS) {
+ denyDesc = "wilderness";
+ }
+ if (deny == TerritoryType.OWN) {
+ denyDesc = "your own";
+ }
+ if (deny == TerritoryType.OTHER) {
+ denyDesc = "other faction's";
+ }
Player player = event.getPlayer();
MixinMessage.get().msgOne(player, "Teleportation with %s is not allowed in %s territory.", teleportDesc, denyDesc);
@@ -75,9 +75,9 @@ public class EngineDenyTeleport extends Engine {
private Entry shouldBeCancelled(PlayerTeleportEvent event) {
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return null;
- }
+ if (MUtil.isntPlayer(player)) {
+ return null;
+ }
MPlayer mplayer = MPlayer.get(player);
@@ -92,37 +92,37 @@ public class EngineDenyTeleport extends Engine {
MConf mconf = MConf.get();
if (cause == TeleportCause.CHORUS_FRUIT) {
- if (!mconf.allowChorusFruitInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
- return Couple.valueOf(cause, TerritoryType.ENEMY);
- }
+ if (!mconf.allowChorusFruitInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
+ return Couple.valueOf(cause, TerritoryType.ENEMY);
+ }
- if (!mconf.allowChorusFruitInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
- return Couple.valueOf(cause, TerritoryType.WILDERNESS);
- }
+ if (!mconf.allowChorusFruitInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
+ return Couple.valueOf(cause, TerritoryType.WILDERNESS);
+ }
- if (!mconf.allowChorusFruitInOwnTerritory && types.contains(TerritoryType.OWN)) {
- return Couple.valueOf(cause, TerritoryType.OWN);
- }
+ if (!mconf.allowChorusFruitInOwnTerritory && types.contains(TerritoryType.OWN)) {
+ return Couple.valueOf(cause, TerritoryType.OWN);
+ }
- if (!mconf.allowChorusFruitInOtherTerritory && types.contains(TerritoryType.OTHER)) {
- return Couple.valueOf(cause, TerritoryType.OTHER);
- }
+ if (!mconf.allowChorusFruitInOtherTerritory && types.contains(TerritoryType.OTHER)) {
+ return Couple.valueOf(cause, TerritoryType.OTHER);
+ }
} else if (cause == TeleportCause.ENDER_PEARL) {
- if (!mconf.allowEnderPearlInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
- return Couple.valueOf(cause, TerritoryType.ENEMY);
- }
+ if (!mconf.allowEnderPearlInEnemyTerritory && types.contains(TerritoryType.ENEMY)) {
+ return Couple.valueOf(cause, TerritoryType.ENEMY);
+ }
- if (!mconf.allowEnderPearlInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
- return Couple.valueOf(cause, TerritoryType.WILDERNESS);
- }
+ if (!mconf.allowEnderPearlInWildernessTerritory && types.contains(TerritoryType.WILDERNESS)) {
+ return Couple.valueOf(cause, TerritoryType.WILDERNESS);
+ }
- if (!mconf.allowEnderPearlInOwnTerritory && types.contains(TerritoryType.OWN)) {
- return Couple.valueOf(cause, TerritoryType.OWN);
- }
+ if (!mconf.allowEnderPearlInOwnTerritory && types.contains(TerritoryType.OWN)) {
+ return Couple.valueOf(cause, TerritoryType.OWN);
+ }
- if (!mconf.allowEnderPearlInOtherTerritory && types.contains(TerritoryType.OTHER)) {
- return Couple.valueOf(cause, TerritoryType.OTHER);
- }
+ if (!mconf.allowEnderPearlInOtherTerritory && types.contains(TerritoryType.OTHER)) {
+ return Couple.valueOf(cause, TerritoryType.OTHER);
+ }
} else {
// Don't cancel other kinds of teleports
}
@@ -134,15 +134,15 @@ public class EngineDenyTeleport extends Engine {
Faction territoryFaction = BoardColl.get().getFactionAt(territory);
Rel relation = territoryFaction.getRelationTo(mplayer);
- if (territoryFaction.isNone()) {
- return TerritoryType.WILDERNESS;
- }
- if (relation == Rel.ENEMY) {
- return TerritoryType.ENEMY;
- }
- if (relation == Rel.FACTION) {
- return TerritoryType.OWN;
- }
+ if (territoryFaction.isNone()) {
+ return TerritoryType.WILDERNESS;
+ }
+ if (relation == Rel.ENEMY) {
+ return TerritoryType.ENEMY;
+ }
+ if (relation == Rel.FACTION) {
+ return TerritoryType.OWN;
+ }
return TerritoryType.OTHER;
}
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineExploit.java b/src/main/java/com/massivecraft/factions/engine/EngineExploit.java
index bc2ea5d0..58d79e56 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineExploit.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineExploit.java
@@ -38,9 +38,9 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void obsidianGenerators(BlockFromToEvent event) {
- if (!MConf.get().handleExploitObsidianGenerators) {
- return;
- }
+ if (!MConf.get().handleExploitObsidianGenerators) {
+ return;
+ }
// thanks to ObGenBlocker and WorldGuard for this method
Block block = event.getToBlock();
@@ -57,12 +57,12 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void enderPearlClipping(PlayerTeleportEvent event) {
- if (!MConf.get().handleExploitEnderPearlClipping) {
- return;
- }
- if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
- return;
- }
+ if (!MConf.get().handleExploitEnderPearlClipping) {
+ return;
+ }
+ if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
+ return;
+ }
// this exploit works when the target location is within 0.31 blocks or so of a door or glass block or similar...
Location target = event.getTo();
@@ -109,26 +109,26 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void portalTrapRemoveAnimation(PlayerTeleportEvent event) {
// If there is a teleport caused by a nether portal ...
- if (!MConf.get().handleNetherPortalTrap || event.getCause() != TeleportCause.NETHER_PORTAL) {
- return;
- }
+ if (!MConf.get().handleNetherPortalTrap || event.getCause() != TeleportCause.NETHER_PORTAL) {
+ return;
+ }
Player player = event.getPlayer();
Block from = event.getTo().getBlock();
// ... and the player can't build at the destination ...
- if (EnginePermBuild.canPlayerBuildAt(player, PS.valueOf(from), false)) {
- return;
- }
+ if (EnginePermBuild.canPlayerBuildAt(player, PS.valueOf(from), false)) {
+ return;
+ }
// ... reset the old portal blocks stored ...
this.portalReset(player);
// ... get all the portal blocks belonging to the new portal at the destination ...
List portalTrap = getPortal(from);
- if (portalTrap.isEmpty()) {
- return;
- }
+ if (portalTrap.isEmpty()) {
+ return;
+ }
// ... and then store those blocks and send an update as if they were air.
this.portalTraps.put(player.getUniqueId(), portalTrap);
@@ -138,18 +138,18 @@ public class EngineExploit extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void portalUpdate(PlayerMoveEvent event) {
// If a player moves ...
- if (!MConf.get().handleNetherPortalTrap || MUtil.isSameBlock(event)) {
- return;
- }
+ if (!MConf.get().handleNetherPortalTrap || MUtil.isSameBlock(event)) {
+ return;
+ }
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
// ... and he recently used a portal ...
List portalTrap = this.portalTraps.get(uuid);
- if (portalTrap == null) {
- return;
- }
+ if (portalTrap == null) {
+ return;
+ }
Location locationTo = event.getTo();
Location locationFrom = portalTrap.get(0).getLocation();
@@ -172,17 +172,17 @@ public class EngineExploit extends Engine {
// If a player has already a portal registered to him ...
List portalTrap = this.portalTraps.get(uuid);
- if (portalTrap == null) {
- return;
- }
+ if (portalTrap == null) {
+ return;
+ }
// ... remove them from the registry ...
this.portalTraps.remove(uuid);
// ... and send updates if the player and portal are in the same world.
- if (!player.getWorld().equals(portalTrap.get(0).getWorld())) {
- return;
- }
+ if (!player.getWorld().equals(portalTrap.get(0).getWorld())) {
+ return;
+ }
portalUpdateReset(player, portalTrap);
}
@@ -212,9 +212,9 @@ public class EngineExploit extends Engine {
for (int x = -(NETHER_TRAP_RADIUS_CHECK); x <= NETHER_TRAP_RADIUS_CHECK; x++) {
for (int y = -(NETHER_TRAP_RADIUS_CHECK); y <= NETHER_TRAP_RADIUS_CHECK; y++) {
for (int z = -(NETHER_TRAP_RADIUS_CHECK); z <= NETHER_TRAP_RADIUS_CHECK; z++) {
- if (from.getRelative(x, y, z).getType() == Material.NETHER_PORTAL) {
- ret.add(from.getRelative(x, y, z));
- }
+ if (from.getRelative(x, y, z).getType() == Material.NETHER_PORTAL) {
+ ret.add(from.getRelative(x, y, z));
+ }
}
}
}
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFlagEndergrief.java b/src/main/java/com/massivecraft/factions/engine/EngineFlagEndergrief.java
index 023acb44..c01055bb 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineFlagEndergrief.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineFlagEndergrief.java
@@ -30,16 +30,16 @@ public class EngineFlagEndergrief extends Engine {
public void blockEndergrief(EntityChangeBlockEvent event) {
// If an enderman is changing a block ...
Entity entity = event.getEntity();
- if (!(entity instanceof Enderman)) {
- return;
- }
+ if (!(entity instanceof Enderman)) {
+ return;
+ }
// ... and the faction there has endergrief disabled ...
PS ps = PS.valueOf(event.getBlock());
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.getFlag(MFlag.getFlagEndergrief())) {
- return;
- }
+ if (faction.getFlag(MFlag.getFlagEndergrief())) {
+ return;
+ }
// ... stop the block alteration.
event.setCancelled(true);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFlagExplosion.java b/src/main/java/com/massivecraft/factions/engine/EngineFlagExplosion.java
index d9f1ec81..d863d6c6 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineFlagExplosion.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineFlagExplosion.java
@@ -47,16 +47,16 @@ public class EngineFlagExplosion extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockExplosion(HangingBreakEvent event) {
// If a hanging entity was broken by an explosion ...
- if (event.getCause() != RemoveCause.EXPLOSION) {
- return;
- }
+ if (event.getCause() != RemoveCause.EXPLOSION) {
+ return;
+ }
Entity entity = event.getEntity();
// ... and the faction there has explosions disabled ...
Faction faction = BoardColl.get().getFactionAt(PS.valueOf(entity.getLocation()));
- if (faction.isExplosionsAllowed()) {
- return;
- }
+ if (faction.isExplosionsAllowed()) {
+ return;
+ }
// ... then cancel.
event.setCancelled(true);
@@ -65,19 +65,19 @@ public class EngineFlagExplosion extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockExplosion(EntityDamageEvent event) {
// If an explosion damages ...
- if (!DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) {
- return;
- }
+ if (!DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) {
+ return;
+ }
// ... an entity that is modified on damage ...
- if (!EnumerationUtil.isEntityTypeEditOnDamage(event.getEntityType())) {
- return;
- }
+ if (!EnumerationUtil.isEntityTypeEditOnDamage(event.getEntityType())) {
+ return;
+ }
// ... and the faction has explosions disabled ...
- if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) {
- return;
- }
+ if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) {
+ return;
+ }
// ... then cancel!
event.setCancelled(true);
@@ -117,9 +117,9 @@ public class EngineFlagExplosion extends Engine {
faction2allowed.put(faction, allowed);
}
- if (!allowed) {
- iterator.remove();
- }
+ if (!allowed) {
+ iterator.remove();
+ }
}
}
@@ -127,17 +127,17 @@ public class EngineFlagExplosion extends Engine {
public void blockExplosion(EntityChangeBlockEvent event) {
// If a wither is changing a block ...
Entity entity = event.getEntity();
- if (!(entity instanceof Wither)) {
- return;
- }
+ if (!(entity instanceof Wither)) {
+ return;
+ }
// ... and the faction there has explosions disabled ...
PS ps = PS.valueOf(event.getBlock());
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.isExplosionsAllowed()) {
- return;
- }
+ if (faction.isExplosionsAllowed()) {
+ return;
+ }
// ... stop the block alteration.
event.setCancelled(true);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFlagFireSpread.java b/src/main/java/com/massivecraft/factions/engine/EngineFlagFireSpread.java
index f075d238..d67b9ed1 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineFlagFireSpread.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineFlagFireSpread.java
@@ -35,9 +35,9 @@ public class EngineFlagFireSpread extends Engine {
PS ps = PS.valueOf(block);
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.getFlag(MFlag.getFlagFirespread())) {
- return;
- }
+ if (faction.getFlag(MFlag.getFlagFirespread())) {
+ return;
+ }
// then cancel the event.
cancellable.setCancelled(true);
@@ -46,9 +46,9 @@ public class EngineFlagFireSpread extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockFireSpread(BlockIgniteEvent event) {
// If fire is spreading ...
- if (event.getCause() != IgniteCause.SPREAD && event.getCause() != IgniteCause.LAVA) {
- return;
- }
+ if (event.getCause() != IgniteCause.SPREAD && event.getCause() != IgniteCause.LAVA) {
+ return;
+ }
// ... consider blocking it.
blockFireSpread(event.getBlock(), event);
@@ -58,9 +58,9 @@ public class EngineFlagFireSpread extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockFireSpread(BlockSpreadEvent event) {
// If fire is spreading ...
- if (event.getNewState().getType() != Material.FIRE) {
- return;
- }
+ if (event.getNewState().getType() != Material.FIRE) {
+ return;
+ }
// ... consider blocking it.
blockFireSpread(event.getBlock(), event);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFlagSpawn.java b/src/main/java/com/massivecraft/factions/engine/EngineFlagSpawn.java
index 15dc09f4..40d5cbc6 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineFlagSpawn.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineFlagSpawn.java
@@ -52,9 +52,9 @@ public class EngineFlagSpawn extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockMonstersAndAnimals(CreatureSpawnEvent event) {
// If this is a natural spawn ..
- if (!NATURAL_SPAWN_REASONS.contains(event.getSpawnReason())) {
- return;
- }
+ if (!NATURAL_SPAWN_REASONS.contains(event.getSpawnReason())) {
+ return;
+ }
// ... get the spawn location ...
Location location = event.getLocation();
@@ -62,17 +62,17 @@ public class EngineFlagSpawn extends Engine {
// ... get the faction there ...
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction == null) {
- return;
- }
+ if (faction == null) {
+ return;
+ }
// ... get the entity type ...
EntityType type = event.getEntityType();
// ... and if this type can't spawn in the faction ...
- if (canSpawn(faction, type)) {
- return;
- }
+ if (canSpawn(faction, type)) {
+ return;
+ }
// ... then cancel.
event.setCancelled(true);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFlagZombiegrief.java b/src/main/java/com/massivecraft/factions/engine/EngineFlagZombiegrief.java
index 1834028c..c71ad9d9 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineFlagZombiegrief.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineFlagZombiegrief.java
@@ -30,16 +30,16 @@ public class EngineFlagZombiegrief extends Engine {
public void denyZombieGrief(EntityBreakDoorEvent event) {
// If a zombie is breaking a door ...
Entity entity = event.getEntity();
- if (!(entity instanceof Zombie)) {
- return;
- }
+ if (!(entity instanceof Zombie)) {
+ return;
+ }
// ... and the faction there has zombiegrief disabled ...
PS ps = PS.valueOf(event.getBlock());
Faction faction = BoardColl.get().getFactionAt(ps);
- if (faction.getFlag(MFlag.getFlagZombiegrief())) {
- return;
- }
+ if (faction.getFlag(MFlag.getFlagZombiegrief())) {
+ return;
+ }
// ... stop the door breakage.
event.setCancelled(true);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineFly.java b/src/main/java/com/massivecraft/factions/engine/EngineFly.java
index da6fcfac..1eea91b0 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineFly.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineFly.java
@@ -44,31 +44,31 @@ public class EngineFly extends Engine {
public void onMassiveCorePlayerUpdate(EventMassiveCorePlayerUpdate event) {
// If we are updating a player ...
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... and that player isn't in creative or spectator mode ...
- if (EventMassiveCorePlayerUpdate.isFlyAllowed(player, false)) {
- return;
- }
+ if (EventMassiveCorePlayerUpdate.isFlyAllowed(player, false)) {
+ return;
+ }
// ... and the player is alive ...
- if (player.isDead()) {
- return;
- }
+ if (player.isDead()) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(player);
// ... and the player enables flying ...
- if (!mplayer.isFlying()) {
- return;
- }
+ if (!mplayer.isFlying()) {
+ return;
+ }
// ... and the player can fly here...
- if (!canFlyInTerritory(mplayer, PS.valueOf(player))) {
- return;
- }
+ if (!canFlyInTerritory(mplayer, PS.valueOf(player))) {
+ return;
+ }
// ... set allowed ...
event.setAllowed(true);
@@ -80,27 +80,27 @@ public class EngineFly extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void moveChunkDetect(PlayerMoveEvent event) {
// If the player is moving from one chunk to another ...
- if (MUtil.isSameChunk(event)) {
- return;
- }
+ if (MUtil.isSameChunk(event)) {
+ return;
+ }
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... gather info on the player and the move ...
MPlayer mplayer = MPlayer.get(player);
PS chunkTo = PS.valueOf(event.getTo()).getChunk(true);
// ... and they are currently flying ...
- if (!mplayer.isFlying()) {
- return;
- }
+ if (!mplayer.isFlying()) {
+ return;
+ }
// ... but can't fly at the new place ...
- if (canFlyInTerritory(mplayer, chunkTo)) {
- return;
- }
+ if (canFlyInTerritory(mplayer, chunkTo)) {
+ return;
+ }
// ... then perhaps they should not be
mplayer.setFlying(false);
@@ -109,12 +109,12 @@ public class EngineFly extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void flagUpdate(EventFactionsFlagChange event) {
- if (event.getFlag() != MFlag.getFlagFly()) {
- return;
- }
- if (event.isNewValue() == true) {
- return;
- }
+ if (event.getFlag() != MFlag.getFlagFly()) {
+ return;
+ }
+ if (event.isNewValue() == true) {
+ return;
+ }
// Disable for all players when disabled
event.getFaction().getOnlinePlayers().forEach(EngineFly::deactivateForPlayer);
@@ -123,23 +123,23 @@ public class EngineFly extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void territoryShield(EntityDamageByEntityEvent event) {
// If flying is diabled on PVP ...
- if (!MConf.get().flyDisableOnPvp) {
- return;
- }
+ if (!MConf.get().flyDisableOnPvp) {
+ return;
+ }
// ... and the defender is a player ...
Entity entity = event.getEntity();
- if (MUtil.isntPlayer(entity)) {
- return;
- }
+ if (MUtil.isntPlayer(entity)) {
+ return;
+ }
Player defender = (Player) entity;
MPlayer mdefender = MPlayer.get(defender);
// ... and the attacker is a player ...
Entity eattacker = MUtil.getLiableDamager(event);
- if (!(eattacker instanceof Player)) {
- return;
- }
+ if (!(eattacker instanceof Player)) {
+ return;
+ }
Player attacker = (Player) eattacker;
MPlayer mattacker = MPlayer.get(attacker);
@@ -206,12 +206,12 @@ public class EngineFly extends Engine {
if (isAdmin) {
boolean overriding = mplayer.isOverriding();
ex.addMsg("You can change the flag if you are overriding.");
- if (overriding) {
- ex.addMsg("You are already overriding.");
- } else {
- ex.addMsg("You can enable override with:");
- ex.addMessage(CmdFactions.get().cmdFactionsOverride.getTemplate(false, true, mplayer.getSender()));
- }
+ if (overriding) {
+ ex.addMsg("You are already overriding.");
+ } else {
+ ex.addMsg("You can enable override with:");
+ ex.addMessage(CmdFactions.get().cmdFactionsOverride.getTemplate(false, true, mplayer.getSender()));
+ }
if (!isDefault) {
ex.addMsg("You can also ask someone with access to the configuration files to make flying enabled by default.");
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineLastActivity.java b/src/main/java/com/massivecraft/factions/engine/EngineLastActivity.java
index ead82ec2..b8b658e1 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineLastActivity.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineLastActivity.java
@@ -27,21 +27,21 @@ public class EngineLastActivity extends Engine {
// -------------------------------------------- //
public static void updateLastActivity(CommandSender sender) {
- if (sender == null) {
- throw new RuntimeException("sender");
- }
- if (MUtil.isntSender(sender)) {
- return;
- }
+ if (sender == null) {
+ throw new RuntimeException("sender");
+ }
+ if (MUtil.isntSender(sender)) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(sender);
mplayer.setLastActivityMillis();
}
public static void updateLastActivitySoon(final CommandSender sender) {
- if (sender == null) {
- throw new RuntimeException("sender");
- }
+ if (sender == null) {
+ throw new RuntimeException("sender");
+ }
Bukkit.getScheduler().scheduleSyncDelayedTask(Factions.get(), () -> updateLastActivity(sender));
}
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineMoveChunk.java b/src/main/java/com/massivecraft/factions/engine/EngineMoveChunk.java
index b7ca383a..d37576e7 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineMoveChunk.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineMoveChunk.java
@@ -37,13 +37,13 @@ public class EngineMoveChunk extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void moveChunkDetect(PlayerMoveEvent event) {
// If the player is moving from one chunk to another ...
- if (MUtil.isSameChunk(event)) {
- return;
- }
+ if (MUtil.isSameChunk(event)) {
+ return;
+ }
Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... gather info on the player and the move ...
MPlayer mplayer = MPlayer.get(player);
@@ -67,9 +67,9 @@ public class EngineMoveChunk extends Engine {
}
private static void sendAutoMapUpdate(MPlayer mplayer, PS ps) {
- if (!mplayer.isMapAutoUpdating()) {
- return;
- }
+ if (!mplayer.isMapAutoUpdating()) {
+ return;
+ }
AsciiMap map = new AsciiMap(mplayer, ps, false);
mplayer.message(map.render());
}
@@ -78,9 +78,9 @@ public class EngineMoveChunk extends Engine {
Faction factionFrom = BoardColl.get().getFactionAt(psFrom);
Faction factionTo = BoardColl.get().getFactionAt(psTo);
- if (factionFrom == factionTo) {
- return;
- }
+ if (factionFrom == factionTo) {
+ return;
+ }
if (mplayer.isTerritoryInfoTitles()) {
String titleMain = parseTerritoryInfo(MConf.get().territoryInfoTitlesMain, mplayer, factionTo);
@@ -96,12 +96,12 @@ public class EngineMoveChunk extends Engine {
}
private static String parseTerritoryInfo(String string, MPlayer mplayer, Faction faction) {
- if (string == null) {
- throw new NullPointerException("string");
- }
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (string == null) {
+ throw new NullPointerException("string");
+ }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
string = Txt.parse(string);
string = string.replace("{name}", faction.getName());
@@ -112,9 +112,9 @@ public class EngineMoveChunk extends Engine {
}
private static void sendTerritoryAccessMessage(MPlayer mplayer, PS psFrom, PS psTo) {
- if (!MConf.get().territoryAccessShowMessage) {
- return;
- }
+ if (!MConf.get().territoryAccessShowMessage) {
+ return;
+ }
// Get TerritoryAccess for from & to chunks
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(psFrom);
@@ -123,9 +123,9 @@ public class EngineMoveChunk extends Engine {
// See if the status has changed
AccessStatus statusFrom = accessFrom.getTerritoryAccess(mplayer);
AccessStatus statusTo = accessTo.getTerritoryAccess(mplayer);
- if (statusFrom == statusTo) {
- return;
- }
+ if (statusFrom == statusTo) {
+ return;
+ }
// Inform
mplayer.message(statusTo.getStatusMessage());
@@ -138,9 +138,9 @@ public class EngineMoveChunk extends Engine {
private static void tryAutoClaim(MPlayer mplayer, PS chunkTo) {
// If the player is auto claiming ...
Faction autoClaimFaction = mplayer.getAutoClaimFaction();
- if (autoClaimFaction == null) {
- return;
- }
+ if (autoClaimFaction == null) {
+ return;
+ }
// ... try claim.
mplayer.tryClaim(autoClaimFaction, Collections.singletonList(chunkTo));
diff --git a/src/main/java/com/massivecraft/factions/engine/EnginePermBuild.java b/src/main/java/com/massivecraft/factions/engine/EnginePermBuild.java
index e801a8ea..4f1812f2 100644
--- a/src/main/java/com/massivecraft/factions/engine/EnginePermBuild.java
+++ b/src/main/java/com/massivecraft/factions/engine/EnginePermBuild.java
@@ -62,39 +62,39 @@ public class EnginePermBuild extends Engine {
// -------------------------------------------- //
public static Boolean isProtected(ProtectCase protectCase, boolean verboose, MPlayer mplayer, PS ps, Object object) {
- if (mplayer == null) {
- return null;
- }
- if (protectCase == null) {
- return null;
- }
+ if (mplayer == null) {
+ return null;
+ }
+ if (protectCase == null) {
+ return null;
+ }
String name = mplayer.getName();
- if (MConf.get().playersWhoBypassAllProtection.contains(name)) {
- return false;
- }
- if (mplayer.isOverriding()) {
- return false;
- }
+ if (MConf.get().playersWhoBypassAllProtection.contains(name)) {
+ return false;
+ }
+ if (mplayer.isOverriding()) {
+ return false;
+ }
MPerm perm = protectCase.getPerm(object);
- if (perm == null) {
- return null;
- }
- if (protectCase != ProtectCase.BUILD) {
- return !perm.has(mplayer, ps, verboose);
- }
+ if (perm == null) {
+ return null;
+ }
+ if (protectCase != ProtectCase.BUILD) {
+ return !perm.has(mplayer, ps, verboose);
+ }
if (!perm.has(mplayer, ps, false) && MPerm.getPermPainbuild().has(mplayer, ps, false)) {
- if (!verboose) {
- return false;
- }
+ if (!verboose) {
+ return false;
+ }
Faction hostFaction = BoardColl.get().getFactionAt(ps);
mplayer.msg("It is painful to build in the territory of %s.", hostFaction.describeTo(mplayer));
Player player = mplayer.getPlayer();
- if (player != null) {
- player.damage(MConf.get().actionDeniedPainAmount);
- }
+ if (player != null) {
+ player.damage(MConf.get().actionDeniedPainAmount);
+ }
}
return !perm.has(mplayer, ps, verboose);
@@ -102,20 +102,20 @@ public class EnginePermBuild extends Engine {
public static Boolean protect(ProtectCase protectCase, boolean verboose, Player player, PS ps, Object object, Cancellable cancellable) {
Boolean ret = isProtected(protectCase, verboose, MPlayer.get(player), ps, object);
- if (Boolean.TRUE.equals(ret) && cancellable != null) {
- cancellable.setCancelled(true);
- }
+ if (Boolean.TRUE.equals(ret) && cancellable != null) {
+ cancellable.setCancelled(true);
+ }
return ret;
}
public static Boolean build(Entity entity, Block block, Event event) {
- if (!(event instanceof Cancellable)) {
- return true;
- }
- if (MUtil.isntPlayer(entity)) {
- return false;
- }
+ if (!(event instanceof Cancellable)) {
+ return true;
+ }
+ if (MUtil.isntPlayer(entity)) {
+ return false;
+ }
Player player = (Player) entity;
boolean verboose = !isFake(event);
return protect(ProtectCase.BUILD, verboose, player, PS.valueOf(block), block, (Cancellable) event);
@@ -139,9 +139,9 @@ public class EnginePermBuild extends Engine {
public static boolean canPlayerBuildAt(Object senderObject, PS ps, boolean verboose) {
MPlayer mplayer = MPlayer.get(senderObject);
- if (mplayer == null) {
- return false;
- }
+ if (mplayer == null) {
+ return false;
+ }
Boolean ret = isProtected(ProtectCase.BUILD, verboose, mplayer, ps, null);
return !Boolean.TRUE.equals(ret);
@@ -180,9 +180,9 @@ public class EnginePermBuild extends Engine {
public void build(EntityChangeBlockEvent event) {
// Handling lilypads being broken by boats
Entity entity = event.getEntity();
- if (entity.getType() != EntityType.BOAT || entity.getPassengers().size() <= 0) {
- return;
- }
+ if (entity.getType() != EntityType.BOAT || entity.getPassengers().size() <= 0) {
+ return;
+ }
Entity player = entity.getPassengers().stream().filter(MUtil::isPlayer).findAny().orElse(entity);
build(player, event.getBlock(), event);
@@ -196,26 +196,26 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void useBlockItem(PlayerInteractEvent event) {
// If the player right clicks (or is physical with) a block ...
- if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) {
- return;
- }
+ if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) {
+ return;
+ }
Block block = event.getClickedBlock();
Player player = event.getPlayer();
- if (block == null) {
- return;
- }
+ if (block == null) {
+ return;
+ }
// ... and we are either allowed to use this block ...
Boolean ret = useBlock(player, block, true, event);
- if (Boolean.TRUE.equals(ret)) {
- return;
- }
+ if (Boolean.TRUE.equals(ret)) {
+ return;
+ }
// ... or are allowed to right click with the item, this event is safe to perform.
- if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
- return;
- }
+ if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
+ return;
+ }
useItem(player, block, event.getMaterial(), event);
}
@@ -241,9 +241,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void useEntity(PlayerInteractEntityEvent event) {
// Ignore Off Hand
- if (isOffHand(event)) {
- return;
- }
+ if (isOffHand(event)) {
+ return;
+ }
useEntity(event.getPlayer(), event.getRightClicked(), true, event);
}
@@ -254,22 +254,22 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void handleArmorStand(PlayerInteractAtEntityEvent event) {
// Ignore Off Hand
- if (isOffHand(event)) {
- return;
- }
+ if (isOffHand(event)) {
+ return;
+ }
// Gather Info
final Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
final Entity entity = event.getRightClicked();
final boolean verboose = true;
// Only care for armor stands.
- if (entity.getType() != EntityType.ARMOR_STAND) {
- return;
- }
+ if (entity.getType() != EntityType.ARMOR_STAND) {
+ return;
+ }
// If we can't use, block it
EnginePermBuild.useEntity(player, entity, verboose, event);
@@ -283,16 +283,16 @@ public class EnginePermBuild extends Engine {
public void buildEntity(EntityDamageByEntityEvent event) {
// If a player ...
Entity damager = MUtil.getLiableDamager(event);
- if (MUtil.isntPlayer(damager)) {
- return;
- }
+ if (MUtil.isntPlayer(damager)) {
+ return;
+ }
Player player = (Player) damager;
// ... damages an entity which is edited on damage ...
Entity entity = event.getEntity();
- if (entity == null || !EnumerationUtil.isEntityTypeEditOnDamage(entity.getType())) {
- return;
- }
+ if (entity == null || !EnumerationUtil.isEntityTypeEditOnDamage(entity.getType())) {
+ return;
+ }
// ... and the player can't build there, cancel the event
build(player, entity.getLocation().getBlock(), event);
@@ -302,23 +302,23 @@ public class EnginePermBuild extends Engine {
public void combustEntity(EntityCombustByEntityEvent event) {
// If a burning projectile ...
- if (!(event.getCombuster() instanceof Projectile)) {
- return;
- }
+ if (!(event.getCombuster() instanceof Projectile)) {
+ return;
+ }
Projectile entityProjectile = (Projectile) event.getCombuster();
// ... fired by a player ...
ProjectileSource projectileSource = entityProjectile.getShooter();
- if (MUtil.isntPlayer(projectileSource)) {
- return;
- }
+ if (MUtil.isntPlayer(projectileSource)) {
+ return;
+ }
Player player = (Player) projectileSource;
// ... and hits an entity which is edited on damage (and thus likely to burn) ...
Entity entityTarget = event.getEntity();
- if (entityTarget == null || !EnumerationUtil.isEntityTypeEditOnDamage(entityTarget.getType())) {
- return;
- }
+ if (entityTarget == null || !EnumerationUtil.isEntityTypeEditOnDamage(entityTarget.getType())) {
+ return;
+ }
// ... and the player can't build there, cancel the event
Block block = entityTarget.getLocation().getBlock();
@@ -339,9 +339,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockBuild(BlockPistonExtendEvent event) {
// Is checking deactivated by MConf?
- if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
- return;
- }
+ if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
+ return;
+ }
Faction pistonFaction = BoardColl.get().getFactionAt(PS.valueOf(event.getBlock()));
@@ -354,14 +354,14 @@ public class EnginePermBuild extends Engine {
// Members of a faction might not have build rights in their own territory, but pistons should still work regardless
Faction targetFaction = BoardColl.get().getFactionAt(PS.valueOf(targetBlock));
- if (targetFaction == pistonFaction) {
- continue;
- }
+ if (targetFaction == pistonFaction) {
+ continue;
+ }
// Perm check
- if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
- continue;
- }
+ if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
+ continue;
+ }
event.setCancelled(true);
return;
@@ -371,9 +371,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void blockBuild(BlockPistonRetractEvent event) {
// Is checking deactivated by MConf?
- if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
- return;
- }
+ if (!MConf.get().handlePistonProtectionThroughDenyBuild) {
+ return;
+ }
Faction pistonFaction = BoardColl.get().getFactionAt(PS.valueOf(event.getBlock()));
@@ -382,20 +382,20 @@ public class EnginePermBuild extends Engine {
// Check for all retracted blocks
for (Block block : blocks) {
// Is the retracted block air/water/lava? Don't worry about it
- if (block.isEmpty() || block.isLiquid()) {
- return;
- }
+ if (block.isEmpty() || block.isLiquid()) {
+ return;
+ }
// Members of a faction might not have build rights in their own territory, but pistons should still work regardless
Faction targetFaction = BoardColl.get().getFactionAt(PS.valueOf(block));
- if (targetFaction == pistonFaction) {
- continue;
- }
+ if (targetFaction == pistonFaction) {
+ continue;
+ }
// Perm check
- if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
- continue;
- }
+ if (MPerm.getPermBuild().has(pistonFaction, targetFaction)) {
+ continue;
+ }
event.setCancelled(true);
return;
@@ -410,27 +410,27 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL)
public void buildFire(PlayerInteractEvent event) {
// If it is a left click on block and the clicked block is not null...
- if (event.getAction() != Action.LEFT_CLICK_BLOCK || event.getClickedBlock() == null) {
- return;
- }
+ if (event.getAction() != Action.LEFT_CLICK_BLOCK || event.getClickedBlock() == null) {
+ return;
+ }
// ... and the potential block is not null either ...
Block potentialBlock = event.getClickedBlock().getRelative(BlockFace.UP, 1);
- if (potentialBlock == null) {
- return;
- }
+ if (potentialBlock == null) {
+ return;
+ }
Material blockType = potentialBlock.getType();
// ... and we're only going to check for fire ... (checking everything else would be bad performance wise)
- if (blockType != Material.FIRE) {
- return;
- }
+ if (blockType != Material.FIRE) {
+ return;
+ }
// ... check if they can't build, cancel the event ...
- if (!Boolean.FALSE.equals(build(event.getPlayer(), potentialBlock, event))) {
- return;
- }
+ if (!Boolean.FALSE.equals(build(event.getPlayer(), potentialBlock, event))) {
+ return;
+ }
// ... and compensate for client side prediction
event.getPlayer().sendBlockChange(potentialBlock.getLocation(), blockType, potentialBlock.getState().getRawData());
@@ -442,9 +442,9 @@ public class EnginePermBuild extends Engine {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void buildMove(BlockFromToEvent event) {
- if (!MConf.get().protectionLiquidFlowEnabled) {
- return;
- }
+ if (!MConf.get().protectionLiquidFlowEnabled) {
+ return;
+ }
// Prepare fields
Block fromBlock = event.getBlock();
@@ -455,21 +455,21 @@ public class EnginePermBuild extends Engine {
int chunkToZ = (fromBlock.getZ() + face.getModZ()) >> 4;
// If a liquid (or dragon egg) moves from one chunk to another ...
- if (chunkToX == chunkFromX && chunkToZ == chunkFromZ) {
- return;
- }
+ if (chunkToX == chunkFromX && chunkToZ == chunkFromZ) {
+ return;
+ }
// ... get the correct board for this block ...
Board board = BoardColl.get().getFixed(fromBlock.getWorld().getName().toLowerCase(), false);
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
// ... get the access map ...
Map map = board.getMapRaw();
- if (map.isEmpty()) {
- return;
- }
+ if (map.isEmpty()) {
+ return;
+ }
// ... get the faction ids from and to ...
PS fromPs = PS.valueOf(chunkFromX, chunkFromZ);
@@ -482,22 +482,22 @@ public class EnginePermBuild extends Engine {
String toId = toTa != null ? toTa.getHostFactionId() : Factions.ID_NONE;
// ... and the chunks belong to different factions ...
- if (toId.equals(fromId)) {
- return;
- }
+ if (toId.equals(fromId)) {
+ return;
+ }
// ... and the faction "from" can not build at "to" ...
Faction fromFac = FactionColl.get().getFixed(fromId);
- if (fromFac == null) {
- fromFac = FactionColl.get().getNone();
- }
+ if (fromFac == null) {
+ fromFac = FactionColl.get().getNone();
+ }
Faction toFac = FactionColl.get().getFixed(toId);
- if (toFac == null) {
- toFac = FactionColl.get().getNone();
- }
- if (MPerm.getPermBuild().has(fromFac, toFac)) {
- return;
- }
+ if (toFac == null) {
+ toFac = FactionColl.get().getNone();
+ }
+ if (MPerm.getPermBuild().has(fromFac, toFac)) {
+ return;
+ }
// ... cancel the event!
event.setCancelled(true);
diff --git a/src/main/java/com/massivecraft/factions/engine/EnginePlayerData.java b/src/main/java/com/massivecraft/factions/engine/EnginePlayerData.java
index 7e9cf54d..5613f42c 100644
--- a/src/main/java/com/massivecraft/factions/engine/EnginePlayerData.java
+++ b/src/main/java/com/massivecraft/factions/engine/EnginePlayerData.java
@@ -31,20 +31,20 @@ public class EnginePlayerData extends Engine {
// ... and if the if player was banned (not just kicked) ...
//if (!event.getReason().equals("Banned by admin.")) return;
- if (!player.isBanned()) {
- return;
- }
+ if (!player.isBanned()) {
+ return;
+ }
// ... and we remove player data when banned ...
- if (!MConf.get().removePlayerWhenBanned) {
- return;
- }
+ if (!MConf.get().removePlayerWhenBanned) {
+ return;
+ }
// ... get rid of their stored info.
MPlayer mplayer = MPlayerColl.get().get(player, false);
- if (mplayer == null) {
- return;
- }
+ if (mplayer == null) {
+ return;
+ }
if (mplayer.getRank().isLeader()) {
mplayer.getFaction().promoteNewLeader();
diff --git a/src/main/java/com/massivecraft/factions/engine/EnginePower.java b/src/main/java/com/massivecraft/factions/engine/EnginePower.java
index 26d151c5..d2b0650c 100644
--- a/src/main/java/com/massivecraft/factions/engine/EnginePower.java
+++ b/src/main/java/com/massivecraft/factions/engine/EnginePower.java
@@ -35,15 +35,15 @@ public class EnginePower extends Engine {
public void powerLossOnDeath(PlayerDeathEvent event) {
// If a player dies ...
Player player = event.getEntity();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
// ... and this is the first death event this tick ...
// (yeah other plugins can case death event to fire twice the same tick)
- if (PlayerUtil.isDuplicateDeathEvent(event)) {
- return;
- }
+ if (PlayerUtil.isDuplicateDeathEvent(event)) {
+ return;
+ }
MPlayer mplayer = MPlayer.get(player);
@@ -65,9 +65,9 @@ public class EnginePower extends Engine {
EventFactionsPowerChange powerChangeEvent = new EventFactionsPowerChange(null, mplayer, PowerChangeReason.DEATH, newPower);
powerChangeEvent.run();
- if (powerChangeEvent.isCancelled()) {
- return;
- }
+ if (powerChangeEvent.isCancelled()) {
+ return;
+ }
newPower = powerChangeEvent.getNewPower();
mplayer.setPower(newPower);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineSeeChunk.java b/src/main/java/com/massivecraft/factions/engine/EngineSeeChunk.java
index f8f01cac..6200b646 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineSeeChunk.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineSeeChunk.java
@@ -39,9 +39,9 @@ public class EngineSeeChunk extends Engine {
// -------------------------------------------- //
public static void leaveAndWorldChangeRemoval(Player player) {
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
final MPlayer mplayer = MPlayer.get(player);
mplayer.setSeeingChunk(false);
@@ -68,9 +68,9 @@ public class EngineSeeChunk extends Engine {
// Do we have a new period?
final long now = System.currentTimeMillis();
final long length = 500;
- if (!PeriodUtil.isNewPeriod(this, length, now)) {
- return;
- }
+ if (!PeriodUtil.isNewPeriod(this, length, now)) {
+ return;
+ }
// Get the period number
final long period = PeriodUtil.getPeriod(length, now);
@@ -89,15 +89,15 @@ public class EngineSeeChunk extends Engine {
// For each player
for (Player player : Bukkit.getOnlinePlayers()) {
// Hide for dead players since the death screen looks better without.
- if (player.isDead()) {
- continue;
- }
+ if (player.isDead()) {
+ continue;
+ }
// The player must obviously have the feature activated.
MPlayer mplayer = MPlayer.get(player);
- if (!mplayer.isSeeingChunk()) {
- continue;
- }
+ if (!mplayer.isSeeingChunk()) {
+ continue;
+ }
// Calculate locations and play the effect there.
List locations = getLocations(player, steps, step);
@@ -110,18 +110,18 @@ public class EngineSeeChunk extends Engine {
public static List getLocations(Player player, int steps, int step) {
// Clean Args
- if (player == null) {
- throw new NullPointerException("player");
- }
- if (steps < 1) {
- throw new InvalidParameterException("steps must be larger than 0");
- }
- if (step < 0) {
- throw new InvalidParameterException("step must at least be 0");
- }
- if (step >= steps) {
- throw new InvalidParameterException("step must be less than steps");
- }
+ if (player == null) {
+ throw new NullPointerException("player");
+ }
+ if (steps < 1) {
+ throw new InvalidParameterException("steps must be larger than 0");
+ }
+ if (step < 0) {
+ throw new InvalidParameterException("step must at least be 0");
+ }
+ if (step >= steps) {
+ throw new InvalidParameterException("step must be less than steps");
+ }
// Create Ret
List ret = new ArrayList<>();
@@ -137,14 +137,14 @@ public class EngineSeeChunk extends Engine {
final int zmax = zmin + 15;
int keepEvery = 5;
- if (keepEvery <= 0) {
- keepEvery = Integer.MAX_VALUE;
- }
+ if (keepEvery <= 0) {
+ keepEvery = Integer.MAX_VALUE;
+ }
int skipEvery = 0;
- if (skipEvery <= 0) {
- skipEvery = Integer.MAX_VALUE;
- }
+ if (skipEvery <= 0) {
+ skipEvery = Integer.MAX_VALUE;
+ }
int x = xmin;
int z = zmin;
@@ -154,36 +154,36 @@ public class EngineSeeChunk extends Engine {
while (x + 1 <= xmax) {
x++;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Add #2
while (z + 1 <= zmax) {
z++;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Add #3
while (x - 1 >= xmin) {
x--;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Add #4
while (z - 1 >= zmin) {
z--;
i++;
- if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
- ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
- }
+ if (i % steps == step && (i % keepEvery == 0 && i % skipEvery != 0)) {
+ ret.add(new Location(world, x + 0.5, y + 0.5, z + 0.5));
+ }
}
// Return Ret
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineTeleportHomeOnDeath.java b/src/main/java/com/massivecraft/factions/engine/EngineTeleportHomeOnDeath.java
index 6986bb03..7bd629f2 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineTeleportHomeOnDeath.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineTeleportHomeOnDeath.java
@@ -32,33 +32,33 @@ public class EngineTeleportHomeOnDeath extends Engine {
public void teleportToHomeOnDeath(PlayerRespawnEvent event, EventPriority priority) {
// If a player is respawning ...
final Player player = event.getPlayer();
- if (MUtil.isntPlayer(player)) {
- return;
- }
+ if (MUtil.isntPlayer(player)) {
+ return;
+ }
final MPlayer mplayer = MPlayer.get(player);
// ... homes are enabled, active and at this priority ...
- if (!MConf.get().warpsEnabled) {
- return;
- }
- if (!MConf.get().warpsTeleportToOnDeathActive) {
- return;
- }
- if (MConf.get().warpsTeleportToOnDeathPriority != priority) {
- return;
- }
+ if (!MConf.get().warpsEnabled) {
+ return;
+ }
+ if (!MConf.get().warpsTeleportToOnDeathActive) {
+ return;
+ }
+ if (MConf.get().warpsTeleportToOnDeathPriority != priority) {
+ return;
+ }
// ... and the player has a faction ...
final Faction faction = mplayer.getFaction();
- if (faction.isNone()) {
- return;
- }
+ if (faction.isNone()) {
+ return;
+ }
// ... and the faction has a home ...
List warps = faction.getWarps().getAll((java.util.function.Predicate) (warp -> warp.getName().equalsIgnoreCase(MConf.get().warpsTeleportToOnDeathName)));
- if (warps.isEmpty()) {
- return;
- }
+ if (warps.isEmpty()) {
+ return;
+ }
Warp warp = warps.get(0);
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineTerritoryShield.java b/src/main/java/com/massivecraft/factions/engine/EngineTerritoryShield.java
index b75aa1f3..71a956fe 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineTerritoryShield.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineTerritoryShield.java
@@ -31,32 +31,32 @@ public class EngineTerritoryShield extends Engine {
public void territoryShield(EntityDamageByEntityEvent event) {
// If the entity is a player ...
Entity entity = event.getEntity();
- if (MUtil.isntPlayer(entity)) {
- return;
- }
+ if (MUtil.isntPlayer(entity)) {
+ return;
+ }
Player player = (Player) entity;
MPlayer mplayer = MPlayer.get(player);
// ... and the attacker is a player ...
Entity attacker = MUtil.getLiableDamager(event);
- if (!(attacker instanceof Player)) {
- return;
- }
+ if (!(attacker instanceof Player)) {
+ return;
+ }
// ... and that player has a faction ...
- if (!mplayer.hasFaction()) {
- return;
- }
+ if (!mplayer.hasFaction()) {
+ return;
+ }
// ... and that player is in their own territory ...
- if (!mplayer.isInOwnTerritory()) {
- return;
- }
+ if (!mplayer.isInOwnTerritory()) {
+ return;
+ }
// ... and a territoryShieldFactor is configured ...
- if (MConf.get().territoryShieldFactor <= 0) {
- return;
- }
+ if (MConf.get().territoryShieldFactor <= 0) {
+ return;
+ }
// ... then scale the damage ...
double factor = 1D - MConf.get().territoryShieldFactor;
diff --git a/src/main/java/com/massivecraft/factions/engine/EngineVisualizations.java b/src/main/java/com/massivecraft/factions/engine/EngineVisualizations.java
index 907e54fe..f448114d 100644
--- a/src/main/java/com/massivecraft/factions/engine/EngineVisualizations.java
+++ b/src/main/java/com/massivecraft/factions/engine/EngineVisualizations.java
@@ -24,9 +24,9 @@ public class EngineVisualizations extends Engine {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMoveClearVisualizations(PlayerMoveEvent event) {
- if (MUtil.isSameBlock(event)) {
- return;
- }
+ if (MUtil.isSameBlock(event)) {
+ return;
+ }
VisualizeUtil.clear(event.getPlayer());
}
diff --git a/src/main/java/com/massivecraft/factions/entity/Board.java b/src/main/java/com/massivecraft/factions/entity/Board.java
index 21fbb3bf..6f180909 100644
--- a/src/main/java/com/massivecraft/factions/entity/Board.java
+++ b/src/main/java/com/massivecraft/factions/entity/Board.java
@@ -40,12 +40,12 @@ public class Board extends Entity implements BoardInterface {
@Override
public boolean isDefault() {
- if (this.map == null) {
- return true;
- }
- if (this.map.isEmpty()) {
- return true;
- }
+ if (this.map == null) {
+ return true;
+ }
+ if (this.map.isEmpty()) {
+ return true;
+ }
return false;
}
@@ -83,15 +83,15 @@ public class Board extends Entity implements BoardInterface {
@Override
public TerritoryAccess getTerritoryAccessAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
ps = ps.getChunkCoords(true);
TerritoryAccess ret = this.map.get(ps);
- if (ret == null || ret.getHostFaction() == null) {
- ret = TerritoryAccess.valueOf(Factions.ID_NONE);
- }
+ if (ret == null || ret.getHostFaction() == null) {
+ ret = TerritoryAccess.valueOf(Factions.ID_NONE);
+ }
return ret;
}
@@ -161,9 +161,9 @@ public class Board extends Entity implements BoardInterface {
@Override
public Map> getFactionToChunks(boolean withWorld) {
Function, PS> mapper = Entry::getKey;
- if (withWorld) {
- mapper = mapper.andThen(ps -> ps.withWorld(this.getId()));
- }
+ if (withWorld) {
+ mapper = mapper.andThen(ps -> ps.withWorld(this.getId()));
+ }
return map.entrySet().stream().collect(Collectors.groupingBy(
entry -> entry.getValue().getHostFaction(), // This specifies how to get the key
@@ -180,18 +180,18 @@ public class Board extends Entity implements BoardInterface {
@Override
public int getCount(Faction faction) {
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
return this.getCount(faction.getId());
}
@Override
public int getCount(String factionId) {
- if (factionId == null) {
- throw new NullPointerException("factionId");
- }
+ if (factionId == null) {
+ throw new NullPointerException("factionId");
+ }
return (int) this.map.values().stream()
.map(TerritoryAccess::getHostFactionId)
@@ -234,24 +234,24 @@ public class Board extends Entity implements BoardInterface {
Faction faction = this.getFactionAt(ps);
nearby = ps.withChunkX(ps.getChunkX() + 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkX(ps.getChunkX() - 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() + 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() - 1);
- if (faction != this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction != this.getFactionAt(nearby)) {
+ return true;
+ }
return false;
}
@@ -269,24 +269,24 @@ public class Board extends Entity implements BoardInterface {
PS nearby = null;
nearby = ps.withChunkX(ps.getChunkX() + 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkX(ps.getChunkX() - 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() + 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
nearby = ps.withChunkZ(ps.getChunkZ() - 1);
- if (faction == this.getFactionAt(nearby)) {
- return true;
- }
+ if (faction == this.getFactionAt(nearby)) {
+ return true;
+ }
return false;
}
diff --git a/src/main/java/com/massivecraft/factions/entity/BoardColl.java b/src/main/java/com/massivecraft/factions/entity/BoardColl.java
index 4dc3fe17..f61e0b8e 100644
--- a/src/main/java/com/massivecraft/factions/entity/BoardColl.java
+++ b/src/main/java/com/massivecraft/factions/entity/BoardColl.java
@@ -48,15 +48,15 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public String fixId(Object oid) {
- if (oid == null) {
- return null;
- }
- if (oid instanceof String) {
- return (String) oid;
- }
- if (oid instanceof Board) {
- return ((Board) oid).getId();
- }
+ if (oid == null) {
+ return null;
+ }
+ if (oid instanceof String) {
+ return (String) oid;
+ }
+ if (oid instanceof Board) {
+ return ((Board) oid).getId();
+ }
boolean debug = MassiveCoreMConf.get().debugEnabled;
String ret = MUtil.extract(String.class, "worldName", oid);
@@ -72,25 +72,25 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public TerritoryAccess getTerritoryAccessAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return null;
- }
+ if (board == null) {
+ return null;
+ }
return board.getTerritoryAccessAt(ps);
}
@Override
public Faction getFactionAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return null;
- }
+ if (board == null) {
+ return null;
+ }
return board.getFactionAt(ps);
}
@@ -98,25 +98,25 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public void setTerritoryAccessAt(PS ps, TerritoryAccess territoryAccess) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
board.setTerritoryAccessAt(ps, territoryAccess);
}
@Override
public void setFactionAt(PS ps, Faction faction) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
board.setFactionAt(ps, faction);
}
@@ -124,13 +124,13 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public void removeAt(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return;
- }
+ if (board == null) {
+ return;
+ }
board.removeAt(ps);
}
@@ -190,9 +190,9 @@ public class BoardColl extends Coll implements BoardInterface {
}
// Enforce create
- if (ret == null) {
- ret = new MassiveMap<>();
- }
+ if (ret == null) {
+ ret = new MassiveMap<>();
+ }
// Return
return ret;
@@ -250,13 +250,13 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public boolean isBorderPs(PS ps) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return false;
- }
+ if (board == null) {
+ return false;
+ }
return board.isBorderPs(ps);
}
@@ -267,22 +267,22 @@ public class BoardColl extends Coll implements BoardInterface {
@Override
public boolean isConnectedPs(PS ps, Faction faction) {
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
Board board = this.get(ps.getWorld());
- if (board == null) {
- return false;
- }
+ if (board == null) {
+ return false;
+ }
return board.isConnectedPs(ps, faction);
}
@Override
public boolean isAnyConnectedPs(Set pss, Faction faction) {
for (PS ps : pss) {
- if (this.isConnectedPs(ps, faction)) {
- return true;
- }
+ if (this.isConnectedPs(ps, faction)) {
+ return true;
+ }
}
return false;
}
@@ -296,9 +296,9 @@ public class BoardColl extends Coll implements BoardInterface {
}
public Set getClaimedWorlds(String factionId) {
- if (factionId == null) {
- throw new NullPointerException("factionId");
- }
+ if (factionId == null) {
+ throw new NullPointerException("factionId");
+ }
return this.getAll().stream()
.filter(board -> board.hasClaimed(factionId))
.map(Board::getId)
@@ -314,16 +314,16 @@ public class BoardColl extends Coll implements BoardInterface {
// Distance 1 returns 3x3 = 9 chunks.
public static Set getNearbyChunks(PS psChunk, int distance) {
// Fix Args
- if (psChunk == null) {
- throw new NullPointerException("psChunk");
- }
+ if (psChunk == null) {
+ throw new NullPointerException("psChunk");
+ }
psChunk = psChunk.getChunk(true);
// Create
Set ret = new MassiveSet<>();
- if (distance < 0) {
- return ret;
- }
+ if (distance < 0) {
+ return ret;
+ }
// Fill
int chunkX = psChunk.getChunkX();
@@ -347,16 +347,16 @@ public class BoardColl extends Coll implements BoardInterface {
public static Set getNearbyChunks(Collection chunks, int distance) {
// Fix Args
- if (chunks == null) {
- throw new NullPointerException("chunks");
- }
+ if (chunks == null) {
+ throw new NullPointerException("chunks");
+ }
// Create
Set ret = new MassiveSet<>();
- if (distance < 0) {
- return ret;
- }
+ if (distance < 0) {
+ return ret;
+ }
// Fill
for (PS chunk : chunks) {
@@ -369,9 +369,9 @@ public class BoardColl extends Coll implements BoardInterface {
public static Set getDistinctFactions(Collection chunks) {
// Fix Args
- if (chunks == null) {
- throw new NullPointerException("chunks");
- }
+ if (chunks == null) {
+ throw new NullPointerException("chunks");
+ }
// Create
Set ret = new MassiveSet<>();
@@ -379,9 +379,9 @@ public class BoardColl extends Coll implements BoardInterface {
// Fill
for (PS chunk : chunks) {
Faction faction = get().getFactionAt(chunk);
- if (faction == null) {
- continue;
- }
+ if (faction == null) {
+ continue;
+ }
ret.add(faction);
}
@@ -398,9 +398,9 @@ public class BoardColl extends Coll implements BoardInterface {
for (PS chunk : chunks) {
chunk = chunk.getChunk(true);
Faction faction = get().getFactionAt(chunk);
- if (faction == null) {
- faction = none;
- }
+ if (faction == null) {
+ faction = none;
+ }
ret.put(chunk, faction);
}
@@ -414,9 +414,9 @@ public class BoardColl extends Coll implements BoardInterface {
outer:
for (PS ps : pss) {
- if (discovered.contains(ps)) {
- continue outer;
- }
+ if (discovered.contains(ps)) {
+ continue outer;
+ }
List forest = new MassiveList<>();
forests.add(forest);
@@ -426,9 +426,9 @@ public class BoardColl extends Coll implements BoardInterface {
inner:
while (!stack.empty()) {
PS elm = stack.pop();
- if (discovered.contains(elm)) {
- continue inner;
- }
+ if (discovered.contains(elm)) {
+ continue inner;
+ }
System.out.println(elm);
discovered.add(elm);
forest.add(elm);
@@ -444,9 +444,9 @@ public class BoardColl extends Coll implements BoardInterface {
}
private static void addIfInSource(PS ps, Stack stack, Collection source) {
- if (source.contains(ps)) {
- stack.push(ps);
- }
+ if (source.contains(ps)) {
+ stack.push(ps);
+ }
}
}
diff --git a/src/main/java/com/massivecraft/factions/entity/Faction.java b/src/main/java/com/massivecraft/factions/entity/Faction.java
index 0c502a5e..36cb7e1e 100644
--- a/src/main/java/com/massivecraft/factions/entity/Faction.java
+++ b/src/main/java/com/massivecraft/factions/entity/Faction.java
@@ -87,9 +87,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
@Override
public void preDetach(String id) {
- if (!this.isLive()) {
- return;
- }
+ if (!this.isLive()) {
+ return;
+ }
// NOTE: Existence check is required for compatibility with some plugins.
// If they have money ...
@@ -198,9 +198,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
String target = name;
// Detect Nochange
- if (MUtil.equals(this.name, target)) {
- return;
- }
+ if (MUtil.equals(this.name, target)) {
+ return;
+ }
// Apply
this.name = target;
@@ -220,9 +220,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public String getName(RelationParticipator observer) {
- if (observer == null) {
- return getName();
- }
+ if (observer == null) {
+ return getName();
+ }
return this.getName(this.getColorTo(observer).toString());
}
@@ -245,9 +245,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
String target = clean(description);
// Detect Nochange
- if (MUtil.equals(this.description, target)) {
- return;
- }
+ if (MUtil.equals(this.description, target)) {
+ return;
+ }
// Apply
this.description = target;
@@ -260,9 +260,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public String getDescriptionDesc() {
String motd = this.getDescription();
- if (motd == null) {
- motd = NODESCRIPTION;
- }
+ if (motd == null) {
+ motd = NODESCRIPTION;
+ }
return motd;
}
@@ -285,9 +285,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
String target = clean(motd);
// Detect Nochange
- if (MUtil.equals(this.motd, target)) {
- return;
- }
+ if (MUtil.equals(this.motd, target)) {
+ return;
+ }
// Apply
this.motd = target;
@@ -303,9 +303,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
private static String getMotdDesc(String motd) {
- if (motd == null) {
- motd = NOMOTD;
- }
+ if (motd == null) {
+ motd = NOMOTD;
+ }
return motd;
}
@@ -339,9 +339,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public void setCreatedAtMillis(long createdAtMillis) {
// Detect Nochange
- if (MUtil.equals(this.createdAtMillis, createdAtMillis)) {
- return;
- }
+ if (MUtil.equals(this.createdAtMillis, createdAtMillis)) {
+ return;
+ }
// Apply
this.createdAtMillis = createdAtMillis;
@@ -367,28 +367,28 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public Warp getWarp(Object oid) {
- if (oid == null) {
- throw new NullPointerException("oid");
- }
+ if (oid == null) {
+ throw new NullPointerException("oid");
+ }
Warp warp = this.getWarps().get(oid);
- if (warp == null) {
- return null;
- }
+ if (warp == null) {
+ return null;
+ }
- if (!warp.verifyIsValid()) {
- return null;
- }
+ if (!warp.verifyIsValid()) {
+ return null;
+ }
return warp;
}
public PS getWarpPS(Object oid) {
- if (oid == null) {
- throw new NullPointerException("oid");
- }
+ if (oid == null) {
+ throw new NullPointerException("oid");
+ }
Warp warp = this.getWarp(oid);
- if (warp == null) {
- return null;
- }
+ if (warp == null) {
+ return null;
+ }
return warp.getLocation();
}
@@ -408,9 +408,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
@Override
public double getPowerBoost() {
Double ret = this.powerBoost;
- if (ret == null) {
- ret = 0D;
- }
+ if (ret == null) {
+ ret = 0D;
+ }
return ret;
}
@@ -419,14 +419,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
// Clean input
Double target = powerBoost;
- if (target == null || target == 0) {
- target = null;
- }
+ if (target == null || target == 0) {
+ target = null;
+ }
// Detect Nochange
- if (MUtil.equals(this.powerBoost, target)) {
- return;
- }
+ if (MUtil.equals(this.powerBoost, target)) {
+ return;
+ }
// Apply
this.powerBoost = target;
@@ -440,29 +440,29 @@ public class Faction extends Entity implements FactionsParticipator, MP
// -------------------------------------------- //
public double getMoney() {
- if (!MConf.get().econEnabled) {
- throw new UnsupportedOperationException("econ not enabled");
- }
- if (!MConf.get().bankEnabled) {
- throw new UnsupportedOperationException("bank not enabled");
- }
- if (!MConf.get().useNewMoneySystem) {
- throw new UnsupportedOperationException("this server does not use the new econ system");
- }
+ if (!MConf.get().econEnabled) {
+ throw new UnsupportedOperationException("econ not enabled");
+ }
+ if (!MConf.get().bankEnabled) {
+ throw new UnsupportedOperationException("bank not enabled");
+ }
+ if (!MConf.get().useNewMoneySystem) {
+ throw new UnsupportedOperationException("this server does not use the new econ system");
+ }
return this.convertGet(this.money, 0D);
}
public void setMoney(Double money) {
- if (!MConf.get().econEnabled) {
- throw new UnsupportedOperationException("econ not enabled");
- }
- if (!MConf.get().bankEnabled) {
- throw new UnsupportedOperationException("bank not enabled");
- }
- if (!MConf.get().useNewMoneySystem) {
- throw new UnsupportedOperationException("this server does not use the new econ system");
- }
+ if (!MConf.get().econEnabled) {
+ throw new UnsupportedOperationException("econ not enabled");
+ }
+ if (!MConf.get().bankEnabled) {
+ throw new UnsupportedOperationException("bank not enabled");
+ }
+ if (!MConf.get().useNewMoneySystem) {
+ throw new UnsupportedOperationException("this server does not use the new econ system");
+ }
this.money = this.convertSet(money, this.money, 0D);
}
@@ -517,9 +517,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public Rank getRank(String rankId) {
- if (rankId == null) {
- throw new NullPointerException("rankId");
- }
+ if (rankId == null) {
+ throw new NullPointerException("rankId");
+ }
return this.getRanks().getFixed(rankId);
}
@@ -536,9 +536,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public Rank getLeaderRank() {
Rank ret = null;
for (Rank rank : this.getRanks().getAll()) {
- if (ret != null && ret.isMoreThan(rank)) {
- continue;
- }
+ if (ret != null && ret.isMoreThan(rank)) {
+ continue;
+ }
ret = rank;
}
@@ -548,9 +548,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public Rank getLowestRank() {
Rank ret = null;
for (Rank rank : this.getRanks().getAll()) {
- if (ret != null && ret.isLessThan(rank)) {
- continue;
- }
+ if (ret != null && ret.isLessThan(rank)) {
+ continue;
+ }
ret = rank;
}
@@ -568,16 +568,16 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public void addVote(Vote vote) {
- if (vote == null) {
- throw new NullPointerException("vote");
- }
+ if (vote == null) {
+ throw new NullPointerException("vote");
+ }
this.getVotes().attach(vote);
}
public Optional getVoteByName(String name) {
- if (name == null) {
- throw new NullPointerException("name");
- }
+ if (name == null) {
+ throw new NullPointerException("name");
+ }
return this.getVotes().getAll().stream().filter(vote -> vote.getName().equalsIgnoreCase(name)).findFirst();
}
@@ -596,9 +596,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
MassiveMapDef target = new MassiveMapDef<>(relationWishes);
// Detect Nochange
- if (MUtil.equals(this.relationWishes, target)) {
- return;
- }
+ if (MUtil.equals(this.relationWishes, target)) {
+ return;
+ }
// Apply
this.relationWishes = target;
@@ -611,9 +611,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public Rel getRelationWish(String factionId) {
Rel ret = this.getRelationWishes().get(factionId);
- if (ret == null) {
- ret = Rel.NEUTRAL;
- }
+ if (ret == null) {
+ ret = Rel.NEUTRAL;
+ }
return ret;
}
@@ -664,9 +664,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
// ... resolve object and skip unknowns ...
MFlag mflag = MFlag.get(id);
- if (mflag == null) {
- continue;
- }
+ if (mflag == null) {
+ continue;
+ }
ret.put(mflag, entry.getValue());
}
@@ -687,23 +687,23 @@ public class Faction extends Entity implements FactionsParticipator, MP
MassiveMapDef target = new MassiveMapDef<>();
for (Map.Entry entry : flagIds.entrySet()) {
String key = entry.getKey();
- if (key == null) {
- continue;
- }
+ if (key == null) {
+ continue;
+ }
key = key.toLowerCase(); // Lowercased Keys Version 2.6.0 --> 2.7.0
Boolean value = entry.getValue();
- if (value == null) {
- continue;
- }
+ if (value == null) {
+ continue;
+ }
target.put(key, value);
}
// Detect Nochange
- if (MUtil.equals(this.flags, target)) {
- return;
- }
+ if (MUtil.equals(this.flags, target)) {
+ return;
+ }
// Apply
this.flags = new MassiveMapDef<>(target);
@@ -715,67 +715,67 @@ public class Faction extends Entity implements FactionsParticipator, MP
// FINER
public boolean getFlag(String flagId) {
- if (flagId == null) {
- throw new NullPointerException("flagId");
- }
+ if (flagId == null) {
+ throw new NullPointerException("flagId");
+ }
Boolean ret = this.flags.get(flagId);
- if (ret != null) {
- return ret;
- }
+ if (ret != null) {
+ return ret;
+ }
MFlag flag = MFlag.get(flagId);
- if (flag == null) {
- throw new NullPointerException("flag");
- }
+ if (flag == null) {
+ throw new NullPointerException("flag");
+ }
return flag.isStandard();
}
public boolean getFlag(MFlag flag) {
- if (flag == null) {
- throw new NullPointerException("flag");
- }
+ if (flag == null) {
+ throw new NullPointerException("flag");
+ }
String flagId = flag.getId();
- if (flagId == null) {
- throw new NullPointerException("flagId");
- }
+ if (flagId == null) {
+ throw new NullPointerException("flagId");
+ }
Boolean ret = this.flags.get(flagId);
- if (ret != null) {
- return ret;
- }
+ if (ret != null) {
+ return ret;
+ }
return flag.isStandard();
}
public Boolean setFlag(String flagId, boolean value) {
- if (flagId == null) {
- throw new NullPointerException("flagId");
- }
+ if (flagId == null) {
+ throw new NullPointerException("flagId");
+ }
Boolean ret = this.flags.put(flagId, value);
- if (ret == null || ret != value) {
- this.changed();
- }
+ if (ret == null || ret != value) {
+ this.changed();
+ }
return ret;
}
public Boolean setFlag(MFlag flag, boolean value) {
- if (flag == null) {
- throw new NullPointerException("flag");
- }
+ if (flag == null) {
+ throw new NullPointerException("flag");
+ }
String flagId = flag.getId();
- if (flagId == null) {
- throw new NullPointerException("flagId");
- }
+ if (flagId == null) {
+ throw new NullPointerException("flagId");
+ }
Boolean ret = this.flags.put(flagId, value);
- if (ret == null || ret != value) {
- this.changed();
- }
+ if (ret == null || ret != value) {
+ this.changed();
+ }
return ret;
}
@@ -819,18 +819,18 @@ public class Faction extends Entity implements FactionsParticipator, MP
// IS PERMITTED
public boolean isPlayerPermitted(MPlayer mplayer, String permId) {
- if (isPermitted(mplayer.getId(), permId)) {
- return true;
- }
- if (isPermitted(mplayer.getFaction().getId(), permId)) {
- return true;
- }
- if (isPermitted(mplayer.getRank().getId(), permId)) {
- return true;
- }
- if (isPermitted(RelationUtil.getRelationOfThatToMe(mplayer, this).toString(), permId)) {
- return true;
- }
+ if (isPermitted(mplayer.getId(), permId)) {
+ return true;
+ }
+ if (isPermitted(mplayer.getFaction().getId(), permId)) {
+ return true;
+ }
+ if (isPermitted(mplayer.getRank().getId(), permId)) {
+ return true;
+ }
+ if (isPermitted(RelationUtil.getRelationOfThatToMe(mplayer, this).toString(), permId)) {
+ return true;
+ }
return false;
}
@@ -840,12 +840,12 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public boolean isFactionPermitted(Faction faction, String permId) {
- if (isPermitted(faction.getId(), permId)) {
- return true;
- }
- if (isPermitted(RelationUtil.getRelationOfThatToMe(faction, this).toString(), permId)) {
- return true;
- }
+ if (isPermitted(faction.getId(), permId)) {
+ return true;
+ }
+ if (isPermitted(RelationUtil.getRelationOfThatToMe(faction, this).toString(), permId)) {
+ return true;
+ }
return false;
}
@@ -855,17 +855,17 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public Set getPermitted(String permId) {
- if (permId == null) {
- throw new NullPointerException("permId");
- }
+ if (permId == null) {
+ throw new NullPointerException("permId");
+ }
Set permables = this.perms.get(permId);
if (permables == null) {
// No perms was found, but likely this is just a new MPerm.
// So if this does not exist in the database, throw an error.
- if (!doesPermExist(permId)) {
- throw new NullPointerException(permId + " caused null");
- }
+ if (!doesPermExist(permId)) {
+ throw new NullPointerException(permId + " caused null");
+ }
permables = new MassiveSet<>();
this.perms.put(permId, permables);
@@ -887,21 +887,21 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public boolean isPermitted(String permableId, String permId) {
- if (permableId == null) {
- throw new NullPointerException("permableId");
- }
- if (permId == null) {
- throw new NullPointerException("permId");
- }
+ if (permableId == null) {
+ throw new NullPointerException("permableId");
+ }
+ if (permId == null) {
+ throw new NullPointerException("permId");
+ }
// TODO: Isn't this section redundant and just a copy of that from getPermitted?
Set permables = this.perms.get(permId);
if (permables == null) {
// No perms was found, but likely this is just a new MPerm.
// So if this does not exist in the database, throw an error.
- if (!doesPermExist(permId)) {
- throw new NullPointerException(permId + " caused null");
- }
+ if (!doesPermExist(permId)) {
+ throw new NullPointerException(permId + " caused null");
+ }
// Otherwise handle it
return false;
@@ -919,9 +919,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
if (perms == null) {
// No perms was found, but likely this is just a new MPerm.
// So if this does not exist in the database, throw an error.
- if (!doesPermExist(permId)) {
- throw new NullPointerException(permId + " caused null");
- }
+ if (!doesPermExist(permId)) {
+ throw new NullPointerException(permId + " caused null");
+ }
// Otherwise handle it
Set permables = new MassiveSet<>();
@@ -934,9 +934,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
} else {
changed = this.getPerms().get(permId).remove(mpermable.getId()) | changed;
}
- if (changed) {
- this.changed();
- }
+ if (changed) {
+ this.changed();
+ }
return changed;
}
@@ -969,16 +969,16 @@ public class Faction extends Entity implements FactionsParticipator, MP
// FINER GET
public Double getTaxFor(String id) {
- if (id == null) {
- throw new NullPointerException("id");
- }
+ if (id == null) {
+ throw new NullPointerException("id");
+ }
return this.tax.get(id);
}
public Double getTaxFor(Identified identified) {
- if (identified == null) {
- throw new NullPointerException("identified");
- }
+ if (identified == null) {
+ throw new NullPointerException("identified");
+ }
return this.getTaxFor(identified.getId());
}
@@ -987,30 +987,30 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public Optional> getTaxAndReasonForPlayer(MPlayer mplayer) {
- if (mplayer == null) {
- throw new NullPointerException("mplayer");
- }
+ if (mplayer == null) {
+ throw new NullPointerException("mplayer");
+ }
- if (mplayer.getFaction() != this) {
- throw new IllegalArgumentException("Player " + mplayer.getId() + " not in " + this.getId());
- }
+ if (mplayer.getFaction() != this) {
+ throw new IllegalArgumentException("Player " + mplayer.getId() + " not in " + this.getId());
+ }
Double ret = null;
ret = this.getTaxFor(mplayer);
- if (ret != null) {
- return Optional.of(new Couple<>(mplayer.getId(), ret));
- }
+ if (ret != null) {
+ return Optional.of(new Couple<>(mplayer.getId(), ret));
+ }
ret = this.getTaxFor(mplayer.getRank());
- if (ret != null) {
- return Optional.of(new Couple<>(mplayer.getRank().getId(), ret));
- }
+ if (ret != null) {
+ return Optional.of(new Couple<>(mplayer.getRank().getId(), ret));
+ }
ret = this.getTaxFor(IDENTIFIER_TAX_BASE);
- if (ret != null) {
- return Optional.of(new Couple<>(IDENTIFIER_TAX_BASE, ret));
- }
+ if (ret != null) {
+ return Optional.of(new Couple<>(IDENTIFIER_TAX_BASE, ret));
+ }
return Optional.empty();
}
@@ -1061,9 +1061,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
@Override
public String getDisplayName(Object senderObject) {
MPlayer mplayer = MPlayer.get(senderObject);
- if (mplayer == null) {
- return this.getName();
- }
+ if (mplayer == null) {
+ return this.getName();
+ }
return this.describeTo(mplayer);
}
@@ -1074,9 +1074,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
// TODO: Implement a has enough feature.
public double getPower() {
- if (this.getFlag(MFlag.getFlagInfpower())) {
- return 999999;
- }
+ if (this.getFlag(MFlag.getFlagInfpower())) {
+ return 999999;
+ }
double ret = 0;
for (MPlayer mplayer : this.getMPlayers()) {
@@ -1090,9 +1090,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
}
public double getPowerMax() {
- if (this.getFlag(MFlag.getFlagInfpower())) {
- return 999999;
- }
+ if (this.getFlag(MFlag.getFlagInfpower())) {
+ return 999999;
+ }
double ret = 0;
for (MPlayer mplayer : this.getMPlayers()) {
@@ -1170,9 +1170,9 @@ public class Faction extends Entity implements FactionsParticipator, MP
public MPlayer getLeader() {
List ret = this.getMPlayersWhereRank(this.getLeaderRank());
- if (ret.size() == 0) {
- return null;
- }
+ if (ret.size() == 0) {
+ return null;
+ }
return ret.get(0);
}
@@ -1186,14 +1186,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
// Fill Ret
for (CommandSender sender : IdUtil.getLocalSenders()) {
- if (MUtil.isntSender(sender)) {
- continue;
- }
+ if (MUtil.isntSender(sender)) {
+ continue;
+ }
MPlayer mplayer = MPlayer.get(sender);
- if (mplayer.getFaction() != this) {
- continue;
- }
+ if (mplayer.getFaction() != this) {
+ continue;
+ }
ret.add(sender);
}
@@ -1208,14 +1208,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
// Fill Ret
for (Player player : Bukkit.getOnlinePlayers()) {
- if (MUtil.isntPlayer(player)) {
- continue;
- }
+ if (MUtil.isntPlayer(player)) {
+ continue;
+ }
MPlayer mplayer = MPlayer.get(player);
- if (mplayer.getFaction() != this) {
- continue;
- }
+ if (mplayer.getFaction() != this) {
+ continue;
+ }
ret.add(player);
}
@@ -1226,12 +1226,12 @@ public class Faction extends Entity implements FactionsParticipator, MP
// used when current leader is about to be removed from the faction; promotes new leader, or disbands faction if no other members left
public void promoteNewLeader() {
- if (!this.isNormal()) {
- return;
- }
- if (this.getFlag(MFlag.getFlagPermanent()) && MConf.get().permanentFactionsDisableLeaderPromotion) {
- return;
- }
+ if (!this.isNormal()) {
+ return;
+ }
+ if (this.getFlag(MFlag.getFlagPermanent()) && MConf.get().permanentFactionsDisableLeaderPromotion) {
+ return;
+ }
MPlayer oldLeader = this.getLeader();
Rank leaderRank = oldLeader.getRank();
@@ -1239,14 +1239,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
List replacements = Collections.emptyList();
for (Rank rank = leaderRank; rank != null; rank = rank.getRankBelow()) {
//Skip first
- if (rank == leaderRank) {
- continue;
- }
+ if (rank == leaderRank) {
+ continue;
+ }
replacements = this.getMPlayersWhereRank(rank);
- if (!replacements.isEmpty()) {
- break;
- }
+ if (!replacements.isEmpty()) {
+ break;
+ }
}
// if we found a replacement
@@ -1305,12 +1305,12 @@ public class Faction extends Entity implements FactionsParticipator, MP
boolean explosions = this.getFlag(MFlag.getFlagExplosions());
boolean offlineexplosions = this.getFlag(MFlag.getFlagOfflineexplosions());
- if (explosions && offlineexplosions) {
- return true;
- }
- if (!explosions && !offlineexplosions) {
- return false;
- }
+ if (explosions && offlineexplosions) {
+ return true;
+ }
+ if (!explosions && !offlineexplosions) {
+ return false;
+ }
boolean online = this.isFactionConsideredOnline();
@@ -1357,14 +1357,14 @@ public class Faction extends Entity implements FactionsParticipator, MP
// FIXME this probably needs to be moved elsewhere
public static String clean(String message) {
String target = message;
- if (target == null) {
- return null;
- }
+ if (target == null) {
+ return null;
+ }
target = target.trim();
- if (target.isEmpty()) {
- target = null;
- }
+ if (target.isEmpty()) {
+ target = null;
+ }
return target;
}
diff --git a/src/main/java/com/massivecraft/factions/entity/FactionColl.java b/src/main/java/com/massivecraft/factions/entity/FactionColl.java
index 1304a116..d695217b 100644
--- a/src/main/java/com/massivecraft/factions/entity/FactionColl.java
+++ b/src/main/java/com/massivecraft/factions/entity/FactionColl.java
@@ -41,9 +41,9 @@ public class FactionColl extends Coll {
public void setActive(boolean active) {
super.setActive(active);
- if (!active) {
- return;
- }
+ if (!active) {
+ return;
+ }
this.createSpecialFactions();
@@ -63,9 +63,9 @@ public class FactionColl extends Coll {
public Faction getNone() {
String id = Factions.ID_NONE;
Faction faction = this.get(id);
- if (faction != null) {
- return faction;
- }
+ if (faction != null) {
+ return faction;
+ }
faction = this.create(id);
@@ -100,9 +100,9 @@ public class FactionColl extends Coll {
public Faction getSafezone() {
String id = Factions.ID_SAFEZONE;
Faction faction = this.get(id);
- if (faction != null) {
- return faction;
- }
+ if (faction != null) {
+ return faction;
+ }
faction = this.create(id);
@@ -135,9 +135,9 @@ public class FactionColl extends Coll {
public Faction getWarzone() {
String id = Factions.ID_WARZONE;
Faction faction = this.get(id);
- if (faction != null) {
- return faction;
- }
+ if (faction != null) {
+ return faction;
+ }
faction = this.create(id);
@@ -197,29 +197,29 @@ public class FactionColl extends Coll {
// Fill
for (Faction fac : FactionColl.get().getAll()) {
- if (fac.getFlag(flagPeaceful)) {
- continue;
- }
+ if (fac.getFlag(flagPeaceful)) {
+ continue;
+ }
Rel rel = fac.getRelationTo(faction);
List names = ret.get(rel);
- if (names == null) {
- continue;
- }
+ if (names == null) {
+ continue;
+ }
String name = fac.describeTo(faction, true);
names.add(name);
}
// Replace TRUCE if peaceful
- if (!peaceful) {
- return ret;
- }
+ if (!peaceful) {
+ return ret;
+ }
List names = ret.get(Rel.TRUCE);
- if (names == null) {
- return ret;
- }
+ if (names == null) {
+ return ret;
+ }
ret.put(Rel.TRUCE, Collections.singletonList(MConf.get().colorTruce.toString() + Txt.parse("*EVERYONE*")));
diff --git a/src/main/java/com/massivecraft/factions/entity/MConfColl.java b/src/main/java/com/massivecraft/factions/entity/MConfColl.java
index c44a5cd2..c174416d 100644
--- a/src/main/java/com/massivecraft/factions/entity/MConfColl.java
+++ b/src/main/java/com/massivecraft/factions/entity/MConfColl.java
@@ -30,9 +30,9 @@ public class MConfColl extends Coll {
@Override
public void setActive(boolean active) {
super.setActive(active);
- if (!active) {
- return;
- }
+ if (!active) {
+ return;
+ }
MConf.i = this.get(MassiveCore.INSTANCE, true);
}
diff --git a/src/main/java/com/massivecraft/factions/entity/MFlag.java b/src/main/java/com/massivecraft/factions/entity/MFlag.java
index b22fc11c..278e625b 100644
--- a/src/main/java/com/massivecraft/factions/entity/MFlag.java
+++ b/src/main/java/com/massivecraft/factions/entity/MFlag.java
@@ -363,12 +363,12 @@ public class MFlag extends Entity implements Prioritized, Registerable, N
// -------------------------------------------- //
public boolean isInteresting(boolean value) {
- if (!this.isVisible()) {
- return false;
- }
- if (this.isEditable()) {
- return true;
- }
+ if (!this.isVisible()) {
+ return false;
+ }
+ if (this.isEditable()) {
+ return true;
+ }
return this.isStandard() != value;
}
@@ -377,15 +377,15 @@ public class MFlag extends Entity implements Prioritized, Registerable, N
List ret = new MassiveList<>();
// Fill
- if (withValue) {
- ret.add(getStateValue(value, monospaceValue));
- }
- if (withName) {
- ret.add(this.getStateName());
- }
- if (withDesc) {
- ret.add(this.getStateDescription(value, specificDesc));
- }
+ if (withValue) {
+ ret.add(getStateValue(value, monospaceValue));
+ }
+ if (withName) {
+ ret.add(this.getStateName());
+ }
+ if (withDesc) {
+ ret.add(this.getStateDescription(value, specificDesc));
+ }
// Return
return Txt.implode(ret, " ");
@@ -404,12 +404,12 @@ public class MFlag extends Entity implements Prioritized, Registerable, N
private ChatColor getStateColor() {
// Is special?
- if (!this.isVisible()) {
- return ChatColor.GRAY;
- }
- if (this.isEditable()) {
- return ChatColor.LIGHT_PURPLE;
- }
+ if (!this.isVisible()) {
+ return ChatColor.GRAY;
+ }
+ if (this.isEditable()) {
+ return ChatColor.LIGHT_PURPLE;
+ }
// Return normal
return ChatColor.AQUA;
@@ -420,9 +420,9 @@ public class MFlag extends Entity implements Prioritized, Registerable, N
String desc = this.getDesc();
// Is specific?
- if (specific) {
- desc = value ? this.getDescYes() : this.getDescNo();
- }
+ if (specific) {
+ desc = value ? this.getDescYes() : this.getDescNo();
+ }
// Return
return Txt.parse("%s", desc);
diff --git a/src/main/java/com/massivecraft/factions/entity/MFlagColl.java b/src/main/java/com/massivecraft/factions/entity/MFlagColl.java
index 9b5bb712..9cb8b3ed 100644
--- a/src/main/java/com/massivecraft/factions/entity/MFlagColl.java
+++ b/src/main/java/com/massivecraft/factions/entity/MFlagColl.java
@@ -36,9 +36,9 @@ public class MFlagColl extends Coll {
@Override
public void setActive(boolean active) {
super.setActive(active);
- if (!active) {
- return;
- }
+ if (!active) {
+ return;
+ }
MFlag.setupStandardFlags();
}
@@ -52,9 +52,9 @@ public class MFlagColl extends Coll {
// Fill
for (MFlag mflag : this.getAll()) {
- if (mflag.isRegistered() != registered) {
- continue;
- }
+ if (mflag.isRegistered() != registered) {
+ continue;
+ }
ret.add(mflag);
}
diff --git a/src/main/java/com/massivecraft/factions/entity/MPerm.java b/src/main/java/com/massivecraft/factions/entity/MPerm.java
index 29243515..aa1f5d67 100644
--- a/src/main/java/com/massivecraft/factions/entity/MPerm.java
+++ b/src/main/java/com/massivecraft/factions/entity/MPerm.java
@@ -438,12 +438,12 @@ public class MPerm extends Entity implements Prioritized, Registerable, N
public String createDeniedMessage(MPlayer mplayer, Faction hostFaction) {
// Null Check
- if (mplayer == null) {
- throw new NullPointerException("mplayer");
- }
- if (hostFaction == null) {
- throw new NullPointerException("hostFaction");
- }
+ if (mplayer == null) {
+ throw new NullPointerException("mplayer");
+ }
+ if (hostFaction == null) {
+ throw new NullPointerException("hostFaction");
+ }
String ret = Txt.parse("%s does not allow you to %s.", hostFaction.describeTo(mplayer, true), this.getDesc());
@@ -484,54 +484,54 @@ public class MPerm extends Entity implements Prioritized, Registerable, N
public boolean has(Faction faction, Faction hostFaction) {
// Null Check
- if (faction == null) {
- throw new NullPointerException("faction");
- }
- if (hostFaction == null) {
- throw new NullPointerException("hostFaction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
+ if (hostFaction == null) {
+ throw new NullPointerException("hostFaction");
+ }
return hostFaction.isFactionPermitted(faction, this);
}
public boolean has(MPlayer mplayer, Faction hostFaction, boolean verboose) {
// Null Check
- if (mplayer == null) {
- throw new NullPointerException("mplayer");
- }
- if (hostFaction == null) {
- throw new NullPointerException("hostFaction");
- }
+ if (mplayer == null) {
+ throw new NullPointerException("mplayer");
+ }
+ if (hostFaction == null) {
+ throw new NullPointerException("hostFaction");
+ }
- if (mplayer.isOverriding()) {
- return true;
- }
+ if (mplayer.isOverriding()) {
+ return true;
+ }
Rel rel = mplayer.getRelationTo(hostFaction);
MPermable permable = rel == Rel.FACTION ? mplayer.getRank() : rel;
- if (hostFaction.isPlayerPermitted(mplayer, this)) {
- return true;
- }
+ if (hostFaction.isPlayerPermitted(mplayer, this)) {
+ return true;
+ }
- if (verboose) {
- mplayer.message(this.createDeniedMessage(mplayer, hostFaction));
- }
+ if (verboose) {
+ mplayer.message(this.createDeniedMessage(mplayer, hostFaction));
+ }
return false;
}
public boolean has(MPlayer mplayer, PS ps, boolean verboose) {
// Null Check
- if (mplayer == null) {
- throw new NullPointerException("mplayer");
- }
- if (ps == null) {
- throw new NullPointerException("ps");
- }
+ if (mplayer == null) {
+ throw new NullPointerException("mplayer");
+ }
+ if (ps == null) {
+ throw new NullPointerException("ps");
+ }
- if (mplayer.isOverriding()) {
- return true;
- }
+ if (mplayer.isOverriding()) {
+ return true;
+ }
TerritoryAccess ta = BoardColl.get().getTerritoryAccessAt(ps);
Faction hostFaction = ta.getHostFaction();
@@ -555,9 +555,9 @@ public class MPerm extends Entity implements Prioritized, Registerable, N
// -------------------------------------------- //
public static List getPermables(Faction faction) {
- if (faction == null) {
- throw new NullPointerException("faction");
- }
+ if (faction == null) {
+ throw new NullPointerException("faction");
+ }
List list = new MassiveList<>();
@@ -597,40 +597,40 @@ public class MPerm extends Entity implements Prioritized, Registerable, N
public static Optional idToMPermableOptional(String id) {
MPlayer mplayer = MPlayerColl.get().get(id, false);
- if (mplayer != null) {
- return Optional.of(mplayer);
- }
+ if (mplayer != null) {
+ return Optional.of(mplayer);
+ }
// Workaround for registered senders
// Players ussually have a power, which makes sure they are in the coll
- if (IdUtil.getRegistryIdToSender().containsKey(id)) {
- return Optional.of(MPlayerColl.get().get(id, true));
- }
+ if (IdUtil.getRegistryIdToSender().containsKey(id)) {
+ return Optional.of(MPlayerColl.get().get(id, true));
+ }
Faction faction = Faction.get(id);
- if (faction != null) {
- return Optional.of(faction);
- }
+ if (faction != null) {
+ return Optional.of(faction);
+ }
for (Faction f : FactionColl.get().getAll()) {
Rank rank = f.getRank(id);
- if (rank != null) {
- return Optional.of(rank);
- }
+ if (rank != null) {
+ return Optional.of(rank);
+ }
}
- if (Rel.ALLY.name().equalsIgnoreCase(id)) {
- return Optional.of(Rel.ALLY);
- }
- if (Rel.TRUCE.name().equalsIgnoreCase(id)) {
- return Optional.of(Rel.TRUCE);
- }
- if (Rel.NEUTRAL.name().equalsIgnoreCase(id)) {
- return Optional.of(Rel.NEUTRAL);
- }
- if (Rel.ENEMY.name().equalsIgnoreCase(id)) {
- return Optional.of(Rel.ENEMY);
- }
+ if (Rel.ALLY.name().equalsIgnoreCase(id)) {
+ return Optional.of(Rel.ALLY);
+ }
+ if (Rel.TRUCE.name().equalsIgnoreCase(id)) {
+ return Optional.of(Rel.TRUCE);
+ }
+ if (Rel.NEUTRAL.name().equalsIgnoreCase(id)) {
+ return Optional.of(Rel.NEUTRAL);
+ }
+ if (Rel.ENEMY.name().equalsIgnoreCase(id)) {
+ return Optional.of(Rel.ENEMY);
+ }
return Optional.empty();
}
diff --git a/src/main/java/com/massivecraft/factions/entity/MPermColl.java b/src/main/java/com/massivecraft/factions/entity/MPermColl.java
index f6be6ab3..51d609c2 100644
--- a/src/main/java/com/massivecraft/factions/entity/MPermColl.java
+++ b/src/main/java/com/massivecraft/factions/entity/MPermColl.java
@@ -39,9 +39,9 @@ public class MPermColl extends Coll {
@Override
public void setActive(boolean active) {
super.setActive(active);
- if (!active) {
- return;
- }
+ if (!active) {
+ return;
+ }
MPerm.setupStandardPerms();
}
@@ -88,9 +88,9 @@ public class MPermColl extends Coll {
// Fill
for (MPerm mperm : this.getAll()) {
- if (mperm.isRegistered() != registered) {
- continue;
- }
+ if (mperm.isRegistered() != registered) {
+ continue;
+ }
ret.add(mperm);
}
diff --git a/src/main/java/com/massivecraft/factions/entity/MPlayer.java b/src/main/java/com/massivecraft/factions/entity/MPlayer.java
index a72fd0f1..d8321fc1 100644
--- a/src/main/java/com/massivecraft/factions/entity/MPlayer.java
+++ b/src/main/java/com/massivecraft/factions/entity/MPlayer.java
@@ -80,24 +80,24 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
@Override
public boolean isDefault() {
// Last activity millis is data we use for clearing out cleanable players. So it does not in itself make the player data worth keeping.
- if (this.hasFaction()) {
- return false;
- }
+ if (this.hasFaction()) {
+ return false;
+ }
// Role means nothing without a faction.
// Title means nothing without a faction.
- if (this.hasPowerBoost()) {
- return false;
- }
- if (this.getPowerRounded() != (int) Math.round(MConf.get().defaultPlayerPower)) {
- return false;
- }
+ if (this.hasPowerBoost()) {
+ return false;
+ }
+ if (this.getPowerRounded() != (int) Math.round(MConf.get().defaultPlayerPower)) {
+ return false;
+ }
// if (this.isMapAutoUpdating()) return false; // Just having an auto updating map is not in itself reason enough for database storage.
- if (this.isOverriding()) {
- return false;
- }
- if (this.isTerritoryInfoTitles() != MConf.get().territoryInfoTitlesDefault) {
- return false;
- }
+ if (this.isOverriding()) {
+ return false;
+ }
+ if (this.isTerritoryInfoTitles() != MConf.get().territoryInfoTitlesDefault) {
+ return false;
+ }
return true;
}
@@ -194,16 +194,16 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
private transient WeakReference autoClaimFaction = new WeakReference<>(null);
public Faction getAutoClaimFaction() {
- if (this.isFactionOrphan()) {
- return null;
- }
+ if (this.isFactionOrphan()) {
+ return null;
+ }
Faction ret = this.autoClaimFaction.get();
- if (ret == null) {
- return null;
- }
- if (ret.detached()) {
- return null;
- }
+ if (ret == null) {
+ return null;
+ }
+ if (ret.detached()) {
+ return null;
+ }
return ret;
}
@@ -302,9 +302,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
String afterId = factionId;
// NoChange
- if (MUtil.equals(beforeId, afterId)) {
- return;
- }
+ if (MUtil.equals(beforeId, afterId)) {
+ return;
+ }
// Apply
this.factionId = afterId;
@@ -325,13 +325,13 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
// -------------------------------------------- //
public Rank getRank() {
- if (this.isFactionOrphan()) {
- return FactionColl.get().getNone().getLowestRank();
- }
+ if (this.isFactionOrphan()) {
+ return FactionColl.get().getNone().getLowestRank();
+ }
- if (this.rankId == null) {
- return this.getFaction().getLowestRank();
- }
+ if (this.rankId == null) {
+ return this.getFaction().getLowestRank();
+ }
return this.getFaction().getRank(this.rankId);
}
@@ -340,9 +340,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
String rankId = rank == null ? null : rank.getId();
// Detect Nochange
- if (MUtil.equals(this.rankId, rankId)) {
- return;
- }
+ if (MUtil.equals(this.rankId, rankId)) {
+ return;
+ }
// Apply
this.rankId = rankId;
@@ -362,13 +362,13 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
}
public String getTitle() {
- if (this.isFactionOrphan()) {
- return NOTITLE;
- }
+ if (this.isFactionOrphan()) {
+ return NOTITLE;
+ }
- if (this.hasTitle()) {
- return this.title;
- }
+ if (this.hasTitle()) {
+ return this.title;
+ }
return NOTITLE;
}
@@ -378,9 +378,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
String target = Faction.clean(title);
// Detect Nochange
- if (MUtil.equals(this.title, target)) {
- return;
- }
+ if (MUtil.equals(this.title, target)) {
+ return;
+ }
// Apply
this.title = target;
@@ -396,9 +396,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
@Override
public double getPowerBoost() {
Double ret = this.powerBoost;
- if (ret == null) {
- ret = 0D;
- }
+ if (ret == null) {
+ ret = 0D;
+ }
return ret;
}
@@ -406,14 +406,14 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
public void setPowerBoost(Double powerBoost) {
// Clean input
Double target = powerBoost;
- if (target == null || target == 0) {
- target = null;
- }
+ if (target == null || target == 0) {
+ target = null;
+ }
// Detect Nochange
- if (MUtil.equals(this.powerBoost, target)) {
- return;
- }
+ if (MUtil.equals(this.powerBoost, target)) {
+ return;
+ }
// Apply
this.powerBoost = target;
@@ -482,9 +482,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
public double getPower() {
Double ret = this.power;
- if (ret == null) {
- ret = MConf.get().defaultPlayerPower;
- }
+ if (ret == null) {
+ ret = MConf.get().defaultPlayerPower;
+ }
ret = this.getLimitedPower(ret);
return ret;
}
@@ -494,9 +494,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
Double target = power;
// Detect Nochange
- if (MUtil.equals(this.power, target)) {
- return;
- }
+ if (MUtil.equals(this.power, target)) {
+ return;
+ }
// Apply
this.power = target;
@@ -516,26 +516,26 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
// -------------------------------------------- //
public boolean isMapAutoUpdating() {
- if (this.mapAutoUpdating == null) {
- return false;
- }
- if (this.mapAutoUpdating == false) {
- return false;
- }
+ if (this.mapAutoUpdating == null) {
+ return false;
+ }
+ if (this.mapAutoUpdating == false) {
+ return false;
+ }
return true;
}
public void setMapAutoUpdating(Boolean mapAutoUpdating) {
// Clean input
Boolean target = mapAutoUpdating;
- if (MUtil.equals(target, false)) {
- target = null;
- }
+ if (MUtil.equals(target, false)) {
+ target = null;
+ }
// Detect Nochange
- if (MUtil.equals(this.mapAutoUpdating, target)) {
- return;
- }
+ if (MUtil.equals(this.mapAutoUpdating, target)) {
+ return;
+ }
// Apply
this.mapAutoUpdating = target;
@@ -549,12 +549,12 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
// -------------------------------------------- //
public boolean isOverriding() {
- if (this.overriding == null) {
- return false;
- }
- if (this.overriding == false) {
- return false;
- }
+ if (this.overriding == null) {
+ return false;
+ }
+ if (this.overriding == false) {
+ return false;
+ }
if (!this.hasPermission(Perm.OVERRIDE, true)) {
this.setOverriding(false);
@@ -567,14 +567,14 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
public void setOverriding(Boolean overriding) {
// Clean input
Boolean target = overriding;
- if (MUtil.equals(target, false)) {
- target = null;
- }
+ if (MUtil.equals(target, false)) {
+ target = null;
+ }
// Detect Nochange
- if (MUtil.equals(this.overriding, target)) {
- return;
- }
+ if (MUtil.equals(this.overriding, target)) {
+ return;
+ }
// Apply
this.overriding = target;
@@ -588,26 +588,26 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
// -------------------------------------------- //
public boolean isTerritoryInfoTitles() {
- if (!MixinTitle.get().isAvailable()) {
- return false;
- }
- if (this.territoryInfoTitles == null) {
- return MConf.get().territoryInfoTitlesDefault;
- }
+ if (!MixinTitle.get().isAvailable()) {
+ return false;
+ }
+ if (this.territoryInfoTitles == null) {
+ return MConf.get().territoryInfoTitlesDefault;
+ }
return this.territoryInfoTitles;
}
public void setTerritoryInfoTitles(Boolean territoryInfoTitles) {
// Clean input
Boolean target = territoryInfoTitles;
- if (MUtil.equals(target, MConf.get().territoryInfoTitlesDefault)) {
- target = null;
- }
+ if (MUtil.equals(target, MConf.get().territoryInfoTitlesDefault)) {
+ target = null;
+ }
// Detect Nochange
- if (MUtil.equals(this.territoryInfoTitles, target)) {
- return;
- }
+ if (MUtil.equals(this.territoryInfoTitles, target)) {
+ return;
+ }
// Apply
this.territoryInfoTitles = target;
@@ -634,9 +634,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
public String getFactionName() {
Faction faction = this.getFaction();
- if (faction.isNone()) {
- return "";
- }
+ if (faction.isNone()) {
+ return "";
+ }
return faction.getName();
}
@@ -725,17 +725,17 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
public boolean isInOwnTerritory() {
PS ps = MixinSenderPs.get().getSenderPs(this.getId());
- if (ps == null) {
- return false;
- }
+ if (ps == null) {
+ return false;
+ }
return BoardColl.get().getFactionAt(ps) == this.getFaction();
}
public boolean isInEnemyTerritory() {
PS ps = MixinSenderPs.get().getSenderPs(this.getId());
- if (ps == null) {
- return false;
- }
+ if (ps == null) {
+ return false;
+ }
return BoardColl.get().getFactionAt(ps).getRelationTo(this) == Rel.ENEMY;
}
@@ -763,9 +763,9 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
// Event
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(this.getSender(), this, myFaction, MembershipChangeReason.LEAVE);
membershipChangeEvent.run();
- if (membershipChangeEvent.isCancelled()) {
- return;
- }
+ if (membershipChangeEvent.isCancelled()) {
+ return;
+ }
if (myFaction.isNormal()) {
for (MPlayer mplayer : myFaction.getMPlayersWhereOnline(true)) {
@@ -800,20 +800,20 @@ public class MPlayer extends SenderEntity implements FactionsParticipat
public boolean tryClaim(Faction newFaction, Collection pss, String formatOne, String formatMany) {
// Args
- if (formatOne == null) {
- formatOne = "%s %s %d chunk %s.";
- }
- if (formatMany == null) {
- formatMany = "%s %s %d chunks near %s.";
- }
+ if (formatOne == null) {
+ formatOne = "%s %s %d