Check System Added and Massive Reformat

This commit is contained in:
Driftay
2019-08-24 13:18:50 -04:00
parent 84f4e0f732
commit 72f76aeb71
199 changed files with 15584 additions and 15463 deletions

View File

@@ -4,8 +4,8 @@ import com.massivecraft.factions.struct.Relation;
public class CmdRelationAlly extends FRelationCommand {
public CmdRelationAlly() {
aliases.add("ally");
targetRelation = Relation.ALLY;
}
public CmdRelationAlly() {
aliases.add("ally");
targetRelation = Relation.ALLY;
}
}

View File

@@ -4,8 +4,8 @@ import com.massivecraft.factions.struct.Relation;
public class CmdRelationEnemy extends FRelationCommand {
public CmdRelationEnemy() {
aliases.add("enemy");
targetRelation = Relation.ENEMY;
}
public CmdRelationEnemy() {
aliases.add("enemy");
targetRelation = Relation.ENEMY;
}
}

View File

@@ -4,8 +4,8 @@ import com.massivecraft.factions.struct.Relation;
public class CmdRelationNeutral extends FRelationCommand {
public CmdRelationNeutral() {
aliases.add("neutral");
targetRelation = Relation.NEUTRAL;
}
public CmdRelationNeutral() {
aliases.add("neutral");
targetRelation = Relation.NEUTRAL;
}
}

View File

@@ -4,8 +4,8 @@ import com.massivecraft.factions.struct.Relation;
public class CmdRelationTruce extends FRelationCommand {
public CmdRelationTruce() {
aliases.add("truce");
targetRelation = Relation.TRUCE;
}
public CmdRelationTruce() {
aliases.add("truce");
targetRelation = Relation.TRUCE;
}
}

View File

