Package ch.njol.skript.classes
Class ClassInfo<T>
java.lang.Object
ch.njol.skript.classes.ClassInfo<T>
- Type Parameters:
T
- The class this info is for
- All Implemented Interfaces:
Debuggable
- Direct Known Subclasses:
EnumClassInfo
,RegistryClassInfo
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Use this asname(String)
to suppress warnings about missing documentation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionafter()
Sets one or more classes that this class should occur after in the class info list.before()
Sets one or more classes that this class should occur before in the class info list.changer
(SerializableChanger<? super T> changer) Deprecated.Clones the given object usingcloner
, returning the given object if noCloner
is registered.defaultExpression
(DefaultExpression<T> defaultExpression) description
(String... description) Only used for Skript's documentation.Overrides default documentation id, which is assigned from class name.Only used for Skript's documentation.getC()
@Nullable DefaultExpression
<T> @Nullable String[]
@Nullable String
@Nullable String
Gets overridden documentation id of this this type.@Nullable String[]
@Nullable Arithmetic
<? super T, ?> getMath()
Deprecated.@Nullable Class
<?> Deprecated.getName()
<R> @Nullable Arithmetic
<T, R> Deprecated.@Nullable String[]
@Nullable Class
<?> @Nullable Serializer
<? super T> @Nullable String
getSince()
@Nullable String[]
getUsage()
@Nullable Pattern[]
boolean
hasDocs()
static boolean
isVaildCodeName
(String name) Deprecated.static boolean
isValidCodeName
(String name) math
(Class<R> relativeType, Arithmetic<? super T, R> math) Deprecated.Only used for Skript's documentation.requiredPlugins
(String... pluginNames) Other plugin dependencies for this ClassInfo.serializeAs
(Class<?> serializeAs) serializer
(Serializer<? super T> serializer) Only used for Skript's documentation.Used for dynamically getting all the possible values of a classUsed for getting all the possible constants of a class@NotNull String
toString()
Should returntoString
(null, false)toString
(int flags) @NotNull String
toString
(@Nullable org.bukkit.event.Event event, boolean debug) Only used for Skript's documentation.
-
Field Details
-
NO_DOC
Use this asname(String)
to suppress warnings about missing documentation.
-
-
Constructor Details
-
ClassInfo
- Parameters:
c
- The classcodeName
- The name used in patterns
-
-
Method Details
-
isVaildCodeName
Deprecated.Incorrect spelling in method name. This will be removed in the future. -
isValidCodeName
-
parser
- Parameters:
parser
- A parser to parse values of this class or null if not applicable
-
cloner
- Parameters:
cloner
- ACloner
to clone values when setting variables or passing function arguments.
-
user
- Parameters:
userInputPatterns
- Regex patterns to match this class, e.g. in the expressions loop-[type], random [type] out of ..., or as command arguments. These patterns must be english and match singular and plural.- Throws:
PatternSyntaxException
- If any of the patterns' syntaxes is invalid
-
defaultExpression
- Parameters:
defaultExpression
- The default (event) value of this class or null if not applicable- See Also:
-
supplier
Used for dynamically getting all the possible values of a class- Parameters:
supplier
- The supplier of the values- Returns:
- This ClassInfo object
- See Also:
-
supplier
Used for getting all the possible constants of a class- Parameters:
values
- The array of the values- Returns:
- This ClassInfo object
- See Also:
-
serializer
-
serializeAs
-
changer
Deprecated. -
changer
-
math
Deprecated. -
name
Only used for Skript's documentation.- Parameters:
name
-- Returns:
- This ClassInfo object
-
description
Only used for Skript's documentation.- Parameters:
description
-- Returns:
- This ClassInfo object
-
usage
Only used for Skript's documentation.- Parameters:
usage
-- Returns:
- This ClassInfo object
-
examples
Only used for Skript's documentation.- Parameters:
examples
-- Returns:
- This ClassInfo object
-
since
Only used for Skript's documentation.- Parameters:
since
-- Returns:
- This ClassInfo object
-
requiredPlugins
Other plugin dependencies for this ClassInfo. Only used for Skript's documentation.- Parameters:
pluginNames
-- Returns:
- This ClassInfo object
-
documentationId
Overrides default documentation id, which is assigned from class name. This is especially useful for inner classes whose names are useless without parent class name as a context.- Parameters:
id
- Documentation id override.- Returns:
- This ClassInfo object.
-
getC
-
getName
-
getCodeName
-
getDefaultExpression
-
getParser
-
getCloner
-
clone
Clones the given object usingcloner
, returning the given object if noCloner
is registered. -
getUserInputPatterns
-
getChanger
-
getSupplier
-
getSerializer
-
getSerializeAs
-
getMath
Deprecated. -
getRelativeMath
Deprecated. -
getMathRelativeType
Deprecated. -
getDescription
-
getUsage
-
getExamples
-
getSince
-
getDocName
-
getRequiredPlugins
-
getDocumentationID
Gets overridden documentation id of this this type. If no override has been set, null is returned and the caller may try to derive this from name of#getC()
.- Returns:
- Documentation id override, or null.
-
hasDocs
public boolean hasDocs() -
before
Sets one or more classes that this class should occur before in the class info list. This only affects the order in which classes are parsed if it's unknown of which type the parsed string is.Please note that subclasses will always be registered before superclasses, no matter what is defined here or in
after(String...)
.This list can safely contain classes that may not exist.
- Parameters:
before
-- Returns:
- this ClassInfo
-
after
Sets one or more classes that this class should occur after in the class info list. This only affects the order in which classes are parsed if it's unknown of which type the parsed string is.Please note that subclasses will always be registered before superclasses, no matter what is defined here or in
before(String...)
.This list can safely contain classes that may not exist.
- Parameters:
after
-- Returns:
- this ClassInfo
-
before
- Returns:
- Set of classes that should be after this one. May return null.
-
after
- Returns:
- Set of classes that should be before this one. Never returns null.
-
toString
Description copied from interface:Debuggable
Should returntoString
(null, false)- Specified by:
toString
in interfaceDebuggable
- Overrides:
toString
in classObject
-
toString
-
toString
@NotNull public @NotNull String toString(@Nullable @Nullable org.bukkit.event.Event event, boolean debug) - Specified by:
toString
in interfaceDebuggable
- Parameters:
event
- The event to get information from. This is always null if debug == false.debug
- If true this should print more information, if false this should print what is shown to the end user- Returns:
- String representation of this object
-