Converted, moved and deleted some commands
Converted & noved: /u opme /yeehaw /u c Deleted: /u admin playerinfo /u admin updateplugin Also made the FunComponent more configurable Also removed old command registration, so some commands will stop working #85
This commit is contained in:
parent
e510667215
commit
5b5252382e
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" 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" 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>
|
||||
</module>
|
|
@ -1,6 +1,5 @@
|
|||
package buttondevteam.chat;
|
||||
|
||||
import buttondevteam.chat.commands.YeehawCommand;
|
||||
import buttondevteam.chat.components.announce.AnnouncerComponent;
|
||||
import buttondevteam.chat.components.appendext.AppendTextComponent;
|
||||
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 PlayerJoinLeaveListener(), this);
|
||||
TBMCChatAPI.AddCommands(this, YeehawCommand.class);
|
||||
MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler
|
||||
Console = this.getServer().getConsoleSender();
|
||||
|
||||
|
|
|
@ -1,84 +1,83 @@
|
|||
package buttondevteam.chat.commands.ucmds;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.chat.PluginMain;
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||
|
||||
@CommandClass(modOnly = false)
|
||||
public final class HelpCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Help ----", "Prints out help messages for the TBMC plugins" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
if (args.length == 0) {
|
||||
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:",
|
||||
"commands: See all the commands from this plugin",
|
||||
"chat: Shows some info about custom chat features", "colors: Shows Minecraft color codes" });
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("chat"))
|
||||
sender.sendMessage(new String[] { "§6---- Chat features ----",
|
||||
"- [g] Channel identifier: Click it to copy message", "-- [g]: Global chat (/g)",
|
||||
"-- [TC] Town chat (/tc)", "-- [NC] Nation chat (/nc)",
|
||||
"- 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\"" });
|
||||
else if (args[0].equalsIgnoreCase("commands")) {
|
||||
ArrayList<String> text = new ArrayList<String>();
|
||||
text.add("§6---- Command list ----");
|
||||
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values())
|
||||
if (!cmd.getClass().getAnnotation(CommandClass.class).modOnly() || PluginMain.permission.has(sender, "tbmc.admin"))
|
||||
if (!cmd.isPlayerOnly() || sender instanceof Player)
|
||||
if (!cmd.GetCommandPath().contains(" "))
|
||||
text.add("/" + cmd.GetCommandPath());
|
||||
else {
|
||||
final String topcmd = cmd.GetCommandPath().substring(0, cmd.GetCommandPath().indexOf(' '));
|
||||
if (!text.contains("/" + topcmd))
|
||||
text.add("/" + topcmd);
|
||||
}
|
||||
sender.sendMessage(text.toArray(new String[text.size()]));
|
||||
} else if (args[0].equalsIgnoreCase("colors")) {
|
||||
sender.sendMessage(new String[] { "§6---- Chat colors/formats ----", //
|
||||
"Tellraw name - Code | Tellraw name - Code", //
|
||||
"§0black - &0 | §1dark_blue - &1", //
|
||||
"§2dark_green - &2 | §3dark_aqua - &3", //
|
||||
"§4dark_red - &4 | §5dark_purple - &5", //
|
||||
"§6gold - &6 | §7gray - &7", //
|
||||
"§8dark_gray - &8 | §9blue - &9", //
|
||||
"§agreen - &a | §baqua - &b", //
|
||||
"§cred - &c | §dlight_purple - &d", //
|
||||
"§eyellow - &e | §fwhite - &f", //
|
||||
"§rreset - &r | §kk§robfuscated - &k", //
|
||||
"§lbold - &l | §mstrikethrough - &m", //
|
||||
"§nunderline - &n | §oitalic - &o", //
|
||||
"The format codes in tellraw should be used like \"italic\":\"true\"" }); //
|
||||
} else {
|
||||
String path = args[0];
|
||||
for (int i = 1; i < args.length; i++)
|
||||
path += " " + args[i];
|
||||
TBMCCommandBase cmd = TBMCChatAPI.GetCommands().get(path);
|
||||
if (cmd == null) {
|
||||
String[] subcmds = TBMCChatAPI.GetSubCommands(path, sender);
|
||||
if (subcmds.length > 0)
|
||||
sender.sendMessage(subcmds);
|
||||
else
|
||||
sender.sendMessage(
|
||||
new String[] { "§cError: Command not found or you don't have permission for it: " + path,
|
||||
"Usage example: /u accept --> /u help u accept" });
|
||||
} else
|
||||
sender.sendMessage(cmd.GetHelpText(args[0]));
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
package buttondevteam.chat.commands.ucmds;
|
||||
|
||||
import buttondevteam.chat.PluginMain;
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@CommandClass(modOnly = false)
|
||||
public final class HelpCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Help ----", "Prints out help messages for the TBMC plugins" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
if (args.length == 0) {
|
||||
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:",
|
||||
"commands: See all the commands from this plugin",
|
||||
"chat: Shows some info about custom chat features", "colors: Shows Minecraft color codes" });
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("chat"))
|
||||
sender.sendMessage(new String[] { "§6---- Chat features ----",
|
||||
"- [g] Channel identifier: Click it to copy message", "-- [g]: Global chat (/g)",
|
||||
"-- [TC] Town chat (/tc)", "-- [NC] Nation chat (/nc)",
|
||||
"- 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\"" });
|
||||
else if (args[0].equalsIgnoreCase("commands")) {
|
||||
ArrayList<String> text = new ArrayList<String>();
|
||||
text.add("§6---- Command list ----");
|
||||
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values())
|
||||
if (!cmd.getClass().getAnnotation(CommandClass.class).modOnly() || PluginMain.permission.has(sender, "tbmc.admin"))
|
||||
if (!cmd.isPlayerOnly() || sender instanceof Player)
|
||||
if (!cmd.GetCommandPath().contains(" "))
|
||||
text.add("/" + cmd.GetCommandPath());
|
||||
else {
|
||||
final String topcmd = cmd.GetCommandPath().substring(0, cmd.GetCommandPath().indexOf(' '));
|
||||
if (!text.contains("/" + topcmd))
|
||||
text.add("/" + topcmd);
|
||||
}
|
||||
sender.sendMessage(text.toArray(new String[0]));
|
||||
} else if (args[0].equalsIgnoreCase("colors")) {
|
||||
sender.sendMessage(new String[] { "§6---- Chat colors/formats ----", //
|
||||
"Tellraw name - Code | Tellraw name - Code", //
|
||||
"§0black - &0 | §1dark_blue - &1", //
|
||||
"§2dark_green - &2 | §3dark_aqua - &3", //
|
||||
"§4dark_red - &4 | §5dark_purple - &5", //
|
||||
"§6gold - &6 | §7gray - &7", //
|
||||
"§8dark_gray - &8 | §9blue - &9", //
|
||||
"§agreen - &a | §baqua - &b", //
|
||||
"§cred - &c | §dlight_purple - &d", //
|
||||
"§eyellow - &e | §fwhite - &f", //
|
||||
"§rreset - &r | §kk§robfuscated - &k", //
|
||||
"§lbold - &l | §mstrikethrough - &m", //
|
||||
"§nunderline - &n | §oitalic - &o", //
|
||||
"The format codes in tellraw should be used like \"italic\":\"true\"" }); //
|
||||
} else {
|
||||
String path = args[0];
|
||||
for (int i = 1; i < args.length; i++)
|
||||
path += " " + args[i];
|
||||
TBMCCommandBase cmd = TBMCChatAPI.GetCommands().get(path);
|
||||
if (cmd == null) {
|
||||
String[] subcmds = TBMCChatAPI.GetSubCommands(path, sender);
|
||||
if (subcmds.length > 0)
|
||||
sender.sendMessage(subcmds);
|
||||
else
|
||||
sender.sendMessage(
|
||||
new String[] { "§cError: Command not found or you don't have permission for it: " + path,
|
||||
"Usage example: /u accept --> /u help u accept" });
|
||||
} else
|
||||
sender.sendMessage(cmd.GetHelpText(args[0]));
|
||||
}
|
||||
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;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.chat.ChatPlayer;
|
||||
import buttondevteam.chat.PluginMain;
|
||||
import buttondevteam.lib.chat.*;
|
||||
import buttondevteam.lib.player.TBMCPlayer;
|
||||
|
||||
@CommandClass(modOnly = false)
|
||||
@OptionallyPlayerCommandClass(playerOnly = true)
|
||||
public class CCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Rainbow mode ----", "This command allows you to talk in rainbow colors",
|
||||
"You need to be a donator or a mod to use this command" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
|
||||
if (args.length < 1) {
|
||||
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||
p.OtherColorMode = null;
|
||||
if (p.RainbowPresserColorMode)
|
||||
player.sendMessage("§eRainbow colors §aenabled.");
|
||||
else
|
||||
player.sendMessage("§eRainbow colors §cdisabled.");
|
||||
} else {
|
||||
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (PluginMain.permission.has(player, "tbmc.admin")) {
|
||||
p.RainbowPresserColorMode = false;
|
||||
p.OtherColorMode = null;
|
||||
try {
|
||||
p.OtherColorMode = Color.valueOf(args[0].toLowerCase());
|
||||
} catch (Exception e) {
|
||||
player.sendMessage("§cUnknown message color: " + args[0]);
|
||||
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
||||
}
|
||||
if (p.OtherColorMode != null)
|
||||
player.sendMessage(String.format("§eMessage color set to %s", p.OtherColorMode));
|
||||
else
|
||||
player.sendMessage("§eMessage color reset.");
|
||||
} else {
|
||||
player.sendMessage("§cYou don't have permission for this command.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
package buttondevteam.chat.components.fun;
|
||||
|
||||
import buttondevteam.chat.ChatPlayer;
|
||||
import buttondevteam.chat.PluginMain;
|
||||
import buttondevteam.lib.chat.*;
|
||||
import buttondevteam.lib.player.TBMCPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandClass(path = "u c", helpText = {
|
||||
"Rainbow mode",
|
||||
"This command allows you to talk in rainbow colors"
|
||||
})
|
||||
@OptionallyPlayerCommandClass(playerOnly = true)
|
||||
public class CCommand extends ICommand2MC {
|
||||
@Command2.Subcommand
|
||||
public boolean def(CommandSender sender, @Command2.OptionalArg String color) {
|
||||
Player player = (Player) sender;
|
||||
ChatPlayer p = TBMCPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class);
|
||||
if (color == null) {
|
||||
if (PluginMain.permission.has(player, "thorpe.color.rainbow")) {
|
||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||
p.OtherColorMode = null;
|
||||
if (p.RainbowPresserColorMode)
|
||||
player.sendMessage("§eRainbow colors §aenabled.");
|
||||
else
|
||||
player.sendMessage("§eRainbow colors §cdisabled.");
|
||||
} else {
|
||||
player.sendMessage("§cYou don't have permission for this command.");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (PluginMain.permission.has(player, "thorpe.color.custom")) {
|
||||
p.RainbowPresserColorMode = false;
|
||||
p.OtherColorMode = null;
|
||||
try {
|
||||
p.OtherColorMode = Color.valueOf(color.toLowerCase());
|
||||
} catch (Exception e) {
|
||||
player.sendMessage("§cUnknown message color: " + color);
|
||||
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
||||
}
|
||||
if (p.OtherColorMode != null)
|
||||
player.sendMessage(String.format("§eMessage color set to %s", p.OtherColorMode));
|
||||
else
|
||||
player.sendMessage("§eMessage color reset.");
|
||||
} else {
|
||||
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.ThorpeUtils;
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.lib.architecture.ConfigData;
|
||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||
import buttondevteam.lib.player.ChromaGamerBase;
|
||||
import buttondevteam.lib.player.TBMCPlayer;
|
||||
|
@ -29,7 +30,6 @@ import java.util.ArrayList;
|
|||
import java.util.Random;
|
||||
|
||||
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 ChatPlayer FPlayer = null;
|
||||
private BukkitTask Ftask = null;
|
||||
|
@ -37,6 +37,19 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
|||
private UnlolCommand command;
|
||||
private TBMCSystemChatEvent.BroadcastTarget unlolTarget;
|
||||
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
|
||||
protected void enable() {
|
||||
unlolTarget = TBMCSystemChatEvent.BroadcastTarget.add("unlol");
|
||||
|
@ -47,6 +60,9 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
|||
registerCommand(command=new UnlolCommand(unlolTarget));
|
||||
registerListener(this);
|
||||
registerCommand(new FTopCommand());
|
||||
registerCommand(new OpmeCommand());
|
||||
registerCommand(new YeehawCommand());
|
||||
registerCommand(new CCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,27 +74,30 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
|||
if (ActiveF && !Fs.contains(sender) && message.equalsIgnoreCase("F"))
|
||||
Fs.add(sender);
|
||||
|
||||
String msg = message.toLowerCase();
|
||||
val lld = new UnlolCommand.LastlolData(sender, event, System.nanoTime());
|
||||
boolean add;
|
||||
if (add = msg.contains("lol"))
|
||||
lld.setLolornot(true);
|
||||
else {
|
||||
for (int i = 0; i < LaughStrings.length; i++) {
|
||||
if (add = msg.contains(LaughStrings[i])) {
|
||||
lld.setLolornot(false);
|
||||
break;
|
||||
if (unlol().get()) {
|
||||
String msg = message.toLowerCase();
|
||||
val lld = new UnlolCommand.LastlolData(sender, event, System.nanoTime());
|
||||
boolean add;
|
||||
if (add = msg.contains("lol"))
|
||||
lld.setLolornot(true);
|
||||
else {
|
||||
String[] laughs = laughStrings().get();
|
||||
for (String laugh : laughs) {
|
||||
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
|
||||
public void onPlayerDeath(PlayerDeathEvent e) {
|
||||
// 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 = () -> {
|
||||
if (ActiveF) {
|
||||
ActiveF = false;
|
||||
|
@ -105,12 +124,14 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
|||
}
|
||||
@EventHandler
|
||||
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)
|
||||
public void onCommandPreprocess(TBMCCommandPreprocessEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
if (!unlol().get()) return;
|
||||
final String cmd = event.getMessage();
|
||||
// We don't care if we have arguments
|
||||
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;
|
||||
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||
import buttondevteam.lib.player.TBMCYEEHAWEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandClass(modOnly = false)
|
||||
public class YeehawCommand extends TBMCCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- YEEHAW command ----", "This command makes you YEEHAW." };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
final String message = "§b* "
|
||||
+ (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs.";
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
||||
p.sendMessage(message); //Not broadcasting, so the Discord plugin can handle the event in a special way
|
||||
} // Even a cmdblock could yeehaw in theory
|
||||
// Or anyone from Discord
|
||||
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package buttondevteam.chat.components.fun;
|
||||
|
||||
import buttondevteam.lib.chat.Command2;
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.lib.chat.ICommand2MC;
|
||||
import buttondevteam.lib.player.TBMCYEEHAWEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandClass(modOnly = false, helpText = {
|
||||
"YEEHAW command",
|
||||
"This command makes you YEEHAW."
|
||||
})
|
||||
public class YeehawCommand extends ICommand2MC {
|
||||
@Command2.Subcommand
|
||||
public boolean def(CommandSender sender) {
|
||||
final String message = "§b* "
|
||||
+ (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName()) + " §bYEEHAWs.";
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
||||
p.sendMessage(message); //Not broadcasting, so the Discord plugin can handle the event in a special way
|
||||
} // Even a cmdblock could yeehaw in theory
|
||||
// Or anyone from Discord
|
||||
Bukkit.getPluginManager().callEvent(new TBMCYEEHAWEvent(sender));
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue