-
-
Save WeiiswurstDev/1d5ecc88c987b4df8a76287ad5d5e347 to your computer and use it in GitHub Desktop.
AdminTools3 API example
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 dev.wwst.testplugin | |
import dev.wwst.admintools3.modules.Module; | |
import dev.wwst.admintools3.util.ItemBuilder; | |
import dev.wwst.admintools3.util.XMaterial; | |
import org.bukkit.ChatColor; | |
import org.bukkit.World; | |
import org.bukkit.entity.Player; | |
public class TestModule extends Module { | |
public TestModule() { | |
super(false,true,"test", XMaterial.OAK_LOG); | |
// You can configure the module further here, e.g. | |
// permissionBase = "yourplugin.testmodule"; | |
// permissionSelf = "yourplugin.testmodule.self"; | |
// This will change the default permission (admintools3.module.testmodule) to yourplugin.testmodule | |
// which might be useful if you want to use your own permission prefixes. | |
} | |
@Override | |
public boolean execute(Player player, Player other, World world) { | |
// NEVER REMOVE THESE 3 LINES !!! | |
// IN THE WIKI IS EXPLAINED WHY | |
if(!super.execute(player, other, world)) { | |
return false; | |
} | |
// What happens when the module gets executed? | |
// Remember that "other" is who was selected by "player" in the GUI | |
// other can also be the player himself, if he chose himself or leftclicked. | |
other.getInventory().addItem(new ItemBuilder(XMaterial.STICK, ChatColor.GREEN+"It works").addLore("&cColored Text! (& only works in the lore though!)").build()); | |
// As you can see, AdminTools3 also comes with a handy ItemBuilder to easily create items. | |
return true; // You need to return something, it doesnt matter what. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment