0.4h Better MessageMixin
This commit is contained in:
parent
f5682c354a
commit
03fcb2615b
@ -81,39 +81,50 @@ public abstract class MessageMixinAbstract implements MessageMixin
|
|||||||
@Override
|
@Override
|
||||||
public boolean messageAll(Object message)
|
public boolean messageAll(Object message)
|
||||||
{
|
{
|
||||||
return this.messageAll(Collections.singleton(message));
|
return this.messageAll(asCollection(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean messageAll(Object... messages)
|
public boolean messageAll(Object... messages)
|
||||||
{
|
{
|
||||||
return this.messageAll(Arrays.asList(messages));
|
return this.messageAll(asCollection(messages));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Predicate
|
// Predicate
|
||||||
@Override
|
@Override
|
||||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Object message)
|
public boolean messagePredicate(Predicate<CommandSender> predicate, Object message)
|
||||||
{
|
{
|
||||||
return this.messagePredicate(predicate, Collections.singleton(message));
|
return this.messagePredicate(predicate, asCollection(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages)
|
public boolean messagePredicate(Predicate<CommandSender> predicate, Object... messages)
|
||||||
{
|
{
|
||||||
return this.messagePredicate(predicate, Arrays.asList(messages));
|
return this.messagePredicate(predicate, asCollection(messages));
|
||||||
}
|
}
|
||||||
|
|
||||||
// One
|
// One
|
||||||
@Override
|
@Override
|
||||||
public boolean messageOne(Object sendeeObject, Object message)
|
public boolean messageOne(Object sendeeObject, Object message)
|
||||||
{
|
{
|
||||||
return this.messageOne(sendeeObject, Collections.singleton(message));
|
return this.messageOne(sendeeObject, asCollection(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean messageOne(Object sendeeObject, Object... messages)
|
public boolean messageOne(Object sendeeObject, Object... messages)
|
||||||
{
|
{
|
||||||
return this.messageOne(sendeeObject, Arrays.asList(messages));
|
return this.messageOne(sendeeObject, asCollection(messages));
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// UTIL
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public Collection<?> asCollection(Object message)
|
||||||
|
{
|
||||||
|
if (message instanceof Collection) return (Collection<?>) message;
|
||||||
|
if (message instanceof Object[]) return Arrays.asList((Object[]) message);
|
||||||
|
return Collections.singleton(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user