I'm making a faction plugin for my anarchy server that doesn't have land claims, you can do /fcreate [<text>] to make a faction, but I want to check if that faction name has been taken already so there aren't 2 identical factions.
I tried using a list variable to store all of the faction names, but it didn't work
can someone please help?
Also when someone deletes a faction(/fdelete) and someone is offline and in that faction I would like to have it remove all the faction variables of the players by storing them in a list like {factions::%uuid of player(owner)%::layers::*}
I tried using a list variable to store all of the faction names, but it didn't work
can someone please help?
Also when someone deletes a faction(/fdelete) and someone is offline and in that faction I would like to have it remove all the faction variables of the players by storing them in a list like {factions::%uuid of player(owner)%::layers::*}
Code:
command /fcreate [<text>]:
description: Creates a faction
executable by: players
trigger:
if {factions::factionlist::*} does not contain arg-1:
add arg-1 to {factions::factionlist::*}
if {factions::%uuid of player%::hasfaction} is not 1:
if arg-1 is not "<none>":
if arg-1 does not contain " ":
set {factions::%uuid of player%::factionlocation} to location of player
set {factions::%uuid of player%::factionname} to arg-1
set {factions::%uuid of player%::isowner} to 1
set {factions::%uuid of player%::hasfaction} to 1
message "Created the faction <green>%arg-1%<reset> and set its home to your location"
else:
message "For technical reasons you can't use spaces in your faction, sorry!"
else:
message "For technical reasons you can't name your faction <none>, sorry!"
else:
message "You are already in a faction"
else:
message "That faction name is taken, sorry!"
command /invite [<player>]:
trigger:
if {factions::%uuid of player%::hasfaction} is 1:
if {factions::%uuid of player%::isowner} is 1:
message "you invited %arg-1% to join %{factions::%uuid of player%::factionname}%"
message "%player% invites you to join their faction, %{factions::%uuid of player%::factionname}%","to join type /join %{factions::%uuid of player%::factionname}%" to arg-1
set {factions::%uuid of arg-1%::currentinvite} to {factions::%uuid of player%::factionname}
set {factions::%uuid of arg-1%::invitelocation} to {factions::%uuid of player%::factionlocation}
command /join [<text>]:
trigger:
if {factions::%uuid of player%::currentinvite} is not "<none>":
if {factions::%uuid of player%::hasfaction} is not 1:
if arg-1 is {factions::%uuid of player%::currentinvite}:
set {factions::%uuid of player%::factionname} to {factions::%uuid of player%::currentinvite}
set {factions::%uuid of player%::factionlocation} to {factions::%uuid of player%::invitelocation}
set {factions::%uuid of player%::hasfaction} to 1
set {factions::%uuid of player%::isowner} to 0
set {factions::%uuid of player%::currentinvite} to "<none>"
message "succsefully joined %{factions::%uuid of player%::factionname}%"
else:
message "you are already in a faction"
else:
message "you are not currently invited to any factions"
command /test:
trigger:
message "%{factions::%uuid of player%::currentinvite}%"
command /fdelete:
description: Deletes your faction
executable by: players
trigger:
if {factions::%uuid of player%::hasfaction} is 1:
if {factions::%uuid of player%::isowner} is 1:
message "are you sure you want to <red><bold>delete<reset> %{factions::%uuid of player%::factionname}%?"
message "this action <red><bold>cannot be undone<reset>"
message "type /fconfirm delete <faction name> if you are sure"
else:
message "you aren't the owner of this faction!"
else:
message "you don't have a faction"
command /fconfirm [<text>] [<text>]:
description: Confirms the deletion of your faction
executable by: players
trigger:
if "%arg-1%" is "delete":
if {factions::%uuid of player%::hasfaction} is 1:
if {factions::%uuid of player%::isowner} is 1:
if "%arg-2%" is {factions::%uuid of player%::factionname}:
set {factions::%uuid of player%::hasfaction} to 0
set {factions::%uuid of player%::factionname} to "<none>"
set {factions::%uuid of player%::isowner} to 0
set {factions::%uuid of player%::factionlocation} to "<none>"
else:
message "thats not your faction name try %{factions::%uuid of player%::factionname}%"
else:
message "you don't own %{factions::%uuid of player%::factionname}%"
else:
message "you aren't in a faction"
command /fleave:
trigger:
if {factions::%uuid of player%::hasfaction} is 1:
if {factions::%uuid of player%::isowner} is not 1:
message "succsefully left %{factions::%uuid of player%::factionname}%"
set {factions::%uuid of player%::isowner} to 0
set {factions::%uuid of player%::factionname} to "<none>"
set {factions::%uuid of player%::factionlocation} to "<none>"
set {factions::%uuid of player%::hasfaction} to 0
else:
message "you are the owner of %{factions::%uuid of player%::factionname}% not a member, do /fdelete instead"
else:
message "you aren't in a faction"
command /fsethome:
description: Sets your faction home
executable by: players
trigger:
if {factions::%uuid of player%::hasfaction} is 1:
if {factions::%uuid of player%::isowner} is 1:
if "%block below player%" is not "air" or "lava":
set {factions::%uuid of player%::faction location} to location of player
message "set <lime>%{factions::%uuid of player%::factionname}%'s<reset> home to <grey>%location of player%<reset>"
else:
message "you arent standing in a safe location"
command /fhome:
description: Teleports you to your faction home
executable by: players
trigger:
if {factions::%uuid of player%::hasfaction} is 1:
message "Teleporting you to %{factions::%uuid of player%::factionname}%'s home"
teleport player to {factions::%uuid of player%::factionlocation}
command /finfo:
description: Prevides you with information about your current faction
executable by: players
trigger:
if {factions::%uuid of player%::hasfaction} is 1:
message "name: %{factions::%uuid of player%::factionname}%"
message "location: %{factions::%uuid of player%::factionlocation}%"
if {factions::%uuid of player%::isowner} is 1:
message "You are the owner of %{factions::%uuid of player%::factionname}%"
else:
message "you are a member of %{factions::%uuid of player%::factionname}%"
else:
message "you aren't in a faction"
message "this skript was written by mrclipse"
on chat:
if {factions::%uuid of player%::hasfaction} is 1:
cancel event
send "[%{factions::%uuid of player%::factionname}%] <%player%> %message%" to all players
on join:
set {factions::%uuid of player%::currentinvite} to "<none>"
command /fhelp:
trigger:
message "<green>/fcreate <faction name><reset> >> <green>creates a faction with the name specified and sets the home to your location<reset>"
message "<green>/fdelete<reset> >> <green>prompts you with confirmation to delete your faction<reset>"
message "<green>/fsethome<reset> >> <green>sets your faction home to your current location<reset>"
message "<green>/fhome<reset> >> <green>teleports you to your factions home<reset>"
message "<green>/finfo<reset> >> <green>shows info on the faction you are in<reset>"
message "<green>/fhelp<reset> >> <green>shows you the commands of mrclipse's faction plugin, you're looking at it right now!<reset>"
command /fdebug:
trigger:
message "%{factions::%uuid of player%::factionname}% %{factions::%uuid of player%::hasfaction}% %{factions::%uuid of player%::isowner}% %{factions::%uuid of player%::currentinvite}% %{factions::%uuid of player%::factionlocation}%"
Last edited: