Quickfixed everything easy.
This commit is contained in:
parent
9fc75b1fcf
commit
61e8730495
@ -8,6 +8,8 @@ import java.util.Map;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ChatFormater is a system offered by factions for tag parsing.
|
* The ChatFormater is a system offered by factions for tag parsing.
|
||||||
*
|
*
|
||||||
@ -100,7 +102,7 @@ public class ChatFormatter
|
|||||||
// FORMAT
|
// FORMAT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static String format(String msg, String senderId, String sendeeId, String recipientId)
|
public static String format(String msg, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
// We build the return value in this string buffer
|
// We build the return value in this string buffer
|
||||||
StringBuffer ret = new StringBuffer();
|
StringBuffer ret = new StringBuffer();
|
||||||
@ -135,7 +137,7 @@ public class ChatFormatter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
replacement = compute(tag, modifierIds, senderId, sendeeId, recipientId);
|
replacement = compute(tag, modifierIds, fsender, frecipient);
|
||||||
if (replacement == null)
|
if (replacement == null)
|
||||||
{
|
{
|
||||||
// If a tag or modifier returns null it's the same as opting out.
|
// If a tag or modifier returns null it's the same as opting out.
|
||||||
@ -157,9 +159,9 @@ public class ChatFormatter
|
|||||||
// TAG COMPUTE
|
// TAG COMPUTE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static String compute(ChatTag tag, List<String> modifierIds, String senderId, String sendeeId, String recipientId)
|
public static String compute(ChatTag tag, List<String> modifierIds, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
String ret = tag.getReplacement(senderId, sendeeId, recipientId);
|
String ret = tag.getReplacement(fsender, frecipient);
|
||||||
if (ret == null) return null;
|
if (ret == null) return null;
|
||||||
|
|
||||||
for (String modifierId : modifierIds)
|
for (String modifierId : modifierIds)
|
||||||
@ -170,7 +172,7 @@ public class ChatFormatter
|
|||||||
|
|
||||||
// Modify and ignore change if null.
|
// Modify and ignore change if null.
|
||||||
// Modifier can't get or return null.
|
// Modifier can't get or return null.
|
||||||
String modified = modifier.getModified(ret, senderId, sendeeId, recipientId);
|
String modified = modifier.getModified(ret, fsender, frecipient);
|
||||||
if (modified == null) continue;
|
if (modified == null) continue;
|
||||||
|
|
||||||
ret = modified;
|
ret = modified;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.massivecraft.factions.chat;
|
package com.massivecraft.factions.chat;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
|
|
||||||
public interface ChatModifier
|
public interface ChatModifier
|
||||||
{
|
{
|
||||||
public String getId();
|
public String getId();
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId);
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient);
|
||||||
public boolean register();
|
public boolean register();
|
||||||
public boolean unregister();
|
public boolean unregister();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.massivecraft.factions.chat;
|
package com.massivecraft.factions.chat;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
public interface ChatTag
|
public interface ChatTag
|
||||||
{
|
{
|
||||||
public String getId();
|
public String getId();
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId);
|
public String getReplacement(FPlayer fsender, FPlayer frecipient);
|
||||||
public boolean register();
|
public boolean register();
|
||||||
public boolean unregister();
|
public boolean unregister();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.chat.modifier;
|
package com.massivecraft.factions.chat.modifier;
|
||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
public class ChatModifierLc extends ChatModifierAbstract
|
public class ChatModifierLc extends ChatModifierAbstract
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ public class ChatModifierLc extends ChatModifierAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId)
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
return subject.toLowerCase();
|
return subject.toLowerCase();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.chat.modifier;
|
package com.massivecraft.factions.chat.modifier;
|
||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
|
|
||||||
public class ChatModifierLp extends ChatModifierAbstract
|
public class ChatModifierLp extends ChatModifierAbstract
|
||||||
@ -18,7 +19,7 @@ public class ChatModifierLp extends ChatModifierAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId)
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
if (subject.equals("")) return subject;
|
if (subject.equals("")) return subject;
|
||||||
return " "+subject;
|
return " "+subject;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.chat.modifier;
|
package com.massivecraft.factions.chat.modifier;
|
||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class ChatModifierParse extends ChatModifierAbstract
|
public class ChatModifierParse extends ChatModifierAbstract
|
||||||
@ -18,7 +19,7 @@ public class ChatModifierParse extends ChatModifierAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId)
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
return Txt.parse(subject);
|
return Txt.parse(subject);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.chat.modifier;
|
package com.massivecraft.factions.chat.modifier;
|
||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
public class ChatModifierRp extends ChatModifierAbstract
|
public class ChatModifierRp extends ChatModifierAbstract
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ public class ChatModifierRp extends ChatModifierAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId)
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
if (subject.equals("")) return subject;
|
if (subject.equals("")) return subject;
|
||||||
return subject+" ";
|
return subject+" ";
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.chat.modifier;
|
package com.massivecraft.factions.chat.modifier;
|
||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
|
|
||||||
public class ChatModifierUc extends ChatModifierAbstract
|
public class ChatModifierUc extends ChatModifierAbstract
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ public class ChatModifierUc extends ChatModifierAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId)
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
return subject.toUpperCase();
|
return subject.toUpperCase();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.chat.modifier;
|
package com.massivecraft.factions.chat.modifier;
|
||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
import com.massivecraft.factions.chat.ChatModifierAbstract;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class ChatModifierUcf extends ChatModifierAbstract
|
public class ChatModifierUcf extends ChatModifierAbstract
|
||||||
@ -18,7 +19,7 @@ public class ChatModifierUcf extends ChatModifierAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModified(String subject, String senderId, String sendeeId, String recipientId)
|
public String getModified(String subject, FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
return Txt.upperCaseFirst(subject);
|
return Txt.upperCaseFirst(subject);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
|
|
||||||
public class ChatTagRelcolor extends ChatTagAbstract
|
public class ChatTagRelcolor extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
@ -19,14 +18,8 @@ public class ChatTagRelcolor extends ChatTagAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId)
|
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
if (senderId == null) return "";
|
|
||||||
if (recipientId == null) return "";
|
|
||||||
|
|
||||||
FPlayer fsender = FPlayerColl.get().get(senderId);
|
|
||||||
FPlayer frecipient = FPlayerColl.get().get(recipientId);
|
|
||||||
|
|
||||||
if (fsender == null) return "";
|
if (fsender == null) return "";
|
||||||
if (frecipient == null) return "";
|
if (frecipient == null) return "";
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class ChatTagRole extends ChatTagAbstract
|
public class ChatTagRole extends ChatTagAbstract
|
||||||
@ -20,9 +19,8 @@ public class ChatTagRole extends ChatTagAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId)
|
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
FPlayer fsender = FPlayerColl.get().get(senderId);
|
|
||||||
return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase());
|
return Txt.upperCaseFirst(fsender.getRole().toString().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
|
|
||||||
public class ChatTagRoleprefix extends ChatTagAbstract
|
public class ChatTagRoleprefix extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
@ -19,9 +18,8 @@ public class ChatTagRoleprefix extends ChatTagAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId)
|
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
FPlayer fsender = FPlayerColl.get().get(senderId);
|
|
||||||
return fsender.getRole().getPrefix();
|
return fsender.getRole().getPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
|
|
||||||
public class ChatTagTag extends ChatTagAbstract
|
public class ChatTagTag extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
@ -19,9 +18,8 @@ public class ChatTagTag extends ChatTagAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId)
|
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
FPlayer fsender = FPlayerColl.get().get(senderId);
|
|
||||||
if (!fsender.hasFaction()) return "";
|
if (!fsender.hasFaction()) return "";
|
||||||
return fsender.getFaction().getTag();
|
return fsender.getFaction().getTag();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
|
|
||||||
public class ChatTagTagforce extends ChatTagAbstract
|
public class ChatTagTagforce extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
@ -19,9 +18,8 @@ public class ChatTagTagforce extends ChatTagAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId)
|
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
FPlayer fsender = FPlayerColl.get().get(senderId);
|
|
||||||
return fsender.getFaction().getTag();
|
return fsender.getFaction().getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.chat.tag;
|
|||||||
|
|
||||||
import com.massivecraft.factions.chat.ChatTagAbstract;
|
import com.massivecraft.factions.chat.ChatTagAbstract;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
|
|
||||||
public class ChatTagTitle extends ChatTagAbstract
|
public class ChatTagTitle extends ChatTagAbstract
|
||||||
{
|
{
|
||||||
@ -19,9 +18,8 @@ public class ChatTagTitle extends ChatTagAbstract
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReplacement(String senderId, String sendeeId, String recipientId)
|
public String getReplacement(FPlayer fsender, FPlayer frecipient)
|
||||||
{
|
{
|
||||||
FPlayer fsender = FPlayerColl.get().get(sendeeId);
|
|
||||||
return fsender.getTitle();
|
return fsender.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,14 +73,14 @@ public class CmdFactionsAccess extends FCommand
|
|||||||
|
|
||||||
if (doPlayer)
|
if (doPlayer)
|
||||||
{
|
{
|
||||||
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(), fme);
|
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(fme), fme);
|
||||||
if (targetPlayer == null) return;
|
if (targetPlayer == null) return;
|
||||||
added = territory.toggleFPlayer(targetPlayer);
|
added = territory.toggleFPlayer(targetPlayer);
|
||||||
target = "Player \""+targetPlayer.getName()+"\"";
|
target = "Player \""+targetPlayer.getName()+"\"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Faction targetFaction = this.arg(1, ARFaction.get(), myFaction);
|
Faction targetFaction = this.arg(1, ARFaction.get(myFaction), myFaction);
|
||||||
if (targetFaction == null) return;
|
if (targetFaction == null) return;
|
||||||
added = territory.toggleFaction(targetFaction);
|
added = territory.toggleFaction(targetFaction);
|
||||||
target = "Faction \""+targetFaction.getTag()+"\"";
|
target = "Faction \""+targetFaction.getTag()+"\"";
|
||||||
|
@ -23,7 +23,7 @@ public class CmdFactionsAutoClaim extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction forFaction = this.arg(0, ARFaction.get(), myFaction);
|
Faction forFaction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||||
if (forFaction == null || forFaction == fme.getAutoClaimFor())
|
if (forFaction == null || forFaction == fme.getAutoClaimFor())
|
||||||
{
|
{
|
||||||
fme.setAutoClaimFor(null);
|
fme.setAutoClaimFor(null);
|
||||||
|
@ -30,7 +30,7 @@ public abstract class CmdFactionsCapeAbstract extends FCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.capeFaction = this.arg(this.requiredArgs.size(), ARFaction.get(), this.myFaction);
|
this.capeFaction = this.arg(this.requiredArgs.size(), ARFaction.get(myFaction), myFaction);
|
||||||
if (this.capeFaction == null) return false;
|
if (this.capeFaction == null) return false;
|
||||||
|
|
||||||
// Do we have permission to manage the cape of that faction?
|
// Do we have permission to manage the cape of that faction?
|
||||||
|
@ -28,7 +28,7 @@ public class CmdFactionsClaim extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
final Faction forFaction = this.arg(0, ARFaction.get());
|
final Faction forFaction = this.arg(0, ARFaction.get(me));
|
||||||
if (forFaction == null) return;
|
if (forFaction == null) return;
|
||||||
|
|
||||||
Integer radius = this.arg(1, ARInteger.get(), 1);
|
Integer radius = this.arg(1, ARInteger.get(), 1);
|
||||||
|
@ -6,9 +6,10 @@ 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.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
import com.massivecraft.factions.entity.FPlayerColls;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.event.FactionsEventCreate;
|
import com.massivecraft.factions.event.FactionsEventCreate;
|
||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
||||||
@ -39,7 +40,9 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FactionColl.get().isTagTaken(newTag))
|
FactionColl coll = FactionColls.get().get(fme);
|
||||||
|
|
||||||
|
if (coll.isTagTaken(newTag))
|
||||||
{
|
{
|
||||||
msg("<b>That tag is already in use.");
|
msg("<b>That tag is already in use.");
|
||||||
return;
|
return;
|
||||||
@ -53,15 +56,15 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pre-Generate Id
|
// Pre-Generate Id
|
||||||
String factionId = FactionColl.get().getIdStrategy().generate(FactionColl.get());
|
String factionId = coll.getIdStrategy().generate(coll);
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
FactionsEventCreate createEvent = new FactionsEventCreate(sender, newTag, factionId);
|
FactionsEventCreate createEvent = new FactionsEventCreate(sender, coll.getUniverse(), factionId, newTag);
|
||||||
createEvent.run();
|
createEvent.run();
|
||||||
if (createEvent.isCancelled()) return;
|
if (createEvent.isCancelled()) return;
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
Faction faction = FactionColl.get().create(factionId);
|
Faction faction = coll.create(factionId);
|
||||||
faction.setTag(newTag);
|
faction.setTag(newTag);
|
||||||
|
|
||||||
fme.setRole(Rel.LEADER);
|
fme.setRole(Rel.LEADER);
|
||||||
@ -72,7 +75,7 @@ public class CmdFactionsCreate extends FCommand
|
|||||||
// NOTE: join event cannot be cancelled or you'll have an empty faction
|
// NOTE: join event cannot be cancelled or you'll have an empty faction
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
for (FPlayer follower : FPlayerColl.get().getAllOnline())
|
for (FPlayer follower : FPlayerColls.get().get(fme).getAllOnline())
|
||||||
{
|
{
|
||||||
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower));
|
follower.msg("%s<i> created a new faction %s", fme.describeTo(follower, true), faction.getTag(follower));
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class CmdFactionsDemote extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny());
|
FPlayer you = this.arg(0, ARFPlayer.getStartAny(fme));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
if (you.getFaction() != myFaction)
|
if (you.getFaction() != myFaction)
|
||||||
|
@ -2,9 +2,9 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
import com.massivecraft.factions.entity.FPlayerColls;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.event.FactionsEventDisband;
|
import com.massivecraft.factions.event.FactionsEventDisband;
|
||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
||||||
@ -33,7 +33,7 @@ public class CmdFactionsDisband extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
Faction faction = this.arg(0, ARFaction.get(), myFaction);
|
Faction faction = this.arg(0, ARFaction.get(fme), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
// FPerm
|
// FPerm
|
||||||
@ -56,12 +56,12 @@ public class CmdFactionsDisband extends FCommand
|
|||||||
// Send FPlayerLeaveEvent for each player in the faction
|
// Send FPlayerLeaveEvent for each player in the faction
|
||||||
for (FPlayer fplayer : faction.getFPlayers())
|
for (FPlayer fplayer : faction.getFPlayers())
|
||||||
{
|
{
|
||||||
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fplayer, FactionColl.get().getNone(), MembershipChangeReason.DISBAND);
|
FactionsEventMembershipChange membershipChangeEvent = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(faction).getNone(), MembershipChangeReason.DISBAND);
|
||||||
membershipChangeEvent.run();
|
membershipChangeEvent.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform all players
|
// Inform all players
|
||||||
for (FPlayer fplayer : FPlayerColl.get().getAllOnline())
|
for (FPlayer fplayer : FPlayerColls.get().get(fme).getAllOnline())
|
||||||
{
|
{
|
||||||
String who = fme.describeTo(fplayer);
|
String who = fme.describeTo(fplayer);
|
||||||
if (fplayer.getFaction() == faction)
|
if (fplayer.getFaction() == faction)
|
||||||
|
@ -26,7 +26,7 @@ public class CmdFactionsFlag extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction faction = this.arg(0, ARFaction.get(), myFaction);
|
Faction faction = this.arg(0, ARFaction.get(sender), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
if ( ! this.argIsSet(1))
|
if ( ! this.argIsSet(1))
|
||||||
|
@ -12,7 +12,6 @@ import com.massivecraft.factions.Rel;
|
|||||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||||
import com.massivecraft.factions.entity.BoardColls;
|
import com.massivecraft.factions.entity.BoardColls;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
|
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
|
||||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||||
@ -100,7 +99,7 @@ public class CmdFactionsHome extends FCommand
|
|||||||
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
|
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FPlayer fp = FPlayerColl.get().get(p);
|
FPlayer fp = FPlayer.get(p);
|
||||||
if (fme.getRelationTo(fp) != Rel.ENEMY)
|
if (fme.getRelationTo(fp) != Rel.ENEMY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class CmdFactionsInvite extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny());
|
FPlayer fplayer = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||||
if (fplayer == null) return;
|
if (fplayer == null) return;
|
||||||
|
|
||||||
Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(fplayer));
|
Boolean newInvited = this.arg(1, ARBoolean.get(), !myFaction.isInvited(fplayer));
|
||||||
|
@ -28,10 +28,10 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
Faction faction = this.arg(0, ARFaction.get());
|
Faction faction = this.arg(0, ARFaction.get(sender));
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(), fme);
|
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender), fme);
|
||||||
if (fplayer == null) return;
|
if (fplayer == null) return;
|
||||||
|
|
||||||
boolean samePlayer = fplayer == fme;
|
boolean samePlayer = fplayer == fme;
|
||||||
|
@ -8,7 +8,7 @@ import com.massivecraft.factions.Rel;
|
|||||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
||||||
@ -30,7 +30,7 @@ public class CmdFactionsKick extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Arg
|
// Arg
|
||||||
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny());
|
FPlayer fplayer = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||||
if (fplayer == null) return;
|
if (fplayer == null) return;
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
@ -58,7 +58,7 @@ public class CmdFactionsKick extends FCommand
|
|||||||
if (!FPerm.KICK.has(sender, fplayerFaction)) return;
|
if (!FPerm.KICK.has(sender, fplayerFaction)) return;
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, fplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
|
FactionsEventMembershipChange event = new FactionsEventMembershipChange(sender, fplayer, FactionColls.get().get(fplayer).getNone(), MembershipChangeReason.KICK);
|
||||||
event.run();
|
event.run();
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import com.massivecraft.factions.Rel;
|
|||||||
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
import com.massivecraft.factions.cmd.arg.ARFPlayer;
|
||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
import com.massivecraft.factions.entity.FPlayerColls;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange;
|
||||||
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
|
||||||
@ -28,10 +28,10 @@ public class CmdFactionsLeader extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny());
|
FPlayer newLeader = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||||
if (newLeader == null) return;
|
if (newLeader == null) return;
|
||||||
|
|
||||||
Faction targetFaction = this.arg(1, ARFaction.get(), myFaction);
|
Faction targetFaction = this.arg(1, ARFaction.get(sender), myFaction);
|
||||||
if (targetFaction == null) return;
|
if (targetFaction == null) return;
|
||||||
|
|
||||||
FPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
FPlayer targetFactionCurrentLeader = targetFaction.getLeader();
|
||||||
@ -90,7 +90,7 @@ public class CmdFactionsLeader extends FCommand
|
|||||||
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(fme, true));
|
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(fme, true));
|
||||||
|
|
||||||
// Inform all players
|
// Inform all players
|
||||||
for (FPlayer fplayer : FPlayerColl.get().getAllOnline())
|
for (FPlayer fplayer : FPlayerColls.get().get(sender).getAllOnline())
|
||||||
{
|
{
|
||||||
fplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, fplayer, true), newLeader.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
fplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(fme, fplayer, true), newLeader.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
import com.massivecraft.factions.FactionListComparator;
|
import com.massivecraft.factions.FactionListComparator;
|
||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
||||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
@ -33,7 +33,7 @@ public class CmdFactionsList extends FCommand
|
|||||||
// Create Messages
|
// Create Messages
|
||||||
List<String> lines = new ArrayList<String>();
|
List<String> lines = new ArrayList<String>();
|
||||||
|
|
||||||
ArrayList<Faction> factionList = new ArrayList<Faction>(FactionColl.get().getAll(null, FactionListComparator.get()));
|
ArrayList<Faction> factionList = new ArrayList<Faction>(FactionColls.get().get(sender).getAll(null, FactionListComparator.get()));
|
||||||
|
|
||||||
final int pageheight = 9;
|
final int pageheight = 9;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class CmdFactionsList extends FCommand
|
|||||||
{
|
{
|
||||||
if (faction.isNone())
|
if (faction.isNone())
|
||||||
{
|
{
|
||||||
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColl.get().getNone().getFPlayersWhereOnline(true).size()));
|
lines.add(Txt.parse("<i>Factionless<i> %d online", FactionColls.get().get(sender).getNone().getFPlayersWhereOnline(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",
|
||||||
|
@ -22,7 +22,7 @@ public class CmdFactionsMoneyBalance extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction faction = this.arg(0, ARFaction.get(), myFaction);
|
Faction faction = this.arg(0, ARFaction.get(sender), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
if (faction != myFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
|
if (faction != myFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
|
||||||
|
@ -35,7 +35,7 @@ public class CmdFactionsMoneyDeposit extends FCommand
|
|||||||
Double amount = this.arg(0, ARDouble.get());
|
Double amount = this.arg(0, ARDouble.get());
|
||||||
if (amount == null) return;
|
if (amount == null) return;
|
||||||
|
|
||||||
Faction faction = this.arg(1, ARFaction.get(), myFaction);
|
Faction faction = this.arg(1, ARFaction.get(sender), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(fme, fme, faction, amount);
|
boolean success = Econ.transferMoney(fme, fme, faction, amount);
|
||||||
|
@ -35,10 +35,10 @@ public class CmdFactionsMoneyTransferFf extends FCommand
|
|||||||
Double amount = this.arg(0, ARDouble.get());
|
Double amount = this.arg(0, ARDouble.get());
|
||||||
if (amount == null) return;
|
if (amount == null) return;
|
||||||
|
|
||||||
Faction from = this.arg(1, ARFaction.get());
|
Faction from = this.arg(1, ARFaction.get(sender));
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
Faction to = this.arg(2, ARFaction.get());
|
Faction to = this.arg(2, ARFaction.get(sender));
|
||||||
if (to == null) return;
|
if (to == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
@ -37,10 +37,10 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
|||||||
Double amount = this.arg(0, ARDouble.get());
|
Double amount = this.arg(0, ARDouble.get());
|
||||||
if (amount == null) return;
|
if (amount == null) return;
|
||||||
|
|
||||||
Faction from = this.arg(1, ARFaction.get());
|
Faction from = this.arg(1, ARFaction.get(sender));
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
FPlayer to = this.arg(2, ARFPlayer.getStartAny());
|
FPlayer to = this.arg(2, ARFPlayer.getStartAny(sender));
|
||||||
if (to == null) return;
|
if (to == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
@ -37,10 +37,10 @@ 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;
|
||||||
|
|
||||||
FPlayer from = this.arg(1, ARFPlayer.getStartAny());
|
FPlayer from = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
Faction to = this.arg(2, ARFaction.get());
|
Faction to = this.arg(2, ARFaction.get(sender));
|
||||||
if (to == null) return;
|
if (to == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(fme, from, to, amount);
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.Perm;
|
import com.massivecraft.factions.Perm;
|
||||||
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.FPlayer;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
@ -34,14 +35,16 @@ public class CmdFactionsMoneyWithdraw extends FCommand
|
|||||||
Double amount = this.arg(0, ARDouble.get());
|
Double amount = this.arg(0, ARDouble.get());
|
||||||
if (amount == null) return;
|
if (amount == null) return;
|
||||||
|
|
||||||
Faction faction = this.arg(1, ARFaction.get(), myFaction);
|
Faction from = this.arg(1, ARFaction.get(sender), myFaction);
|
||||||
if (faction == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(fme, faction, fme, amount);
|
FPlayer to = fme;
|
||||||
|
|
||||||
|
boolean success = Econ.transferMoney(fme, from, to, amount);
|
||||||
|
|
||||||
if (success && MConf.get().logMoneyTransactions)
|
if (success && MConf.get().logMoneyTransactions)
|
||||||
{
|
{
|
||||||
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(faction, amount), faction.describeTo(null))));
|
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(from, amount), from.describeTo(null))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class CmdFactionsOfficer extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny());
|
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||||
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,8 +3,6 @@ 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.req.ReqRoleIsAtLeast;
|
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
|
||||||
import com.massivecraft.factions.event.FactionsEventOpenChange;
|
import com.massivecraft.factions.event.FactionsEventOpenChange;
|
||||||
import com.massivecraft.mcore.cmd.arg.ARBoolean;
|
import com.massivecraft.mcore.cmd.arg.ARBoolean;
|
||||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||||
@ -40,14 +38,6 @@ public class CmdFactionsOpen extends FCommand
|
|||||||
// Inform
|
// Inform
|
||||||
String descTarget = myFaction.isOpen() ? "open" : "closed";
|
String descTarget = myFaction.isOpen() ? "open" : "closed";
|
||||||
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), descTarget);
|
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), descTarget);
|
||||||
for (Faction faction : FactionColl.get().getAll())
|
|
||||||
{
|
|
||||||
if (faction == myFaction)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
faction.msg("<i>The faction %s<i> is now %s", myFaction.getTag(faction), descTarget);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class CmdFactionsPerm extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction faction = this.arg(0, ARFaction.get(), myFaction);
|
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
if ( ! this.argIsSet(1))
|
if ( ! this.argIsSet(1))
|
||||||
|
@ -20,7 +20,7 @@ public class CmdFactionsPower extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
FPlayer target = this.arg(0, ARFPlayer.getStartAny(), fme);
|
FPlayer target = this.arg(0, ARFPlayer.getStartAny(fme), fme);
|
||||||
if (target == null) return;
|
if (target == null) return;
|
||||||
|
|
||||||
if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return;
|
if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return;
|
||||||
|
@ -45,7 +45,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
|||||||
|
|
||||||
if (doPlayer)
|
if (doPlayer)
|
||||||
{
|
{
|
||||||
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny());
|
FPlayer targetPlayer = this.arg(1, ARFPlayer.getStartAny(sender));
|
||||||
if (targetPlayer == null) return;
|
if (targetPlayer == null) return;
|
||||||
|
|
||||||
targetPlayer.setPowerBoost(targetPower);
|
targetPlayer.setPowerBoost(targetPower);
|
||||||
@ -53,7 +53,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Faction targetFaction = this.arg(1, ARFaction.get());
|
Faction targetFaction = this.arg(1, ARFaction.get(sender));
|
||||||
if (targetFaction == null) return;
|
if (targetFaction == null) return;
|
||||||
|
|
||||||
targetFaction.setPowerBoost(targetPower);
|
targetFaction.setPowerBoost(targetPower);
|
||||||
|
@ -25,7 +25,7 @@ public class CmdFactionsPromote extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny());
|
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
if (you.getFaction() != myFaction)
|
if (you.getFaction() != myFaction)
|
||||||
|
@ -27,7 +27,7 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
Faction otherFaction = this.arg(0, ARFaction.get());
|
Faction otherFaction = this.arg(0, ARFaction.get(sender));
|
||||||
if (otherFaction == null) return;
|
if (otherFaction == null) return;
|
||||||
|
|
||||||
Rel newRelation = targetRelation;
|
Rel newRelation = targetRelation;
|
||||||
|
@ -34,7 +34,7 @@ public class CmdFactionsSethome extends FCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Args
|
// Args
|
||||||
Faction faction = this.arg(0, ARFaction.get(), myFaction);
|
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
PS newHome = PS.valueOf(me.getLocation());
|
PS newHome = PS.valueOf(me.getLocation());
|
||||||
|
@ -32,7 +32,7 @@ public class CmdFactionsShow extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
Faction faction = this.arg(0, ARFaction.get(), myFaction);
|
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
Collection<FPlayer> leaders = faction.getFPlayersWhereRole(Rel.LEADER);
|
Collection<FPlayer> leaders = faction.getFPlayersWhereRole(Rel.LEADER);
|
||||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.Rel;
|
|||||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.factions.event.FactionsEventTagChange;
|
import com.massivecraft.factions.event.FactionsEventTagChange;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
@ -33,7 +34,7 @@ public class CmdFactionsTag extends FCommand
|
|||||||
String newTag = this.arg(0);
|
String newTag = this.arg(0);
|
||||||
|
|
||||||
// TODO does not first test cover selfcase?
|
// TODO does not first test cover selfcase?
|
||||||
if (FactionColl.get().isTagTaken(newTag) && ! MiscUtil.getComparisonString(newTag).equals(myFaction.getComparisonTag()))
|
if (FactionColls.get().get(myFaction).isTagTaken(newTag) && ! MiscUtil.getComparisonString(newTag).equals(myFaction.getComparisonTag()))
|
||||||
{
|
{
|
||||||
msg("<b>That tag is already taken");
|
msg("<b>That tag is already taken");
|
||||||
return;
|
return;
|
||||||
@ -59,7 +60,7 @@ public class CmdFactionsTag extends FCommand
|
|||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
myFaction.msg("%s<i> changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
|
myFaction.msg("%s<i> changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
|
||||||
for (Faction faction : FactionColl.get().getAll())
|
for (Faction faction : FactionColls.get().get(myFaction).getAll())
|
||||||
{
|
{
|
||||||
if (faction == myFaction)
|
if (faction == myFaction)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ public class CmdFactionsTitle extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
FPlayer you = this.arg(0, ARFPlayer.getStartAny());
|
FPlayer you = this.arg(0, ARFPlayer.getStartAny(sender));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Rel;
|
import com.massivecraft.factions.Rel;
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.mcore.cmd.MCommand;
|
import com.massivecraft.mcore.cmd.MCommand;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
@ -15,7 +14,7 @@ public abstract class FCommand extends MCommand
|
|||||||
@Override
|
@Override
|
||||||
public void fixSenderVars()
|
public void fixSenderVars()
|
||||||
{
|
{
|
||||||
this.fme = FPlayerColl.get().get(this.sender);
|
this.fme = FPlayer.get(this.sender);
|
||||||
this.myFaction = this.fme.getFaction();
|
this.myFaction = this.fme.getFaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd.arg;
|
package com.massivecraft.factions.cmd.arg;
|
||||||
|
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
import com.massivecraft.factions.entity.FPlayerColls;
|
||||||
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
|
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
|
||||||
import com.massivecraft.mcore.cmd.arg.ArgReader;
|
import com.massivecraft.mcore.cmd.arg.ArgReader;
|
||||||
|
|
||||||
@ -11,16 +11,12 @@ public class ARFPlayer
|
|||||||
// INSTANCE
|
// INSTANCE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static ArgReader<FPlayer> fullAny = ARSenderEntity.getFullAny(FPlayerColl.get());
|
public static ArgReader<FPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(FPlayerColls.get().get(o)); }
|
||||||
public static ArgReader<FPlayer> getFullAny() { return fullAny; }
|
|
||||||
|
|
||||||
private static ArgReader<FPlayer> startAny = ARSenderEntity.getStartAny(FPlayerColl.get());
|
public static ArgReader<FPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(FPlayerColls.get().get(o)); }
|
||||||
public static ArgReader<FPlayer> getStartAny() { return startAny; }
|
|
||||||
|
|
||||||
private static ArgReader<FPlayer> fullOnline = ARSenderEntity.getFullOnline(FPlayerColl.get());
|
public static ArgReader<FPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(FPlayerColls.get().get(o)); }
|
||||||
public static ArgReader<FPlayer> getFullOnline() { return fullOnline; }
|
|
||||||
|
|
||||||
private static ArgReader<FPlayer> startOnline = ARSenderEntity.getStartOnline(FPlayerColl.get());
|
public static ArgReader<FPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(FPlayerColls.get().get(o)); }
|
||||||
public static ArgReader<FPlayer> getStartOnline() { return startOnline; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,10 @@ package com.massivecraft.factions.cmd.arg;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.massivecraft.factions.entity.FPlayer;
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.FPlayerColl;
|
import com.massivecraft.factions.entity.FPlayerColls;
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
import com.massivecraft.factions.entity.FactionColl;
|
import com.massivecraft.factions.entity.FactionColl;
|
||||||
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.mcore.cmd.arg.ArgReaderAbstract;
|
import com.massivecraft.mcore.cmd.arg.ArgReaderAbstract;
|
||||||
import com.massivecraft.mcore.cmd.arg.ArgResult;
|
import com.massivecraft.mcore.cmd.arg.ArgResult;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
@ -16,8 +17,18 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
|||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static ARFaction i = new ARFaction();
|
public static ARFaction get(Object o) { return new ARFaction(FactionColls.get().get(o)); }
|
||||||
public static ARFaction get() { return i; }
|
private ARFaction(FactionColl coll)
|
||||||
|
{
|
||||||
|
this.coll = coll;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// FIELDS
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private final FactionColl coll;
|
||||||
|
public FactionColl getColl() { return this.coll;}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE
|
// OVERRIDE
|
||||||
@ -29,15 +40,15 @@ public class ARFaction extends ArgReaderAbstract<Faction>
|
|||||||
ArgResult<Faction> result = new ArgResult<Faction>();
|
ArgResult<Faction> result = new ArgResult<Faction>();
|
||||||
|
|
||||||
// Faction Tag Exact
|
// Faction Tag Exact
|
||||||
result.setResult(FactionColl.get().getByTag(str));
|
result.setResult(this.getColl().getByTag(str));
|
||||||
if (result.hasResult()) return result;
|
if (result.hasResult()) return result;
|
||||||
|
|
||||||
// Faction Tag Match
|
// Faction Tag Match
|
||||||
result.setResult(FactionColl.get().getBestTagMatch(str));
|
result.setResult(this.getColl().getBestTagMatch(str));
|
||||||
if (result.hasResult()) return result;
|
if (result.hasResult()) return result;
|
||||||
|
|
||||||
// FPlayer Name Exact
|
// FPlayer Name Exact
|
||||||
FPlayer fplayer = FPlayerColl.get().get(str);
|
FPlayer fplayer = FPlayerColls.get().get(this.getColl()).get(str);
|
||||||
if (fplayer != null)
|
if (fplayer != null)
|
||||||
{
|
{
|
||||||
result.setResult(fplayer.getFaction());
|
result.setResult(fplayer.getFaction());
|
||||||
|
@ -17,23 +17,25 @@ public class FactionsEventCreate extends FactionsEventAbstractSender
|
|||||||
// FIELDS
|
// FIELDS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// TODO: How do we know what universe? Should we perhaps actually create the faction?
|
private final String universe;
|
||||||
|
public final String getUniverse() { return this.universe; }
|
||||||
|
|
||||||
private String factionTag;
|
private final String factionId;
|
||||||
public String getFactionTag() { return this.factionTag; }
|
public final String getFactionId() { return this.factionId; }
|
||||||
|
|
||||||
private String factionId;
|
private final String factionTag;
|
||||||
public String getFactionId() { return this.factionId; }
|
public final String getFactionTag() { return this.factionTag; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public FactionsEventCreate(CommandSender sender, String factionTag, String factionId)
|
public FactionsEventCreate(CommandSender sender, String universe, String factionId, String factionTag)
|
||||||
{
|
{
|
||||||
super(sender);
|
super(sender);
|
||||||
this.factionTag = factionTag;
|
this.universe = universe;
|
||||||
this.factionId = factionId;
|
this.factionId = factionId;
|
||||||
|
this.factionTag = factionTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ import com.dthielke.herochat.ChannelChatEvent;
|
|||||||
import com.dthielke.herochat.Herochat;
|
import com.dthielke.herochat.Herochat;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.chat.ChatFormatter;
|
import com.massivecraft.factions.chat.ChatFormatter;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +53,8 @@ public class HerochatEngine implements Listener
|
|||||||
|
|
||||||
String format = event.getFormat();
|
String format = event.getFormat();
|
||||||
format = format.replaceAll("&r", "§r");
|
format = format.replaceAll("&r", "§r");
|
||||||
format = ChatFormatter.format(format, event.getSender().getName(), null, null);
|
|
||||||
|
format = ChatFormatter.format(format, FPlayer.get(event.getSender().getPlayer()), null);
|
||||||
event.setFormat(format);
|
event.setFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.chat.ChatFormatter;
|
import com.massivecraft.factions.chat.ChatFormatter;
|
||||||
|
import com.massivecraft.factions.entity.FPlayer;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.mcore.util.SenderUtil;
|
|
||||||
|
|
||||||
public class FactionsListenerChat implements Listener
|
public class FactionsListenerChat implements Listener
|
||||||
{
|
{
|
||||||
@ -95,7 +95,8 @@ public class FactionsListenerChat implements Listener
|
|||||||
|
|
||||||
// ... then parse tags a.k.a. "format the format".
|
// ... then parse tags a.k.a. "format the format".
|
||||||
String format = event.getFormat();
|
String format = event.getFormat();
|
||||||
format = ChatFormatter.format(format, SenderUtil.getSenderId(event.getPlayer()), null, null);
|
|
||||||
|
format = ChatFormatter.format(format, FPlayer.get(event.getPlayer()), null);
|
||||||
event.setFormat(format);
|
event.setFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user