Add private messaging system
This commit is contained in:
parent
ce4289fa00
commit
c32e647d9e
@ -26,6 +26,7 @@ import mineplex.mapparser.command.ListCommand;
|
||||
import mineplex.mapparser.command.LockCommand;
|
||||
import mineplex.mapparser.command.MapCommand;
|
||||
import mineplex.mapparser.command.NameCommand;
|
||||
import mineplex.mapparser.command.PMCommand;
|
||||
import mineplex.mapparser.command.ParseCommand200;
|
||||
import mineplex.mapparser.command.ParseCommand400;
|
||||
import mineplex.mapparser.command.ParseCommand600;
|
||||
@ -119,6 +120,8 @@ public class MapParser extends JavaPlugin
|
||||
commandModule.add(new WarpCommand(this));
|
||||
commandModule.add(new CurrentlyLiveCommand(this));
|
||||
commandModule.add(new AddSplashTextCommand(this));
|
||||
commandModule.add(new PMCommand(this));
|
||||
|
||||
loadInfo();
|
||||
addSplashText();
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class PMCommand extends BaseCommand
|
||||
{
|
||||
public PMCommand(MapParser plugin)
|
||||
{
|
||||
super(plugin, "m", "message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
if(!player.isOp())
|
||||
{
|
||||
player.sendMessage(C.cRed + "You are not allowed to do that!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length == 0)
|
||||
{
|
||||
player.sendMessage(C.cRed + "Please put a message in!");
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(String s : args)
|
||||
{
|
||||
builder.append(s).append(" ");
|
||||
}
|
||||
for(Player ops : UtilServer.getPlayers())
|
||||
{
|
||||
if(!ops.isOp())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ops.sendMessage(F.main("Message", builder.toString().trim()));
|
||||
ops.playSound(ops.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user