Property Visibility. Add some editor annotations to config.
This commit is contained in:
parent
792c379542
commit
033aebea05
@ -6,6 +6,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.bukkit.permissions.Permissible;
|
import org.bukkit.permissions.Permissible;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.command.editor.annotation.EditorNullable;
|
||||||
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
|
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
|
||||||
import com.massivecraft.massivecore.store.Entity;
|
import com.massivecraft.massivecore.store.Entity;
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
@ -27,10 +28,15 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Base command aliases.
|
// Base command aliases.
|
||||||
|
|
||||||
|
@EditorNullable(false)
|
||||||
public List<String> aliasesMcore = MUtil.list("massivecore", "mcore");
|
public List<String> aliasesMcore = MUtil.list("massivecore", "mcore");
|
||||||
|
@EditorNullable(false)
|
||||||
public List<String> aliasesUsys = MUtil.list("usys");
|
public List<String> aliasesUsys = MUtil.list("usys");
|
||||||
|
@EditorNullable(false)
|
||||||
public List<String> aliasesMstore = MUtil.list("massivestore", "mstore");
|
public List<String> aliasesMstore = MUtil.list("massivestore", "mstore");
|
||||||
|
@EditorNullable(false)
|
||||||
public List<String> aliasesBuffer = MUtil.list("buffer");
|
public List<String> aliasesBuffer = MUtil.list("buffer");
|
||||||
|
@EditorNullable(false)
|
||||||
public List<String> aliasesCmdurl = MUtil.list("cmdurl");
|
public List<String> aliasesCmdurl = MUtil.list("cmdurl");
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -48,6 +54,7 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Permission denied formatting.
|
// Permission denied formatting.
|
||||||
|
|
||||||
|
@EditorNullable(false)
|
||||||
public Map<String, String> permissionDeniedFormats = MUtil.map(
|
public Map<String, String> permissionDeniedFormats = MUtil.map(
|
||||||
"some.awesome.permission.node", "<b>You must be awesome to %s<b>.",
|
"some.awesome.permission.node", "<b>You must be awesome to %s<b>.",
|
||||||
"some.derp.permission.node.1", "derp",
|
"some.derp.permission.node.1", "derp",
|
||||||
@ -70,6 +77,7 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Teleportation delay permissions.
|
// Teleportation delay permissions.
|
||||||
|
|
||||||
|
@EditorNullable(false)
|
||||||
public Map<String, Integer> permissionToTpdelay = MUtil.map(
|
public Map<String, Integer> permissionToTpdelay = MUtil.map(
|
||||||
"massivecore.notpdelay", 0,
|
"massivecore.notpdelay", 0,
|
||||||
"default", 10
|
"default", 10
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import com.massivecraft.massivecore.MassiveException;
|
import com.massivecraft.massivecore.MassiveException;
|
||||||
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.command.Visibility;
|
||||||
import com.massivecraft.massivecore.command.requirement.RequirementEditorUse;
|
import com.massivecraft.massivecore.command.requirement.RequirementEditorUse;
|
||||||
import com.massivecraft.massivecore.command.type.Type;
|
import com.massivecraft.massivecore.command.type.Type;
|
||||||
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
||||||
@ -58,6 +59,13 @@ public class CommandEditAbstract<O, V> extends MassiveCommand
|
|||||||
// OVERRIDE
|
// OVERRIDE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Visibility getVisibility()
|
||||||
|
{
|
||||||
|
if ( ! this.getProperty().isVisible()) return Visibility.INVISIBLE;
|
||||||
|
return super.getVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() throws MassiveException
|
public void perform() throws MassiveException
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,10 @@ public abstract class Property<O, V> implements Named
|
|||||||
// SETTINGS
|
// SETTINGS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
protected boolean visible = true;
|
||||||
|
public boolean isVisible() { return this.visible; }
|
||||||
|
public void setVisible(boolean visible) { this.visible = visible; }
|
||||||
|
|
||||||
protected boolean inheritable = true;
|
protected boolean inheritable = true;
|
||||||
public boolean isInheritable() { return this.inheritable; }
|
public boolean isInheritable() { return this.inheritable; }
|
||||||
public void setInheritable(boolean inheritable) { this.inheritable = inheritable; }
|
public void setInheritable(boolean inheritable) { this.inheritable = inheritable; }
|
||||||
@ -233,6 +237,7 @@ public abstract class Property<O, V> implements Named
|
|||||||
// Fill
|
// Fill
|
||||||
for (Property<O, ?> property : properties)
|
for (Property<O, ?> property : properties)
|
||||||
{
|
{
|
||||||
|
if ( ! property.isVisible()) continue;
|
||||||
ret.addAll(property.getShowLines(object, sender));
|
ret.addAll(property.getShowLines(object, sender));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ public class PropertyReflection<O, V> extends Property<O, V>
|
|||||||
ReflectionUtil.makeAccessible(field);
|
ReflectionUtil.makeAccessible(field);
|
||||||
this.field = field;
|
this.field = field;
|
||||||
|
|
||||||
|
this.setVisible(isVisible(field));
|
||||||
this.setInheritable(isInheritable(field));
|
this.setInheritable(isInheritable(field));
|
||||||
this.setEditable(isEditable(field));
|
this.setEditable(isEditable(field));
|
||||||
this.setNullable(isNullable(field));
|
this.setNullable(isNullable(field));
|
||||||
@ -106,7 +107,7 @@ public class PropertyReflection<O, V> extends Property<O, V>
|
|||||||
|
|
||||||
// Fill > Standard
|
// Fill > Standard
|
||||||
int modifiers = field.getModifiers();
|
int modifiers = field.getModifiers();
|
||||||
if (Modifier.isFinal(modifiers)) ret = false;
|
if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers) || Modifier.isFinal(modifiers)) ret = false;
|
||||||
|
|
||||||
// Fill > Annotation
|
// Fill > Annotation
|
||||||
EditorEditable annotation = field.getAnnotation(EditorEditable.class);
|
EditorEditable annotation = field.getAnnotation(EditorEditable.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user