Skip to content
Open
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
114 changes: 99 additions & 15 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,104 @@
Copyright (c) 2011 Alexander Overvoorde
PvP Token System (Complete Function File)

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Includes: Token effects, upgrades, transformation, cooldowns, inventory logic

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
Initialize objectives

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
scoreboard objectives add tokenCooldown dummy scoreboard objectives add hasToken dummy scoreboard objectives add upgradeReady dummy scoreboard objectives add deaths dummy

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
Main Tick Function

3. This notice may not be removed or altered from any source
distribution.
execute as @a[scores={hasToken=1}] run function tokens:token_effects/apply execute as @a[scores={upgradeReady=1}] run function tokens:upgrade

Death Handling (Trigger)

execute as @a[scores={deaths=1}] run function tokens:death_trigger

Token Effects (apply.mcfunction)

execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"fire"}}}] run function tokens:token_effects/fire execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void"}}}] run function tokens:token_effects/void execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"lightning"}}}] run function tokens:token_effects/lightning execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"rain"}}}] run function tokens:token_effects/rain

Repeat for all 15 tokens...

Example: Fire Token Effect

execute as @p at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Particle:"flame",Radius:1.5f,Duration:20} execute as @p at @s run summon minecraft:fireball ~ ~1 ~ {direction:[0.0,0.0,0.0],power:[0.0,0.0,0.0]}

Example: Void Token Effect

execute as @p at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Particle:"blackstone",Radius:2.0f,Duration:20}

Example: Lightning Token Effect

execute as @p at @s run summon minecraft:lightning_bolt ~ ~ ~

Example: Rain Token Effect

execute as @p at @s run weather rain

Upgrade Function

execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void"}}}] run replaceitem entity @s weapon.mainhand minecraft:carrot_on_a_stick{display:{Name:'{"text":"Void Token+"}'},CustomModelData:2001,tag:{token:"void_upgraded"}} scoreboard players set @p upgradeReady 0

Transformation Function

execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void"}}}] run replaceitem entity @s weapon.mainhand minecraft:diamond_sword{display:{Name:'{"text":"Void Sword"}'},CustomModelData:3001,tag:{token:"void_sword"}}

Revert Function

execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void_sword"}}}] run replaceitem entity @s weapon.mainhand minecraft:carrot_on_a_stick{display:{Name:'{"text":"Void Token"}'},CustomModelData:1001,tag:{token:"void"}}

Death Trigger Function

give @s minecraft:carrot_on_a_stick{display:{Name:'{"text":"Stolen Token"}'},CustomModelData:9001,tag:{token:"stolen"}} 1 scoreboard players set @s hasToken 1 scoreboard players set @s deaths 0

# PvP Token System (Complete Function File)
# Includes: Token effects, upgrades, transformation, cooldowns, inventory logic

# Initialize objectives
scoreboard objectives add tokenCooldown dummy
scoreboard objectives add hasToken dummy
scoreboard objectives add upgradeReady dummy
scoreboard objectives add deaths dummy

# Main Tick Function
execute as @a[scores={hasToken=1}] run function tokens:token_effects/apply
execute as @a[scores={upgradeReady=1}] run function tokens:upgrade

# Death Handling (Trigger)
execute as @a[scores={deaths=1}] run function tokens:death_trigger

# Token Effects (apply.mcfunction)
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"fire"}}}] run function tokens:token_effects/fire
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void"}}}] run function tokens:token_effects/void
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"lightning"}}}] run function tokens:token_effects/lightning
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"rain"}}}] run function tokens:token_effects/rain
# Repeat for all 15 tokens...

# Example: Fire Token Effect
execute as @p at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Particle:"flame",Radius:1.5f,Duration:20}
execute as @p at @s run summon minecraft:fireball ~ ~1 ~ {direction:[0.0,0.0,0.0],power:[0.0,0.0,0.0]}

# Example: Void Token Effect
execute as @p at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Particle:"blackstone",Radius:2.0f,Duration:20}

# Example: Lightning Token Effect
execute as @p at @s run summon minecraft:lightning_bolt ~ ~ ~

# Example: Rain Token Effect
execute as @p at @s run weather rain

# Upgrade Function
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void"}}}] run replaceitem entity @s weapon.mainhand minecraft:carrot_on_a_stick{display:{Name:'{"text":"Void Token+"}'},CustomModelData:2001,tag:{token:"void_upgraded"}}
scoreboard players set @p upgradeReady 0

# Transformation Function
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void"}}}] run replaceitem entity @s weapon.mainhand minecraft:diamond_sword{display:{Name:'{"text":"Void Sword"}'},CustomModelData:3001,tag:{token:"void_sword"}}

# Revert Function
execute as @p if entity @s[nbt={SelectedItem:{tag:{token:"void_sword"}}}] run replaceitem entity @s weapon.mainhand minecraft:carrot_on_a_stick{display:{Name:'{"text":"Void Token"}'},CustomModelData:1001,tag:{token:"void"}}

# Death Trigger Function
give @s minecraft:carrot_on_a_stick{display:{Name:'{"text":"Stolen Token"}'},CustomModelData:9001,tag:{token:"stolen"}} 1
scoreboard players set @s hasToken 1
scoreboard players set @s deaths 0