Merge pull request #14 from TBMCPlugins/dev

Convert components, add Towny-Factions
This commit is contained in:
Norbi Peti 2019-10-30 20:59:05 +01:00 committed by GitHub
commit eb894dc79f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 653 additions and 296 deletions

2
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

22
.idea/ButtonPresents.iml Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.tbmcplugins:ButtonWebsiteModule:master-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.massivecraft:Factions:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.massivecraft:MassiveCore:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:master-317b5a3bda-1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
</component>
</module>

16
.idea/compiler.xml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="ButtonPresents" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="ButtonPresents" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

6
.idea/encodings.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>

View file

@ -0,0 +1,11 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="false" />
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
<disabledExtension id="moduleInfo" />
</inspection_tool>
</profile>
</component>

View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ButtonPresents.iml" filepath="$PROJECT_DIR$/.idea/ButtonPresents.iml" />
</modules>
</component>
</project>

124
.idea/uiDesigner.xml Normal file
View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -1,15 +1,18 @@
main: buttondevteam.presents.ButtonPresents
name: ButtonPresents
version: 0.0.1
commands:
dictionary:
description: A set of Hello World commands and listeners, type in /hello to see subcommands
rtp:
description: A command that allows players to randomly teleport across the map
spawn:
description: A set of commands designed to be used in spawn
magic:
description: A set of fun commands designed for cheaty stuff
research:
description: A set of commands designed for R and D
main: buttondevteam.presents.ButtonPresents
name: ButtonPresents
version: 0.0.1
commands:
dictionary:
description: A set of Hello World commands and listeners, type in /hello to see subcommands
rtp:
description: A command that allows players to randomly teleport across the map
spawn:
description: A set of commands designed to be used in spawn
magic:
description: A set of fun commands designed for cheaty stuff
research:
description: A set of commands designed for R and D
softdepend: [Factions]
depend: [ChromaCore]

191
pom.xml
View file

@ -1,86 +1,105 @@
<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.github.tbmcplugins</groupId>
<artifactId>ButtonPresents</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ButtonPresents</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>.</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository> <!-- This repo fixes issues with transitive dependencies -->
<id>jcenter</id>
<url>http://jcenter.bintray.com</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>ButtonCore</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.tbmcplugins</groupId>
<artifactId>ButtonWebsiteModule</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<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.github.tbmcplugins</groupId>
<artifactId>ButtonPresents</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ButtonPresents</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>.</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository> <!-- This repo fixes issues with transitive dependencies -->
<id>jcenter</id>
<url>http://jcenter.bintray.com</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>repo</id>
<url>file://${basedir}/repo</url>
</repository>
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>ButtonCore</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.tbmcplugins</groupId>
<artifactId>ButtonWebsiteModule</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>Towny</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>3.2.2</version>
<description>POM was created from install:install-file</description>
</project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<versioning>
<release>3.2.2</release>
<versions>
<version>2.14.0</version>
<version>3.2.2</version>
</versions>
<lastUpdated>20191027191335</lastUpdated>
</versioning>
</metadata>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
<version>3.2.2</version>
<description>POM was created from install:install-file</description>
</project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
<versioning>
<release>3.2.2</release>
<versions>
<version>2.14.0</version>
<version>3.2.2</version>
</versions>
<lastUpdated>20191027191606</lastUpdated>
</versioning>
</metadata>

View file

@ -1,10 +1,13 @@
package buttondevteam.presents;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.components.chunkarchive.ChunkArchiveComponent;
import buttondevteam.presents.components.magic.MagicComponent;
import buttondevteam.presents.components.portals.PortalLimitComponent;
import buttondevteam.presents.components.research.ResearchComponent;
import buttondevteam.presents.components.research.dictionary.DictionaryComponent;
import buttondevteam.presents.components.spawn.SpawnComponent;
import buttondevteam.presents.components.townyfactions.TownyFactionsComponent;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
@ -17,13 +20,19 @@ public class ButtonPresents extends JavaPlugin{
Logger logger = getLogger();
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
new DictionaryComponent().register(this);
new SpawnComponent().register(this);
new MagicComponent().register(this);
new ResearchComponent().register(this);
new ChunkArchiveComponent().register(this);
Component.registerComponent(this, new DictionaryComponent());
Component.registerComponent(this, new SpawnComponent());
Component.registerComponent(this, new MagicComponent());
Component.registerComponent(this, new ResearchComponent());
try {
Component.registerComponent(this, new ChunkArchiveComponent());
} catch (NoClassDefFoundError e) {
getLogger().warning("ChunkArchive compatibility error, not registering it.");
}
Component.registerComponent(this, new TownyFactionsComponent());
Component.registerComponent(this, new PortalLimitComponent());
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
}

View file

@ -1,14 +1,24 @@
package buttondevteam.presents;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class StaticMain {
public static void main(String[] args){
GsonBuilder builder = new GsonBuilder();
/*GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
System.out.println(gson.toJson(new output()));
System.out.println(gson.toJson(new output()));*/
int distance = 5;
for (int i = -distance; i <= distance; i++) {
for (int j = -distance; j <= distance; j++) {
//if(i*i+j*j<=distance*distance) {
double dist = Math.sqrt(Math.pow((double) (i), 2.0D) + Math.pow((double) (j), 2.0D));
if (dist < distance) {
System.out.print("X");
} else
System.out.print("-");
}
System.out.println();
}
}
static class output{
public String ali = "pls";

View file

@ -1,76 +0,0 @@
package buttondevteam.presents.architecture;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase;
import buttondevteam.website.ButtonWebsiteModule;
import buttondevteam.website.page.Page;
/**
* 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, TBMCCommandBase 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;
}
protected Page addPage(JavaPlugin plugin, Page page){
ButtonWebsiteModule.addPage(page);
return page;
}
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

@ -1,7 +1,8 @@
package buttondevteam.presents.components.chunkarchive;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.presents.architecture.Component;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.ButtonPresents;
import net.minecraft.server.v1_12_R1.ChunkRegionLoader;
import net.minecraft.server.v1_12_R1.ExceptionWorldConflict;
import org.bukkit.Bukkit;
@ -11,22 +12,21 @@ import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkPopulateEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
// @formatter:off
public class ChunkArchiveComponent extends Component implements Listener {
public class ChunkArchiveComponent extends Component<ButtonPresents> implements Listener {
private final File dataFolder = new File("plugins", "ChunkArchive");
@Override
public void register(JavaPlugin plugin) {
public void enable() {
try {
this.registerListener(plugin, this);
this.registerListener(this);
File testFolder = new File(dataFolder, "test");
testFolder.mkdirs();
Logger logger = plugin.getLogger();
Logger logger = getPlugin().getLogger();
logger.info("Starting chunk save test...");
ChunkRegionLoader testcrl = new ChunkRegionLoader(testFolder,
((CraftServer) Bukkit.getServer()).getServer().dataConverterManager);
@ -39,6 +39,11 @@ public class ChunkArchiveComponent extends Component implements Listener {
TBMCCoreAPI.SendException("ChunkArchive loading/testing failed!", e);
}
}
@Override
protected void disable() {
}
/*------------------------------------------------------------*/
private final ChunkRegionLoader chunkRegionLoader =

View file

@ -1,16 +1,20 @@
package buttondevteam.presents.components.dungeon;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.ButtonPresents;
import buttondevteam.presents.architecture.Component;
public class DungeonComponent extends Component{
public class DungeonComponent extends Component<ButtonPresents> {
@Override
public void register(JavaPlugin plugin) {
this.registerCommand(plugin, new DungeonCreate());
this.registerCommand(plugin, new DungeonDelete());
public void enable() {
this.registerCommand(new DungeonCreate());
this.registerCommand(new DungeonDelete());
}
@Override
protected void disable() {
}
}

View file

@ -1,23 +1,25 @@
package buttondevteam.presents.components.magic;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.architecture.Component;
import buttondevteam.presents.components.magic.tricks.AliArrowListener;
import buttondevteam.presents.components.magic.tricks.BoomBowDeathListener;
import buttondevteam.presents.components.magic.tricks.BoomBowListener;
import buttondevteam.presents.components.magic.tricks.CannonBowListener;
import buttondevteam.presents.components.magic.tricks.CannonBowSettings;
public class MagicComponent extends Component{
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new CannonBowSettings());
registerListener(plugin, new AliArrowListener(plugin));
registerListener(plugin, new BoomBowDeathListener());
registerListener(plugin, new BoomBowListener(plugin));
registerListener(plugin, new CannonBowListener(plugin));
}
}
package buttondevteam.presents.components.magic;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.ButtonPresents;
import buttondevteam.presents.components.magic.tricks.*;
import org.bukkit.plugin.java.JavaPlugin;
public class MagicComponent extends Component<ButtonPresents> {
@Override
public void enable() {
JavaPlugin plugin = getPlugin();
registerCommand(new CannonBowSettings());
registerListener(new AliArrowListener(plugin));
registerListener(new BoomBowDeathListener());
registerListener(new BoomBowListener(plugin));
registerListener(new CannonBowListener(plugin));
}
@Override
protected void disable() {
}
}

View file

@ -0,0 +1,40 @@
package buttondevteam.presents.components.portals;
import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ConfigData;
import buttondevteam.presents.ButtonPresents;
import com.google.common.collect.Lists;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import java.util.List;
public class PortalLimitComponent extends Component<ButtonPresents> implements Listener {
@Override
protected void enable() {
registerListener(this);
}
@Override
protected void disable() {
}
private ConfigData<List<String>> worlds() {
return getConfig().getData("worlds", Lists.newArrayList("v1", "v2", "v3"));
}
@EventHandler(ignoreCancelled = true)
public void onPortalEnter(PlayerPortalEvent event) {
if (worlds().get().contains(event.getFrom().getWorld().getName()))
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onPortalEnter(EntityPortalEvent event) {
if (worlds().get().contains(event.getFrom().getWorld().getName()))
event.setCancelled(true);
}
}

View file

@ -1,22 +1,26 @@
package buttondevteam.presents.components.research;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.architecture.Component;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.ButtonPresents;
import buttondevteam.presents.components.research.questions.OverflowCrash;
import buttondevteam.presents.components.research.questions.OverwhelmCrash;
import buttondevteam.presents.components.research.questions.PluginConfigInfo;
import buttondevteam.presents.components.research.questions.PluginDataFolderInfo;
public class ResearchComponent extends Component {
public class ResearchComponent extends Component<ButtonPresents> {
@Override
public void register(JavaPlugin plugin) {
public void enable() {
// TODO Auto-generated method stub
this.registerCommand(plugin, new PluginConfigInfo());
this.registerCommand(plugin, new PluginDataFolderInfo());
this.registerCommand(plugin, new OverwhelmCrash());
this.registerCommand(plugin, new OverflowCrash());
this.registerCommand(new PluginConfigInfo());
this.registerCommand(new PluginDataFolderInfo());
this.registerCommand(new OverwhelmCrash());
this.registerCommand(new OverflowCrash());
}
@Override
protected void disable() {
}

View file

@ -1,51 +1,46 @@
package buttondevteam.presents.components.research.dictionary;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.presents.architecture.Component;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.ButtonPresents;
import buttondevteam.presents.components.research.dictionary.commands.SendJSON;
import buttondevteam.presents.components.research.dictionary.commands.SendMessage;
import buttondevteam.presents.components.research.dictionary.config.LoadConfig;
import buttondevteam.presents.components.research.dictionary.config.SaveConfig;
import buttondevteam.presents.components.research.dictionary.config.TimePersistence;
import buttondevteam.presents.components.research.dictionary.effects.Bedsplode;
import buttondevteam.presents.components.research.dictionary.pages.DataPage;
import buttondevteam.presents.components.research.dictionary.pages.HelloPage;
import buttondevteam.presents.components.research.dictionary.pages.JSONPage;
import buttondevteam.presents.components.research.dictionary.pages.LocationPage;
import buttondevteam.presents.components.research.dictionary.pages.POSTPage;
import buttondevteam.presents.components.research.dictionary.pages.PlayersOnlinePage;
import buttondevteam.presents.components.research.dictionary.spawning.PlaySound;
import buttondevteam.presents.components.research.dictionary.spawning.SetBlock;
import buttondevteam.presents.components.research.dictionary.spawning.SpawnCow;
import buttondevteam.presents.components.research.dictionary.spawning.SpawnItem;
import buttondevteam.presents.components.research.dictionary.spawning.SpawnMagicPotato;
import buttondevteam.presents.components.research.dictionary.spawning.SpawnParticle;
import buttondevteam.presents.components.research.dictionary.spawning.*;
import org.bukkit.plugin.java.JavaPlugin;
public class DictionaryComponent extends Component{
public class DictionaryComponent extends Component<ButtonPresents> {
@Override
public void register(JavaPlugin plugin) {
this.registerCommand(plugin, new SendMessage());
this.registerCommand(plugin, new SendJSON());
this.registerCommand(plugin, new SaveConfig());
this.registerCommand(plugin, new LoadConfig());
this.registerCommand(plugin, new TimePersistence());
this.registerListener(plugin, new Bedsplode());
this.registerCommand(plugin, new SpawnCow());
this.registerCommand(plugin, new SpawnItem());
this.registerCommand(plugin, new SpawnMagicPotato());
this.registerCommand(plugin, new SetBlock());
this.registerCommand(plugin, new SpawnParticle());
this.registerCommand(plugin, new PlaySound());
this.addPage(plugin, new HelloPage());
this.addPage(plugin, new DataPage());
this.addPage(plugin, new PlayersOnlinePage(plugin));
this.addPage(plugin, new LocationPage(plugin));
this.addPage(plugin, new POSTPage(plugin));
this.addPage(plugin, new JSONPage());
public void enable() {
JavaPlugin plugin = getPlugin();
this.registerCommand(new SendMessage());
this.registerCommand(new SendJSON());
this.registerCommand(new SaveConfig());
this.registerCommand(new LoadConfig());
this.registerCommand(new TimePersistence());
this.registerListener(new Bedsplode());
this.registerCommand(new SpawnCow());
this.registerCommand(new SpawnItem());
this.registerCommand(new SpawnMagicPotato());
this.registerCommand(new SetBlock());
this.registerCommand(new SpawnParticle());
this.registerCommand(new PlaySound());
/*ButtonWebsiteModule.addPage(new HelloPage());
ButtonWebsiteModule.addPage(new DataPage());
ButtonWebsiteModule.addPage(new PlayersOnlinePage(plugin));
ButtonWebsiteModule.addPage(new LocationPage(plugin));
ButtonWebsiteModule.addPage(new POSTPage(plugin));
ButtonWebsiteModule.addPage(new JSONPage());*/
}
@Override
protected void disable() {
}
}

View file

@ -1,15 +1,18 @@
package buttondevteam.presents.components.spawn;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.architecture.Component;
import buttondevteam.presents.ButtonPresents;
import buttondevteam.presents.architecture.Component;
public class SpawnComponent extends Component{
public class SpawnComponent extends Component<ButtonPresents> {
@Override
public void register(JavaPlugin plugin) {
this.registerCommand(plugin, new ChooseColor());
public void enable() {
this.registerCommand(new ChooseColor());
}
@Override
protected void disable() {
}
}

View file

@ -0,0 +1,90 @@
package buttondevteam.presents.components.townyfactions;
import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ConfigData;
import buttondevteam.presents.ButtonPresents;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.massivecore.ps.PS;
import com.palmergames.bukkit.towny.event.TownPreClaimEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Coord;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.palmergames.bukkit.towny.object.WorldCoord;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class TownyFactionsComponent extends Component<ButtonPresents> implements Listener {
@Override
public void enable() {
registerListener(this);
}
@Override
protected void disable() {
}
/**
* Defines how many chunks should be between towns and factions
*/
private ConfigData<Integer> distance() {
return getConfig().getData("distance", 5);
}
@EventHandler(ignoreCancelled = true)
public void onFactionsClaim(EventFactionsChunksChange event) throws NotRegisteredException {
if (event.getNewFaction().isNone())
return; //Allow unclaiming
for (PS chunk : event.getChunks()) {
int x = chunk.getChunkX() * 16;
int z = chunk.getChunkZ() * 16;
int size = Coord.getCellSize();
int amount = 16 / size;
World world = chunk.asBukkitWorld();
int max = 0;
if (amount < 1) amount = 1; //For plot sizes > 16
for (int i = 0; i < amount; i++) {
for (int j = 0; j < amount; j++) {
Coord coord = Coord.parseCoord(new Location(world, x + i * size, 64, z + j * size));
int dist = TownyUniverse.getDataSource().getWorld(world.getName())
.getMinDistanceFromOtherTownsPlots(coord);
if (dist > max) max = dist;
}
}
int distance = max / amount;
if (distance().get() >= distance) {
event.setCancelled(true);
event.getSender().sendMessage("§cYou are too close to a town! " + (distance - 1) + " chunks away, " + distance().get() + " is allowed.");
}
}
}
@EventHandler(ignoreCancelled = true)
public void onTownyClaim(TownPreClaimEvent event) {
PS coord = PS.valueOf(getLocation(event.getTownBlock().getWorldCoord()));
int distance = distance().get();
for (int i = -distance + 1; i <= distance - 1; i++) {
for (int j = -distance + 1; j <= distance - 1; j++) {
if (i * i + j * j <= distance * distance) {
PS chunk = PS.valueOf(coord.getChunkX(true) + i, coord.getChunkZ(true) + j)
.withWorld(coord.getWorld());
if (!BoardColl.get().getFactionAt(chunk).isNone()) {
event.setCancelled(true);
}
}
}
}
}
//https://github.com/TownyAdvanced/Towny/blob/master/src/com/palmergames/bukkit/towny/tasks/DrawSmokeTask.java
private Location getLocation(WorldCoord coord) { //Based on parseCoord() - needfix would be always false because the remainder is 0
int cellSize = Coord.getCellSize();
int xresult = coord.getX() * cellSize;
int zresult = coord.getZ() * cellSize;
return new Location(coord.getBukkitWorld(), xresult, 64, zresult);
}
}

View file

@ -1,15 +1,18 @@
main: buttondevteam.presents.ButtonPresents
name: ButtonPresents
version: 0.0.1
commands:
dictionary:
description: A set of Hello World commands and listeners, type in /hello to see subcommands
rtp:
description: A command that allows players to randomly teleport across the map
spawn:
description: A set of commands designed to be used in spawn
magic:
description: A set of fun commands designed for cheaty stuff
research:
description: A set of commands designed for R and D
main: buttondevteam.presents.ButtonPresents
name: ButtonPresents
version: 0.0.1
commands:
dictionary:
description: A set of Hello World commands and listeners, type in /hello to see subcommands
rtp:
description: A command that allows players to randomly teleport across the map
spawn:
description: A set of commands designed to be used in spawn
magic:
description: A set of fun commands designed for cheaty stuff
research:
description: A set of commands designed for R and D
softdepend: [Factions]
depend: [ChromaCore]