Merged Message Methods
This commit is contained in:
parent
c8a7e9401f
commit
7b5f6acd1b
@ -39,7 +39,7 @@ public class DeprecatedCommand extends MassiveCommand
|
||||
public void perform()
|
||||
{
|
||||
msg("<i>Use this new command instead:");
|
||||
sendMessage(target.getUseageTemplate(true));
|
||||
message(target.getUseageTemplate(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class HelpCommand extends MassiveCommand
|
||||
}
|
||||
|
||||
// Send Lines
|
||||
sendMessage(Txt.getPage(lines, page, "Help for command \"" + parentCommand.getAliases().get(0) + "\"", sender));
|
||||
message(Txt.getPage(lines, page, "Help for command \"" + parentCommand.getAliases().get(0) + "\"", sender));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1099,24 +1099,7 @@ public class MassiveCommand
|
||||
// MESSAGE SENDING HELPERS
|
||||
// -------------------------------------------- //
|
||||
|
||||
// CONVENIENCE SEND MESSAGE
|
||||
|
||||
public boolean sendMessage(String message)
|
||||
{
|
||||
return Mixin.messageOne(this.sender, message);
|
||||
}
|
||||
|
||||
public boolean sendMessage(String... messages)
|
||||
{
|
||||
return Mixin.messageOne(this.sender, messages);
|
||||
}
|
||||
|
||||
public boolean sendMessage(Collection<String> messages)
|
||||
{
|
||||
return Mixin.messageOne(this.sender, messages);
|
||||
}
|
||||
|
||||
// CONVENIENCE MSG
|
||||
// MSG
|
||||
|
||||
public boolean msg(String msg)
|
||||
{
|
||||
@ -1133,21 +1116,21 @@ public class MassiveCommand
|
||||
return Mixin.msgOne(this.sender, msgs);
|
||||
}
|
||||
|
||||
// CONVENIENCE RAW
|
||||
// MESSAGE
|
||||
|
||||
public boolean sendRaw(Mson mson)
|
||||
public boolean message(Object message)
|
||||
{
|
||||
return Mixin.messageRawOne(this.sender, mson);
|
||||
return Mixin.messageOne(this.sender, message);
|
||||
}
|
||||
|
||||
public boolean sendRaw(Mson... mson)
|
||||
public boolean message(Object... messages)
|
||||
{
|
||||
return Mixin.messageRawOne(this.sender, mson);
|
||||
return Mixin.messageOne(this.sender, messages);
|
||||
}
|
||||
|
||||
public boolean sendRaw(Collection<Mson> mson)
|
||||
public boolean message(Collection<?> messages)
|
||||
{
|
||||
return Mixin.messageRawOne(this.sender, mson);
|
||||
return Mixin.messageOne(this.sender, messages);
|
||||
}
|
||||
|
||||
// CONVENIENCE MSON
|
||||
|
@ -82,12 +82,12 @@ public class VersionCommand extends MassiveCommand
|
||||
|
||||
public void sendTitle()
|
||||
{
|
||||
sendMessage(Txt.titleize("Plugin Version & Information"));
|
||||
message(Txt.titleize("Plugin Version & Information"));
|
||||
}
|
||||
|
||||
public void sendEntry(String key, String value)
|
||||
{
|
||||
sendMessage(Txt.parse("<pink>%s: <aqua>%s", Txt.upperCaseFirst(key), value == null ? NOT_SPECIFIED : value));
|
||||
message(Txt.parse("<pink>%s: <aqua>%s", Txt.upperCaseFirst(key), value == null ? NOT_SPECIFIED : value));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class CmdMassiveCoreBufferPrint extends MassiveCommand
|
||||
}
|
||||
|
||||
msg("<i>Printing your buffer on the line below:");
|
||||
sendMessage(buffer);
|
||||
message(buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class CmdMassiveCoreStoreListcolls extends MassiveCommand
|
||||
message += Txt.parse(" <i>(%d documents)", coll.getIds().size());
|
||||
}
|
||||
|
||||
sendMessage(message);
|
||||
message(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class CmdMassiveCoreTest extends MassiveCommand
|
||||
public void perform() throws MassiveException
|
||||
{
|
||||
|
||||
sendRaw(mson("This is your ", mson("item").tooltip(me.getItemInHand())));
|
||||
message(mson("This is your ", mson("item").tooltip(me.getItemInHand())));
|
||||
// OLD STUFF
|
||||
/*// Args
|
||||
ParticleEffect particleEffect = this.readArg();
|
||||
|
@ -50,7 +50,7 @@ public class CmdMassiveCoreUsysAspectList extends MassiveCommand
|
||||
}
|
||||
|
||||
// Send them
|
||||
this.sendMessage(Txt.getPage(lines, page, "Aspect List", sender));
|
||||
this.message(Txt.getPage(lines, page, "Aspect List", sender));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class CmdMassiveCoreUsysMultiverseList extends MassiveCommand
|
||||
}
|
||||
|
||||
// Send them
|
||||
this.sendMessage(Txt.getPage(lines, page, "Multiverse List", sender));
|
||||
this.message(Txt.getPage(lines, page, "Multiverse List", sender));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,39 +5,20 @@ import java.util.Collection;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
|
||||
public interface MessageMixin
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
public boolean messageAll(String message);
|
||||
public boolean messageAll(String... messages);
|
||||
public boolean messageAll(Collection<String> messages);
|
||||
|
||||
// Predictate
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, String message);
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, String... messages);
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<String> messages);
|
||||
|
||||
// One
|
||||
public boolean messageOne(Object sendeeObject, String message);
|
||||
public boolean messageOne(Object sendeeObject, String... messages);
|
||||
public boolean messageOne(Object sendeeObject, Collection<String> messages);
|
||||
|
||||
// -------------------------------------------- //
|
||||
// PARSE MSG
|
||||
// MSG
|
||||
// -------------------------------------------- //
|
||||
// All implemented in abstract!
|
||||
|
||||
// All
|
||||
public boolean msgAll(String msg);
|
||||
public boolean msgAll(String msg, Object... args);
|
||||
public boolean msgAll(Collection<String> msgs);
|
||||
|
||||
// Predictate
|
||||
// Predicate
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg);
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, String msg, Object... args);
|
||||
public boolean msgPredictate(Predictate<CommandSender> predictate, Collection<String> msgs);
|
||||
@ -48,22 +29,22 @@ public interface MessageMixin
|
||||
public boolean msgOne(Object sendeeObject, Collection<String> msgs);
|
||||
|
||||
// -------------------------------------------- //
|
||||
// RAW MESSAGE
|
||||
// MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
public boolean messageRawAll(Mson mson);
|
||||
public boolean messageRawAll(Mson... msons);
|
||||
public boolean messageRawAll(Collection<Mson> msons);
|
||||
public boolean messageAll(Object message);
|
||||
public boolean messageAll(Object... messages);
|
||||
public boolean messageAll(Collection<?> messages);
|
||||
|
||||
// Predictate
|
||||
public boolean messageRawPredictate(Predictate<CommandSender> predictate, Mson mson);
|
||||
public boolean messageRawPredictate(Predictate<CommandSender> predictate, Mson... msons);
|
||||
public boolean messageRawPredictate(Predictate<CommandSender> predictate, Collection<Mson> msons);
|
||||
// Predicate
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object message);
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages);
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages);
|
||||
|
||||
// One
|
||||
public boolean messageRawOne(Object sendeeObject, Mson mson);
|
||||
public boolean messageRawOne(Object sendeeObject, Mson... msons);
|
||||
public boolean messageRawOne(Object sendeeObject, Collection<Mson> msons);
|
||||
public boolean messageOne(Object sendeeObject, Object message);
|
||||
public boolean messageOne(Object sendeeObject, Object... messages);
|
||||
public boolean messageOne(Object sendeeObject, Collection<?> messages);
|
||||
|
||||
}
|
||||
|
@ -7,58 +7,14 @@ import java.util.Collections;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.massivecore.Predictate;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class MessageMixinAbstract implements MessageMixin
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// MESSAGE
|
||||
// MSG STRING
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
@Override
|
||||
public boolean messageAll(String message)
|
||||
{
|
||||
return this.messageAll(Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageAll(String... messages)
|
||||
{
|
||||
return this.messageAll(Arrays.asList(messages));
|
||||
}
|
||||
|
||||
// Predictate
|
||||
@Override
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, String message)
|
||||
{
|
||||
return this.messagePredictate(predictate, Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, String... messages)
|
||||
{
|
||||
return this.messagePredictate(predictate, Arrays.asList(messages));
|
||||
}
|
||||
|
||||
// One
|
||||
@Override
|
||||
public boolean messageOne(Object sendeeObject, String message)
|
||||
{
|
||||
return this.messageOne(sendeeObject, Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageOne(Object sendeeObject, String... messages)
|
||||
{
|
||||
return this.messageOne(sendeeObject, Arrays.asList(messages));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// PARSE MSG
|
||||
// -------------------------------------------- //
|
||||
// They are all in abstract!
|
||||
// All implemented in abstract!
|
||||
|
||||
// All
|
||||
@Override
|
||||
@ -118,46 +74,46 @@ public abstract class MessageMixinAbstract implements MessageMixin
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// RAW MESSAGE
|
||||
// MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
@Override
|
||||
public boolean messageRawAll(Mson mson)
|
||||
public boolean messageAll(Object message)
|
||||
{
|
||||
return this.messageRawAll(Arrays.asList(mson));
|
||||
return this.messageAll(Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageRawAll(Mson... msons)
|
||||
public boolean messageAll(Object... messages)
|
||||
{
|
||||
return this.messageRawAll(Arrays.asList(msons));
|
||||
return this.messageAll(Arrays.asList(messages));
|
||||
}
|
||||
|
||||
// Predictate
|
||||
// Predicate
|
||||
@Override
|
||||
public boolean messageRawPredictate(Predictate<CommandSender> predictate, Mson mson)
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object message)
|
||||
{
|
||||
return this.messageRawPredictate(predictate, Arrays.asList(mson));
|
||||
return this.messagePredictate(predictate, Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageRawPredictate(Predictate<CommandSender> predictate, Mson... msons)
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages)
|
||||
{
|
||||
return this.messageRawPredictate(predictate, Arrays.asList(msons));
|
||||
return this.messagePredictate(predictate, Arrays.asList(messages));
|
||||
}
|
||||
|
||||
// One
|
||||
@Override
|
||||
public boolean messageRawOne(Object sendeeObject, Mson mson)
|
||||
public boolean messageOne(Object sendeeObject, Object message)
|
||||
{
|
||||
return this.messageRawOne(sendeeObject, Arrays.asList(mson));
|
||||
return this.messageOne(sendeeObject, Collections.singleton(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageRawOne(Object sendeeObject, Mson... msons)
|
||||
public boolean messageOne(Object sendeeObject, Object... messages)
|
||||
{
|
||||
return this.messageRawOne(sendeeObject, Arrays.asList(msons));
|
||||
return this.messageOne(sendeeObject, Arrays.asList(messages));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,93 +20,99 @@ public class MessageMixinDefault extends MessageMixinAbstract
|
||||
public static MessageMixinDefault get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
// NOTE: Targets messageOne
|
||||
@Override
|
||||
public boolean messageAll(Collection<String> messages)
|
||||
public boolean messageAll(Collection<?> messages)
|
||||
{
|
||||
// Check Messages
|
||||
if (messages == null) return false;
|
||||
if (messages.isEmpty()) return false;
|
||||
|
||||
// Here
|
||||
for (CommandSender sender : IdUtil.getLocalSenders())
|
||||
{
|
||||
this.messageOne(sender, messages);
|
||||
}
|
||||
|
||||
// Return
|
||||
return true;
|
||||
}
|
||||
|
||||
// Predicate
|
||||
// NOTE: Targets messageOne
|
||||
@Override
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<String> messages)
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages)
|
||||
{
|
||||
// Check Predicate
|
||||
if (predictate == null) return false;
|
||||
|
||||
// Check Messages
|
||||
if (messages == null) return false;
|
||||
if (messages.isEmpty()) return false;
|
||||
|
||||
// Here
|
||||
for (CommandSender sender : IdUtil.getLocalSenders())
|
||||
{
|
||||
if (!predictate.apply(sender)) continue;
|
||||
this.messageOne(sender, messages);
|
||||
}
|
||||
|
||||
// Return
|
||||
return true;
|
||||
}
|
||||
|
||||
// One
|
||||
// NOTE: The core implementation
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean messageOne(Object sendeeObject, Collection<String> messages)
|
||||
public boolean messageOne(Object sendeeObject, Collection<?> messages)
|
||||
{
|
||||
// Check Sendee
|
||||
CommandSender sendee = IdUtil.getSender(sendeeObject);
|
||||
if (sendee == null) return false;
|
||||
|
||||
// Check Messages
|
||||
if (messages == null) return false;
|
||||
sendee.sendMessage(messages.toArray(new String[0]));
|
||||
return true;
|
||||
}
|
||||
if (messages.isEmpty()) return false;
|
||||
|
||||
// Raw message aka. JsonString
|
||||
@Override
|
||||
public boolean messageRawAll(Collection<Mson> msons)
|
||||
{
|
||||
if (msons == null) return false;
|
||||
for (CommandSender sender : IdUtil.getLocalSenders())
|
||||
// Type Switch
|
||||
Object first = messages.iterator().next();
|
||||
if (first instanceof String)
|
||||
{
|
||||
this.messageRawOne(sender, msons);
|
||||
// String
|
||||
Collection<String> strings = (Collection<String>) messages;
|
||||
sendee.sendMessage(strings.toArray(new String[0]));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageRawPredictate(Predictate<CommandSender> predictate, Collection<Mson> msons)
|
||||
{
|
||||
if (predictate == null) return false;
|
||||
if (msons == null) return false;
|
||||
for (CommandSender sender : IdUtil.getLocalSenders())
|
||||
else if (first instanceof Mson)
|
||||
{
|
||||
if ( ! predictate.apply(sender)) continue;
|
||||
this.messageRawOne(sender, msons);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean messageRawOne(Object sendeeObject, Collection<Mson> msons)
|
||||
{
|
||||
if (msons == null) return false;
|
||||
|
||||
CommandSender sender = IdUtil.getSender(sendeeObject);
|
||||
if (sender == null) return false;
|
||||
|
||||
if (sender instanceof Player && NmsPacket.get().isAvailable())
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
for (Mson mson : msons)
|
||||
// Mson
|
||||
Collection<Mson> msons = (Collection<Mson>) messages;
|
||||
if (sendee instanceof Player && NmsPacket.get().isAvailable())
|
||||
{
|
||||
NmsPacket.sendRaw(player, mson.toRaw());
|
||||
Player player = (Player) sendee;
|
||||
for (Mson mson : msons)
|
||||
{
|
||||
NmsPacket.sendRaw(player, mson.toRaw());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Mson mson : msons)
|
||||
{
|
||||
sendee.sendMessage(mson.toPlain(true));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Mson mson : msons)
|
||||
{
|
||||
sender.sendMessage(mson.toPlain(true));
|
||||
}
|
||||
throw new IllegalArgumentException("The messages must be either String or Mson.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -234,130 +234,100 @@ public class Mixin
|
||||
// STATIC EXPOSE: MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
public static boolean messageAll(String message)
|
||||
{
|
||||
return getMessageMixin().messageAll(message);
|
||||
}
|
||||
public static boolean messageAll(String... messages)
|
||||
{
|
||||
return getMessageMixin().messageAll(messages);
|
||||
}
|
||||
public static boolean messageAll(Collection<String> messages)
|
||||
{
|
||||
return getMessageMixin().messageAll(messages);
|
||||
}
|
||||
|
||||
// Predictate
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, String message)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, message);
|
||||
}
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, String... messages)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, messages);
|
||||
}
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Collection<String> messages)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, messages);
|
||||
}
|
||||
|
||||
// One
|
||||
public static boolean messageOne(Object senderObject, String message)
|
||||
{
|
||||
return getMessageMixin().messageOne(senderObject, message);
|
||||
}
|
||||
public static boolean messageOne(Object senderObject, String... messages)
|
||||
{
|
||||
return getMessageMixin().messageOne(senderObject, messages);
|
||||
}
|
||||
public static boolean messageOne(Object senderObject, Collection<String> messages)
|
||||
{
|
||||
return getMessageMixin().messageOne(senderObject, messages);
|
||||
}
|
||||
|
||||
// All
|
||||
// MSG: All
|
||||
public static boolean msgAll(String msg)
|
||||
{
|
||||
return getMessageMixin().msgAll(msg);
|
||||
}
|
||||
|
||||
public static boolean msgAll(String msg, Object... args)
|
||||
{
|
||||
return getMessageMixin().msgAll(msg, args);
|
||||
}
|
||||
|
||||
public static boolean msgAll(Collection<String> msgs)
|
||||
{
|
||||
return getMessageMixin().msgAll(msgs);
|
||||
}
|
||||
|
||||
// Predictate
|
||||
// MSG: Predicate
|
||||
public static boolean msgPredictate(Predictate<CommandSender> predictate, String msg)
|
||||
{
|
||||
return getMessageMixin().msgPredictate(predictate, msg);
|
||||
}
|
||||
|
||||
public static boolean msgPredictate(Predictate<CommandSender> predictate, String msg, Object... args)
|
||||
{
|
||||
return getMessageMixin().msgPredictate(predictate, msg, args);
|
||||
}
|
||||
|
||||
public static boolean msgPredictate(Predictate<CommandSender> predictate, Collection<String> msgs)
|
||||
{
|
||||
return getMessageMixin().msgPredictate(predictate, msgs);
|
||||
}
|
||||
|
||||
// One
|
||||
public static boolean msgOne(Object senderObject, String msg)
|
||||
// MSG: One
|
||||
public static boolean msgOne(Object sendeeObject, String msg)
|
||||
{
|
||||
return getMessageMixin().msgOne(senderObject, msg);
|
||||
}
|
||||
public static boolean msgOne(Object senderObject, String msg, Object... args)
|
||||
{
|
||||
return getMessageMixin().msgOne(senderObject, msg, args);
|
||||
}
|
||||
public static boolean msgOne(Object senderObject, Collection<String> msgs)
|
||||
{
|
||||
return getMessageMixin().msgOne(senderObject, msgs);
|
||||
return getMessageMixin().msgOne(sendeeObject, msg);
|
||||
}
|
||||
|
||||
// RAW All
|
||||
public static boolean messageRawAll(Mson mson)
|
||||
public static boolean msgOne(Object sendeeObject, String msg, Object... args)
|
||||
{
|
||||
return getMessageMixin().messageRawAll(mson);
|
||||
}
|
||||
public static boolean messageRawAll(Mson... msons)
|
||||
{
|
||||
return getMessageMixin().messageRawAll(msons);
|
||||
}
|
||||
public static boolean messageRawAll(Collection<Mson> msons)
|
||||
{
|
||||
return getMessageMixin().messageRawAll(msons);
|
||||
return getMessageMixin().msgOne(sendeeObject, msg, args);
|
||||
}
|
||||
|
||||
// RAW Predictate
|
||||
public static boolean messageRawPredictate(Predictate<CommandSender> predictate, Mson mson)
|
||||
public static boolean msgOne(Object sendeeObject, Collection<String> msgs)
|
||||
{
|
||||
return getMessageMixin().messageRawPredictate(predictate, mson);
|
||||
}
|
||||
public static boolean messageRawPredictate(Predictate<CommandSender> predictate, Mson... msons)
|
||||
{
|
||||
return getMessageMixin().messageRawPredictate(predictate, msons);
|
||||
}
|
||||
public static boolean messageRawPredictate(Predictate<CommandSender> predictate, Collection<Mson> msons)
|
||||
{
|
||||
return getMessageMixin().messageRawPredictate(predictate, msons);
|
||||
return getMessageMixin().msgOne(sendeeObject, msgs);
|
||||
}
|
||||
|
||||
// RAW One
|
||||
public static boolean messageRawOne(Object senderObject, Mson mson)
|
||||
// MESSAGE: All
|
||||
public static boolean messageAll(Object message)
|
||||
{
|
||||
return getMessageMixin().messageRawOne(senderObject, mson);
|
||||
return getMessageMixin().messageAll(message);
|
||||
}
|
||||
public static boolean messageRawOne(Object senderObject, Mson... msons)
|
||||
|
||||
public static boolean messageAll(Object... messages)
|
||||
{
|
||||
return getMessageMixin().messageRawOne(senderObject, msons);
|
||||
return getMessageMixin().messageAll(messages);
|
||||
}
|
||||
public static boolean messageRawOne(Object senderObject, Collection<Mson> msons)
|
||||
|
||||
public static boolean messageAll(Collection<?> messages)
|
||||
{
|
||||
return getMessageMixin().messageRawOne(senderObject, msons);
|
||||
return getMessageMixin().messageAll(messages);
|
||||
}
|
||||
|
||||
// MESSAGE: Predicate
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Object message)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, message);
|
||||
}
|
||||
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Object... messages)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, messages);
|
||||
}
|
||||
|
||||
public static boolean messagePredictate(Predictate<CommandSender> predictate, Collection<?> messages)
|
||||
{
|
||||
return getMessageMixin().messagePredictate(predictate, messages);
|
||||
}
|
||||
|
||||
// MESSAGE: One
|
||||
public static boolean messageOne(Object sendeeObject, Object message)
|
||||
{
|
||||
return getMessageMixin().messageOne(sendeeObject, message);
|
||||
}
|
||||
|
||||
public static boolean messageOne(Object sendeeObject, Object... messages)
|
||||
{
|
||||
return getMessageMixin().messageOne(sendeeObject, messages);
|
||||
}
|
||||
|
||||
public static boolean messageOne(Object sendeeObject, Collection<?> messages)
|
||||
{
|
||||
return getMessageMixin().messageOne(sendeeObject, messages);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -820,25 +820,25 @@ public class Mson implements Serializable
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SEND
|
||||
// MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// All
|
||||
public boolean sendAll()
|
||||
public boolean messageAll()
|
||||
{
|
||||
return Mixin.messageRawAll(this);
|
||||
return Mixin.messageAll(this);
|
||||
}
|
||||
|
||||
// Predictate
|
||||
public boolean sendPredictate(Predictate<CommandSender> predictate)
|
||||
public boolean messagePredictate(Predictate<CommandSender> predictate)
|
||||
{
|
||||
return Mixin.messageRawPredictate(predictate, this);
|
||||
return Mixin.messagePredictate(predictate, this);
|
||||
}
|
||||
|
||||
// One
|
||||
public boolean sendOne(Object senderObject)
|
||||
public boolean messageOne(Object senderObject)
|
||||
{
|
||||
return Mixin.messageRawOne(senderObject, this);
|
||||
return Mixin.messageOne(senderObject, this);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -36,6 +36,7 @@ public interface Pager<T>
|
||||
// MSON
|
||||
// -------------------------------------------- //
|
||||
|
||||
public List<Mson> getPageMson(int number, String title, Msonifier<T> msonifier, MassiveCommand command, List<String> args);
|
||||
public List<Mson> getPageMson(int number, String title, MassiveCommand command, List<String> args, Msonifier<T> msonifier);
|
||||
public List<Mson> getPageMson(int number, String title, MassiveCommand command, Msonifier<T> msonifier);
|
||||
|
||||
}
|
||||
|
@ -13,11 +13,13 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
// CORE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public int size()
|
||||
{
|
||||
return (int) Math.ceil((double) this.getItems().size() / this.getItemsPerPage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(int number)
|
||||
{
|
||||
if (this.isEmpty()) return false;
|
||||
@ -26,6 +28,7 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return this.getItems().isEmpty();
|
||||
@ -66,11 +69,13 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
// TXT
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public String getMessageEmpty()
|
||||
{
|
||||
return Txt.getMessageEmpty().toPlain(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageInvalid()
|
||||
{
|
||||
return Txt.getMessageInvalid(this.size()).toPlain(true);
|
||||
@ -81,7 +86,7 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
{
|
||||
List<String> ret = new ArrayList<String>();
|
||||
|
||||
List<Mson> msons = getPageMson(number, title, new Msonifier<T>(){
|
||||
List<Mson> msons = getPageMson(number, title, null, null, new Msonifier<T>(){
|
||||
|
||||
@Override
|
||||
public Mson toMson(T item, int index)
|
||||
@ -89,7 +94,7 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
return Mson.mson(stringifier.toString(item, index));
|
||||
}
|
||||
|
||||
}, null, null);
|
||||
});
|
||||
|
||||
for (Mson mson : msons)
|
||||
{
|
||||
@ -103,7 +108,8 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
// Mson
|
||||
// -------------------------------------------- //
|
||||
|
||||
public List<Mson> getPageMson(int number, String title, Msonifier<T> msonifier, MassiveCommand command, List<String> args)
|
||||
@Override
|
||||
public List<Mson> getPageMson(int number, String title, MassiveCommand command, List<String> args, Msonifier<T> msonifier)
|
||||
{
|
||||
List<Mson> ret = new ArrayList<Mson>();
|
||||
|
||||
@ -140,4 +146,10 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mson> getPageMson(int number, String title, MassiveCommand command, Msonifier<T> msonifier)
|
||||
{
|
||||
return this.getPageMson(number, title, command, command.getArgs(), msonifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SENDER UTIL METHOD MIRRORING
|
||||
// TYPE
|
||||
// -------------------------------------------- //
|
||||
|
||||
// IS
|
||||
@ -86,7 +86,10 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
return IdUtil.getAsConsole(this.getSender());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ONLINE / OFFLINE
|
||||
// -------------------------------------------- //
|
||||
// TODO: Update with new presence enumeration?
|
||||
|
||||
public boolean isOnline()
|
||||
{
|
||||
@ -113,8 +116,11 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
return Mixin.hasPlayedBefore(this.getId());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DISPLAY NAME
|
||||
// -------------------------------------------- //
|
||||
|
||||
// TODO: Remove this one shortly.
|
||||
@Deprecated
|
||||
public String getDisplayName()
|
||||
{
|
||||
@ -131,24 +137,11 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
return Mixin.getDisplayNameMson(this.getId(), watcherObject);
|
||||
}
|
||||
|
||||
// CONVENIENCE SEND MESSAGE
|
||||
// -------------------------------------------- //
|
||||
// MSG / MESSAGE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean sendMessage(String message)
|
||||
{
|
||||
return Mixin.messageOne(this.getId(), message);
|
||||
}
|
||||
|
||||
public boolean sendMessage(String... messages)
|
||||
{
|
||||
return Mixin.messageOne(this.getId(), messages);
|
||||
}
|
||||
|
||||
public boolean sendMessage(Collection<String> messages)
|
||||
{
|
||||
return Mixin.messageOne(this.getId(), messages);
|
||||
}
|
||||
|
||||
// CONVENIENCE MSG
|
||||
// MSG
|
||||
|
||||
public boolean msg(String msg)
|
||||
{
|
||||
@ -165,24 +158,26 @@ public abstract class SenderEntity<E extends SenderEntity<E>> extends Entity<E>
|
||||
return Mixin.msgOne(this.getId(), msgs);
|
||||
}
|
||||
|
||||
// CONVENIENCE SEND RAW
|
||||
// MESSAGE
|
||||
|
||||
public boolean sendRaw(Mson mson)
|
||||
public boolean message(Object message)
|
||||
{
|
||||
return Mixin.messageRawOne(this.getId(), mson);
|
||||
return Mixin.messageOne(this.getId(), message);
|
||||
}
|
||||
|
||||
public boolean sendRaw(Mson... msons)
|
||||
public boolean message(Object... messages)
|
||||
{
|
||||
return Mixin.messageRawOne(this.getId(), msons);
|
||||
return Mixin.messageOne(this.getId(), messages);
|
||||
}
|
||||
|
||||
public boolean sendRaw(Collection<Mson> msons)
|
||||
public boolean message(Collection<?> messages)
|
||||
{
|
||||
return Mixin.messageRawOne(this.getId(), msons);
|
||||
return Mixin.messageOne(this.getId(), messages);
|
||||
}
|
||||
|
||||
// CONVENIENCE GAME-MODE
|
||||
// -------------------------------------------- //
|
||||
// GAME-MODE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public GameMode getGameMode(GameMode def)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user