Fixed NPE error when dependency plugin not found
Fixed Chat error causing chat prefixes to stop working Updated to QuickShop Reremake 3.0.2 API Dropped filename versioning number. Added /GriefPreventionQuickShopBridge [version | help] command Added /GriefPreventionQuickShopBridge [reload] command
This commit is contained in:
parent
5334d90daa
commit
f82177cf22
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.github.judgetread</groupId>
|
||||
<artifactId>GriefPreventionQuickShopBridge</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.1.1</version>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
|
@ -1,13 +1,15 @@
|
||||
package com.github.judgetread.GriefPreventionQuickShopBridge;
|
||||
|
||||
import com.github.judgetread.GriefPreventionQuickShopBridge.listeners.MainCommandExecutor;
|
||||
import com.github.judgetread.GriefPreventionQuickShopBridge.listeners.GriefPreventionListener;
|
||||
import com.github.judgetread.GriefPreventionQuickShopBridge.listeners.QuickShopListener;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.NonFinal;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -66,7 +68,7 @@ public class GriefPreventionQuickShopBridge extends JavaPlugin {
|
||||
/**
|
||||
* Reload this plugin.
|
||||
*/
|
||||
private void reload() {
|
||||
public void reload() {
|
||||
Bukkit.getConsoleSender().sendMessage(" Reloading " + getName());
|
||||
unregisterListeners();
|
||||
unloadHooks();
|
||||
@ -85,6 +87,7 @@ public class GriefPreventionQuickShopBridge extends JavaPlugin {
|
||||
this.getPluginLoader().disablePlugin(this);
|
||||
}
|
||||
registerListeners();
|
||||
registerCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,6 +107,16 @@ public class GriefPreventionQuickShopBridge extends JavaPlugin {
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Commands
|
||||
*/
|
||||
private void registerCommands(){
|
||||
Bukkit.getConsoleSender().sendMessage(" Registering Commands...");
|
||||
PluginCommand gpqsbCommand = getCommand("GriefPreventionQuickShopBridge");
|
||||
gpqsbCommand.setExecutor(new MainCommandExecutor(this));
|
||||
gpqsbCommand.setUsage(ChatColor.translateAlternateColorCodes('&', gpqsbCommand.getUsage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload config
|
||||
*/
|
||||
|
@ -0,0 +1,72 @@
|
||||
package com.github.judgetread.GriefPreventionQuickShopBridge.listeners;
|
||||
|
||||
import com.github.judgetread.GriefPreventionQuickShopBridge.GriefPreventionQuickShopBridge;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Judgetread
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class MainCommandExecutor implements org.bukkit.command.CommandExecutor {
|
||||
|
||||
/** Plugin instance */
|
||||
private GriefPreventionQuickShopBridge plugin;
|
||||
|
||||
/**
|
||||
* @param sender CommandSender
|
||||
* @param command Command
|
||||
* @param label String
|
||||
* @param args String[]
|
||||
* @return True if handled, false if not handled
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
|
||||
// Return if there is no sub command
|
||||
if (args.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (args[0].toUpperCase()) {
|
||||
|
||||
/**Help/Version Sub command */
|
||||
case "VERSION":
|
||||
case "HELP":
|
||||
if (!sender.hasPermission("GriefPreventionQuickShopBridge.help")) {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getCommand("GriefPreventionQuickShopBridge").getPermissionMessage()));
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[===== &aGriefPreventionQuickShopBridge &e=====]"));
|
||||
String authors = "";
|
||||
for (String str : plugin.getDescription().getAuthors()) {
|
||||
String tmp = "";
|
||||
if (!authors.isEmpty()) {
|
||||
tmp = ", ";
|
||||
}
|
||||
authors = authors + tmp + str;
|
||||
}
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[&f*] &aAuthors: &b" + authors));
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[&f*] &aVersion: &b" + plugin.getDescription().getVersion().toString()));
|
||||
return true;
|
||||
|
||||
/** Reload Sub-command */
|
||||
case "RELOAD":
|
||||
if (!sender.hasPermission("GriefPreventionQuickShopBridge.reload")) {
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getCommand("GriefPreventionQuickShopBridge").getPermissionMessage()));
|
||||
return true;
|
||||
}
|
||||
plugin.reload();
|
||||
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[&f*] &aGriefPreventionQuickShopBridge Reload Complete"));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,9 +1,24 @@
|
||||
name: ${name}
|
||||
main: ${package}.${name}
|
||||
version: ${project.version}
|
||||
authors: [Judgetread]
|
||||
authors: [Judgetread, Ajoobe]
|
||||
|
||||
description: QuickShop Reremake GriefPrevtion Bridge
|
||||
softdepend: [GriefPrevention, QuickShop]
|
||||
|
||||
api-version: 1.13
|
||||
api-version: 1.13
|
||||
|
||||
commands:
|
||||
GriefPreventionQuickShopBridge:
|
||||
description: GriefPreventionQuickShopBridge command
|
||||
usage: '&6/GriefPreventionQuickShopBridge <sub-command>'
|
||||
aliases: [gpqsb, gpb, qsb]
|
||||
permission-message: '&4You not have have permission to use this command.'
|
||||
default: op
|
||||
permissions:
|
||||
GriefPreventionQuickShopBridge.help:
|
||||
description: GriefPreventionQuickShopBridge Help
|
||||
default: op
|
||||
GriefPreventionQuickShopBridge.reload:
|
||||
description: GriefPreventionQuickShopBridge Reload
|
||||
default: op
|
Loading…
Reference in New Issue
Block a user