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" 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,14 +1,13 @@
|
|||
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;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@CommandClass(modOnly = false)
|
||||
public final class HelpCommand extends UCommandBase {
|
||||
|
@ -46,7 +45,7 @@ public final class HelpCommand extends UCommandBase {
|
|||
if (!text.contains("/" + topcmd))
|
||||
text.add("/" + topcmd);
|
||||
}
|
||||
sender.sendMessage(text.toArray(new String[text.size()]));
|
||||
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", //
|
||||
|
|
|
@ -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,29 +1,24 @@
|
|||
package buttondevteam.chat.commands.ucmds;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
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(modOnly = false)
|
||||
@CommandClass(path = "u c", helpText = {
|
||||
"Rainbow mode",
|
||||
"This command allows you to talk in rainbow colors"
|
||||
})
|
||||
@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) {
|
||||
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 (args.length < 1) {
|
||||
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
||||
if (color == null) {
|
||||
if (PluginMain.permission.has(player, "thorpe.color.rainbow")) {
|
||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||
p.OtherColorMode = null;
|
||||
if (p.RainbowPresserColorMode)
|
||||
|
@ -31,17 +26,17 @@ public class CCommand extends UCommandBase {
|
|||
else
|
||||
player.sendMessage("§eRainbow colors §cdisabled.");
|
||||
} else {
|
||||
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
|
||||
player.sendMessage("§cYou don't have permission for this command.");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (PluginMain.permission.has(player, "tbmc.admin")) {
|
||||
if (PluginMain.permission.has(player, "thorpe.color.custom")) {
|
||||
p.RainbowPresserColorMode = false;
|
||||
p.OtherColorMode = null;
|
||||
try {
|
||||
p.OtherColorMode = Color.valueOf(args[0].toLowerCase());
|
||||
p.OtherColorMode = Color.valueOf(color.toLowerCase());
|
||||
} catch (Exception e) {
|
||||
player.sendMessage("§cUnknown message color: " + args[0]);
|
||||
player.sendMessage("§cUnknown message color: " + color);
|
||||
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
||||
}
|
||||
if (p.OtherColorMode != null)
|
||||
|
@ -55,5 +50,4 @@ public class CCommand extends UCommandBase {
|
|||
}
|
||||
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,14 +74,16 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
|||
if (ActiveF && !Fs.contains(sender) && message.equalsIgnoreCase("F"))
|
||||
Fs.add(sender);
|
||||
|
||||
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 {
|
||||
for (int i = 0; i < LaughStrings.length; i++) {
|
||||
if (add = msg.contains(LaughStrings[i])) {
|
||||
String[] laughs = laughStrings().get();
|
||||
for (String laugh : laughs) {
|
||||
if (add = msg.contains(laugh)) {
|
||||
lld.setLolornot(false);
|
||||
break;
|
||||
}
|
||||
|
@ -74,11 +92,12 @@ public class FunComponent extends Component<PluginMain> implements Listener {
|
|||
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) {
|
||||
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,22 +1,20 @@
|
|||
package buttondevteam.chat.commands;
|
||||
package buttondevteam.chat.components.fun;
|
||||
|
||||
import buttondevteam.lib.chat.Command2;
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||
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)
|
||||
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) {
|
||||
@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()) {
|
Loading…
Reference in a new issue