0.3h Property sender to sender entity

This commit is contained in:
BuildTools 2016-03-17 23:05:09 +01:00 committed by Olof Larsson
parent 7b69175c0f
commit 930ebd71b4
2 changed files with 46 additions and 2 deletions

View File

@ -130,14 +130,14 @@ public abstract class CommandEditContainerAbstract<O, V> extends CommandEditAbst
Collection<Object> additions = ContainerUtil.getAdditions(before, after);
if ( ! additions.isEmpty())
{
messages.add(Mson.prepondfix(mson("Additions: ").color(ChatColor.AQUA), this.getValueType().getVisualMson((V) additions), null));
messages.add(Mson.prepondfix(mson("Additions: ").color(ChatColor.AQUA), this.getValueType().getVisualMson((V) additions, sender), null));
}
// Note: The result of getDeletions is not actually V, but the implementation doesn't care.
Collection<Object> deletions = ContainerUtil.getDeletions(before, after);
if ( ! deletions.isEmpty())
{
messages.add(Mson.prepondfix(mson("Deletions: ").color(ChatColor.AQUA), this.getValueType().getVisualMson((V) deletions), null));
messages.add(Mson.prepondfix(mson("Deletions: ").color(ChatColor.AQUA), this.getValueType().getVisualMson((V) deletions, sender), null));
}
message(messages);

View File

@ -0,0 +1,44 @@
package com.massivecraft.massivecore.command.editor;
import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.command.type.sender.TypeSender;
import com.massivecraft.massivecore.store.SenderColl;
import com.massivecraft.massivecore.store.SenderEntity;
public class PropertyThisSenderEntity<O extends SenderEntity<O>> extends Property<CommandSender, O>
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final SenderColl<O> coll;
public SenderColl<O> getColl() { return this.coll; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public PropertyThisSenderEntity(SenderColl<O> coll)
{
super(TypeSender.get(), coll.getTypeEntity(), "this");
this.coll = coll;
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public O getRaw(CommandSender object)
{
return coll.get(object);
}
@Override
public void setRaw(CommandSender object, O value)
{
return;
}
}