Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onCommand(final CommandSender c, final Command command, final String label, final String[] args) {
- if (command.getName().equalsIgnoreCase("cc")) {
- if (!c.hasPermission("gosvtools.chat.clear")) {
- c.sendMessage(Main.bu);
- return true;
- }
- for (int i = 0; i < 100; ++i) {
- Bukkit.broadcastMessage("");
- }
- for (final String wiadomosc : Main.config.getStringList("ClearChat")) {
- Bukkit.broadcastMessage(wiadomosc.replaceAll("&", "§").replaceAll("%czyszczacy%", c.getName()));
- }
- return false;
- }
- else {
- if (!command.getName().equalsIgnoreCase("zc")) {
- return false;
- }
- if (!c.hasPermission("gosvtools.chat.lock")) {
- c.sendMessage(Main.bu);
- return false;
- }
- if (!Main.wylaczony) {
- for (final String wiadomosc : Main.config.getStringList("ChatLock.Wylaczono")) {
- Bukkit.broadcastMessage(wiadomosc.replaceAll("&", "§").replaceAll("%gracz%", c.getName()));
- }
- Main.wylaczony = true;
- }
- else {
- for (final String wiadomosc : Main.config.getStringList("ChatLock.Wlaczono")) {
- Bukkit.broadcastMessage(wiadomosc.replaceAll("&", "§").replaceAll("%gracz%", c.getName()));
- }
- Main.wylaczony = false;
- }
- return false;
- }
- }
- @EventHandler
- public void chat(final AsyncPlayerChatEvent event) {
- if (event.getPlayer().hasPermission("gosvtools.chat.lock.allow")) {
- return;
- }
- if (Main.wylaczony) {
- event.getPlayer().sendMessage(Main.msg("ChatLock.Wylaczony"));
- event.setCancelled(true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment