How to use in your plugins

Documentation

Documentation

Add softdepend: [CLib] or depend: [CLib] to your plugin.yml First!!!!

Economy

An Example of economy in A command:

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("buy")) {
		if (args[0] == "wood") {
			Player player = (Player) sender;
			int Amount = 100
			Playerbal = GetBal(player)
			if (PlayerBal >= Amount) {
				RemMoney(Amount, player)
			}
		}	
    }
    return false;
}

IconMenu

Examples of the IconMenu in a command:

Sending a messages to the player with the name of the option.

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("menu")) {
        if(args[0] == "open"){
			CIconMenu menu = new CIconMenu("IconMenu Test", 9, new CIconMenu.OptionClickEventHandler() {
				@Override
				public void onOptionClick(CIconMenu.OptionClickEvent event) {
					event.getPlayer().sendMessage("You have chosen " + event.getName());
					event.setWillClose(true);
					event.setWillDestroy(true);
				}
			}, plugin)
			.setOption(3, new ItemStack(Material.APPLE, 1), "Food", "The food is delicious")
			.setOption(4, new ItemStack(Material.IRON_SWORD, 1), "Weapon", "Weapons are for awesome people")
			.setOption(5, new ItemStack(Material.EMERALD, 1), "Money", "Money brings happiness");
		}
    }
    return false;
}

Example of change size of the menu and economy in the menu

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("menu")) {
        if(args[0] == "open"){
			CIconMenu menu = new CIconMenu("IconMenu Test", 54, new CIconMenu.OptionClickEventHandler() {
				@Override
				public void onOptionClick(CIconMenu.OptionClickEvent event) {
					if (event.getName() == Food) {
						Player player = event.getPlayer();
						//Do Something
						AddMoney(player,20)
						//Destroy the event (if you don't do this then the everything will be done multiple times)
						event.setWillClose(true);
						event.setWillDestroy(true);
					}
				}
			}, plugin)
			.setOption(0, new ItemStack(266, 1), "Money", "This will give you 20$")
			.setOption(1, new ItemStack(Material.IRON_SWORD, 1), "Weapon", "Weapons are for awesome people")
			.setOption(8, new ItemStack(Material.EMERALD, 1), "Close", "Close the Menu");
		}
    }
    return false;
}

Comments

Posts Quoted:
Reply
Clear All Quotes