Allow player place only one sponge block in a area

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

AIGLE25

New Member
Nov 8, 2023
6
0
1
18
Category: block place

Suggested name: anti place too much sponge

What I want:


Hello , i want a script that only allow one sponge block per player to be placed in a area (worldguard or something else) and as long as he does not break the sponge he placed, he will not be able to place another sponge.


Ideas for permissions: maybe sponge.place

When I'd like it by: 7 day if possible

i have skript 2.6.5 and 1.8.8 paper
 
Last edited:
Category: block place

Suggested name: anti place too much sponge

What I want:


Hello , i want a script that only allow one sponge block per player to be placed in a area (worldguard or something else) and as long as he does not break the sponge he placed, he will not be able to place another sponge.


Ideas for permissions: maybe sponge.place

When I'd like it by: 7 day if possible

i have skript 2.6.5 and 1.8.8 paper
First, check if the block placed is in a region, then assign a variable to the player's uuid. Check if it's set, if it isn't (Player hasn't placed a block), have it set to true. Then when the code is run again, it will cancel the event and prevent a block from being placed.
Code:
on place of sponge:
   if event-block is in region "sponge_test":
      set {_p} to player
      set {_u} to {_p}'s uuid
      if {sponge::%{_u}%} isn't set:
         set {sponge::%{_u}%} to true
      else:
         cancel event
 
here you go, doesn't require any dependencies (except worldguard), it handles overlapping regions, duplicate region names in different worlds, has sponge.place permission, and prevents players from destroying sponges they didn't place
 

Attachments

  • antisponge.sk
    1.9 KB · Views: 19
  • Like
Reactions: AIGLE25
here you go, doesn't require any dependencies (except worldguard), it handles overlapping regions, duplicate region names in different worlds, has sponge.place permission, and prevents players from destroying sponges they didn't place
thats working , thank you :emoji_slight_smile: but idk if you can detect if someone is bridging with sponge ? because i need it do disallow player bridging with sponge

i have a idea , if the player place a sponge block on a region , break the block like if a player break it.

maybe i should create a new skript request ?
 
Last edited:
regarding detecting bridging, the easiest fix would probably be not allowing players to place sponge above air

block break animation can be done using this: https://docs.skunity.com/syntax/search/id:9396
then once the animation finishes, delete the block

i'm busy for a few days so i don't think i'll have time to edit the skript for you
 
regarding detecting bridging, the easiest fix would probably be not allowing players to place sponge above air

block break animation can be done using this: https://docs.skunity.com/syntax/search/id:9396
then once the animation finishes, delete the block

i'm busy for a few days so i don't think i'll have time to edit the skript for you
ok i found how to do "not allowing players to place sponge above air and sponges" but when i put if "%region at player%" contains "test": the region check doesn't work
 
ok i found how to do "not allowing players to place sponge above air and sponges" but when i put if "%region at player%" contains "test": the region check doesn't work
it is %regions at player% not region, and it returns a list because there could be multiple regions at player
try something like
Code:
set {_regions::*} to regions at player
loop {_regions::*}:
    if loop-value contains "test":
 
it is %regions at player% not region, and it returns a list because there could be multiple regions at player
try something like
Code:
set {_regions::*} to regions at player
loop {_regions::*}:
    if loop-value contains "test":
i tried

on place of sponge:
if event-block is in region "test":
if block under event-location is air or sponge:
set {_regions::*} to regions at player
loop {_regions::*}:
if loop-value contains "test":
cancel event
and some modification but no one was good
1699813604085.png
 
Last edited: