First commit.
This commit is contained in:
commit
49aa5f8679
10 changed files with 143 additions and 0 deletions
12
.classpath
Normal file
12
.classpath
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="/home/adrian/Downloads/craftbukkit-1060.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/tenkumaLib"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
.project
Normal file
17
.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>aboukkit</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
9
.settings/org.eclipse.jdt.core.prefs
Normal file
9
.settings/org.eclipse.jdt.core.prefs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
BIN
bin/gd/rf/adrian/aboukkit/CustomCommand.class
Normal file
BIN
bin/gd/rf/adrian/aboukkit/CustomCommand.class
Normal file
Binary file not shown.
BIN
bin/gd/rf/adrian/aboukkit/aboukkit.class
Normal file
BIN
bin/gd/rf/adrian/aboukkit/aboukkit.class
Normal file
Binary file not shown.
14
config.yml
Normal file
14
config.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# IMPORTANT: for your commands to work you will need to register them
|
||||
# Open this plugin's jar with a archive manager and add your command to plugin.yml
|
||||
# Here lies your custom commands
|
||||
commands:
|
||||
- 'about'
|
||||
- 'aboukkit'
|
||||
# and here you define a string list for each command
|
||||
# & will be automatically converted to §$ so you can use colors
|
||||
about:
|
||||
- "&cThis plugin has not been configured yet!"
|
||||
- "Visit our website at &l&1https://betamargarina.rf.gd&f for server &cbackup downloads&f, our &cwiki&f and much more!"
|
||||
- "&6Aboukkit, by &9Adrian Victor&6. Uses code from &9AleksandarHaralanov"
|
||||
aboukkit:
|
||||
- 'This server is running aboukkit.'
|
||||
10
plugin.yml
Normal file
10
plugin.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
name: Aboukkit
|
||||
main: gd.rf.adrian.aboukkit.aboukkit
|
||||
version: 2.0
|
||||
commands:
|
||||
about:
|
||||
description: Shows info about this server.
|
||||
usage: /about
|
||||
aboukkit:
|
||||
description: Shows info about the Aboukkit plugin.
|
||||
usage: /aboukkit
|
||||
36
src/gd/rf/adrian/aboukkit/CustomCommand.java
Normal file
36
src/gd/rf/adrian/aboukkit/CustomCommand.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package gd.rf.adrian.aboukkit;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import gd.rf.adrianvictor.lib.Color;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomCommand implements CommandExecutor {
|
||||
private final String commandName;
|
||||
|
||||
public CustomCommand(String commandName) {
|
||||
this.commandName = commandName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
List<String> messages = aboukkit.getPluginConfig().getStringList(commandName, new ArrayList<>());
|
||||
|
||||
if (messages == null || messages.isEmpty()) {
|
||||
sender.sendMessage(ChatColor.RED + "No response set for this command in config.yml.");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (String message : messages) {
|
||||
sender.sendMessage(Color.formatColors(message));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
43
src/gd/rf/adrian/aboukkit/aboukkit.java
Normal file
43
src/gd/rf/adrian/aboukkit/aboukkit.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package gd.rf.adrian.aboukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import gd.rf.adrianvictor.lib.Configuration;
|
||||
import gd.rf.adrianvictor.lib.Log;
|
||||
|
||||
public class aboukkit extends JavaPlugin {
|
||||
private static PluginDescriptionFile pdf;
|
||||
private static Configuration config;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
pdf = getDescription();
|
||||
config = new Configuration(this, "config.yml");
|
||||
config.loadConfig();
|
||||
|
||||
Log.info(this + " enabled (version " + pdf.getVersion() + ")");
|
||||
List<String> userCommands = aboukkit.getPluginConfig().getStringList("commands", new ArrayList<>());
|
||||
|
||||
for (String userCommand : userCommands) {
|
||||
if (getCommand(userCommand) != null) {
|
||||
getCommand(userCommand).setExecutor(new CustomCommand(userCommand));
|
||||
Log.info("[Aboukkit] Registered command: " + userCommand);
|
||||
} else {
|
||||
Log.warning("[Aboukkit] Command '" + userCommand + "' is missing from plugin.yml!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
}
|
||||
|
||||
public static Configuration getPluginConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue