-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1277abf
commit 0c9c2f2
Showing
4 changed files
with
88 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/me/limeglass/towny/elements/expressions/ExprTownLevel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package me.limeglass.towny.elements.expressions; | ||
|
||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
import com.palmergames.bukkit.towny.object.Town; | ||
|
||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.expressions.base.SimplePropertyExpression; | ||
|
||
@Name("Town Level") | ||
@Description("Get the level of a Town.") | ||
public class ExprTownLevel extends SimplePropertyExpression<Town, Integer> { | ||
|
||
static { | ||
register(ExprTownLevel.class, Integer.class, "town level", "towns"); | ||
} | ||
|
||
@Override | ||
public Class<? extends Integer> getReturnType() { | ||
return Integer.class; | ||
} | ||
|
||
@Override | ||
public @Nullable Integer convert(Town town) { | ||
return town.getLevel(); | ||
} | ||
|
||
@Override | ||
protected String getPropertyName() { | ||
return "town level"; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/me/limeglass/towny/elements/expressions/ExprTownMayor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package me.limeglass.towny.elements.expressions; | ||
|
||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
import com.palmergames.bukkit.towny.object.Resident; | ||
import com.palmergames.bukkit.towny.object.Town; | ||
|
||
import ch.njol.skript.doc.Description; | ||
import ch.njol.skript.doc.Name; | ||
import ch.njol.skript.expressions.base.SimplePropertyExpression; | ||
|
||
@Name("Town Mayor") | ||
@Description("Get the town mayor of a Town.") | ||
public class ExprTownMayor extends SimplePropertyExpression<Town, Resident> { | ||
|
||
static { | ||
register(ExprTownMayor.class, Resident.class, "[town] mayor", "towns"); | ||
} | ||
|
||
@Override | ||
public Class<? extends Resident> getReturnType() { | ||
return Resident.class; | ||
} | ||
|
||
@Override | ||
public @Nullable Resident convert(Town town) { | ||
return town.getMayor(); | ||
} | ||
|
||
@Override | ||
protected String getPropertyName() { | ||
return "mayor"; | ||
} | ||
|
||
} |