Loads of UPlayer --> MPlayer renames
This commit is contained in:
parent
529ae45ede
commit
0b60a5ad1a
@ -7,7 +7,7 @@ public class Const
|
|||||||
public static final String BASENAME_ = BASENAME+"_";
|
public static final String BASENAME_ = BASENAME+"_";
|
||||||
|
|
||||||
public static final String COLLECTION_BOARD = BASENAME_+"board";
|
public static final String COLLECTION_BOARD = BASENAME_+"board";
|
||||||
public static final String COLLECTION_FACTION = BASENAME_+"faction";
|
public static final String COLLECTION_FACTION = BASENAME_+"faction";
|
||||||
public static final String COLLECTION_MPLAYER = BASENAME_+"mplayer";
|
public static final String COLLECTION_MPLAYER = BASENAME_+"mplayer";
|
||||||
public static final String COLLECTION_MCONF = BASENAME_+"mconf";
|
public static final String COLLECTION_MCONF = BASENAME_+"mconf";
|
||||||
|
|
||||||
|
@ -125,10 +125,10 @@ public enum FPerm
|
|||||||
// HAS?
|
// HAS?
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public String createDeniedMessage(MPlayer uplayer, Faction hostFaction)
|
public String createDeniedMessage(MPlayer mplayer, Faction hostFaction)
|
||||||
{
|
{
|
||||||
String ret = Txt.parse("%s<b> does not allow you to %s<b>.", hostFaction.describeTo(uplayer, true), this.getDescription());
|
String ret = Txt.parse("%s<b> does not allow you to %s<b>.", hostFaction.describeTo(mplayer, true), this.getDescription());
|
||||||
if (Perm.ADMIN.has(uplayer.getPlayer()))
|
if (Perm.ADMIN.has(mplayer.getPlayer()))
|
||||||
{
|
{
|
||||||
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
|
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
|
||||||
}
|
}
|
||||||
@ -141,39 +141,39 @@ public enum FPerm
|
|||||||
return hostFaction.getPermittedRelations(this).contains(rel);
|
return hostFaction.getPermittedRelations(this).contains(rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean has(MPlayer uplayer, Faction hostFaction, boolean verboose)
|
public boolean has(MPlayer mplayer, Faction hostFaction, boolean verboose)
|
||||||
{
|
{
|
||||||
if (uplayer.isUsingAdminMode()) return true;
|
if (mplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
Rel rel = uplayer.getRelationTo(hostFaction);
|
Rel rel = mplayer.getRelationTo(hostFaction);
|
||||||
if (hostFaction.getPermittedRelations(this).contains(rel)) return true;
|
if (hostFaction.getPermittedRelations(this).contains(rel)) return true;
|
||||||
|
|
||||||
if (verboose) uplayer.sendMessage(this.createDeniedMessage(uplayer, hostFaction));
|
if (verboose) mplayer.sendMessage(this.createDeniedMessage(mplayer, hostFaction));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean has(MPlayer uplayer, PS ps, boolean verboose)
|
public boolean has(MPlayer mplayer, PS ps, boolean verboose)
|
||||||
{
|
{
|
||||||
if (uplayer.isUsingAdminMode()) return true;
|
if (mplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
TerritoryAccess ta = BoardColl.get().getTerritoryAccessAt(ps);
|
TerritoryAccess ta = BoardColl.get().getTerritoryAccessAt(ps);
|
||||||
Faction hostFaction = ta.getHostFaction(ps);
|
Faction hostFaction = ta.getHostFaction();
|
||||||
|
|
||||||
if (this.isTerritoryPerm())
|
if (this.isTerritoryPerm())
|
||||||
{
|
{
|
||||||
Boolean hasTerritoryAccess = ta.hasTerritoryAccess(uplayer);
|
Boolean hasTerritoryAccess = ta.hasTerritoryAccess(mplayer);
|
||||||
if (hasTerritoryAccess != null)
|
if (hasTerritoryAccess != null)
|
||||||
{
|
{
|
||||||
if (verboose && !hasTerritoryAccess)
|
if (verboose && !hasTerritoryAccess)
|
||||||
{
|
{
|
||||||
uplayer.sendMessage(this.createDeniedMessage(uplayer, hostFaction));
|
mplayer.sendMessage(this.createDeniedMessage(mplayer, hostFaction));
|
||||||
}
|
}
|
||||||
return hasTerritoryAccess;
|
return hasTerritoryAccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.has(uplayer, hostFaction, verboose);
|
return this.has(mplayer, hostFaction, verboose);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -35,8 +35,8 @@ public class FactionEqualsPredictate implements Predictate<CommandSender>, Seria
|
|||||||
@Override
|
@Override
|
||||||
public boolean apply(CommandSender sender)
|
public boolean apply(CommandSender sender)
|
||||||
{
|
{
|
||||||
MPlayer uplayer = MPlayer.get(sender);
|
MPlayer mplayer = MPlayer.get(sender);
|
||||||
return this.factionId.equals(uplayer.getFactionId());
|
return this.factionId.equals(mplayer.getFactionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -36,11 +36,11 @@ public class FactionListComparator implements Comparator<Faction>
|
|||||||
if (ret != 0) return ret;
|
if (ret != 0) return ret;
|
||||||
|
|
||||||
// Players Online
|
// Players Online
|
||||||
ret = f2.getUPlayersWhereOnline(true).size() - f1.getUPlayersWhereOnline(true).size();
|
ret = f2.getMPlayersWhereOnline(true).size() - f1.getMPlayersWhereOnline(true).size();
|
||||||
if (ret != 0) return ret;
|
if (ret != 0) return ret;
|
||||||
|
|
||||||
// Players Total
|
// Players Total
|
||||||
ret = f2.getUPlayers().size() - f1.getUPlayers().size();
|
ret = f2.getMPlayers().size() - f1.getMPlayers().size();
|
||||||
if (ret != 0) return ret;
|
if (ret != 0) return ret;
|
||||||
|
|
||||||
// Tie by Id
|
// Tie by Id
|
||||||
|
@ -117,7 +117,7 @@ public class Factions extends MassivePlugin
|
|||||||
MPlayerColl.get().init();
|
MPlayerColl.get().init();
|
||||||
FactionColl.get().init();
|
FactionColl.get().init();
|
||||||
BoardColl.get().init();
|
BoardColl.get().init();
|
||||||
FactionColl.get().reindexUPlayers();
|
FactionColl.get().reindexMPlayers();
|
||||||
this.databaseInitialized = true;
|
this.databaseInitialized = true;
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
|
@ -94,12 +94,12 @@ public class TerritoryAccess
|
|||||||
// FIELDS: UNIVERSED
|
// FIELDS: UNIVERSED
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public Faction getHostFaction(Object universe)
|
public Faction getHostFaction()
|
||||||
{
|
{
|
||||||
return FactionColl.get().get(this.getHostFactionId());
|
return FactionColl.get().get(this.getHostFactionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedHashSet<MPlayer> getGrantedUPlayers(Object universe)
|
public LinkedHashSet<MPlayer> getGrantedMPlayers()
|
||||||
{
|
{
|
||||||
LinkedHashSet<MPlayer> ret = new LinkedHashSet<MPlayer>();
|
LinkedHashSet<MPlayer> ret = new LinkedHashSet<MPlayer>();
|
||||||
for (String playerId : this.getPlayerIds())
|
for (String playerId : this.getPlayerIds())
|
||||||
@ -109,7 +109,7 @@ public class TerritoryAccess
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedHashSet<Faction> getGrantedFactions(Object universe)
|
public LinkedHashSet<Faction> getGrantedFactions()
|
||||||
{
|
{
|
||||||
LinkedHashSet<Faction> ret = new LinkedHashSet<Faction>();
|
LinkedHashSet<Faction> ret = new LinkedHashSet<Faction>();
|
||||||
for (String factionId : this.getFactionIds())
|
for (String factionId : this.getFactionIds())
|
||||||
@ -200,11 +200,11 @@ public class TerritoryAccess
|
|||||||
// true means elevated access
|
// true means elevated access
|
||||||
// false means decreased access
|
// false means decreased access
|
||||||
// null means standard access
|
// null means standard access
|
||||||
public Boolean hasTerritoryAccess(MPlayer uplayer)
|
public Boolean hasTerritoryAccess(MPlayer mplayer)
|
||||||
{
|
{
|
||||||
if (this.getPlayerIds().contains(uplayer.getId())) return true;
|
if (this.getPlayerIds().contains(mplayer.getId())) return true;
|
||||||
|
|
||||||
String factionId = uplayer.getFactionId();
|
String factionId = mplayer.getFactionId();
|
||||||
if (this.getFactionIds().contains(factionId)) return true;
|
if (this.getFactionIds().contains(factionId)) return true;
|
||||||
|
|
||||||
if (this.getHostFactionId().equals(factionId) && !this.isHostFactionAllowed()) return false;
|
if (this.getHostFactionId().equals(factionId) && !this.isHostFactionAllowed()) return false;
|
||||||
|
@ -43,7 +43,7 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
|
|||||||
{
|
{
|
||||||
chunk = PS.valueOf(me).getChunk(true);
|
chunk = PS.valueOf(me).getChunk(true);
|
||||||
ta = BoardColl.get().getTerritoryAccessAt(chunk);
|
ta = BoardColl.get().getTerritoryAccessAt(chunk);
|
||||||
hostFaction = ta.getHostFaction(usender);
|
hostFaction = ta.getHostFaction();
|
||||||
|
|
||||||
this.innerPerform();
|
this.innerPerform();
|
||||||
}
|
}
|
||||||
@ -55,8 +55,8 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
|
|||||||
sendMessage(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
|
sendMessage(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
|
||||||
msg("<k>Host Faction: %s", hostFaction.describeTo(usender, true));
|
msg("<k>Host Faction: %s", hostFaction.describeTo(usender, true));
|
||||||
msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
|
msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
|
||||||
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedUPlayers(usender), usender));
|
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), usender));
|
||||||
msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(usender), usender));
|
msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(), usender));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)
|
public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FPerm;
|
import com.massivecraft.factions.FPerm;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.entity.BoardColl;
|
import com.massivecraft.factions.entity.BoardColl;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
||||||
@ -35,17 +35,17 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
|||||||
public void innerPerform()
|
public void innerPerform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
|
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
|
||||||
if (uplayer == null) return;
|
if (mplayer == null) return;
|
||||||
|
|
||||||
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
|
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(mplayer.getId()));
|
||||||
if (newValue == null) return;
|
if (newValue == null) return;
|
||||||
|
|
||||||
// FPerm
|
// FPerm
|
||||||
if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
|
if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
ta = ta.withPlayerId(uplayer.getId(), newValue);
|
ta = ta.withPlayerId(mplayer.getId(), newValue);
|
||||||
BoardColl.get().setTerritoryAccessAt(chunk, ta);
|
BoardColl.get().setTerritoryAccessAt(chunk, ta);
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class CmdFactionsDemote extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
MPlayer you = this.arg(0, ARMPlayer.getAny());
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
if (you.getFaction() != usenderFaction)
|
if (you.getFaction() != usenderFaction)
|
||||||
|
@ -50,7 +50,7 @@ public class CmdFactionsDescription extends FCommand
|
|||||||
usenderFaction.setDescription(newDescription);
|
usenderFaction.setDescription(newDescription);
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
for (MPlayer follower : usenderFaction.getUPlayers())
|
for (MPlayer follower : usenderFaction.getMPlayers())
|
||||||
{
|
{
|
||||||
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
|
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
|
||||||
}
|
}
|
||||||
|
@ -64,23 +64,23 @@ public class CmdFactionsDisband extends FCommand
|
|||||||
// Merged Apply and Inform
|
// Merged Apply and Inform
|
||||||
|
|
||||||
// Run event for each player in the faction
|
// Run event for each player in the faction
|
||||||
for (MPlayer uplayer : faction.getUPlayers())
|
for (MPlayer mplayer : faction.getMPlayers())
|
||||||
{
|
{
|
||||||
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, uplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND);
|
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND);
|
||||||
membershipChangeEvent.run();
|
membershipChangeEvent.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform all players
|
// Inform all players
|
||||||
for (MPlayer uplayer : MPlayerColl.get().getAllOnline())
|
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
|
||||||
{
|
{
|
||||||
String who = usender.describeTo(uplayer);
|
String who = usender.describeTo(mplayer);
|
||||||
if (uplayer.getFaction() == faction)
|
if (mplayer.getFaction() == faction)
|
||||||
{
|
{
|
||||||
uplayer.msg("<h>%s<i> disbanded your faction.", who);
|
mplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getName(uplayer));
|
mplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getName(mplayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class CmdFactionsFaction extends FCommand
|
|||||||
List<String> followerNamesOnline = new ArrayList<String>();
|
List<String> followerNamesOnline = new ArrayList<String>();
|
||||||
List<String> followerNamesOffline = new ArrayList<String>();
|
List<String> followerNamesOffline = new ArrayList<String>();
|
||||||
|
|
||||||
List<MPlayer> followers = faction.getUPlayers();
|
List<MPlayer> followers = faction.getMPlayers();
|
||||||
Collections.sort(followers, PlayerRoleComparator.get());
|
Collections.sort(followers, PlayerRoleComparator.get());
|
||||||
|
|
||||||
for (MPlayer follower : followers)
|
for (MPlayer follower : followers)
|
||||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.FPerm;
|
import com.massivecraft.factions.FPerm;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
||||||
@ -40,16 +40,16 @@ public class CmdFactionsInvite extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
|
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
|
||||||
if (uplayer == null) return;
|
if (mplayer == null) return;
|
||||||
|
|
||||||
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
|
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(mplayer));
|
||||||
if (newInvited == null) return;
|
if (newInvited == null) return;
|
||||||
|
|
||||||
// Allready member?
|
// Allready member?
|
||||||
if (uplayer.getFaction() == usenderFaction)
|
if (mplayer.getFaction() == usenderFaction)
|
||||||
{
|
{
|
||||||
msg("%s<i> is already a member of %s", uplayer.getName(), usenderFaction.getName());
|
msg("%s<i> is already a member of %s", mplayer.getName(), usenderFaction.getName());
|
||||||
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
|
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,24 +58,24 @@ public class CmdFactionsInvite extends FCommand
|
|||||||
if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return;
|
if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return;
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, uplayer, usenderFaction, newInvited);
|
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, usenderFaction, newInvited);
|
||||||
event.run();
|
event.run();
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
newInvited = event.isNewInvited();
|
newInvited = event.isNewInvited();
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
usenderFaction.setInvited(uplayer, newInvited);
|
usenderFaction.setInvited(mplayer, newInvited);
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
if (newInvited)
|
if (newInvited)
|
||||||
{
|
{
|
||||||
uplayer.msg("%s<i> invited you to %s", usender.describeTo(uplayer, true), usenderFaction.describeTo(uplayer));
|
mplayer.msg("%s<i> invited you to %s", usender.describeTo(mplayer, true), usenderFaction.describeTo(mplayer));
|
||||||
usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), uplayer.describeTo(usenderFaction));
|
usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), mplayer.describeTo(usenderFaction));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(uplayer), usenderFaction.describeTo(uplayer));
|
mplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(mplayer), usenderFaction.describeTo(mplayer));
|
||||||
usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), uplayer.describeTo(usenderFaction));
|
usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), mplayer.describeTo(usenderFaction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
@ -42,11 +42,11 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
Faction faction = this.arg(0, ARFaction.get());
|
Faction faction = this.arg(0, ARFaction.get());
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
MPlayer uplayer = this.arg(1, ARUPlayer.getAny(), usender);
|
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), usender);
|
||||||
if (uplayer == null) return;
|
if (mplayer == null) return;
|
||||||
Faction uplayerFaction = uplayer.getFaction();
|
Faction mplayerFaction = mplayer.getFaction();
|
||||||
|
|
||||||
boolean samePlayer = uplayer == usender;
|
boolean samePlayer = mplayer == usender;
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
|
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
|
||||||
@ -55,36 +55,36 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (faction == uplayerFaction)
|
if (faction == mplayerFaction)
|
||||||
{
|
{
|
||||||
msg("<i>%s <i>%s already a member of %s<i>.", uplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
|
msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MConf.get().factionMemberLimit > 0 && faction.getUPlayers().size() >= MConf.get().factionMemberLimit)
|
if (MConf.get().factionMemberLimit > 0 && faction.getMPlayers().size() >= MConf.get().factionMemberLimit)
|
||||||
{
|
{
|
||||||
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, uplayer.describeTo(usender, false));
|
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, mplayer.describeTo(usender, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uplayerFaction.isNormal())
|
if (mplayerFaction.isNormal())
|
||||||
{
|
{
|
||||||
msg("<b>%s must leave %s current faction first.", uplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
|
msg("<b>%s must leave %s current faction first.", mplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MConf.get().canLeaveWithNegativePower && uplayer.getPower() < 0)
|
if (!MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
|
||||||
{
|
{
|
||||||
msg("<b>%s cannot join a faction with a negative power level.", uplayer.describeTo(usender, true));
|
msg("<b>%s cannot join a faction with a negative power level.", mplayer.describeTo(usender, true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! (faction.isOpen() || faction.isInvited(uplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
if( ! (faction.isOpen() || faction.isInvited(mplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||||
{
|
{
|
||||||
msg("<i>This faction requires invitation.");
|
msg("<i>This faction requires invitation.");
|
||||||
if (samePlayer)
|
if (samePlayer)
|
||||||
{
|
{
|
||||||
faction.msg("%s<i> tried to join your faction.", uplayer.describeTo(faction, true));
|
faction.msg("%s<i> tried to join your faction.", mplayer.describeTo(faction, true));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -97,27 +97,27 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
// Inform
|
// Inform
|
||||||
if (!samePlayer)
|
if (!samePlayer)
|
||||||
{
|
{
|
||||||
uplayer.msg("<i>%s <i>moved you into the faction %s<i>.", usender.describeTo(uplayer, true), faction.getName(uplayer));
|
mplayer.msg("<i>%s <i>moved you into the faction %s<i>.", usender.describeTo(mplayer, true), faction.getName(mplayer));
|
||||||
}
|
}
|
||||||
faction.msg("<i>%s <i>joined <lime>your faction<i>.", uplayer.describeTo(faction, true));
|
faction.msg("<i>%s <i>joined <lime>your faction<i>.", mplayer.describeTo(faction, true));
|
||||||
usender.msg("<i>%s <i>successfully joined %s<i>.", uplayer.describeTo(usender, true), faction.getName(usender));
|
usender.msg("<i>%s <i>successfully joined %s<i>.", mplayer.describeTo(usender, true), faction.getName(usender));
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
uplayer.resetFactionData();
|
mplayer.resetFactionData();
|
||||||
uplayer.setFaction(faction);
|
mplayer.setFaction(faction);
|
||||||
|
|
||||||
faction.setInvited(uplayer, false);
|
faction.setInvited(mplayer, false);
|
||||||
|
|
||||||
// Derplog
|
// Derplog
|
||||||
if (MConf.get().logFactionJoin)
|
if (MConf.get().logFactionJoin)
|
||||||
{
|
{
|
||||||
if (samePlayer)
|
if (samePlayer)
|
||||||
{
|
{
|
||||||
Factions.get().log(Txt.parse("%s joined the faction %s.", uplayer.getName(), faction.getName()));
|
Factions.get().log(Txt.parse("%s joined the faction %s.", mplayer.getName(), faction.getName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", usender.getName(), uplayer.getName(), faction.getName()));
|
Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", usender.getName(), mplayer.getName(), faction.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import com.massivecraft.factions.FPerm;
|
|||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
@ -40,58 +40,58 @@ public class CmdFactionsKick extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Arg
|
// Arg
|
||||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny());
|
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
|
||||||
if (uplayer == null) return;
|
if (mplayer == null) return;
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if (usender == uplayer)
|
if (usender == mplayer)
|
||||||
{
|
{
|
||||||
msg("<b>You cannot kick yourself.");
|
msg("<b>You cannot kick yourself.");
|
||||||
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
|
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
|
if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
|
||||||
{
|
{
|
||||||
msg("<b>The leader can not be kicked.");
|
msg("<b>The leader can not be kicked.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! MConf.get().canLeaveWithNegativePower && uplayer.getPower() < 0)
|
if ( ! MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
|
||||||
{
|
{
|
||||||
msg("<b>You cannot kick that member until their power is positive.");
|
msg("<b>You cannot kick that member until their power is positive.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FPerm
|
// FPerm
|
||||||
Faction uplayerFaction = uplayer.getFaction();
|
Faction mplayerFaction = mplayer.getFaction();
|
||||||
if (!FPerm.KICK.has(usender, uplayerFaction, true)) return;
|
if (!FPerm.KICK.has(usender, mplayerFaction, true)) return;
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, uplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
|
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
|
||||||
event.run();
|
event.run();
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
uplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", usender.describeTo(uplayerFaction, true), uplayer.describeTo(uplayerFaction, true));
|
mplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", usender.describeTo(mplayerFaction, true), mplayer.describeTo(mplayerFaction, true));
|
||||||
uplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(uplayer, true), uplayerFaction.describeTo(uplayer));
|
mplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(mplayer, true), mplayerFaction.describeTo(mplayer));
|
||||||
if (uplayerFaction != usenderFaction)
|
if (mplayerFaction != usenderFaction)
|
||||||
{
|
{
|
||||||
usender.msg("<i>You kicked %s<i> from the faction %s<i>!", uplayer.describeTo(usender), uplayerFaction.describeTo(usender));
|
usender.msg("<i>You kicked %s<i> from the faction %s<i>!", mplayer.describeTo(usender), mplayerFaction.describeTo(usender));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MConf.get().logFactionKick)
|
if (MConf.get().logFactionKick)
|
||||||
{
|
{
|
||||||
Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + uplayer.getName() + " from the faction " + uplayerFaction.getName());
|
Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + mplayer.getName() + " from the faction " + mplayerFaction.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
if (uplayer.getRole() == Rel.LEADER)
|
if (mplayer.getRole() == Rel.LEADER)
|
||||||
{
|
{
|
||||||
uplayerFaction.promoteNewLeader();
|
mplayerFaction.promoteNewLeader();
|
||||||
}
|
}
|
||||||
uplayerFaction.setInvited(uplayer, false);
|
mplayerFaction.setInvited(mplayer, false);
|
||||||
uplayer.resetFactionData();
|
mplayer.resetFactionData();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
@ -38,7 +38,7 @@ public class CmdFactionsLeader extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
MPlayer newLeader = this.arg(0, ARUPlayer.getAny());
|
MPlayer newLeader = this.arg(0, ARMPlayer.getAny());
|
||||||
if (newLeader == null) return;
|
if (newLeader == null) return;
|
||||||
|
|
||||||
Faction targetFaction = this.arg(1, ARFaction.get(), usenderFaction);
|
Faction targetFaction = this.arg(1, ARFaction.get(), usenderFaction);
|
||||||
@ -46,7 +46,7 @@ public class CmdFactionsLeader extends FCommand
|
|||||||
|
|
||||||
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||||
|
|
||||||
// We now have uplayer and the target faction
|
// We now have mplayer and the target faction
|
||||||
if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
|
if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
|
||||||
{
|
{
|
||||||
// Do whatever you wish
|
// Do whatever you wish
|
||||||
@ -100,9 +100,9 @@ public class CmdFactionsLeader extends FCommand
|
|||||||
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
|
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
|
||||||
|
|
||||||
// Inform all players
|
// Inform all players
|
||||||
for (MPlayer uplayer : MPlayerColl.get().getAllOnline())
|
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
|
||||||
{
|
{
|
||||||
uplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, uplayer, true), newLeader.describeTo(uplayer), targetFaction.describeTo(uplayer));
|
mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,13 +63,13 @@ public class CmdFactionsList extends FCommand
|
|||||||
{
|
{
|
||||||
if (faction.isNone())
|
if (faction.isNone())
|
||||||
{
|
{
|
||||||
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.get().getNone().getUPlayersWhereOnline(true).size()));
|
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.get().getNone().getMPlayersWhereOnline(true).size()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
|
||||||
faction.getName(usender),
|
faction.getName(usender),
|
||||||
faction.getUPlayersWhereOnline(true).size(),
|
faction.getMPlayersWhereOnline(true).size(),
|
||||||
faction.getUPlayers().size(),
|
faction.getMPlayers().size(),
|
||||||
faction.getLandCount(),
|
faction.getLandCount(),
|
||||||
faction.getPowerRounded(),
|
faction.getPowerRounded(),
|
||||||
faction.getPowerMaxRounded())
|
faction.getPowerMaxRounded())
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
@ -51,7 +51,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
|||||||
Faction from = this.arg(1, ARFaction.get());
|
Faction from = this.arg(1, ARFaction.get());
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
MPlayer to = this.arg(2, ARUPlayer.getAny());
|
MPlayer to = this.arg(2, ARMPlayer.getAny());
|
||||||
if (to == null) return;
|
if (to == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(usender, from, to, amount);
|
boolean success = Econ.transferMoney(usender, from, to, amount);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
@ -48,7 +48,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
|||||||
Double amount = this.arg(0, ARDouble.get());
|
Double amount = this.arg(0, ARDouble.get());
|
||||||
if (amount == null) return;
|
if (amount == null) return;
|
||||||
|
|
||||||
MPlayer from = this.arg(1, ARUPlayer.getAny());
|
MPlayer from = this.arg(1, ARMPlayer.getAny());
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
Faction to = this.arg(2, ARFaction.get());
|
Faction to = this.arg(2, ARFaction.get());
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||||
@ -32,7 +32,7 @@ public class CmdFactionsOfficer extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
MPlayer you = this.arg(0, ARMPlayer.getAny());
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
||||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.massivecore.Progressbar;
|
import com.massivecraft.massivecore.Progressbar;
|
||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||||
@ -37,24 +37,24 @@ public class CmdFactionsPlayer extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
MPlayer uplayer = this.arg(0, ARUPlayer.getAny(), usender);
|
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), usender);
|
||||||
if (uplayer == null) return;
|
if (mplayer == null) return;
|
||||||
|
|
||||||
// INFO: Title
|
// INFO: Title
|
||||||
msg(Txt.titleize(Txt.upperCaseFirst(uplayer.getUniverse()) + " Player " + uplayer.describeTo(usender)));
|
msg(Txt.titleize(Txt.upperCaseFirst(mplayer.getUniverse()) + " Player " + mplayer.describeTo(usender)));
|
||||||
|
|
||||||
// INFO: Power (as progress bar)
|
// INFO: Power (as progress bar)
|
||||||
double progressbarQuota = uplayer.getPower() / uplayer.getPowerMax();
|
double progressbarQuota = mplayer.getPower() / mplayer.getPowerMax();
|
||||||
int progressbarWidth = (int) Math.round(uplayer.getPowerMax() / uplayer.getPowerMaxUniversal() * 100);
|
int progressbarWidth = (int) Math.round(mplayer.getPowerMax() / mplayer.getPowerMaxUniversal() * 100);
|
||||||
msg("<k>Power: <v>%s", Progressbar.HEALTHBAR_CLASSIC.withQuota(progressbarQuota).withWidth(progressbarWidth).render());
|
msg("<k>Power: <v>%s", Progressbar.HEALTHBAR_CLASSIC.withQuota(progressbarQuota).withWidth(progressbarWidth).render());
|
||||||
|
|
||||||
// INFO: Power (as digits)
|
// INFO: Power (as digits)
|
||||||
msg("<k>Power: <v>%.2f / %.2f", uplayer.getPower(), uplayer.getPowerMax());
|
msg("<k>Power: <v>%.2f / %.2f", mplayer.getPower(), mplayer.getPowerMax());
|
||||||
|
|
||||||
// INFO: Power Boost
|
// INFO: Power Boost
|
||||||
if (uplayer.hasPowerBoost())
|
if (mplayer.hasPowerBoost())
|
||||||
{
|
{
|
||||||
double powerBoost = uplayer.getPowerBoost();
|
double powerBoost = mplayer.getPowerBoost();
|
||||||
String powerBoostType = (powerBoost > 0 ? "bonus" : "penalty");
|
String powerBoostType = (powerBoost > 0 ? "bonus" : "penalty");
|
||||||
msg("<k>Power Boost: <v>%f <i>(a manually granted %s)", powerBoost, powerBoostType);
|
msg("<k>Power Boost: <v>%f <i>(a manually granted %s)", powerBoost, powerBoostType);
|
||||||
}
|
}
|
||||||
@ -63,20 +63,20 @@ public class CmdFactionsPlayer extends FCommand
|
|||||||
// If the player is not at maximum we wan't to display how much time left.
|
// If the player is not at maximum we wan't to display how much time left.
|
||||||
|
|
||||||
String stringTillMax = "";
|
String stringTillMax = "";
|
||||||
double powerTillMax = uplayer.getPowerMax() - uplayer.getPower();
|
double powerTillMax = mplayer.getPowerMax() - mplayer.getPower();
|
||||||
if (powerTillMax > 0)
|
if (powerTillMax > 0)
|
||||||
{
|
{
|
||||||
long millisTillMax = (long) (powerTillMax * TimeUnit.MILLIS_PER_HOUR / uplayer.getPowerPerHour());
|
long millisTillMax = (long) (powerTillMax * TimeUnit.MILLIS_PER_HOUR / mplayer.getPowerPerHour());
|
||||||
LinkedHashMap<TimeUnit, Long> unitcountsTillMax = TimeDiffUtil.unitcounts(millisTillMax, TimeUnit.getAllButMillis());
|
LinkedHashMap<TimeUnit, Long> unitcountsTillMax = TimeDiffUtil.unitcounts(millisTillMax, TimeUnit.getAllButMillis());
|
||||||
unitcountsTillMax = TimeDiffUtil.limit(unitcountsTillMax, 2);
|
unitcountsTillMax = TimeDiffUtil.limit(unitcountsTillMax, 2);
|
||||||
String unitcountsTillMaxFormated = TimeDiffUtil.formatedVerboose(unitcountsTillMax, "<i>");
|
String unitcountsTillMaxFormated = TimeDiffUtil.formatedVerboose(unitcountsTillMax, "<i>");
|
||||||
stringTillMax = Txt.parse(" <i>(%s <i>left till max)", unitcountsTillMaxFormated);
|
stringTillMax = Txt.parse(" <i>(%s <i>left till max)", unitcountsTillMaxFormated);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg("<k>Power per Hour: <v>%.2f%s", uplayer.getPowerPerHour(), stringTillMax);
|
msg("<k>Power per Hour: <v>%.2f%s", mplayer.getPowerPerHour(), stringTillMax);
|
||||||
|
|
||||||
// INFO: Power per Death
|
// INFO: Power per Death
|
||||||
msg("<k>Power per Death: <v>%.2f", uplayer.getPowerPerDeath());
|
msg("<k>Power per Death: <v>%.2f", mplayer.getPowerPerDeath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
@ -56,7 +56,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
|||||||
|
|
||||||
if (doPlayer)
|
if (doPlayer)
|
||||||
{
|
{
|
||||||
MPlayer targetPlayer = this.arg(1, ARUPlayer.getAny());
|
MPlayer targetPlayer = this.arg(1, ARMPlayer.getAny());
|
||||||
if (targetPlayer == null) return;
|
if (targetPlayer == null) return;
|
||||||
|
|
||||||
targetPlayer.setPowerBoost(targetPower);
|
targetPlayer.setPowerBoost(targetPower);
|
||||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class CmdFactionsPromote extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
MPlayer you = this.arg(0, ARMPlayer.getAny());
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
if (you.getFaction() != usenderFaction)
|
if (you.getFaction() != usenderFaction)
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
import com.massivecraft.factions.event.EventFactionsTitleChange;
|
import com.massivecraft.factions.event.EventFactionsTitleChange;
|
||||||
@ -40,7 +40,7 @@ public class CmdFactionsTitle extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
MPlayer you = this.arg(0, ARUPlayer.getAny());
|
MPlayer you = this.arg(0, ARMPlayer.getAny());
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||||
|
@ -36,12 +36,12 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
|||||||
result.setResult(FactionColl.get().getBestNameMatch(str));
|
result.setResult(FactionColl.get().getBestNameMatch(str));
|
||||||
if (result.hasResult()) return result;
|
if (result.hasResult()) return result;
|
||||||
|
|
||||||
// UPlayer Name Exact
|
// MPlayer Name Exact
|
||||||
String id = IdUtil.getId(str);
|
String id = IdUtil.getId(str);
|
||||||
MPlayer uplayer = MPlayer.get(id);
|
MPlayer mplayer = MPlayer.get(id);
|
||||||
if (uplayer != null)
|
if (mplayer != null)
|
||||||
{
|
{
|
||||||
result.setResult(uplayer.getFaction());
|
result.setResult(mplayer.getFaction());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import com.massivecraft.factions.entity.MPlayer;
|
|||||||
import com.massivecraft.factions.entity.MPlayerColl;
|
import com.massivecraft.factions.entity.MPlayerColl;
|
||||||
import com.massivecraft.massivecore.cmd.arg.ArgReader;
|
import com.massivecraft.massivecore.cmd.arg.ArgReader;
|
||||||
|
|
||||||
public class ARUPlayer
|
public class ARMPlayer
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE
|
// INSTANCE
|
@ -33,8 +33,8 @@ public class ReqRoleIsAtLeast extends ReqAbstract
|
|||||||
@Override
|
@Override
|
||||||
public boolean apply(CommandSender sender, MassiveCommand command)
|
public boolean apply(CommandSender sender, MassiveCommand command)
|
||||||
{
|
{
|
||||||
MPlayer uplayer = MPlayer.get(sender);
|
MPlayer mplayer = MPlayer.get(sender);
|
||||||
return uplayer.getRole().isAtLeast(this.rel);
|
return mplayer.getRole().isAtLeast(this.rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,7 +99,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
{
|
{
|
||||||
if (ps == null) return null;
|
if (ps == null) return null;
|
||||||
TerritoryAccess ta = this.getTerritoryAccessAt(ps);
|
TerritoryAccess ta = this.getTerritoryAccessAt(ps);
|
||||||
return ta.getHostFaction(this);
|
return ta.getHostFaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SET
|
// SET
|
||||||
|
@ -407,9 +407,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
return this.getInvitedPlayerIds().contains(playerId);
|
return this.getInvitedPlayerIds().contains(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInvited(MPlayer uplayer)
|
public boolean isInvited(MPlayer mplayer)
|
||||||
{
|
{
|
||||||
return this.isInvited(uplayer.getId());
|
return this.isInvited(mplayer.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setInvited(String playerId, boolean invited)
|
public boolean setInvited(String playerId, boolean invited)
|
||||||
@ -429,9 +429,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInvited(MPlayer uplayer, boolean invited)
|
public void setInvited(MPlayer mplayer, boolean invited)
|
||||||
{
|
{
|
||||||
this.setInvited(uplayer.getId(), invited);
|
this.setInvited(mplayer.getId(), invited);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -774,9 +774,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
if (this.getFlag(FFlag.INFPOWER)) return 999999;
|
if (this.getFlag(FFlag.INFPOWER)) return 999999;
|
||||||
|
|
||||||
double ret = 0;
|
double ret = 0;
|
||||||
for (MPlayer uplayer : this.getUPlayers())
|
for (MPlayer mplayer : this.getMPlayers())
|
||||||
{
|
{
|
||||||
ret += uplayer.getPower();
|
ret += mplayer.getPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
double factionPowerMax = MConf.get().factionPowerMax;
|
double factionPowerMax = MConf.get().factionPowerMax;
|
||||||
@ -795,9 +795,9 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
if (this.getFlag(FFlag.INFPOWER)) return 999999;
|
if (this.getFlag(FFlag.INFPOWER)) return 999999;
|
||||||
|
|
||||||
double ret = 0;
|
double ret = 0;
|
||||||
for (MPlayer uplayer : this.getUPlayers())
|
for (MPlayer mplayer : this.getMPlayers())
|
||||||
{
|
{
|
||||||
ret += uplayer.getPowerMax();
|
ret += mplayer.getPowerMax();
|
||||||
}
|
}
|
||||||
|
|
||||||
double factionPowerMax = MConf.get().factionPowerMax;
|
double factionPowerMax = MConf.get().factionPowerMax;
|
||||||
@ -836,13 +836,13 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// FOREIGN KEY: UPLAYER
|
// FOREIGN KEY: MPLAYER
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
protected transient List<MPlayer> uplayers = new ArrayList<MPlayer>();
|
protected transient List<MPlayer> mplayers = new ArrayList<MPlayer>();
|
||||||
public void reindexUPlayers()
|
public void reindexMPlayers()
|
||||||
{
|
{
|
||||||
this.uplayers.clear();
|
this.mplayers.clear();
|
||||||
|
|
||||||
String factionId = this.getId();
|
String factionId = this.getId();
|
||||||
if (factionId == null) return;
|
if (factionId == null) return;
|
||||||
@ -850,42 +850,42 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
for (MPlayer mplayer : MPlayerColl.get().getAll())
|
for (MPlayer mplayer : MPlayerColl.get().getAll())
|
||||||
{
|
{
|
||||||
if (!MUtil.equals(factionId, mplayer.getFactionId())) continue;
|
if (!MUtil.equals(factionId, mplayer.getFactionId())) continue;
|
||||||
this.uplayers.add(mplayer);
|
this.mplayers.add(mplayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Even though this check method removeds the invalid entries it's not a true solution.
|
// TODO: Even though this check method removeds the invalid entries it's not a true solution.
|
||||||
// TODO: Find the bug causing non-attached UPlayers to be present in the index.
|
// TODO: Find the bug causing non-attached MPlayers to be present in the index.
|
||||||
private void checkUPlayerIndex()
|
private void checkMPlayerIndex()
|
||||||
{
|
{
|
||||||
Iterator<MPlayer> iter = this.uplayers.iterator();
|
Iterator<MPlayer> iter = this.mplayers.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
MPlayer uplayer = iter.next();
|
MPlayer mplayer = iter.next();
|
||||||
if (!uplayer.attached())
|
if (!mplayer.attached())
|
||||||
{
|
{
|
||||||
String msg = Txt.parse("<rose>WARN: <i>Faction <h>%s <i>aka <h>%s <i>had unattached uplayer in index:", this.getName(), this.getId());
|
String msg = Txt.parse("<rose>WARN: <i>Faction <h>%s <i>aka <h>%s <i>had unattached mplayer in index:", this.getName(), this.getId());
|
||||||
Factions.get().log(msg);
|
Factions.get().log(msg);
|
||||||
Factions.get().log(Factions.get().gson.toJson(uplayer));
|
Factions.get().log(Factions.get().gson.toJson(mplayer));
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MPlayer> getUPlayers()
|
public List<MPlayer> getMPlayers()
|
||||||
{
|
{
|
||||||
this.checkUPlayerIndex();
|
this.checkMPlayerIndex();
|
||||||
return new ArrayList<MPlayer>(this.uplayers);
|
return new ArrayList<MPlayer>(this.mplayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MPlayer> getUPlayersWhereOnline(boolean online)
|
public List<MPlayer> getMPlayersWhereOnline(boolean online)
|
||||||
{
|
{
|
||||||
List<MPlayer> ret = this.getUPlayers();
|
List<MPlayer> ret = this.getMPlayers();
|
||||||
Iterator<MPlayer> iter = ret.iterator();
|
Iterator<MPlayer> iter = ret.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
MPlayer uplayer = iter.next();
|
MPlayer mplayer = iter.next();
|
||||||
if (uplayer.isOnline() != online)
|
if (mplayer.isOnline() != online)
|
||||||
{
|
{
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
@ -893,14 +893,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MPlayer> getUPlayersWhereRole(Rel role)
|
public List<MPlayer> getMPlayersWhereRole(Rel role)
|
||||||
{
|
{
|
||||||
List<MPlayer> ret = this.getUPlayers();
|
List<MPlayer> ret = this.getMPlayers();
|
||||||
Iterator<MPlayer> iter = ret.iterator();
|
Iterator<MPlayer> iter = ret.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
MPlayer uplayer = iter.next();
|
MPlayer mplayer = iter.next();
|
||||||
if (uplayer.getRole() != role)
|
if (mplayer.getRole() != role)
|
||||||
{
|
{
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
@ -910,14 +910,14 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
|
|
||||||
public MPlayer getLeader()
|
public MPlayer getLeader()
|
||||||
{
|
{
|
||||||
List<MPlayer> ret = this.getUPlayers();
|
List<MPlayer> ret = this.getMPlayers();
|
||||||
Iterator<MPlayer> iter = ret.iterator();
|
Iterator<MPlayer> iter = ret.iterator();
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
{
|
{
|
||||||
MPlayer uplayer = iter.next();
|
MPlayer mplayer = iter.next();
|
||||||
if (uplayer.getRole() == Rel.LEADER)
|
if (mplayer.getRole() == Rel.LEADER)
|
||||||
{
|
{
|
||||||
return uplayer;
|
return mplayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -928,9 +928,8 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
List<CommandSender> ret = new ArrayList<CommandSender>();
|
List<CommandSender> ret = new ArrayList<CommandSender>();
|
||||||
for (CommandSender player : IdUtil.getOnlineSenders())
|
for (CommandSender player : IdUtil.getOnlineSenders())
|
||||||
{
|
{
|
||||||
MPlayer uplayer = MPlayer.get(player);
|
MPlayer mplayer = MPlayer.get(player);
|
||||||
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
|
if (mplayer.getFaction() != this) continue;
|
||||||
if (uplayer.getFaction() != this) continue;
|
|
||||||
ret.add(player);
|
ret.add(player);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -941,9 +940,8 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
List<Player> ret = new ArrayList<Player>();
|
List<Player> ret = new ArrayList<Player>();
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
MPlayer uplayer = MPlayer.get(player);
|
MPlayer mplayer = MPlayer.get(player);
|
||||||
if (!MUtil.equals(uplayer.getUniverse(), this.getUniverse())) continue;
|
if (mplayer.getFaction() != this) continue;
|
||||||
if (uplayer.getFaction() != this) continue;
|
|
||||||
ret.add(player);
|
ret.add(player);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -958,10 +956,10 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
MPlayer oldLeader = this.getLeader();
|
MPlayer oldLeader = this.getLeader();
|
||||||
|
|
||||||
// get list of officers, or list of normal members if there are no officers
|
// get list of officers, or list of normal members if there are no officers
|
||||||
List<MPlayer> replacements = this.getUPlayersWhereRole(Rel.OFFICER);
|
List<MPlayer> replacements = this.getMPlayersWhereRole(Rel.OFFICER);
|
||||||
if (replacements == null || replacements.isEmpty())
|
if (replacements == null || replacements.isEmpty())
|
||||||
{
|
{
|
||||||
replacements = this.getUPlayersWhereRole(Rel.MEMBER);
|
replacements = this.getMPlayersWhereRole(Rel.MEMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replacements == null || replacements.isEmpty())
|
if (replacements == null || replacements.isEmpty())
|
||||||
@ -1007,19 +1005,19 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
|||||||
// FACTION ONLINE STATE
|
// FACTION ONLINE STATE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean isAllUPlayersOffline()
|
public boolean isAllMPlayersOffline()
|
||||||
{
|
{
|
||||||
return this.getUPlayersWhereOnline(true).size() == 0;
|
return this.getMPlayersWhereOnline(true).size() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAnyUPlayersOnline()
|
public boolean isAnyMPlayersOnline()
|
||||||
{
|
{
|
||||||
return !this.isAllUPlayersOffline();
|
return !this.isAllMPlayersOffline();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFactionConsideredOffline()
|
public boolean isFactionConsideredOffline()
|
||||||
{
|
{
|
||||||
return this.isAllUPlayersOffline();
|
return this.isAllMPlayersOffline();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFactionConsideredOnline()
|
public boolean isFactionConsideredOnline()
|
||||||
|
@ -50,7 +50,7 @@ public class FactionColl extends Coll<Faction>
|
|||||||
// Example Reason: When creating the special factions for the first time "createSpecialFactions" a clean would be triggered otherwise.
|
// Example Reason: When creating the special factions for the first time "createSpecialFactions" a clean would be triggered otherwise.
|
||||||
if (ret == null && Factions.get().isDatabaseInitialized())
|
if (ret == null && Factions.get().isDatabaseInitialized())
|
||||||
{
|
{
|
||||||
String message = Txt.parse("<b>Non existing factionId <h>%s <b>requested. <i>Cleaning all boards and uplayers.", this.fixId(oid));
|
String message = Txt.parse("<b>Non existing factionId <h>%s <b>requested. <i>Cleaning all boards and mplayers.", this.fixId(oid));
|
||||||
Factions.get().log(message);
|
Factions.get().log(message);
|
||||||
|
|
||||||
BoardColl.get().clean();
|
BoardColl.get().clean();
|
||||||
@ -64,11 +64,11 @@ public class FactionColl extends Coll<Faction>
|
|||||||
// INDEX
|
// INDEX
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void reindexUPlayers()
|
public void reindexMPlayers()
|
||||||
{
|
{
|
||||||
for (Faction faction : this.getAll())
|
for (Faction faction : this.getAll())
|
||||||
{
|
{
|
||||||
faction.reindexUPlayers();
|
faction.reindexMPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public class FactionColl extends Coll<Faction>
|
|||||||
int landCount = faction.getLandCount();
|
int landCount = faction.getLandCount();
|
||||||
if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0)
|
if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0)
|
||||||
{
|
{
|
||||||
List<MPlayer> players = faction.getUPlayers();
|
List<MPlayer> players = faction.getMPlayers();
|
||||||
int playerCount = players.size();
|
int playerCount = players.size();
|
||||||
double reward = econLandReward * landCount / playerCount;
|
double reward = econLandReward * landCount / playerCount;
|
||||||
for (MPlayer player : players)
|
for (MPlayer player : players)
|
||||||
@ -320,11 +320,11 @@ public class FactionColl extends Coll<Faction>
|
|||||||
// INDEX
|
// INDEX
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void reindexUPlayers()
|
public void reindexMPlayers()
|
||||||
{
|
{
|
||||||
for (FactionColl coll : this.getColls())
|
for (FactionColl coll : this.getColls())
|
||||||
{
|
{
|
||||||
coll.reindexUPlayers();
|
coll.reindexMPlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +77,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
// ... update the index.
|
// ... update the index.
|
||||||
Faction faction = this.getFaction();
|
Faction faction = this.getFaction();
|
||||||
faction.uplayers.add(this);
|
faction.mplayers.add(this);
|
||||||
|
|
||||||
//Factions.get().log(Txt.parse("<g>postAttach added <h>%s <i>aka <h>%s <i>to <h>%s <i>aka <h>%s<i>.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName()));
|
//Factions.get().log(Txt.parse("<g>postAttach added <h>%s <i>aka <h>%s <i>to <h>%s <i>aka <h>%s<i>.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName()));
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
// ... update the index.
|
// ... update the index.
|
||||||
Faction faction = this.getFaction();
|
Faction faction = this.getFaction();
|
||||||
faction.uplayers.remove(this);
|
faction.mplayers.remove(this);
|
||||||
|
|
||||||
//Factions.get().log(Txt.parse("<b>preDetach removed <h>%s <i>aka <h>%s <i>to <h>%s <i>aka <h>%s<i>.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName()));
|
//Factions.get().log(Txt.parse("<b>preDetach removed <h>%s <i>aka <h>%s <i>to <h>%s <i>aka <h>%s<i>.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName()));
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
// Null means false
|
// Null means false
|
||||||
private Boolean usingAdminMode = null;
|
private Boolean usingAdminMode = null;
|
||||||
|
|
||||||
// The id for the faction this uplayer is currently autoclaiming for.
|
// The id for the faction this player is currently autoclaiming for.
|
||||||
// NOTE: This field will not be saved to the database ever.
|
// NOTE: This field will not be saved to the database ever.
|
||||||
// Null means the player isn't auto claiming.
|
// Null means the player isn't auto claiming.
|
||||||
private transient Faction autoClaimFaction = null;
|
private transient Faction autoClaimFaction = null;
|
||||||
@ -214,8 +214,8 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
Faction oldFaction = Faction.get(oldFactionId);
|
Faction oldFaction = Faction.get(oldFactionId);
|
||||||
Faction faction = this.getFaction();
|
Faction faction = this.getFaction();
|
||||||
|
|
||||||
if (oldFaction != null) oldFaction.uplayers.remove(this);
|
if (oldFaction != null) oldFaction.mplayers.remove(this);
|
||||||
if (faction != null) faction.uplayers.add(this);
|
if (faction != null) faction.mplayers.add(this);
|
||||||
|
|
||||||
String oldFactionIdDesc = "NULL";
|
String oldFactionIdDesc = "NULL";
|
||||||
String oldFactionNameDesc = "NULL";
|
String oldFactionNameDesc = "NULL";
|
||||||
@ -556,9 +556,9 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
{
|
{
|
||||||
return this.getNameAndTitle(this.getColorTo(faction).toString());
|
return this.getNameAndTitle(this.getColorTo(faction).toString());
|
||||||
}
|
}
|
||||||
public String getNameAndTitle(MPlayer uplayer)
|
public String getNameAndTitle(MPlayer mplayer)
|
||||||
{
|
{
|
||||||
return this.getNameAndTitle(this.getColorTo(uplayer).toString());
|
return this.getNameAndTitle(this.getColorTo(mplayer).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -637,7 +637,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
boolean permanent = myFaction.getFlag(FFlag.PERMANENT);
|
boolean permanent = myFaction.getFlag(FFlag.PERMANENT);
|
||||||
|
|
||||||
if (myFaction.getUPlayers().size() > 1)
|
if (myFaction.getMPlayers().size() > 1)
|
||||||
{
|
{
|
||||||
if (!permanent && this.getRole() == Rel.LEADER)
|
if (!permanent && this.getRole() == Rel.LEADER)
|
||||||
{
|
{
|
||||||
@ -659,9 +659,9 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
if (myFaction.isNormal())
|
if (myFaction.isNormal())
|
||||||
{
|
{
|
||||||
for (MPlayer uplayer : myFaction.getUPlayersWhereOnline(true))
|
for (MPlayer mplayer : myFaction.getMPlayersWhereOnline(true))
|
||||||
{
|
{
|
||||||
uplayer.msg("%s<i> left %s<i>.", this.describeTo(uplayer, true), myFaction.describeTo(uplayer));
|
mplayer.msg("%s<i> left %s<i>.", this.describeTo(mplayer, true), myFaction.describeTo(mplayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MConf.get().logFactionLeave)
|
if (MConf.get().logFactionLeave)
|
||||||
@ -672,7 +672,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
this.resetFactionData();
|
this.resetFactionData();
|
||||||
|
|
||||||
if (myFaction.isNormal() && !permanent && myFaction.getUPlayers().isEmpty())
|
if (myFaction.isNormal() && !permanent && myFaction.getMPlayers().isEmpty())
|
||||||
{
|
{
|
||||||
// Remove this faction
|
// Remove this faction
|
||||||
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
|
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
|
||||||
@ -717,7 +717,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newFaction.getUPlayers().size() < mconf.claimsRequireMinFactionMembers)
|
if (newFaction.getMPlayers().size() < mconf.claimsRequireMinFactionMembers)
|
||||||
{
|
{
|
||||||
msg("Factions must have at least <h>%s<b> members to claim land.", mconf.claimsRequireMinFactionMembers);
|
msg("Factions must have at least <h>%s<b> members to claim land.", mconf.claimsRequireMinFactionMembers);
|
||||||
return false;
|
return false;
|
||||||
@ -804,11 +804,11 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
informees.add(this);
|
informees.add(this);
|
||||||
if (newFaction.isNormal())
|
if (newFaction.isNormal())
|
||||||
{
|
{
|
||||||
informees.addAll(newFaction.getUPlayers());
|
informees.addAll(newFaction.getMPlayers());
|
||||||
}
|
}
|
||||||
if (oldFaction.isNormal())
|
if (oldFaction.isNormal())
|
||||||
{
|
{
|
||||||
informees.addAll(oldFaction.getUPlayers());
|
informees.addAll(oldFaction.getMPlayers());
|
||||||
}
|
}
|
||||||
if (MConf.get().logLandClaims)
|
if (MConf.get().logLandClaims)
|
||||||
{
|
{
|
||||||
|
@ -30,14 +30,14 @@ public class MPlayerColl extends SenderColl<MPlayer>
|
|||||||
public void clean()
|
public void clean()
|
||||||
{
|
{
|
||||||
String universe = this.getUniverse();
|
String universe = this.getUniverse();
|
||||||
for (MPlayer uplayer : this.getAll())
|
for (MPlayer mplayer : this.getAll())
|
||||||
{
|
{
|
||||||
String factionId = uplayer.getFactionId();
|
String factionId = mplayer.getFactionId();
|
||||||
if (FactionColl.get().containsId(factionId)) continue;
|
if (FactionColl.get().containsId(factionId)) continue;
|
||||||
|
|
||||||
uplayer.resetFactionData();
|
mplayer.resetFactionData();
|
||||||
|
|
||||||
String message = Txt.parse("<i>Reset data for <h>%s <i>in <h>%s <i>universe. Unknown factionId <h>%s", uplayer.getDisplayName(IdUtil.getConsole()), universe, factionId);
|
String message = Txt.parse("<i>Reset data for <h>%s <i>in <h>%s <i>universe. Unknown factionId <h>%s", mplayer.getDisplayName(IdUtil.getConsole()), universe, factionId);
|
||||||
Factions.get().log(message);
|
Factions.get().log(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,31 +49,31 @@ public class MPlayerColl extends SenderColl<MPlayer>
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
double toleranceMillis = MConf.get().removePlayerDataAfterInactiveDays * TimeUnit.MILLIS_PER_DAY;
|
double toleranceMillis = MConf.get().removePlayerDataAfterInactiveDays * TimeUnit.MILLIS_PER_DAY;
|
||||||
|
|
||||||
for (MPlayer uplayer : this.getAll())
|
for (MPlayer mplayer : this.getAll())
|
||||||
{
|
{
|
||||||
Long lastPlayed = Mixin.getLastPlayed(uplayer.getId());
|
Long lastPlayed = Mixin.getLastPlayed(mplayer.getId());
|
||||||
if (lastPlayed == null) continue;
|
if (lastPlayed == null) continue;
|
||||||
|
|
||||||
if (uplayer.isOnline()) continue;
|
if (mplayer.isOnline()) continue;
|
||||||
if (now - lastPlayed <= toleranceMillis) continue;
|
if (now - lastPlayed <= toleranceMillis) continue;
|
||||||
|
|
||||||
if (MConf.get().logFactionLeave || MConf.get().logFactionKick)
|
if (MConf.get().logFactionLeave || MConf.get().logFactionKick)
|
||||||
{
|
{
|
||||||
Factions.get().log("Player "+uplayer.getName()+" was auto-removed due to inactivity.");
|
Factions.get().log("Player "+mplayer.getName()+" was auto-removed due to inactivity.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if player is faction leader, sort out the faction since he's going away
|
// if player is faction leader, sort out the faction since he's going away
|
||||||
if (uplayer.getRole() == Rel.LEADER)
|
if (mplayer.getRole() == Rel.LEADER)
|
||||||
{
|
{
|
||||||
Faction faction = uplayer.getFaction();
|
Faction faction = mplayer.getFaction();
|
||||||
if (faction != null)
|
if (faction != null)
|
||||||
{
|
{
|
||||||
uplayer.getFaction().promoteNewLeader();
|
mplayer.getFaction().promoteNewLeader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uplayer.leave();
|
mplayer.leave();
|
||||||
uplayer.detach();
|
mplayer.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,18 +89,18 @@ public class MPlayerColl extends SenderColl<MPlayer>
|
|||||||
if ( ! oldFile.exists()) return;
|
if ( ! oldFile.exists()) return;
|
||||||
|
|
||||||
// Read the file content through GSON.
|
// Read the file content through GSON.
|
||||||
Type type = new TypeToken<Map<String, UPlayer>>(){}.getType();
|
Type type = new TypeToken<Map<String, MPlayer>>(){}.getType();
|
||||||
Map<String, UPlayer> id2uplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
Map<String, MPlayer> id2mplayer = Factions.get().gson.fromJson(DiscUtil.readCatch(oldFile), type);
|
||||||
|
|
||||||
// The Coll
|
// The Coll
|
||||||
UPlayerColl coll = this.getForUniverse(MassiveCore.DEFAULT);
|
MPlayerColl coll = this.getForUniverse(MassiveCore.DEFAULT);
|
||||||
|
|
||||||
// Set the data
|
// Set the data
|
||||||
for (Entry<String, UPlayer> entry : id2uplayer.entrySet())
|
for (Entry<String, MPlayer> entry : id2mplayer.entrySet())
|
||||||
{
|
{
|
||||||
String playerId = entry.getKey();
|
String playerId = entry.getKey();
|
||||||
UPlayer uplayer = entry.getValue();
|
MPlayer mplayer = entry.getValue();
|
||||||
coll.attach(uplayer, playerId);
|
coll.attach(mplayer, playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark as migrated
|
// Mark as migrated
|
||||||
@ -113,7 +113,7 @@ public class MPlayerColl extends SenderColl<MPlayer>
|
|||||||
|
|
||||||
public void clean()
|
public void clean()
|
||||||
{
|
{
|
||||||
for (UPlayerColl coll : this.getColls())
|
for (MPlayerColl coll : this.getColls())
|
||||||
{
|
{
|
||||||
coll.clean();
|
coll.clean();
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ public class EventFactionsInvitedChange extends EventFactionsAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final MPlayer uplayer;
|
private final MPlayer mplayer;
|
||||||
public MPlayer getUPlayer() { return this.uplayer; }
|
public MPlayer getMPlayer() { return this.mplayer; }
|
||||||
|
|
||||||
private final Faction faction;
|
private final Faction faction;
|
||||||
public Faction getFaction() { return this.faction; }
|
public Faction getFaction() { return this.faction; }
|
||||||
@ -34,10 +34,10 @@ public class EventFactionsInvitedChange extends EventFactionsAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public EventFactionsInvitedChange(CommandSender sender, MPlayer uplayer, Faction faction, boolean newInvited)
|
public EventFactionsInvitedChange(CommandSender sender, MPlayer mplayer, Faction faction, boolean newInvited)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.uplayer = uplayer;
|
this.mplayer = mplayer;
|
||||||
this.faction = faction;
|
this.faction = faction;
|
||||||
this.newInvited = newInvited;
|
this.newInvited = newInvited;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender
|
|||||||
super.setCancelled(cancelled);
|
super.setCancelled(cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final MPlayer uplayer;
|
private final MPlayer mplayer;
|
||||||
public MPlayer getUPlayer() { return this.uplayer; }
|
public MPlayer getMPlayer() { return this.mplayer; }
|
||||||
|
|
||||||
private final Faction newFaction;
|
private final Faction newFaction;
|
||||||
public Faction getNewFaction() { return this.newFaction; }
|
public Faction getNewFaction() { return this.newFaction; }
|
||||||
@ -40,10 +40,10 @@ public class EventFactionsMembershipChange extends EventFactionsAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public EventFactionsMembershipChange(CommandSender sender, MPlayer uplayer, Faction newFaction, MembershipChangeReason reason)
|
public EventFactionsMembershipChange(CommandSender sender, MPlayer mplayer, Faction newFaction, MembershipChangeReason reason)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.uplayer = uplayer;
|
this.mplayer = mplayer;
|
||||||
this.newFaction = newFaction;
|
this.newFaction = newFaction;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ public class EventFactionsPowerChange extends EventFactionsAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final MPlayer uplayer;
|
private final MPlayer mplayer;
|
||||||
public MPlayer getUPlayer() { return this.uplayer; }
|
public MPlayer getMPlayer() { return this.mplayer; }
|
||||||
|
|
||||||
private final PowerChangeReason reason;
|
private final PowerChangeReason reason;
|
||||||
public PowerChangeReason getReason() { return this.reason; }
|
public PowerChangeReason getReason() { return this.reason; }
|
||||||
@ -33,12 +33,12 @@ public class EventFactionsPowerChange extends EventFactionsAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public EventFactionsPowerChange(CommandSender sender, MPlayer uplayer, PowerChangeReason reason, double newPower)
|
public EventFactionsPowerChange(CommandSender sender, MPlayer mplayer, PowerChangeReason reason, double newPower)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.uplayer = uplayer;
|
this.mplayer = mplayer;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
this.newPower = uplayer.getLimitedPower(newPower);
|
this.newPower = mplayer.getLimitedPower(newPower);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -19,8 +19,8 @@ public class EventFactionsTitleChange extends EventFactionsAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private final MPlayer uplayer;
|
private final MPlayer mplayer;
|
||||||
public MPlayer getUPlayer() { return this.uplayer; }
|
public MPlayer getMPlayer() { return this.mplayer; }
|
||||||
|
|
||||||
private String newTitle;
|
private String newTitle;
|
||||||
public String getNewTitle() { return this.newTitle; }
|
public String getNewTitle() { return this.newTitle; }
|
||||||
@ -30,10 +30,10 @@ public class EventFactionsTitleChange extends EventFactionsAbstractSender
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public EventFactionsTitleChange(CommandSender sender, MPlayer uplayer, String newTitle)
|
public EventFactionsTitleChange(CommandSender sender, MPlayer mplayer, String newTitle)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.uplayer = uplayer;
|
this.mplayer = mplayer;
|
||||||
this.newTitle = newTitle;
|
this.newTitle = newTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +152,9 @@ public class Econ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<MPlayer> getUPlayers(EconomyParticipator ep)
|
public static Set<MPlayer> getMPlayers(EconomyParticipator ep)
|
||||||
{
|
{
|
||||||
Set<MPlayer> uplayers = new HashSet<MPlayer>();
|
Set<MPlayer> mplayers = new HashSet<MPlayer>();
|
||||||
|
|
||||||
if (ep == null)
|
if (ep == null)
|
||||||
{
|
{
|
||||||
@ -162,22 +162,22 @@ public class Econ
|
|||||||
}
|
}
|
||||||
else if (ep instanceof MPlayer)
|
else if (ep instanceof MPlayer)
|
||||||
{
|
{
|
||||||
uplayers.add((MPlayer)ep);
|
mplayers.add((MPlayer)ep);
|
||||||
}
|
}
|
||||||
else if (ep instanceof Faction)
|
else if (ep instanceof Faction)
|
||||||
{
|
{
|
||||||
uplayers.addAll(((Faction)ep).getUPlayers());
|
mplayers.addAll(((Faction)ep).getMPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
return uplayers;
|
return mplayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
|
public static void sendTransferInfo(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount)
|
||||||
{
|
{
|
||||||
Set<MPlayer> recipients = new HashSet<MPlayer>();
|
Set<MPlayer> recipients = new HashSet<MPlayer>();
|
||||||
recipients.addAll(getUPlayers(invoker));
|
recipients.addAll(getMPlayers(invoker));
|
||||||
recipients.addAll(getUPlayers(from));
|
recipients.addAll(getMPlayers(from));
|
||||||
recipients.addAll(getUPlayers(to));
|
recipients.addAll(getMPlayers(to));
|
||||||
|
|
||||||
if (invoker == null)
|
if (invoker == null)
|
||||||
{
|
{
|
||||||
|
@ -652,11 +652,11 @@ public class EngineDynmap extends EngineAbstract
|
|||||||
|
|
||||||
Set<String> ret = new HashSet<String>();
|
Set<String> ret = new HashSet<String>();
|
||||||
|
|
||||||
for (MPlayer uplayer : faction.getUPlayers())
|
for (MPlayer mplayer : faction.getMPlayers())
|
||||||
{
|
{
|
||||||
// NOTE: We add both UUID and name. This might be a good idea for future proofing.
|
// NOTE: We add both UUID and name. This might be a good idea for future proofing.
|
||||||
ret.add(uplayer.getId());
|
ret.add(mplayer.getId());
|
||||||
ret.add(uplayer.getName());
|
ret.add(mplayer.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -779,22 +779,22 @@ public class EngineDynmap extends EngineAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Players
|
// Players
|
||||||
List<MPlayer> playersList = faction.getUPlayers();
|
List<MPlayer> playersList = faction.getMPlayers();
|
||||||
String playersCount = String.valueOf(playersList.size());
|
String playersCount = String.valueOf(playersList.size());
|
||||||
String players = getPlayerString(playersList);
|
String players = getPlayerString(playersList);
|
||||||
|
|
||||||
MPlayer playersLeaderObject = faction.getLeader();
|
MPlayer playersLeaderObject = faction.getLeader();
|
||||||
String playersLeader = getPlayerName(playersLeaderObject);
|
String playersLeader = getPlayerName(playersLeaderObject);
|
||||||
|
|
||||||
List<MPlayer> playersOfficersList = faction.getUPlayersWhereRole(Rel.OFFICER);
|
List<MPlayer> playersOfficersList = faction.getMPlayersWhereRole(Rel.OFFICER);
|
||||||
String playersOfficersCount = String.valueOf(playersOfficersList.size());
|
String playersOfficersCount = String.valueOf(playersOfficersList.size());
|
||||||
String playersOfficers = getPlayerString(playersOfficersList);
|
String playersOfficers = getPlayerString(playersOfficersList);
|
||||||
|
|
||||||
List<MPlayer> playersMembersList = faction.getUPlayersWhereRole(Rel.MEMBER);
|
List<MPlayer> playersMembersList = faction.getMPlayersWhereRole(Rel.MEMBER);
|
||||||
String playersMembersCount = String.valueOf(playersMembersList.size());
|
String playersMembersCount = String.valueOf(playersMembersList.size());
|
||||||
String playersMembers = getPlayerString(playersMembersList);
|
String playersMembers = getPlayerString(playersMembersList);
|
||||||
|
|
||||||
List<MPlayer> playersRecruitsList = faction.getUPlayersWhereRole(Rel.RECRUIT);
|
List<MPlayer> playersRecruitsList = faction.getMPlayersWhereRole(Rel.RECRUIT);
|
||||||
String playersRecruitsCount = String.valueOf(playersRecruitsList.size());
|
String playersRecruitsCount = String.valueOf(playersRecruitsList.size());
|
||||||
String playersRecruits = getPlayerString(playersRecruitsList);
|
String playersRecruits = getPlayerString(playersRecruitsList);
|
||||||
|
|
||||||
@ -812,21 +812,21 @@ public class EngineDynmap extends EngineAbstract
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPlayerString(List<MPlayer> uplayers)
|
public static String getPlayerString(List<MPlayer> mplayers)
|
||||||
{
|
{
|
||||||
String ret = "";
|
String ret = "";
|
||||||
for (MPlayer uplayer : uplayers)
|
for (MPlayer mplayer : mplayers)
|
||||||
{
|
{
|
||||||
if (ret.length() > 0) ret += ", ";
|
if (ret.length() > 0) ret += ", ";
|
||||||
ret += getPlayerName(uplayer);
|
ret += getPlayerName(mplayer);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPlayerName(MPlayer uplayer)
|
public static String getPlayerName(MPlayer mplayer)
|
||||||
{
|
{
|
||||||
if (uplayer == null) return "none";
|
if (mplayer == null) return "none";
|
||||||
return escapeHtml(uplayer.getName());
|
return escapeHtml(mplayer.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String boolcolor(String string, boolean bool)
|
public static String boolcolor(String string, boolean bool)
|
||||||
|
@ -72,7 +72,7 @@ public class EngineLwc implements Listener
|
|||||||
|
|
||||||
public static void removeAlienProtections(PS chunkPs, Faction faction)
|
public static void removeAlienProtections(PS chunkPs, Faction faction)
|
||||||
{
|
{
|
||||||
List<MPlayer> nonAliens = faction.getUPlayers();
|
List<MPlayer> nonAliens = faction.getMPlayers();
|
||||||
for (Protection protection : getProtectionsInChunk(chunkPs))
|
for (Protection protection : getProtectionsInChunk(chunkPs))
|
||||||
{
|
{
|
||||||
MPlayer owner = MPlayer.get(protection.getOwner());
|
MPlayer owner = MPlayer.get(protection.getOwner());
|
||||||
|
@ -57,12 +57,12 @@ public class FactionsListenerEcon implements Listener
|
|||||||
if (event.getReason() != MembershipChangeReason.LEAVE) return;
|
if (event.getReason() != MembershipChangeReason.LEAVE) return;
|
||||||
|
|
||||||
// ... and that player was the last one in the faction ...
|
// ... and that player was the last one in the faction ...
|
||||||
MPlayer uplayer = event.getUPlayer();
|
MPlayer mplayer = event.getMPlayer();
|
||||||
Faction oldFaction = uplayer.getFaction();
|
Faction oldFaction = mplayer.getFaction();
|
||||||
if (oldFaction.getUPlayers().size() > 1) return;
|
if (oldFaction.getMPlayers().size() > 1) return;
|
||||||
|
|
||||||
// ... then transfer all money to the player.
|
// ... then transfer all money to the player.
|
||||||
Econ.transferMoney(uplayer, oldFaction, uplayer, Money.get(oldFaction));
|
Econ.transferMoney(mplayer, oldFaction, mplayer, Money.get(oldFaction));
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -121,16 +121,16 @@ public class FactionsListenerMain implements Listener
|
|||||||
// CHUNK CHANGE: TERRITORY INFO
|
// CHUNK CHANGE: TERRITORY INFO
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void chunkChangeTerritoryInfo(MPlayer uplayer, Player player, PS chunkFrom, PS chunkTo, Faction factionFrom, Faction factionTo)
|
public void chunkChangeTerritoryInfo(MPlayer mplayer, Player player, PS chunkFrom, PS chunkTo, Faction factionFrom, Faction factionTo)
|
||||||
{
|
{
|
||||||
// send host faction info updates
|
// send host faction info updates
|
||||||
if (uplayer.isMapAutoUpdating())
|
if (mplayer.isMapAutoUpdating())
|
||||||
{
|
{
|
||||||
uplayer.sendMessage(BoardColl.get().getMap(uplayer, chunkTo, player.getLocation().getYaw()));
|
mplayer.sendMessage(BoardColl.get().getMap(mplayer, chunkTo, player.getLocation().getYaw()));
|
||||||
}
|
}
|
||||||
else if (factionFrom != factionTo)
|
else if (factionFrom != factionTo)
|
||||||
{
|
{
|
||||||
String msg = Txt.parse("<i>") + " ~ " + factionTo.getName(uplayer);
|
String msg = Txt.parse("<i>") + " ~ " + factionTo.getName(mplayer);
|
||||||
if (factionTo.hasDescription())
|
if (factionTo.hasDescription())
|
||||||
{
|
{
|
||||||
msg += " - " + factionTo.getDescription();
|
msg += " - " + factionTo.getDescription();
|
||||||
@ -140,24 +140,24 @@ public class FactionsListenerMain implements Listener
|
|||||||
|
|
||||||
// Show access level message if it changed.
|
// Show access level message if it changed.
|
||||||
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(chunkFrom);
|
TerritoryAccess accessFrom = BoardColl.get().getTerritoryAccessAt(chunkFrom);
|
||||||
Boolean hasTerritoryAccessFrom = accessFrom.hasTerritoryAccess(uplayer);
|
Boolean hasTerritoryAccessFrom = accessFrom.hasTerritoryAccess(mplayer);
|
||||||
|
|
||||||
TerritoryAccess accessTo = BoardColl.get().getTerritoryAccessAt(chunkTo);
|
TerritoryAccess accessTo = BoardColl.get().getTerritoryAccessAt(chunkTo);
|
||||||
Boolean hasTerritoryAccessTo = accessTo.hasTerritoryAccess(uplayer);
|
Boolean hasTerritoryAccessTo = accessTo.hasTerritoryAccess(mplayer);
|
||||||
|
|
||||||
if (!MUtil.equals(hasTerritoryAccessFrom, hasTerritoryAccessTo))
|
if (!MUtil.equals(hasTerritoryAccessFrom, hasTerritoryAccessTo))
|
||||||
{
|
{
|
||||||
if (hasTerritoryAccessTo == null)
|
if (hasTerritoryAccessTo == null)
|
||||||
{
|
{
|
||||||
uplayer.msg("<i>You have standard access to this area.");
|
mplayer.msg("<i>You have standard access to this area.");
|
||||||
}
|
}
|
||||||
else if (hasTerritoryAccessTo)
|
else if (hasTerritoryAccessTo)
|
||||||
{
|
{
|
||||||
uplayer.msg("<g>You have elevated access to this area.");
|
mplayer.msg("<g>You have elevated access to this area.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uplayer.msg("<b>You have decreased access to this area.");
|
mplayer.msg("<b>You have decreased access to this area.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,14 +166,14 @@ public class FactionsListenerMain implements Listener
|
|||||||
// CHUNK CHANGE: AUTO CLAIM
|
// CHUNK CHANGE: AUTO CLAIM
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public void chunkChangeAutoClaim(MPlayer uplayer, PS chunkTo)
|
public void chunkChangeAutoClaim(MPlayer mplayer, PS chunkTo)
|
||||||
{
|
{
|
||||||
// If the player is auto claiming ...
|
// If the player is auto claiming ...
|
||||||
Faction autoClaimFaction = uplayer.getAutoClaimFaction();
|
Faction autoClaimFaction = mplayer.getAutoClaimFaction();
|
||||||
if (autoClaimFaction == null) return;
|
if (autoClaimFaction == null) return;
|
||||||
|
|
||||||
// ... try claim.
|
// ... try claim.
|
||||||
uplayer.tryClaim(autoClaimFaction, chunkTo, true, true);
|
mplayer.tryClaim(autoClaimFaction, chunkTo, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -462,10 +462,10 @@ public class FactionsListenerMain implements Listener
|
|||||||
// If a player is trying to run a command ...
|
// If a player is trying to run a command ...
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
MPlayer uplayer = MPlayer.get(player);
|
MPlayer mplayer = MPlayer.get(player);
|
||||||
|
|
||||||
// ... and the player does not have adminmode ...
|
// ... and the player does not have adminmode ...
|
||||||
if (uplayer.isUsingAdminMode()) return;
|
if (mplayer.isUsingAdminMode()) return;
|
||||||
|
|
||||||
// ... clean up the command ...
|
// ... clean up the command ...
|
||||||
String command = event.getMessage();
|
String command = event.getMessage();
|
||||||
@ -474,9 +474,9 @@ public class FactionsListenerMain implements Listener
|
|||||||
command = command.trim();
|
command = command.trim();
|
||||||
|
|
||||||
// ... the command may be denied for members of permanent factions ...
|
// ... the command may be denied for members of permanent factions ...
|
||||||
if (uplayer.hasFaction() && uplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, MConf.get().denyCommandsPermanentFactionMember))
|
if (mplayer.hasFaction() && mplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, MConf.get().denyCommandsPermanentFactionMember))
|
||||||
{
|
{
|
||||||
uplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
|
mplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -487,13 +487,13 @@ public class FactionsListenerMain implements Listener
|
|||||||
if (factionAtPs.isNone()) return; // TODO: An NPE can arise here? Why?
|
if (factionAtPs.isNone()) return; // TODO: An NPE can arise here? Why?
|
||||||
|
|
||||||
// ... the command may be denied in the territory of this relation type ...
|
// ... the command may be denied in the territory of this relation type ...
|
||||||
Rel rel = factionAtPs.getRelationTo(uplayer);
|
Rel rel = factionAtPs.getRelationTo(mplayer);
|
||||||
|
|
||||||
List<String> deniedCommands = MConf.get().denyCommandsTerritoryRelation.get(rel);
|
List<String> deniedCommands = MConf.get().denyCommandsTerritoryRelation.get(rel);
|
||||||
if (deniedCommands == null) return;
|
if (deniedCommands == null) return;
|
||||||
if (!containsCommand(command, deniedCommands)) return;
|
if (!containsCommand(command, deniedCommands)) return;
|
||||||
|
|
||||||
uplayer.msg("<b>You can't use \"<h>/%s<b>\" in %s territory.", command, Txt.getNicedEnum(rel));
|
mplayer.msg("<b>You can't use \"<h>/%s<b>\" in %s territory.", command, Txt.getNicedEnum(rel));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,21 +712,21 @@ public class FactionsListenerMain implements Listener
|
|||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
||||||
|
|
||||||
MPlayer uplayer = MPlayer.get(player);
|
MPlayer mplayer = MPlayer.get(player);
|
||||||
if (uplayer.isUsingAdminMode()) return true;
|
if (mplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
if (!FPerm.BUILD.has(uplayer, ps, false) && FPerm.PAINBUILD.has(uplayer, ps, false))
|
if (!FPerm.BUILD.has(mplayer, ps, false) && FPerm.PAINBUILD.has(mplayer, ps, false))
|
||||||
{
|
{
|
||||||
if (verboose)
|
if (verboose)
|
||||||
{
|
{
|
||||||
Faction hostFaction = BoardColl.get().getFactionAt(ps);
|
Faction hostFaction = BoardColl.get().getFactionAt(ps);
|
||||||
uplayer.msg("<b>It is painful to build in the territory of %s<b>.", hostFaction.describeTo(uplayer));
|
mplayer.msg("<b>It is painful to build in the territory of %s<b>.", hostFaction.describeTo(mplayer));
|
||||||
player.damage(MConf.get().actionDeniedPainAmount);
|
player.damage(MConf.get().actionDeniedPainAmount);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FPerm.BUILD.has(uplayer, ps, verboose);
|
return FPerm.BUILD.has(mplayer, ps, verboose);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
@ -891,10 +891,10 @@ public class FactionsListenerMain implements Listener
|
|||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
|
||||||
|
|
||||||
MPlayer uplayer = MPlayer.get(player);
|
MPlayer mplayer = MPlayer.get(player);
|
||||||
if (uplayer.isUsingAdminMode()) return true;
|
if (mplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
return FPerm.BUILD.has(uplayer, ps, !justCheck);
|
return FPerm.BUILD.has(mplayer, ps, !justCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
|
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
|
||||||
@ -948,7 +948,7 @@ public class FactionsListenerMain implements Listener
|
|||||||
{
|
{
|
||||||
// If a player is respawning ...
|
// If a player is respawning ...
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final MPlayer uplayer = MPlayer.get(player);
|
final MPlayer mplayer = MPlayer.get(player);
|
||||||
|
|
||||||
// ... homes are enabled, active and at this priority ...
|
// ... homes are enabled, active and at this priority ...
|
||||||
if (!MConf.get().homesEnabled) return;
|
if (!MConf.get().homesEnabled) return;
|
||||||
@ -956,7 +956,7 @@ public class FactionsListenerMain implements Listener
|
|||||||
if (MConf.get().homesTeleportToOnDeathPriority != priority) return;
|
if (MConf.get().homesTeleportToOnDeathPriority != priority) return;
|
||||||
|
|
||||||
// ... and the player has a faction ...
|
// ... and the player has a faction ...
|
||||||
final Faction faction = uplayer.getFaction();
|
final Faction faction = mplayer.getFaction();
|
||||||
if (faction.isNone()) return;
|
if (faction.isNone()) return;
|
||||||
|
|
||||||
// ... and the faction has a home ...
|
// ... and the faction has a home ...
|
||||||
|
@ -4,9 +4,9 @@ import com.massivecraft.factions.entity.MPlayer;
|
|||||||
|
|
||||||
public interface PowerMixin
|
public interface PowerMixin
|
||||||
{
|
{
|
||||||
public double getMaxUniversal(MPlayer uplayer);
|
public double getMaxUniversal(MPlayer mplayer);
|
||||||
public double getMax(MPlayer uplayer);
|
public double getMax(MPlayer mplayer);
|
||||||
public double getMin(MPlayer uplayer);
|
public double getMin(MPlayer mplayer);
|
||||||
public double getPerHour(MPlayer uplayer);
|
public double getPerHour(MPlayer mplayer);
|
||||||
public double getPerDeath(MPlayer uplayer);
|
public double getPerDeath(MPlayer mplayer);
|
||||||
}
|
}
|
||||||
|
@ -40,18 +40,18 @@ public class RelationUtil
|
|||||||
}
|
}
|
||||||
else if (that instanceof MPlayer)
|
else if (that instanceof MPlayer)
|
||||||
{
|
{
|
||||||
MPlayer uplayerthat = (MPlayer) that;
|
MPlayer mplayerthat = (MPlayer) that;
|
||||||
if (that == me)
|
if (that == me)
|
||||||
{
|
{
|
||||||
ret = "you";
|
ret = "you";
|
||||||
}
|
}
|
||||||
else if (thatFaction == myFaction)
|
else if (thatFaction == myFaction)
|
||||||
{
|
{
|
||||||
ret = uplayerthat.getNameAndTitle(myFaction);
|
ret = mplayerthat.getNameAndTitle(myFaction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = uplayerthat.getNameAndFactionName();
|
ret = mplayerthat.getNameAndFactionName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user