-
-
Save Techno3600/18bd86b96a8daf185553e7cf65fdf6f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bob.server; | |
import org.bukkit.ChatColor; | |
import org.bukkit.Sound; | |
import org.bukkit.command.Command; | |
import org.bukkit.command.CommandExecutor; | |
import org.bukkit.command.CommandSender; | |
import org.bukkit.entity.Player; | |
public class Broadcast implements CommandExecutor { | |
@Override | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
Player p = (Player) sender; | |
if (!(p.hasPermission("technocraft.op"))) { | |
p.sendMessage(c.nperm()); | |
} | |
if (p.hasPermission("technocraft.op") && args.length == 0) { | |
p.sendMessage(c.help("/broadcast,bc (message)", "Send server message.")); | |
} else { | |
StringBuilder sb = new StringBuilder(); | |
String message; | |
for(int i = 0; i < args.length; i++) | |
{ | |
sb.append(args[i]).append(" "); | |
} | |
message = sb.toString().trim(); | |
ChatColor.translateAlternateColorCodes('&', message); | |
p.sendMessage(c.h("Announcement") + ChatColor.AQUA + message); | |
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1F, 1F); | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment