/plan lite command, PlanLite command change: /plan > /planlite

- Started creating planlite html,
-> html unfinished.
- Tested all 3 plugins working together, fixed bugs and typos
accordingly
-> Swapped planlite permissions and commands from plan to planlite
This commit is contained in:
Rsl1122 2017-01-15 18:54:14 +02:00
parent 2538e32e6d
commit 2a76db770e
16 changed files with 251 additions and 116 deletions

View File

@ -0,0 +1,50 @@
package com.djrapitops.planlite;
import org.bukkit.ChatColor;
/**
*
* @author Rsl1122
*/
public enum Phrase {
USERNAME_NOT_VALID(ChatColor.RED + "This Player doesn't exist."),
USERNAME_NOT_SEEN(ChatColor.RED + "This Player has not played on this server."),
USERNAME_NOT_KNOWN(ChatColor.RED + "Player not found from the database."),
COLOR_MAIN(ChatColor.DARK_GREEN),
COLOR_SEC(ChatColor.GRAY),
COLOR_TER(ChatColor.WHITE),
ARROWS_RIGHT("»"),
BALL(""),
ERROR_NO_HOOKS(ChatColor.RED + "[PlanLite] No Hooks enabled - Reload plugin!"),
COMMAND_SENDER_NOT_PLAYER(ChatColor.RED + "[PlanLite] This command can be only used as a player."),
COMMAND_REQUIRES_ARGUMENTS(ChatColor.RED + "[PlanLite] Command requires arguments."),
COMMAND_REQUIRES_ARGUMENTS_ONE(ChatColor.RED + "[PlanLite] Command requires one argument."),
COMMAND_NO_PERMISSION(ChatColor.RED + "[PlanLite] You do not have the required permmission.");
private final String text;
private final ChatColor color;
private Phrase(final String text) {
this.text = text;
this.color = null;
}
private Phrase(final ChatColor color) {
this.color = color;
this.text = "";
}
@Override
public String toString() {
return text;
}
/**
* @return Color of the COLOR_ENUM
*/
public ChatColor color() {
return color;
}
}

View File

@ -32,7 +32,7 @@ public class PlanLite extends JavaPlugin {
private final Map<String, Hook> hooks;
private API api;
private final Map<String, Hook> extraHooks;
private PlanCommand planCommand;
private PlanLiteCommand planCommand;
public PlanLite() {
this.hooks = new HashMap<>();
@ -79,11 +79,11 @@ public class PlanLite extends JavaPlugin {
if (!hookFail.isEmpty()) {
Bukkit.getServer().getConsoleSender().sendMessage("[PlanLite] " + failedMsg);
}
planCommand = new PlanCommand(this);
planCommand = new PlanLiteCommand(this);
getCommand("planlite").setExecutor(planCommand);
log("Player Analytics Enabled.");
log("Player Analytics Lite Enabled.");
}
public List<String> hookInit() {
@ -121,7 +121,7 @@ public class PlanLite extends JavaPlugin {
@Override
public void onDisable() {
log("Player Analytics Disabled.");
log("Player Analytics Lite Disabled.");
}
public void log(String message) {
@ -173,7 +173,7 @@ public class PlanLite extends JavaPlugin {
}
}
public PlanCommand getPlanCommand() {
public PlanLiteCommand getPlanCommand() {
return planCommand;
}
}

View File

@ -9,7 +9,6 @@ import com.djrapitops.planlite.command.commands.InspectCommand;
import com.djrapitops.planlite.command.commands.ReloadCommand;
import com.djrapitops.planlite.command.commands.SearchCommand;
import com.djrapitops.planlite.command.utils.MiscUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -19,11 +18,11 @@ import java.util.List;
import java.util.ArrayList;
import org.bukkit.entity.Player;
public class PlanCommand implements CommandExecutor {
public class PlanLiteCommand implements CommandExecutor {
private final List<SubCommand> commands;
public PlanCommand(PlanLite plugin) {
public PlanLiteCommand(PlanLite plugin) {
commands = new ArrayList<>();
commands.add(new HelpCommand(plugin, this));
@ -76,22 +75,18 @@ public class PlanCommand implements CommandExecutor {
boolean console = !(sender instanceof Player);
if (!sender.hasPermission(command.getPermission())) {
// Phrase.NO_PERMISSION_FOR_COMMAND.sendWithPrefix( sender );
sender.sendMessage(ChatColor.RED + "[PlanLite] You do not have the required permmission.");
sender.sendMessage(Phrase.COMMAND_NO_PERMISSION.toString());
return true;
}
if (console && args.length < 2 && command.getCommandType() == CommandType.CONSOLE_WITH_ARGUMENTS) {
// Phrase.COMMAND_NEEDS_ARGUMENTS.sendWithPrefix( sender );
sender.sendMessage(ChatColor.RED + "[PlanLite] Command requires arguments.");
sender.sendMessage(Phrase.COMMAND_REQUIRES_ARGUMENTS.toString());
return true;
}
if (console && command.getCommandType() == CommandType.PLAYER) {
// Phrase.COMMAND_NOT_CONSOLE.sendWithPrefix( sender, commandLabel );
sender.sendMessage(ChatColor.RED + "[PlanLite] This command can be only used as a player.");
sender.sendMessage(Phrase.COMMAND_SENDER_NOT_PLAYER.toString());
return true;
}
@ -101,9 +96,7 @@ public class PlanCommand implements CommandExecutor {
realArgs[i - 1] = args[i];
}
if (!command.onCommand(sender, cmd, commandLabel, realArgs)) {
// Phrase.TRY_COMMAND.sendWithPrefix( sender, parse( commandLabel, command ) );
}
command.onCommand(sender, cmd, commandLabel, realArgs);
return true;
}

View File

@ -1,5 +1,6 @@
package com.djrapitops.planlite.command.commands;
import com.djrapitops.planlite.Phrase;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.command.CommandType;
import com.djrapitops.planlite.command.SubCommand;
@ -24,18 +25,21 @@ public class AnalyzeCommand extends SubCommand {
private Date refreshDate;
public AnalyzeCommand(PlanLite plugin) {
super("analyze", "planlite.analyze", "Analyze data of all players /plan analyze [-refresh]", CommandType.CONSOLE);
super("analyze", "planlite.analyze", "Analyze data of players, /planlite analyze [-refresh]", CommandType.CONSOLE);
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor textColor = ChatColor.GRAY;
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
for (String arg : args) {
if (arg.toLowerCase().equals("-refresh")) {
if (sender.hasPermission("planlite.analyze.refresh") || !(sender instanceof Player)) {
refreshAnalysisData(sender);
} else {
sender.sendMessage(Phrase.COMMAND_NO_PERMISSION.toString());
}
}
}
@ -43,29 +47,30 @@ public class AnalyzeCommand extends SubCommand {
refreshAnalysisData(sender);
}
//header
sender.sendMessage(textColor + "-- [" + operatorColor + "PLAN - Analysis results, refreshed "
+ DataFormatUtils.formatTimeAmountSinceDate(refreshDate, new Date()) + " ago:" + textColor + "] --");
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite | Analysis results - refreshed "
+ DataFormatUtils.formatTimeAmountSinceDate(refreshDate, new Date()) + " ago");
List<String[]> dataList = DataFormatUtils.turnDataHashMapToSortedListOfArrays(analyzedPlayerdata);
sender.sendMessage("" + textColor + "Averages for " + this.playerData.size() + " player(s)");
sender.sendMessage(hColor + Phrase.BALL.toString() + tColor + " Averages for " + hColor + this.playerData.size() + tColor + " player(s)");
for (String[] dataString : dataList) {
sender.sendMessage("" + operatorColor + dataString[0].charAt(4) + dataString[0].toLowerCase().substring(5) + ": " + textColor + dataString[1]);
sender.sendMessage(" " + tColor + Phrase.BALL + oColor+" "
+ dataString[0].charAt(4) + dataString[0].toLowerCase().substring(5) + ": " + tColor + dataString[1]);
}
sender.sendMessage(textColor + "-- o --");
sender.sendMessage(hColor + Phrase.BALL.toString());
return true;
}
private void refreshAnalysisData(CommandSender sender) {
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor textColor = ChatColor.GRAY;
sender.sendMessage(textColor + "[" + operatorColor + "Plan" + textColor + "] "
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite " + tColor + "| "
+ "Refreshing playerData, this might take a while..");
this.playerData = DataUtils.getTotalData(DataUtils.getMatchingDisplaynames(true));
this.refreshDate = new Date();
this.analyzedPlayerdata = Analysis.analyze(this.playerData);
sender.sendMessage(textColor + "[" + operatorColor + "Plan" + textColor + "] "
+ "Refreshed, took "+DataFormatUtils.formatTimeAmountSinceDate(refreshDate, new Date()));
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite " + tColor + "| "
+ "Refreshed, took " + DataFormatUtils.formatTimeAmountSinceDate(refreshDate, new Date()));
}
}

View File

@ -1,7 +1,8 @@
package com.djrapitops.planlite.command.commands;
import com.djrapitops.planlite.Phrase;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.PlanCommand;
import com.djrapitops.planlite.PlanLiteCommand;
import com.djrapitops.planlite.command.CommandType;
import com.djrapitops.planlite.command.SubCommand;
import org.bukkit.ChatColor;
@ -12,9 +13,9 @@ import org.bukkit.entity.Player;
public class HelpCommand extends SubCommand {
private final PlanLite plugin;
private final PlanCommand command;
private final PlanLiteCommand command;
public HelpCommand(PlanLite plugin, PlanCommand command) {
public HelpCommand(PlanLite plugin, PlanLiteCommand command) {
super("help,?", "planlite.?", "Show command list.", CommandType.CONSOLE);
this.plugin = plugin;
@ -24,11 +25,11 @@ public class HelpCommand extends SubCommand {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
ChatColor textColor = ChatColor.GRAY;
sender.sendMessage(textColor + "-- [" + operatorColor + "Plan Lite - Player Analytics Lite" + textColor + "] --");
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite");
for (SubCommand command : this.command.getCommands()) {
if (command.getName().equalsIgnoreCase(getName())) {
@ -43,9 +44,11 @@ public class HelpCommand extends SubCommand {
continue;
}
sender.sendMessage(operatorColor + "/planlite " + command.getFirstName() + textColor + " - " + command.getUsage());
sender.sendMessage(" "+Phrase.BALL+oColor + " /planlite " + command.getFirstName() + tColor + " " + command.getUsage());
}
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString());
return true;
}

View File

@ -1,5 +1,6 @@
package com.djrapitops.planlite.command.commands;
import com.djrapitops.planlite.Phrase;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.command.CommandType;
import com.djrapitops.planlite.command.SubCommand;
@ -21,12 +22,15 @@ public class InfoCommand extends SubCommand {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
plugin.reloadConfig();
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor textColor = ChatColor.GRAY;
sender.sendMessage(textColor +"--["+operatorColor+"PLAN - Info"+textColor+"]--");
sender.sendMessage(operatorColor+"Version: "+textColor+plugin.getDescription().getVersion());
sender.sendMessage(textColor+MiscUtils.checkVersion());
sender.sendMessage(operatorColor+"Enabled Hooks: "+textColor+plugin.getHooks().keySet());
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite | Info");
sender.sendMessage(oColor+"Version: "+tColor+plugin.getDescription().getVersion());
sender.sendMessage(tColor+MiscUtils.checkVersion());
sender.sendMessage(oColor+"Enabled Hooks: "+tColor+plugin.getHooks().keySet());
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString());
return true;
}

View File

@ -1,6 +1,8 @@
package com.djrapitops.planlite.command.commands;
import com.djrapitops.planlite.Phrase;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.UUIDFetcher;
import com.djrapitops.planlite.command.CommandType;
import com.djrapitops.planlite.command.SubCommand;
import com.djrapitops.planlite.command.utils.DataFormatUtils;
@ -11,8 +13,11 @@ import java.util.HashMap;
import java.util.List;
import com.djrapitops.planlite.api.DataPoint;
import com.djrapitops.planlite.api.DataType;
import java.util.UUID;
import static org.bukkit.Bukkit.getOfflinePlayer;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -21,7 +26,7 @@ public class InspectCommand extends SubCommand {
private PlanLite plugin;
public InspectCommand(PlanLite plugin) {
super("inspect", "planlite.inspect", "Inspect data /plan <player> [-a, -r].", CommandType.CONSOLE_WITH_ARGUMENTS);
super("inspect", "planlite.inspect", "Inspect data /planlite <player> [-a, -r].", CommandType.CONSOLE_WITH_ARGUMENTS);
this.plugin = plugin;
}
@ -29,12 +34,24 @@ public class InspectCommand extends SubCommand {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
String playerName = DataUtils.getPlayerDisplayname(args, sender);
UUID uuid;
try {
uuid = UUIDFetcher.getUUIDOf(playerName);
if (uuid == null) {
throw new Exception("Username doesn't exist.");
}
} catch (Exception e) {
sender.sendMessage(Phrase.USERNAME_NOT_VALID.toString());
return true;
}
OfflinePlayer p = getOfflinePlayer(uuid);
if (!p.hasPlayedBefore()) {
sender.sendMessage(Phrase.USERNAME_NOT_SEEN.toString());
return true;
}
if (this.plugin.getHooks().isEmpty()) {
this.plugin.logError("noHookedPluginsError on InspectCommand");
this.plugin.logToFile("INSPECT\nnoHookedPluginsError on InspectCommand");
return false;
sender.sendMessage(Phrase.ERROR_NO_HOOKS.toString());
return true;
}
boolean allData = false;
@ -61,16 +78,16 @@ public class InspectCommand extends SubCommand {
List<String[]> dataList = DataFormatUtils.turnDataHashMapToSortedListOfArrays(data);
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor textColor = ChatColor.GRAY;
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
//header
sender.sendMessage(textColor + "-- [" + operatorColor + "PLAN - Inspect results: " + playerName +" - took "+DataFormatUtils.formatTimeAmountSinceDate(refreshDate, new Date())+ textColor + "] --");
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite | Inspect results: " + playerName);
for (String[] dataString : dataList) {
sender.sendMessage("" + operatorColor + dataString[0].charAt(4) + dataString[0].toLowerCase().substring(5) + ": " + textColor + dataString[1]);
sender.sendMessage(" " + tColor + Phrase.BALL + oColor+" "+ dataString[0].charAt(4) + dataString[0].toLowerCase().substring(5) + ": " + tColor + dataString[1]);
}
sender.sendMessage(textColor + "-- o --");
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString());
return true;
}
}

View File

@ -1,5 +1,6 @@
package com.djrapitops.planlite.command.commands;
import com.djrapitops.planlite.Phrase;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.command.CommandType;
import com.djrapitops.planlite.command.SubCommand;
@ -24,9 +25,10 @@ public class ReloadCommand extends SubCommand {
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
plugin.reloadConfig();
List<String> hookFail = plugin.hookInit();
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor textColor = ChatColor.GRAY;
sender.sendMessage(textColor + "[" + operatorColor + "PLAN" + textColor + "] Config & Hooks reloaded.");
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite | Config & Hooks reloaded.");
String loadedMsg = " Hooked into: ";
for (String key : plugin.getHooks().keySet()) {
loadedMsg += ChatColor.GREEN + key + " ";
@ -35,9 +37,9 @@ public class ReloadCommand extends SubCommand {
for (String string : hookFail) {
failedMsg += ChatColor.RED + string + " ";
}
sender.sendMessage(textColor + loadedMsg);
sender.sendMessage(tColor + loadedMsg);
if (!hookFail.isEmpty()) {
sender.sendMessage(textColor + failedMsg);
sender.sendMessage(tColor + failedMsg);
}
return true;
}

View File

@ -1,5 +1,6 @@
package com.djrapitops.planlite.command.commands;
import com.djrapitops.planlite.Phrase;
import com.djrapitops.planlite.PlanLite;
import com.djrapitops.planlite.command.CommandType;
import com.djrapitops.planlite.command.SubCommand;
@ -13,7 +14,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import static org.bukkit.Bukkit.getOfflinePlayer;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
@ -25,7 +25,7 @@ public class SearchCommand extends SubCommand {
private final PlanLite plugin;
public SearchCommand(PlanLite plugin) {
super("search", "planlite.search", "Inspect specific data /plan <search terms> [-p]", CommandType.CONSOLE_WITH_ARGUMENTS);
super("search", "planlite.search", "Inspect specific data /planlite <search terms> [-p]", CommandType.CONSOLE_WITH_ARGUMENTS);
this.plugin = plugin;
}
@ -46,13 +46,11 @@ public class SearchCommand extends SubCommand {
matchingPlayers = DataUtils.getMatchingDisplaynames(args, sender, false);
}
args = DataFormatUtils.parseSearchArgs(args);
HashMap<UUID, HashMap<String, DataPoint>> data = DataUtils.getTotalData(matchingPlayers);
if (this.plugin.getHooks().isEmpty()) {
this.plugin.logError("noHookedPluginsError on SearchCommand");
this.plugin.logToFile("SEARCH\nnoHookedPluginsError on SearchCommand");
return false;
sender.sendMessage(Phrase.ERROR_NO_HOOKS.toString());
return true;
}
HashMap<UUID, HashMap<String, DataPoint>> data = DataUtils.getTotalData(matchingPlayers);
Date refreshDate = new Date();
HashMap<String, List<String[]>> dataLists = new HashMap<>();
@ -69,22 +67,23 @@ public class SearchCommand extends SubCommand {
dataLists.put(p.getName(), DataFormatUtils.turnDataHashMapToSortedListOfArrays(dataMap));
}
ChatColor operatorColor = ChatColor.DARK_GREEN;
ChatColor textColor = ChatColor.GRAY;
ChatColor oColor = Phrase.COLOR_MAIN.color();
ChatColor tColor = Phrase.COLOR_SEC.color();
ChatColor hColor = Phrase.COLOR_TER.color();
//header
sender.sendMessage(textColor + "-- [" + operatorColor + "PLAN - Search results: took " + DataFormatUtils.formatTimeAmountSinceDate(refreshDate, new Date()) + textColor + "] --");
sender.sendMessage(operatorColor + "Results for: " + Arrays.toString(args));
for (String playerName : dataLists.keySet()) {
sender.sendMessage(textColor + "Matching player: " + playerName);
for (String[] dataString : dataLists.get(playerName)) {
sender.sendMessage("" + operatorColor + dataString[0].charAt(4) + dataString[0].toLowerCase().substring(5) + ": " + textColor + dataString[1]);
}
}
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString() + oColor + " Player Analytics Lite | Search results: " + Arrays.toString(args));
if (dataLists.isEmpty()) {
sender.sendMessage(operatorColor + "No results for " + textColor + Arrays.toString(args) + operatorColor + ".");
sender.sendMessage(" " + tColor + Phrase.BALL + oColor + " No results.");
} else {
for (String playerName : dataLists.keySet()) {
sender.sendMessage(tColor + "Matching player: " + hColor + playerName);
for (String[] dataString : dataLists.get(playerName)) {
sender.sendMessage(" " + tColor + Phrase.BALL + oColor + " "
+ dataString[0].charAt(4) + dataString[0].toLowerCase().substring(5) + ": " + tColor + dataString[1]);
}
sender.sendMessage(textColor + "-- o --");
}
}
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString());
return true;
}
}

View File

@ -3,23 +3,23 @@ main: com.djrapitops.planlite.PlanLite
version: 1.6.3
commands:
plan:
planlite:
usage: /<command> <name>
description: base command
inspect:
usage: /plan inspect <name>
usage: /planlite inspect <name>
description: inspect player data
analyze:
usage: /plan analyze
usage: /planlite analyze
description: analyze all players' data, add -refresh to refresh analysis.
reload:
usage: /plan reload
usage: /planlite reload
description: reload plugin config
search:
usage: /plan <search terms> -p add -p to make not search playername
usage: /planlite <search terms> -p add -p to make not search playername
description: search data of multiple players with search terms
debug:
usage: /plan debug
usage: /planlite debug
description: run commands to debug the plugin.
softdepend:

View File

@ -6,6 +6,8 @@ import com.djrapitops.planlite.api.DataPoint;
import java.util.HashMap;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
/**
@ -38,13 +40,15 @@ public class PlanLiteHook {
}
enabled = true;
planLiteApi = planLite.getAPI();
return;
} catch (Exception e) {
}
}
}
} else {
enabled = false;
}
} else {
enabled = false;
}
}
public Set<String> getEnabledHooksNames() {
return planLite.getHooks().keySet();
@ -61,4 +65,8 @@ public class PlanLiteHook {
public boolean isEnabled() {
return enabled;
}
public boolean passCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
return planLite.getPlanCommand().onCommand(sender, cmd, commandLabel, args);
}
}

View File

@ -2,12 +2,7 @@ package com.djrapitops.plan.command;
import com.djrapitops.plan.Phrase;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.command.commands.AnalyzeCommand;
import com.djrapitops.plan.command.commands.HelpCommand;
import com.djrapitops.plan.command.commands.InfoCommand;
import com.djrapitops.plan.command.commands.InspectCommand;
import com.djrapitops.plan.command.commands.ReloadCommand;
import com.djrapitops.plan.command.commands.SearchCommand;
import com.djrapitops.plan.command.commands.*;
import com.djrapitops.plan.utilities.FormatUtils;
import org.bukkit.command.Command;
@ -42,6 +37,9 @@ public class PlanCommand implements CommandExecutor {
commands.add(new SearchCommand(plugin));
commands.add(new InfoCommand(plugin));
commands.add(new ReloadCommand(plugin));
if (plugin.getPlanLiteHook().isEnabled()) {
commands.add(new LiteCommand(plugin));
}
}
/**

View File

@ -47,7 +47,7 @@ public class HelpCommand extends SubCommand {
}
sender.sendMessage(tColor + " " + Phrase.BALL.toString() + oColor
+ " /plan " + command.getFirstName() + command.getArguments() + tColor + " - " + command.getUsage());
+ " /plan " + command.getFirstName() +" "+ command.getArguments() + tColor + " - " + command.getUsage());
}
// Footer
sender.sendMessage(hColor + Phrase.ARROWS_RIGHT.toString());

View File

@ -0,0 +1,30 @@
package com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanLiteHook;
import com.djrapitops.plan.command.CommandType;
import com.djrapitops.plan.command.SubCommand;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class LiteCommand extends SubCommand {
private Plan plugin;
private PlanLiteHook hook;
public LiteCommand(Plan plugin) {
super("lite", "plan.?", "Use PlanLite Commands", CommandType.CONSOLE, "<planlite command>");
this.plugin = plugin;
this.hook = plugin.getPlanLiteHook();
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (hook.isEnabled()) {
return hook.passCommand(sender, cmd, commandLabel, args);
}
return false;
}
}

View File

@ -152,6 +152,7 @@ public class AnalysisUtils {
+ "border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px; "
+ "box-shadow: 5px 5px 4px 0px #888888;\">";
if (sortedTowns.size() > 1) {
html += "<table style=\"border-collapse: collapse;table-layout: fixed; border-style: solid; border-width: 1px; width: 100%;\">";
int i = 1;
@ -162,7 +163,10 @@ public class AnalysisUtils {
html += "<tr style=\"text-align: center;border-style: solid; border-width: 1px;height: 28px;\"><td><b>" + values[1] + "</b></td>\r\n<td>" + values[0] + "</td></tr>";
i++;
}
html += "</table><table style=\"border-collapse: collapse;table-layout: fixed; border-style: solid; border-width: 1px; width: 100%;\">";
html += "</table>";
}
html += "<table style=\"border-collapse: collapse;table-layout: fixed; border-style: solid; border-width: 1px; width: 100%;\">";
int j = 1;
for (String[] values : sortedFactions) {
if (j >= 20) {
@ -172,9 +176,9 @@ public class AnalysisUtils {
j++;
}
html += "</table></tr>" + "<tr>"
+ " <td style=\"margin-left: 3px; margin-right: auto; "
+ " border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px;"
+ " box-shadow: 5px 5px 4px 0px #888888;\">"
+ "<td style=\"margin-left: 3px; margin-right: auto; "
+ "border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px;"
+ "box-shadow: 5px 5px 4px 0px #888888;\">"
+ "<h4>Information</h4>"
+ "<p>Total Money on the server: " + planLiteData.getTotalMoney() + "<br/>Players have voted the server "
+ planLiteData.getTotalVotes() + " times.</p>"

View File

@ -0,0 +1,22 @@
<!doctype html>
<head></head>
<body>
<table>
<tr>
<td style="margin-left: 3px; margin-right: auto;border-style: groove; border-width: 3px;
border-radius: 12px; padding: 2px 4px 2px 3px; box-shadow: 5px 5px 4px 0px #888888;">
<p>%townyheader%</p>
<p>%townylist%</p>
<br/>
<p>%factionheader%</p>
<p>%factionlist%</p>
</td>
<td style="margin-left: 3px; margin-right: auto;border-style: groove; border-width: 3px;
border-radius: 12px; padding: 2px 4px 2px 3px; box-shadow: 5px 5px 4px 0px #888888;">
<h4>Information from PlanLite</h4>
<p>%totalmoneyline%</p>
<p>%totalvotesline%</p>
</td>
</tr>
</table>
</body>