2011-03-19 23:39:51 +01:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
2013-10-16 21:59:39 +02:00
|
|
|
import com.earth2me.essentials.CommandSource;
|
2013-05-26 17:23:11 +02:00
|
|
|
import com.earth2me.essentials.Console;
|
2011-11-21 02:55:26 +01:00
|
|
|
import static com.earth2me.essentials.I18n._;
|
2011-03-19 23:39:51 +01:00
|
|
|
import com.earth2me.essentials.User;
|
2013-06-08 23:31:19 +02:00
|
|
|
import com.earth2me.essentials.utils.FormatUtil;
|
2011-11-18 18:42:26 +01:00
|
|
|
import org.bukkit.Server;
|
2013-05-26 17:23:11 +02:00
|
|
|
import org.bukkit.command.CommandSender;
|
2011-11-18 18:42:26 +01:00
|
|
|
import org.bukkit.entity.Player;
|
2011-03-19 23:39:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
public class Commandhelpop extends EssentialsCommand
|
|
|
|
{
|
|
|
|
public Commandhelpop()
|
|
|
|
{
|
|
|
|
super("helpop");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-11-18 13:06:59 +01:00
|
|
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
2013-05-26 17:23:11 +02:00
|
|
|
{
|
|
|
|
user.setDisplayNick();
|
2013-10-16 21:59:39 +02:00
|
|
|
sendMessage(server, user.getSource(), user.getDisplayName(), args);
|
2013-05-26 17:23:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-16 21:59:39 +02:00
|
|
|
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
2013-05-26 17:23:11 +02:00
|
|
|
{
|
|
|
|
sendMessage(server, sender, Console.NAME, args);
|
|
|
|
}
|
|
|
|
|
2013-10-16 21:59:39 +02:00
|
|
|
private void sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception
|
2011-03-19 23:39:51 +01:00
|
|
|
{
|
|
|
|
if (args.length < 1)
|
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 23:07:30 +02:00
|
|
|
throw new NotEnoughArgumentsException();
|
2011-03-19 23:39:51 +01:00
|
|
|
}
|
2013-06-08 23:31:19 +02:00
|
|
|
final String message = _("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
|
2013-05-26 17:23:11 +02:00
|
|
|
CommandSender cs = Console.getCommandSender(server);
|
|
|
|
cs.sendMessage(message);
|
2011-11-18 13:06:59 +01:00
|
|
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
2011-03-19 23:39:51 +01:00
|
|
|
{
|
2011-11-18 13:06:59 +01:00
|
|
|
final User player = ess.getUser(onlinePlayer);
|
|
|
|
if (!player.isAuthorized("essentials.helpop.receive"))
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 23:07:30 +02:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-11-18 13:06:59 +01:00
|
|
|
player.sendMessage(message);
|
2011-03-19 23:39:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|