Developer API

This plugin has a developer api. you can post your plugins here

Developer API

you can hook into MultiMarket and create other ways of buying and selling than just signs. heres how...

  1. import the plugin to your build path
  2. there are 4 different methods you can call. the first 2 are the most useful. they all come from the MMAPI class
MMAPI.setMoney(Player p, String money, String market)
sets the player p's money as money for the market market
MMAPI.getMoney(Player p, String market)
returns player p money from market as an int
MMAPI.defaultSell(Player player, String market, int price, ItemStack item)
if player has the item in his hand, then it will take away the item from him and give them price in market
MMAPI.defaultBuy(Player player, String market, int price, String cmdToExecute)
checks is player has enough money from market, then executes the cmdToExecute from the terminal and takes away price

Other Useful Things

simple check and sell

		int money = MMAPI.getMoney(player, market);
		if (something isnt correct. maybe the item in his hand isnt there or something) {
			player.sendMessage(ChatColor.RED + "Something Isnt Correct");
			return;
		} else {
			
			int moneyy = money + price;
			
                        //this is where you would do something
			
			MMAPI.setMoney(player, moneyy + "", market);
			
		}

and this is for a simple buy

		int money = MMAPI.getMoney(player, market);
		if (money < price) {
			player.sendMessage(ChatColor.RED + "You do not have sufficient funds!");
			return;
		} else {
			
			int moneyy = money - price;
			
		        //do something here
		
			MMAPI.setMoney(player, moneyy + "", market);
			
		}

Comments

Posts Quoted:
Reply
Clear All Quotes