options: # If the PvP modes should affect non-player entities: pvp-mode-entities-involved: true function setPvPMode(world: world, type: text): if {_type} is "normal": set {pvpmode::%{_world}%} to "normal" else if {_type} is "combo" or "nohitdelay": set {pvpmode::%{_world}%} to "nohitdelay" else if {_type} is "nodamage": set {pvpmode::%{_world}%} to "nodamage" function PvPModeChooseType(p: player, type: text): set {chosenpvpmode::%{_p}%} to {_type} function PvPModeChooseWorld(p: player, world: object): set {chosenpvpworld::%{_p}%} to {_world} effect PvPMode choose type for %player%: trigger: delay effect set {_p} to expr-1 delete {chosenpvpmode::%{_p}%} open virtual chest inventory with 1 row named "&aChoose type:" to {_p} make gui slot 2 of {_p} with iron sword named "&aNormal" with lore "&7This mode is to reset back to||&7normal Minecraft PvP" to close then run function PvPModeChooseType({_p}, "normal") make gui slot 4 of {_p} with diamond sword named "&aNoHitDelay" with lore "&7This mode removes the hit ||&7delay, this will cause every click ||&7on an entity to be a hit" to close then run function PvPModeChooseType({_p}, "nohitdelay") make gui slot 6 of {_p} with stick named "&aNoDamage" with lore "&7This mode removes damage from ||&7hitting players, but will keep the ||&7knockback and animation part." to close then run function PvPModeChooseType({_p}, "nodamage") while name of {_p}'s current inventory is "&aChoose type:": wait 1 tick continue effect PvPMode choose world for %player%: trigger: delay effect set {_p} to expr-1 delete {chosenpvpworld::%{_p}%} open virtual chest inventory with 3 row named "&aChoose world:" to {_p} make gui slot 0 of {_p} with nether star named "&eAll" with lore "&7Click this to select all worlds" to close then run function PvPModeChooseWorld({_p}, "all") set {_i} to 1 loop all worlds: if "%loop-value.getEnvironment()%" is "NORMAL": set {_item} to grass else if "%loop-value.getEnvironment()%" is "NETHER": set {_item} to netherrack else if "%loop-value.getEnvironment()%" is "THE_END": set {_item} to end stone else: set {_item} to stone make gui slot {_i} of {_p} with {_item} named "&e%loop-value%" with lore "&7Current PvP mode: &c%{pvpmode::%loop-value%} ? ""normal""%" to close then run function PvPModeChooseWorld({_p}, loop-value) add 1 to {_i} while name of {_p}'s current inventory is "&aChoose world:": wait 1 tick continue command /setpvpmode [] []: aliases: /pvpmode permission: setpvpmode trigger: if arg-1 is set: if arg-1 is "all": set {_world} to "all" else if arg-1 parsed as a world is set: set {_world} to arg-1 parsed as a world else: message "&a%arg-1% &cis not a valid world" stop else: PvPMode choose world for player set {_world} to {chosenpvpworld::%player%} delete {chosenpvpworld::%player%} if {_world} is not set: stop if arg-2 is set: if arg-2 is not "normal", "combo", "nohitdelay" or "nodamage": message "&cAvailable PvP modes: &anormal&c, &anohitdelay (AKA combo) &cand &anodamage" stop else: set {_type} to arg-2 else: PvPMode choose type for player set {_type} to {chosenpvpmode::%player%} delete {chosenpvpmode::%player%} if {_type} is not set: stop if {_world} is "all": loop all worlds: setPvPMode(loop-value, {_type}) message "&aPvP mode of all worlds set to &c%{_type}%" else: setPvPMode({_world}, {_type}) message "&aPvP mode of world &c%{_world}% &aset to &c%{_type}%" on damage: damage cause is attack or ("projectile" parsed as a damage cause) set {_e} to victim if {@pvp-mode-entities-involved} is false: {_e} is not a player stop set {_world} to world of {_e} {pvpmode::%{_world}%} is set if {pvpmode::%{_world}%} is "nohitdelay": {_e}.setMaximumNoDamageTicks(0) else: {_e}.setMaximumNoDamageTicks(20) if {pvpmode::%{_world}%} is "nodamage": set damage to 0