Skip to content

Modarate Changes!

Latest

Choose a tag to compare

@coffeerequiredev coffeerequiredev released this 18 May 18:17
· 1 commit to main since this release

Added world guard snipset
effect
effect get [a] flag %string% [value] from [region] %string% in [world] %string% [1¦[(2¦with response|without)]] [and] save [it] in %-object% for %player%:

Usage
Example

i.e. /getFlag pvp myRegion world

command getFlag [<string>] [<string>] [<string>]:
    trigger:
        get flag arg-1 from arg-2 in arg-3 save in {_flagResult} for player
        broadcast "My flag %arg-1% is valued as %{_flagResult}%"

without

CASE 1A ?: get flag "flag" from region "region" in world "world" without and save in "save_place" for player

CASE 2A ?: get flag "flag" from "region" in "world" and save in {_s} for player

CASE 3A ?: get flag "flag" from "region" in "world" save in {_s} for player

with

CASE 1B ?: get flag "flag" from region "region" in world "world" with response and save in {_s} for player

CASE 2B ?: get flag "flag" from "region" in "world" with response and save in {_s} for player

CASE 3B ?: get flag "flag" from "region" in "world" with response save in {_s} for player

Center snipset

import:
  org.bukkit.map.MinecraftFont

function getWidth(text: string) :: number:
  set {_s::*} to {_text} split at "&l"
  loop {_s::*}:
    add (MinecraftFont.Font.getWidth(unformatted loop-value) + (size of (loop-value split at "")) - (size of loop-value split at " ")) to {_result} if mod(loop-index parsed as integer, 2) = 0
    add MinecraftFont.Font.getWidth(unformatted loop-value) to {_result} if mod(loop-index parsed as integer, 2) = 1
  return {_result}

# 154 for chat, 127 for motd
function centeredText(text: string, lenght: integer) :: string:
  while {_compensated} ? 0 < ({_lenght} - (getWidth({_text}) / 2)):
    set {_return} to "%{_return} ? ""%&r "
    add (getWidth(" ") + 1) to {_compensated}
  return "%{_return}%%{_text}%"


function titleCenter(s: string) :: string:
    if "%{_s}%" contains "ι":
        replace all "ι" in {_s} with "i"
        set {_c} to centeredText({_s}, 154)
        replace all "i" in {_c} with "ι"    
        return {_c}

Full Changelog: 4.0...4.1