MassiveCore - Remove Static Mixin

This commit is contained in:
Olof Larsson 2016-05-13 12:32:05 +02:00
parent 41bfc0bd8f
commit 9c9681957c
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474
12 changed files with 37 additions and 38 deletions

View File

@ -4,7 +4,6 @@ import java.util.Comparator;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.comparator.ComparatorComparable;
import com.massivecraft.massivecore.util.MUtil;
public class FactionListComparator implements Comparator<Faction>
{

View File

@ -8,7 +8,7 @@ import com.massivecraft.factions.event.EventFactionsDescriptionChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinDisplayName;
public class CmdFactionsDescription extends FactionsCommand
{
@ -54,7 +54,7 @@ public class CmdFactionsDescription extends FactionsCommand
// Inform
for (MPlayer follower : msenderFaction.getMPlayers())
{
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), msenderFaction.getDescription());
follower.msg("<i>%s <i>set your faction description to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getDescription());
}
}

View File

@ -13,7 +13,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.PriorityLines;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFaction extends FactionsCommand
@ -56,13 +56,13 @@ public class CmdFactionsFaction extends FactionsCommand
if (event.isCancelled()) return;
// Title
Mixin.messageOne(sender, Txt.titleize("Faction " + faction.getName(msender)));
MixinMessage.get().messageOne(sender, Txt.titleize("Faction " + faction.getName(msender)));
// Lines
TreeSet<PriorityLines> priorityLiness = new TreeSet<PriorityLines>(event.getIdPriorityLiness().values());
for (PriorityLines priorityLines : priorityLiness)
{
Mixin.messageOne(sender, priorityLines.getLines());
MixinMessage.get().messageOne(sender, priorityLines.getLines());
}
}
});

View File

@ -17,7 +17,7 @@ import com.massivecraft.factions.event.EventFactionsHomeTeleport;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinTeleport;
import com.massivecraft.massivecore.mixin.TeleporterException;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.teleport.Destination;
@ -152,7 +152,7 @@ public class CmdFactionsHome extends FactionsCommandHome
try
{
Destination destination = new DestinationSimple(home, homeDesc);
Mixin.teleport(me, destination, sender);
MixinTeleport.get().teleport(me, destination, sender);
}
catch (TeleporterException e)
{

View File

@ -8,7 +8,7 @@ import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinDisplayName;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
@ -88,7 +88,7 @@ public class CmdFactionsMotd extends FactionsCommand
// Inform
for (MPlayer follower : msenderFaction.getMPlayers())
{
follower.msg("<i>%s <i>set your faction motd to:\n%s", Mixin.getDisplayName(sender, follower), msenderFaction.getMotd());
follower.msg("<i>%s <i>set your faction motd to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getMotd());
}
}

View File

@ -10,7 +10,7 @@ import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinWorld;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
@ -85,7 +85,7 @@ public class CmdFactionsSetAll extends CmdFactionsSetXAll
}
Board board = BoardColl.get().get(worldId);
chunks = board.getChunks(oldFaction);
String worldDisplayName = Mixin.getWorldDisplayName(worldId);
String worldDisplayName = MixinWorld.get().getWorldDisplayName(worldId);
this.setFormatOne("<h>%s<i> %s <h>%d <i>chunk using " + word + " <h>" + worldDisplayName + "<i>.");
this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using " + word + " <h>" + worldDisplayName + "<i>.");
}

View File

@ -6,7 +6,7 @@ import com.massivecraft.massivecore.command.Visibility;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementTitlesAvailable;
import com.massivecraft.massivecore.command.type.primitive.TypeBoolean;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinTitle;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsTerritorytitles extends FactionsCommand
@ -36,7 +36,7 @@ public class CmdFactionsTerritorytitles extends FactionsCommand
public Visibility getVisibility()
{
// We hide the command if titles aren't available.
if ( ! Mixin.isTitlesAvailable()) return Visibility.INVISIBLE;
if ( ! MixinTitle.get().isTitlesAvailable()) return Visibility.INVISIBLE;
return super.getVisibility();
}

View File

