Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/main/kotlin/de/hglabor/plugins/kitapi/implementation/Dieb.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.hglabor.plugins.kitapi.implementation

import de.hglabor.plugins.kitapi.cooldown.MultipleUsesCooldownProperties
import de.hglabor.plugins.kitapi.cooldown.applyCooldown
import de.hglabor.plugins.kitapi.kit.Kit
import org.bukkit.Material
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack

class DiebProperties : MultipleUsesCooldownProperties(3, 45000)

val Dieb = Kit("Dieb", ::DiebProperties) {
displayMaterial = Material.COAL

clickOnEntityItem(ItemStack(Material.COAL)) {
val rightClicked = it.rightClicked as? Player ?: return@clickOnEntityItem
applyCooldown(it) {
}
rightClicked.inventory.removeItem(ItemStack(Material.MUSHROOM_SOUP))
it.player.inventory.addItem(ItemStack(Material.MUSHROOM_SOUP))
}
}
20 changes: 20 additions & 0 deletions src/main/kotlin/de/hglabor/plugins/kitapi/implementation/Farmer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package de.hglabor.plugins.kitapi.implementation

import de.hglabor.plugins.kitapi.kit.Kit
import de.hglabor.plugins.kitapi.kit.KitProperties
import org.bukkit.Material
import org.bukkit.event.block.BlockBreakEvent


class FarmerProperties : KitProperties()

