MassiveCore - Remove Static Mixin

This commit is contained in:
Olof Larsson 2016-05-13 12:32:28 +02:00
parent 37e93a86f4
commit 1e73cfb7db
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474
33 changed files with 127 additions and 531 deletions

View File

@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinInventory;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext; import com.massivecraft.massivecore.xlib.gson.JsonDeserializationContext;
import com.massivecraft.massivecore.xlib.gson.JsonDeserializer; import com.massivecraft.massivecore.xlib.gson.JsonDeserializer;
import com.massivecraft.massivecore.xlib.gson.JsonElement; import com.massivecraft.massivecore.xlib.gson.JsonElement;
@ -184,7 +184,7 @@ public class AdapterInventory implements JsonDeserializer<Inventory>, JsonSerial
size = SIZE_PLAYER_STORAGE; size = SIZE_PLAYER_STORAGE;
// This is a PlayerInventory // This is a PlayerInventory
ret = Mixin.createPlayerInventory(); ret = MixinInventory.get().createPlayerInventory();
PlayerInventory pret = (PlayerInventory)ret; PlayerInventory pret = (PlayerInventory)ret;
// Helmet // Helmet
@ -233,7 +233,7 @@ public class AdapterInventory implements JsonDeserializer<Inventory>, JsonSerial
size = jsonSize.getAsInt(); size = jsonSize.getAsInt();
// This is a "Custom" Inventory (content only). // This is a "Custom" Inventory (content only).
ret = Mixin.createInventory(null, size, ""); ret = MixinInventory.get().createInventory(null, size, "");
} }
// Now process content // Now process content

View File

@ -5,7 +5,7 @@ import java.security.InvalidParameterException;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinCommand;
public class ChestActionCommand extends ChestActionAbstract public class ChestActionCommand extends ChestActionAbstract
{ {
@ -56,7 +56,7 @@ public class ChestActionCommand extends ChestActionAbstract
String commandLine = this.getCommandLine(); String commandLine = this.getCommandLine();
if (commandLine == null) return false; if (commandLine == null) return false;
return Mixin.dispatchCommand(player, commandLine); return MixinCommand.get().dispatchCommand(player, commandLine);
} }
} }

View File

@ -28,7 +28,7 @@ import com.massivecraft.massivecore.command.requirement.Requirement;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract; import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm; import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.Type; import com.massivecraft.massivecore.command.type.Type;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase; import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase;
import com.massivecraft.massivecore.util.PermUtil; import com.massivecraft.massivecore.util.PermUtil;
@ -866,17 +866,17 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// OR // OR
// Message: "The sub command X is ambiguous." // Message: "The sub command X is ambiguous."
Mson bluetoken = mson(token).color(ChatColor.AQUA); Mson bluetoken = mson(token).color(ChatColor.AQUA);
Mixin.messageOne(sender, base.replaceAll(Lang.COMMAND_REPLACEMENT, bluetoken).command(this)); MixinMessage.get().messageOne(sender, base.replaceAll(Lang.COMMAND_REPLACEMENT, bluetoken).command(this));
// Message: "/f access ..." // Message: "/f access ..."
// Message: "/f ally ..." // Message: "/f ally ..."
for (MassiveCommand suggestion : suggestions) for (MassiveCommand suggestion : suggestions)
{ {
Mixin.messageOne(sender, suggestion.getTemplate(suggestion.getChain(), false, false, sender)); MixinMessage.get().messageOne(sender, suggestion.getTemplate(suggestion.getChain(), false, false, sender));
} }
// Message: "Use /Y to see all commands." // Message: "Use /Y to see all commands."
Mixin.messageOne(sender, Lang.COMMAND_CHILD_HELP.replaceAll(Lang.COMMAND_REPLACEMENT, this.getTemplate(chain, false, false, sender)).command(this)); MixinMessage.get().messageOne(sender, Lang.COMMAND_CHILD_HELP.replaceAll(Lang.COMMAND_REPLACEMENT, this.getTemplate(chain, false, false, sender)).command(this));
} }
// NOTE: This return statement will jump to the finally block. // NOTE: This return statement will jump to the finally block.
@ -894,7 +894,7 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
// Sometimes Types (or commands themselves) throw exceptions, to stop executing and notify the user. // Sometimes Types (or commands themselves) throw exceptions, to stop executing and notify the user.
if (ex.hasMessages()) if (ex.hasMessages())
{ {
Mixin.messageOne(sender, ex.getMessages()); MixinMessage.get().messageOne(sender, ex.getMessages());
} }
} }
finally finally
@ -968,8 +968,8 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
{ {
if (sender != null) if (sender != null)
{ {
Mixin.msgOne(sender, Lang.COMMAND_TOO_FEW_ARGUMENTS); MixinMessage.get().msgOne(sender, Lang.COMMAND_TOO_FEW_ARGUMENTS);
Mixin.messageOne(sender, this.getTemplate()); MixinMessage.get().messageOne(sender, this.getTemplate());
} }
return false; return false;
} }
@ -982,9 +982,9 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
{ {
// Get the too many string slice // Get the too many string slice
List<String> theTooMany = args.subList(this.getParameterCount(sender), args.size()); List<String> theTooMany = args.subList(this.getParameterCount(sender), args.size());
Mixin.msgOne(sender, Lang.COMMAND_TOO_MANY_ARGUMENTS, Txt.implodeCommaAndDot(theTooMany, Txt.parse("<aqua>%s"), Txt.parse("<b>, "), Txt.parse("<b> and "), "")); MixinMessage.get().msgOne(sender, Lang.COMMAND_TOO_MANY_ARGUMENTS, Txt.implodeCommaAndDot(theTooMany, Txt.parse("<aqua>%s"), Txt.parse("<b>, "), Txt.parse("<b> and "), ""));
Mixin.msgOne(sender, Lang.COMMAND_TOO_MANY_ARGUMENTS2); MixinMessage.get().msgOne(sender, Lang.COMMAND_TOO_MANY_ARGUMENTS2);
Mixin.messageOne(sender, this.getTemplate()); MixinMessage.get().messageOne(sender, this.getTemplate());
} }
return false; return false;
} }
@ -1230,34 +1230,34 @@ public class MassiveCommand implements Active, PluginIdentifiableCommand
public boolean msg(String msg) public boolean msg(String msg)
{ {
return Mixin.msgOne(this.sender, msg); return MixinMessage.get().msgOne(this.sender, msg);
} }
public boolean msg(String msg, Object... args) public boolean msg(String msg, Object... args)
{ {
return Mixin.msgOne(this.sender, msg, args); return MixinMessage.get().msgOne(this.sender, msg, args);
} }
public boolean msg(Collection<String> msgs) public boolean msg(Collection<String> msgs)
{ {
return Mixin.msgOne(this.sender, msgs); return MixinMessage.get().msgOne(this.sender, msgs);
} }
// MESSAGE // MESSAGE
public boolean message(Object message) public boolean message(Object message)
{ {
return Mixin.messageOne(this.sender, message); return MixinMessage.get().messageOne(this.sender, message);
} }
public boolean message(Object... messages) public boolean message(Object... messages)
{ {
return Mixin.messageOne(this.sender, messages); return MixinMessage.get().messageOne(this.sender, messages);
} }
public boolean message(Collection<?> messages) public boolean message(Collection<?> messages)
{ {
return Mixin.messageOne(this.sender, messages); return MixinMessage.get().messageOne(this.sender, messages);
} }
// CONVENIENCE MSON // CONVENIENCE MSON

