Created
February 5, 2020 00:51
-
-
Save joserobjr/64230084dbde2195503b88c28105787b to your computer and use it in GitHub Desktop.
Test plugin for https://github.com/NukkitX/Nukkit/issues/1126
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
name: OffhandTestPlugin | |
main: sample.OffhandTestPlugin | |
version: 1.0.0 | |
api: ["1.0.9"] | |
commands: | |
test-offhand: | |
permission: test-offhand | |
permissions: | |
test-offhand: | |
default: true |
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
package sample; | |
import cn.nukkit.Player; | |
import cn.nukkit.command.Command; | |
import cn.nukkit.command.CommandSender; | |
import cn.nukkit.plugin.PluginBase; | |
public class OffhandTestPlugin extends PluginBase { | |
@Override | |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | |
Player player = (Player) sender; | |
sender.sendMessage("You have this in your offhand: "+player.getOffhandInventory().getItem(0).getName()); | |
player.getInventory().clearAll(); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment