Added code for exception handling
And other stuff :P
This commit is contained in:
parent
0d3c83b65f
commit
20e8ce27b8
20 changed files with 483 additions and 268 deletions
10
pom.xml
10
pom.xml
|
@ -1,4 +1,5 @@
|
||||||
<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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.github.tbmcplugins</groupId>
|
<groupId>com.github.tbmcplugins</groupId>
|
||||||
<artifactId>AliPresents</artifactId>
|
<artifactId>AliPresents</artifactId>
|
||||||
|
@ -58,10 +59,15 @@
|
||||||
<version>1.9.2-R0.1-SNAPSHOT</version>
|
<version>1.9.2-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.4</version>
|
<version>3.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
<artifactId>ButtonCore</artifactId>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package alisolarflare.modules;
|
package alisolarflare.modules;
|
||||||
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Module class is a helper class that allows the compacting of projects into one single package.
|
* A Module class is a helper class that allows the compacting of projects into one single package.
|
||||||
* Each feature, whether game, arrow trail listener, or command tool, can have its command and listener
|
* Each feature, whether game, arrow trail listener, or command tool, can have its command and listener
|
||||||
|
@ -35,9 +37,8 @@ public abstract class Module implements Registerable{
|
||||||
* @param label Name of the command in plugin.yml
|
* @param label Name of the command in plugin.yml
|
||||||
* @param commandExecutor Custom coded CommandExecutor class
|
* @param commandExecutor Custom coded CommandExecutor class
|
||||||
*/
|
*/
|
||||||
protected CommandExecutor registerCommand(JavaPlugin plugin, String label, CommandExecutor commandExecutor){
|
protected <T extends TBMCCommandBase> void registerCommand(JavaPlugin plugin, String label, Class<T> commandExecutor){
|
||||||
plugin.getCommand(label).setExecutor(commandExecutor);
|
TBMCChatAPI.AddCommands(plugin, commandExecutor);
|
||||||
return commandExecutor;
|
|
||||||
}
|
}
|
||||||
protected Listener registerListener(JavaPlugin plugin, Listener listener){
|
protected Listener registerListener(JavaPlugin plugin, Listener listener){
|
||||||
plugin.getServer().getPluginManager().registerEvents(listener, plugin);
|
plugin.getServer().getPluginManager().registerEvents(listener, plugin);
|
||||||
|
|
|
@ -6,13 +6,14 @@ import alisolarflare.modules.Module;
|
||||||
import alisolarflare.modules.components.flairdoor.commands.FlairMe;
|
import alisolarflare.modules.components.flairdoor.commands.FlairMe;
|
||||||
import alisolarflare.modules.components.flairdoor.commands.SetFlairDoorColour;
|
import alisolarflare.modules.components.flairdoor.commands.SetFlairDoorColour;
|
||||||
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
public class FlairDoorModule extends Module{
|
public class FlairDoorModule extends Module {
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
plugin.getCommand("flairme").setExecutor(new FlairMe());
|
TBMCChatAPI.AddCommands(plugin, FlairMe.class);
|
||||||
plugin.getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());
|
|
||||||
|
|
||||||
plugin.getServer().getPluginManager().registerEvents(new PortalListener(plugin), plugin);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PortalListener(plugin), plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
package alisolarflare.modules.components.flairdoor.commands;
|
package alisolarflare.modules.components.flairdoor.commands;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
import alisolarflare.modules.components.flairdoor.listeners.PortalListener;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class FlairMe implements CommandExecutor{
|
public class FlairMe extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
sender.sendMessage("Flairing..." + sender.getName());
|
sender.sendMessage("Flairing..." + sender.getName());
|
||||||
PortalListener.playersToBeFlaired.add(sender.getName());
|
PortalListener.playersToBeFlaired.add(sender.getName());
|
||||||
sender.sendMessage("Finished Preparation! Walk through a portal to get your flair");
|
sender.sendMessage("Finished Preparation! Walk through a portal to get your flair");
|
||||||
|
@ -17,4 +16,25 @@ public class FlairMe implements CommandExecutor{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new String[] { "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "flairme";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,46 +3,68 @@ package alisolarflare.modules.components.flairdoor.commands;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public class SetFlairDoorColour implements CommandExecutor {
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
public class SetFlairDoorColour extends TBMCCommandBase {
|
||||||
public static String FlairDoorColorMode = "null";
|
public static String FlairDoorColorMode = "null";
|
||||||
public static final List<String> COLOURMODES = Arrays.asList("red", "orange", "yellow", "green", "blue", "purple", "gray");
|
public static final List<String> COLOURMODES = Arrays.asList("red", "orange", "yellow", "green", "blue", "purple",
|
||||||
|
"gray");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
if (args.length > 1){
|
if (args.length > 1) {
|
||||||
sender.sendMessage("You must specify and argument, Red-Purple or Null.HHAHHAHAHAHHAHAHAHHA");
|
sender.sendMessage("You must specify and argument, Red-Purple or Null.HHAHHAHAHAHHAHAHAHHA");
|
||||||
}
|
}
|
||||||
|
|
||||||
String firstCommand = args[0];
|
String firstCommand = args[0];
|
||||||
firstCommand = firstCommand.toLowerCase();
|
firstCommand = firstCommand.toLowerCase();
|
||||||
if(firstCommand.startsWith("e")|| firstCommand.startsWith("gra")|| firstCommand.startsWith("grey")){
|
if (firstCommand.startsWith("e") || firstCommand.startsWith("gra") || firstCommand.startsWith("grey")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to gray");
|
sender.sendMessage("Flair Door Colour Mode set to gray");
|
||||||
FlairDoorColorMode = "gray";
|
FlairDoorColorMode = "gray";
|
||||||
}else if(firstCommand.startsWith("r")){
|
} else if (firstCommand.startsWith("r")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Red");
|
sender.sendMessage("Flair Door Colour Mode set to Red");
|
||||||
FlairDoorColorMode = "red";
|
FlairDoorColorMode = "red";
|
||||||
}else if(firstCommand.startsWith("o")){
|
} else if (firstCommand.startsWith("o")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Orange");
|
sender.sendMessage("Flair Door Colour Mode set to Orange");
|
||||||
FlairDoorColorMode = "orange";
|
FlairDoorColorMode = "orange";
|
||||||
}else if(firstCommand.startsWith("y")){
|
} else if (firstCommand.startsWith("y")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Yellow");
|
sender.sendMessage("Flair Door Colour Mode set to Yellow");
|
||||||
FlairDoorColorMode = "yellow";
|
FlairDoorColorMode = "yellow";
|
||||||
}else if(firstCommand.startsWith("g")){
|
} else if (firstCommand.startsWith("g")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Green (use E for grey)");
|
sender.sendMessage("Flair Door Colour Mode set to Green (use E for grey)");
|
||||||
FlairDoorColorMode = "green";
|
FlairDoorColorMode = "green";
|
||||||
}else if(firstCommand.startsWith("b") || firstCommand.startsWith("i")){
|
} else if (firstCommand.startsWith("b") || firstCommand.startsWith("i")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Blue");
|
sender.sendMessage("Flair Door Colour Mode set to Blue");
|
||||||
FlairDoorColorMode = "blue";
|
FlairDoorColorMode = "blue";
|
||||||
}else if(firstCommand.startsWith("v") || firstCommand.startsWith("p")){
|
} else if (firstCommand.startsWith("v") || firstCommand.startsWith("p")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Purple");
|
sender.sendMessage("Flair Door Colour Mode set to Purple");
|
||||||
FlairDoorColorMode = "purple";
|
FlairDoorColorMode = "purple";
|
||||||
}else if(firstCommand.startsWith("n")){
|
} else if (firstCommand.startsWith("n")) {
|
||||||
sender.sendMessage("Flair Door Colour Mode set to Null");
|
sender.sendMessage("Flair Door Colour Mode set to Null");
|
||||||
FlairDoorColorMode = "null";
|
FlairDoorColorMode = "null";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) { // TODO
|
||||||
|
return new String[] { "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "setflairdoorcolour";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,16 @@ import alisolarflare.modules.components.gpowers.commands.PowerDown;
|
||||||
import alisolarflare.modules.components.gpowers.commands.PowerUp;
|
import alisolarflare.modules.components.gpowers.commands.PowerUp;
|
||||||
import alisolarflare.modules.components.gpowers.commands.gPowerCommand;
|
import alisolarflare.modules.components.gpowers.commands.gPowerCommand;
|
||||||
import alisolarflare.modules.components.gpowers.listeners.gPowerListener;
|
import alisolarflare.modules.components.gpowers.listeners.gPowerListener;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
public class GPowerModule extends Module{
|
public class GPowerModule extends Module {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
plugin.getCommand("powerup").setExecutor(new PowerUp());
|
TBMCChatAPI.AddCommands(plugin, gPowerCommand.class);
|
||||||
plugin.getCommand("powerdown").setExecutor(new PowerDown());
|
|
||||||
plugin.getCommand("gpowercommand").setExecutor(new gPowerCommand());
|
|
||||||
|
|
||||||
plugin.getServer().getPluginManager().registerEvents(new gPowerListener(plugin), plugin);
|
TBMCCoreAPI.RegisterEventsForExceptions(new gPowerListener(plugin), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,35 @@ import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public class PowerDown implements CommandExecutor {
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
public class PowerDown extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
|
public boolean OnCommand(CommandSender arg0, String arg2, String[] arg3) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "powerdown";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,35 @@ import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class PowerUp implements CommandExecutor{
|
public class PowerUp extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)){
|
// gPowerMemory.PowerUpPlayer(player, colour);
|
||||||
sender.sendMessage("You must be a player to use this command!");
|
return false;
|
||||||
}
|
}
|
||||||
//gPowerMemory.PowerUpPlayer(player, colour);
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "powerup";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,53 +6,67 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.modules.components.gpowers.gPowerMemory;
|
import alisolarflare.modules.components.gpowers.gPowerMemory;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class gPowerCommand implements CommandExecutor{
|
public class gPowerCommand extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
sender.sendMessage("G power activate!");
|
sender.sendMessage("G power activate!");
|
||||||
if (!(sender instanceof Player)){
|
|
||||||
sender.sendMessage("You must be a player to use this command!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (args.length < 2){
|
if (args.length < 2) {
|
||||||
player.sendMessage("Proper Usage to test G-Powers:");
|
player.sendMessage("Proper Usage to test G-Powers:");
|
||||||
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String colour;
|
String colour;
|
||||||
player.sendMessage("Checking terms...");
|
player.sendMessage("Checking terms...");
|
||||||
if(args[0].startsWith("r") ||
|
if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g")
|
||||||
args[0].startsWith("o")||
|
|| args[0].startsWith("b") || args[0].startsWith("p")) {
|
||||||
args[0].startsWith("y")||
|
|
||||||
args[0].startsWith("g")||
|
|
||||||
args[0].startsWith("b")||
|
|
||||||
args[0].startsWith("p")){
|
|
||||||
colour = args[0];
|
colour = args[0];
|
||||||
}else{
|
} else {
|
||||||
player.sendMessage("Term Fail: COLOUR. Proper Usage to test G-Powers:");
|
player.sendMessage("Term Fail: COLOUR. Proper Usage to test G-Powers:");
|
||||||
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean isActive;
|
boolean isActive;
|
||||||
if(args[1].startsWith("t")){
|
if (args[1].startsWith("t")) {
|
||||||
isActive = true;
|
isActive = true;
|
||||||
}else if (args[1].startsWith("f")){
|
} else if (args[1].startsWith("f")) {
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}else{
|
} else {
|
||||||
player.sendMessage("Term Fail: ACTIVE. Proper Usage to test G-Powers:");
|
player.sendMessage("Term Fail: ACTIVE. Proper Usage to test G-Powers:");
|
||||||
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.sendMessage("Terms Vaild!");
|
player.sendMessage("Terms Vaild!");
|
||||||
if(isActive){
|
if (isActive) {
|
||||||
gPowerMemory.PowerUpPlayer(player, colour);
|
gPowerMemory.PowerUpPlayer(player, colour);
|
||||||
}else{
|
} else {
|
||||||
gPowerMemory.PowerDownPlayer(player);
|
gPowerMemory.PowerDownPlayer(player);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new String[] { "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "gpower";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
package alisolarflare.modules.components.links;
|
package alisolarflare.modules.components.links;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -7,25 +8,25 @@ import alisolarflare.modules.Module;
|
||||||
import alisolarflare.modules.components.links.commands.PressAliLink;
|
import alisolarflare.modules.components.links.commands.PressAliLink;
|
||||||
import alisolarflare.modules.components.links.commands.SetAliLink;
|
import alisolarflare.modules.components.links.commands.SetAliLink;
|
||||||
import alisolarflare.modules.components.links.entities.Link;
|
import alisolarflare.modules.components.links.entities.Link;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
public class AliLinkModule extends Module{
|
public class AliLinkModule extends Module {
|
||||||
private SetAliLink setAliLink;
|
private SetAliLink setAliLink;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin){
|
public void register(JavaPlugin plugin) {
|
||||||
setAliLink = new SetAliLink(plugin);
|
setAliLink = new SetAliLink(plugin);
|
||||||
plugin.getCommand("setalilink").setExecutor(setAliLink);
|
TBMCChatAPI.AddCommands(plugin, PressAliLink.class);
|
||||||
plugin.getCommand("pressalilink").setExecutor(new PressAliLink(plugin, setAliLink));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void saveLinkList(JavaPlugin plugin){
|
|
||||||
|
public void saveLinkList(JavaPlugin plugin) {
|
||||||
plugin.getConfig().set("aliLinkList", setAliLink.linkList);
|
plugin.getConfig().set("aliLinkList", setAliLink.linkList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<Link> loadLinkList(JavaPlugin plugin){
|
public List<Link> loadLinkList(JavaPlugin plugin) {
|
||||||
return (List<Link>) plugin.getConfig().getList("aliLinkList");
|
return (List<Link>) plugin.getConfig().getList("aliLinkList");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,26 +6,29 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import alisolarflare.modules.components.links.entities.Link;
|
import alisolarflare.modules.components.links.entities.Link;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class PressAliLink implements CommandExecutor{
|
public class PressAliLink extends TBMCCommandBase {
|
||||||
private JavaPlugin plugin;
|
private JavaPlugin plugin;
|
||||||
private SetAliLink setAliLink;
|
private SetAliLink setAliLink;
|
||||||
public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink){
|
|
||||||
|
public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.setAliLink = setAliLink;
|
this.setAliLink = setAliLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
|
|
||||||
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
|
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
|
||||||
|
|
||||||
if (args.length < 1){
|
if (args.length < 1) {
|
||||||
sender.sendMessage("You must specify a link frequency");
|
sender.sendMessage("You must specify a link frequency");
|
||||||
sender.sendMessage("/pressalilink [frequency]");
|
sender.sendMessage("/pressalilink [frequency]");
|
||||||
}
|
}
|
||||||
for (Link link: setAliLink.linkList){
|
for (Link link : setAliLink.linkList) {
|
||||||
for (String inputlink: args){
|
for (String inputlink : args) {
|
||||||
if(inputlink.equals(link.frequency)){
|
if (inputlink.equals(link.frequency)) {
|
||||||
link.press(plugin);
|
link.press(plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,4 +36,27 @@ public class PressAliLink implements CommandExecutor{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "pressalilink";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package alisolarflare.modules.components.links.commands;
|
package alisolarflare.modules.components.links.commands;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -14,66 +13,70 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import alisolarflare.modules.components.links.AliLinkModule;
|
import alisolarflare.modules.components.links.AliLinkModule;
|
||||||
import alisolarflare.modules.components.links.entities.Link;
|
import alisolarflare.modules.components.links.entities.Link;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link,
|
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link, a location in a world that when called on by {@link PressAliLink}, creates a temporary redstone
|
||||||
* a location in a world that when called on by {@link Class#PressAliLink}, creates a temporary redstone block,
|
* block, enabling wireless redstone
|
||||||
* enabling wireless redstone
|
|
||||||
*
|
*
|
||||||
* @see Class#PressAliLink
|
* @see PressAliLink
|
||||||
* @author Alisolarflare
|
* @author Alisolarflare
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SetAliLink implements CommandExecutor{
|
public class SetAliLink extends TBMCCommandBase {
|
||||||
public List<Link> linkList = new ArrayList<Link>();
|
public List<Link> linkList = new ArrayList<Link>();
|
||||||
AliLinkModule subplugin;
|
AliLinkModule subplugin;
|
||||||
private JavaPlugin plugin;
|
private JavaPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the SetAliLink class
|
* Constructs the SetAliLink class
|
||||||
* @param plugin The plugin that contains the configuration file of SetAliLink
|
*
|
||||||
|
* @param plugin
|
||||||
|
* The plugin that contains the configuration file of SetAliLink
|
||||||
*/
|
*/
|
||||||
public SetAliLink(JavaPlugin plugin){
|
public SetAliLink(JavaPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This command creates an Ali-Link which, when activated by the command /PressAliLink,
|
* This command creates an Ali-Link which, when activated by the command /PressAliLink, creates a temporary redstone block if and only if /PressAliLink [frequency] matches the frequency saved when
|
||||||
* creates a temporary redstone block if and only if /PressAliLink [frequency] matches the frequency
|
* /SetAliLink [frequency] is called.
|
||||||
* saved when /SetAliLink [frequency] is called.
|
|
||||||
*
|
*
|
||||||
* @see Class#PressAliLink
|
* @see Class#PressAliLink
|
||||||
* @param sender Player who sent the command
|
* @param sender
|
||||||
* @param command Command Object created
|
* Player who sent the command
|
||||||
* @param label Name of the command
|
* @param command
|
||||||
* @param args Arguments: [frequency] [x-coordinate] [y-coordinate] [z-coordinate], where the coordinates point
|
* Command Object created
|
||||||
* to the intended location of the Ali-Link
|
* @param label
|
||||||
|
* Name of the command
|
||||||
|
* @param args
|
||||||
|
* Arguments: [frequency] [x-coordinate] [y-coordinate] [z-coordinate], where the coordinates point to the intended location of the Ali-Link
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
sender.sendMessage("you pressed shit");
|
sender.sendMessage("you pressed shit");
|
||||||
if (args == null || args.length < 1){
|
if (args == null || args.length < 1) {
|
||||||
sender.sendMessage("You must specify a link frequency");
|
sender.sendMessage("You must specify a link frequency");
|
||||||
sender.sendMessage("/pressalilink [name]");
|
sender.sendMessage("/pressalilink [name]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(sender instanceof Player)){
|
|
||||||
sender.sendMessage("You must be a player to use this command!");
|
|
||||||
}
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (args.length < 4){
|
if (args.length < 4) {
|
||||||
player.sendMessage("short");
|
player.sendMessage("short");
|
||||||
linkList.add(new Link(args[0], player.getLocation()));
|
linkList.add(new Link(args[0], player.getLocation()));
|
||||||
save(player);
|
save(player);
|
||||||
player.sendMessage("end");
|
player.sendMessage("end");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2]) && StringUtils.isNumericSpace(args[3])){
|
if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2])
|
||||||
|
&& StringUtils.isNumericSpace(args[3])) {
|
||||||
player.sendMessage("CUUUSTOM");
|
player.sendMessage("CUUUSTOM");
|
||||||
linkList.add(new Link(args[0],new Location(player.getWorld(), Double.parseDouble(args[1]), Double.parseDouble(args[2]), Double.parseDouble(args[3]))));
|
linkList.add(new Link(args[0], new Location(player.getWorld(), Double.parseDouble(args[1]),
|
||||||
|
Double.parseDouble(args[2]), Double.parseDouble(args[3]))));
|
||||||
save(player);
|
save(player);
|
||||||
player.sendMessage("FINISHED");
|
player.sendMessage("FINISHED");
|
||||||
}else{
|
} else {
|
||||||
player.sendMessage("UNCUSTOOM");
|
player.sendMessage("UNCUSTOOM");
|
||||||
linkList.add(new Link(args[0], player.getLocation()));
|
linkList.add(new Link(args[0], player.getLocation()));
|
||||||
save(player);
|
save(player);
|
||||||
|
@ -82,43 +85,58 @@ public class SetAliLink implements CommandExecutor{
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to save the entire SetAliLink class into memory, which includes
|
* Tries to save the entire SetAliLink class into memory, which includes all of the current Ali-links saved and in use.
|
||||||
* all of the current Ali-links saved and in use.
|
*
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
private void save(Player player){
|
private void save(Player player) {
|
||||||
player.sendMessage("SAAAVING");
|
player.sendMessage("SAAAVING");
|
||||||
player.sendMessage("SAVE FAILED: TELL ALI TO FIX THE SAVE AND UN-COMMENT THE PARAGRAPH SHE COMMENTED");
|
player.sendMessage("SAVE FAILED: TELL ALI TO FIX THE SAVE AND UN-COMMENT THE PARAGRAPH SHE COMMENTED");
|
||||||
player.sendMessage("Link will only last until next server restart");
|
player.sendMessage("Link will only last until next server restart");
|
||||||
return;
|
return;
|
||||||
/*
|
/*
|
||||||
subplugin.plugin.getConfig().set("aliLinkList", subplugin.linkList);
|
* subplugin.plugin.getConfig().set("aliLinkList", subplugin.linkList); try { player.sendMessage("SAVIN"); subplugin.plugin.saveConfig(); player.sendMessage("GOOD SAVE"); } catch (Exception e)
|
||||||
try {
|
* { player.sendMessage("YOU FUCKED STUFF UP"); // TODO Auto-generated catch block e.printStackTrace(); }
|
||||||
player.sendMessage("SAVIN");
|
|
||||||
subplugin.plugin.saveConfig();
|
|
||||||
player.sendMessage("GOOD SAVE");
|
|
||||||
} catch (Exception e) {
|
|
||||||
player.sendMessage("YOU FUCKED STUFF UP");
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to load the previous saved state of AliLinks, from the plugin
|
* Attempts to load the previous saved state of AliLinks, from the plugin configuration file
|
||||||
* configuration file
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void load(){
|
private void load() {
|
||||||
try{
|
try {
|
||||||
linkList = (List<Link>) plugin.getConfig().getList("aliLinkList");
|
linkList = (List<Link>) plugin.getConfig().getList("aliLinkList");
|
||||||
if(linkList == null || linkList.isEmpty()){
|
if (linkList == null || linkList.isEmpty()) {
|
||||||
linkList = new ArrayList<Link>();
|
linkList = new ArrayList<Link>();
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "setalilink";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,13 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import alisolarflare.modules.Module;
|
import alisolarflare.modules.Module;
|
||||||
import alisolarflare.modules.components.shulker.commands.AliShulker;
|
import alisolarflare.modules.components.shulker.commands.AliShulker;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
public class AliShulkerModule extends Module{
|
public class AliShulkerModule extends Module {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
plugin.getCommand("alishulker").setExecutor(new AliShulker());
|
TBMCChatAPI.AddCommands(plugin, AliShulker.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,19 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Shulker;
|
import org.bukkit.entity.Shulker;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alisolarflare
|
* @author Alisolarflare This class is responsible for the command /aliShulker, which in-game spawns a shulker that: Has a health of 10 Has a wither and invisibility effect present Has noAI And is
|
||||||
* This class is responsible for the command /aliShulker, which in-game spawns
|
* Glowing
|
||||||
* a shulker that:
|
|
||||||
* Has a health of 10
|
|
||||||
* Has a wither and invisibility effect present
|
|
||||||
* Has noAI
|
|
||||||
* And is Glowing
|
|
||||||
*/
|
*/
|
||||||
public class AliShulker implements CommandExecutor {
|
public class AliShulker extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)){
|
|
||||||
sender.sendMessage("You must be a player to use this command!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if(!(player.getName().equals("iie") || player.getName().equals("alisolarflare"))){
|
if (!(player.getName().equals("iie") || player.getName().equals("alisolarflare"))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
|
@ -44,4 +38,26 @@ public class AliShulker implements CommandExecutor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "alishulker";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,22 +6,25 @@ import alisolarflare.modules.Module;
|
||||||
import alisolarflare.modules.events.uhc.commands.AddToUHC;
|
import alisolarflare.modules.events.uhc.commands.AddToUHC;
|
||||||
import alisolarflare.modules.events.uhc.commands.StartMatch;
|
import alisolarflare.modules.events.uhc.commands.StartMatch;
|
||||||
import alisolarflare.modules.events.uhc.memory.UHCMatch;
|
import alisolarflare.modules.events.uhc.memory.UHCMatch;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
public class UHCModule extends Module {
|
public class UHCModule extends Module {
|
||||||
public UHCMatch match;
|
public UHCMatch match;
|
||||||
|
|
||||||
public void register(JavaPlugin plugin){
|
public void register(JavaPlugin plugin) {
|
||||||
registerCommands(plugin);
|
registerCommands(plugin);
|
||||||
registerListeners(plugin);
|
registerListeners(plugin);
|
||||||
registerMemoryUnits(plugin);
|
registerMemoryUnits(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerListeners(JavaPlugin plugin) {
|
private void registerListeners(JavaPlugin plugin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCommands(JavaPlugin plugin) {
|
private void registerCommands(JavaPlugin plugin) {
|
||||||
registerCommand(plugin, "addToUHC", new AddToUHC(this.match));
|
TBMCChatAPI.AddCommands(plugin, AddToUHC.class);
|
||||||
registerCommand(plugin, "startMatch", new StartMatch(this.match));
|
|
||||||
}
|
}
|
||||||
private void registerMemoryUnits(JavaPlugin plugin){
|
|
||||||
|
private void registerMemoryUnits(JavaPlugin plugin) {
|
||||||
match = new UHCMatch(plugin.getConfig(), plugin.getConfig().getString("UHCMatchState"));
|
match = new UHCMatch(plugin.getConfig(), plugin.getConfig().getString("UHCMatchState"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,80 @@
|
||||||
package alisolarflare.modules.events.uhc.commands;
|
package alisolarflare.modules.events.uhc.commands;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.modules.events.uhc.memory.UHCMatch;
|
import alisolarflare.modules.events.uhc.memory.UHCMatch;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class handles the specific command /addToUHC which, in-game,
|
* This class handles the specific command /addToUHC which, in-game, adds a player to a specific UltraHardcore match, that is defined by the constructor: {@linkplain #AddToUHC(UHCMatch)}
|
||||||
* adds a player to a specific UltraHardcore match, that is defined
|
*
|
||||||
* by the constructor: {@linkplain #AddToUHC(UHCMatch)}
|
|
||||||
* @author Alisolarflare
|
* @author Alisolarflare
|
||||||
*/
|
*/
|
||||||
public class AddToUHC implements CommandExecutor{
|
public class AddToUHC extends TBMCCommandBase {
|
||||||
private UHCMatch generalMemory;
|
private UHCMatch generalMemory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for this AddToUHC
|
* Constructor for this AddToUHC
|
||||||
* @param generalMemory The Memory Unit for the current match
|
*
|
||||||
|
* @param generalMemory
|
||||||
|
* The Memory Unit for the current match
|
||||||
*/
|
*/
|
||||||
public AddToUHC(UHCMatch generalMemory){
|
public AddToUHC(UHCMatch generalMemory) {
|
||||||
this.generalMemory = generalMemory;
|
this.generalMemory = generalMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activated function when /addtoUHC <> is typed in-game
|
* Activated function when /addtoUHC <> is typed in-game
|
||||||
* @param sender CommandSender which sent the command /addToUHC
|
*
|
||||||
* @param command Command object created when /addToUHC is called in-game
|
* @param sender
|
||||||
* @param label Name of the command called
|
* CommandSender which sent the command /addToUHC
|
||||||
* @param args Arguments passed onto /addToUHC by the player
|
* @param command
|
||||||
|
* Command object created when /addToUHC is called in-game
|
||||||
|
* @param label
|
||||||
|
* Name of the command called
|
||||||
|
* @param args
|
||||||
|
* Arguments passed onto /addToUHC by the player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
//INPUT SANITATION
|
// INPUT SANITATION
|
||||||
if (!(sender instanceof Player)){
|
|
||||||
sender.sendMessage("You must be a player to use this command!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (player.getName() != "alisolarflare"){
|
if (player.getName() != "alisolarflare") {
|
||||||
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions");
|
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length <= 1){
|
if (args.length <= 1) {
|
||||||
sender.sendMessage("You must supply at least one playername");
|
sender.sendMessage("You must supply at least one playername");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Adds players to memory
|
// Adds players to memory
|
||||||
for (int i = 0; i > args.length; i++){
|
for (int i = 0; i > args.length; i++) {
|
||||||
generalMemory.matchPlayerUsernames.add(player.getName());
|
generalMemory.matchPlayerUsernames.add(player.getName());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "addtouhc";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,17 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import alisolarflare.modules.events.uhc.memory.MatchState;
|
import alisolarflare.modules.events.uhc.memory.MatchState;
|
||||||
import alisolarflare.modules.events.uhc.memory.UHCMatch;
|
import alisolarflare.modules.events.uhc.memory.UHCMatch;
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class StartMatch implements CommandExecutor {
|
public class StartMatch extends TBMCCommandBase {
|
||||||
private UHCMatch match;
|
private UHCMatch match;
|
||||||
public StartMatch(UHCMatch match){
|
|
||||||
|
public StartMatch(UHCMatch match) {
|
||||||
this.match = match;
|
this.match = match;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)){
|
|
||||||
sender.sendMessage("You must be a player to use this command! Contact a dev if you think this is wrong");
|
|
||||||
}
|
|
||||||
if (match.getMatchState() == MatchState.NULL)
|
if (match.getMatchState() == MatchState.NULL)
|
||||||
sender.sendMessage("There is no match to begin.");
|
sender.sendMessage("There is no match to begin.");
|
||||||
else if (match.getMatchState() == MatchState.IDLE)
|
else if (match.getMatchState() == MatchState.IDLE)
|
||||||
|
@ -32,4 +32,26 @@ public class StartMatch implements CommandExecutor {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "startmatch";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class AliArrowListener implements Listener {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent event){
|
public void onProjectileLaunch(ProjectileLaunchEvent event){
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package alisolarflare.modules.magictrick.aliarrow;
|
package alisolarflare.modules.magictrick.aliarrow;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import alisolarflare.modules.Module;
|
import alisolarflare.modules.Module;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
|
||||||
public class AliArrowModule extends Module{
|
public class AliArrowModule extends Module {
|
||||||
/**
|
/**
|
||||||
* Registers the plugin, activating listeners, commands, and events
|
* Registers the plugin, activating listeners, commands, and events
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin);
|
TBMCCoreAPI.RegisterEventsForExceptions(new AliArrowListener(plugin), plugin);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,12 @@ import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class AliArrowTask extends BukkitRunnable{
|
public class AliArrowTask extends BukkitRunnable {
|
||||||
JavaPlugin plugin;
|
JavaPlugin plugin;
|
||||||
String name;
|
String name;
|
||||||
Arrow arrow;
|
Arrow arrow;
|
||||||
|
|
||||||
|
public AliArrowTask(JavaPlugin plugin, Arrow arrow, String name) {
|
||||||
|
|
||||||
public AliArrowTask(JavaPlugin plugin, Arrow arrow, String name){
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.arrow = arrow;
|
this.arrow = arrow;
|
||||||
|
@ -20,19 +18,19 @@ public class AliArrowTask extends BukkitRunnable{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (arrow.isOnGround() || arrow.isDead()){
|
if (arrow.isOnGround() || arrow.isDead()) {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
if (name.equalsIgnoreCase("alisolarflare")){
|
if (name.equalsIgnoreCase("alisolarflare")) {
|
||||||
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
|
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
|
||||||
}
|
}
|
||||||
if (name.equalsIgnoreCase("Zanthr")){
|
if (name.equalsIgnoreCase("Zanthr")) {
|
||||||
arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1);
|
arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1);
|
||||||
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
|
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (name.equals("NorbiPeti"))
|
||||||
|
arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue