Add private messaging system

This commit is contained in:
TadahTech 2016-07-18 22:21:09 -05:00
parent ce4289fa00
commit c32e647d9e
2 changed files with 55 additions and 0 deletions

View File

@ -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();
}

View File

@ -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;
}
}