View File

@ -12,7 +12,7 @@ import org.bukkit.plugin.Plugin;
import com.massivecraft.massivecore.Lang; import com.massivecraft.massivecore.Lang;
import com.massivecraft.massivecore.MassiveCoreMConf; import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -149,7 +149,7 @@ public class MassiveCoreBukkitCommand extends Command implements PluginIdentifia
int maxSize = MassiveCoreMConf.get().tabCompletionLimit; int maxSize = MassiveCoreMConf.get().tabCompletionLimit;
if (maxSize > 0 && retSize > maxSize) if (maxSize > 0 && retSize > maxSize)
{ {
Mixin.msgOne(sender, Lang.COMMAND_TOO_MANY_TAB_SUGGESTIONS, retSize); MixinMessage.get().msgOne(sender, Lang.COMMAND_TOO_MANY_TAB_SUGGESTIONS, retSize);
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -18,7 +18,7 @@ import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer; import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinInventory;
import com.massivecraft.massivecore.util.InventoryUtil; import com.massivecraft.massivecore.util.InventoryUtil;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -120,7 +120,7 @@ public class CommandEditItemStacksOpen<O> extends CommandEditItemStacksAbstract<
if (itemStacks == null) return null; if (itemStacks == null) return null;
// Create Ret // Create Ret
Inventory ret = Mixin.createInventory(me, 54, this.getProperty().getName()); Inventory ret = MixinInventory.get().createInventory(me, 54, this.getProperty().getName());
// Fill Ret // Fill Ret
for (int i = 0; i < itemStacks.size(); i++) for (int i = 0; i < itemStacks.size(); i++)

View File

@ -6,7 +6,7 @@ import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm; import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.TypeStringCommand; import com.massivecraft.massivecore.command.type.TypeStringCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinCommand;
public class CmdMassiveCoreClick extends MassiveCommand public class CmdMassiveCoreClick extends MassiveCommand
{ {
@ -43,7 +43,7 @@ public class CmdMassiveCoreClick extends MassiveCommand
MassiveCoreMConf.get().clickSound.run(me); MassiveCoreMConf.get().clickSound.run(me);
String command = this.readArg(); String command = this.readArg();
if (command == null) return; if (command == null) return;
Mixin.dispatchCommand(sender, command); MixinCommand.get().dispatchCommand(sender, command);
} }
} }

View File

@ -15,7 +15,7 @@ import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm; import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer; import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.command.type.primitive.TypeString; import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.WebUtil; import com.massivecraft.massivecore.util.WebUtil;
public class CmdMassiveCoreCmdurl extends MassiveCommand public class CmdMassiveCoreCmdurl extends MassiveCommand
@ -81,19 +81,19 @@ public class CmdMassiveCoreCmdurl extends MassiveCommand
@Override @Override
public void run() public void run()
{ {
Mixin.msgOne(commander, "<i>... <h>%d <i>lines loaded. Now executing ...", lines.size()); MixinMessage.get().msgOne(commander, "<i>... <h>%d <i>lines loaded. Now executing ...", lines.size());
for (int i = 0; i <= lines.size() - 1; i++) for (int i = 0; i <= lines.size() - 1; i++)
{ {
String line = lines.get(i); String line = lines.get(i);
line = line.trim(); line = line.trim();
if (line.length() == 0 || line.startsWith("#")) if (line.length() == 0 || line.startsWith("#"))
{ {
Mixin.msgOne(commander, "<b>#%d: <i>%s", i, line); MixinMessage.get().msgOne(commander, "<b>#%d: <i>%s", i, line);
// Ignore the line // Ignore the line
} }
else else
{ {
Mixin.msgOne(commander, "<g>#%d: <i>%s", i, line); MixinMessage.get().msgOne(commander, "<g>#%d: <i>%s", i, line);
// Run the line // Run the line
commander.chat(line); commander.chat(line);
} }
@ -109,7 +109,7 @@ public class CmdMassiveCoreCmdurl extends MassiveCommand
@Override @Override
public void run() public void run()
{ {
Mixin.msgOne(commander, "<b>%s: %s", e.getClass().getSimpleName(), e.getMessage()); MixinMessage.get().msgOne(commander, "<b>%s: %s", e.getClass().getSimpleName(), e.getMessage());
} }
}); });
return; return;

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
public abstract class RequirementAbstract implements Requirement, Serializable public abstract class RequirementAbstract implements Requirement, Serializable
{ {
@ -40,7 +40,7 @@ public abstract class RequirementAbstract implements Requirement, Serializable
public static boolean isRequirementsMet(Iterable<Requirement> requirements, CommandSender sender, MassiveCommand command, boolean verboose) public static boolean isRequirementsMet(Iterable<Requirement> requirements, CommandSender sender, MassiveCommand command, boolean verboose)
{ {
String error = getRequirementsError(requirements, sender, command, verboose); String error = getRequirementsError(requirements, sender, command, verboose);
if (error != null && verboose) Mixin.messageOne(sender, error); if (error != null && verboose) MixinMessage.get().messageOne(sender, error);
return error == null; return error == null;
} }

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.command.requirement;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinDisplayName;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -38,7 +38,7 @@ public class RequirementIsntCertainSender extends RequirementAbstract
@Override @Override
public String createErrorMessage(CommandSender sender, MassiveCommand command) public String createErrorMessage(CommandSender sender, MassiveCommand command)
{ {
return Txt.parse("<b>Player can't be <h>%s<b>.", Mixin.getDisplayName(this.getSenderId(), sender)); return Txt.parse("<b>Player can't be <h>%s<b>.", MixinDisplayName.get().getDisplayName(this.getSenderId(), sender));
} }
} }

