-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #190
- Loading branch information
Showing
6 changed files
with
103 additions
and
1 deletion.
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
83 changes: 83 additions & 0 deletions
83
...in/java/com/denizenscript/depenizen/bukkit/extensions/vampire/VampirePlayerExtension.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,83 @@ | ||
package com.denizenscript.depenizen.bukkit.extensions.vampire; | ||
|
||
import com.denizenscript.depenizen.bukkit.extensions.dObjectExtension; | ||
import com.massivecraft.vampire.entity.UPlayer; | ||
import net.aufdemrand.denizen.objects.dPlayer; | ||
import net.aufdemrand.denizencore.objects.Element; | ||
import net.aufdemrand.denizencore.objects.dObject; | ||
import net.aufdemrand.denizencore.tags.Attribute; | ||
|
||
public class VampirePlayerExtension extends dObjectExtension { | ||
|
||
public static boolean describes(dObject object) { | ||
return object instanceof dPlayer; | ||
} | ||
|
||
public static VampirePlayerExtension getFrom(dObject object) { | ||
if (!describes(object)) { | ||
return null; | ||
} | ||
else { | ||
return new VampirePlayerExtension((dPlayer) object); | ||
} | ||
} | ||
|
||
public VampirePlayerExtension(dPlayer player) { | ||
this.uPlayer = UPlayer.get(player.getPlayerEntity()); | ||
} | ||
|
||
UPlayer uPlayer = null; | ||
|
||
@Override | ||
public String getAttribute(Attribute attribute) { | ||
if (attribute == null) { | ||
return null; | ||
} | ||
|
||
// <--[tag] | ||
// @attribute <p@player.is_vampire> | ||
// @returns Element(Boolean) | ||
// @description | ||
// Returns true if the player is a vampire. | ||
// @Plugin DepenizenBukkit, Vampire | ||
// --> | ||
if (attribute.startsWith("is_vampire")) { | ||
return new Element(uPlayer.isVampire()).getAttribute(attribute.fulfill(1)); | ||
} | ||
|
||
// <--[tag] | ||
// @attribute <p@player.is_ínfected> | ||
// @returns Element(Boolean) | ||
// @description | ||
// Returns true if the player is infected. | ||
// @Plugin DepenizenBukkit, Vampire | ||
// --> | ||
if (attribute.startsWith("is_ínfected")) { | ||
return new Element(uPlayer.isInfected()).getAttribute(attribute.fulfill(1)); | ||
} | ||
|
||
// <--[tag] | ||
// @attribute <p@player.combat_infect> | ||
// @returns Element(Double) | ||
// @description | ||
// Returns the value of the combat infection risk. | ||
// @Plugin DepenizenBukkit, Vampire | ||
// --> | ||
if (attribute.startsWith("combat_infect")) { | ||
return new Element(uPlayer.combatInfectRisk()).getAttribute(attribute.fulfill(1)); | ||
} | ||
|
||
// <--[tag] | ||
// @attribute <p@player.combat_damage> | ||
// @returns Element(Double) | ||
// @description | ||
// Returns the value of the combat damage factor. | ||
// @Plugin DepenizenBukkit, Vampire | ||
// --> | ||
if (attribute.startsWith("combat_damage")) { | ||
return new Element(uPlayer.combatDamageFactor()).getAttribute(attribute.fulfill(1)); | ||
} | ||
|
||
return null; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
bukkit/src/main/java/com/denizenscript/depenizen/bukkit/support/plugins/VampireSupport.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,11 @@ | ||
package com.denizenscript.depenizen.bukkit.support.plugins; | ||
|
||
import com.denizenscript.depenizen.bukkit.extensions.vampire.VampirePlayerExtension; | ||
import com.denizenscript.depenizen.bukkit.support.Support; | ||
import net.aufdemrand.denizen.objects.dPlayer; | ||
|
||
public class VampireSupport extends Support { | ||
public VampireSupport() { | ||
registerProperty(VampirePlayerExtension.class, dPlayer.class); | ||
} | ||
} |
Binary file not shown.
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