KtSkript - Endless customizations for your server

First, writing in caps doesn’t help at all.

Discord seems to be a better place to discuss your issue further. https://discord.gg/YrecCft

Or, an alternative - although it would more annoying - also depending on if KtSkript supports it or not - you could use GriefPrevention claim UUIDs. GriefPrevention is public (I think? I have a plugin that works off it, so I assume so…) and can be incorporated with getClaimAtPlayer, using the claim’s UUID number to specify the area the player is in, using admin claims mode to claim areas for server builds/hubs/etc.

1 Like

KtSkript can do everything a normal plugin can do, apart from NMS (which isn’t recommended anyway).

Getting damage from biomes

Script on GitHub

val damagingBiomes = listOf(BiomeTypes.TAIGA, BiomeTypes.TAIGA_HILLS)

val damageSource = DamageSource.builder()
  .type(DamageTypes.CUSTOM)
  .build()

Task.builder()
  .intervalTicks(20 * 10)
  .execute { task ->
    Server.onlinePlayers
      .filter { player ->
        player.location.hasBiome() && player.location.biome in damagingBiomes
      }
      .forEach { player ->
        player.damage(1.0, damageSource)
      }
  }
  .submit(KtSkript)

This script damages players every 20 * 10 ticks (10 seconds) by 1.0 (half a heart) when being in the taiga or taiga hills. You can add more biomes from here: BiomeTypes.

Can I move this plug-in to the MCBBS forum in China?

I will show the original author and the original page.

If you like, I will send you the link of the web page after the successful removal.

I will not provide other download addresses.

Yes, you can do that. Please provide Releases · randombyte-developer/kt-skript · GitHub as the download link. It always shows the latest release.

No problem. I’ll do what you say.

v1.2 released!

Download here

Changes:

  • Added more scheduler utils
  • Added server start/stop events
  • Moved/Extracted duration and date serialization
  • Added getNearbyEntities

Regular broadcasts & vote commands

Just some simple messages with URLs in them, modify them as you like.

Broadcast script on GitHub

Intervals documentation: Here

onEvery("5m") {
  val message = "&4Please vote for this server here: ".t +
    "&e[VOTE]".t.action(TextActions.openUrl(URL("https://www.example.com")))
  message.broadcast()
}

Vote command script on GitHub

registerCommand("website") {
  action(onlyPlayers = true) {
    val text = "&2This is a link to our website: ".t +
      "&e[Click here]".t.underline().action(TextActions.openUrl(URL("https://www.example.com")))
    text.sendTo(player)
  }
}

registerCommand("vote") {
  action(onlyPlayers = true) {
    val text = "Vote-Link: ".t +
      "&b[Vote]".t.underline().action(TextActions.openUrl(URL("https://www.example.com")))
    text.sendTo(player)
  }
}

Hello, I am a Chinese.

My English is poor.

Communication requires the help of translation software.

Your plugin is very good~!

But I need an instance because I can’t download the instance file in China.

I hope you can send some examples to my mailbox

307198081 @qq.com

------ a loyal fan

v1.2.1 released!

Download here

Changes:

  • Fixed a bug in the scheduler / tasks module

v1.3.0 released!

Download here

Changes:

  • Added BigDecimal and EconomyService tools
  • Improved the scheduler module

Empty server commands

This simple script allows you to make the server automatically run some commands when the server is empty for a time period (here 5 minutes but of course you can change that).

var delayTask: Task? = null

onPlayerLeave {
  // the currently leaving player is at the time of this check technically still on the server
  if (Server.onlinePlayers.size == 1) {
    delayTask = delay("5m") {
      Server.console.executeCommand("say Yep, this server is empty!")
    }
  }
}

onPlayerJoin {
  delayTask?.cancel()
}

See it on GitHub

v1.3.1 released!

Download here

Changes:

  • Fixed a small inconvenience when creating commands

Docs

New docs for handling with the economy helpers are now available here: Economy docs


Tax collection script

This simple script allows you calculate taxes for one money pool (e.g. the pool your lottery uses). The taxes are then moved to another account. This script just shows how to deal with virtual accounts. Also see the new economy docs on how to use player accounts: Docs

val taxPercentage = 0.19

onEvery("1h") {
  val account = EconomyService.getAccount("bank-account")

  // calculate tax
  val tax = account.balance * taxPercentage
  // withdraw tax
  account.balance -= tax
  // deposit tax somewhere else
  EconomyService.getAccount("some-other-account").balance += tax

  "${tax.toInt()} coins just got moved somewhere else!".t.broadcast()
}

See it on GitHub