From 1609a7cfeafcc5512dfdbf098a6115a6d02e91b8 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 26 Apr 2013 14:01:28 +0200 Subject: [PATCH] Renaming show --> faction and power --> player --- plugin.yml | 21 ++++++++----------- src/com/massivecraft/factions/Perm.java | 8 +++---- .../factions/cmd/CmdFactions.java | 8 +++---- ...tionsShow.java => CmdFactionsFaction.java} | 8 +++---- .../factions/cmd/CmdFactionsPerm.java | 6 ++++++ ...tionsPower.java => CmdFactionsPlayer.java} | 11 +++++----- .../massivecraft/factions/entity/Faction.java | 1 + 7 files changed, 32 insertions(+), 31 deletions(-) rename src/com/massivecraft/factions/cmd/{CmdFactionsShow.java => CmdFactionsFaction.java} (96%) rename src/com/massivecraft/factions/cmd/{CmdFactionsPower.java => CmdFactionsPlayer.java} (75%) diff --git a/plugin.yml b/plugin.yml index 5c9ce313..8828e93a 100644 --- a/plugin.yml +++ b/plugin.yml @@ -13,7 +13,7 @@ permissions: factions.access: {description: grant territory access, with the proper fperm, default: false} factions.access.any: {description: grant territory access for another faction, default: false} factions.access.view: {description: view territory access, default: false} - factions.adminmode: {description: enable adminmode, default: false} + factions.admin: {description: enable adminmode, default: false} factions.autoclaim: {description: autoclaim when walking, default: false} factions.claim: {description: claim land where you stand, default: false} factions.claim.radius: {description: claim land with radius, default: false} @@ -21,6 +21,7 @@ permissions: factions.demote: {description: demote lesser members in your faction, default: false} factions.description: {description: change faction description, default: false} factions.disband: {description: disband faction, default: false} + factions.faction: {description: show faction information, default: false} factions.flag: {description: read faction flags, default: false} factions.flag.set: {description: set faction flags, default: false} factions.home: {description: teleport to faction home, default: false} @@ -45,14 +46,12 @@ permissions: factions.officer.any: {description: set officers for another faction, default: false} factions.open: {description: set if invitation is required to join, default: false} factions.perm: {description: change faction permissions, default: false} - factions.power: {description: show player power} - factions.power.any: {description: show another players power} + factions.player: {description: show player information} factions.powerboost: {description: set powerboost, default: false} factions.promote: {description: promote lesser members in your faction, default: false} factions.relation: {description: set relation wish to another faction, default: false} factions.seechunk: {description: see the chunk you stand in, default: false} factions.sethome: {description: set the faction home, default: false} - factions.show: {description: show faction information, default: false} factions.name: {description: set faction name, default: false} factions.title: {description: set player title, default: false} factions.title.color: {description: set player title with color, default: false} @@ -67,7 +66,7 @@ permissions: factions.access: true factions.access.any: true factions.access.view: true - factions.adminmode: true + factions.admin: true factions.autoclaim: true factions.claim: true factions.claim.radius: true @@ -75,6 +74,7 @@ permissions: factions.demote: true factions.description: true factions.disband: true + factions.faction: true factions.flag: true factions.flag.set: true factions.home: true @@ -93,14 +93,12 @@ permissions: factions.officer.any: true factions.open: true factions.perm: true - factions.power: true - factions.power.any: true + factions.player: true factions.powerboost: true factions.promote: true factions.relation: true factions.seechunk: true factions.sethome: true - factions.show: true factions.name: true factions.title: true factions.title.color: true @@ -142,7 +140,7 @@ permissions: default: false children: factions.kit.rank0: true - factions.adminmode: true + factions.admin: true factions.kit.rank0: default: false children: @@ -155,6 +153,7 @@ permissions: factions.demote: true factions.description: true factions.disband: true + factions.faction: true factions.flag: true factions.home: true factions.invite: true @@ -168,13 +167,11 @@ permissions: factions.officer: true factions.open: true factions.perm: true - factions.power: true - factions.power.any: true + factions.player: true factions.promote: true factions.relation: true factions.seechunk: true factions.sethome: true - factions.show: true factions.name: true factions.title: true factions.title.color: true diff --git a/src/com/massivecraft/factions/Perm.java b/src/com/massivecraft/factions/Perm.java index 240c50b3..5a8e2d63 100644 --- a/src/com/massivecraft/factions/Perm.java +++ b/src/com/massivecraft/factions/Perm.java @@ -13,7 +13,7 @@ public enum Perm ACCESS("access"), ACCESS_ANY("access.any"), ACCESS_VIEW("access.view"), - ADMIN("adminmode"), + ADMIN("admin"), AUTOCLAIM("autoclaim"), CLAIM("claim"), CLAIM_RADIUS("claim.radius"), @@ -21,6 +21,7 @@ public enum Perm DEMOTE("demote"), DESCRIPTION("description"), DISBAND("disband"), + FACTION("faction"), FLAG("flag"), FLAG_SET("flag.set"), HOME("home"), @@ -45,15 +46,12 @@ public enum Perm OFFICER_ANY("officer.any"), OPEN("open"), PERM("perm"), - POWER("power"), - POWER_ANY("power.any"), + PLAYER("player"), POWERBOOST("powerboost"), PROMOTE("promote"), RELATION("relation"), - SAVE("save"), SEE_CHUNK("seechunk"), SETHOME("sethome"), - SHOW("show"), NAME("name"), TITLE("title"), TITLE_COLOR("title.color"), diff --git a/src/com/massivecraft/factions/cmd/CmdFactions.java b/src/com/massivecraft/factions/cmd/CmdFactions.java index 4d99a7d9..622e1bdb 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactions.java +++ b/src/com/massivecraft/factions/cmd/CmdFactions.java @@ -19,6 +19,7 @@ public class CmdFactions extends FCommand public CmdFactionsDemote cmdFactionsDemote = new CmdFactionsDemote(); public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription(); public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband(); + public CmdFactionsFaction cmdFactionsFaction = new CmdFactionsFaction(); public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag(); public CmdFactionsHome cmdFactionsHome = new CmdFactionsHome(); public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite(); @@ -31,7 +32,7 @@ public class CmdFactions extends FCommand public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney(); public CmdFactionsOpen cmdFactionsOpen = new CmdFactionsOpen(); public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm(); - public CmdFactionsPower cmdFactionsPower = new CmdFactionsPower(); + public CmdFactionsPlayer cmdFactionsPlayer = new CmdFactionsPlayer(); public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost(); public CmdFactionsPromote cmdFactionsPromote = new CmdFactionsPromote(); public CmdFactionsRelationAlly cmdFactionsRelationAlly = new CmdFactionsRelationAlly(); @@ -40,7 +41,6 @@ public class CmdFactions extends FCommand public CmdFactionsRelationTruce cmdFactionsRelationTruce = new CmdFactionsRelationTruce(); public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk(); public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome(); - public CmdFactionsShow cmdFactionsShow = new CmdFactionsShow(); public CmdFactionsName cmdFactionsName = new CmdFactionsName(); public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle(); public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim(); @@ -61,8 +61,8 @@ public class CmdFactions extends FCommand this.addSubCommand(HelpCommand.get()); this.addSubCommand(this.cmdFactionsList); - this.addSubCommand(this.cmdFactionsShow); - this.addSubCommand(this.cmdFactionsPower); + this.addSubCommand(this.cmdFactionsFaction); + this.addSubCommand(this.cmdFactionsPlayer); this.addSubCommand(this.cmdFactionsJoin); this.addSubCommand(this.cmdFactionsLeave); this.addSubCommand(this.cmdFactionsHome); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java similarity index 96% rename from src/com/massivecraft/factions/cmd/CmdFactionsShow.java rename to src/com/massivecraft/factions/cmd/CmdFactionsFaction.java index 8c7cce3e..2d79c14d 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java @@ -24,16 +24,16 @@ import com.massivecraft.mcore.util.TimeDiffUtil; import com.massivecraft.mcore.util.TimeUnit; import com.massivecraft.mcore.util.Txt; -public class CmdFactionsShow extends FCommand +public class CmdFactionsFaction extends FCommand { - public CmdFactionsShow() + public CmdFactionsFaction() { - this.addAliases("s", "show", "who"); + this.addAliases("f", "faction"); this.addOptionalArg("faction", "you"); this.addRequirements(ReqFactionsEnabled.get()); - this.addRequirements(ReqHasPerm.get(Perm.SHOW.node)); + this.addRequirements(ReqHasPerm.get(Perm.FACTION.node)); } @Override diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java index a6179ffe..939dd068 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPerm.java @@ -62,6 +62,12 @@ public class CmdFactionsPerm extends FCommand Rel rel = this.arg(2, ARRel.get()); if (rel == null) return; + if (!this.argIsSet(3)) + { + msg("Should %s have the %s permission or not?\nYou must add \"yes\" or \"no\" at the end.", Txt.getNicedEnum(rel), Txt.getNicedEnum(perm)); + return; + } + Boolean val = this.arg(3, ARBoolean.get(), null); if (val == null) return; diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsPower.java b/src/com/massivecraft/factions/cmd/CmdFactionsPlayer.java similarity index 75% rename from src/com/massivecraft/factions/cmd/CmdFactionsPower.java rename to src/com/massivecraft/factions/cmd/CmdFactionsPlayer.java index 2f67d31b..ec1f99e4 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsPower.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsPlayer.java @@ -6,16 +6,16 @@ import com.massivecraft.factions.cmd.req.ReqFactionsEnabled; import com.massivecraft.factions.entity.UPlayer; import com.massivecraft.mcore.cmd.req.ReqHasPerm; -public class CmdFactionsPower extends FCommand +public class CmdFactionsPlayer extends FCommand { - public CmdFactionsPower() + public CmdFactionsPlayer() { - this.addAliases("power", "pow"); + this.addAliases("p", "player"); this.addOptionalArg("player", "you"); this.addRequirements(ReqFactionsEnabled.get()); - this.addRequirements(ReqHasPerm.get(Perm.POWER.node)); + this.addRequirements(ReqHasPerm.get(Perm.PLAYER.node)); } @Override @@ -25,8 +25,7 @@ public class CmdFactionsPower extends FCommand UPlayer target = this.arg(0, ARUPlayer.getStartAny(sender), usender); if (target == null) return; - // Perm - if (target != usender && ! Perm.POWER_ANY.has(sender, true)) return; + // TODO: Print info double powerBoost = target.getPowerBoost(); String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index 7180d1e3..512140a0 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -643,6 +643,7 @@ public class Faction extends Entity implements EconomyParticipator { Entry> entry = iter.next(); FPerm key = entry.getKey(); + if (key == null) System.out.println("key was null"); Set keyDefault = key.getDefault(this); Set value = entry.getValue();