View File

@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.Lang; import com.massivecraft.massivecore.Lang;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinTitle;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class RequirementTitlesAvailable extends RequirementAbstract public class RequirementTitlesAvailable extends RequirementAbstract
@ -25,7 +25,7 @@ public class RequirementTitlesAvailable extends RequirementAbstract
@Override @Override
public boolean apply(CommandSender sender, MassiveCommand command) public boolean apply(CommandSender sender, MassiveCommand command)
{ {
return Mixin.isTitlesAvailable(); return MixinTitle.get().isTitlesAvailable();
} }
@Override @Override

View File

@ -6,7 +6,7 @@ import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinWorld;
public class TypeWorld extends TypeAbstractChoice<World> public class TypeWorld extends TypeAbstractChoice<World>
{ {
@ -25,13 +25,13 @@ public class TypeWorld extends TypeAbstractChoice<World>
@Override @Override
public String getVisualInner(World value, CommandSender sender) public String getVisualInner(World value, CommandSender sender)
{ {
return Mixin.getWorldDisplayName(value.getName()); return MixinWorld.get().getWorldDisplayName(value.getName());
} }
@Override @Override
public String getNameInner(World value) public String getNameInner(World value)
{ {
return Mixin.getWorldAliasOrId(value.getName()); return MixinWorld.get().getWorldAliasOrId(value.getName());
} }
@Override @Override
@ -49,7 +49,7 @@ public class TypeWorld extends TypeAbstractChoice<World>
@Override @Override
public boolean canSee(World value, CommandSender sender) public boolean canSee(World value, CommandSender sender)
{ {
return Mixin.canSeeWorld(sender, value.getName()); return MixinWorld.get().canSeeWorld(sender, value.getName());
} }
} }

View File

@ -4,7 +4,7 @@ import java.util.Collection;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinWorld;
public class TypeWorldId extends TypeAbstractChoice<String> public class TypeWorldId extends TypeAbstractChoice<String>
{ {
@ -29,13 +29,13 @@ public class TypeWorldId extends TypeAbstractChoice<String>
@Override @Override
public String getVisualInner(String value, CommandSender sender) public String getVisualInner(String value, CommandSender sender)
{ {
return Mixin.getWorldDisplayName(value); return MixinWorld.get().getWorldDisplayName(value);
} }
@Override @Override
public String getNameInner(String value) public String getNameInner(String value)
{ {
return Mixin.getWorldAliasOrId(value); return MixinWorld.get().getWorldAliasOrId(value);
} }
@Override @Override
@ -47,13 +47,13 @@ public class TypeWorldId extends TypeAbstractChoice<String>
@Override @Override
public Collection<String> getAll() public Collection<String> getAll()
{ {
return Mixin.getWorldIds(); return MixinWorld.get().getWorldIds();
} }
@Override @Override
public boolean canSee(String value, CommandSender sender) public boolean canSee(String value, CommandSender sender)
{ {
return Mixin.canSeeWorld(sender, value); return MixinWorld.get().canSeeWorld(sender, value);
} }
} }

View File

@ -11,7 +11,8 @@ import com.massivecraft.massivecore.SenderPresence;
import com.massivecraft.massivecore.SenderType; import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.command.type.TypeAbstract; import com.massivecraft.massivecore.command.type.TypeAbstract;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinDisplayName;
import com.massivecraft.massivecore.mixin.MixinVisibility;
import com.massivecraft.massivecore.store.SenderIdSource; import com.massivecraft.massivecore.store.SenderIdSource;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -87,7 +88,7 @@ public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
String id = IdUtil.getId(value); String id = IdUtil.getId(value);
if (id == null) return null; if (id == null) return null;
return Mixin.getDisplayName(id, sender); return MixinDisplayName.get().getDisplayName(id, sender);
} }
@Override @Override
@ -162,7 +163,7 @@ public abstract class TypeSenderIdAbstract<T> extends TypeAbstract<T>
Set<String> ret = new MassiveSet<String>(size); Set<String> ret = new MassiveSet<String>(size);
for (String id : ids) for (String id : ids)
{ {
if ( ! Mixin.isVisible(id, sender)) continue; if ( ! MixinVisibility.get().isVisible(id, sender)) continue;
if (addIds) ret.add(id); if (addIds) ret.add(id);
String name = IdUtil.getName(id); String name = IdUtil.getName(id);
if (name == null) continue; if (name == null) continue;

View File

@ -11,7 +11,7 @@ import org.bukkit.inventory.Inventory;
import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.chestgui.ChestAction; import com.massivecraft.massivecore.chestgui.ChestAction;
import com.massivecraft.massivecore.chestgui.ChestGui; import com.massivecraft.massivecore.chestgui.ChestGui;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.InventoryUtil; import com.massivecraft.massivecore.util.InventoryUtil;
public class EngineMassiveCoreChestGui extends Engine public class EngineMassiveCoreChestGui extends Engine
@ -45,7 +45,7 @@ public class EngineMassiveCoreChestGui extends Engine
// ... warn on bottom inventory ... // ... warn on bottom inventory ...
if (InventoryUtil.isBottomInventory(event)) if (InventoryUtil.isBottomInventory(event))
{ {
Mixin.msgOne(event.getWhoClicked(), "<b>Exit the GUI to edit your items."); MixinMessage.get().msgOne(event.getWhoClicked(), "<b>Exit the GUI to edit your items.");
return; return;
} }

View File

@ -27,7 +27,7 @@ import com.massivecraft.massivecore.event.EventMassiveCoreAfterPlayerRespawn;
import com.massivecraft.massivecore.event.EventMassiveCoreAfterPlayerTeleport; import com.massivecraft.massivecore.event.EventMassiveCoreAfterPlayerTeleport;
import com.massivecraft.massivecore.event.EventMassiveCorePermissionDeniedFormat; import com.massivecraft.massivecore.event.EventMassiveCorePermissionDeniedFormat;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat; import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinVisibility;
import com.massivecraft.massivecore.predicate.Predicate; import com.massivecraft.massivecore.predicate.Predicate;
import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase; import com.massivecraft.massivecore.predicate.PredicateStartsWithIgnoreCase;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
@ -129,7 +129,7 @@ public class EngineMassiveCoreMain extends Engine
{ {
if ( ! predicate.apply(senderName)) continue; if ( ! predicate.apply(senderName)) continue;
if (current.contains(senderName)) continue; if (current.contains(senderName)) continue;
if ( ! Mixin.isVisible(senderName, watcher)) continue; if ( ! MixinVisibility.get().isVisible(senderName, watcher)) continue;
event.getTabCompletions().add(senderName); event.getTabCompletions().add(senderName);
} }

View File

@ -15,7 +15,8 @@ import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave; 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.teleport.ScheduledTeleport; import com.massivecraft.massivecore.teleport.ScheduledTeleport;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -99,7 +100,7 @@ public class EngineMassiveCoreScheduledTeleport extends Engine
scheduledTeleport.unschedule(); scheduledTeleport.unschedule();
// ... and inform the teleportee. // ... and inform the teleportee.
Mixin.msgOne(scheduledTeleport.getTeleporteeId(), "<rose>Cancelled <i>teleport to <h>"+scheduledTeleport.getDestination().getDesc(scheduledTeleport.getTeleporteeId())+"<i>."); MixinMessage.get().msgOne(scheduledTeleport.getTeleporteeId(), "<rose>Cancelled <i>teleport to <h>"+scheduledTeleport.getDestination().getDesc(scheduledTeleport.getTeleporteeId())+"<i>.");
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@ -133,7 +134,7 @@ public class EngineMassiveCoreScheduledTeleport extends Engine
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void cancelTeleport(EventMassiveCorePlayerLeave event) public void cancelTeleport(EventMassiveCorePlayerLeave event)
{ {
if ( ! Mixin.isActualLeave(event)) return; if ( ! MixinActual.get().isActualLeave(event)) return;
final Player player = event.getPlayer(); final Player player = event.getPlayer();
this.cancelTeleport(player); this.cancelTeleport(player);

View File

@ -1,405 +0,0 @@
package com.massivecraft.massivecore.mixin;
import java.util.Collection;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.permissions.Permissible;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.predicate.Predicate;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.store.Coll;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.teleport.Destination;
public class Mixin
{
// -------------------------------------------- //
// STATIC EXPOSE: WORLD
// -------------------------------------------- //
public static boolean canSeeWorld(Permissible permissible, String worldId)
{
return MixinWorld.get().canSeeWorld(permissible, worldId);
}
public static List<String> getWorldIds()
{
return MixinWorld.get().getWorldIds();
}
public static List<String> getVisibleWorldIds(Permissible permissible)
{
return MixinWorld.get().getVisibleWorldIds(permissible);
}
public static ChatColor getWorldColor(String worldId)
{
return MixinWorld.get().getWorldColor(worldId);
}
public static List<String> getWorldAliases(String worldId)
{
return MixinWorld.get().getWorldAliases(worldId);
}
public static String getWorldAliasOrId(String worldId)
{
return MixinWorld.get().getWorldAliasOrId(worldId);
}
public static String getWorldDisplayName(String worldId)
{
return MixinWorld.get().getWorldDisplayName(worldId);
}
public static PS getWorldSpawnPs(String worldId)
{
return MixinWorld.get().getWorldSpawnPs(worldId);
}
public static void setWorldSpawnPs(String worldId, PS spawnPs)
{
MixinWorld.get().setWorldSpawnPs(worldId, spawnPs);
}
public static boolean trySetWorldSpawnWp(CommandSender sender, String worldId, PS spawnPs, boolean verbooseChange, boolean verbooseSame)
{
return MixinWorld.get().trySetWorldSpawnWp(sender, worldId, spawnPs, verbooseChange, verbooseSame);
}
// -------------------------------------------- //
// STATIC EXPOSE: DISPLAY NAME
// -------------------------------------------- //
@Deprecated
public static String getDisplayName(Object senderObject)
{
return MixinDisplayName.get().getDisplayName(senderObject, null);
}
public static String getDisplayName(Object senderObject, Object watcherObject)
{
return MixinDisplayName.get().getDisplayName(senderObject, watcherObject);
}
public static Mson getDisplayNameMson(Object senderObject, Object watcherObject)
{
return MixinDisplayName.get().getDisplayNameMson(senderObject, watcherObject);
}
// -------------------------------------------- //
// STATIC EXPOSE: INVENTORY
// -------------------------------------------- //
public static PlayerInventory createPlayerInventory()
{
return MixinInventory.get().createPlayerInventory();
}
public static Inventory createInventory(InventoryHolder holder, int size, String title)
{
return MixinInventory.get().createInventory(holder, size, title);
}
// -------------------------------------------- //
// STATIC EXPOSE: SENDER PS
// -------------------------------------------- //
public static PS getSenderPs(Object senderObject)
{
return MixinSenderPs.get().getSenderPs(senderObject);
}
public static void setSenderPs(Object senderObject, PS ps)
{
MixinSenderPs.get().setSenderPs(senderObject, ps);
}
// -------------------------------------------- //
// STATIC EXPOSE: GAMEMODE
// -------------------------------------------- //
public static GameMode getGamemode(Object playerObject)
{
return MixinGamemode.get().getGamemode(playerObject);
}
public static void setGamemode(Object playerObject, GameMode gameMode)
{
MixinGamemode.get().setGamemode(playerObject, gameMode);
}
// -------------------------------------------- //
// STATIC EXPOSE: PLAYED
// -------------------------------------------- //
public static boolean isOnline(Object senderObject)
{
return MixinPlayed.get().isOnline(senderObject);
}
public static boolean isOffline(Object senderObject)
{
return MixinPlayed.get().isOffline(senderObject);
}
public static Long getLastPlayed(Object senderObject)
{
return MixinPlayed.get().getLastPlayed(senderObject);
}
public static Long getFirstPlayed(Object senderObject)
{
return MixinPlayed.get().getFirstPlayed(senderObject);
}
public static boolean hasPlayedBefore(Object senderObject)
{
return MixinPlayed.get().hasPlayedBefore(senderObject);
}
public static String getIp(Object senderObject)
{
return MixinPlayed.get().getIp(senderObject);
}
// -------------------------------------------- //
// STATIC EXPOSE: VISIBILITY
// -------------------------------------------- //
public static boolean isVisible(Object watcheeObject)
{
return MixinVisibility.get().isVisible(watcheeObject);
}
public static boolean isVisible(Object watcheeObject, Object watcherObject)
{
return MixinVisibility.get().isVisible(watcheeObject, watcherObject);
}
// -------------------------------------------- //
// STATIC EXPOSE: TELEPORTER
// -------------------------------------------- //
public static boolean isCausedByMixin(PlayerTeleportEvent event)
{
return MixinTeleport.get().isCausedByMixin(event);
}
public static void teleport(Object teleporteeObject, Destination destination) throws TeleporterException
{
MixinTeleport.get().teleport(teleporteeObject, destination);
}
public static void teleport(Object teleporteeObject, Destination destination, Permissible delayPermissible) throws TeleporterException
{
MixinTeleport.get().teleport(teleporteeObject, destination, delayPermissible);
}
public static void teleport(Object teleporteeObject, Destination destination, int delaySeconds) throws TeleporterException
{
MixinTeleport.get().teleport(teleporteeObject, destination, delaySeconds);
}
// -------------------------------------------- //
// STATIC EXPOSE: MESSAGE
// -------------------------------------------- //
// MSG: All
public static boolean msgAll(String msg)
{
return MixinMessage.get().msgAll(msg);
}
public static boolean msgAll(String msg, Object... args)
{
return MixinMessage.get().msgAll(msg, args);
}
public static boolean msgAll(Collection<String> msgs)
{
return MixinMessage.get().msgAll(msgs);
}
// MSG: Predicate
public static boolean msgPredicate(Predicate<CommandSender> predicate, String msg)
{
return MixinMessage.get().msgPredicate(predicate, msg);
}
public static boolean msgPredicate(Predicate<CommandSender> predicate, String msg, Object... args)
{
return MixinMessage.get().msgPredicate(predicate, msg, args);
}
public static boolean msgPredicate(Predicate<CommandSender> predicate, Collection<String> msgs)
{
return MixinMessage.get().msgPredicate(predicate, msgs);
}
// MSG: One
public static boolean msgOne(Object sendeeObject, String msg)
{
return MixinMessage.get().msgOne(sendeeObject, msg);
}
public static boolean msgOne(Object sendeeObject, String msg, Object... args)
{
return MixinMessage.get().msgOne(sendeeObject, msg, args);
}
public static boolean msgOne(Object sendeeObject, Collection<String> msgs)
{
return MixinMessage.get().msgOne(sendeeObject, msgs);
}
// MESSAGE: All
public static boolean messageAll(Object message)
{
return MixinMessage.get().messageAll(message);
}
public static boolean messageAll(Object... messages)
{
return MixinMessage.get().messageAll(messages);
}
public static boolean messageAll(Collection<?> messages)
{
return MixinMessage.get().messageAll(messages);
}
// MESSAGE: Predicate
public static boolean messagePredicate(Predicate<CommandSender> predicate, Object message)
{
return MixinMessage.get().messagePredicate(predicate, message);
}
public static boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages)
{
return MixinMessage.get().messagePredicate(predicate, messages);
}
public static boolean messagePredicate(Predicate<CommandSender> predicate, Collection<?> messages)
{
return MixinMessage.get().messagePredicate(predicate, messages);
}
// MESSAGE: One
public static boolean messageOne(Object sendeeObject, Object message)
{
return MixinMessage.get().messageOne(sendeeObject, message);
}
public static boolean messageOne(Object sendeeObject, Object... messages)
{
return MixinMessage.get().messageOne(sendeeObject, messages);
}
public static boolean messageOne(Object sendeeObject, Collection<?> messages)
{
return MixinMessage.get().messageOne(sendeeObject, messages);
}
// -------------------------------------------- //
// STATIC EXPOSE: ACTIONBAR
// -------------------------------------------- //
public static boolean sendActionbarMessage(Object sendeeObject, String message)
{
return MixinActionbar.get().sendActionbarMessage(sendeeObject, message);
}
public static boolean sendActionbarMsg(Object sendeeObject, String message)
{
return MixinActionbar.get().sendActionbarMsg(sendeeObject, message);
}
public static boolean sendActionbarMson(Object sendeeObject, Mson mson)
{
return MixinActionbar.get().sendActionbarMson(sendeeObject, mson);
}
public static boolean isActionbarAvailable()
{
return MixinActionbar.get().isActionbarAvailable();
}
// -------------------------------------------- //
// STATIC EXPOSE: TITLE
// -------------------------------------------- //
public static boolean sendTitleMessage(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
{
return MixinTitle.get().sendTitleMessage(watcherObject, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
}
public static boolean sendTitleMsg(Object watcherObject, int ticksIn, int ticksStay, int ticksOut, String titleMain, String titleSub)
{
return MixinTitle.get().sendTitleMsg(watcherObject, ticksIn, ticksStay, ticksOut, titleMain, titleSub);
}
public static boolean isTitlesAvailable()
{
return MixinTitle.get().isTitlesAvailable();
}
// -------------------------------------------- //
// STATIC EXPOSE: KICK
// -------------------------------------------- //
public static boolean kick(Object senderObject)
{
return MixinKick.get().kick(senderObject);
}
public static boolean kick(Object senderObject, String message)
{
return MixinKick.get().kick(senderObject, message);
}
// -------------------------------------------- //
// STATIC EXPOSE: ACTUALL
// -------------------------------------------- //
public static boolean isActualJoin(PlayerJoinEvent event)
{
return MixinActual.get().isActualJoin(event);
}
public static boolean isActualLeave(EventMassiveCorePlayerLeave event)
{
return MixinActual.get().isActualLeave(event);
}
// -------------------------------------------- //
// STATIC EXPOSE: COMMAND
// -------------------------------------------- //
public static boolean dispatchCommand(Object senderObject, String commandLine)
{
return MixinCommand.get().dispatchCommand(senderObject, commandLine);
}
public static boolean dispatchCommand(Object presentObject, Object senderObject, String commandLine)
{
return MixinCommand.get().dispatchCommand(presentObject, senderObject, commandLine);
}
// -------------------------------------------- //
// STATIC EXPOSE: MODIFCATION
// -------------------------------------------- //
public static void syncModification(Entity<?> entity)
{
MixinModification.get().syncModification(entity);
}
public static void syncModification(Coll<?> coll, String id)
{
MixinModification.get().syncModification(coll, id);
}
}

View File

@ -99,7 +99,7 @@ public class MixinTeleport extends MixinAbstract
public void teleport(Object teleporteeObject, Destination destination, int delaySeconds) throws TeleporterException public void teleport(Object teleporteeObject, Destination destination, int delaySeconds) throws TeleporterException
{ {
String teleporteeId = IdUtil.getId(teleporteeObject); String teleporteeId = IdUtil.getId(teleporteeObject);
if (!IdUtil.isPlayerId(teleporteeId)) throw new TeleporterException(Txt.parse("<white>%s <b>is not a player.", Mixin.getDisplayName(teleporteeId, IdUtil.getConsole()))); if (!IdUtil.isPlayerId(teleporteeId)) throw new TeleporterException(Txt.parse("<white>%s <b>is not a player.", MixinDisplayName.get().getDisplayName(teleporteeId, IdUtil.getConsole())));
PS ps; PS ps;
try try
@ -117,11 +117,11 @@ public class MixinTeleport extends MixinAbstract
// With delay // With delay
if (desc != null && ! desc.isEmpty()) if (desc != null && ! desc.isEmpty())
{ {
Mixin.msgOne(teleporteeId, "<i>Teleporting to <h>"+desc+" <i>in <h>"+delaySeconds+"s <i>unless you move."); MixinMessage.get().msgOne(teleporteeId, "<i>Teleporting to <h>"+desc+" <i>in <h>"+delaySeconds+"s <i>unless you move.");
} }
else else
{ {
Mixin.msgOne(teleporteeId, "<i>Teleporting in <h>"+delaySeconds+"s <i>unless you move."); MixinMessage.get().msgOne(teleporteeId, "<i>Teleporting in <h>"+delaySeconds+"s <i>unless you move.");
} }
new ScheduledTeleport(teleporteeId, destination, delaySeconds).schedule(); new ScheduledTeleport(teleporteeId, destination, delaySeconds).schedule();
@ -131,7 +131,7 @@ public class MixinTeleport extends MixinAbstract
// Without delay AKA "now"/"at once" // Without delay AKA "now"/"at once"
// Run event // Run event
EventMassiveCorePlayerPSTeleport event = new EventMassiveCorePlayerPSTeleport(teleporteeId, Mixin.getSenderPs(teleporteeId), destination); EventMassiveCorePlayerPSTeleport event = new EventMassiveCorePlayerPSTeleport(teleporteeId, MixinSenderPs.get().getSenderPs(teleporteeId), destination);
event.run(); event.run();
if (event.isCancelled()) return; if (event.isCancelled()) return;
destination = event.getDestination(); destination = event.getDestination();
@ -139,7 +139,7 @@ public class MixinTeleport extends MixinAbstract
if (desc != null && ! desc.isEmpty()) if (desc != null && ! desc.isEmpty())
{ {
Mixin.msgOne(teleporteeId, "<i>Teleporting to <h>"+desc+"<i>."); MixinMessage.get().msgOne(teleporteeId, "<i>Teleporting to <h>"+desc+"<i>.");
} }
Player teleportee = IdUtil.getPlayer(teleporteeId); Player teleportee = IdUtil.getPlayer(teleporteeId);
@ -149,7 +149,7 @@ public class MixinTeleport extends MixinAbstract
} }
else else
{ {
Mixin.setSenderPs(teleporteeId, ps); MixinSenderPs.get().setSenderPs(teleporteeId, ps);
} }
} }
} }

View File

@ -121,13 +121,13 @@ public class MixinWorld extends MixinAbstract
{ {
if (verbooseChange || verbooseSame) if (verbooseChange || verbooseSame)
{ {
Mixin.msgOne(sender, "<b>Unknown world <h>%s<b>.", worldId); MixinMessage.get().msgOne(sender, "<b>Unknown world <h>%s<b>.", worldId);
} }
return false; return false;
} }
// Pre Calculations // Pre Calculations
String worldDisplayName = Mixin.getWorldDisplayName(worldId); String worldDisplayName = MixinWorld.get().getWorldDisplayName(worldId);
PS current = this.getWorldSpawnPs(worldId); PS current = this.getWorldSpawnPs(worldId);
String currentFormatted = current.toString(PSFormatDesc.get()); String currentFormatted = current.toString(PSFormatDesc.get());
String goalFormatted = goal.toString(PSFormatDesc.get()); String goalFormatted = goal.toString(PSFormatDesc.get());
@ -137,7 +137,7 @@ public class MixinWorld extends MixinAbstract
{ {
if (verbooseSame) if (verbooseSame)
{ {
Mixin.msgOne(sender, "<i>Spawn location is already <h>%s <i>for <h>%s<i>.", currentFormatted, worldDisplayName); MixinMessage.get().msgOne(sender, "<i>Spawn location is already <h>%s <i>for <h>%s<i>.", currentFormatted, worldDisplayName);
} }
return true; return true;
} }
@ -145,7 +145,7 @@ public class MixinWorld extends MixinAbstract
// Report // Report
if (verbooseChange) if (verbooseChange)
{ {
Mixin.msgOne(sender, "<i>Changing spawn location from <h>%s <i>to <h>%s <i>for <h>%s<i>.", currentFormatted, goalFormatted, worldDisplayName); MixinMessage.get().msgOne(sender, "<i>Changing spawn location from <h>%s <i>to <h>%s <i>for <h>%s<i>.", currentFormatted, goalFormatted, worldDisplayName);
} }
// Set it // Set it

View File

@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableList;
import com.massivecraft.massivecore.adapter.AdapterLowercaseEnum; import com.massivecraft.massivecore.adapter.AdapterLowercaseEnum;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.predicate.Predicate; import com.massivecraft.massivecore.predicate.Predicate;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -1174,19 +1174,19 @@ public class Mson implements Serializable
// All // All
public boolean messageAll() public boolean messageAll()
{ {
return Mixin.messageAll(this); return MixinMessage.get().messageAll(this);
} }
// Predicate // Predicate
public boolean messagePredicate(Predicate<CommandSender> predicate) public boolean messagePredicate(Predicate<CommandSender> predicate)
{ {
return Mixin.messagePredicate(predicate, this); return MixinMessage.get().messagePredicate(predicate, this);
} }
// One // One
public boolean messageOne(Object senderObject) public boolean messageOne(Object senderObject)
{ {
return Mixin.messageOne(senderObject, this); return MixinMessage.get().messageOne(senderObject, this);
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.pager;
import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -268,7 +268,7 @@ public class Pager<T>
List<Mson> messages = this.get(); List<Mson> messages = this.get();
// Message // Message
Mixin.messageOne(this.getSender(), messages); MixinMessage.get().messageOne(this.getSender(), messages);
} }
public void messageAsync() public void messageAsync()

View File

@ -4,7 +4,6 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -3,7 +3,7 @@ import java.lang.ref.WeakReference;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinVisibility;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
public class PredicateVisibleTo implements Predicate<Object> public class PredicateVisibleTo implements Predicate<Object>
@ -32,7 +32,7 @@ public class PredicateVisibleTo implements Predicate<Object>
@Override @Override
public boolean apply(Object watcheeObject) public boolean apply(Object watcheeObject)
{ {
return Mixin.isVisible(watcheeObject, this.getWatcher()); return MixinVisibility.get().isVisible(watcheeObject, this.getWatcher());
} }
} }

