-
Notifications
You must be signed in to change notification settings - Fork 1
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
21 changed files
with
565 additions
and
38 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
AdminCommand: | ||
- wlib | ||
- awlib | ||
- awl | ||
PlayerCommand: | ||
- wlib | ||
- wl |
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
27 changes: 27 additions & 0 deletions
27
Winfxklib/src/cn/winfxk/nukkit/winfxklib/cmd/MyCommand.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,27 @@ | ||
package cn.winfxk.nukkit.winfxklib.cmd; | ||
|
||
import cn.nukkit.command.Command; | ||
import cn.winfxk.nukkit.winfxklib.Message; | ||
import cn.winfxk.nukkit.winfxklib.WinfxkLib; | ||
import cn.winfxk.nukkit.winfxklib.tool.Config; | ||
|
||
import java.io.File; | ||
|
||
public abstract class MyCommand extends Command { | ||
protected static WinfxkLib lib = WinfxkLib.getMain(); | ||
protected static final Message msg = WinfxkLib.getMessage(); | ||
protected static final File file = new File(WinfxkLib.getMain().getConfigDir(), WinfxkLib.CommandFileName); | ||
protected static final Config config = new Config(file); | ||
protected static final String AdminPermission = "WinfxkLib.Command.Admin"; | ||
protected static final String PlayerPermission = "WinfxkLib.Command.Player"; | ||
protected String CommandKey; | ||
|
||
public MyCommand(String name, String description, String usageMessage, String[] aliases) { | ||
super(name, description, usageMessage, aliases); | ||
CommandKey = getClass().getSimpleName(); | ||
} | ||
|
||
protected String getString(String Key) { | ||
return msg.getSun("Command", CommandKey, Key); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Winfxklib/src/cn/winfxk/nukkit/winfxklib/cmd/PlayerCommand.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,45 @@ | ||
package cn.winfxk.nukkit.winfxklib.cmd; | ||
|
||
import cn.nukkit.command.CommandSender; | ||
import cn.nukkit.command.data.CommandParameter; | ||
import cn.winfxk.nukkit.winfxklib.MyPlayer; | ||
import cn.winfxk.nukkit.winfxklib.WinfxkLib; | ||
import cn.winfxk.nukkit.winfxklib.module.leave_word.LeaveWord; | ||
import cn.winfxk.nukkit.winfxklib.tool.Tool; | ||
|
||
import java.util.Locale; | ||
|
||
public class PlayerCommand extends MyCommand { | ||
public PlayerCommand() { | ||
super("admin-" + lib.getName().toLowerCase(Locale.ROOT), msg.getSun("Command", "PlayerCommand", "Description"), msg.getSun("Command", "PlayerCommand", "usageMessage"), Tool.getArray(config.getList("PlayerCommand"), new String[]{})); | ||
commandParameters.clear(); | ||
commandParameters.put(getString("Help"), new CommandParameter[]{new CommandParameter(getString("Help"), false, new String[]{"help", "h"})}); | ||
commandParameters.put(getString("LeaveWord"), new CommandParameter[]{new CommandParameter(getString("LeaveWord"), false, new String[]{"leaveword", "lw"})}); | ||
} | ||
|
||
@Override | ||
public boolean execute(CommandSender sender, String s, String[] args) { | ||
if (!sender.hasPermission(PlayerPermission)) { | ||
sender.sendMessage(getString("无权执行")); | ||
return true; | ||
} | ||
if (!sender.isPlayer()) { | ||
sender.sendMessage(getString("NotPlayer")); | ||
return true; | ||
} | ||
String mainKey; | ||
if (args == null || args.length <= 0 || (mainKey = args[0]) == null || mainKey.isEmpty()) { | ||
sender.sendMessage(Tool.getCommandHelp(this)); | ||
return true; | ||
} | ||
MyPlayer myPlayer = WinfxkLib.getMyPlayer(sender.getName()); | ||
switch (mainKey.toLowerCase(Locale.ROOT)) { | ||
case "leaveword": | ||
case "lw": | ||
return myPlayer.showForm(new LeaveWord(myPlayer.getPlayer(), null, true)); | ||
default: | ||
sender.sendMessage(Tool.getCommandHelp(this)); | ||
} | ||
return true; | ||
} | ||
} |
Oops, something went wrong.