Skip to content

Instantly share code, notes, and snippets.

@WeiiswurstDev
Created March 31, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WeiiswurstDev/1d5ecc88c987b4df8a76287ad5d5e347 to your computer and use it in GitHub Desktop.
Save WeiiswurstDev/1d5ecc88c987b4df8a76287ad5d5e347 to your computer and use it in GitHub Desktop.
AdminTools3 API example
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