@@ -15,113 +15,113 @@ import org.bukkit.ChatColor;
public abstract class FRelationCommand extends FCommand {
public Relation targetRelation;
public Relation targetRelation;
public FRelationCommand() {
super();
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("player name", "you");
public FRelationCommand() {
super();
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("player name", "you");
this.permission = Permission.RELATION.node;
this.disableOnLock = true;
this.permission = Permission.RELATION.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction them = this.argAsFaction(0);
if (them == null) {
return;
}
@Override
public void perform() {
Faction them = this.argAsFaction(0);
if (them == null) {
return;
}
if (!them.isNormal()) {
msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
return;
}
if (!them.isNormal()) {
msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
return;
}
if (them == myFaction) {
msg(TL.COMMAND_RELATIONS_MORENOPE);
return;
}
if (them == myFaction) {
msg(TL.COMMAND_RELATIONS_MORENOPE);
return;
}
if (myFaction.getRelationWish(them) == targetRelation) {
msg(TL.COMMAND_RELATIONS_ALREADYINRELATIONSHIP, them.getTag());
return;
}
if (myFaction.getRelationWish(them) == targetRelation) {
msg(TL.COMMAND_RELATIONS_ALREADYINRELATIONSHIP, them.getTag());
return;
}
if (hasMaxRelations(them, targetRelation)) {
// We message them down there with the count.
return;
}
Relation oldRelation = myFaction.getRelationTo(them, true);
FactionRelationWishEvent wishEvent = new FactionRelationWishEvent(fme, myFaction, them, oldRelation, targetRelation);
Bukkit.getPluginManager().callEvent(wishEvent);
if (wishEvent.isCancelled()) {
return;
}
if (hasMaxRelations(them, targetRelation)) {
// We message them down there with the count.
return;
}
Relation oldRelation = myFaction.getRelationTo(them, true);
FactionRelationWishEvent wishEvent = new FactionRelationWishEvent(fme, myFaction, them, oldRelation, targetRelation);
Bukkit.getPluginManager().callEvent(wishEvent);
if (wishEvent.isCancelled()) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(targetRelation.getRelationCost(), TL.COMMAND_RELATIONS_TOMARRY, TL.COMMAND_RELATIONS_FORMARRY)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(targetRelation.getRelationCost(), TL.COMMAND_RELATIONS_TOMARRY, TL.COMMAND_RELATIONS_FORMARRY)) {
return;
}
// try to set the new relation
myFaction.setRelationWish(them, targetRelation);
Relation currentRelation = myFaction.getRelationTo(them, true);
ChatColor currentRelationColor = currentRelation.getColor();
// try to set the new relation
myFaction.setRelationWish(them, targetRelation);
Relation currentRelation = myFaction.getRelationTo(them, true);
ChatColor currentRelationColor = currentRelation.getColor();
// if the relation change was successful
if (targetRelation.value == currentRelation.value) {
// trigger the faction relation event
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
Bukkit.getServer().getPluginManager().callEvent(relationEvent);
// if the relation change was successful
if (targetRelation.value == currentRelation.value) {
// trigger the faction relation event
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
Bukkit.getServer().getPluginManager().callEvent(relationEvent);
them.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + myFaction.getTag());
myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + them.getTag());
} else {
// inform the other faction of your request
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_1, currentRelationColor + myFaction.getTag(), targetRelation.getColor() + targetRelation.getTranslation());
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_2, Conf.baseCommandAliases.get(0), targetRelation, myFaction.getTag());
myFaction.msg(TL.COMMAND_RELATIONS_PROPOSAL_SENT, currentRelationColor + them.getTag(), "" + targetRelation.getColor() + targetRelation);
}
them.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + myFaction.getTag());
myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + them.getTag());
} else {
// inform the other faction of your request
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_1, currentRelationColor + myFaction.getTag(), targetRelation.getColor() + targetRelation.getTranslation());
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_2, Conf.baseCommandAliases.get(0), targetRelation, myFaction.getTag());
myFaction.msg(TL.COMMAND_RELATIONS_PROPOSAL_SENT, currentRelationColor + them.getTag(), "" + targetRelation.getColor() + targetRelation);
}
if (!targetRelation.isNeutral() && them.isPeaceful()) {
them.msg(TL.COMMAND_RELATIONS_PEACEFUL);
myFaction.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
}
if (!targetRelation.isNeutral() && them.isPeaceful()) {
them.msg(TL.COMMAND_RELATIONS_PEACEFUL);
myFaction.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
}
if (!targetRelation.isNeutral() && myFaction.isPeaceful()) {
them.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
myFaction.msg(TL.COMMAND_RELATIONS_PEACEFUL);
}
if (!targetRelation.isNeutral() && myFaction.isPeaceful()) {
them.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
myFaction.msg(TL.COMMAND_RELATIONS_PEACEFUL);
}
FTeamWrapper.updatePrefixes(myFaction);
FTeamWrapper.updatePrefixes(them);
}
FTeamWrapper.updatePrefixes(myFaction);
FTeamWrapper.updatePrefixes(them);
}
private boolean hasMaxRelations(Faction them, Relation targetRelation) {
int max = P.p.getConfig().getInt("max-relations." + targetRelation.toString(), -1);
if (P.p.getConfig().getBoolean("max-relations.enabled", false)) {
if (max != -1) {
if (myFaction.getRelationCount(targetRelation) >= max) {
msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation());
return true;
}
if (them.getRelationCount(targetRelation) >= max) {
msg(TL.COMMAND_RELATIONS_EXCEEDS_THEY, max, targetRelation.getPluralTranslation());
return true;
}
}
}
return false;
}
private boolean hasMaxRelations(Faction them, Relation targetRelation) {
int max = P.p.getConfig().getInt("max-relations." + targetRelation.toString(), -1);
if (P.p.getConfig().getBoolean("max-relations.enabled", false)) {
if (max != -1) {
if (myFaction.getRelationCount(targetRelation) >= max) {
msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation());
return true;
}
if (them.getRelationCount(targetRelation) >= max) {
msg(TL.COMMAND_RELATIONS_EXCEEDS_THEY, max, targetRelation.getPluralTranslation());
return true;
}
}
}
return false;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RELATIONS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RELATIONS_DESCRIPTION;
}
}