Skip to content

Commit 03c07ca

Browse files
committed
Mavenize the project and add more to plugin.yml
1 parent 39d6789 commit 03c07ca

File tree

6 files changed

+237
-13
lines changed

6 files changed

+237
-13
lines changed

.gitignore

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Created by https://www.gitignore.io/api/java,maven,intellij,intellij+iml,intellij+all
2+
3+
### Intellij ###
4+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
5+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
6+
7+
# User-specific stuff:
8+
.idea/**/workspace.xml
9+
.idea/**/tasks.xml
10+
.idea/dictionaries
11+
12+
# Sensitive or high-churn files:
13+
.idea/**/dataSources/
14+
.idea/**/dataSources.ids
15+
.idea/**/dataSources.xml
16+
.idea/**/dataSources.local.xml
17+
.idea/**/sqlDataSources.xml
18+
.idea/**/dynamic.xml
19+
.idea/**/uiDesigner.xml
20+
21+
# Gradle:
22+
.idea/**/gradle.xml
23+
.idea/**/libraries
24+
25+
# CMake
26+
cmake-build-debug/
27+
28+
# Mongo Explorer plugin:
29+
.idea/**/mongoSettings.xml
30+
31+
## File-based project format:
32+
*.iws
33+
34+
## Plugin-specific files:
35+
36+
# IntelliJ
37+
/out/
38+
39+
# mpeltonen/sbt-idea plugin
40+
.idea_modules/
41+
42+
# JIRA plugin
43+
atlassian-ide-plugin.xml
44+
45+
# Cursive Clojure plugin
46+
.idea/replstate.xml
47+
48+
# Crashlytics plugin (for Android Studio and IntelliJ)
49+
com_crashlytics_export_strings.xml
50+
crashlytics.properties
51+
crashlytics-build.properties
52+
fabric.properties
53+
54+
### Intellij Patch ###
55+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
56+
57+
# *.iml
58+
# modules.xml
59+
# .idea/misc.xml
60+
# *.ipr
61+
62+
# Sonarlint plugin
63+
.idea/sonarlint
64+
65+
### Intellij+all ###
66+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
67+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
68+
69+
# User-specific stuff:
70+
71+
# Sensitive or high-churn files:
72+
73+
# Gradle:
74+
75+
# CMake
76+
77+
# Mongo Explorer plugin:
78+
79+
## File-based project format:
80+
81+
## Plugin-specific files:
82+
83+
# IntelliJ
84+
85+
# mpeltonen/sbt-idea plugin
86+
87+
# JIRA plugin
88+
89+
# Cursive Clojure plugin
90+
91+
# Crashlytics plugin (for Android Studio and IntelliJ)
92+
93+
### Intellij+all Patch ###
94+
# Ignores the whole idea folder
95+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
96+
97+
.idea/
98+
99+
### Intellij+iml ###
100+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
101+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
102+
103+
# User-specific stuff:
104+
105+
# Sensitive or high-churn files:
106+
107+
# Gradle:
108+
109+
# CMake
110+
111+
# Mongo Explorer plugin:
112+
113+
## File-based project format:
114+
115+
## Plugin-specific files:
116+
117+
# IntelliJ
118+
119+
# mpeltonen/sbt-idea plugin
120+
121+
# JIRA plugin
122+
123+
# Cursive Clojure plugin
124+
125+
# Crashlytics plugin (for Android Studio and IntelliJ)
126+
127+
### Intellij+iml Patch ###
128+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
129+
130+
*.iml
131+
modules.xml
132+
.idea/misc.xml
133+
*.ipr
134+
135+
### Java ###
136+
# Compiled class file
137+
*.class
138+
139+
# Log file
140+
*.log
141+
142+
# BlueJ files
143+
*.ctxt
144+
145+
# Mobile Tools for Java (J2ME)
146+
.mtj.tmp/
147+
148+
# Package Files #
149+
*.jar
150+
*.war
151+
*.ear
152+
*.zip
153+
*.tar.gz
154+
*.rar
155+
156+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
157+
hs_err_pid*
158+
159+
# Manifest files
160+
*.MF
161+
162+
### Maven ###
163+
target/
164+
pom.xml.tag
165+
pom.xml.releaseBackup
166+
pom.xml.versionsBackup
167+
pom.xml.next
168+
release.properties
169+
dependency-reduced-pom.xml
170+
buildNumber.properties
171+
.mvn/timing.properties
172+
173+
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
174+
!/.mvn/wrapper/maven-wrapper.jar

