Skip to content

Commit

Permalink
Added Vampire support
Browse files Browse the repository at this point in the history
For #190
  • Loading branch information
Mwthorn committed May 15, 2018
1 parent 84544a8 commit 511df90
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Supported Plugins: (And the sources we acquired Jar files from.)
- TerrainControl (https://www.spigotmc.org/resources/terraincontrol.2214/)
- Towny (http://towny.palmergames.com/)
- TownyChat (http://towny.palmergames.com/)
- Vampire (https://www.spigotmc.org/resources/vampire.1906/)
- Vault (http://dev.bukkit.org/bukkit-plugins/vault/)
- Votifier (http://dev.bukkit.org/bukkit-plugins/votifier/)
- WorldEdit (https://dev.bukkit.org/bukkit-plugins/worldedit/)
Expand Down
7 changes: 7 additions & 0 deletions bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/Factions.jar</systemPath>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>Vampire</artifactId>
<version>2.13.7</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/Vampire.jar</systemPath>
</dependency>
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>MassiveCore</artifactId>
Expand Down
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;
}
}
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 added bukkit/src/main/resources/lib/Vampire.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors: ['Morphan1', 'DenizenScript team']
version: ${project.version} (build ${BUILD_NUMBER})
main: com.denizenscript.depenizen.bukkit.DepenizenPlugin
depend: [Denizen]
softdepend: [mcMMO, BattleNight, Towny, Factions, Votifier, Jobs, Heroes, pvparena, WorldEdit, WorldGuard, Essentials, pvpstats, HyperConomy, SkillAPI, Prism, TerrainControl, PlotMe, PlotSquared, SimpleClans, MobArena, ASkyBlock, NoCheatPlus, MythicMobs, Sentinel, Shopkeepers, GriefPrevention, Quests, PlaceholderAPI, Residence, dtlTraders, AreaShop, LibsDisguises, OpenTerrainGenerator, PlayerPoints, LuckPerms, EffectLib, BossShop]
softdepend: [mcMMO, BattleNight, Towny, Factions, Votifier, Jobs, Heroes, pvparena, WorldEdit, WorldGuard, Essentials, pvpstats, HyperConomy, SkillAPI, Prism, TerrainControl, PlotMe, PlotSquared, SimpleClans, MobArena, ASkyBlock, NoCheatPlus, MythicMobs, Sentinel, Shopkeepers, GriefPrevention, Quests, PlaceholderAPI, Residence, dtlTraders, AreaShop, LibsDisguises, OpenTerrainGenerator, PlayerPoints, LuckPerms, EffectLib, BossShop, Vampire]

commands:
depenizen:
Expand Down

0 comments on commit 511df90

Please sign in to comment.