View File

@ -3,7 +3,7 @@ package com.massivecraft.massivecore.ps;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinWorld;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class PSFormatAbstract implements PSFormat public class PSFormatAbstract implements PSFormat
@ -93,11 +93,11 @@ public class PSFormatAbstract implements PSFormat
{ {
if (this.useWorldDisplayname) if (this.useWorldDisplayname)
{ {
val = Mixin.getWorldDisplayName(val.toString()); val = MixinWorld.get().getWorldDisplayName(val.toString());
} }
else if (this.useWorldAlias) else if (this.useWorldAlias)
{ {
val = Mixin.getWorldAliasOrId(val.toString()); val = MixinWorld.get().getWorldAliasOrId(val.toString());
} }
ret.add(String.format(this.formatWorld, val)); ret.add(String.format(this.formatWorld, val));
} }

View File

@ -17,7 +17,7 @@ import com.massivecraft.massivecore.MassivePlugin;
import com.massivecraft.massivecore.Named; import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.comparator.ComparatorNaturalOrder; import com.massivecraft.massivecore.comparator.ComparatorNaturalOrder;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinModification;
import com.massivecraft.massivecore.predicate.Predicate; import com.massivecraft.massivecore.predicate.Predicate;
import com.massivecraft.massivecore.predicate.PredicateEqualsIgnoreCase; import com.massivecraft.massivecore.predicate.PredicateEqualsIgnoreCase;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -446,7 +446,7 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
this.removeIdentifiedModificationFixed(id); this.removeIdentifiedModificationFixed(id);
this.getDb().delete(this, id); this.getDb().delete(this, id);
Mixin.syncModification(this, id); MixinModification.get().syncModification(this, id);
} }
@Override @Override
@ -476,7 +476,7 @@ public class Coll<E extends Entity<E>> extends CollAbstract<E>
if (mtime == 0) return; if (mtime == 0) return;
entity.setLastMtime(mtime); entity.setLastMtime(mtime);
} }
Mixin.syncModification(entity); MixinModification.get().syncModification(entity);
} }
@Override @Override

View File

@ -10,7 +10,10 @@ import org.bukkit.entity.Player;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.massivecraft.massivecore.Named; import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinDisplayName;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.mixin.MixinPlayed;
import com.massivecraft.massivecore.mixin.MixinVisibility;
import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.PermUtil; import com.massivecraft.massivecore.util.PermUtil;
@ -119,42 +122,42 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
public boolean isOnline() public boolean isOnline()
{ {
return Mixin.isOnline(this.getId()); return MixinPlayed.get().isOnline(this.getId());
} }
public boolean isOffline() public boolean isOffline()
{ {
return Mixin.isOffline(this.getId()); return MixinPlayed.get().isOffline(this.getId());
} }
public Long getLastPlayed() public Long getLastPlayed()
{ {
return Mixin.getLastPlayed(this.getId()); return MixinPlayed.get().getLastPlayed(this.getId());
} }
public Long getFirstPlayed() public Long getFirstPlayed()
{ {
return Mixin.getFirstPlayed(this.getId()); return MixinPlayed.get().getFirstPlayed(this.getId());
} }
public boolean hasPlayedBefore() public boolean hasPlayedBefore()
{ {
return Mixin.hasPlayedBefore(this.getId()); return MixinPlayed.get().hasPlayedBefore(this.getId());
} }
public String getIp() public String getIp()
{ {
return Mixin.getIp(this.getId()); return MixinPlayed.get().getIp(this.getId());
} }
public boolean isVisible() public boolean isVisible()
{ {
return Mixin.isVisible(this); return MixinVisibility.get().isVisible(this);
} }
public boolean isVisible(Object watcherObject) public boolean isVisible(Object watcherObject)
{ {
return Mixin.isVisible(this, watcherObject); return MixinVisibility.get().isVisible(this, watcherObject);
} }
public boolean isOnline(Object watcherObject) public boolean isOnline(Object watcherObject)
@ -171,21 +174,14 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
// DISPLAY NAME // DISPLAY NAME
// -------------------------------------------- // // -------------------------------------------- //
// TODO: Remove this one shortly.
@Deprecated
public String getDisplayName()
{
return Mixin.getDisplayName(this.getId());
}
public String getDisplayName(Object watcherObject) public String getDisplayName(Object watcherObject)
{ {
return Mixin.getDisplayName(this.getId(), watcherObject); return MixinDisplayName.get().getDisplayName(this.getId(), watcherObject);
} }
public Mson getDisplayNameMson(Object watcherObject) public Mson getDisplayNameMson(Object watcherObject)
{ {
return Mixin.getDisplayNameMson(this.getId(), watcherObject); return MixinDisplayName.get().getDisplayNameMson(this.getId(), watcherObject);
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -196,34 +192,34 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
public boolean msg(String msg) public boolean msg(String msg)
{ {
return Mixin.msgOne(this.getId(), msg); return MixinMessage.get().msgOne(this.getId(), msg);
} }
public boolean msg(String msg, Object... args) public boolean msg(String msg, Object... args)
{ {
return Mixin.msgOne(this.getId(), msg, args); return MixinMessage.get().msgOne(this.getId(), msg, args);
} }
public boolean msg(Collection<String> msgs) public boolean msg(Collection<String> msgs)
{ {
return Mixin.msgOne(this.getId(), msgs); return MixinMessage.get().msgOne(this.getId(), msgs);
} }
// MESSAGE // MESSAGE
public boolean message(Object message) public boolean message(Object message)
{ {
return Mixin.messageOne(this.getId(), message); return MixinMessage.get().messageOne(this.getId(), message);
} }
public boolean message(Object... messages) public boolean message(Object... messages)
{ {
return Mixin.messageOne(this.getId(), messages); return MixinMessage.get().messageOne(this.getId(), messages);
} }
public boolean message(Collection<?> messages) public boolean message(Collection<?> messages)
{ {
return Mixin.messageOne(this.getId(), messages); return MixinMessage.get().messageOne(this.getId(), messages);
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -3,7 +3,9 @@ package com.massivecraft.massivecore.teleport;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinDisplayName;
import com.massivecraft.massivecore.mixin.MixinPlayed;
import com.massivecraft.massivecore.mixin.MixinSenderPs;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
@ -46,7 +48,7 @@ public class DestinationPlayer extends DestinationAbstract
@Override @Override
public PS getPsInner() public PS getPsInner()
{ {
return Mixin.getSenderPs(this.playerId); return MixinSenderPs.get().getSenderPs(this.playerId);
} }
@Override @Override
@ -66,10 +68,10 @@ public class DestinationPlayer extends DestinationAbstract
} }
// Display Name // Display Name
ret += Mixin.getDisplayName(this.getPlayerId(), watcherObject); ret += MixinDisplayName.get().getDisplayName(this.getPlayerId(), watcherObject);
// Offline Suffix // Offline Suffix
if (Mixin.isOffline(this.getPlayerId())) if (MixinPlayed.get().isOffline(this.getPlayerId()))
{ {
ret += Txt.parse(" <b>[Offline]"); ret += Txt.parse(" <b>[Offline]");
} }

View File

@ -5,7 +5,7 @@ import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinWorld;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
public class DestinationWorld extends DestinationAbstract public class DestinationWorld extends DestinationAbstract
@ -60,13 +60,13 @@ public class DestinationWorld extends DestinationAbstract
String worldId = this.getWorldId(); String worldId = this.getWorldId();
if (worldId == null) return null; if (worldId == null) return null;
return Mixin.getWorldSpawnPs(worldId); return MixinWorld.get().getWorldSpawnPs(worldId);
} }
@Override @Override
public String getDesc(Object watcherObject) public String getDesc(Object watcherObject)
{ {
return "World " + Mixin.getWorldDisplayName(this.getWorldId()); return "World " + MixinWorld.get().getWorldDisplayName(this.getWorldId());
} }
} }

