Placeholder Annotation Processor
Do you find it tiring to create placeholders again and again? Does this task eat up a lot of your time set aside for development?
Let me introduce
PAP (Placeholder Annotation Processor)
. This tool is designed to make the process of creating placeholders much easier and faster for you.
COMPATIBILITY
At present, PAP is designed to work conjointly with
PlaceholderAPI but is intended to work with other plugin in the future.
USAGE
A step by step guide is available HERE
EXAMPLES
Code (Java):
@Placeholder
(identifier
=
"done"
)
@RequireOnlinePlayer
public
String onDone
(RequestIssuer issuer
)
{
final QuestPlayer questPlayer
= QuestPlayer.
getQuestPlayer
(issuer.
getPlayer
(
).
getUniqueId
(
)
)
;
return
String.
valueOf
(questPlayer.
getNumberOfQuestsDone
(
)
)
;
}
@DefaultPlaceholder
@Placeholder
(identifier
=
"quest"
)
@RequireOnlinePlayer
public
String onQuest
(RequestIssuer issuer,
String serviceId,
Integer index, @Optional
(defaultArg
=
"display"
)
String param
)
{
final QuestPlayer questPlayer
= QuestPlayer.
getQuestPlayer
(issuer.
getPlayer
(
).
getUniqueId
(
)
)
;
final List
<ActiveQuest
> activeQuests
= questPlayer.
getActiveQuests
(serviceId
)
;
if
(activeQuests.
size
(
)
<= index
)
{
return
null
;
}
final ActiveQuest activeQuest
= activeQuests.
get
(index
)
;
final Quest quest
= plugin.
getQuestManager
(
).
fromId
(activeQuest.
getQuestId
(
)
)
;
switch
(param.
toLowerCase
(
Locale.
ROOT
)
)
{
case
"display"
:
return quest.
getDisplay
(
)
;
case
"type"
:
return quest.
getType
(
).
name
(
).
toLowerCase
(
Locale.
ROOT
)
;
case
"progress"
:
return
String.
valueOf
(activeQuest.
getProgress
(
)
)
;
case
"required"
:
return
String.
valueOf
(quest.
getRequiredAmount
(
)
)
;
case
"progressbar"
:
return ProgressUtil.
getProcessBar
(activeQuest.
getProgress
(
), quest.
getRequiredAmount
(
)
)
;
default
:
return
null
;
}
}
INSTALLATION
MAVEN
Code (Text):
<repositories>
<!-- Other repositories... -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- Other dependencies... -->
<dependency>
<groupId>com.github.Robotv2</groupId>
<artifactId>PlaceholderAnnotationProcessor</artifactId>
<version>[VERSION]</version>
</dependency>
</dependencies>
GRADLE
Code (Text):
repositories {
// Other repositories...
maven { url = 'https://jitpack.io' }
}
dependencies {
// Other dependencies...
implementation 'com.github.Robotv2:PlaceholderAnnotationProcessor:[VERSION]'
}