Permission node cleanup and removal of the commented out deprecated API.

This commit is contained in:
Olof Larsson 2013-04-24 16:10:16 +02:00
parent da2cc0f052
commit 9b932cb1c6
5 changed files with 121 additions and 220 deletions

View File

@ -9,69 +9,97 @@ permissions:
# -------------------------------------------- # # -------------------------------------------- #
# THE REAL NODES # THE REAL NODES
# -------------------------------------------- # # -------------------------------------------- #
factions.access: {description: grant territory access for your faction, with the proper fperm} factions.access: {description: grant territory access, with the proper fperm, default: false}
factions.access.any: {description: grant territory access for any faction} factions.access.any: {description: grant territory access for another faction, default: false}
factions.access.view: {description: view territory access info for your faction} factions.access.view: {description: view territory access, default: false}
factions.adminmode: {description: enable admin bypass mode} factions.adminmode: {description: enable adminmode, default: false}
factions.autoclaim: {description: auto-claim land as you walk around} factions.autoclaim: {description: autoclaim when walking, default: false}
factions.cape: {description: manage faction capes} factions.claim: {description: claim land where you stand, default: false}
factions.cape.get: {description: get faction cape} factions.claim.radius: {description: claim land with radius, default: false}
factions.cape.set: {description: set faction cape} factions.create: {description: create new faction, default: false}
factions.cape.remove: {description: remove faction cape} factions.demote: {description: demote lesser members in your faction, default: false}
factions.claim: {description: claim land where you are standing} factions.description: {description: change faction description, default: false}
factions.claim.radius: {description: claim land in a large radius} factions.disband: {description: disband faction, default: false}
factions.config: {description: change a conf.json setting} factions.flag: {description: read faction flags, default: false}
factions.create: {description: create a new faction} factions.flag.set: {description: set faction flags, default: false}
factions.demote: {description: demote lesser members in your faction} factions.home: {description: teleport to faction home, default: false}
factions.description: {description: change the faction description} factions.invite: {description: set if player is invited, default: false}
factions.disband: {description: disband a faction} factions.join: {description: join faction, default: false}
factions.flag: {description: read faction flags} factions.join.any: {description: join closed faction, default: false}
factions.flag.set: {description: set faction flags} factions.join.others: {description: have another player join faction, default: false}
factions.help: {description: display a help page} factions.kick: {description: kick player from faction, default: false}
factions.home: {description: teleport to the faction home} factions.leader: {description: set leader for faction, default: false}
factions.invite: {description: set if a player is invited} factions.leader.any: {description: set leader for another faction, default: false}
factions.join: {description: join a faction} factions.leave: {description: leave your faction, default: false}
factions.join.any: {description: join any faction, bypassing invitation process for closed factions} factions.list: {description: list all factions, default: false}
factions.join.others: {description: specify another player in the join command, to move them to the specified faction} factions.map: {description: show territory map, default: false}
factions.kick: {description: kick a player from the faction} factions.money.balance: {description: show faction money, default: false}
factions.leader: {description: hand over leader rights} factions.money.balance.any: {description: show another factions money, default: false}
factions.leader.any: {description: give or revoke leader status for any player in any faction} factions.money.deposit: {description: deposit to faction, default: false}
factions.leave: {description: leave your faction} factions.money.f2f: {description: transfer f --> f, default: false}
factions.list: {description: see a list of the factions} factions.money.f2p: {description: transfer f --> p, default: false}
factions.lock: {description: lock all write stuff} factions.money.p2f: {description: transfer p --> f, default: false}
factions.map: {description: show the territory map, and set optional auto update} factions.money.withdraw: {description: withdraw from faction, default: false}
factions.money.balance: {description: show money balance for a faction} factions.officer: {description: make player officer, default: false}
factions.money.balance.any: {description: show money balance for another faction} factions.officer.any: {description: set officers for another faction, default: false}
factions.money.deposit: {description: deposit money to faction bank} factions.open: {description: set if invitation is required to join, default: false}
factions.money.f2f: {description: transfer f --> f} factions.perm: {description: change faction permissions, default: false}
factions.money.f2p: {description: transfer f --> p} factions.powerboost: {description: set powerboost, default: false}
factions.money.p2f: {description: transfer p --> f} factions.promote: {description: promote lesser members in your faction, default: false}
factions.money.withdraw: {description: withdraw money from faction bank} factions.relation: {description: set relation wish to another faction, default: false}
factions.officer: {description: give or revoke officer rights} factions.seechunk: {description: see the chunk you stand in, default: false}
factions.officer.any: {description: give or revoke officer rights for any player in any faction} factions.sethome: {description: set the faction home, default: false}
factions.open: {description: switch if invitation is required to join} factions.show: {description: show faction information, default: false}
factions.perm: {description: change faction permissions} factions.tag: {description: set faction tag, default: false}
factions.powerboost: {description: apply permanent power bonus/penalty to specified player or faction} factions.title: {description: set player title, default: false}
factions.promote: {description: promote lesser members in your faction} factions.unclaim: {description: unclaim land where you stand, default: false}
factions.relation: {description: set relation wish to another faction} factions.unclaimall: {description: unclaim all land, default: false}
factions.reload: {description: reload data file(s) from disk} factions.version: {description: see plugin version, default: false}
factions.save: {description: save all data to disk}
factions.seechunk: {description: see the chunk you stand in}
factions.sethome: {description: set the faction home}
factions.show: {description: show faction information}
factions.tag: {description: change the faction tag}
factions.title: {description: set or remove a players title}
factions.unclaim: {description: unclaim the land where you are standing}
factions.unclaimall: {description: unclaim all of your factions land}
factions.version: {description: see the version of the plugin}
# -------------------------------------------- # # -------------------------------------------- #
# STAR NOTATION # STAR NOTATION
# -------------------------------------------- # # -------------------------------------------- #
factions.cape.*: factions.*:
children: children:
factions.cape.get: true factions.access: true
factions.cape.set: true factions.access.any: true
factions.cape.remove: true factions.access.view: true
factions.adminmode: true
factions.autoclaim: true
factions.claim: true
factions.claim.radius: true
factions.create: true
factions.demote: true
factions.description: true
factions.disband: true
factions.flag: true
factions.flag.set: true
factions.home: true
factions.invite: true
factions.join: true
factions.join.any: true
factions.join.others: true
factions.kick: true
factions.leader: true
factions.leader.any: true
factions.leave: true
factions.list: true
factions.map: true
factions.money.*: true
factions.officer: true
factions.officer.any: true
factions.open: true
factions.perm: true
factions.powerboost: true
factions.promote: true
factions.relation: true
factions.seechunk: true
factions.sethome: true
factions.show: true
factions.tag: true
factions.title: true
factions.unclaim: true
factions.unclaimall: true
factions.version: true
factions.money.*: factions.money.*:
children: children:
factions.money.balance: true factions.money.balance: true
@ -84,22 +112,18 @@ permissions:
# -------------------------------------------- # # -------------------------------------------- #
# KITS # KITS
# -------------------------------------------- # # -------------------------------------------- #
factions.kit.admin: factions.kit.op:
description: All faction permissions. default: op
children: children:
factions.kit.mod: true factions.*: true
factions.config: true factions.kit.rank3:
factions.lock: true default: false
factions.reload: true
factions.save: true
factions.*:
description: This is just an alias for factions.kit.admin
children: children:
factions.kit.admin: true factions.kit.rank2: true
factions.kit.mod: factions.kit.rank2:
description: All faction permissions but configuration and persistance. default: false
children: children:
factions.kit.halfmod: true factions.kit.rank1: true
factions.flag.set: true factions.flag.set: true
factions.powerboost: true factions.powerboost: true
factions.join.any: true factions.join.any: true
@ -107,31 +131,24 @@ permissions:
factions.leader.any: true factions.leader.any: true
factions.officer.any: true factions.officer.any: true
factions.access.any: true factions.access.any: true
factions.kit.halfmod: factions.kit.rank1:
description: Can use adminmode and chat spy default: false
children: children:
factions.kit.fullplayer: true factions.kit.rank0: true
factions.adminmode: true factions.adminmode: true
factions.kit.fullplayer: factions.kit.rank0:
description: Can also create new factions. default: false
children: children:
factions.kit.halfplayer: true
factions.create: true factions.create: true
factions.kit.halfplayer:
description: Can do all but create factions.
children:
factions.access: true factions.access: true
factions.access.view: true factions.access.view: true
factions.autoclaim: true factions.autoclaim: true
factions.cape: true
factions.cape.*: true
factions.claim: true factions.claim: true
factions.claim.radius: true factions.claim.radius: true
factions.demote: true factions.demote: true
factions.description: true factions.description: true
factions.disband: true factions.disband: true
factions.flag: true factions.flag: true
factions.help: true
factions.home: true factions.home: true
factions.invite: true factions.invite: true
factions.join: true factions.join: true
@ -153,3 +170,7 @@ permissions:
factions.unclaim: true factions.unclaim: true
factions.unclaimall: true factions.unclaimall: true
factions.version: true factions.version: true
factions.kit.default:
default: true
children:
factions.kit.rank0: true

View File

@ -84,7 +84,7 @@ public enum FFlag
} }
// -------------------------------------------- // // -------------------------------------------- //
// FRODOODODFOFL // PARSE
// -------------------------------------------- // // -------------------------------------------- //
public static FFlag parse(String str) public static FFlag parse(String str)
@ -103,6 +103,10 @@ public enum FFlag
return null; return null;
} }
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
public String getStateInfo(boolean value, boolean withDesc) public String getStateInfo(boolean value, boolean withDesc)
{ {
String ret = (value ? "<g>YES" : "<b>NOO") + "<c> " + this.getNicename(); String ret = (value ? "<g>YES" : "<b>NOO") + "<c> " + this.getNicename();
@ -113,6 +117,4 @@ public enum FFlag
return ret; return ret;
} }
} }

View File

@ -38,7 +38,6 @@ public enum FPerm
SETHOME("sethome", "set the home", Rel.LEADER, Rel.OFFICER), SETHOME("sethome", "set the home", Rel.LEADER, Rel.OFFICER),
WITHDRAW("withdraw", "withdraw money", Rel.LEADER, Rel.OFFICER), WITHDRAW("withdraw", "withdraw money", Rel.LEADER, Rel.OFFICER),
TERRITORY("territory", "claim or unclaim", Rel.LEADER, Rel.OFFICER), TERRITORY("territory", "claim or unclaim", Rel.LEADER, Rel.OFFICER),
CAPE("cape", "set the cape", Rel.LEADER, Rel.OFFICER),
ACCESS("access", "grant territory access", Rel.LEADER, Rel.OFFICER), ACCESS("access", "grant territory access", Rel.LEADER, Rel.OFFICER),
DISBAND("disband", "disband the faction", Rel.LEADER), DISBAND("disband", "disband the faction", Rel.LEADER),
PERMS("perms", "manage permissions", Rel.LEADER), PERMS("perms", "manage permissions", Rel.LEADER),
@ -97,7 +96,7 @@ public enum FPerm
} }
// -------------------------------------------- // // -------------------------------------------- //
// FROOODLDLLD // PARSE
// -------------------------------------------- // // -------------------------------------------- //
public static FPerm parse(String str) public static FPerm parse(String str)
@ -115,12 +114,15 @@ public enum FPerm
if (str.startsWith("s")) return SETHOME; if (str.startsWith("s")) return SETHOME;
if (str.startsWith("w")) return WITHDRAW; if (str.startsWith("w")) return WITHDRAW;
if (str.startsWith("t")) return TERRITORY; if (str.startsWith("t")) return TERRITORY;
if (str.startsWith("ca")) return CAPE;
if (str.startsWith("di")) return DISBAND; if (str.startsWith("di")) return DISBAND;
if (str.startsWith("pe")) return PERMS; if (str.startsWith("pe")) return PERMS;
return null; return null;
} }
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
public static String getStateHeaders() public static String getStateHeaders()
{ {
String ret = ""; String ret = "";

View File

@ -123,6 +123,12 @@ public class Factions extends MPlugin
// Right now only a few situations are handled through this listener. // Right now only a few situations are handled through this listener.
FactionsListenerEcon.get().setup(); FactionsListenerEcon.get().setup();
// Integrate
this.integrate(
HerochatFeatures.get(),
LwcFeatures.get()
);
// Schedule recurring non-tps-dependent tasks // Schedule recurring non-tps-dependent tasks
TaskPlayerPowerUpdate.get().schedule(this); TaskPlayerPowerUpdate.get().schedule(this);
TaskPlayerDataRemove.get().schedule(this); TaskPlayerDataRemove.get().schedule(this);
@ -144,12 +150,6 @@ public class Factions extends MPlugin
ChatTagTagforce.get().register(); ChatTagTagforce.get().register();
ChatTagTitle.get().register(); ChatTagTitle.get().register();
// Integrate
this.integrate(
HerochatFeatures.get(),
LwcFeatures.get()
);
postEnable(); postEnable();
} }
@ -165,121 +165,5 @@ public class Factions extends MPlugin
.registerTypeAdapter(FFlag.class, FFlagAdapter.get()) .registerTypeAdapter(FFlag.class, FFlagAdapter.get())
; ;
} }
// -------------------------------------------- //
// Functions for other plugins to hook into
// -------------------------------------------- //
// TODO: This "outer API" is removed. I should ensure these features are
// available using the appropriate classes and then remove this commented out section below.
/*
// Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat
public String getPlayerFactionTag(Player player)
{
return getPlayerFactionTagRelation(player, null);
}
// Same as above, but with relation (enemy/neutral/ally) coloring potentially added to the tag
public String getPlayerFactionTagRelation(Player speaker, Player listener)
{
String tag = "~";
if (speaker == null)
return tag;
FPlayer me = FPlayerColl.i.get(speaker);
if (me == null)
return tag;
// if listener isn't set, or config option is disabled, give back uncolored tag
if (listener == null || !ConfServer.chatParseTagsColored) {
tag = me.getChatTag().trim();
} else {
FPlayer you = FPlayerColl.i.get(listener);
if (you == null)
tag = me.getChatTag().trim();
else // everything checks out, give the colored tag
tag = me.getChatTag(you).trim();
}
if (tag.isEmpty())
tag = "~";
return tag;
}
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
public String getPlayerTitle(Player player)
{
if (player == null)
return "";
FPlayer me = FPlayerColl.i.get(player);
if (me == null)
return "";
return me.getTitle().trim();
}
// Get a list of all faction tags (names)
public Set<String> getFactionTags()
{
Set<String> tags = new HashSet<String>();
for (Faction faction : FactionColl.i.get())
{
tags.add(faction.getTag());
}
return tags;
}
// Get a list of all players in the specified faction
public Set<String> getPlayersInFaction(String factionTag)
{
Set<String> players = new HashSet<String>();
Faction faction = FactionColl.i.getByTag(factionTag);
if (faction != null)
{
for (FPlayer fplayer : faction.getFPlayers())
{
players.add(fplayer.getName());
}
}
return players;
}
// Get a list of all online players in the specified faction
public Set<String> getOnlinePlayersInFaction(String factionTag)
{
Set<String> players = new HashSet<String>();
Faction faction = FactionColl.i.getByTag(factionTag);
if (faction != null)
{
for (FPlayer fplayer : faction.getFPlayersWhereOnline(true))
{
players.add(fplayer.getName());
}
}
return players;
}
// check if player is allowed to build/destroy in a particular location
public boolean isPlayerAllowedToBuildHere(Player player, Location location)
{
return FactionsBlockListener.playerCanBuildDestroyBlock(player, location.getBlock(), "", true);
}
// check if player is allowed to interact with the specified block (doors/chests/whatever)
public boolean isPlayerAllowedToInteractWith(Player player, Block block)
{
return FactionsPlayerListener.canPlayerUseBlock(player, block, true);
}
// check if player is allowed to use a specified item (flint&steel, buckets, etc) in a particular location
public boolean isPlayerAllowedToUseThisHere(Player player, Location location, Material material)
{
return FactionsPlayerListener.playerCanUseItemHere(player, location, material, true);
}
*/
} }

