From 6f5baf6836ea6197aafeff8cbce5afd46f1885d5 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 16 Sep 2016 23:07:53 +0200 Subject: [PATCH] Added files --- .gitignore | 225 ++++++++++++++++++ .../discordplugin/DiscordPlugin.java | 27 +++ src/main/resources/plugin.yml | 5 + .../buttondevteam/DiscordPlugin/AppTest.java | 38 +++ 4 files changed, 295 insertions(+) create mode 100644 .gitignore create mode 100644 src/main/java/buttondevteam/discordplugin/DiscordPlugin.java create mode 100644 src/main/resources/plugin.yml create mode 100644 src/test/java/buttondevteam/DiscordPlugin/AppTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ec5deb --- /dev/null +++ b/.gitignore @@ -0,0 +1,225 @@ +################# +## Eclipse +################# + +*.pydevproject +.metadata/ +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +target/ +.project + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml +*.publishproj + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[cod] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg +.metadata/* +TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar +*.iml +*.name +.idea/compiler.xml +*.xml + +Token.txt diff --git a/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java b/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java new file mode 100644 index 0000000..cdfab07 --- /dev/null +++ b/src/main/java/buttondevteam/discordplugin/DiscordPlugin.java @@ -0,0 +1,27 @@ +package buttondevteam.discordplugin; + +import org.apache.commons.io.IOUtils; +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.base.Charsets; +import sx.blah.discord.api.ClientBuilder; + +/** + * Hello world! + * + */ +public class DiscordPlugin extends JavaPlugin { + @Override + public void onEnable() { + try { + Bukkit.getLogger().info("Initializing DiscordPlugin..."); + ClientBuilder cb = new ClientBuilder(); + cb.withToken(IOUtils.toString(getClass().getResourceAsStream("Token.txt"), Charsets.UTF_8)); + cb.login(); + } catch (Exception e) { + e.printStackTrace(); + Bukkit.getPluginManager().disablePlugin(this); + } + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..b04bce3 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,5 @@ +name: DiscordPlugin +main: buttondevteam.discordplugin.DiscordPlugin +version: 1.0 +author: TBMCPlugins +depend: [] diff --git a/src/test/java/buttondevteam/DiscordPlugin/AppTest.java b/src/test/java/buttondevteam/DiscordPlugin/AppTest.java new file mode 100644 index 0000000..be62810 --- /dev/null +++ b/src/test/java/buttondevteam/DiscordPlugin/AppTest.java @@ -0,0 +1,38 @@ +package buttondevteam.DiscordPlugin; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +}