More components, broadcasts #98
10 changed files with 246 additions and 294 deletions
|
@ -39,5 +39,33 @@
|
||||||
<orderEntry type="library" name="Maven: org.anjocaido:EssentialsGroupManager:2.10.1" level="project" />
|
<orderEntry type="library" name="Maven: org.anjocaido:EssentialsGroupManager:2.10.1" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:ButtonCore:master-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: net.sourceforge.htmlcleaner:htmlcleaner:2.16" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jdom:jdom2:2.0.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.19.0-GA" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:8d3b6b6" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-68f14eca20-1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.16" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.webbukkit:Dynmap-Towny:master-0.60-g924051d-7" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.webbukkit:Dynmap:v2.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.nijikokun.bukkit:Permissions:3.1.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: ru.tehkode:PermissionsEx:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.bananaco:bPermissions:2.9.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.platymuus.bukkit.permissions:PermissionsBukkit:1.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.anjocaido:EssentialsGroupManager:2.10.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -1,6 +1,5 @@
|
||||||
package buttondevteam.chat;
|
package buttondevteam.chat;
|
||||||
|
|
||||||
import buttondevteam.chat.commands.YeehawCommand;
|
|
||||||
import buttondevteam.chat.components.announce.AnnouncerComponent;
|
import buttondevteam.chat.components.announce.AnnouncerComponent;
|
||||||
import buttondevteam.chat.components.appendext.AppendTextComponent;
|
import buttondevteam.chat.components.appendext.AppendTextComponent;
|
||||||
import buttondevteam.chat.components.flair.FlairComponent;
|
import buttondevteam.chat.components.flair.FlairComponent;
|
||||||
|
@ -49,7 +48,6 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15
|
||||||
|
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
|
||||||
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
|
||||||
MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler
|
MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
|
|
||||||
|
|
|
@ -1,84 +1,83 @@
|
||||||
package buttondevteam.chat.commands.ucmds;
|
package buttondevteam.chat.commands.ucmds;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import buttondevteam.chat.PluginMain;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import org.bukkit.command.CommandSender;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import org.bukkit.entity.Player;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import buttondevteam.chat.PluginMain;
|
import org.bukkit.entity.Player;
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import java.util.ArrayList;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
|
||||||
|
@CommandClass(modOnly = false)
|
||||||
@CommandClass(modOnly = false)
|
public final class HelpCommand extends UCommandBase {
|
||||||
public final class HelpCommand extends UCommandBase {
|
|
||||||
|
@Override
|
||||||
@Override
|
public String[] GetHelpText(String alias) {
|
||||||
public String[] GetHelpText(String alias) {
|
return new String[] { "§6---- Help ----", "Prints out help messages for the TBMC plugins" };
|
||||||
return new String[] { "§6---- Help ----", "Prints out help messages for the TBMC plugins" };
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
if (args.length == 0) {
|
||||||
if (args.length == 0) {
|
sender.sendMessage(new String[] { "§6---- TBMC Help ----", "Do /u help <topic> for more info",
|
||||||
sender.sendMessage(new String[] { "§6---- TBMC Help ----", "Do /u help <topic> for more info",
|
"Do /u help <commandname> [subcommands] for more info about a command", "Topics:",
|
||||||
"Do /u help <commandname> [subcommands] for more info about a command", "Topics:",
|
"commands: See all the commands from this plugin",
|
||||||
"commands: See all the commands from this plugin",
|
"chat: Shows some info about custom chat features", "colors: Shows Minecraft color codes" });
|
||||||
"chat: Shows some info about custom chat features", "colors: Shows Minecraft color codes" });
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
if (args[0].equalsIgnoreCase("chat"))
|
||||||
if (args[0].equalsIgnoreCase("chat"))
|
sender.sendMessage(new String[] { "§6---- Chat features ----",
|
||||||
sender.sendMessage(new String[] { "§6---- Chat features ----",
|
"- [g] Channel identifier: Click it to copy message", "-- [g]: Global chat (/g)",
|
||||||
"- [g] Channel identifier: Click it to copy message", "-- [g]: Global chat (/g)",
|
"-- [TC] Town chat (/tc)", "-- [NC] Nation chat (/nc)",
|
||||||
"-- [TC] Town chat (/tc)", "-- [NC] Nation chat (/nc)",
|
"- Playernames: Hover over them to get some player info",
|
||||||
"- Playernames: Hover over them to get some player info",
|
"-- Respect: This is the number of paid respects divided by eliglble deaths. This is a reference to CoD:AW's \"Press F to pay respects\"" });
|
||||||
"-- Respect: This is the number of paid respects divided by eliglble deaths. This is a reference to CoD:AW's \"Press F to pay respects\"" });
|
else if (args[0].equalsIgnoreCase("commands")) {
|
||||||
else if (args[0].equalsIgnoreCase("commands")) {
|
ArrayList<String> text = new ArrayList<String>();
|
||||||
ArrayList<String> text = new ArrayList<String>();
|
text.add("§6---- Command list ----");
|
||||||
text.add("§6---- Command list ----");
|
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values())
|
||||||
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values())
|
if (!cmd.getClass().getAnnotation(CommandClass.class).modOnly() || PluginMain.permission.has(sender, "tbmc.admin"))
|
||||||
if (!cmd.getClass().getAnnotation(CommandClass.class).modOnly() || PluginMain.permission.has(sender, "tbmc.admin"))
|
if (!cmd.isPlayerOnly() || sender instanceof Player)
|
||||||
if (!cmd.isPlayerOnly() || sender instanceof Player)
|
if (!cmd.GetCommandPath().contains(" "))
|
||||||
if (!cmd.GetCommandPath().contains(" "))
|
text.add("/" + cmd.GetCommandPath());
|
||||||
text.add("/" + cmd.GetCommandPath());
|
else {
|
||||||
else {
|
final String topcmd = cmd.GetCommandPath().substring(0, cmd.GetCommandPath().indexOf(' '));
|
||||||
final String topcmd = cmd.GetCommandPath().substring(0, cmd.GetCommandPath().indexOf(' '));
|
if (!text.contains("/" + topcmd))
|
||||||
if (!text.contains("/" + topcmd))
|
text.add("/" + topcmd);
|
||||||
text.add("/" + topcmd);
|
}
|
||||||
}
|
sender.sendMessage(text.toArray(new String[0]));
|
||||||
sender.sendMessage(text.toArray(new String[text.size()]));
|
} else if (args[0].equalsIgnoreCase("colors")) {
|
||||||
} else if (args[0].equalsIgnoreCase("colors")) {
|
sender.sendMessage(new String[] { "§6---- Chat colors/formats ----", //
|
||||||
sender.sendMessage(new String[] { "§6---- Chat colors/formats ----", //
|
"Tellraw name - Code | Tellraw name - Code", //
|
||||||
"Tellraw name - Code | Tellraw name - Code", //
|
"§0black - &0 | §1dark_blue - &1", //
|
||||||
"§0black - &0 | §1dark_blue - &1", //
|
"§2dark_green - &2 | §3dark_aqua - &3", //
|
||||||
"§2dark_green - &2 | §3dark_aqua - &3", //
|
"§4dark_red - &4 | §5dark_purple - &5", //
|
||||||
"§4dark_red - &4 | §5dark_purple - &5", //
|
"§6gold - &6 | §7gray - &7", //
|
||||||
"§6gold - &6 | §7gray - &7", //
|
"§8dark_gray - &8 | §9blue - &9", //
|
||||||
"§8dark_gray - &8 | §9blue - &9", //
|
"§agreen - &a | §baqua - &b", //
|
||||||
"§agreen - &a | §baqua - &b", //
|
"§cred - &c | §dlight_purple - &d", //
|
||||||
"§cred - &c | §dlight_purple - &d", //
|
"§eyellow - &e | §fwhite - &f", //
|
||||||
"§eyellow - &e | §fwhite - &f", //
|
"§rreset - &r | §kk§robfuscated - &k", //
|
||||||
"§rreset - &r | §kk§robfuscated - &k", //
|
"§lbold - &l | §mstrikethrough - &m", //
|
||||||
"§lbold - &l | §mstrikethrough - &m", //
|
"§nunderline - &n | §oitalic - &o", //
|
||||||
"§nunderline - &n | §oitalic - &o", //
|
"The format codes in tellraw should be used like \"italic\":\"true\"" }); //
|
||||||
"The format codes in tellraw should be used like \"italic\":\"true\"" }); //
|
} else {
|
||||||
} else {
|
String path = args[0];
|
||||||
String path = args[0];
|
for (int i = 1; i < args.length; i++)
|
||||||
for (int i = 1; i < args.length; i++)
|
path += " " + args[i];
|
||||||
path += " " + args[i];
|
TBMCCommandBase cmd = TBMCChatAPI.GetCommands().get(path);
|
||||||
TBMCCommandBase cmd = TBMCChatAPI.GetCommands().get(path);
|
if (cmd == null) {
|
||||||
if (cmd == null) {
|
String[] subcmds = TBMCChatAPI.GetSubCommands(path, sender);
|
||||||
String[] subcmds = TBMCChatAPI.GetSubCommands(path, sender);
|
if (subcmds.length > 0)
|
||||||
if (subcmds.length > 0)
|
sender.sendMessage(subcmds);
|
||||||
sender.sendMessage(subcmds);
|
else
|
||||||
else
|
sender.sendMessage(
|
||||||
sender.sendMessage(
|
new String[] { "§cError: Command not found or you don't have permission for it: " + path,
|
||||||
new String[] { "§cError: Command not found or you don't have permission for it: " + path,
|
"Usage example: /u accept --> /u help u accept" });
|
||||||
"Usage example: /u accept --> /u help u accept" });
|
} else
|
||||||
} else
|
sender.sendMessage(cmd.GetHelpText(args[0]));
|
||||||
sender.sendMessage(cmd.GetHelpText(args[0]));
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
package buttondevteam.chat.commands.ucmds;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
|
||||||
|
|
||||||
@CommandClass(modOnly = false)
|
|
||||||
public class OpmeCommand extends UCommandBase {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] GetHelpText(String alias) {
|
|
||||||
return new String[] { "§6---- OP me ----", "Totally makes you OP" };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
|
||||||
sender.sendMessage("It would be nice, wouldn't it?");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package buttondevteam.chat.commands.ucmds.admin;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
|
||||||
import buttondevteam.lib.player.TBMCPlayerBase;
|
|
||||||
|
|
||||||
public class PlayerInfoCommand extends AdminCommandBase {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] GetHelpText(String alias) {
|
|
||||||
return new String[] { "§6---- Player info ----",
|
|
||||||
"Shows some info about the player's flair, Reddit username(s) and other data known by the plugin",
|
|
||||||
"Usage: /u admin playerinfo <player>" };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
|
||||||
if (args.length == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ChatPlayer p = TBMCPlayerBase.getFromName(args[0], ChatPlayer.class);
|
|
||||||
if (p == null) {
|
|
||||||
sender.sendMessage("§cPlayer not found: " + args[0] + "§r");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("§6Usernames:");
|
|
||||||
for (String username : p.UserNames())
|
|
||||||
sb.append(" ").append(username);
|
|
||||||
sender.sendMessage(new String[] { //
|
|
||||||
"Player name: " + p.PlayerName(), //
|
|
||||||
"User flair: " + p.GetFormattedFlair(), //
|
|
||||||
"Username: " + p.UserName(), //
|
|
||||||
"Flair state: " + p.FlairState(), //
|
|
||||||
sb.toString(), //
|
|
||||||
"FCount: " + p.FCount(), //
|
|
||||||
"FDeaths: " + p.FDeaths() //
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package buttondevteam.chat.commands.ucmds.admin;
|
|
||||||
|
|
||||||
import buttondevteam.chat.PluginMain;
|
|
||||||
import buttondevteam.core.component.updater.PluginUpdater;
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
public class UpdatePlugin extends AdminCommandBase {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] GetHelpText(String alias) {
|
|
||||||
return new String[] { //
|
|
||||||
"§6---- Update plugin ----", //
|
|
||||||
"This command downloads the latest version of a TBMC plugin from GitHub", //
|
|
||||||
"To update a plugin: /" + alias + " <plugin>", //
|
|
||||||
"To list the plugin names: /" + alias //
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> {
|
|
||||||
if (args.length == 0) {
|
|
||||||
sender.sendMessage("Downloading plugin names...");
|
|
||||||
boolean first = true;
|
|
||||||
for (String plugin : PluginUpdater.GetPluginNames()) {
|
|
||||||
if (first) {
|
|
||||||
sender.sendMessage("§6---- Plugin names ----");
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
sender.sendMessage("- " + plugin);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
TBMCCoreAPI.UpdatePlugin(args[0], sender, args.length == 1 ? "master" : args[1]);
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,59 +1,53 @@
|
||||||
package buttondevteam.chat.commands.ucmds;
|
package buttondevteam.chat.components.fun;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import buttondevteam.chat.PluginMain;
|
||||||
|
import buttondevteam.lib.chat.*;
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
import buttondevteam.chat.PluginMain;
|
import org.bukkit.command.CommandSender;
|
||||||
import buttondevteam.lib.chat.*;
|
import org.bukkit.entity.Player;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
|
||||||
|
@CommandClass(path = "u c", helpText = {
|
||||||
@CommandClass(modOnly = false)
|
"Rainbow mode",
|
||||||
@OptionallyPlayerCommandClass(playerOnly = true)
|
"This command allows you to talk in rainbow colors"
|
||||||
public class CCommand extends UCommandBase {
|
})
|
||||||
|
@OptionallyPlayerCommandClass(playerOnly = true)
|
||||||
@Override
|
public class CCommand extends ICommand2MC {
|
||||||
public String[] GetHelpText(String alias) {
|
@Command2.Subcommand
|
||||||
return new String[] { "§6---- Rainbow mode ----", "This command allows you to talk in rainbow colors",
|
public boolean def(CommandSender sender, @Command2.OptionalArg String color) {
|
||||||
"You need to be a donator or a mod to use this command" };
|
Player player = (Player) sender;
|
||||||
}
|
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
|
||||||
|
if (color == null) {
|
||||||
@Override
|
if (PluginMain.permission.has(player, "thorpe.color.rainbow")) {
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||||
Player player = (Player) sender;
|
p.OtherColorMode = null;
|
||||||
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
|
if (p.RainbowPresserColorMode)
|
||||||
if (args.length < 1) {
|
player.sendMessage("§eRainbow colors §aenabled.");
|
||||||
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
else
|
||||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
player.sendMessage("§eRainbow colors §cdisabled.");
|
||||||
p.OtherColorMode = null;
|
} else {
|
||||||
if (p.RainbowPresserColorMode)
|
player.sendMessage("§cYou don't have permission for this command.");
|
||||||
player.sendMessage("§eRainbow colors §aenabled.");
|
return true;
|
||||||
else
|
}
|
||||||
player.sendMessage("§eRainbow colors §cdisabled.");
|
} else {
|
||||||
} else {
|
if (PluginMain.permission.has(player, "thorpe.color.custom")) {
|
||||||
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
|
p.RainbowPresserColorMode = false;
|
||||||
return true;
|
p.OtherColorMode = null;
|
||||||
}
|
try {
|
||||||
} else {
|
p.OtherColorMode = Color.valueOf(color.toLowerCase());
|
||||||
if (PluginMain.permission.has(player, "tbmc.admin")) {
|
} catch (Exception e) {
|
||||||
p.RainbowPresserColorMode = false;
|
player.sendMessage("§cUnknown message color: " + color);
|
||||||
p.OtherColorMode = null;
|
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
||||||
try {
|
}
|
||||||
p.OtherColorMode = Color.valueOf(args[0].toLowerCase());
|
if (p.OtherColorMode != null)
|
||||||
} catch (Exception e) {
|
player.sendMessage(String.format("§eMessage color set to %s", p.OtherColorMode));
|
||||||
player.sendMessage("§cUnknown message color: " + args[0]);
|
else
|
||||||
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
player.sendMessage("§eMessage color reset.");
|
||||||
}
|
} else {
|
||||||
if (p.OtherColorMode != null)
|
player.sendMessage("§cYou don't have permission for this command.");
|
||||||
player.sendMessage(String.format("§eMessage color set to %s", p.OtherColorMode));
|
return true;
|
||||||
else
|
}
|
||||||
player.sendMessage("§eMessage color reset.");
|
}
|
||||||
} else {
|
return true;
|
||||||
player.sendMessage("§cYou don't have permission for this command.");
|
}
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,6 +8,7 @@ import buttondevteam.lib.TBMCCommandPreprocessEvent;
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
import buttondevteam.lib.ThorpeUtils;
|
import buttondevteam.lib.ThorpeUtils;
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
|
import buttondevteam.lib.architecture.ConfigData;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase;
|
import buttondevteam.lib.player.ChromaGamerBase;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
|
@ -29,7 +30,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class FunComponent extends Component<PluginMain> implements Listener {
|
public class FunComponent extends Component<PluginMain> implements Listener {
|
||||||
private final static String[] LaughStrings = new String[]{"xd", "lel", "lawl", "kek", "lmao", "hue", "hah", "rofl"};
|
|
||||||
private boolean ActiveF = false;
|
private boolean ActiveF = false;
|
||||||
private ChatPlayer FPlayer = null;
|
private ChatPlayer FPlayer = null;
|
||||||
private BukkitTask Ftask = null;
|
private BukkitTask Ftask = null;
|
||||||
|
@ -37,6 +37,19 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
||||||
private UnlolCommand command;
|
private UnlolCommand command;
|
||||||
private TBMCSystemChatEvent.BroadcastTarget unlolTarget;
|
private TBMCSystemChatEvent.BroadcastTarget unlolTarget;
|
||||||
private TBMCSystemChatEvent.BroadcastTarget fTarget;
|
private TBMCSystemChatEvent.BroadcastTarget fTarget;
|
||||||
|
|
||||||
|
private ConfigData<String[]> laughStrings() {
|
||||||
|
return getConfig().getData("laughStrings", () -> new String[]{"xd", "lel", "lawl", "kek", "lmao", "hue", "hah", "rofl"});
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConfigData<Boolean> respect() {
|
||||||
|
return getConfig().getData("respect", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConfigData<Boolean> unlol() {
|
||||||
|
return getConfig().getData("unlol", true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
unlolTarget = TBMCSystemChatEvent.BroadcastTarget.add("unlol");
|
unlolTarget = TBMCSystemChatEvent.BroadcastTarget.add("unlol");
|
||||||
|
@ -47,6 +60,9 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
||||||
registerCommand(command=new UnlolCommand(unlolTarget));
|
registerCommand(command=new UnlolCommand(unlolTarget));
|
||||||
registerListener(this);
|
registerListener(this);
|
||||||
registerCommand(new FTopCommand());
|
registerCommand(new FTopCommand());
|
||||||
|
registerCommand(new OpmeCommand());
|
||||||
|
registerCommand(new YeehawCommand());
|
||||||
|
registerCommand(new CCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,27 +74,30 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
||||||
if (ActiveF && !Fs.contains(sender) && message.equalsIgnoreCase("F"))
|
if (ActiveF && !Fs.contains(sender) && message.equalsIgnoreCase("F"))
|
||||||
Fs.add(sender);
|
Fs.add(sender);
|
||||||
|
|
||||||
String msg = message.toLowerCase();
|
if (unlol().get()) {
|
||||||
val lld = new UnlolCommand.LastlolData(sender, event, System.nanoTime());
|
String msg = message.toLowerCase();
|
||||||
boolean add;
|
val lld = new UnlolCommand.LastlolData(sender, event, System.nanoTime());
|
||||||
if (add = msg.contains("lol"))
|
boolean add;
|
||||||
lld.setLolornot(true);
|
if (add = msg.contains("lol"))
|
||||||
else {
|
lld.setLolornot(true);
|
||||||
for (int i = 0; i < LaughStrings.length; i++) {
|
else {
|
||||||
if (add = msg.contains(LaughStrings[i])) {
|
String[] laughs = laughStrings().get();
|
||||||
lld.setLolornot(false);
|
for (String laugh : laughs) {
|
||||||
break;
|
if (add = msg.contains(laugh)) {
|
||||||
|
lld.setLolornot(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (add)
|
||||||
|
command.Lastlol.put(event.getChannel(), lld);
|
||||||
}
|
}
|
||||||
if (add)
|
|
||||||
command.Lastlol.put(event.getChannel(), lld);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDeath(PlayerDeathEvent e) {
|
public void onPlayerDeath(PlayerDeathEvent e) {
|
||||||
// MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e.getEntity());
|
// MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(e.getEntity());
|
||||||
if (/* (mgp != null && !mgp.isInMinigame()) && */ new Random().nextBoolean()) { // Don't store Fs for NPCs
|
if (e.getDeathMessage().length() > 0 && respect().get() && new Random().nextBoolean()) { // Don't store Fs for NPCs
|
||||||
Runnable tt = () -> {
|
Runnable tt = () -> {
|
||||||
if (ActiveF) {
|
if (ActiveF) {
|
||||||
ActiveF = false;
|
ActiveF = false;
|
||||||
|
@ -105,12 +124,14 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLeave(PlayerQuitEvent event) {
|
public void onPlayerLeave(PlayerQuitEvent event) {
|
||||||
command.Lastlol.values().removeIf(lld -> lld.getLolowner().equals(event.getPlayer()));
|
if (unlol().get())
|
||||||
|
command.Lastlol.values().removeIf(lld -> lld.getLolowner().equals(event.getPlayer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onCommandPreprocess(TBMCCommandPreprocessEvent event) {
|
public void onCommandPreprocess(TBMCCommandPreprocessEvent event) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
if (!unlol().get()) return;
|
||||||
final String cmd = event.getMessage();
|
final String cmd = event.getMessage();
|
||||||
// We don't care if we have arguments
|
// We don't care if we have arguments
|
||||||
if (cmd.toLowerCase().startsWith("/un")) {
|
if (cmd.toLowerCase().startsWith("/un")) {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package buttondevteam.chat.components.fun;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.Command2;
|
||||||
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import buttondevteam.lib.chat.ICommand2MC;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@CommandClass(modOnly = false, path = "u opme", helpText = {
|
||||||
|
"OP me",
|
||||||
|
"Totally makes you OP"
|
||||||
|
})
|
||||||
|
public class OpmeCommand extends ICommand2MC {
|
||||||
|
@Command2.Subcommand
|
||||||
|
public boolean def(CommandSender sender) {
|
||||||
|
sender.sendMessage("It would be nice, wouldn't it?");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,30 +1,28 @@
|
||||||
package buttondevteam.chat.commands;
|
package buttondevteam.chat.components.fun;
|
||||||
|
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
import buttondevteam.lib.chat.Command2;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.player.TBMCYEEHAWEvent;
|
import buttondevteam.lib.chat.ICommand2MC;
|
||||||
import org.bukkit.Bukkit;
|
import buttondevteam.lib.player.TBMCYEEHAWEvent;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
@CommandClass(modOnly = false)
|
|
||||||
public class YeehawCommand extends TBMCCommandBase {
|
@CommandClass(modOnly = false, helpText = {
|
||||||
|
"YEEHAW command",
|
||||||
@Override
|
"This command makes you YEEHAW."
|
||||||
public String[] GetHelpText(String alias) {
|
})
|
||||||
return new String[] { "§6---- YEEHAW command ----", "This command makes you YEEHAW." };
|
public class YeehawCommand extends ICommand2MC {
|
||||||
}
|
@Command2.Subcommand
|
||||||
|
public boolean def(CommandSender sender) {
|
||||||
@Override
|
final String message = "§b* "
|
||||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
+ (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs.";
|
||||||
final String message = "§b* "
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
+ (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs.";
|
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
p.sendMessage(message); //Not broadcasting, so the Discord plugin can handle the event in a special way
|
||||||
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
} // Even a cmdblock could yeehaw in theory
|
||||||
p.sendMessage(message); //Not broadcasting, so the Discord plugin can handle the event in a special way
|
// Or anyone from Discord
|
||||||
} // Even a cmdblock could yeehaw in theory
|
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
|
||||||
// Or anyone from Discord
|
return true;
|
||||||
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
|
}
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue