Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2523133110 #6

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Created by https://www.gitignore.io/api/java,maven,intellij,intellij+iml,intellij+all

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:

# Sensitive or high-churn files:

# Gradle:

# CMake

# Mongo Explorer plugin:

## File-based project format:

## Plugin-specific files:

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

### Intellij+all Patch ###
# Ignores the whole idea folder
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

### Intellij+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:

# Sensitive or high-churn files:

# Gradle:

# CMake

# Mongo Explorer plugin:

## File-based project format:

## Plugin-specific files:

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Manifest files
*.MF

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
38 changes: 38 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Don't use the Nukkit namespace for your own plugins -->
<groupId>cn.nukkit</groupId>
<artifactId>example-plugin</artifactId>
<version>1.0.0</version>
<name>ExamplePlugin</name>
<description>An Example Nukkit Plugin</description>
<url>https://github.com/CloudburstMC/ExamplePlugin/</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>nukkitx-repo</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>cn.nukkit</groupId>
<artifactId>nukkit</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<defaultGoal>clean package</defaultGoal>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package ExamplePlugin;
package cn.nukkit.exampleplugin;

import cn.nukkit.scheduler.PluginTask;

/**
* author: MagicDroidX
* ExamplePlugin Project
*/
public class BroadcastPluginTask extends PluginTask<MainClass> {
public class BroadcastPluginTask extends PluginTask<ExamplePlugin> {

public BroadcastPluginTask(MainClass owner) {
public BroadcastPluginTask(ExamplePlugin owner) {
super(owner);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ExamplePlugin;
package cn.nukkit.exampleplugin;

import cn.nukkit.event.EventHandler;
import cn.nukkit.event.EventPriority;
Expand All @@ -10,9 +10,9 @@
* NukkitExamplePlugin Project
*/
public class EventListener implements Listener {
MainClass plugin;
private final ExamplePlugin plugin;

public EventListener(MainClass plugin) {
public EventListener(ExamplePlugin plugin) {
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ExamplePlugin;
package cn.nukkit.exampleplugin;

import cn.nukkit.command.Command;
import cn.nukkit.command.CommandSender;
Expand All @@ -15,7 +15,7 @@
* author: MagicDroidX
* NukkitExamplePlugin Project
*/
public class MainClass extends PluginBase {
public class ExamplePlugin extends PluginBase {

@Override
public void onLoad() {
Expand Down Expand Up @@ -61,7 +61,7 @@ public void onDisable() {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (command.getName()) {
switch (command.getName().toLowerCase()) {
case "example":
try {
this.getLogger().info(Utils.readFile(new File(this.getDataFolder(), "string.txt")) + " " + sender.getName());
Expand Down
26 changes: 21 additions & 5 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
#name, main, version and api are required
name: ExamplePlugin
main: ExamplePlugin.MainClass
main: cn.nukkit.exampleplugin.ExamplePlugin
#remember version and api is string, don't write it like this: 1.0.0, or there will be an exception
version: "1.0.0"
api: ["1.0.0"]

api: ["1.0.5"]
load: POSTWORLD
author: Nukkit Project
# Authors and author will be added together in one list.
authors: ["Example", "Another"]
description: Example plugin showing the API
website: https://github.com/Nukkit/ExamplePlugin
website: https://github.com/NukkitX/ExamplePlugin
# These dependencies are required for the plugin to start.
#depend: ["OtherPlugin", "ThisPlugin"]
# These dependencies are not required.
softdepend: ["PluginA", "PluginB"]
# Log prefix in console
prefix: "Example"
# Plugin will be loaded before these. Any cyclic loadbefore's or dependencies's will throw errors!
loadbefore: ["ImportantPlugin"]

commands:
example:
description: Example command
usage: "/example"
aliases: ["xample", "nukkitexample"]
permission: exampleplugin.command.example
permission-message: "You do not have the required permission to run /example"
permissions:
exampleplugin.command.example:
description: "Allows the user to run the example command"
default: true
default: true
# children:
# exampleplugin.command.example.test:
# description: "Use the test feature in the example command"
# default: true