New cape system and refactored spout appearances.
This commit is contained in:
parent
1f51ee9699
commit
ca6b185bd1
22
plugin.yml
22
plugin.yml
@ -35,9 +35,7 @@ permissions:
|
|||||||
children:
|
children:
|
||||||
factions.kit.fullplayer: true
|
factions.kit.fullplayer: true
|
||||||
factions.adminmode: true
|
factions.adminmode: true
|
||||||
factions.chatspy: true
|
|
||||||
factions.kit.fullplayer:
|
factions.kit.fullplayer:
|
||||||
default: true
|
|
||||||
description: Can also create new factions.
|
description: Can also create new factions.
|
||||||
children:
|
children:
|
||||||
factions.kit.halfplayer: true
|
factions.kit.halfplayer: true
|
||||||
@ -46,7 +44,8 @@ permissions:
|
|||||||
description: Can do all but create factions.
|
description: Can do all but create factions.
|
||||||
children:
|
children:
|
||||||
factions.autoclaim: true
|
factions.autoclaim: true
|
||||||
factions.chat: true
|
factions.cape: true
|
||||||
|
factions.cape.*: true
|
||||||
factions.claim: true
|
factions.claim: true
|
||||||
factions.deinvite: true
|
factions.deinvite: true
|
||||||
factions.description: true
|
factions.description: true
|
||||||
@ -78,12 +77,21 @@ permissions:
|
|||||||
factions.version: true
|
factions.version: true
|
||||||
factions.adminmode:
|
factions.adminmode:
|
||||||
description: enable admin bypass mode
|
description: enable admin bypass mode
|
||||||
factions.chatspy:
|
|
||||||
description: enable admin chat spy mode
|
|
||||||
factions.autoclaim:
|
factions.autoclaim:
|
||||||
description: auto-claim land as you walk around
|
description: auto-claim land as you walk around
|
||||||
factions.chat:
|
factions.cape:
|
||||||
description: change chat mode
|
description: manage faction capes
|
||||||
|
factions.cape.*:
|
||||||
|
children:
|
||||||
|
factions.cape.get: true
|
||||||
|
factions.cape.set: true
|
||||||
|
factions.cape.remove: true
|
||||||
|
factions.cape.get:
|
||||||
|
description: get faction cape
|
||||||
|
factions.cape.set:
|
||||||
|
description: set faction cape
|
||||||
|
factions.cape.remove:
|
||||||
|
description: remove faction cape
|
||||||
factions.claim:
|
factions.claim:
|
||||||
description: claim land where you are standing
|
description: claim land where you are standing
|
||||||
factions.config:
|
factions.config:
|
||||||
|
@ -177,8 +177,7 @@ public class Conf
|
|||||||
public static String spoutHealthBarColorTag = "{c}";
|
public static String spoutHealthBarColorTag = "{c}";
|
||||||
public static int spoutHealthBarWidth = 30;
|
public static int spoutHealthBarWidth = 30;
|
||||||
public static Map<Double, String> spoutHealthBarColorUnderQuota = new LinkedHashMap<Double, String>();
|
public static Map<Double, String> spoutHealthBarColorUnderQuota = new LinkedHashMap<Double, String>();
|
||||||
public static boolean spoutFactionLeaderCapes = true; // Show capes on faction admins, colored based on the viewer's relation to the target player
|
public static boolean spoutCapes = true; // Show faction capes
|
||||||
public static boolean spoutFactionOfficerCapes = true; // same, but for faction moderators
|
|
||||||
public static int spoutTerritoryDisplayPosition = 3; // permanent territory display, instead of by chat; 0 = disabled, 1 = top left, 2 = top center, 3+ = top right
|
public static int spoutTerritoryDisplayPosition = 3; // permanent territory display, instead of by chat; 0 = disabled, 1 = top left, 2 = top center, 3+ = top right
|
||||||
public static float spoutTerritoryDisplaySize = 1.0f; // text scale (size) for territory display
|
public static float spoutTerritoryDisplaySize = 1.0f; // text scale (size) for territory display
|
||||||
public static boolean spoutTerritoryDisplayShowDescription = true; // whether to show the faction description, not just the faction tag
|
public static boolean spoutTerritoryDisplayShowDescription = true; // whether to show the faction description, not just the faction tag
|
||||||
@ -188,11 +187,11 @@ public class Conf
|
|||||||
public static boolean spoutTerritoryNoticeShowDescription = false; // whether to show the faction description in the notice, not just the faction tag
|
public static boolean spoutTerritoryNoticeShowDescription = false; // whether to show the faction description in the notice, not just the faction tag
|
||||||
public static float spoutTerritoryNoticeSize = 1.5f; // text scale (size) for notice
|
public static float spoutTerritoryNoticeSize = 1.5f; // text scale (size) for notice
|
||||||
public static float spoutTerritoryNoticeLeaveAfterSeconds = 2.00f; // how many seconds before the notice goes away
|
public static float spoutTerritoryNoticeLeaveAfterSeconds = 2.00f; // how many seconds before the notice goes away
|
||||||
public static String capeAlly = "https://github.com/MassiveCraft/Factions/raw/master/capes/ally.png";
|
/*public static String capeAlly = "https://github.com/MassiveCraft/Factions/raw/master/capes/ally.png";
|
||||||
public static String capeEnemy = "https://github.com/MassiveCraft/Factions/raw/master/capes/enemy.png";
|
public static String capeEnemy = "https://github.com/MassiveCraft/Factions/raw/master/capes/enemy.png";
|
||||||
public static String capeMember = "https://github.com/MassiveCraft/Factions/raw/master/capes/member.png";
|
public static String capeMember = "https://github.com/MassiveCraft/Factions/raw/master/capes/member.png";
|
||||||
public static String capeNeutral = "https://github.com/MassiveCraft/Factions/raw/master/capes/neutral.png";
|
public static String capeNeutral = "https://github.com/MassiveCraft/Factions/raw/master/capes/neutral.png";
|
||||||
public static String capePeaceful = "https://github.com/MassiveCraft/Factions/raw/master/capes/peaceful.png";
|
public static String capePeaceful = "https://github.com/MassiveCraft/Factions/raw/master/capes/peaceful.png";*/
|
||||||
|
|
||||||
// Economy settings
|
// Economy settings
|
||||||
public static boolean econEnabled = false;
|
public static boolean econEnabled = false;
|
||||||
|
@ -53,13 +53,14 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
if (oldFaction != null) oldFaction.removeFPlayer(this);
|
if (oldFaction != null) oldFaction.removeFPlayer(this);
|
||||||
faction.addFPlayer(this);
|
faction.addFPlayer(this);
|
||||||
this.factionId = faction.getId();
|
this.factionId = faction.getId();
|
||||||
SpoutFeatures.updateAppearances(this.getPlayer());
|
SpoutFeatures.updateTitle(this, null);
|
||||||
|
SpoutFeatures.updateTitle(null, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIELD: role
|
// FIELD: role
|
||||||
private Rel role;
|
private Rel role;
|
||||||
public Rel getRole() { return this.role; }
|
public Rel getRole() { return this.role; }
|
||||||
public void setRole(Rel role) { this.role = role; SpoutFeatures.updateAppearances(this.getPlayer()); }
|
public void setRole(Rel role) { this.role = role; SpoutFeatures.updateTitle(this, null); }
|
||||||
|
|
||||||
// FIELD: title
|
// FIELD: title
|
||||||
private String title;
|
private String title;
|
||||||
@ -141,7 +142,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
|
|
||||||
if (doSpoutUpdate)
|
if (doSpoutUpdate)
|
||||||
{
|
{
|
||||||
SpoutFeatures.updateAppearances(this.getPlayer());
|
SpoutFeatures.updateTitle(this, null);
|
||||||
|
SpoutFeatures.updateTitle(null, this);
|
||||||
|
SpoutFeatures.updateCape(this.getPlayer(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,11 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
|
|
||||||
return aid;
|
return aid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIELD: cape
|
||||||
|
private String cape;
|
||||||
|
public String getCape() { return cape; }
|
||||||
|
public void setCape(String val) { this.cape = val; }
|
||||||
|
|
||||||
// FIELD: powerBoost
|
// FIELD: powerBoost
|
||||||
// special increase/decrease to default and max power for this faction
|
// special increase/decrease to default and max power for this faction
|
||||||
|
@ -97,8 +97,8 @@ public class P extends MPlugin
|
|||||||
Board.load();
|
Board.load();
|
||||||
|
|
||||||
// Add Base Commands
|
// Add Base Commands
|
||||||
this.cmdBase = new FCmdRoot();
|
|
||||||
this.cmdAutoHelp = new CmdAutoHelp();
|
this.cmdAutoHelp = new CmdAutoHelp();
|
||||||
|
this.cmdBase = new FCmdRoot();
|
||||||
this.getBaseCommands().add(cmdBase);
|
this.getBaseCommands().add(cmdBase);
|
||||||
|
|
||||||
EssentialsFeatures.setup();
|
EssentialsFeatures.setup();
|
||||||
|
52
src/com/massivecraft/factions/cmd/CapeCommand.java
Normal file
52
src/com/massivecraft/factions/cmd/CapeCommand.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.struct.FPerm;
|
||||||
|
|
||||||
|
public abstract class CapeCommand extends FCommand
|
||||||
|
{
|
||||||
|
public Faction capeFaction;
|
||||||
|
public String currentCape;
|
||||||
|
|
||||||
|
public CapeCommand()
|
||||||
|
{
|
||||||
|
this.optionalArgs.put("faction", "your");
|
||||||
|
|
||||||
|
this.disableOnLock = true;
|
||||||
|
|
||||||
|
senderMustBePlayer = false;
|
||||||
|
senderMustBeMember = false;
|
||||||
|
senderMustBeOfficer = false;
|
||||||
|
senderMustBeLeader = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validCall(CommandSender sender, List<String> args)
|
||||||
|
{
|
||||||
|
if ( ! super.validCall(sender, args)) return false;
|
||||||
|
|
||||||
|
|
||||||
|
this.capeFaction = null;
|
||||||
|
this.currentCape = null;
|
||||||
|
|
||||||
|
if (this.myFaction == null && ! this.argIsSet(this.requiredArgs.size()))
|
||||||
|
{
|
||||||
|
msg("<b>You must specify a faction from console.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.capeFaction = this.argAsFaction(this.requiredArgs.size(), this.myFaction);
|
||||||
|
if (this.capeFaction == null) return false;
|
||||||
|
|
||||||
|
// Do we have permission to manage the cape of that faction?
|
||||||
|
if (fme != null && ! FPerm.CAPE.has(fme, capeFaction)) return false;
|
||||||
|
|
||||||
|
this.currentCape = this.capeFaction.getCape();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
36
src/com/massivecraft/factions/cmd/CmdCape.java
Normal file
36
src/com/massivecraft/factions/cmd/CmdCape.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.P;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
|
||||||
|
public class CmdCape extends FCommand
|
||||||
|
{
|
||||||
|
public CmdCapeGet cmdCapeGet = new CmdCapeGet();
|
||||||
|
public CmdCapeSet cmdCapeSet = new CmdCapeSet();
|
||||||
|
public CmdCapeRemove cmdCapeRemove = new CmdCapeRemove();
|
||||||
|
|
||||||
|
public CmdCape()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.aliases.add("cape");
|
||||||
|
|
||||||
|
this.permission = Permission.CAPE.node;
|
||||||
|
|
||||||
|
senderMustBePlayer = false;
|
||||||
|
senderMustBeMember = false;
|
||||||
|
senderMustBeOfficer = false;
|
||||||
|
senderMustBeLeader = false;
|
||||||
|
|
||||||
|
this.addSubCommand(this.cmdCapeGet);
|
||||||
|
this.addSubCommand(this.cmdCapeSet);
|
||||||
|
this.addSubCommand(this.cmdCapeRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
this.commandChain.add(this);
|
||||||
|
P.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
25
src/com/massivecraft/factions/cmd/CmdCapeGet.java
Normal file
25
src/com/massivecraft/factions/cmd/CmdCapeGet.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
|
||||||
|
public class CmdCapeGet extends CapeCommand
|
||||||
|
{
|
||||||
|
public CmdCapeGet()
|
||||||
|
{
|
||||||
|
this.aliases.add("get");
|
||||||
|
this.permission = Permission.CAPE_GET.node;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
if (currentCape == null)
|
||||||
|
{
|
||||||
|
msg("<h>%s <i>has no cape set.", capeFaction.describeTo(fme, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("<i>The cape of <h>%s <i>is \"<h>%s<i>\".", capeFaction.describeTo(fme, true), currentCape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
src/com/massivecraft/factions/cmd/CmdCapeRemove.java
Normal file
35
src/com/massivecraft/factions/cmd/CmdCapeRemove.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
|
|
||||||
|
public class CmdCapeRemove extends CapeCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public CmdCapeRemove()
|
||||||
|
{
|
||||||
|
this.aliases.add("rm");
|
||||||
|
this.aliases.add("rem");
|
||||||
|
this.aliases.add("remove");
|
||||||
|
this.aliases.add("del");
|
||||||
|
this.aliases.add("delete");
|
||||||
|
this.permission = Permission.CAPE_REMOVE.node;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
if (currentCape == null)
|
||||||
|
{
|
||||||
|
msg("<h>%s <i>has no cape set.", capeFaction.describeTo(fme, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
capeFaction.setCape(null);
|
||||||
|
SpoutFeatures.updateCape(capeFaction, null);
|
||||||
|
msg("<h>%s <i>removed the cape from <h>%s<i>.", RelationUtil.describeThatToMe(fme, fme, true), capeFaction.describeTo(fme));
|
||||||
|
capeFaction.msg("<h>%s <i>removed the cape from <h>%s<i>.", RelationUtil.describeThatToMe(fme, capeFaction, true), capeFaction.describeTo(capeFaction));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
src/com/massivecraft/factions/cmd/CmdCapeSet.java
Normal file
49
src/com/massivecraft/factions/cmd/CmdCapeSet.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
|
|
||||||
|
public class CmdCapeSet extends CapeCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public CmdCapeSet()
|
||||||
|
{
|
||||||
|
this.aliases.add("set");
|
||||||
|
this.requiredArgs.add("url");
|
||||||
|
this.permission = Permission.CAPE_SET.node;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
String newCape = this.argAsString(0);
|
||||||
|
|
||||||
|
if (isUrlValid(newCape))
|
||||||
|
{
|
||||||
|
capeFaction.setCape(newCape);
|
||||||
|
SpoutFeatures.updateCape(capeFaction, null);
|
||||||
|
msg("<h>%s <i>set the cape of <h>%s<i> to \"<h>%s<i>\".", RelationUtil.describeThatToMe(fme, fme, true), capeFaction.describeTo(fme), newCape);
|
||||||
|
capeFaction.msg("<h>%s <i>set the cape of <h>%s<i> to \"<h>%s<i>\".", RelationUtil.describeThatToMe(fme, capeFaction, true), capeFaction.describeTo(capeFaction), newCape);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("<i>\"<h>%s<i>\" is not a valid URL.", newCape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUrlValid(String urlString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new URL(urlString);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -393,7 +393,8 @@ public class CmdConfig extends FCommand
|
|||||||
Conf.save();
|
Conf.save();
|
||||||
|
|
||||||
// in case some Spout related setting was changed
|
// in case some Spout related setting was changed
|
||||||
SpoutFeatures.updateAppearances();
|
SpoutFeatures.updateTitle(null, null);
|
||||||
|
//SpoutFeatures.updateCape(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,7 @@ public class CmdDisband extends FCommand
|
|||||||
|
|
||||||
faction.detach();
|
faction.detach();
|
||||||
|
|
||||||
SpoutFeatures.updateAppearances();
|
SpoutFeatures.updateTitle(null, null);
|
||||||
|
SpoutFeatures.updateCape(null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.struct.FPerm;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
|
||||||
public class CmdInvite extends FCommand
|
public class CmdInvite extends FCommand
|
||||||
@ -37,6 +38,8 @@ public class CmdInvite extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fme != null && ! FPerm.INVITE.has(fme, myFaction)) return;
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
if ( ! payForCommand(Conf.econCostInvite, "to invite someone", "for inviting someone")) return;
|
if ( ! payForCommand(Conf.econCostInvite, "to invite someone", "for inviting someone")) return;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class CmdKick extends FCommand
|
|||||||
|
|
||||||
senderMustBePlayer = true;
|
senderMustBePlayer = true;
|
||||||
senderMustBeMember = false;
|
senderMustBeMember = false;
|
||||||
senderMustBeOfficer = true;
|
senderMustBeOfficer = false;
|
||||||
senderMustBeLeader = false;
|
senderMustBeLeader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class CmdTag extends FCommand
|
|||||||
|
|
||||||
if (Conf.spoutFactionTagsOverNames)
|
if (Conf.spoutFactionTagsOverNames)
|
||||||
{
|
{
|
||||||
SpoutFeatures.updateAppearances(myFaction);
|
SpoutFeatures.updateTitle(myFaction, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class CmdTitle extends FCommand
|
|||||||
|
|
||||||
if (Conf.spoutFactionTitlesOverNames)
|
if (Conf.spoutFactionTitlesOverNames)
|
||||||
{
|
{
|
||||||
SpoutFeatures.updateAppearances(me);
|
SpoutFeatures.updateTitle(me, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public class FCmdRoot extends FCommand
|
|||||||
public CmdLeader cmdLeader = new CmdLeader();
|
public CmdLeader cmdLeader = new CmdLeader();
|
||||||
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
|
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
|
||||||
public CmdAdmin cmdBypass = new CmdAdmin();
|
public CmdAdmin cmdBypass = new CmdAdmin();
|
||||||
|
public CmdCape cmdCape = new CmdCape();
|
||||||
public CmdClaim cmdClaim = new CmdClaim();
|
public CmdClaim cmdClaim = new CmdClaim();
|
||||||
public CmdConfig cmdConfig = new CmdConfig();
|
public CmdConfig cmdConfig = new CmdConfig();
|
||||||
public CmdCreate cmdCreate = new CmdCreate();
|
public CmdCreate cmdCreate = new CmdCreate();
|
||||||
@ -71,6 +72,7 @@ public class FCmdRoot extends FCommand
|
|||||||
this.addSubCommand(this.cmdLeader);
|
this.addSubCommand(this.cmdLeader);
|
||||||
this.addSubCommand(this.cmdAutoClaim);
|
this.addSubCommand(this.cmdAutoClaim);
|
||||||
this.addSubCommand(this.cmdBypass);
|
this.addSubCommand(this.cmdBypass);
|
||||||
|
this.addSubCommand(this.cmdCape);
|
||||||
this.addSubCommand(this.cmdClaim);
|
this.addSubCommand(this.cmdClaim);
|
||||||
this.addSubCommand(this.cmdConfig);
|
this.addSubCommand(this.cmdConfig);
|
||||||
this.addSubCommand(this.cmdCreate);
|
this.addSubCommand(this.cmdCreate);
|
||||||
|
@ -93,7 +93,7 @@ public abstract class FRelationCommand extends FCommand
|
|||||||
myFaction.msg("<i>This will have no effect while your faction is peaceful.");
|
myFaction.msg("<i>This will have no effect while your faction is peaceful.");
|
||||||
}
|
}
|
||||||
|
|
||||||
SpoutFeatures.updateAppearances(myFaction, them);
|
SpoutFeatures.updateTitle(myFaction, them);
|
||||||
SpoutFeatures.updateTerritoryDisplayLoc(null);
|
SpoutFeatures.updateTerritoryDisplayLoc(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.massivecraft.factions.integration;
|
package com.massivecraft.factions.integration;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
@ -14,62 +16,216 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.massivecraft.factions.struct.Rel;
|
|
||||||
import com.massivecraft.factions.util.HealthBarUtil;
|
import com.massivecraft.factions.util.HealthBarUtil;
|
||||||
|
|
||||||
import org.getspout.spoutapi.gui.Color;
|
|
||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
|
|
||||||
|
|
||||||
public class SpoutFeatures
|
public class SpoutFeatures
|
||||||
{
|
{
|
||||||
private transient static boolean spoutMe = false;
|
// -------------------------------------------- //
|
||||||
private transient static SpoutMainListener mainListener;
|
// FIELDS
|
||||||
private transient static boolean listenersHooked;
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static SpoutMainListener mainListener;
|
||||||
|
|
||||||
|
private static boolean enabled = false;
|
||||||
|
public static boolean isEnabled() { return enabled; }
|
||||||
|
|
||||||
public static void setup()
|
// -------------------------------------------- //
|
||||||
|
// SETUP AND AVAILABILITY
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static boolean setup()
|
||||||
{
|
{
|
||||||
Plugin test = Bukkit.getServer().getPluginManager().getPlugin("Spout");
|
Plugin plugin = Bukkit.getPluginManager().getPlugin("Spout");
|
||||||
if (test == null || !test.isEnabled()) return;
|
if (plugin == null || ! plugin.isEnabled())
|
||||||
|
{
|
||||||
setAvailable(true, test.getDescription().getFullName());
|
if (enabled == false) return false;
|
||||||
|
enabled = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabled == true) return true;
|
||||||
|
enabled = true;
|
||||||
|
|
||||||
|
P.p.log("Found and will use features of "+plugin.getDescription().getFullName());
|
||||||
|
mainListener = new SpoutMainListener();
|
||||||
|
Bukkit.getPluginManager().registerEvents(mainListener, P.p);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set integration availability
|
// -------------------------------------------- //
|
||||||
public static void setAvailable(boolean enable, String pluginName)
|
// CAPES
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// Capes look the same to everyone.
|
||||||
|
|
||||||
|
public static void updateCape(final Object ofrom, final Object oto)
|
||||||
{
|
{
|
||||||
spoutMe = enable;
|
// Enabled and non-null?
|
||||||
if (!spoutMe) return;
|
if ( ! isEnabled()) return;
|
||||||
|
if ( ! Conf.spoutCapes) return;
|
||||||
P.p.log("Found and will use features of "+pluginName);
|
|
||||||
|
Set<Player> fromPlayers = getPlayersFromObject(ofrom);
|
||||||
if (!listenersHooked)
|
Set<Player> toPlayers = getPlayersFromObject(oto);
|
||||||
|
|
||||||
|
for (Player player : fromPlayers)
|
||||||
{
|
{
|
||||||
listenersHooked = true;
|
FPlayer fplayer = FPlayers.i.get(player);
|
||||||
mainListener = new SpoutMainListener();
|
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(mainListener, P.p);
|
Faction faction = fplayer.getFaction();
|
||||||
|
|
||||||
|
String cape = faction.getCape();
|
||||||
|
|
||||||
|
for (Player playerTo : toPlayers)
|
||||||
|
{
|
||||||
|
SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo);
|
||||||
|
|
||||||
|
// Set the cape
|
||||||
|
if (cape != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
splayer.setCapeFor(splayerTo, cape);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
splayer.resetCapeFor(splayerTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're successfully hooked into Spout
|
public static void updateCapeShortly(final Object ofrom, final Object oto)
|
||||||
public static boolean enabled()
|
|
||||||
{
|
{
|
||||||
return spoutMe;
|
P.p.getServer().getScheduler().scheduleSyncDelayedTask(P.p, new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
updateCape(ofrom, oto);
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If Spout is available and the specified Player is running the Spoutcraft client
|
// -------------------------------------------- //
|
||||||
public static boolean availableFor(Player player)
|
// TITLE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static void updateTitle(final Object ofrom, final Object oto)
|
||||||
{
|
{
|
||||||
return spoutMe && SpoutManager.getPlayer(player).isSpoutCraftEnabled();
|
// Enabled and non-null?
|
||||||
|
if ( ! isEnabled()) return;
|
||||||
|
if ( ! (Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames || Conf.spoutHealthBarUnderNames)) return;
|
||||||
|
|
||||||
|
Set<Player> fromPlayers = getPlayersFromObject(ofrom);
|
||||||
|
Set<Player> toPlayers = getPlayersFromObject(oto);
|
||||||
|
|
||||||
|
for (Player player : fromPlayers)
|
||||||
|
{
|
||||||
|
FPlayer fplayer = FPlayers.i.get(player);
|
||||||
|
SpoutPlayer splayer = SpoutManager.getPlayer(player);
|
||||||
|
Faction faction = fplayer.getFaction();
|
||||||
|
|
||||||
|
for (Player playerTo : toPlayers)
|
||||||
|
{
|
||||||
|
FPlayer fplayerTo = FPlayers.i.get(playerTo);
|
||||||
|
SpoutPlayer splayerTo = SpoutManager.getPlayer(playerTo);
|
||||||
|
Faction factionTo = fplayerTo.getFaction();
|
||||||
|
|
||||||
|
ChatColor relationColor = faction.getRelationTo(factionTo).getColor();
|
||||||
|
|
||||||
|
String title = generateTitle(player, fplayer, faction, relationColor);
|
||||||
|
splayer.setTitleFor(splayerTo, title);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateTitleShortly(final Object ofrom, final Object oto)
|
||||||
|
{
|
||||||
|
P.p.getServer().getScheduler().scheduleSyncDelayedTask(P.p, new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
updateTitle(ofrom, oto);
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generateTitle(Player player, FPlayer fplayer, Faction faction, ChatColor relationColor)
|
||||||
|
{
|
||||||
|
String ret = null;
|
||||||
|
|
||||||
|
ret = player.getDisplayName();
|
||||||
|
|
||||||
|
if (faction.isNormal())
|
||||||
|
{
|
||||||
|
String addTag = "";
|
||||||
|
if (Conf.spoutFactionTagsOverNames)
|
||||||
|
{
|
||||||
|
addTag += relationColor.toString() + "[" + fplayer.getRole().getPrefix() + faction.getTag() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Conf.spoutFactionTitlesOverNames && ! fplayer.getTitle().isEmpty())
|
||||||
|
{
|
||||||
|
addTag += (addTag.isEmpty() ? "" : " ") + fplayer.getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = addTag + "\n" + ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Conf.spoutHealthBarUnderNames)
|
||||||
|
{
|
||||||
|
ret += "\n";
|
||||||
|
ret += HealthBarUtil.getHealthbar(player.getHealth() / 20d);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// UTIL
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public static Set<Player> getPlayersFromObject(Object o)
|
||||||
|
{
|
||||||
|
Set<Player> ret = new HashSet<Player>();
|
||||||
|
if (o instanceof Player)
|
||||||
|
{
|
||||||
|
ret.add((Player)o);
|
||||||
|
}
|
||||||
|
else if (o instanceof FPlayer)
|
||||||
|
{
|
||||||
|
ret.add(((FPlayer)o).getPlayer());
|
||||||
|
}
|
||||||
|
else if (o instanceof Faction)
|
||||||
|
{
|
||||||
|
ret.addAll(((Faction)o).getOnlinePlayers());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.addAll(Arrays.asList(Bukkit.getOnlinePlayers()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// TERRITORY DISPLAY
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// update displayed current territory for all players inside a specified chunk; if specified chunk is null, then simply update everyone online
|
// update displayed current territory for all players inside a specified chunk; if specified chunk is null, then simply update everyone online
|
||||||
public static void updateTerritoryDisplayLoc(FLocation fLoc)
|
public static void updateTerritoryDisplayLoc(FLocation fLoc)
|
||||||
{
|
{
|
||||||
if (!enabled())
|
if ( ! isEnabled()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Set<FPlayer> players = FPlayers.i.getOnline();
|
Set<FPlayer> players = FPlayers.i.getOnline();
|
||||||
|
|
||||||
@ -85,245 +241,13 @@ public class SpoutFeatures
|
|||||||
// update displayed current territory for specified player; returns false if unsuccessful
|
// update displayed current territory for specified player; returns false if unsuccessful
|
||||||
public static boolean updateTerritoryDisplay(FPlayer player)
|
public static boolean updateTerritoryDisplay(FPlayer player)
|
||||||
{
|
{
|
||||||
if (!enabled())
|
if ( ! isEnabled()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return mainListener.updateTerritoryDisplay(player, true);
|
return mainListener.updateTerritoryDisplay(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playerDisconnect(FPlayer player)
|
public static void playerDisconnect(FPlayer player)
|
||||||
{
|
{
|
||||||
if (!enabled())
|
if ( ! isEnabled()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
mainListener.removeTerritoryLabels(player.getName());
|
mainListener.removeTerritoryLabels(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// update all appearances between every player
|
|
||||||
public static void updateAppearances()
|
|
||||||
{
|
|
||||||
if (!enabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Set<FPlayer> players = FPlayers.i.getOnline();
|
|
||||||
|
|
||||||
for (FPlayer playerA : players)
|
|
||||||
{
|
|
||||||
for (FPlayer playerB : players)
|
|
||||||
{
|
|
||||||
updateSingle(playerB, playerA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update all appearances related to a specific player
|
|
||||||
public static void updateAppearances(Player player)
|
|
||||||
{
|
|
||||||
if (!enabled() || player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Set<FPlayer> players = FPlayers.i.getOnline();
|
|
||||||
FPlayer playerA = FPlayers.i.get(player);
|
|
||||||
|
|
||||||
for (FPlayer playerB : players)
|
|
||||||
{
|
|
||||||
updateSingle(playerB, playerA);
|
|
||||||
updateSingle(playerA, playerB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update how this player looks in the eyes of all other players
|
|
||||||
public static void updateMyAppearance(Player player)
|
|
||||||
{
|
|
||||||
if (!enabled() || player == null) return;
|
|
||||||
|
|
||||||
Set<FPlayer> players = FPlayers.i.getOnline();
|
|
||||||
FPlayer playerA = FPlayers.i.get(player);
|
|
||||||
|
|
||||||
for (FPlayer playerB : players)
|
|
||||||
{
|
|
||||||
updateSingle(playerB, playerA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// as above method, but with a delay added; useful for after-login update which doesn't always propagate if done immediately
|
|
||||||
public static void updateAppearancesShortly(final Player player)
|
|
||||||
{
|
|
||||||
P.p.getServer().getScheduler().scheduleSyncDelayedTask(P.p, new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
updateAppearances(player);
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update all appearances related to a single faction
|
|
||||||
public static void updateAppearances(Faction faction)
|
|
||||||
{
|
|
||||||
if (!enabled() || faction == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Set<FPlayer> players = FPlayers.i.getOnline();
|
|
||||||
Faction factionA;
|
|
||||||
|
|
||||||
for (FPlayer playerA : players)
|
|
||||||
{
|
|
||||||
factionA = playerA.getFaction();
|
|
||||||
|
|
||||||
for (FPlayer playerB : players)
|
|
||||||
{
|
|
||||||
if (factionA != faction && playerB.getFaction() != faction)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
updateSingle(playerB, playerA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update all appearances between two factions
|
|
||||||
public static void updateAppearances(Faction factionA, Faction factionB)
|
|
||||||
{
|
|
||||||
if (!enabled() || factionA == null || factionB == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (FPlayer playerA : factionA.getFPlayersWhereOnline(true))
|
|
||||||
{
|
|
||||||
for (FPlayer playerB : factionB.getFPlayersWhereOnline(true))
|
|
||||||
{
|
|
||||||
updateSingle(playerB, playerA);
|
|
||||||
updateSingle(playerA, playerB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// update a single appearance; internal use only by above public methods
|
|
||||||
private static void updateSingle(FPlayer viewer, FPlayer viewed)
|
|
||||||
{
|
|
||||||
if (viewer == null || viewed == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Faction viewedFaction = viewed.getFaction();
|
|
||||||
if (viewedFaction == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// these still end up returning null on occasion at this point, mucking up the SpoutManager.getPlayer() method
|
|
||||||
if (viewer.getPlayer() == null || viewed.getPlayer() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SpoutPlayer pViewer = SpoutManager.getPlayer(viewer.getPlayer());
|
|
||||||
SpoutPlayer pViewed = SpoutManager.getPlayer(viewed.getPlayer());
|
|
||||||
if (pViewed == null || pViewer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
String viewedTitle = viewed.getTitle();
|
|
||||||
Rel viewedRole = viewed.getRole();
|
|
||||||
|
|
||||||
if ((Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames || Conf.spoutHealthBarUnderNames) && viewer != viewed)
|
|
||||||
{
|
|
||||||
String title = pViewed.getDisplayName();
|
|
||||||
|
|
||||||
if (viewedFaction.isNormal())
|
|
||||||
{
|
|
||||||
String addTag = "";
|
|
||||||
if (Conf.spoutFactionTagsOverNames)
|
|
||||||
{
|
|
||||||
addTag += viewedFaction.getTag(viewed.getColorTo(viewer).toString() + "[") + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
String rolePrefix = viewedRole.getPrefix();
|
|
||||||
if (Conf.spoutFactionTitlesOverNames && (!viewedTitle.isEmpty() || !rolePrefix.isEmpty()))
|
|
||||||
{
|
|
||||||
addTag += (addTag.isEmpty() ? "" : " ") + viewedRole.getPrefix() + viewedTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
title = addTag + "\n" + title;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Conf.spoutHealthBarUnderNames)
|
|
||||||
{
|
|
||||||
title += "\n";
|
|
||||||
title += HealthBarUtil.getHealthbar(pViewed.getHealth() / 20d);
|
|
||||||
}
|
|
||||||
|
|
||||||
pViewed.setTitleFor(pViewer, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(
|
|
||||||
Conf.spoutFactionLeaderCapes
|
|
||||||
&&
|
|
||||||
viewedRole.equals(Rel.LEADER)
|
|
||||||
)
|
|
||||||
||
|
|
||||||
(
|
|
||||||
Conf.spoutFactionOfficerCapes
|
|
||||||
&&
|
|
||||||
viewedRole.equals(Rel.OFFICER)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Rel relation = viewer.getRelationTo(viewed);
|
|
||||||
String cape = "";
|
|
||||||
if (!viewedFaction.isNormal())
|
|
||||||
{
|
|
||||||
// yeah, no cape if no faction
|
|
||||||
}
|
|
||||||
else if (relation == Rel.TRUCE)
|
|
||||||
cape = Conf.capePeaceful;
|
|
||||||
else if (relation == Rel.NEUTRAL)
|
|
||||||
cape = Conf.capeNeutral;
|
|
||||||
else if (relation == Rel.MEMBER)
|
|
||||||
cape = Conf.capeMember;
|
|
||||||
else if (relation == Rel.ENEMY)
|
|
||||||
cape = Conf.capeEnemy;
|
|
||||||
else if (relation == Rel.ALLY)
|
|
||||||
cape = Conf.capeAlly;
|
|
||||||
|
|
||||||
if (cape.isEmpty())
|
|
||||||
pViewed.resetCapeFor(pViewer);
|
|
||||||
else
|
|
||||||
pViewed.setCapeFor(pViewer, cape);
|
|
||||||
}
|
|
||||||
else if (Conf.spoutFactionLeaderCapes || Conf.spoutFactionOfficerCapes)
|
|
||||||
{
|
|
||||||
pViewed.resetCapeFor(pViewer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// method to convert a Bukkit ChatColor to a Spout Color
|
|
||||||
protected static Color getSpoutColor(ChatColor inColor, int alpha)
|
|
||||||
{
|
|
||||||
if (inColor == null)
|
|
||||||
return SpoutFixedColor(191, 191, 191, alpha);
|
|
||||||
|
|
||||||
switch (inColor.getChar())
|
|
||||||
{
|
|
||||||
case 0x1: return SpoutFixedColor(0, 0, 191, alpha);
|
|
||||||
case 0x2: return SpoutFixedColor(0, 191, 0, alpha);
|
|
||||||
case 0x3: return SpoutFixedColor(0, 191, 191, alpha);
|
|
||||||
case 0x4: return SpoutFixedColor(191, 0, 0, alpha);
|
|
||||||
case 0x5: return SpoutFixedColor(191, 0, 191, alpha);
|
|
||||||
case 0x6: return SpoutFixedColor(191, 191, 0, alpha);
|
|
||||||
case 0x7: return SpoutFixedColor(191, 191, 191, alpha);
|
|
||||||
case 0x8: return SpoutFixedColor(64, 64, 64, alpha);
|
|
||||||
case 0x9: return SpoutFixedColor(64, 64, 255, alpha);
|
|
||||||
case 0xA: return SpoutFixedColor(64, 255, 64, alpha);
|
|
||||||
case 0xB: return SpoutFixedColor(64, 255, 255, alpha);
|
|
||||||
case 0xC: return SpoutFixedColor(255, 64, 64, alpha);
|
|
||||||
case 0xD: return SpoutFixedColor(255, 64, 255, alpha);
|
|
||||||
case 0xE: return SpoutFixedColor(255, 255, 64, alpha);
|
|
||||||
case 0xF: return SpoutFixedColor(255, 255, 255, alpha);
|
|
||||||
default: return SpoutFixedColor(0, 0, 0, alpha);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static Color SpoutFixedColor(int r, int g, int b, int a)
|
|
||||||
{
|
|
||||||
return new Color(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ public class SpoutMainListener implements Listener
|
|||||||
{
|
{
|
||||||
final FPlayer me = FPlayers.i.get(event.getPlayer());
|
final FPlayer me = FPlayers.i.get(event.getPlayer());
|
||||||
|
|
||||||
SpoutFeatures.updateAppearances(me.getPlayer());
|
SpoutFeatures.updateTitle(me, null);
|
||||||
|
SpoutFeatures.updateTitle(null, me);
|
||||||
updateTerritoryDisplay(me, true);
|
updateTerritoryDisplay(me, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class FactionsHealthBarListener implements Listener
|
|||||||
if ( ! Conf.spoutHealthBarUnderNames) return;
|
if ( ! Conf.spoutHealthBarUnderNames) return;
|
||||||
if ( ! (entity instanceof Player)) return;
|
if ( ! (entity instanceof Player)) return;
|
||||||
Player player = (Player)entity;
|
Player player = (Player)entity;
|
||||||
SpoutFeatures.updateMyAppearance(player);
|
SpoutFeatures.updateTitle(player, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
@ -53,13 +53,11 @@ public class FactionsPlayerListener implements Listener
|
|||||||
// Update the lastLoginTime for this fplayer
|
// Update the lastLoginTime for this fplayer
|
||||||
me.setLastLoginTime(System.currentTimeMillis());
|
me.setLastLoginTime(System.currentTimeMillis());
|
||||||
|
|
||||||
/* This is now done in a separate task which runs every few minutes
|
//SpoutFeatures.updateAppearancesShortly(event.getPlayer());
|
||||||
// Run the member auto kick routine. Twice to get to the admins...
|
SpoutFeatures.updateTitleShortly(event.getPlayer(), null);
|
||||||
FPlayers.i.autoLeaveOnInactivityRoutine();
|
SpoutFeatures.updateTitleShortly(null, event.getPlayer());
|
||||||
FPlayers.i.autoLeaveOnInactivityRoutine();
|
SpoutFeatures.updateCapeShortly(event.getPlayer(), null);
|
||||||
*/
|
SpoutFeatures.updateCapeShortly(null, event.getPlayer());
|
||||||
|
|
||||||
SpoutFeatures.updateAppearancesShortly(event.getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.massivecraft.factions.listeners;
|
package com.massivecraft.factions.listeners;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -22,21 +21,12 @@ public class FactionsServerListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginDisable(PluginDisableEvent event)
|
public void onPluginDisable(PluginDisableEvent event)
|
||||||
{
|
{
|
||||||
String name = event.getPlugin().getDescription().getName();
|
SpoutFeatures.setup();
|
||||||
if (name.equals("Spout"))
|
|
||||||
{
|
|
||||||
SpoutFeatures.setAvailable(false, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginEnable(PluginEnableEvent event)
|
public void onPluginEnable(PluginEnableEvent event)
|
||||||
{
|
{
|
||||||
Plugin plug = event.getPlugin();
|
SpoutFeatures.setup();
|
||||||
String name = plug.getDescription().getName();
|
|
||||||
if (name.equals("Spout"))
|
|
||||||
{
|
|
||||||
SpoutFeatures.setAvailable(true, plug.getDescription().getFullName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,10 +31,12 @@ public enum FPerm
|
|||||||
BUTTON("button", "use stone buttons", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY),
|
BUTTON("button", "use stone buttons", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY),
|
||||||
LEVER("lever", "use levers", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY),
|
LEVER("lever", "use levers", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.ALLY),
|
||||||
CONTAINER("container", "use containers", Rel.LEADER, Rel.OFFICER, Rel.MEMBER),
|
CONTAINER("container", "use containers", Rel.LEADER, Rel.OFFICER, Rel.MEMBER),
|
||||||
|
INVITE("invite", "invite players", Rel.LEADER, Rel.OFFICER),
|
||||||
KICK("kick", "kick members", Rel.LEADER, Rel.OFFICER),
|
KICK("kick", "kick members", Rel.LEADER, Rel.OFFICER),
|
||||||
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),
|
||||||
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),
|
||||||
;
|
;
|
||||||
@ -77,6 +79,7 @@ public enum FPerm
|
|||||||
if (str.startsWith("but")) return BUTTON;
|
if (str.startsWith("but")) return BUTTON;
|
||||||
if (str.startsWith("l")) return LEVER;
|
if (str.startsWith("l")) return LEVER;
|
||||||
if (str.startsWith("co")) return CONTAINER;
|
if (str.startsWith("co")) return CONTAINER;
|
||||||
|
if (str.startsWith("i")) return INVITE;
|
||||||
if (str.startsWith("k")) return KICK;
|
if (str.startsWith("k")) return KICK;
|
||||||
if (str.startsWith("s")) return SETHOME;
|
if (str.startsWith("s")) return SETHOME;
|
||||||
if (str.startsWith("w")) return WITHDRAW;
|
if (str.startsWith("w")) return WITHDRAW;
|
||||||
|
@ -7,8 +7,10 @@ public enum Permission
|
|||||||
{
|
{
|
||||||
ADMIN("adminmode"),
|
ADMIN("adminmode"),
|
||||||
AUTOCLAIM("autoclaim"),
|
AUTOCLAIM("autoclaim"),
|
||||||
CHAT("chat"),
|
CAPE("cape"),
|
||||||
CHATSPY("chatspy"),
|
CAPE_GET("cape.get"),
|
||||||
|
CAPE_SET("cape.set"),
|
||||||
|
CAPE_REMOVE("cape.remove"),
|
||||||
CLAIM("claim"),
|
CLAIM("claim"),
|
||||||
CONFIG("config"),
|
CONFIG("config"),
|
||||||
CREATE("create"),
|
CREATE("create"),
|
||||||
|
Loading…
Reference in New Issue
Block a user