-
Notifications
You must be signed in to change notification settings - Fork 782
Code Templates
Evan Kranzler edited this page Jan 27, 2019
·
7 revisions
It's handy to use code templates for code constructs you need often. The code templates can be defined here: Tools -> Options -> Editor -> Code Templates (Language=Java). You define an "Abbreviation" the "Expand Text" and optional a description. As you enter the abbreviation followed by a tab in the code, the NetBeans editor changes the abbreviation to the expand text.
class ${effectName newVarName default="New"}Effect extends ${osef type="mage.abilities.effects.OneShotEffect" default="OneShotEffect" editable="false"} {
${effectName}Effect() {
super(Outcome.Benefit);
this.staticText = "${selection}${cursor}";
}
private ${effectName}Effect(final ${effectName}Effect effect) {
super(effect);
}
@Override
public ${effectName}Effect copy() {
return new ${effectName}Effect(this);
}
@Override
public boolean apply(${game type="mage.game.Game" default="Game" editable="false"} game, ${ability type="mage.abilities.Ability" default="Ability" editable="false"} source) {
return false;
}
}
class ${abilityName default="New"}TriggeredAbility extends ${trab type="mage.abilities.TriggeredAbilityImpl" default="TriggeredAbilityImpl" editable="false"} {
${abilityName}TriggeredAbility() {
super(Zone.BATTLEFIELD, null, false);
}
private ${abilityName}TriggeredAbility(final ${abilityName}TriggeredAbility ability) {
super(ability);
}
@Override
public ${abilityName}TriggeredAbility copy() {
return new ${abilityName}TriggeredAbility(this);
}
@Override
public boolean checkTrigger(${gameEvent type="mage.game.events.GameEvent" default="GameEvent" editable="false"} event, ${game type="mage.game.Game" default="Game" editable="false"} game) {
return false;
}
@Override
public String getRule() {
return "${cursor}" + super.getRule();
}
}