Browse Source

Uploaded source

master
Jens F. 1 year ago
commit
4087a8092f

+ 3
- 0
.gitignore View File

@@ -0,0 +1,3 @@
/target/
/nb-configuration.xml
/licenseheader.txt

+ 0
- 0
README.md View File


+ 52
- 0
pom.xml View File

@@ -0,0 +1,52 @@
<?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>
<groupId>com.ancient.addon.examples</groupId>
<artifactId>Ancient-RPG-Example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<!-- Spigot -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--Ancient API-->
<dependency>
<groupId>com.ancient</groupId>
<artifactId>Ancient-RPG</artifactId>
<version>1.0.0</version>
</dependency>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Bukkit API-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<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>
</project>

+ 72
- 0
src/main/java/com/ancient/addon/example/ExampleAddon.java View File

@@ -0,0 +1,72 @@
package com.ancient.addon.example;
import com.ancient.AddonsV3.Abstract.JavaAddon;
import com.ancient.AddonsV3.Annotations.AddonInfo;
import com.ancient.Util.Console;
import com.ancient.addon.example.commands.ExampleCommand;
import com.ancient.addon.example.listeners.ExampleListener;
/**
* The addons main-class.
* @author Th3Shadowbroker
*/
@AddonInfo
(
name = "Testaddon",
author = "Th3Shadowbroker",
description = "Another addon for testing.",
version = "1.0.0"
)
public class ExampleAddon extends JavaAddon
{
//A prefix
private final String prefix = "[Testaddon] ";
//The current instance of our addon.
private static ExampleAddon instance;
@Override
public void onEnable()
{
//Assign the instance
instance = this;
//Let's write something to console!
Console.println( prefix + "Loaded the Testaddon!" );
//Let's assign our command and our listener
registerCommand( new ExampleCommand() );
registerListener( new ExampleListener() );
}
@Override
public void onDisable()
{
//That's it!
Console.println( prefix + "Unloaded the Testaddon!" );
}
/**
* Get our addons prefix.
* @return String
*/
public static String getPrefix()
{
return instance.prefix;
}
/**
* Get the instance of this class.
* @return ExampleAddon
*/
public static ExampleAddon getInstance()
{
return instance;
}
}

+ 39
- 0
src/main/java/com/ancient/addon/example/commands/ExampleCommand.java View File

@@ -0,0 +1,39 @@
package com.ancient.addon.example.commands;
import com.ancient.AddonsV3.Annotations.CommandInfo;
import com.ancient.addon.example.ExampleAddon;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* A simple command.
* @author Th3Shadowbroker
*/
@CommandInfo
(
key = "example",
description = "A command for testing!",
aliases = {"test"},
permission = "addon.test",
usage = "/example"
)
public class ExampleCommand implements CommandExecutor
{
@Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args)
{
//Our player.
Player player = (Player) sender;
//Let's send a message!
player.sendMessage( ExampleAddon.getPrefix() + "§2Done!" );
//Done for now.
return true;
}
}

+ 22
- 0
src/main/java/com/ancient/addon/example/listeners/ExampleListener.java View File

@@ -0,0 +1,22 @@
package com.ancient.addon.example.listeners;
import com.ancient.addon.example.ExampleAddon;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
/**
* A simple listener.
* @author Th3Shadowbroker
*/
public class ExampleListener implements Listener
{
@EventHandler
public void onPlayerJoin( PlayerJoinEvent ev )
{
//Let's send a message
ev.setJoinMessage( ExampleAddon.getPrefix() + "§2Another join message!" );
}
}

Loading…
Cancel
Save