More components, broadcasts #98
5 changed files with 60 additions and 9 deletions
|
@ -42,5 +42,34 @@
|
||||||
<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" name="Maven: com.vexsoftware:nuvotifier-universal:2.3.4" 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,7 +1,10 @@
|
||||||
package buttondevteam.chat.components.announce;
|
package buttondevteam.chat.components.announce;
|
||||||
|
|
||||||
|
import buttondevteam.core.component.channel.Channel;
|
||||||
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
import buttondevteam.lib.architecture.Component;
|
import buttondevteam.lib.architecture.Component;
|
||||||
import buttondevteam.lib.architecture.ConfigData;
|
import buttondevteam.lib.architecture.ConfigData;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -14,6 +17,9 @@ public class AnnouncerComponent extends Component implements Runnable {
|
||||||
public ConfigData<Integer> AnnounceTime() {
|
public ConfigData<Integer> AnnounceTime() {
|
||||||
return getConfig().getData("announceTime", 15 * 60 * 1000);
|
return getConfig().getData("announceTime", 15 * 60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TBMCSystemChatEvent.BroadcastTarget target;
|
||||||
|
|
||||||
private static int AnnounceMessageIndex = 0;
|
private static int AnnounceMessageIndex = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,7 +32,7 @@ public class AnnouncerComponent extends Component implements Runnable {
|
||||||
}
|
}
|
||||||
if (Bukkit.getOnlinePlayers().size() == 0) continue; //Don't post to Discord if nobody is on
|
if (Bukkit.getOnlinePlayers().size() == 0) continue; //Don't post to Discord if nobody is on
|
||||||
if (AnnounceMessages().get().size() > AnnounceMessageIndex) {
|
if (AnnounceMessages().get().size() > AnnounceMessageIndex) {
|
||||||
Bukkit.broadcastMessage(AnnounceMessages().get().get(AnnounceMessageIndex));
|
TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, AnnounceMessages().get().get(AnnounceMessageIndex), target);
|
||||||
AnnounceMessageIndex++;
|
AnnounceMessageIndex++;
|
||||||
if (AnnounceMessageIndex == AnnounceMessages().get().size())
|
if (AnnounceMessageIndex == AnnounceMessages().get().size())
|
||||||
AnnounceMessageIndex = 0;
|
AnnounceMessageIndex = 0;
|
||||||
|
@ -36,6 +42,7 @@ public class AnnouncerComponent extends Component implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
|
target= TBMCSystemChatEvent.BroadcastTarget.add("announcements");
|
||||||
registerCommand(new AddCommand());
|
registerCommand(new AddCommand());
|
||||||
registerCommand(new EditCommand());
|
registerCommand(new EditCommand());
|
||||||
registerCommand(new ListCommand());
|
registerCommand(new ListCommand());
|
||||||
|
|
|
@ -2,6 +2,7 @@ package buttondevteam.chat.components.fun;
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import buttondevteam.chat.PluginMain;
|
import buttondevteam.chat.PluginMain;
|
||||||
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.lib.TBMCChatEventBase;
|
import buttondevteam.lib.TBMCChatEventBase;
|
||||||
import buttondevteam.lib.TBMCCommandPreprocessEvent;
|
import buttondevteam.lib.TBMCCommandPreprocessEvent;
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent;
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
|
@ -10,6 +11,7 @@ import buttondevteam.lib.architecture.Component;
|
||||||
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;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -35,13 +37,15 @@ public class FunComponent extends Component implements Listener {
|
||||||
private ArrayList<CommandSender> Fs = new ArrayList<>();
|
private ArrayList<CommandSender> Fs = new ArrayList<>();
|
||||||
private UnlolCommand command;
|
private UnlolCommand command;
|
||||||
private TBMCSystemChatEvent.BroadcastTarget unlolTarget;
|
private TBMCSystemChatEvent.BroadcastTarget unlolTarget;
|
||||||
|
private TBMCSystemChatEvent.BroadcastTarget fTarget;
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
unlolTarget = TBMCSystemChatEvent.BroadcastTarget.add("unlol");
|
unlolTarget = TBMCSystemChatEvent.BroadcastTarget.add("unlol");
|
||||||
|
fTarget = TBMCSystemChatEvent.BroadcastTarget.add("respect");
|
||||||
val pc = new PressCommand();
|
val pc = new PressCommand();
|
||||||
registerCommand(pc);
|
registerCommand(pc);
|
||||||
registerListener(pc);
|
registerListener(pc);
|
||||||
registerCommand(command=new UnlolCommand());
|
registerCommand(command=new UnlolCommand(unlolTarget));
|
||||||
registerListener(this);
|
registerListener(this);
|
||||||
registerCommand(new FTopCommand());
|
registerCommand(new FTopCommand());
|
||||||
}
|
}
|
||||||
|
@ -81,8 +85,9 @@ public class FunComponent extends Component implements Listener {
|
||||||
ActiveF = false;
|
ActiveF = false;
|
||||||
if (FPlayer != null && FPlayer.FCount().get() < Integer.MAX_VALUE - 1)
|
if (FPlayer != null && FPlayer.FCount().get() < Integer.MAX_VALUE - 1)
|
||||||
FPlayer.FCount().set(FPlayer.FCount().get() + Fs.size());
|
FPlayer.FCount().set(FPlayer.FCount().get() + Fs.size());
|
||||||
Bukkit.broadcastMessage("§b" + Fs.size() + " " + (Fs.size() == 1 ? "person" : "people")
|
TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL,
|
||||||
+ " paid their respects.§r");
|
"§b" + Fs.size() + " " + (Fs.size() == 1 ? "person" : "people")
|
||||||
|
+ " paid their respects.§r", fTarget);
|
||||||
Fs.clear();
|
Fs.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -94,7 +99,8 @@ public class FunComponent extends Component implements Listener {
|
||||||
Fs.clear();
|
Fs.clear();
|
||||||
FPlayer = TBMCPlayer.getPlayer(e.getEntity().getUniqueId(), ChatPlayer.class);
|
FPlayer = TBMCPlayer.getPlayer(e.getEntity().getUniqueId(), ChatPlayer.class);
|
||||||
FPlayer.FDeaths().set(FPlayer.FDeaths().get() + 1);
|
FPlayer.FDeaths().set(FPlayer.FDeaths().get() + 1);
|
||||||
Bukkit.broadcastMessage("§bPress F to pay respects.§r");
|
TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL,
|
||||||
|
"§bPress F to pay respects.§r", fTarget);
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(PluginMain.Instance, tt, 15 * 20);
|
Bukkit.getScheduler().runTaskLaterAsynchronously(PluginMain.Instance, tt, 15 * 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package buttondevteam.chat.components.fun;
|
package buttondevteam.chat.components.fun;
|
||||||
|
|
||||||
|
import buttondevteam.core.component.channel.Channel;
|
||||||
|
import buttondevteam.core.component.restart.RestartComponent;
|
||||||
import buttondevteam.core.component.restart.ScheduledRestartCommand;
|
import buttondevteam.core.component.restart.ScheduledRestartCommand;
|
||||||
import buttondevteam.lib.ScheduledServerRestartEvent;
|
import buttondevteam.lib.ScheduledServerRestartEvent;
|
||||||
import buttondevteam.lib.ThorpeUtils;
|
import buttondevteam.lib.ThorpeUtils;
|
||||||
import buttondevteam.lib.chat.Command2;
|
import buttondevteam.lib.chat.Command2;
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
import buttondevteam.lib.chat.ICommand2MC;
|
import buttondevteam.lib.chat.ICommand2MC;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -30,7 +33,7 @@ public class PressCommand extends ICommand2MC implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pressers.add(sender);
|
pressers.add(sender);
|
||||||
Bukkit.broadcastMessage(String.format("§b-- %s §bpressed at %.0fs", ThorpeUtils.getDisplayName(sender), command.getRestartCounter() / 20f));
|
TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, String.format("§b-- %s §bpressed at %.0fs", ThorpeUtils.getDisplayName(sender), command.getRestartCounter() / 20f), command.getComponent().getRestartBroadcast());
|
||||||
command.setRestartCounter(startTicks);
|
command.setRestartCounter(startTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@ package buttondevteam.chat.components.fun;
|
||||||
|
|
||||||
import buttondevteam.core.component.channel.Channel;
|
import buttondevteam.core.component.channel.Channel;
|
||||||
import buttondevteam.lib.TBMCChatEventBase;
|
import buttondevteam.lib.TBMCChatEventBase;
|
||||||
|
import buttondevteam.lib.TBMCSystemChatEvent;
|
||||||
|
import buttondevteam.lib.ThorpeUtils;
|
||||||
import buttondevteam.lib.chat.*;
|
import buttondevteam.lib.chat.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -20,10 +23,13 @@ import java.util.Map;
|
||||||
"It will make the last person saying one of the recognized laugh strings blind for a few seconds",
|
"It will make the last person saying one of the recognized laugh strings blind for a few seconds",
|
||||||
"Note that you can only unlaugh laughs that weren't unlaughed before"
|
"Note that you can only unlaugh laughs that weren't unlaughed before"
|
||||||
})
|
})
|
||||||
|
@RequiredArgsConstructor
|
||||||
public final class UnlolCommand extends ICommand2MC {
|
public final class UnlolCommand extends ICommand2MC {
|
||||||
|
|
||||||
public Map<Channel, LastlolData> Lastlol = new HashMap<>();
|
public Map<Channel, LastlolData> Lastlol = new HashMap<>();
|
||||||
|
|
||||||
|
private final TBMCSystemChatEvent.BroadcastTarget target;
|
||||||
|
|
||||||
@Command2.Subcommand
|
@Command2.Subcommand
|
||||||
public boolean def(CommandSender sender) {
|
public boolean def(CommandSender sender) {
|
||||||
LastlolData lol = Lastlol.values().stream().filter(lld -> lld.Chatevent.shouldSendTo(sender))
|
LastlolData lol = Lastlol.values().stream().filter(lld -> lld.Chatevent.shouldSendTo(sender))
|
||||||
|
@ -33,10 +39,10 @@ public final class UnlolCommand extends ICommand2MC {
|
||||||
if (lol.Lolowner instanceof Player)
|
if (lol.Lolowner instanceof Player)
|
||||||
((Player) lol.Lolowner)
|
((Player) lol.Lolowner)
|
||||||
.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 2 * 20, 5, false, false));
|
.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 2 * 20, 5, false, false));
|
||||||
String msg = (sender instanceof Player ? ((Player) sender).getDisplayName() : sender.getName())
|
String msg = ThorpeUtils.getDisplayName(sender)
|
||||||
+ (lol.Lolornot ? " unlolled " : " unlaughed ")
|
+ (lol.Lolornot ? " unlolled " : " unlaughed ")
|
||||||
+ (lol.Lolowner instanceof Player ? ((Player) lol.Lolowner).getDisplayName() : lol.Lolowner.getName());
|
+ ThorpeUtils.getDisplayName(lol.Lolowner);
|
||||||
Bukkit.broadcastMessage(msg);
|
TBMCChatAPI.SendSystemMessage(Channel.GlobalChat, Channel.RecipientTestResult.ALL, msg, target);
|
||||||
Lastlol.remove(lol.Chatevent.getChannel());
|
Lastlol.remove(lol.Chatevent.getChannel());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue