Added Minecraft Support

MINECRAFT'd THE FUCK OUTTA THIS SHIT
This commit is contained in:
alisolarflare 2017-04-01 06:18:43 -04:00
parent ae067c0440
commit 237af2d973
12 changed files with 214 additions and 0 deletions

0
config.yml Normal file
View file

4
plugin.yml Normal file
View file

@ -0,0 +1,4 @@
main: buttondevteam.minecraft.Main
name: PlaceMinecraft
version: 0.0.1

View file

@ -0,0 +1,70 @@
package buttondevteam.architecture;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.architecture.commands.BaseCommand;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
/**
* A Module class allows the compacting of projects into one single package.
*
* Each feature can have its commands and listeners coded into the Module class,
* as well as any other pointers to memory units, or other classes in the package.
*
* This package can then be moved from eclipse project to eclipse project smoothly,
* as long as the destination project has the Module abstract class, and as long as all dependencies are either
* contained in the moved package, or moved along with it.
* @author Alisolarflare
*
*/
public abstract class Component{
/**
* Registers the module, when called by the JavaPlugin class. Call
* registerCommand() and registerListener() within this method.
*
* @param plugin Plugin class called to register commands and listeners
*/
public abstract void register(JavaPlugin plugin);
/**
* Registers a TBMCCommand to the plugin
* @param plugin Main plugin responsible for stuff
* @param label Name of the command in plugin.yml
* @param commandExecutor Custom coded CommandExecutor class
*/
protected void registerCommand(JavaPlugin plugin, BaseCommand commandBase){
TBMCChatAPI.AddCommand(plugin, commandBase);
//plugin.getCommand(commandBase.getClass().getSimpleName().toString()).setExecutor(commandBase);
}
/**
* Registers a Listener to this plugin
* @param plugin Main plugin responsible for stuff
* @param label Name of the command in plugin.yml
* @param commandExecutor Custom coded CommandExecutor class
*/
protected Listener registerListener(JavaPlugin plugin, Listener listener){
TBMCCoreAPI.RegisterEventsForExceptions(listener, plugin);
return listener;
}
public void saveData(FileConfiguration config, String pathToData, Object data){
config.set("moduledata." + this.getClassName() + "." + pathToData, data);
}
public Object getData(FileConfiguration config, String pathToData, Object data){
return config.get("moduledata." + this.getClassName() + "." + pathToData, data);
}
public String getClassName(){
Class<?> enclosingClass = getClass().getEnclosingClass();
String className = "nullModule";
if (enclosingClass != null) {
className = (enclosingClass.getName());
} else {
className = (getClass().getName());
}
return className;
}
}

View file

@ -0,0 +1,22 @@
package buttondevteam.architecture.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public abstract class BaseCommand extends TBMCCommandBase implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// TODO Auto-generated method stub
return OnCommand(sender, label, args);
}
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text ask a dev to write one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
}

View file

@ -0,0 +1,21 @@
package buttondevteam.architecture.commands;
public abstract class CommandBlockCommand extends BaseCommand{
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text. ",
};
}
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,17 @@
package buttondevteam.architecture.commands;
public abstract class ModCommand extends PlayerCommand{
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text, ask a dev to add one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
@Override
public boolean GetModOnly() {
return true;
}
}

View file

@ -0,0 +1,38 @@
package buttondevteam.architecture.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public abstract class PlayerCommand extends BaseCommand{
/**replaces CommandExecutor functionality*/
@Override
public boolean onCommand(CommandSender sender, Command command, String string, String[] args){
return OnCommand(sender, string, args);
}
/**replaces TBMCCommandBase functionality*/
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args){
return OnCommand((Player) sender, alias, args);
}
public abstract boolean OnCommand(Player player, String alias, String[] args);
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
@Override
public String[] GetHelpText(String alias){
return new String[] {
"This command doesn't have help text. ",
"If you're a player, ask a mod to write one",
"If you're a mod, ask a dev to write one",
"If you're a dev, write the help text you lazy bastard. -Ali"
};
}
}

View file

@ -0,0 +1,22 @@
package buttondevteam.minecraft;
import java.util.logging.Logger;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
public void onEnable(){
PluginDescriptionFile pdfFile = getDescription();
Logger logger = getLogger();
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
}
}

View file

@ -0,0 +1,5 @@
package buttondevteam.minecraft.place;
public class Place {
}

View file

@ -0,0 +1,5 @@
package buttondevteam.minecraft.place;
public class Reader {
}

View file

@ -0,0 +1,5 @@
package buttondevteam.minecraft.place;
public class Translator {
}

View file

@ -0,0 +1,5 @@
package buttondevteam.minecraft.place;
public class Writer {
}