Convert components, add Towny-Factions #14
17 changed files with 406 additions and 296 deletions
32
plugin.yml
32
plugin.yml
|
@ -1,15 +1,17 @@
|
|||
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]
|
||||
|
|
191
pom.xml
191
pom.xml
|
@ -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>2.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>MassiveCore</artifactId>
|
||||
<version>2.14.0</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>
|
||||
|
|
10
repo/com/massivecraft/Factions/2.14.0/Factions-2.14.0.pom
Normal file
10
repo/com/massivecraft/Factions/2.14.0/Factions-2.14.0.pom
Normal 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>2.14.0</version>
|
||||
<description>POM was created from install:install-file</description>
|
||||
</project>
|
12
repo/com/massivecraft/Factions/maven-metadata-local.xml
Normal file
12
repo/com/massivecraft/Factions/maven-metadata-local.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<versioning>
|
||||
<release>2.14.0</release>
|
||||
<versions>
|
||||
<version>2.14.0</version>
|
||||
</versions>
|
||||
<lastUpdated>20190824204629</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
|
@ -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>2.14.0</version>
|
||||
<description>POM was created from install:install-file</description>
|
||||
</project>
|
12
repo/com/massivecraft/MassiveCore/maven-metadata-local.xml
Normal file
12
repo/com/massivecraft/MassiveCore/maven-metadata-local.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>MassiveCore</artifactId>
|
||||
<versioning>
|
||||
<release>2.14.0</release>
|
||||
<versions>
|
||||
<version>2.14.0</version>
|
||||
</versions>
|
||||
<lastUpdated>20190824204534</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
|
@ -1,10 +1,12 @@
|
|||
package buttondevteam.presents;
|
||||
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.presents.components.chunkarchive.ChunkArchiveComponent;
|
||||
import buttondevteam.presents.components.magic.MagicComponent;
|
||||
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 +19,18 @@ 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());
|
||||
|
||||
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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 =
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
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
|
||||
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 = size / 16;
|
||||
World world = chunk.asBukkitWorld();
|
||||
int max = 0;
|
||||
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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTownyClaim(TownPreClaimEvent event) {
|
||||
PS chunkCoord = PS.valueOf(getLocation(event.getTownBlock().getWorldCoord())).getChunkCoords(true);
|
||||
int distance = distance().get();
|
||||
for (int i = -distance; i <= distance; i++) {
|
||||
for (int j = -distance; j <= distance; j++) {
|
||||
if (i * i + j * j <= distance * distance) {
|
||||
PS chunk = PS.valueOf(chunkCoord.getChunkX() + i, chunkCoord.getChunkZ() + j)
|
||||
.withWorld(chunkCoord.getWorld()); //TODO: Doesn't have the world for some reason
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,15 +1,17 @@
|
|||
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]
|
||||
|
|
Loading…
Reference in a new issue