View File

@ -15,20 +15,14 @@ public enum Perm
ACCESS_VIEW("access.view"), ACCESS_VIEW("access.view"),
ADMIN("adminmode"), ADMIN("adminmode"),
AUTOCLAIM("autoclaim"), AUTOCLAIM("autoclaim"),
CAPE("cape"),
CAPE_GET("cape.get"),
CAPE_SET("cape.set"),
CAPE_REMOVE("cape.remove"),
CLAIM("claim"), CLAIM("claim"),
CLAIM_RADIUS("claim.radius"), CLAIM_RADIUS("claim.radius"),
CONFIG("config"),
CREATE("create"), CREATE("create"),
DEMOTE("demote"), DEMOTE("demote"),
DESCRIPTION("description"), DESCRIPTION("description"),
DISBAND("disband"), DISBAND("disband"),
FLAG("flag"), FLAG("flag"),
FLAG_SET("flag.set"), FLAG_SET("flag.set"),
HELP("help"),
HOME("home"), HOME("home"),
INVITE("invite"), INVITE("invite"),
JOIN("join"), JOIN("join"),
@ -39,7 +33,6 @@ public enum Perm
LEADER_ANY("leader.any"), LEADER_ANY("leader.any"),
LEAVE("leave"), LEAVE("leave"),
LIST("list"), LIST("list"),
LOCK("lock"),
MAP("map"), MAP("map"),
MONEY_BALANCE("money.balance"), MONEY_BALANCE("money.balance"),
MONEY_BALANCE_ANY("money.balance.any"), MONEY_BALANCE_ANY("money.balance.any"),
@ -55,7 +48,6 @@ public enum Perm
POWERBOOST("powerboost"), POWERBOOST("powerboost"),
PROMOTE("promote"), PROMOTE("promote"),
RELATION("relation"), RELATION("relation"),
RELOAD("reload"),
SAVE("save"), SAVE("save"),
SEE_CHUNK("seechunk"), SEE_CHUNK("seechunk"),
SETHOME("sethome"), SETHOME("sethome"),