objective

Objective

Example

In this example I will show you how to make a objective that will update every time you teleport

public class TeleportObjective implements Listener, Objective {
	
	public Teleport(int specialId) {
		setSpecialId(specialId);
	}
	
	public Teleport() {
	}
	
	@EventHandler
	public void onMoneyUpdate(PlayerTeleportEvent e) {
		updateAdd(e.getPlayer(), 1);
	}
	
	@Override
	public String getName() {
		return "tp";
	}

	private boolean registered = false;
	
	@Override
	public void register() {
		registered = true;
	}

	@Override
	public boolean isRegistered() {
		return registered;
	}
	
	private int id;
	
	@Override
	public int getSpecialId() {
		return id;
	};
	
	public void setSpecialId(int id) {
		this.id= id;
	};
}

How to make a Objective

first you need to create a class that implements Objective optional (listener)

the next things you need to have:

  • a constructor for specialId
  • the register methode
  • getName()
  • getId()
  • getSpecialId()

that' s all you need

Score

you can add or set score by:

  • set: update(player, newScore)
  • add: updateAdd(player, addScore)

Comments

Posts Quoted:
Reply
Clear All Quotes