@ -16,7 +16,7 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinTeleport;
import com.massivecraft.massivecore.mixin.TeleporterException;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.teleport.Destination;
@ -67,7 +67,7 @@ public class CmdFactionsUnstuck extends FactionsCommand
Destination destination = new DestinationSimple(PS.valueOf(location));
try
{
Mixin.teleport(me, destination, MConf.get().unstuckSeconds);
MixinTeleport.get().teleport(me, destination, MConf.get().unstuckSeconds);
}
catch (TeleporterException e)
{

View File

@ -97,7 +97,9 @@ import com.massivecraft.massivecore.PriorityLines;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinActual;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.mixin.MixinTitle;
import com.massivecraft.massivecore.mixin.MixinWorld;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.ps.PS;
@ -384,7 +386,7 @@ public class EngineMain extends Engine
if (currentPriority != MConf.get().motdPriority) return;
// ... and this is an actual join ...
if (!Mixin.isActualJoin(event)) return;
if ( ! MixinActual.get().isActualJoin(event)) return;
// ... then prepare the messages ...
final List<Object> messages = faction.getMotdMessages();
@ -392,7 +394,7 @@ public class EngineMain extends Engine
// ... and send to the player.
if (MConf.get().motdDelayTicks < 0)
{
Mixin.messageOne(player, messages);
MixinMessage.get().messageOne(player, messages);
}
else
{
@ -401,7 +403,7 @@ public class EngineMain extends Engine
@Override
public void run()
{
Mixin.messageOne(player, messages);
MixinMessage.get().messageOne(player, messages);
}
}, MConf.get().motdDelayTicks);
}
@ -500,7 +502,7 @@ public class EngineMain extends Engine
String worldId = chunk.getWorld();
if ( ! MConf.get().worldsClaimingEnabled.contains(worldId))
{
String worldName = Mixin.getWorldDisplayName(worldId);
String worldName = MixinWorld.get().getWorldDisplayName(worldId);
mplayer.msg("<b>Land claiming is disabled in <h>%s<b>.", worldName);
event.setCancelled(true);
return;
@ -715,7 +717,7 @@ public class EngineMain extends Engine
{
String maintitle = parseTerritoryInfo(MConf.get().territoryInfoTitlesMain, mplayer, factionTo);
String subtitle = parseTerritoryInfo(MConf.get().territoryInfoTitlesSub, mplayer, factionTo);
Mixin.sendTitleMessage(player, MConf.get().territoryInfoTitlesTicksIn, MConf.get().territoryInfoTitlesTicksStay, MConf.get().territoryInfoTitleTicksOut, maintitle, subtitle);
MixinTitle.get().sendTitleMessage(player, MConf.get().territoryInfoTitlesTicksIn, MConf.get().territoryInfoTitlesTicksStay, MConf.get().territoryInfoTitleTicksOut, maintitle, subtitle);
}
else
{

View File

@ -31,7 +31,7 @@ import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveMapDef;
import com.massivecraft.massivecore.collections.MassiveTreeSetDef;
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.predicate.Predicate;
import com.massivecraft.massivecore.ps.PS;
@ -1215,34 +1215,34 @@ public class Faction extends Entity<Faction> implements EconomyParticipator, Nam
public boolean sendMessage(Object message)
{
return Mixin.messagePredicate(new FactionEqualsPredicate(this), message);
return MixinMessage.get().messagePredicate(new FactionEqualsPredicate(this), message);
}
public boolean sendMessage(Object... messages)
{
return Mixin.messagePredicate(new FactionEqualsPredicate(this), messages);
return MixinMessage.get().messagePredicate(new FactionEqualsPredicate(this), messages);
}
public boolean sendMessage(Collection<Object> messages)
{
return Mixin.messagePredicate(new FactionEqualsPredicate(this), messages);
return MixinMessage.get().messagePredicate(new FactionEqualsPredicate(this), messages);
}
// CONVENIENCE MSG
public boolean msg(String msg)
{
return Mixin.msgPredicate(new FactionEqualsPredicate(this), msg);
return MixinMessage.get().msgPredicate(new FactionEqualsPredicate(this), msg);
}
public boolean msg(String msg, Object... args)
{
return Mixin.msgPredicate(new FactionEqualsPredicate(this), msg, args);
return MixinMessage.get().msgPredicate(new FactionEqualsPredicate(this), msg, args);
}
public boolean msg(Collection<String> msgs)
{
return Mixin.msgPredicate(new FactionEqualsPredicate(this), msgs);
return MixinMessage.get().msgPredicate(new FactionEqualsPredicate(this), msgs);
}
}

View File

@ -23,7 +23,8 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinSenderPs;
import com.massivecraft.massivecore.mixin.MixinTitle;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
import com.massivecraft.massivecore.store.SenderEntity;
@ -90,7 +91,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
Faction faction = this.getFaction();
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, MixinDisplayName.get().getDisplayName(id), faction.getId(), faction.getName()));
}
@Override
@ -103,7 +104,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
Faction faction = this.getFaction();
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, MixinDisplayName.get().getDisplayName(id), faction.getId(), faction.getName()));
}
// -------------------------------------------- //
@ -575,7 +576,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
public boolean isTerritoryInfoTitles()
{
if ( ! Mixin.isTitlesAvailable()) return false;
if ( ! MixinTitle.get().isTitlesAvailable()) return false;
if (this.territoryInfoTitles == null) return MConf.get().territoryInfoTitlesDefault;
return this.territoryInfoTitles;
}
@ -707,14 +708,14 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
public boolean isInOwnTerritory()
{
PS ps = Mixin.getSenderPs(this.getId());
PS ps = MixinSenderPs.get().getSenderPs(this.getId());
if (ps == null) return false;
return BoardColl.get().getFactionAt(ps) == this.getFaction();
}
public boolean isInEnemyTerritory()
{
PS ps = Mixin.getSenderPs(this.getId());
PS ps = MixinSenderPs.get().getSenderPs(this.getId());
if (ps == null) return false;
return BoardColl.get().getFactionAt(ps).getRelationTo(this) == Rel.ENEMY;
}

View File

@ -1,7 +1,6 @@
package com.massivecraft.factions.integration.lwc;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -15,8 +14,6 @@ import com.massivecraft.factions.engine.EngineMain;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.SoundEffect;
import com.massivecraft.massivecore.command.type.enumeration.TypeSound;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.SmokeUtil;