From 9c9681957c1de131d89468d25010b40782bf58c5 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 13 May 2016 12:32:05 +0200 Subject: [PATCH] MassiveCore - Remove Static Mixin --- .../factions/FactionListComparator.java | 1 - .../factions/cmd/CmdFactionsDescription.java | 4 ++-- .../factions/cmd/CmdFactionsFaction.java | 6 +++--- .../massivecraft/factions/cmd/CmdFactionsHome.java | 4 ++-- .../massivecraft/factions/cmd/CmdFactionsMotd.java | 4 ++-- .../factions/cmd/CmdFactionsSetAll.java | 4 ++-- .../factions/cmd/CmdFactionsTerritorytitles.java | 4 ++-- .../factions/cmd/CmdFactionsUnstuck.java | 4 ++-- .../massivecraft/factions/engine/EngineMain.java | 14 ++++++++------ src/com/massivecraft/factions/entity/Faction.java | 14 +++++++------- src/com/massivecraft/factions/entity/MPlayer.java | 13 +++++++------ .../integration/lwc/FactionsLwcModule.java | 3 --- 12 files changed, 37 insertions(+), 38 deletions(-) diff --git a/src/com/massivecraft/factions/FactionListComparator.java b/src/com/massivecraft/factions/FactionListComparator.java index 4342aaad..8935736d 100644 --- a/src/com/massivecraft/factions/FactionListComparator.java +++ b/src/com/massivecraft/factions/FactionListComparator.java @@ -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 { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java index a8b77022..2eaefda9 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java @@ -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("%s set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), msenderFaction.getDescription()); + follower.msg("%s set your faction description to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getDescription()); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java index e7ea1f6e..559080f3 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsFaction.java @@ -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 priorityLiness = new TreeSet(event.getIdPriorityLiness().values()); for (PriorityLines priorityLines : priorityLiness) { - Mixin.messageOne(sender, priorityLines.getLines()); + MixinMessage.get().messageOne(sender, priorityLines.getLines()); } } }); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java index 17b439de..fd6ea52f 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -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) { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java b/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java index fba49714..3453941b 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsMotd.java @@ -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("%s set your faction motd to:\n%s", Mixin.getDisplayName(sender, follower), msenderFaction.getMotd()); + follower.msg("%s set your faction motd to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getMotd()); } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSetAll.java b/src/com/massivecraft/factions/cmd/CmdFactionsSetAll.java index 14c45783..37ed3924 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSetAll.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSetAll.java @@ -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("%s %s %d chunk using " + word + " " + worldDisplayName + "."); this.setFormatMany("%s %s %d chunks using " + word + " " + worldDisplayName + "."); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java b/src/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java index b0b0a64a..ceebf546 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsTerritorytitles.java @@ -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(); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java index 3e70c6c3..661efae1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnstuck.java @@ -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) { diff --git a/src/com/massivecraft/factions/engine/EngineMain.java b/src/com/massivecraft/factions/engine/EngineMain.java index 8c90370b..3c0e9f35 100644 --- a/src/com/massivecraft/factions/engine/EngineMain.java +++ b/src/com/massivecraft/factions/engine/EngineMain.java @@ -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 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("Land claiming is disabled in %s.", 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 { diff --git a/src/com/massivecraft/factions/entity/Faction.java b/src/com/massivecraft/factions/entity/Faction.java index 5b94213e..ca6e3a27 100644 --- a/src/com/massivecraft/factions/entity/Faction.java +++ b/src/com/massivecraft/factions/entity/Faction.java @@ -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 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 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 msgs) { - return Mixin.msgPredicate(new FactionEqualsPredicate(this), msgs); + return MixinMessage.get().msgPredicate(new FactionEqualsPredicate(this), msgs); } } diff --git a/src/com/massivecraft/factions/entity/MPlayer.java b/src/com/massivecraft/factions/entity/MPlayer.java index 283a03e0..0a9b67ca 100644 --- a/src/com/massivecraft/factions/entity/MPlayer.java +++ b/src/com/massivecraft/factions/entity/MPlayer.java @@ -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 implements EconomyParticipato Faction faction = this.getFaction(); faction.mplayers.add(this); - //Factions.get().log(Txt.parse("postAttach added %s aka %s to %s aka %s.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName())); + //Factions.get().log(Txt.parse("postAttach added %s aka %s to %s aka %s.", id, MixinDisplayName.get().getDisplayName(id), faction.getId(), faction.getName())); } @Override @@ -103,7 +104,7 @@ public class MPlayer extends SenderEntity implements EconomyParticipato Faction faction = this.getFaction(); faction.mplayers.remove(this); - //Factions.get().log(Txt.parse("preDetach removed %s aka %s to %s aka %s.", id, Mixin.getDisplayName(id), faction.getId(), faction.getName())); + //Factions.get().log(Txt.parse("preDetach removed %s aka %s to %s aka %s.", id, MixinDisplayName.get().getDisplayName(id), faction.getId(), faction.getName())); } // -------------------------------------------- // @@ -575,7 +576,7 @@ public class MPlayer extends SenderEntity 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 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; } diff --git a/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java b/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java index e4e69f80..163f3a5b 100644 --- a/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java +++ b/src/com/massivecraft/factions/integration/lwc/FactionsLwcModule.java @@ -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;