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
b6c1cd9
commit 7eaed46
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/main/java/net/gnomeffinway/depenizen/extensions/askyblock/ASkyBlockWorldExtension.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,53 @@ | ||
package net.gnomeffinway.depenizen.extensions.askyblock; | ||
|
||
import com.wasteofplastic.askyblock.ASkyBlockAPI; | ||
import net.aufdemrand.denizen.objects.dWorld; | ||
import net.aufdemrand.denizencore.objects.Element; | ||
import net.aufdemrand.denizencore.objects.dObject; | ||
import net.aufdemrand.denizencore.tags.Attribute; | ||
import net.gnomeffinway.depenizen.extensions.dObjectExtension; | ||
|
||
public class ASkyBlockWorldExtension extends dObjectExtension { | ||
|
||
public static boolean describes(dObject pl) { | ||
return pl instanceof dWorld; | ||
} | ||
|
||
public static ASkyBlockWorldExtension getFrom(dObject object) { | ||
if (!describes(object)) { | ||
return null; | ||
} | ||
else { | ||
return new ASkyBlockWorldExtension((dWorld) object); | ||
} | ||
} | ||
|
||
public ASkyBlockWorldExtension(dWorld world) { | ||
this.world = world; | ||
} | ||
|
||
dWorld world; | ||
ASkyBlockAPI api = ASkyBlockAPI.getInstance(); | ||
|
||
@Override | ||
public String getAttribute(Attribute attribute) { | ||
if (attribute == null) { | ||
return null; | ||
} | ||
|
||
// <--[tag] | ||
// @attribute <w@world.is_skyblock_world> | ||
// @returns Element(Boolean) | ||
// @description | ||
// Returns whether the world is used by A SkyBlock. | ||
// @plugin Depenizen, A SkyBlock | ||
// --> | ||
if (attribute.startsWith("is_skyblock_world")) { | ||
return new Element(api.getIslandWorld() == world.getWorld() || | ||
api.getNetherWorld() == world.getWorld()).getAttribute(attribute.fulfill(1)); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
} |
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