Some fixes to Commands
This commit is contained in:
parent
89f4dc4f57
commit
b94f227bce
13 changed files with 136 additions and 107 deletions
84
dependency-reduced-pom.xml
Normal file
84
dependency-reduced-pom.xml
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>nl.iobyte</groupId>
|
||||||
|
<artifactId>themeparkconnector</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>vault-repo</id>
|
||||||
|
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>codemc-repo</id>
|
||||||
|
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>nl.iobyte</groupId>
|
||||||
|
<artifactId>themepark</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
|
<artifactId>VaultAPI</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
</project>
|
4
pom.xml
4
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<groupId>nl.iobyte</groupId>
|
<groupId>nl.iobyte</groupId>
|
||||||
<artifactId>themeparkconnector</artifactId>
|
<artifactId>themeparkconnector</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.1</version>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.iobyte</groupId>
|
<groupId>nl.iobyte</groupId>
|
||||||
<artifactId>themepark</artifactId>
|
<artifactId>themepark</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package nl.iobyte.themeparkconnector.commands;
|
package nl.iobyte.themeparkconnector.commands;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.CommandFactory;
|
import nl.iobyte.commandapi.CommandFactory;
|
||||||
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import nl.iobyte.commandapi.middlewares.PermissionMiddleware;
|
import nl.iobyte.commandapi.middlewares.PermissionMiddleware;
|
||||||
|
import nl.iobyte.themepark.commands.executors.ConsoleExecutor;
|
||||||
|
import nl.iobyte.themepark.commands.executors.PlayerExecutor;
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
import nl.iobyte.themeparkconnector.commands.subcommands.*;
|
import nl.iobyte.themeparkconnector.commands.subcommands.*;
|
||||||
import nl.iobyte.themeparkconnector.commands.subcommands.operator.OperatorCommands;
|
import nl.iobyte.themeparkconnector.commands.subcommands.operator.OperatorCommands;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ThemeParkConnectorCommand {
|
public class ThemeParkConnectorCommand {
|
||||||
|
|
||||||
|
@ -26,7 +30,14 @@ public class ThemeParkConnectorCommand {
|
||||||
factory.addMiddleware(new PermissionMiddleware());
|
factory.addMiddleware(new PermissionMiddleware());
|
||||||
|
|
||||||
//Register command
|
//Register command
|
||||||
factory.registerCommand(ThemeParkConnector.getInstance());
|
ThemeParkConnector.getInstance().getCommand(factory.getName()).setExecutor((sender, command, s, args) -> {
|
||||||
|
ICommandExecutor executor = new ConsoleExecutor(sender);
|
||||||
|
if(sender instanceof Player)
|
||||||
|
executor = new PlayerExecutor((Player) sender);
|
||||||
|
|
||||||
|
factory.onCommand(executor, args);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import nl.iobyte.themeparkconnector.api.operator.objects.AttractionOperator;
|
||||||
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItem;
|
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItem;
|
||||||
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItemState;
|
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItemState;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ public class OperatorArgument implements ICommandArgument<OperatorItemState> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if argument is valid OperatorItemState
|
* Check if argument is valid OperatorItemState
|
||||||
* @param sender CommandSender
|
* @param sender ICommandExecutor
|
||||||
* @param args Arguments passed by Command
|
* @param args Arguments passed by Command
|
||||||
* @param previousArguments Previous arguments
|
* @param previousArguments Previous arguments
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public ArgumentCheck checkArgument(CommandSender sender, String[] args, List<Object> previousArguments) {
|
public ArgumentCheck checkArgument(ICommandExecutor sender, String[] args, List<Object> previousArguments) {
|
||||||
if(args.length < 3)
|
if(args.length < 3)
|
||||||
return new ArgumentCheck(false, 1);
|
return new ArgumentCheck(false, 1);
|
||||||
|
|
||||||
|
@ -49,12 +49,12 @@ public class OperatorArgument implements ICommandArgument<OperatorItemState> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get OperatorItemState passed by command
|
* Get OperatorItemState passed by command
|
||||||
* @param sender CommandSender
|
* @param sender ICommandExecutor
|
||||||
* @param args Arguments passed by Command
|
* @param args Arguments passed by Command
|
||||||
* @param previousArguments Previous arguments
|
* @param previousArguments Previous arguments
|
||||||
* @return OperatorItemState
|
* @return OperatorItemState
|
||||||
*/
|
*/
|
||||||
public OperatorItemState getArgument(CommandSender sender, String[] args, List<Object> previousArguments) {
|
public OperatorItemState getArgument(ICommandExecutor sender, String[] args, List<Object> previousArguments) {
|
||||||
AttractionOperator operator = ThemeParkConnector.getInstance().getAPI().getOperatorService().getOperator(args[0]);
|
AttractionOperator operator = ThemeParkConnector.getInstance().getAPI().getOperatorService().getOperator(args[0]);
|
||||||
previousArguments.add(operator);
|
previousArguments.add(operator);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package nl.iobyte.themeparkconnector.commands.subcommands;
|
package nl.iobyte.themeparkconnector.commands.subcommands;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
import nl.iobyte.themepark.api.attraction.objects.Attraction;
|
||||||
import nl.iobyte.themepark.commands.arguments.AttractionArgument;
|
import nl.iobyte.themepark.commands.arguments.AttractionArgument;
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import nl.iobyte.themeparkconnector.api.operator.objects.AttractionOperator;
|
import nl.iobyte.themeparkconnector.api.operator.objects.AttractionOperator;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ public class ConnectCommand extends SubCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Attempt to generate an url for the Player
|
//Attempt to generate an url for the Player
|
||||||
public void onPlayerCommand(Player player, List<Object> list, int i) {
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
|
Player player = (Player) sender.getOriginal();
|
||||||
Attraction attraction = (Attraction) list.get(0);
|
Attraction attraction = (Attraction) list.get(0);
|
||||||
AttractionOperator operator = ThemeParkConnector.getInstance().getAPI().getOperatorService().getOperator(attraction.getID());
|
AttractionOperator operator = ThemeParkConnector.getInstance().getAPI().getOperatorService().getOperator(attraction.getID());
|
||||||
if(operator == null) {
|
if(operator == null) {
|
||||||
|
@ -41,6 +42,4 @@ public class ConnectCommand extends SubCommand {
|
||||||
client.publishURL(attraction.getID());
|
client.publishURL(attraction.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onConsoleCommand(CommandSender commandSender, List<Object> list, int i) { }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package nl.iobyte.themeparkconnector.commands.subcommands;
|
package nl.iobyte.themeparkconnector.commands.subcommands;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
import nl.iobyte.themeparkconnector.api.ThemeParkConnectorAPI;
|
import nl.iobyte.themeparkconnector.api.ThemeParkConnectorAPI;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DisconnectCommand extends SubCommand {
|
public class DisconnectCommand extends SubCommand {
|
||||||
|
@ -17,11 +16,7 @@ public class DisconnectCommand extends SubCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Attempt to generate an url for the Player
|
//Attempt to generate an url for the Player
|
||||||
public void onPlayerCommand(Player player, List<Object> list, int i) {
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
onConsoleCommand(player, list, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onConsoleCommand(CommandSender sender, List<Object> list, int i) {
|
|
||||||
ThemeParkConnectorAPI api = ThemeParkConnector.getInstance().getAPI();
|
ThemeParkConnectorAPI api = ThemeParkConnector.getInstance().getAPI();
|
||||||
try {
|
try {
|
||||||
if (api.getStateService().isConnected())
|
if (api.getStateService().isConnected())
|
||||||
|
|
|
@ -2,9 +2,9 @@ package nl.iobyte.themeparkconnector.commands.subcommands;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.CommandFactory;
|
import nl.iobyte.commandapi.CommandFactory;
|
||||||
import nl.iobyte.commandapi.arguments.number.IntegerArgument;
|
import nl.iobyte.commandapi.arguments.number.IntegerArgument;
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -21,12 +21,8 @@ public class HelpCommand extends SubCommand {
|
||||||
.addArgument(new IntegerArgument());
|
.addArgument(new IntegerArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerCommand(Player player, List<Object> list, int i) {
|
//Send ICommandExecutor list of commands it has access to
|
||||||
onConsoleCommand(player, list, i);
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
}
|
|
||||||
|
|
||||||
//Send CommandSender list of commands it has access to
|
|
||||||
public void onConsoleCommand(CommandSender sender, List<Object> list, int i) {
|
|
||||||
List<SubCommand> commands = factory.getApplicableSubCommands(sender);
|
List<SubCommand> commands = factory.getApplicableSubCommands(sender);
|
||||||
if(commands.size() <= 5) {
|
if(commands.size() <= 5) {
|
||||||
sendSinglePage(sender, commands);
|
sendSinglePage(sender, commands);
|
||||||
|
@ -36,7 +32,7 @@ public class HelpCommand extends SubCommand {
|
||||||
sendMultiPage(sender, commands, list, i);
|
sendMultiPage(sender, commands, list, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendSinglePage(CommandSender sender, List<SubCommand> commands) {
|
private void sendSinglePage(ICommandExecutor sender, List<SubCommand> commands) {
|
||||||
sender.sendMessage(Text.color("&f&l>==== &6&lThemeParkConnector &l&f====<"));
|
sender.sendMessage(Text.color("&f&l>==== &6&lThemeParkConnector &l&f====<"));
|
||||||
for (SubCommand command : commands)
|
for (SubCommand command : commands)
|
||||||
sender.sendMessage(Text.color("&f" + command.getApplicableSyntaxList(sender).get(0).getUsage()));
|
sender.sendMessage(Text.color("&f" + command.getApplicableSyntaxList(sender).get(0).getUsage()));
|
||||||
|
@ -44,7 +40,7 @@ public class HelpCommand extends SubCommand {
|
||||||
sender.sendMessage(Text.color("&f&l>==== &6&lThemeParkConnector &l&f====<"));
|
sender.sendMessage(Text.color("&f&l>==== &6&lThemeParkConnector &l&f====<"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMultiPage(CommandSender sender, List<SubCommand> commands, List<Object> list, int i) {
|
private void sendMultiPage(ICommandExecutor sender, List<SubCommand> commands, List<Object> list, int i) {
|
||||||
int page = 1;
|
int page = 1;
|
||||||
int pages = (int) Math.ceil(((double) commands.size()) / 5);
|
int pages = (int) Math.ceil(((double) commands.size()) / 5);
|
||||||
if(i == 1)
|
if(i == 1)
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package nl.iobyte.themeparkconnector.commands.subcommands;
|
package nl.iobyte.themeparkconnector.commands.subcommands;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.arguments.MessageArgument;
|
import nl.iobyte.commandapi.arguments.MessageArgument;
|
||||||
import nl.iobyte.commandapi.arguments.PlayersArgument;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.themepark.commands.arguments.PlayersArgument;
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
||||||
import nl.iobyte.themeparkconnector.api.client.objects.Notification;
|
import nl.iobyte.themeparkconnector.api.client.objects.Notification;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -22,12 +22,9 @@ public class NotificationCommand extends SubCommand {
|
||||||
.addArgument(new MessageArgument());
|
.addArgument(new MessageArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerCommand(Player player, List<Object> objects, int i) {
|
|
||||||
onConsoleCommand(player, objects, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get Notification data and send to Player(s)
|
//Get Notification data and send to Player(s)
|
||||||
public void onConsoleCommand(CommandSender sender, List<Object> objects, int i) {
|
@SuppressWarnings("unchecked")
|
||||||
|
public void onCommand(ICommandExecutor sender, List<Object> objects, int i) {
|
||||||
Notification notification = new Notification((String) objects.get(1), (String) objects.get(2));
|
Notification notification = new Notification((String) objects.get(1), (String) objects.get(2));
|
||||||
for(Player player : (List<Player>) objects.get(0)) {
|
for(Player player : (List<Player>) objects.get(0)) {
|
||||||
ClientConnection client = ThemeParkConnector.getInstance().getAPI().getNetworkingService().getClient(player.getUniqueId());
|
ClientConnection client = ThemeParkConnector.getInstance().getAPI().getNetworkingService().getClient(player.getUniqueId());
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package nl.iobyte.themeparkconnector.commands.subcommands;
|
package nl.iobyte.themeparkconnector.commands.subcommands;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
import nl.iobyte.themeparkconnector.api.ThemeParkConnectorAPI;
|
import nl.iobyte.themeparkconnector.api.ThemeParkConnectorAPI;
|
||||||
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
import nl.iobyte.themeparkconnector.api.client.ClientConnection;
|
||||||
import nl.iobyte.themeparkconnector.api.state.objects.AbstractState;
|
import nl.iobyte.themeparkconnector.api.state.objects.AbstractState;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -19,12 +19,8 @@ public class StatusCommand extends SubCommand {
|
||||||
addSyntax("/themeparkconnector status");
|
addSyntax("/themeparkconnector status");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerCommand(Player player, List<Object> objects, int i) {
|
//Give ICommandExecutor overview of Plugin status
|
||||||
onConsoleCommand(player, objects, i);
|
public void onCommand(ICommandExecutor sender, List<Object> objects, int i) {
|
||||||
}
|
|
||||||
|
|
||||||
//Give CommandSender overview of Plugin status
|
|
||||||
public void onConsoleCommand(CommandSender sender, List<Object> objects, int i) {
|
|
||||||
ThemeParkConnectorAPI api = ThemeParkConnector.getInstance().getAPI();
|
ThemeParkConnectorAPI api = ThemeParkConnector.getInstance().getAPI();
|
||||||
AbstractState state = api.getStateService().getCurrentState();
|
AbstractState state = api.getStateService().getCurrentState();
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package nl.iobyte.themeparkconnector.commands.subcommands.operator;
|
package nl.iobyte.themeparkconnector.commands.subcommands.operator;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.themeparkconnector.api.load.objects.OperatorDataLoader;
|
import nl.iobyte.themeparkconnector.api.load.objects.OperatorDataLoader;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OperatorReloadCommand extends SubCommand {
|
public class OperatorReloadCommand extends SubCommand {
|
||||||
|
@ -15,13 +14,7 @@ public class OperatorReloadCommand extends SubCommand {
|
||||||
addSyntax("/themeparkconnector operator reload");
|
addSyntax("/themeparkconnector operator reload");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
public void onPlayerCommand(Player player, List<Object> list, int i) {
|
|
||||||
onConsoleCommand(player, list, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConsoleCommand(CommandSender sender, List<Object> list, int i) {
|
|
||||||
sender.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &6Attempting to load ride operators"));
|
sender.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &6Attempting to load ride operators"));
|
||||||
new OperatorDataLoader().load();
|
new OperatorDataLoader().load();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package nl.iobyte.themeparkconnector.commands.subcommands.operator;
|
package nl.iobyte.themeparkconnector.commands.subcommands.operator;
|
||||||
|
|
||||||
import nl.iobyte.commandapi.arguments.StringArgument;
|
import nl.iobyte.commandapi.arguments.StringArgument;
|
||||||
import nl.iobyte.commandapi.interfaces.SubCommand;
|
import nl.iobyte.commandapi.objects.SubCommand;
|
||||||
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
import nl.iobyte.themeparkconnector.ThemeParkConnector;
|
||||||
import nl.iobyte.themeparkconnector.api.event.operator.OperatorStateEvent;
|
import nl.iobyte.themeparkconnector.api.event.operator.OperatorStateEvent;
|
||||||
import nl.iobyte.themeparkconnector.api.message.Text;
|
import nl.iobyte.themeparkconnector.api.message.Text;
|
||||||
|
@ -9,8 +9,7 @@ import nl.iobyte.themeparkconnector.api.operator.objects.AttractionOperator;
|
||||||
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItem;
|
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItem;
|
||||||
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItemState;
|
import nl.iobyte.themeparkconnector.api.operator.objects.panel.OperatorItemState;
|
||||||
import nl.iobyte.themeparkconnector.commands.arguments.OperatorArgument;
|
import nl.iobyte.themeparkconnector.commands.arguments.OperatorArgument;
|
||||||
import org.bukkit.command.CommandSender;
|
import nl.iobyte.commandapi.interfaces.ICommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OperatorStateCommand extends SubCommand {
|
public class OperatorStateCommand extends SubCommand {
|
||||||
|
@ -26,19 +25,13 @@ public class OperatorStateCommand extends SubCommand {
|
||||||
.addArgument(new StringArgument());
|
.addArgument(new StringArgument());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void onCommand(ICommandExecutor sender, List<Object> list, int i) {
|
||||||
public void onPlayerCommand(Player player, List<Object> list, int i) {
|
|
||||||
onConsoleCommand(player, list, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConsoleCommand(CommandSender sender, List<Object> list, int i) {
|
|
||||||
AttractionOperator operator = (AttractionOperator) list.get(0);
|
AttractionOperator operator = (AttractionOperator) list.get(0);
|
||||||
OperatorItem item = (OperatorItem) list.get(1);
|
OperatorItem item = (OperatorItem) list.get(1);
|
||||||
OperatorItemState state = (OperatorItemState) list.get(2);
|
OperatorItemState state = (OperatorItemState) list.get(2);
|
||||||
OperatorItemState old = item.getActiveState();
|
OperatorItemState old = item.getActiveState();
|
||||||
if(state.getID().equals(old.getID())) {
|
if(state.getID().equals(old.getID())) {
|
||||||
if(sender instanceof Player)
|
if(sender.isPlayer())
|
||||||
sender.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &4Item already in state: &f"+state.getID()));
|
sender.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &4Item already in state: &f"+state.getID()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -53,7 +46,7 @@ public class OperatorStateCommand extends SubCommand {
|
||||||
i == 0 ? "" : (String) list.get(3)
|
i == 0 ? "" : (String) list.get(3)
|
||||||
));
|
));
|
||||||
|
|
||||||
if(sender instanceof Player)
|
if(sender.isPlayer())
|
||||||
sender.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &aSuccessfully changed state of item to: &f"+state.getID()));
|
sender.sendMessage(Text.color("&6&lThemeParkConnectorMC &f➢ &aSuccessfully changed state of item to: &f"+state.getID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: ThemeParkConnector
|
name: ThemeParkConnector
|
||||||
version: 3.0.0
|
version: 3.0.1
|
||||||
author: IOByte
|
author: IOByte
|
||||||
website: 'https://www.iobyte.nl'
|
website: 'https://www.iobyte.nl'
|
||||||
main: nl.iobyte.themeparkconnector.ThemeParkConnector
|
main: nl.iobyte.themeparkconnector.ThemeParkConnector
|
||||||
|
@ -7,5 +7,5 @@ depend: [ThemePark]
|
||||||
softdepend: [Vault,PlaceholderAPI,Train_Carts,Multiverse-Core,MultiWorld]
|
softdepend: [Vault,PlaceholderAPI,Train_Carts,Multiverse-Core,MultiWorld]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
tpc:
|
themeparkconnector:
|
||||||
aliases: [themeparkconnector]
|
aliases: [tpc]
|
|
@ -1,35 +0,0 @@
|
||||||
<?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_11">
|
|
||||||
<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/main/resources" type="java-resource" />
|
|
||||||
<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" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: io.socket:socket.io-client:1.0.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: io.socket:engine.io-client:1.0.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.12.12" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.15.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.json:json:20090211" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: nl.iobyte:themepark:3.0.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: de.mkammerer.snowflake-id:snowflake-id:0.0.1" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: de.tr7zw:item-nbt-api:2.8.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: de.tr7zw:functional-annotations:0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:VaultAPI:1.7" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
Reference in a new issue