val Farmer = Kit("Farmer", ::FarmerProperties) {
displayMaterial = Material.WHEAT

kitPlayerEvent<BlockBreakEvent>({ it.player }) { it, _ ->
for (i in it.block.drops.toList()) {
it.block.drops.add(i)
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package de.hglabor.plugins.kitapi.implementation

import de.hglabor.plugins.hungergames.SecondaryColor
import de.hglabor.plugins.hungergames.game.GameManager
import de.hglabor.plugins.hungergames.game.phase.phases.LobbyPhase
import de.hglabor.plugins.kitapi.cooldown.CooldownProperties
import de.hglabor.plugins.kitapi.cooldown.applyCooldown
import de.hglabor.plugins.kitapi.kit.ClickOnEntityKitItem
import de.hglabor.plugins.kitapi.kit.Kit
import de.hglabor.plugins.kitapi.kit.KitProperties
import net.axay.kspigot.extensions.events.isRightClick
import net.axay.kspigot.extensions.geometry.times
import net.axay.kspigot.items.itemStack
import net.axay.kspigot.items.meta
import net.axay.kspigot.items.name
import org.bukkit.Material
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.player.PlayerToggleSneakEvent
import org.bukkit.inventory.ItemStack
import org.bukkit.util.Vector

class KänguruProperties : KitProperties() {
val Vector = 3
}

val Känguru = Kit("Kangaroo", ::KänguruProperties) {
displayMaterial = Material.FIREWORK

clickableItem(ItemStack(Material.FIREWORK)) {
if (!it.action.isRightClick) return@clickableItem
val player = it.player
val velocity = player.velocity
if (!player.isOnGround) return@clickableItem

if (player.isSneaking) {
velocity.x *= 5
velocity.y *= 2
}
else {
velocity.y *= 5
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.util.*

class PerfectProperties : KitProperties() {
val soupsForReward by int(8);
val soupsAsReward by int(5);
val soupsAsReward by int(3);
}

val Perfect = Kit("Perfect", ::PerfectProperties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ val Revive = Kit("Revive", ::ReviveProperties) {
player.addPotionEffects(
listOf(
PotionEffect(PotionEffectType.REGENERATION, 10, 9),
PotionEffect(PotionEffectType.ABSORPTION, 200, 2),
PotionEffect(PotionEffectType.ABSORPTION, 200, 4),
PotionEffect(PotionEffectType.FIRE_RESISTANCE, 800, 0)
)
)
Expand All @@ -42,11 +42,11 @@ val Revive = Kit("Revive", ::ReviveProperties) {
val scaleY = 1
val density = 1.0
var i = 0.0
player.world.playSound(player.location, Sound.ANVIL_BREAK, 3f, 1f)
player.world.playSound(player.location, Sound.FIREWORK_BLAST, 3f, 1f)
while (i < 2 * Math.PI) {
val x = cos(i) * scaleX
val y = sin(i) * scaleY
player.world.playEffect(player.location.clone().add(x, 0, y), Effect.HAPPY_VILLAGER, 15)
player.world.playEffect(player.location.clone().add(x, 0, y), Effect.FIREWORKS_SPARK, 15)
i += density
}
}
Expand Down
85 changes: 85 additions & 0 deletions src/main/kotlin/de/hglabor/plugins/kitapi/implementation/Shabby.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package de.hglabor.plugins.kitapi.implementation

import de.hglabor.plugins.hungergames.event.KitDisableEvent
import de.hglabor.plugins.hungergames.event.KitEnableEvent
import de.hglabor.plugins.hungergames.utils.ChanceUtils
import de.hglabor.plugins.kitapi.kit.Kit
import de.hglabor.plugins.kitapi.kit.KitProperties
import net.axay.kspigot.runnables.taskRunLater
import org.bukkit.Material
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
import org.bukkit.event.entity.EntityDamageByEntityEvent
import org.bukkit.event.player.PlayerItemConsumeEvent
import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType


class ShabbyProperties : KitProperties() {
val effectDuration by int(3)
val effectMultiplier by int(0)
val probability by int(8)
}

val Shabby = Kit("Shabby", ::ShabbyProperties) {
displayMaterial = Material.FERMENTED_SPIDER_EYE

kitPlayerEvent<EntityDamageByEntityEvent>({ it.damager as? Player }) { it, damager ->
val target = (it.entity as? LivingEntity) ?: return@kitPlayerEvent
if (!ChanceUtils.roll(kit.properties.probability)) return@kitPlayerEvent
target.addPotionEffect(
PotionEffect(
PotionEffectType.BLINDNESS,
this.kit.properties.effectDuration * 20,
this.kit.properties.effectMultiplier
)
)
}
kitPlayerEvent<EntityDamageByEntityEvent>({ it.damager as? Player }) { it, damager ->
val target = (it.entity as? LivingEntity) ?: return@kitPlayerEvent
if (!ChanceUtils.roll(kit.properties.probability)) return@kitPlayerEvent
target.addPotionEffect(
PotionEffect(
PotionEffectType.SLOW,
this.kit.properties.effectDuration * 20,
this.kit.properties.effectMultiplier
)
)
}
kitPlayerEvent<EntityDamageByEntityEvent>({ it.damager as? Player }) { it, damager ->
val target = (it.entity as? LivingEntity) ?: return@kitPlayerEvent
if (!ChanceUtils.roll(kit.properties.probability)) return@kitPlayerEvent
target.addPotionEffect(
PotionEffect(
PotionEffectType.POISON,
this.kit.properties.effectDuration * 20,
this.kit.properties.effectMultiplier
)
)
}
kitPlayerEvent<EntityDamageByEntityEvent>({ it.damager as? Player }) { it, damager ->
val target = (it.entity as? LivingEntity) ?: return@kitPlayerEvent
if (!ChanceUtils.roll(kit.properties.probability)) return@kitPlayerEvent
target.addPotionEffect(
PotionEffect(
PotionEffectType.WEAKNESS,
this.kit.properties.effectDuration * 20,
this.kit.properties.effectMultiplier
)
)
}
kitPlayerEvent<EntityDamageByEntityEvent>({ it.damager as? Player }) { it, damager ->
val target = (it.entity as? LivingEntity) ?: return@kitPlayerEvent
if (!ChanceUtils.roll(kit.properties.probability)) return@kitPlayerEvent
target.addPotionEffect(
PotionEffect(
PotionEffectType.WITHER,
this.kit.properties.effectDuration * 20,
this.kit.properties.effectMultiplier
)
)
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.bukkit.util.Vector
class SpiderProperties : CooldownProperties(20000) {
val effectDuration by int(3)
val effectMultiplier by int(1)
val probability by int(30)
val probability by int(20)

val spidernetRadius by int(5)
val spidernetHeight by int(5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SpongeProperties : MultipleUsesCooldownProperties(15, 30000) {
val poisonDuration by int(60)
val poisonAmplifier by int(60)
val spongesOnKill by int(2)
val spongesOnStart by int(12)
val spongesOnStart by int(13)
val spongeBoost by double(1.0)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.bukkit.potion.PotionEffectType
class SquidProperties : KitProperties() {
val effectDuration by int(3)
val effectMultiplier by int(0)
val probability by int(30)
val probability by int(15)
}

val Squid = Kit("Squid", ::SquidProperties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ val Viking = Kit("Viking", ::VikingProperties) {
kitPlayerEvent<EntityDamageByEntityEvent>({ it.damager as? Player }) { it, player ->
when (player.itemInHand.type) {
Material.DIAMOND_AXE, Material.WOOD_AXE, Material.IRON_AXE, Material.STONE_AXE ->
it.damage += 1.5
it.damage += 2.0
else -> {}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/de/hglabor/plugins/kitapi/kit/KitManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ object KitManager {
Anchor,
Automatic,
Blink,
//Claw,
//Counter,
Dieb,
Digger,
Domino,
Endermage,
Farmer,
Gladiator,
Känguru,
Lumberjack,
Magma,
Nightshade,
Expand All @@ -23,6 +27,7 @@ object KitManager {
Redstoner,
//Relaxo,
Revive,
Shabby,
Smoothyy,
Snail,
Spider,
Expand Down