Skip to content

Instantly share code, notes, and snippets.

@csh
Created April 14, 2016 21:19
Show Gist options
  • Save csh/de7970b02642bec839db66a895211ba0 to your computer and use it in GitHub Desktop.
Save csh/de7970b02642bec839db66a895211ba0 to your computer and use it in GitHub Desktop.
<templateSet group="bukkit/scheduler">
<template name="runTask" value="org.bukkit.Bukkit.getScheduler().runTask($PLUGIN$, () -&gt; {&#10; $END$&#10;});" description="Executes a task using the given Plugin instance" toReformat="true" toShortenFQNames="true">
<variable name="PLUGIN" expression="variableOfType(&quot;org.bukkit.plugin.Plugin&quot;)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_CODE" value="false" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="runTaskAsynchronously" value="org.bukkit.Bukkit.getScheduler().runTaskAsynchronously($PLUGIN$, () -&gt; {&#10; $END$&#10;});" description="Executes a task asynchronously using the given Plugin instance" toReformat="true" toShortenFQNames="true">
<variable name="PLUGIN" expression="variableOfType(&quot;org.bukkit.plugin.Plugin&quot;)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_CODE" value="false" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="runTaskTimer" value="org.bukkit.Bukkit.getScheduler().runTaskTimer($PLUGIN$, () -&gt; {&#10; $END$&#10;}, $PAUSE$, $EVERY$);" description="Executes a task every n ticks using the given Plugin instance" toReformat="true" toShortenFQNames="true">
<variable name="PLUGIN" expression="variableOfType(&quot;org.bukkit.plugin.Plugin&quot;)" defaultValue="" alwaysStopAt="false" />
<variable name="PAUSE" expression="expectedType()" defaultValue="" alwaysStopAt="true" />
<variable name="EVERY" expression="expectedType()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="false" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="runnable" value="new org.bukkit.scheduler.BukkitRunnable() {&#10; @Override&#10; public void run() {&#10; $END$&#10; }&#10;};" description="Create a new BukkitRunnable" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
<option name="COMPLETION" value="true" />
</context>
</template>
</templateSet>
<templateSet group="bukkit/utility">
<template name="handler" value="@org.bukkit.event.EventHandler&#10;public void handle($TYPE$ event) {&#10; $END$&#10;}" description="Generate EventHandler annotated methods" toReformat="true" toShortenFQNames="true">
<variable name="TYPE" expression="variableOfType(&quot;org.bukkit.event.Event&quot;)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="scheduler" value="org.bukkit.Bukkit.getScheduler()" description="Retrieve the BukkitScheduler instance via the Bukkit utility class" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="COMPLETION" value="true" />
</context>
</template>
<template name="server" value="org.bukkit.Bukkit.getServer()" description="Retrieve the Server instance via the Bukkit utility class" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="COMPLETION" value="true" />
</context>
</template>
<template name="provider" value="org.bukkit.plugin.java.JavaPlugin.getProvidingPlugin($CURRENT$.class)" description="Retrieve the Plugin instance that provides the given class" toReformat="true" toShortenFQNames="true">
<variable name="CURRENT" expression="className" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="COMPLETION" value="true" />
</context>
</template>
<template name="service" value="org.bukkit.plugin.RegisteredServiceProvider&lt;$TYPE$&gt; provider = org.bukkit.Bukkit.getServicesManager().getRegistration($TYPE$.class);" description="Retrieve the service provider of a given type" toReformat="true" toShortenFQNames="true">
<variable name="TYPE" expression="variableOfType(Type)" defaultValue="Object" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="XML_TEXT" value="false" />
<option name="JSON" value="false" />
<option name="JAVA_CODE" value="false" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
<option name="JAVA_COMMENT" value="false" />
<option name="JAVA_STRING" value="false" />
<option name="COMPLETION" value="false" />
<option name="SQL" value="false" />
<option name="GROOVY" value="false" />
<option name="GROOVY_EXPRESSION" value="false" />
<option name="GROOVY_STATEMENT" value="false" />
<option name="GROOVY_DECLARATION" value="false" />
<option name="MAVEN" value="false" />
<option name="KOTLIN" value="false" />
<option name="KOTLIN_TOPLEVEL" value="false" />
<option name="KOTLIN_STATEMENT" value="false" />
<option name="KOTLIN_CLASS" value="false" />
<option name="KOTLIN_EXPRESSION" value="false" />
<option name="KOTLIN_COMMENT" value="false" />
<option name="OTHER" value="false" />
</context>
</template>
<template name="pwp" value="new java.util.ArrayList&lt;Player&gt;();&#10;for (org.bukkit.entity.Player player : org.bukkit.Bukkit.getOnlinePlayers()) {&#10; if (player.hasPermission(&quot;$PERMISSION$&quot;)) {&#10; $VAR$.add(player);&#10; }&#10;}" description="Populate a Collection with players that have a specific permission" toReformat="false" toShortenFQNames="true">
<variable name="PERMISSION" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="VAR" expression="variableOfType(&quot;java.util.List&quot;)" defaultValue="players" alwaysStopAt="false" />
<context>
<option name="JAVA_CODE" value="false" />
<option name="JAVA_STATEMENT" value="false" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="false" />
<option name="COMPLETION" value="true" />
</context>
</template>
</templateSet>
<templateSet group="xml">
<template name="spigot" value="&lt;repository&gt;&#10; &lt;id&gt;spigot-repo&lt;/id&gt;&#10; &lt;url&gt;https://hub.spigotmc.org/nexus/content/groups/public&lt;/url&gt;&#10;&lt;/repository&gt;" description="Spigot repository" toReformat="false" toShortenFQNames="true">
<context>
<option name="XML_TEXT" value="true" />
</context>
</template>
</templateSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment