0.2.0_DEV
- It is now possible to set whether the key message should be blocked or sent to other players. - It can now be set whether the response should be sent to the player or to all players. This is also possible across bungees (no MiniMessage format support). - MiniMessage format is supported. Not if it should be sent to all bungee players! - TZ2Code minimum requirement 12.5
This commit is contained in:
parent
d527152ebc
commit
3051d68de4
19
pom.xml
19
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>AutoResponse</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<version>0.2.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2C-AutoResponse</name>
|
||||
@ -54,14 +54,6 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
@ -74,15 +66,14 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>net.t2code.minecraft.1_8.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8r1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>12.0</version>
|
||||
<version>12.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
|
@ -11,9 +11,9 @@ import java.util.logging.Level;
|
||||
public final class BMain extends Plugin {
|
||||
|
||||
|
||||
public static Plugin plugin;
|
||||
public static String version;
|
||||
public static String autor;
|
||||
private static Plugin plugin;
|
||||
private static String version;
|
||||
private static String autor;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -5,6 +5,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
@ -16,18 +17,28 @@ public class BListener implements Listener {
|
||||
public void onPluginmessage(PluginMessageEvent event) {
|
||||
if (event.getTag().equalsIgnoreCase("t2car:bungee")) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||
event.setCancelled(true);
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
if (channel.equals("T2Code-Console")) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: " + input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
} else {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player + ": " + input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
|
||||
switch (channel) {
|
||||
case "ConC":
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: " + input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
break;
|
||||
case "ALLPMSG":
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
Bsend.player(player, input);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player + ": " + input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
@ -19,10 +18,10 @@ public final class Main extends JavaPlugin {
|
||||
return plugin.getDataFolder();
|
||||
}
|
||||
|
||||
public static String version;
|
||||
public static List<String> autor;
|
||||
private static String version;
|
||||
private static List<String> autor;
|
||||
|
||||
public static Main plugin;
|
||||
private static Main plugin;
|
||||
|
||||
public static ArrayList<ResponsesObject> allResponses = new ArrayList<>();
|
||||
public static ArrayList<String> allResponse = new ArrayList<>();
|
||||
@ -46,21 +45,48 @@ public final class Main extends JavaPlugin {
|
||||
T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
||||
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
} else {
|
||||
if (Double.parseDouble(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion()) < ver) {
|
||||
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
||||
if (ver.contains("_")) {
|
||||
if (!plVer.equals(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
||||
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
String[] split = plVer.split("_");
|
||||
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
||||
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static List<String> getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
public static Main getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class Commands {
|
||||
public static void info(CommandSender sender) {
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(),Util.getSpigot(),Util.getDiscord(), Main.autor,Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||
T2CodeTemplate.sendInfo(sender, Util.getPrefix(),Util.getSpigot(),Util.getDiscord(), Main.getAutor(),Main.getVersion(), UpdateAPI.PluginVersionen.get(Main.getPlugin().getName()).publicVersion);
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
|
@ -11,7 +11,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class CreateMessages {
|
||||
private static Plugin plugin = Main.plugin;
|
||||
private static Plugin plugin = Main.getPlugin();
|
||||
|
||||
public static void langCreate() {
|
||||
send.debug(plugin,"§4Language files are created / updated...");
|
||||
|
@ -14,12 +14,12 @@ package net.t2code.autoresponse.Spigot.config.languages;
|
||||
public class MSG {
|
||||
|
||||
// EN
|
||||
public static String EN_ReloadStart = "[prefix] &6Plugin is reloaded...";
|
||||
public static String EN_ReloadEnd = "[prefix] &2Plugin was successfully reloaded.";
|
||||
public static String EN_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!";
|
||||
protected static String EN_ReloadStart = "[prefix] &6Plugin is reloaded...";
|
||||
protected static String EN_ReloadEnd = "[prefix] &2Plugin was successfully reloaded.";
|
||||
protected static String EN_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!";
|
||||
|
||||
// DE
|
||||
public static String DE_ReloadStart = "[prefix] &6Plugin wird neu geladen...";
|
||||
public static String DE_ReloadEnd = "[prefix] &2Plugin wurde erfolgreich neu geladen.";
|
||||
public static String DE_NoPermissionForCommand = "[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!";
|
||||
protected static String DE_ReloadStart = "[prefix] &6Plugin wird neu geladen...";
|
||||
protected static String DE_ReloadEnd = "[prefix] &2Plugin wurde erfolgreich neu geladen.";
|
||||
protected static String DE_NoPermissionForCommand = "[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!";
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ public class SelectMessages {
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
|
||||
send.debug(Main.plugin, "§4Select language...");
|
||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
||||
send.debug(Main.getPlugin(), "§4Select language...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File msg;
|
||||
|
||||
@ -46,6 +46,6 @@ public class SelectMessages {
|
||||
ReloadEnd = Config.select(prefix, "Plugin.Reload.End", yamlConfiguration);
|
||||
NoPermissionForCommand = Config.select(prefix, "Plugin.ForCommand", yamlConfiguration);
|
||||
|
||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class CreateExampleResponse {
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else send.console(Util.getPrefix() + " §4config.yml are created...");
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ public class CreateExampleResponse {
|
||||
Config.set("Response.Enable", true, yamlConfiguration);
|
||||
Config.set("Response.ResponseKeys", Collections.singletonList(".example"), yamlConfiguration);
|
||||
Config.set("Response.Contains", false, yamlConfiguration);
|
||||
Config.set("Response.BlockKeyMessage", true, yamlConfiguration);
|
||||
Config.set("Response.Permission.Necessary", true, yamlConfiguration);
|
||||
Config.set("Response.Permission.Permission", "t2c-autoresponse.response.example", yamlConfiguration);
|
||||
|
||||
@ -35,12 +36,9 @@ public class CreateExampleResponse {
|
||||
Config.set("Response.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
|
||||
|
||||
Config.set("Response.Message.Enable", true, yamlConfiguration);
|
||||
Config.set("Response.Message.Messages", Arrays.asList("&2This is an Automated response from §8[§4T2Code§7-§bAutoResponse§8]&2.", "&6Contact us for questions / support on our Discord."), yamlConfiguration);
|
||||
Config.set("Response.Message.TextBuilder.Enable", true, yamlConfiguration);
|
||||
Config.set("Response.Message.TextBuilder.Hover", "&5Discord: &edc.t2code.net", yamlConfiguration);
|
||||
Config.set("Response.Message.TextBuilder.ClickEvent.Enable", true, yamlConfiguration);
|
||||
Config.set("Response.Message.TextBuilder.ClickEvent.Action", "OPEN_URL", yamlConfiguration);
|
||||
Config.set("Response.Message.TextBuilder.ClickEvent.ActionValue", "http://dc.t2code.net", yamlConfiguration);
|
||||
Config.set("Response.Message.Global.Enable", false, yamlConfiguration);
|
||||
Config.set("Response.Message.Global.Bungee", false, yamlConfiguration);
|
||||
Config.set("Response.Message.Messages", Arrays.asList("[prefix] <dark_green>This is an Automated response from <dark_gray>[<dark_red>T2Code</dark_red><gray>-</gray><aqua>AutoResponse</aqua>]</dark_gray>.</dark_green>", "[prefix] <gold>Contact us for questions / support on our <dark_purple><hover:show_text:'<dark_purple>Discord:</dark_purple> <yellow>dc.t2code.net</yellow>'><click:open_url:'http://dc.t2code.net'>Discord</click></hover></dark_purple>.</gold>"), yamlConfiguration);
|
||||
|
||||
Config.set("Response.Protection.GameMode.Enable", false, yamlConfiguration);
|
||||
Config.set("Response.Protection.GameMode.Mode", "blacklist", yamlConfiguration);
|
||||
|
@ -22,6 +22,7 @@ public class SelectResponses {
|
||||
yamlConfiguration.getBoolean("Response.Enable"),
|
||||
yamlConfiguration.getStringList("Response.ResponseKeys"),
|
||||
yamlConfiguration.getBoolean("Response.Contains"),
|
||||
yamlConfiguration.getBoolean("Response.BlockKeyMessage"),
|
||||
yamlConfiguration.getBoolean("Response.Permission.Necessary"),
|
||||
yamlConfiguration.getString("Response.Permission.Permission"),
|
||||
|
||||
@ -31,12 +32,9 @@ public class SelectResponses {
|
||||
yamlConfiguration.getStringList("Response.Command.Commands"),
|
||||
|
||||
yamlConfiguration.getBoolean("Response.Message.Enable"),
|
||||
yamlConfiguration.getBoolean("Response.Message.Global.Enable"),
|
||||
yamlConfiguration.getBoolean("Response.Message.Global.Bungee"),
|
||||
yamlConfiguration.getStringList("Response.Message.Messages"),
|
||||
yamlConfiguration.getBoolean("Response.Message.TextBuilder.Enable"),
|
||||
yamlConfiguration.getString("Response.Message.TextBuilder.Hover"),
|
||||
yamlConfiguration.getBoolean("Response.Message.TextBuilder.ClickEvent.Enable"),
|
||||
yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.Action"),
|
||||
yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.ActionValue"),
|
||||
|
||||
yamlConfiguration.getBoolean("Response.Protection.GameMode.Enable"),
|
||||
yamlConfiguration.getString("Response.Protection.GameMode.Mode"),
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.t2code.autoresponse.Spigot.event;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.t2code.autoresponse.Spigot.system.BungeeSend;
|
||||
import net.t2code.autoresponse.Util;
|
||||
import net.t2code.autoresponse.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.autoresponse.Spigot.objects.ResponsesObject;
|
||||
@ -12,6 +13,7 @@ import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -31,14 +33,14 @@ public class ResponseListener implements Listener {
|
||||
for (ResponsesObject response : Main.allResponses) {
|
||||
if (!response.permNecessary || player.hasPermission(response.permission)) {
|
||||
if (response.contains) {
|
||||
for (String responseKey : response.responseKeys){
|
||||
for (String responseKey : response.responseKeys) {
|
||||
if (e.getMessage().contains(responseKey)) {
|
||||
execute(e, player, response, responseKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (String responseKey : response.responseKeys){
|
||||
for (String responseKey : response.responseKeys) {
|
||||
if (e.getMessage().equals(responseKey)) {
|
||||
execute(e, player, response, responseKey);
|
||||
return;
|
||||
@ -67,13 +69,15 @@ public class ResponseListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
use(e, player, responseKey);
|
||||
use(e, player, responseKey, response);
|
||||
|
||||
if (response.commandEnable) {
|
||||
for (String cmd : response.command) {
|
||||
if (response.bungeeCommand) {
|
||||
if (SelectConfig.bungee) {
|
||||
BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), response.commandAsConsole);
|
||||
if (response.commandAsConsole) {
|
||||
BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), BungeeSend.BUNGEECOMMAND);
|
||||
} else BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), BungeeSend.COMMAND);
|
||||
} else {
|
||||
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
send.sender(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
@ -85,7 +89,7 @@ public class ResponseListener implements Listener {
|
||||
public void run() {
|
||||
Cmd.console(cmd.replace("[player]", player.getName()));
|
||||
}
|
||||
}.runTaskLater(Main.plugin, 1L);
|
||||
}.runTaskLater(Main.getPlugin(), 1L);
|
||||
|
||||
} else {
|
||||
Cmd.player(player, cmd.replace("[player]", player.getName()));
|
||||
@ -96,30 +100,26 @@ public class ResponseListener implements Listener {
|
||||
if (response.messageEnable) {
|
||||
for (String msg : response.messages) {
|
||||
String text;
|
||||
String hover;
|
||||
if (PluginCheck.papi()) {
|
||||
text = Replace.replace(Util.getPrefix(), player, msg);
|
||||
hover = Replace.replace(Util.getPrefix(), player, response.hover);
|
||||
} else {
|
||||
text = Replace.replace(Util.getPrefix(), msg);
|
||||
hover = Replace.replace(Util.getPrefix(), response.hover);
|
||||
}
|
||||
if (response.textBuilder) {
|
||||
TextBuilder textBuilder = new TextBuilder(text);
|
||||
textBuilder.addHover(hover);
|
||||
if (response.clickEvent) {
|
||||
textBuilder.addClickEvent(ClickEvent.Action.valueOf(response.action), response.actionValue);
|
||||
if (response.messageGlobal) {
|
||||
if (response.messageGlobalBungee) {
|
||||
BCommand_Sender_Reciver.sendToBungee(player, text, BungeeSend.ALLPLAYERMSG);
|
||||
} else {
|
||||
for (Player player1 : Bukkit.getOnlinePlayers()) {
|
||||
send.player(player1, text);
|
||||
}
|
||||
}
|
||||
player.spigot().sendMessage(textBuilder.build());
|
||||
} else {
|
||||
send.player(player, text);
|
||||
}
|
||||
} else send.player(player, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void use(AsyncPlayerChatEvent e, Player player, String responseKey) {
|
||||
e.setCancelled(true);
|
||||
if (SelectConfig.logConsole) send.console(Util.getPrefix() + " §6Player: §e" + player.getName() + " §6use AutoResponse: §e" +responseKey);
|
||||
private static void use(AsyncPlayerChatEvent e, Player player, String responseKey, ResponsesObject response) {
|
||||
if (response.blockKeyMessage) e.setCancelled(true);
|
||||
if (SelectConfig.logConsole) send.console(Util.getPrefix() + " §6Player: §e" + player.getName() + " §6use AutoResponse: §e" + responseKey);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ public class ResponsesObject {
|
||||
public Boolean enable;
|
||||
public List<String> responseKeys;
|
||||
public Boolean contains;
|
||||
public Boolean blockKeyMessage;
|
||||
public Boolean commandEnable;
|
||||
public Boolean permNecessary;
|
||||
public String permission;
|
||||
@ -14,12 +15,9 @@ public class ResponsesObject {
|
||||
public Boolean bungeeCommand;
|
||||
public List<String> command;
|
||||
public Boolean messageEnable;
|
||||
public Boolean messageGlobal;
|
||||
public Boolean messageGlobalBungee;
|
||||
public List<String> messages;
|
||||
public Boolean textBuilder;
|
||||
public String hover;
|
||||
public Boolean clickEvent;
|
||||
public String action;
|
||||
public String actionValue;
|
||||
|
||||
public Boolean protectionGameModeEnable;
|
||||
public String protectionGameModeMode;
|
||||
@ -32,6 +30,7 @@ public class ResponsesObject {
|
||||
public ResponsesObject(Boolean enable,
|
||||
List<String> responseKeys,
|
||||
Boolean contains,
|
||||
Boolean blockKeyMessage,
|
||||
Boolean permNecessary,
|
||||
String permission,
|
||||
Boolean commandEnable,
|
||||
@ -39,12 +38,9 @@ public class ResponsesObject {
|
||||
Boolean bungeeCommand,
|
||||
List<String> command,
|
||||
Boolean messageEnable,
|
||||
Boolean messageGlobal,
|
||||
Boolean messageGlobalBungee,
|
||||
List<String> messages,
|
||||
Boolean textBuilder,
|
||||
String hover,
|
||||
Boolean clickEvent,
|
||||
String action,
|
||||
String actionValue,
|
||||
Boolean protectionGameModeEnable,
|
||||
String protectionGameModeMode,
|
||||
List<String> protectionGameModeList,
|
||||
@ -54,6 +50,7 @@ public class ResponsesObject {
|
||||
this.enable = enable;
|
||||
this.responseKeys = responseKeys;
|
||||
this.contains=contains;
|
||||
this.blockKeyMessage=blockKeyMessage;
|
||||
this.permNecessary = permNecessary;
|
||||
this.permission = permission;
|
||||
this.commandEnable = commandEnable;
|
||||
@ -61,12 +58,9 @@ public class ResponsesObject {
|
||||
this.bungeeCommand = bungeeCommand;
|
||||
this.command = command;
|
||||
this.messageEnable = messageEnable;
|
||||
this.messageGlobal = messageGlobal;
|
||||
this.messageGlobalBungee = messageGlobalBungee;
|
||||
this.messages = messages;
|
||||
this.textBuilder = textBuilder;
|
||||
this.hover = hover;
|
||||
this.clickEvent = clickEvent;
|
||||
this.action = action;
|
||||
this.actionValue = actionValue;
|
||||
|
||||
this.protectionGameModeEnable = protectionGameModeEnable;
|
||||
this.protectionGameModeMode = protectionGameModeMode;
|
||||
|
@ -11,29 +11,37 @@ import java.io.IOException;
|
||||
|
||||
public class BCommand_Sender_Reciver {
|
||||
|
||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||
public static void sendToBungee(CommandSender sender, String information, BungeeSend type) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(stream);
|
||||
|
||||
try {
|
||||
if (console) {
|
||||
output.writeUTF("T2Code-Console");
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
output.writeUTF(sender.getName());
|
||||
} else {
|
||||
output.writeUTF("T2Code-Console");
|
||||
}
|
||||
switch (type) {
|
||||
case BUNGEECOMMAND:
|
||||
output.writeUTF("ConC");
|
||||
break;
|
||||
case COMMAND:
|
||||
if (sender instanceof Player) {
|
||||
output.writeUTF(sender.getName());
|
||||
} else {
|
||||
output.writeUTF("ConC");
|
||||
}
|
||||
break;
|
||||
case ALLPLAYERMSG:
|
||||
output.writeUTF("ALLPMSG");
|
||||
break;
|
||||
}
|
||||
output.writeUTF(information);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(Main.plugin, "t2car:bungee", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(Main.plugin, "t2car:bungee", stream.toByteArray());
|
||||
player.sendPluginMessage(Main.getPlugin(), "t2car:bungee", stream.toByteArray());
|
||||
} else {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(Main.getPlugin(), "t2car:bungee", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package net.t2code.autoresponse.Spigot.system;
|
||||
|
||||
public enum BungeeSend {
|
||||
BUNGEECOMMAND,
|
||||
COMMAND,
|
||||
ALLPLAYERMSG
|
||||
}
|
@ -14,10 +14,10 @@ public class JoinEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
if (Main.version.toUpperCase().contains("DEV")) {
|
||||
if (Main.getVersion().toUpperCase().contains("DEV")) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
UpdateAPI.join(Main.plugin, Util.getPrefix(),Permissions.updatemsg,player,Util.getSpigot(), Util.getDiscord());
|
||||
UpdateAPI.join(Main.getPlugin(), Util.getPrefix(),Permissions.updatemsg,player,Util.getSpigot(), Util.getDiscord());
|
||||
}
|
||||
}
|
@ -18,10 +18,10 @@ import org.bukkit.plugin.Plugin;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
static Plugin plugin = Main.plugin;
|
||||
static Main plugin = Main.getPlugin();
|
||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
Main.plugin.getCommand("t2code-autoresponse").setExecutor( new CmdExecuter());
|
||||
plugin.getCommand("t2code-autoresponse").setExecutor( new CmdExecuter());
|
||||
|
||||
loadReload();
|
||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
||||
@ -31,8 +31,8 @@ public class Load {
|
||||
T2CodeTemplate.onLoadFooter(prefix, long_,version);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
if (SelectConfig.bungee) {
|
||||
Main.plugin.getServer().getMessenger().registerOutgoingPluginChannel(Main.plugin, "BungeeCord");
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "t2car:bungee");
|
||||
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2car:bungee");
|
||||
}
|
||||
Permissions.register();
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ public class Permissions {
|
||||
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||
|
||||
protected static void register() {
|
||||
Register.permission(info, op, Main.plugin);
|
||||
Register.permission(updatemsg, op, Main.plugin);
|
||||
Register.permission(admin, op, info, true, Main.plugin);
|
||||
Register.permission(admin, op, updatemsg, true, Main.plugin);
|
||||
Register.permission(info, op, Main.getPlugin());
|
||||
Register.permission(updatemsg, op, Main.getPlugin());
|
||||
Register.permission(admin, op, info, true, Main.getPlugin());
|
||||
Register.permission(admin, op, updatemsg, true, Main.getPlugin());
|
||||
for (ResponsesObject response : Main.allResponses) {
|
||||
Register.permission(response.permission, op,Main.plugin);
|
||||
Register.permission(response.permission, op, Main.getPlugin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.t2code.autoresponse;
|
||||
|
||||
public class Util {
|
||||
private static double requiredT2CodeLibVersion = 12.0;
|
||||
private static String requiredT2CodeLibVersion = "12.5";
|
||||
private static String Prefix = "§8[§4T2Code§7-§bAutoResponse§8]";
|
||||
private static Integer SpigotID = 100603;
|
||||
private static Integer BstatsID = 14091;
|
||||
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
|
||||
private static String Discord = "http://dc.t2code.net";
|
||||
|
||||
public static double getRequiredT2CodeLibVersion() {
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return requiredT2CodeLibVersion;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user