Editor getUsedSettings
This commit is contained in:
parent
f133149321
commit
9a50457b3d
@ -11,7 +11,7 @@ public class CommandEditUsed<O> extends CommandEditSimple<CommandSender, O>
|
||||
public CommandEditUsed(EditSettings<O> settings)
|
||||
{
|
||||
// Super
|
||||
super(settings.createUsedSettings(), settings.getUsedProperty());
|
||||
super(settings.getUsedSettings(), settings.getUsedProperty());
|
||||
|
||||
// Aliases
|
||||
this.setAliases("used", "selected");
|
||||
|
@ -26,6 +26,28 @@ public class EditSettings<O>
|
||||
public Property<CommandSender, O> getUsedProperty() { return this.usedProperty; }
|
||||
public void setUsedProperty(Property<CommandSender, O> usedProperty) { this.usedProperty = usedProperty; }
|
||||
|
||||
// The Internal EditSettings<CommandSender> for setting the used.
|
||||
protected EditSettings<CommandSender> usedSettings = null;
|
||||
public EditSettings<CommandSender> getUsedSettings()
|
||||
{
|
||||
if (this.usedSettings == null)
|
||||
{
|
||||
this.usedSettings = this.createUsedSettings();
|
||||
}
|
||||
return this.usedSettings;
|
||||
}
|
||||
protected EditSettings<CommandSender> createUsedSettings()
|
||||
{
|
||||
final EditSettings<O> main = this;
|
||||
return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get())) {
|
||||
@Override
|
||||
public Permission getPropertyPermission(Property<CommandSender,?> property)
|
||||
{
|
||||
return main.getUsedPermission();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
@ -41,20 +63,6 @@ public class EditSettings<O>
|
||||
this(objectType, null);
|
||||
}
|
||||
|
||||
public EditSettings<CommandSender> createUsedSettings()
|
||||
{
|
||||
final EditSettings<O> main = this;
|
||||
return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get())) {
|
||||
|
||||
@Override
|
||||
public Permission getPropertyPermission(Property<CommandSender,?> property)
|
||||
{
|
||||
return main.getUsedPermission();
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OBJECT
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user