pom.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<!-- Don't use the Nukkit namespace for your own plugins -->
6+
<groupId>cn.nukkit</groupId>
7+
<artifactId>example-plugin</artifactId>
8+
<version>1.0.0</version>
9+
<name>ExamplePlugin</name>
10+
<description>An Example Nukkit Plugin</description>
11+
<url>https://github.com/NukkitX/ExamplePlugin/</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<maven.compiler.source>1.8</maven.compiler.source>
16+
<maven.compiler.target>1.8</maven.compiler.target>
17+
</properties>
18+
19+
<repositories>
20+
<repository>
21+
<id>potestas-repo</id>
22+
<url>http://repo.potestas.xyz/</url>
23+
</repository>
24+
</repositories>
25+
26+
<dependencies>
27+
<dependency>
28+
<groupId>cn.nukkit</groupId>
29+
<artifactId>nukkit</artifactId>
30+
<version>1.0-SNAPSHOT</version>
31+
<scope>provided</scope>
32+
</dependency>
33+
</dependencies>
34+
</project>

src/main/java/ExamplePlugin/BroadcastPluginTask.java renamed to src/main/java/cn/nukkit/exampleplugin/BroadcastPluginTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package ExamplePlugin;
1+
package cn.nukkit.exampleplugin;
22

33
import cn.nukkit.scheduler.PluginTask;
44

55
/**
66
* author: MagicDroidX
77
* ExamplePlugin Project
88
*/
9-
public class BroadcastPluginTask extends PluginTask<MainClass> {
9+
public class BroadcastPluginTask extends PluginTask<ExamplePlugin> {
1010

11-
public BroadcastPluginTask(MainClass owner) {
11+
public BroadcastPluginTask(ExamplePlugin owner) {
1212
super(owner);
1313
}
1414

src/main/java/ExamplePlugin/EventListener.java renamed to src/main/java/cn/nukkit/exampleplugin/EventListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ExamplePlugin;
1+
package cn.nukkit.exampleplugin;
22

33
import cn.nukkit.event.EventHandler;
44
import cn.nukkit.event.EventPriority;
@@ -10,9 +10,9 @@
1010
* NukkitExamplePlugin Project
1111
*/
1212
public class EventListener implements Listener {
13-
MainClass plugin;
13+
private final ExamplePlugin plugin;
1414

15-
public EventListener(MainClass plugin) {
15+
public EventListener(ExamplePlugin plugin) {
1616
this.plugin = plugin;
1717
}
1818

src/main/java/ExamplePlugin/MainClass.java renamed to src/main/java/cn/nukkit/exampleplugin/ExamplePlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ExamplePlugin;
1+
package cn.nukkit.exampleplugin;
22

33
import cn.nukkit.command.Command;
44
import cn.nukkit.command.CommandSender;
@@ -15,7 +15,7 @@
1515
* author: MagicDroidX
1616
* NukkitExamplePlugin Project
1717
*/
18-
public class MainClass extends PluginBase {
18+
public class ExamplePlugin extends PluginBase {
1919

2020
@Override
2121
public void onLoad() {
@@ -61,7 +61,7 @@ public void onDisable() {
6161

6262
@Override
6363
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
64-
switch (command.getName()) {
64+
switch (command.getName().toLowerCase()) {
6565
case "example":
6666
try {
6767
this.getLogger().info(Utils.readFile(new File(this.getDataFolder(), "string.txt")) + " " + sender.getName());

src/main/resources/plugin.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
11
#name, main, version and api are required
22
name: ExamplePlugin
3-
main: ExamplePlugin.MainClass
3+
main: cn.nukkit.exampleplugin.ExamplePlugin
44
#remember version and api is string, don't write it like this: 1.0.0, or there will be an exception
55
version: "1.0.0"
66
api: ["1.0.0"]
7-
87
load: POSTWORLD
98
author: Nukkit Project
9+
# Authors and author will be added together in one list.
10+
authors: ["Example", "Another"]
1011
description: Example plugin showing the API
11-
website: https://github.com/Nukkit/ExamplePlugin
12+
website: https://github.com/NukkitX/ExamplePlugin
13+
# These dependencies are required for the plugin to start.
14+
depend: ["OtherPlugin", "ThisPlugin"]
15+
# These dependencies are not required.
16+
softdepend: ["PluginA", "PluginB"]
17+
# Log prefix in console
18+
prefix: "Example"
19+
# Plugin will be loaded before these. Any cyclic loadbefore's or dependencies's will throw errors!
20+
loadbefore: ["ImportantPlugin"]
21+
1222
commands:
1323
example:
1424
description: Example command
1525
usage: "/example"
26+
aliases: ["xample", "nukkitexample"]
1627
permission: exampleplugin.command.example
28+
permission-message: "You do not have the required permission to run /example"
1729
permissions:
1830
exampleplugin.command.example:
1931
description: "Allows the user to run the example command"
20-
default: true
32+
default: true
33+
children:
34+
# exampleplugin.command.example.test:
35+
# description: "Use the test feature in the example command"
36+
# default: true

0 commit comments

Comments
 (0)