-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
143 additions
and
16 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
...dyplus/chat/command/player/LbCommand.java → .../cn/handyplus/chat/command/LbCommand.java
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
52 changes: 52 additions & 0 deletions
52
src/main/java/cn/handyplus/chat/command/player/TellCommand.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package cn.handyplus.chat.command.player; | ||
|
||
import cn.handyplus.chat.constants.ChatConstants; | ||
import cn.handyplus.chat.listener.AsyncPlayerChatEventListener; | ||
import cn.handyplus.chat.util.ConfigUtil; | ||
import cn.handyplus.lib.command.IHandyCommandEvent; | ||
import cn.handyplus.lib.util.AssertUtil; | ||
import cn.handyplus.lib.util.BaseUtil; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* 私信 | ||
* | ||
* @author handy | ||
*/ | ||
public class TellCommand implements IHandyCommandEvent { | ||
|
||
@Override | ||
public String command() { | ||
return "tell"; | ||
} | ||
|
||
@Override | ||
public String permission() { | ||
return "playerChat.tell"; | ||
} | ||
|
||
@Override | ||
public boolean isAsync() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
// 参数是否正常 | ||
AssertUtil.notTrue(args.length < 2, sender, ConfigUtil.LANG_CONFIG.getString("paramFailureMsg")); | ||
// 是否为玩家 | ||
Player player = AssertUtil.notPlayer(sender, BaseUtil.getMsgNotColor("noPlayerFailureMsg")); | ||
// 接收人 | ||
String playerName = args[1]; | ||
// 获取消息 | ||
StringBuilder message = new StringBuilder(); | ||
for (int i = 2; i < args.length; i++) { | ||
message.append(args[i]).append(" "); | ||
} | ||
// 发送消息 | ||
AsyncPlayerChatEventListener.sendMsg(player, message.toString(), ChatConstants.TELL, playerName); | ||
} | ||
|
||
} |
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
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
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
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
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
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
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