View File

@ -1,7 +1,8 @@
package com.massivecraft.massivecore.teleport; package com.massivecraft.massivecore.teleport;
import com.massivecraft.massivecore.engine.EngineMassiveCoreScheduledTeleport; import com.massivecraft.massivecore.engine.EngineMassiveCoreScheduledTeleport;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.mixin.MixinTeleport;
import com.massivecraft.massivecore.mixin.TeleporterException; import com.massivecraft.massivecore.mixin.TeleporterException;
public class ScheduledTeleport implements Runnable public class ScheduledTeleport implements Runnable
@ -66,11 +67,11 @@ public class ScheduledTeleport implements Runnable
try try
{ {
Mixin.teleport(this.getTeleporteeId(), this.getDestination(), 0); MixinTeleport.get().teleport(this.getTeleporteeId(), this.getDestination(), 0);
} }
catch (TeleporterException e) catch (TeleporterException e)
{ {
Mixin.messageOne(this.getTeleporteeId(), e.getMessage()); MixinMessage.get().messageOne(this.getTeleporteeId(), e.getMessage());
} }
} }

View File

@ -30,7 +30,8 @@ import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave; import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.event.EventMassiveCoreSenderRegister; import com.massivecraft.massivecore.event.EventMassiveCoreSenderRegister;
import com.massivecraft.massivecore.event.EventMassiveCoreSenderUnregister; import com.massivecraft.massivecore.event.EventMassiveCoreSenderUnregister;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinActual;
import com.massivecraft.massivecore.mixin.MixinPlayed;
import com.massivecraft.massivecore.store.SenderEntity; import com.massivecraft.massivecore.store.SenderEntity;
import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken; import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken;
@ -397,7 +398,7 @@ public class IdUtil implements Listener, Runnable
// Declaring Existence? Sure, whatever you were before! // Declaring Existence? Sure, whatever you were before!
// It can definitely not be local at this point. // It can definitely not be local at this point.
// But online or offline is fine. // But online or offline is fine.
boolean online = Mixin.isOnline(player); boolean online = MixinPlayed.get().isOnline(player);
update(id, name, SenderPresence.fromOnline(online)); update(id, name, SenderPresence.fromOnline(online));
} }
@ -430,7 +431,7 @@ public class IdUtil implements Listener, Runnable
// Leaving? Is it an actuall leave? // Leaving? Is it an actuall leave?
SenderPresence presence; SenderPresence presence;
if (Mixin.isActualLeave(event)) if (MixinActual.get().isActualLeave(event))
{ {
// They actually left. // They actually left.
// They are offline. // They are offline.

View File

@ -27,7 +27,7 @@ import org.bukkit.material.MaterialData;
import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinInventory;
public class InventoryUtil public class InventoryUtil
{ {
@ -924,7 +924,7 @@ public class InventoryUtil
Inventory ret = null; Inventory ret = null;
if (inventory instanceof PlayerInventory && playerSupport) if (inventory instanceof PlayerInventory && playerSupport)
{ {
ret = Mixin.createPlayerInventory(); ret = MixinInventory.get().createPlayerInventory();
} }
else else
{ {
@ -932,7 +932,7 @@ public class InventoryUtil
int size = inventory.getSize(); int size = inventory.getSize();
if (inventory instanceof PlayerInventory) size = SIZE_PLAYER_STORAGE; if (inventory instanceof PlayerInventory) size = SIZE_PLAYER_STORAGE;
String title = inventory.getTitle(); String title = inventory.getTitle();
ret = Mixin.createInventory(holder, size, title); ret = MixinInventory.get().createInventory(holder, size, title);
} }
// Fill // Fill

View File

@ -65,7 +65,7 @@ import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
import com.massivecraft.massivecore.engine.EngineMassiveCoreDatabase; import com.massivecraft.massivecore.engine.EngineMassiveCoreDatabase;
import com.massivecraft.massivecore.engine.EngineMassiveCoreMain; import com.massivecraft.massivecore.engine.EngineMassiveCoreMain;
import com.massivecraft.massivecore.engine.EngineMassiveCoreWorldNameSet; import com.massivecraft.massivecore.engine.EngineMassiveCoreWorldNameSet;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.nms.NmsEntity; import com.massivecraft.massivecore.nms.NmsEntity;
import com.massivecraft.massivecore.predicate.Predicate; import com.massivecraft.massivecore.predicate.Predicate;
import com.massivecraft.massivecore.util.extractor.Extractor; import com.massivecraft.massivecore.util.extractor.Extractor;
@ -547,7 +547,7 @@ public class MUtil
messages.addAll(MUtil.getStackTraceStrings(1, true)); messages.addAll(MUtil.getStackTraceStrings(1, true));
// Message // Message
Mixin.messageOne(IdUtil.CONSOLE_ID, messages); MixinMessage.get().messageOne(IdUtil.CONSOLE_ID, messages);
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -25,7 +25,7 @@ import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleEvent; import org.bukkit.event.vehicle.VehicleEvent;
import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.event.vehicle.VehicleExitEvent;
import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.mixin.MixinSenderPs;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -199,7 +199,7 @@ public class ExtractorLogic
{ {
if (senderObject == null) return null; if (senderObject == null) return null;
PS ps = Mixin.getSenderPs(senderObject); PS ps = MixinSenderPs.get().getSenderPs(senderObject);
if (ps == null) return null; if (ps == null) return null;
return ps.getWorld(); return ps.getWorld();