#help-development

1 messages · Page 1811 of 1

drowsy helm
#

why not just get points/30

#

that will give you level

#

then you only have to work with 1 number rather than level and exp

wide solstice
#

Anyone have a large open source project where they used the cloud command framework? I'm looking for some starting points on how to use it, I've looked at their documentation but I'd like a real-world example.

quaint mantle
#

It's not a big one but this should explain some things 🙂

wide solstice
#

Thanks!

quaint mantle
#

I've also made a pr to their repo that adds bungee and velocity support if you are looking to support multiple platforms

vapid inlet
#

I bought a plugin but it does not appear, what do I do?

quaint mantle
#

Mind elaborate a bit more ?

vapid inlet
#

¿?

#

I bought a plugin about 20 minutes ago and it still does not appear in my account

quaint mantle
#

Oh okay can't help with that :p

vapid inlet
#

@vagrant stratus

upper niche
#

so i just tried to update from spigot 1.17 to 1.18
i use eclipse
and after running buildtools and it gave spigot-1.18.jar and changed the referenced libaries to 1.18 instead of 1.17 eclipse is insisting that any import starting with org.bukkit doesnt exist
any ideas what im doing wrong?

drowsy helm
#

Use maven itll make your life much easier

pastel stag
#

If there are formatting problems they can be ignored I’m coding at work in notepad.exe lol will move to an ide when I get home if this is proper

glossy scroll
#

?paste

undone axleBOT
drowsy helm
#

you need to declare the iterator type iirc

#

why not just use a for loop?

#

and you also have to use iterator.next()

#

Block.getLocation() wont work

pastel stag
#

So blocklist returns a List of Block objects right so iterator<Block> ?

drowsy helm
#

yeah

#
Iterator<Block> it = blocklist.iterator();
while( it.hasNext()){
  Block b = it.next();  
  //do stuff
}```
pastel stag
#

Ah ok

drowsy helm
#

but thats just a harder way of doign

for(Block block : blocklist){

}```
#

does exactly the same thing

pastel stag
#

So the first way when I read it makes sense but I’ve never used for() before so for now at least ill@stick to doing it the hard way :p

#

Thank you for your help

drowsy helm
#

no worries

buoyant viper
#

never used for before? wtf r u? functional?..

pastel stag
#

Anyone know the event name for Enderman block theft? Lmao

#

Idk what to call it and google doesn’t know what im talking about

drowsy helm
pastel stag
#

Hmmm sweet thanks 🙂

spare marsh
#

Hi, can I get some help with this? I transfered computer and brought all my plugins to this pc but I'm getting this error and I have tried a few things but still nothing 😦

#

as if maven didn't exist

#

but it does

#

I just re installed everyhing including maven

quaint mantle
#

Nvm

#

Can you share full pom

spare marsh
#

Yes

#

There

#

I even tried starting a new project with spigot's plugin. Auto generated pom.xml and same issue

pastel stag
#

On line 2 your gators are not closed

#

Oh nvm I had to zoom over

spare marsh
#

Yeah

#

I tried removing all dependencies and same issues

#

I think its related to maven but don't get what it is

quaint mantle
#

What if you relocate build after getting repo/dependency

spare marsh
#

I have tried making new projects

#

empty ones

#

and the generated pom.xml contains the same issue

quaint mantle
#

Like this <build> after your repo depen stuff.

#

Other then that it all looks good to me

drowsy helm
#

its not a snytax thing its a maven thing

#

is it just the plugins that come up red?

spare marsh
#

Yeah

#

Yes

#

and dependencies at the end

#

do you think it has to do with a network issue or something?

#

Like the firewall perhaps?

dry forum
#

is it possible to loop something x amount of times with a delay? like a bukkit runnable but loop it?

drowsy helm
#

yeah it sounds like that to me

drowsy helm
#
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
    @Override
    public void run() {
        Bukkit.broadcastMessage("This message is shown immediately and then repeated every second");
    }
}, 0L, 20L); //0 Tick initial delay, 20 Tick (1 Second) between repeats```
young knoll
#

runTaskTimer

dry forum
#

thanks

#

is it possible to only look it for example 3 times then stop it? i know with a runnable you can use task.cancel() but i tried to store it in a bukkitrunnable and it corrected to int?

drowsy helm
#

wdym corrected to an int?

young knoll
#

Some return an int and some a task

dry forum
#

nvm i just realised i did task instead

young knoll
#

I believe you can use the int with Bukkit.getScheduler.cancelTask

#

Or something

tender shard
#

lol

spare marsh
#

Man I have no idea how to fix this

spare marsh
tender shard
#

fix what exactly? I just joined

spare marsh
tender shard
#

btw I just had an awesome idea for a new paid plugin

tender shard
#

and

#

?paste your pom

undone axleBOT
tender shard
#

ugh why are you using spigot 1.14 api

spare marsh
#

It was for an old plugin

#

That's not the point xd, the point is I have no idea why it is not loading maven at all

#

like if it was a network issue or something because I even created a 1.18 new plugin and the generated pom.xml has the same issue.

tender shard
#

yeah gimme a minute pls

dry forum
#

still kinda confused with this say i wanted to use

    @Override
    public void run() {
        Bukkit.broadcastMessage("This message is shown immediately and then repeated every second");
    }
}, 0L, 20L); //0 Tick initial delay, 20 Tick (1 Second) between repeats```
to loop something every 20 ticks but i only wanna loop it 3 times then stop it, i cant cancel it inside of the schedular since it says it wouldnt be initialized so?
tender shard
drowsy helm
#

this will refer to the runnable iirc

tender shard
#

run mvn clean -U pls

dry forum
drowsy helm
#

nvm

spare marsh
#

wait nvm

drowsy helm
#
int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(..);
Bukkit.getScheduler().cancelTask(taskID);
``` try that
spare marsh
#

sorry I misunderstood xd

tender shard
#

wrong directory @spare marsh

#

run it where your pom is^^

#

after that try mvn package -U

dry forum
tender shard
#

show the full code pls

tender shard
#

that's totally wrong

drowsy helm
#

you can use the keyword this

tender shard
#

the scheduler will only return an int, which is basically sth like the "process" ID

drowsy helm
#

in your runnable

#

this.cancel() should work

tender shard
#

no you're not understanding the problem @drowsy helm

tender shard
#

@dry forum . You want to assign an int to a variable that was declared to be a instanceof BukkitRunnable

#

that's like saying SomeObjectWhichIsNotANumber thing = 3;

#

do you understand what I mean?

tender shard
#

If yes I explain what you should do instead

drowsy helm
#

all they want to do is run the task 3 times

#

i am understanding it correctly

dry forum
#

kinda but why is that necessary when i can just use task.cancel()

tender shard
dry forum
tender shard
tender shard
#

you are doing it totally wrong 😛

spare marsh
#

Bruh I am a complete noob with this maven stuff so a little help plz xd

tender shard
#

on the right side, you have a section called maven

spare marsh
#

Yeah i see it

tender shard
#

click on the "m" thing and then do this

waxen plinth
#

Don't do new Runnable() {, use a lambda instead

tender shard
#

sorry, not meaning to be rude but

waxen plinth
#

It's one way to do it

tender shard
#

do you know basic java?

waxen plinth
#

Excuse me

tender shard
#

that makes no sense at all

waxen plinth
#

Why not

tender shard
#

you declare an array with a length of one, which a value of "0" at index 0. Then you assign the task ID of the Runnable you are starting into that array

waxen plinth
#

Yes

tender shard
#

I'm wondering, why?

spare marsh
# tender shard that makes no sense at all

bro what does this mean?

Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom```
waxen plinth
#

Yeah ok so you begin by insulting me

tender shard
#

I did not

waxen plinth
#

When I've done that because it's necessary

quaint mantle
tender shard
#

I just asked whether you know what you are actually doing there

waxen plinth
#

Go ahead and try doing it without an array

#

All values referenced by a lambda must be effectively final

#

You can't use a plain int

#

The easiest way around this is using a size 1 int array instead

#

You can also use an AtomicInteger

waxen plinth
tender shard
#

I know that. But you can easily cancel your task by simply running cancel() inside it

waxen plinth
#

You can use runTaskTimer and pass a Consumer<BukkitTask>

waxen plinth
#

Yes I said that

#

I personally just use a wrapper class I made

tender shard
#

O never mind

waxen plinth
#
Task.syncRepeating(t -> {
  ...
  if (someCondition) {
    t.cancel();
  }
}, 1, 1);```
drowsy helm
#

this.cancel works

tender shard
#

I am sorry

drowsy helm
#

if you use a BukkitRunnable

tender shard
#

I was confused myself

#

but nonetheless, I didn't insult you

waxen plinth
#

But yeah doing it with the int array also works fine

#

You did

tender shard
#

I did NOT

waxen plinth
#

You asked "do you even know basic java"

drowsy helm
#

pls shutup

tender shard
#

yes I did ask that but that's not an insult so don't throw a tandrum now pls

drowsy helm
#
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new BukkitRunnable() {
            @Override
            public void run() {
                this.cancel();
            }
        }, 0L, 20L);``` works well
waxen plinth
#

I'm not

drowsy helm
#

but scheduleSyncRepeatingTask is deprecated i think runTaskTimer is the newer equiv

waxen plinth
#

Much easier to use a lambda

young knoll
#

You can cancel it fine with a lambda too

waxen plinth
#

If you use runTaskTimer

#

Honestly I have never used runTaskTimer so I'm just used to doing it with an int array

tender shard
#

in fact your code runs fine, I just tested it @waxen plinth

#

so what exactly was your question again lol

waxen plinth
#

I went from doing it with runSyncRepeatingTask to using my wrapper so I never really looked into runTaskTimer

#

I didn't have a question I was answering that guy's question

tender shard
#

aaaaaaaah

#

okay sorry

#

I just joined and it's 5am here

#

sorry

waxen plinth
#

He was using runSyncDelayedTask and asking how to cancel the task from within itself

#

So I showed the simplest way to do that

tender shard
#

I'm a bit tired, excuse me pls

waxen plinth
#

If you use an int variable instead of an array it won't work

tender shard
#

true

waxen plinth
#

It's fine

#

Just don't jump to conclusions

tender shard
#

I don't

spare marsh
#

mfnalex I did what you said

#

this is for maven clean install -U

Could not find artifact org.yaml:snakeyaml:pom:1.26 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)```
#

and for package -U

tender shard
#

anyway I'd suggest to use a BukitRunnable instead, it's way easier @waxen plinth

#
new BukkitRunnable() {

            @Override
            public void run() {
                if(true) cancel();
            }
        }.runTaskTimer(whatEver);
    }
waxen plinth
#

No I really don't like that syntax

#

Cause then you always need the @Override public void run() {

tender shard
waxen plinth
#

I find the lambda much cleaner

spare marsh
#

package one was

Could not find artifact me.carleslc.Simple-YAML:Simple-Yaml:jar:1.7.2 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
tender shard
#

the anon class can cancel itself

#

no need to store any "self-identificating" task IDs

waxen plinth
#

Well

tender shard
#

of course both things will work

proud basin
#

Why does UnicodeFont not exist in my project?

tender shard
#

neither is better than the other

proud basin
#

I can't extend it

waxen plinth
#
Bukkit.getScheduler().runTaskTimer(plugin, t -> {
  ...
  t.cancel();
}, 1, 1);```
#

Cleaner

tender shard
young knoll
#

There we go

waxen plinth
#

Yeah I wasn't thinking of runTaskTimer

young knoll
#

That’s the nice one

#

But boo 1 letter variables :p

waxen plinth
#

Doing it with syncRepeatingTask, the int array is the easiest way

waxen plinth
tender shard
#

in fact there's like... 10 ways to get a runnable/task working

waxen plinth
#

1 letter variables are okay in lambdas

#

Otherwise I will generally not like them

tender shard
#

but the one with storing the task id inside an array / atomic integer is imho the worst one

tender shard
#

or int i = 0; i < ...

waxen plinth
#

Yeah I try to abstract those away as much as I can

#

Hmm

#

Maybe I should make a helper for that

tender shard
#

anyway sorry I really didnt mean to be rude @waxen plinth let's just move on 🙂

young knoll
#

Or you could just not use that version

waxen plinth
#
NDimensionalIterator.forRange(0, 10, 0, 10, 0, 10); //Returns a Stream<int[]>```
#

That would be cool

drowsy helm
#

1 letter variables = less data to process = faster program 😉

waxen plinth
#

You could do stuff like this

young knoll
#

I mean

#

1 letter variables do save a few bytes

waxen plinth
#
Block block;
NDimensionalIterator.range(0, 10, 0, 10, 0, 10).forEach(a -> {
  Block b = block.getRelative(a[0], a[1], a[2]);
  b.setType(Material.STONE);
});```
#

Wouldn't that be so clean?

drowsy helm
tender shard
#
minecraft@niere:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:            62Gi        25Gi        23Gi       0.0Ki        13Gi        36Gi
Swap:           31Gi          0B        31Gi
minecraft@niere:~$

If you need to save 32 bytes... go ahead. I'd rather save myself 5 minutes from debugging because all my variables are 1 char strings

fickle helm
drowsy helm
#

where do you split t

waxen plinth
#

What do you mean

#

It would take an int... for the range function

#

Every int pair represents a dimension and the range being iterated on

#

So, it's iterating on x from 0 to 10, y from 0 to 10, and z from 0 to 10

drowsy helm
#

oh pair

waxen plinth
#

That would be a 3d for loop and it would pass an int array with 3 elements for each pass on the lambda

tender shard
young knoll
#

Shhh

#

Details

tender shard
#

just use extremely verbose variable names and then use a proper obfuscator lol

young knoll
#

Or just don’t use an obfuscator

spare marsh
#

The dependency issues are gone only maven issue now

waxen plinth
#

int numberThatCameToMeInADreamOnTheNightOfChristmasEve2021 = 4;

drowsy helm
#

sheesh you guys cant take a joke lol

tender shard
tender shard
#

it's just not worth it in any way for that case

tender shard
waxen plinth
#

🌚

buoyant viper
#

hashmap enthusiast

waxen plinth
#

Yes hashmaps are the best data structure

drowsy helm
buoyant viper
#

fair

waxen plinth
#

Prefix trees are probably second on my list

#

They're not useful in the majority of cases but they are super cool

tender shard
#

I like overly verbose method/variable names. Makes debugging easier

waxen plinth
#

And in the cases where they are useful... woo boy do they save a lot of time

waxen plinth
tender shard
#

that's why that method is unused, thank god

young knoll
#

lol what

waxen plinth
#

One time there was a bug with a plugin

#

Don't remember what it was exactly

#

But I had to debug it by calling a fake EntityDamageByEntityEvent and erroring when it was cancelled so I could see the stack trace and determine which plugin was cancelling it

tender shard
# young knoll lol what

MMOItems / MythicLibs used to call a playerdeathevent one tick / in the same after the real playerdeathevent occured. it got fixed meanwhile though

waxen plinth
#

"which bastard moron plugin is messing with this event???"

young knoll
#

How did they manage to do that accidentally

tender shard
#

they set the players maxHealth to 0 during the "original" playerdeathevent

#

no idea why they did that

#

but they fixed that within 1 or 2 days after I reported it

#

sooooo

young knoll
#

Fair enough, I guess

pastel stag
tender shard
#

yeah bad mistakes can happen for everyone

waxen plinth
#

Oh shit lol

#

I was only looking at the variable names not the method name

#

The method name is insanely long

buoyant viper
#

lool

tender shard
#

there simply was no other solution than to check the stacktrace

pastel stag
#

Actually hilarious

tender shard
#

yeah thank god they fixed it quickly lol

waxen plinth
#

Oh I remember!!!

#

Holy shit I remember

#

Ok so there's this fucking awful anticheat called AngelX

tender shard
#

oh no

#

they stole 50% of my name lol

waxen plinth
#

We had this bug where people would randomly get teleported to another world and dropped out of the sky, die and lose all their items

tender shard
#

wtf lmao

waxen plinth
#

Yeah

tender shard
#

better install AngelChest too so they don't lose their items lol

waxen plinth
#

We eventually figured out that they were being teleported to the same coordinates in another world

tender shard
#

AngelChest, AngelX, ...

pastel stag
#

@waxen plinth I fail to see the problem

young knoll
#

Now that’s a good way to deal with cheaters

#

Drop them from space

pastel stag
#

Exactly

waxen plinth
#

It would do it to innocent players all the time

pastel stag
#

Sounds like a feature not a bug

young knoll
#

That’s part of the excitement

#

Oh god don’t let the challenge youtubers know

waxen plinth
#

So I had to add a listener for when players were being teleported to another world at the same coordinates and print the stack trace so I could see which plugin was responsible

young knoll
#

“Minecraft but I randomly fall from the sky”

pastel stag
#

Lmao

waxen plinth
#

It was AngelX

tender shard
#

oh btw there was this debugging plugin but it's dead now I fear

waxen plinth
#

And I was very annoyed because we had paid for that anticheat and it was really damn bad

pastel stag
#

I can already hear people screaming GEORGE in my head

tender shard
waxen plinth
#

I went in their support discord to report this bug and they wouldn't hear anything about it unless I brought the server owner in because he's the one who bought the plugin

#

Wouldn't let me tell them about a critical bug unless I could prove I had given them money

tender shard
#

lmao

waxen plinth
#

Truly high quality developers

tender shard
#

very professional indeed

waxen plinth
#

We ended up switching a while later

#

Vulcan is a good anticheat

tender shard
#

I mean I also wouldn't give support to anyone who claims to have bought something then fails to verify

waxen plinth
#

Even if they were reporting a critical bug?

tender shard
#

but when it's about serious bug fixes, then one should listen to the bug report first, and THEN ask them to verify their purchase

waxen plinth
#

Yeah lol

pastel stag
#

Yeah I mean the but still exists for those that actually did buy it though

waxen plinth
#

I never claimed I had bought the product, I told them point blank that I was a developer on a server that used their anticheat

tender shard
#

btw does someone want to see really really really ugly code?

waxen plinth
#

Sure

young knoll
#

Is it skript

waxen plinth
#

Do you want to see some of my ugly code

buoyant viper
tender shard
waxen plinth
#

            Class<? extends Event> chestSortEventClass = (Class<? extends Event>) Class.forName("de.jeff_media.chestsort.api.ChestSortEvent");
            ChestSortListener chestSortListener = new ChestSortListener();
            getServer().getPluginManager().registerEvent(chestSortEventClass, chestSortListener, EventPriority.HIGHEST, chestSortListener.getExecutor(), this);```
#

Jesus christ

#

Why would you do this

#

Instead of just adding an @EventHandler method

tender shard
#

because in 1.18 that didn't work anymore for events that aren't in the classpath yet

waxen plinth
#

Wat

tender shard
#

and I didn't have time to update CHestSorts API

waxen plinth
#

What do you mean it wouldn't work for events that aren't in the classpath

tender shard
#

you can't register a listener to that event in 1.18 anymore when ChestSort isn't installed

#

even when you shade that API into your own plugin

waxen plinth
#

Well yeah that makes sense

#

It's looking for the class

tender shard
#

used to work in 1.17 and earlier though

#

yeah no

waxen plinth
#

Weird

tender shard
#

the class would have been shaded into all other plugins

waxen plinth
#

I don't know why that would have worked

#

I would have just made a separate class for the event listener that is only instantiated if the chest API plugin is loaded

tender shard
#

but in 1.18, the classloader "detects" that the actual event isn't the one coming from chestsort

#

seems like they introcuded some kind of "namespaces" for classes that were shaded, idk how to say it properly

pastel stag
#

@tender shard chris walker is going to be so disappointed

tender shard
#

nah we talked about it

#

it's my fault for not having the API adjusted for the new classloader changes yet

lavish hemlock
#

ironically

buoyant viper
#

smmh

tender shard
#

but I didnt want him to get a hundred bug reports so I fixed it on his side quite dirty for now

lavish hemlock
#

Chris Walker is the name of an enemy from Outlast

tender shard
#

and will adjust the API for ChestSort in a few days

#

but its really strange

#

in 1.17 and earlier, people could just shade the ChestSortEvent and listen to it, without problems

#

in 1.1.8 it throws a weird error

#

1.18*

waxen plinth
#

NoClassDefFound?

tender shard
#

no

#

some exception caused by the EventHandler

lavish hemlock
tender shard
#

I dont recall it right now

#

the problem wasn't NoClassFoundError, that makes no sense anyway since ChestSortAPI used to just have all plugins that use it shade that event themselves

#

so whether Chestsort is installed or not - the class is available for all plugins that listen to it

#

but somehow it stopped working in 1.18

#

I dont remember details right now

young knoll
#

Pester MD about it :p

tender shard
#

no it's my fault anyway, I know that

#

every plugin should check whether that event class exists before registering a listener for it

#

it's just... it worked fine in 1.17 and earlier 😄

#

I'll just have to remove that event from the API and make people check for the class existing before registering listeners for it

#

but because I didnt have time for that today, I made that PR which does work, it's just totally ugly

spare marsh
#

Hi, so I fixed the maven issue but now it won't recognize one of my dependency 😦

young knoll
#

What dependency

spare marsh
#
dependency>
            <groupId>me.carleslc.Simple-YAML</groupId>
            <artifactId>Simple-Yaml</artifactId>
            <version>1.7.2</version>
        </dependency>```
#

It was working perfectly fine on my other computer but just transferred to this one and this happens

#

At first it didn't recognize maven or any dependenc

#

dependency

#

now it recognizes maven

#

them the dependencies

#

but on build time it says this

#

And I have no idea if it is a network issue or something else

pastel stag
#

Do individual chunks have a chunk id of any sort?

#

Or do you have to use a set of coordinates

spare marsh
#

Damn this channel died

young knoll
pastel stag
#

Hmm alright bummer

#

Every block inside a given chunk shares the exact same chunk coordinate tho right? Or not exactly

young knoll
#

Yes

pastel stag
#

Ok cool I think using chunk coordinate would work the same then

#

Is that a piece of information that’s stored inside of a Block object already or do you have to do some stuff to figure out what that chunk coordinate is

pastel stag
#

Never mind

#

GetChunk() just found it

young knoll
#

Ah yeah you can do that too

pastel stag
#

Like getChunk().getX() and getZ() apparently will work

hollow spindle
#

Heyoo, I'd like some advice or any suggestions/feedback about this block of code i've created.

#

Pretty much made an item that actively changes its description in the GUI and that seems to work as expected, however I'm a little concerned as to how I've used the schedulers/async threads as I think I can do a better job handling it.

young knoll
#

I would use a repeating async task instead of a while loop and sleeping

#

And have it run every 10 ticks, which should be the same as 500ms

#

And then in the close event you can cancel() the task

hollow spindle
#

How would you access the close method in a lambda expression?

#

Or well, access the task from the close event?

#

Oh wait my bad, I'll try it out

tender shard
#

does anyone know whether's its possible to keep a referene to an itemstack while another plugin removes it and then, without chaning it, adds it back to an inventory?

#

because IIRC spigot calls .clone on the itemstack everytime you do inventory stuff

#

so e.g. when I do something like this:

#
ItemStack item = inv.get(0); // get item from first lot. no idea whether the method is actually called "get(int)", you know what I mean
inv.set(0,null);
inv.set(0,item);
//////////// -> but now
inv.get(0) will be != to item
#

you know what I mean?

#

is there any way to see whether inv.get(0) is still the SAME item as item?

#

equals does not help, those could equal without being the same itemsatck

#

I fear that itll be impossible because spigot always clones itemstacks for such stuff

#

pls ping me when someone replies 🙂

quaint mantle
junior briar
#

any way to listen to a certain event manually?

whole nebula
#

Hello, I would like to know if it is possible to create a plugins with an extension of another plugn? If yes, how?

tepid thicket
#

Hi, has Spigot support for LootTables? Let's say I don't want to have an item to be generated in chests.

#

How would I do that?

pastel stag
sullen marlin
#

Yes, search the docs for loot

pastel stag
quaint mantle
#

why my command wont work for no reason
no output

tepid thicket
#

Seems to be the LootGenerateEvent then. Alright, thx.

pastel stag
quaint mantle
#

but there is none

#

i registered it in plugin.yml

pastel stag
quaint mantle
#

and its not my first time coding a plugin

#

i have this before any return

#

and i register it

#

it is in plugin.yml

#

oh wait i have a return in onEnable

#

wait

pastel stag
#

Hover over setExecutor

quaint mantle
#

bruh nvm

pastel stag
#

Your mistake is there

whole nebula
pastel stag
#

Also don’t use sysout use Bukkit.getLogger

vague oracle
#

That is just a null check

pastel stag
junior briar
whole nebula
sullen marlin
quaint mantle
#

how to stop players from placing redstone

#

on BlockPlaceEvent

#

i guess redstone place wont be called

candid galleon
#

event.setCancelled(true)

quaint mantle
#

i can check the material

#

but redstone

#

is not a block

candid galleon
#

it's an item

quaint mantle
#

and redstone placement wont call BlockPlaceEvent

candid galleon
#

you can check the material in the player's hand

#

it will

#

redstone placement should call blockplaceevent

#

redstone is a block

quaint mantle
#

i tried

#

and Material.REDSTONE.isBlock() is false

candid galleon
#

interesting

whole nebula
#

He would not have a document for what I want to do?

candid galleon
#

well, blockplaceevent should still be called

quaint mantle
#

well if i check redstone

#

nothing will happen

waxen plinth
quaint mantle
#

ah yes

lapis lark
#

PlayerInteractEvent, if player.getInventory().getItemInMainHand().getType() == Material.REDSTONE and action is block do event.setCancelled(true)

#

But BlockPlaceEvent should be triggered on redstone place

quaint mantle
#

it does

#

i tested

lapis lark
junior briar
pastel stag
#

@EventHandler

junior briar
pastel stag
#

Public method(BlockPlaceEvent event){

#

If you’re listening for block placement

junior briar
#

as what i said above, i don't have direct access to the event class.

pastel stag
#

What do you mean you don’t have access to the event class?

#

Can you clarify your use case

junior briar
#

in other words, idk which event it is until it happens.

crimson terrace
junior briar
#

how? can i use Event?
afaik Event won't work in a listener.

crimson terrace
#

and usually if you have a clear enough vision of what your plugin should do you know which event will be called

#

if you want to elaborate on what you want to do I could help out but its hard without information

quaint mantle
#

you can check for every events

#

😂

#

like every single one of them

#

just do system.out.println lol

junior briar
#

i know which to call, i just don't have access to it.
imagine u have to use Class.forName to get the event class.

quaint mantle
pastel stag
#

@quaint mantle god I thought we got rid of this guy

quaint mantle
#

🆗

junior briar
#

like a soft dependency.

crimson terrace
pastel stag
#

Or tell us what exactly you’re trying to do

#

Above you said you wanted to stop red stone from being placed, if that’s what you want to do then BlockPlaceEvent is the event you want to listen for

crimson terrace
#

usually you can make another class to get the event in if its impossible in your current class (which usually doesnt happen since you can just implement Listener aswell even if you implement something else first)

junior briar
#

i've got a string of class name from somewhere else and its content is like "com.blabla.SomeCertainEvent". what i need to do is listening to it and maybe cancel it.

crimson terrace
#

ok thats something to work with

#

you could use a factory

quaint mantle
#

PluginManager.registerEvent

crimson terrace
#

basically a switch(eventString){

case CreatureSpawnEvent: PluginManager.registerEvent

quaint mantle
#

why my plugin is acting strange
when it uses symbols like »
it turns in to A with something above it

#

but not other plugins

crimson terrace
#

or that

#

I get excited

junior briar
crimson terrace
quaint mantle
#

Class.forName and registerEvent is a way to go

quasi flint
#

wtf. only exists runtime

quaint mantle
#

it literally gets class by name

quasi flint
#

bet you otherwise

crimson terrace
quasi flint
#

prob

crimson terrace
pastel stag
#

Im lost tbh

quaint mantle
#

why do you need to get that event

crimson terrace
junior briar
#

cancel it maybe?

crimson terrace
#

cancelling events by name wouldnt be a good idea. you could be cancelling the PlayerMoveEvent

#

or something else you wouldnt want cancelled in every situation

quaint mantle
#

wht

#

Whats the concept

crimson terrace
quaint mantle
#

but why

crimson terrace
#

from what im getting

quaint mantle
#

in what case you need this

junior briar
#

that's just an example. the purpose to listen to an event might be various.
what important is to realize it.

pastel stag
#

So you are wanting to see every single event and then dependent on what that event is do something or don’t do something with it?

crimson terrace
#

ive read about a plugin that was discontinued in which people ingame could code their own plugins without touching an IDE or something like that. maybe something along those lines?

quaint mantle
#

well, PluginManager.registerEvent

junior briar
#

not every single event. depends on the class name.

crimson terrace
#

but every single event is possible

#

we cant help you without knowing your intentions or code

pastel stag
#

Yeah you need to either listen to everything or know what you want to listen to there is no in between

junior briar
#

it's ok if i have to. but is there a way to listen them all?

pastel stag
#

If you tell us what exactly you are trying to do and walk us through a better example of what you want we may be able to help more

#

Like you want to listen (for what) and (do what)

crimson terrace
#

something like this?

pastel stag
#

Depending (on what)

crimson terrace
#

you can listen to Event appearently

pastel stag
#

That should give you every event that happens I believe ^

#

Any event

crimson terrace
#

just gonna be heavy as hell since its gonna do it for literally anything, including PlayerMoveEvent, etc

junior briar
#

but idk why.

crimson terrace
#

I wont test it and Im out of ideas if that is correct

eternal oxide
#

No that will not work

#

You can not listen to Abstract Events.

random epoch
#

Just use EventExecutor

summer scroll
#

Does someone know any free online maven repository? I want to add a maven repo for my libs, idc if it's public/private.

eternal oxide
#

most are free

#

or just put your code on Github

summer scroll
#

it's already on github

eternal oxide
#

then it will be accessible, so long as it has a pom

summer scroll
#

how can i access it?

eternal oxide
#

something like xml <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependencies> <dependency> <groupId>com.github.ElgarL</groupId> <artifactId>Regen</artifactId> <version>0.0.1</version> </dependency>

summer scroll
#

wow, i didn't know you can do that with github

#

so i got this from jitpack.io site, and it says "Could not found artifact ..."

eternal oxide
#

needs a tag

summer scroll
#

publish a release?

eternal oxide
#

you can, or you can find the tag jitpack generates when it builds it

#

if you publish you use teh version number you published

#

if you use a jitpack tag its a random string

summer scroll
#

can i make it if i update the libs, i didn't need to change the tag?

#

let's say the version would be latest at all time

eternal oxide
#

publish a release on Github and you can use teh version number as the tag

#

you might be able to use latest, I've nto tried

#

testing

#

nope, it doesn;t like latest

unreal quartz
#

you need to specify the branch for jitpack

quaint mantle
#

Woah

unreal quartz
#

also “latest” should now work

#

jitpack only builds it when you request it

#

meaning initial requests will fail

summer scroll
#

so what should i do, to get the dependency

#

publish a release with the jar on github?

unreal quartz
#

well it’s available on jitpack now

summer scroll
#

yeah, it's still cannot resolve

eternal oxide
#

latest as a version fails for me

summer scroll
unreal quartz
#

you may need to invalidate caches or something

summer scroll
#

okay, one sec

eternal oxide
#

I did, still fails for me

#

different dependency, but one I know works with a version

unreal quartz
#

i think maven also holds a cache of what failed

#

i always forget how to reset it

eternal oxide
#

nope, I cleared and updated

quaint mantle
#

I'd use own repository if you have a server

eternal oxide
#

it doesn;t like latest

quaint mantle
#

check out reposilite

eternal oxide
#

I'm fine using version numbers, but it would be nice to use latest

summer scroll
#

still errors, cannot resolve dep

#

i'll try to use version number

tardy delta
#

is there no event.getPlayer() in the inventoryclickevent?

summer scroll
#

getWhoClicked

tardy delta
#

there is a getWho() or something

#

ah yea

unreal quartz
tardy delta
#

returns a humanentity

unreal quartz
#

works for me (gradle)

tardy delta
#

why not just a player

eternal oxide
unreal quartz
#

it's not an authenticated request

#

it only builds when you actually request it

eternal oxide
#

yep, but the first lookup on their site is

unreal quartz
summer scroll
#

i removed the latest release xd

#

it's still available on jitpack tho

unreal quartz
#

i would just use master-SNAPSHOT anyway rather than github releases signalling it but latest would've worked

summer scroll
#

i tried to use master-SNAPSHOT, but the version on the pom.xml has a red text

quaint mantle
#

guys why when i use Player#getInventory#setItem in PlayerInteractEvent, the item slot gets cleared

worn tundra
#

code?

eternal oxide
#

if you are setting the slot that was clicked you need to also cancel the event

eternal oxide
#

just not latest for some reason

quaint mantle
#

the problem is not with the Item....

summer scroll
#

it works on gradle

#

the latest version

unreal quartz
#

because maven caches failures for like a day

#

or an hour

#

no idea but you can clear it if you google it

summer scroll
#

is it this one?

unreal quartz
#

that’s intellij

tardy delta
#

intellij good

summer scroll
#

oh, the maven cache

#

not intellij

#

it's the .m2 folder then, no?

unreal quartz
#

that’s your local repository

echo hound
#

would you safe coins and language in something like playerdata tatabase or safe it in two (coins, language)

summer scroll
#

no error on maven reload

worn tundra
quaint mantle
worn tundra
#

Awh man

#

And the problem was?

quaint mantle
#

i dont know but i fixed it

worn tundra
#

aha

smoky oak
#

how do i set a player's persistent data?

#

i only find the methods to get data from the PersistentDataContainer

eternal oxide
#

set

smoky oak
#

there is no player.setPersistentDataContainer

#

thats why im asking

#

i know how maps work

eternal oxide
#

you don;t set the container

#

its a container

#

you set things inside the container

smoky oak
#

so manipulating the container directly is enough then?

eternal oxide
#

get the container, set or get data

smoky oak
#

ah ok

#

thanks

#

different question, can i remove all entries from that map from a specific plugin?

#

or do i have to keep track of the keys i set?

eternal oxide
#

you can read all keys and delete only yours

smoky oak
#

i know that

#

but i was unsure if there was a simpler solution

summer scroll
#

@unreal quartz you know how to reobfuscate remapped-mojang on gradle?

quaint mantle
#

why when i right click with a dye itemstack i made in my plugin, it disappears

#

i removed playerinteractevent

#

and there is no plugin doing it

smoky oak
#

@eternal oxide like this?

public static void delAll(PersistentDataContainer container, String plugin){
    for(NamespacedKey key : container.getKeys()){
        if(key.getNamespace().equals(plugin)){
            container.remove(key);
        }
    }
}
#

the documentation is just empty for that

#

for some reason

summer scroll
#

why loop through all keys?

smoky oak
#

remove all entries of a specific plugin

#

resetting the data

#

and i asked earlier because i thought there was a simpler solution

summer scroll
#

i guess if you remove the key, it will remove all entries

#

i might be wrong tho

#

on remove method, you don't need to specify the data type

#

so i'm assuming it will removes all data types for that key

smoky oak
#

issue being you cant do that.

#

thats all you can do with container

#

and namespaced key requires a specific plugin and string as key

summer scroll
#

i usually will keep reference of the NamespacedKey

#

or you can just new NamespacedKey(plugin, "some-key")

smoky oak
#

well unfortunately i need to keep possibly one entry per minecraft item

#

so i dont know what entrys there exactly are

hybrid spoke
#

will probably throw a concurrentmodificationexception

drowsy helm
#

-1 for not being verbose enough

smoky oak
#

i just tested it

#

doesnt work

worn tundra
#

What doesn't work

smoky oak
#

it keeps the key

#

still there

summer scroll
#

have you set the item meta back?

smoky oak
#

item meta in a persistentdatacontainer?

#

explain

worn tundra
#

Oh lmao

#

right yes

#

Exactly

hybrid spoke
#

getItemMeta returns a new item meta, you need to set it back to the ItemStack

worn tundra
#

If you're working with an items pdc, you need to update the items itemmeta

smoky oak
#

its the players pdc

eternal oxide
worn tundra
summer scroll
#

could be one-liner container.getKeys().removeIf(key -> key.getName().equalsIgnoreCase(plugin));

worn tundra
#

^

eternal oxide
#

getName()

worn tundra
#

Nope

#

He passes the plugin as a string

smoky oak
#

because the method takes a string

#

dumb thing is

#

the equalsIgnoreCase was the solutoin

worn tundra
#

lol

smoky oak
#

but the actual plugin name contains big characters

#

and i typed it in correctly

eternal oxide
#

Yes he passes it as a string but key.getNamespace() returns the plugins name

smoky oak
#

well yes but why in lowercase??

eternal oxide
#

because its a namespace, it has to be lower case

smoky oak
#

im going to pretend to know why namespace cant even work with all ascii characters

#

thanks for the help tho

eternal oxide
#

Keys may only contain lowercase alphanumeric characters, periods, underscores, hyphens, and forward slashes.

smoky oak
#

then why does new NamespacedKey take Bukkit.plugin as constructor

#

urgh

eternal oxide
#

it then uses the plugin.getName()

smoky oak
#

ah

#

though

#

new NamespacedKey(plugin, String) seems to be able to use upper case characters

#

considering i can use a big M as both key and to get what i set

eternal oxide
#

it may, but it should not

smoky oak
#

note taken

#

thanks

rough basin
#

Is it possible to change LivingEntity's arrgo range without NMS?

crimson terrace
rough basin
#

hmm

hybrid spoke
#

i dont think so. you could loop over the entities and set the target manually if there is any in range, but this may not be the best solution here

#

at least for extending the range

#

for minimizing do what shreb said

crimson terrace
#

you could get nearbyEntities on the location of the LivingEntity and consider targetting those

#

but that basically just loops over all the entities anyway

misty current
#

High values can be a bit laggy tho

#

Check if spigot has api for that tag

summer scroll
#

um, so i kinda new to Java Consumer, i found a problem where i can't use the method of the Type of the consumer, as you can see the image, the wrapper.getSender returns a CommandSender, and i can't use that for some reason

eternal oxide
#

show your SpigotCommand class

#

?paste

undone axleBOT
wide solstice
#

Has anyone had this issue before? I'm trying to download the sources for ACF and it seems to be bugging out... I've tried:

  1. Clearing my .m2 repo
  2. Invalidating my IntelliJ caches
  3. Tried downloading sources from other repos (it worked)
quaint mantle
#

is there a way to ignore netherrite knockback resistance?

eternal oxide
#

what options do you get on wrapper. ?

summer scroll
eternal oxide
#

does it auto complete to getSender()?

summer scroll
#

yes

drowsy helm
#

have you tried compiling with it

#

could just be the ide throwing a fit

eternal oxide
#

hovering over getSender() does it show an error?

summer scroll
#

it does

#

Cannot resolve method getSender()

drowsy helm
#

have you restarted the ide aglerr

summer scroll
#

ill try to restart the ide too

drowsy helm
#

because that code looks fine to me

summer scroll
#

oh wait, it looks like you must complete all of the parameters argument first

drowsy helm
#

oh lmao yeah thats probs it

summer scroll
#

well, odd but yeah

#

thanks for nothing ig

tardy delta
#

why do people make fields without an access modifier?

#

i saw it's package scope

#

but private fields in a package??

misty current
#

When an access modifier isn't specified for a field, that field can only be accessed from classes in the same package

#

Protected is the same but subclasses can also get the field

tardy delta
#

how would a field be accessed from outside the class?

#

if its default

misty current
#

Is the class you want it to be accessed in in the same package?

tardy delta
#

but default is also private in some way

misty current
#

It's not, as i told you

#

Only the class of the field and classes in the same package

#

Anyways you can use reflection to access it

#

If you can't modify the field access modified

tardy delta
#

ah its similar to protected?

knotty shell
misty current
#

Yeah default is similar to protected

#

And i have already explained to you

tardy delta
#

oki

pastel stag
misty current
#

Protected can also be accessed by subclasses

tardy delta
#

but default also can if they're in the same package?

misty current
#

Yes

pastel stag
#

i found my mistake

#

i didnt getWorld().getName()

eternal oxide
#

yep

pastel stag
#

i used toString() instead 😒

eternal oxide
#

you have a lot of redundant code in there

eternal oxide
# pastel stag i used toString() instead 😒
    @EventHandler
    public void onentityExplosion(EntityExplodeEvent event){

        if (event.getEntity().getType() == EntityType.PRIMED_TNT) return;

        event.blockList().forEach(block -> {
            if(sqllogger.blockexists(block.getX(), block.getY(), block.getZ(), block.getWorld().getName()))
                sqllogger.removeBlock(block.getX(), block.getY(), block.getZ(), block.getWorld().getName());
        });
    }```
quaint mantle
#

hey does anyone know what the replacement for hideEntity is

young knoll
#

There isn’t one

#

It’s a draft API

quaint mantle
#

oh

#

is it useable?

#

or like are they working on it

#

i havent heard of it but i need smth like it, its pretty neat

young knoll
#

It’s usable

quaint mantle
#

sweet

#

nvm didnt work

#

im trying to add debuffs to players by adding certain items ontop of their heads and just wanna have them follow the player around

#

is there a way to spawn something in with no hitbox?

peak granite
#
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("You cannot execute this command in console.");
            return true;
        }
        Inventory testGui = Bukkit.createInventory(null, 9, "Test");
        settingsGui.addItem(createGuiItem(Material.IRON_HELMET, "§bExample Helmet", "§aFirst line of the lore", "§bSecond line of the lore"));
        return true;
    }

    @EventHandler
    public void onInventoryClick(final InventoryDragEvent event) {
        if (event.getInventory().equals(testGui)) {
            event.setCancelled(true);
        }
    }```

i can't use testGui in the event, any way i can do it? because each players get the inventory made uniquely for them
late sonnet
eternal oxide
#

Don't use inventory name for matching. You store the inventory instance in a map against the players UUID. Pull the inventory from the map and compare to the clicked inventory.

wide galleon
#

How do I repeatedly run something(for example broadcastMessage) after a random amount of minutes(like a runnable but in random delays)?

eternal oxide
#

a repeating task with an internal counter

#

when teh task starts set an int, increase a counter every time the task runs, when it hits the target value, reset counter, set a new target value and send message

quasi flint
#

or just a new random

#

between 5-10 numbers ig

eternal oxide
#

if it never ends you could have a non repeating delayed task execute a fresh instance of itself

#

That question makes no sense

quasi flint
#

exactly

wide galleon
#

no, i mean where do I put the code of that

eternal oxide
#

So random question

#

No idea, I have not seen any of yoru code to even guess

quasi flint
#

prob whereever you need the counter

eternal oxide
#

If you tell us exactly what you are doing we could probably advise better

peak gulch
#

Can you help

eternal oxide
#

You have not got teh mongo database on yoru server

#

didn;t shade the driver

quaint mantle
#

i'm getting this error with gradle when trying to use spigot: Could not find spigot-api-1.18-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT:20211201.040401-5). , could anyone help? i can send my build.gradle if you need it

wide galleon
eternal oxide
#

That doesn;t really help

peak gulch
tardy delta
#

make a while with a random from 0 to 1000?

wide galleon
# eternal oxide That doesn;t really help

i dont really know how to say it lmao, if the setting in the config is enabled, i want to repeatedly broadcast a message with a random delay (if that makes more sense)

eternal oxide
#

does thsi need to run all teh time? What kind of message?

tardy delta
#

just a scheduled timer with a random?

wide galleon
tardy delta
wide galleon
#

i know, but i dont know where i'm supposed to put that code, like in the onEnable in my Main or in an event?

tardy delta
#
Random random = ThreadLocalRandom.current();
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
  Bukkit.broadcastMessage("Hello World!");
}, 1, random.nextInt(100));```
wide galleon
#

i know how to code it, but i dont know where(what file/what function) to put the code.

tardy delta
#

just make a command to start it

#

and something to stop it

rough basin
#

Is it possible for an Entity's Target to be the Entity itself?

tardy delta
#

?

#

in which context?

quaint mantle
#

Imagine entity attacking itself

#

One hand trying to attack it

#

While other hand trying to stop it

tardy delta
#

oh that way

#

no

#

i guess

rough basin
#

Nooooo

tardy delta
#

i dont think it would do anything

wide galleon
# tardy delta just make a command to start it

it's supposed to run whenever the timer is running, so ```java
if(timer.isRunning){
Random random = ThreadLocalRandom.current();
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
Bukkit.broadcastMessage("Hello World!");
}, 1, random.nextInt(100));
}

quaint mantle
#

You want like a mob would hurt itself and the player should be the one who rescue the mob?

tardy delta
#

in command

quaint mantle
#

Hmm then use function that will hurt the mob over time then

rough basin
#

I just looking for useless value to return when there is no entity matches

tardy delta
#

null

rough basin
#

Nice

#

Thanks

tardy delta
#

just make a new BukkitRunnable

#

check for ifRunning and if its false, cancel the runnable

wide galleon
#

i just want to know where in my code im supposed to put that runnable?

tardy delta
#

in the command that starts the timer?

manic furnace
#

Do anyone know a good tutorial for how to send packts?

tardy delta
#

which packets?

#

there are not really tutorials for packets

round finch
#

yes it will run the codes then it starts the timer

round finch
#

dead channel atm

quasi flint
#

undead it now

tardy delta
#

whats the min/max value of random.nextDouble?

quasi flint
#

prob max double limit

tardy delta
#

oh lol

quasi flint
#

1.7976931348623157 x 10 ^ 308

proven river
#

Can someone help me with a really basic issue?
I want to ban a player when they die i've got that sorted
but I've got it so player.banPlayer("REASON", duration)
but spigot dosent clarify what should be in the duration?

tardy delta
#

just put null

#

thats never

proven river
#

Yea but I want it to be set to two hours

#

So how would I do that?

tardy delta
#

Date?

proven river
#

like wdym?

tardy delta
proven river
#

I've already had a look at it but I dont know how I would go about adding the date for it, Would it be getting the current date then adding 2 hours somehow?

tardy delta
#

yes

late sonnet
#

this

late sonnet
red sedge
#

spigot doesnt register my plugin as a plugin/

#

??

late sonnet
red sedge
#

im pretty sure?

late sonnet
#

i mean the only way spigot not load your plugin is not build correctly.. like bad plugin.yml or missing main class defined and many other causes

proven river
proven river
#

Like how to I add the 2 hours onto the date?

#

Date now = new Date();
player.banPlayer("Reason", new + ??);

red sedge
rough basin
#

How do I modify attributes on LivingEntity? I've only found tutorials on Inventory nah

spiral light
#

entity.getAttribute...

zealous osprey
#

Is there an event for when a entity gets loaded, so like when you enter old chuncks ?

spiral light
#

then setBaseValue()
or addModifier(...)

spiral light
zealous osprey
#

doesnt seem like

late sonnet
#

@proven river
maybe this can help (i use instant because in D4J/Discord i work more with Instant and not Date)

Instant now = Instant.now(); // The current date
Duration duration = Duration.ofHours(8); // A duration in hours
Instant future = now.plus(duration); // Make a copy with the added
Date dateExpire = Date.from(future); // Generate the date using the instant modified

System.out.println("Now is " + Date.from(now));    
System.out.println("Expire in " + dateExpire);
supple token
#

How do i get console logs?

manic furnace
#

How can i make an ü bold?

eternal oxide
#

ChatColor.BOLD

spiral light
quaint mantle
#

ü

rough basin
proven river
late sonnet
#

the plus create another instant.. you need convert to Date

#

like player.banPlayer("You have died", Date.from(now.plus(duration)));
not sure if the method like this ok is a paper method...

proven river
#

tysm I fixed it

#

<3

rough basin
#

Is it possible to give two potion effects to one entity?

quaint mantle
#

yes

rough basin
#

I think i just found false infomation

#

bruh

tardy delta
#

the internet is full of wrong information

rough basin
#

I trolled by wiki

#

damn

#

My Snowman still have a Fire Resistance, it keeps Damage and died bruh

pastel arrow
#

im trying to deactivate suffocation damage. in my plugin, when you get damage, you get teleported. i want that when you get suffocation damage you dont get teleported. i tried with cancelling suffocation damage event but you still get ported?

red sedge
#

damage cause

pastel arrow
#

the event get cancelled when the damage cause is suffocation.

red sedge
#

did you make the teleport thing?

pastel arrow
#

yes

red sedge
#

so just go to the teleport thing

#

and not run it

#

if the cause is suffocation

pastel arrow
#

thought of that but isnt it too late then?

#

i ll try it anyways

waxen plinth
#

Try setting the one that teleports to a higher event priority, and return out of it immediately if it's been cancelled

#

Higher event priorities are called later, so they get the final say in whether an event is cancelled

slim cairn
#

How would I teleport a player back to a certrain coordinate if they reach below a certain y level?

eternal oxide
#

player#teleport

waxen plinth
#

Listen for PlayerMoveEvent

#

If they go below a certain Y level you teleport them somewhere

slim cairn
waxen plinth
#

Look up docs and guides

#

There are countless examples

#

"spigot event handling"

eternal oxide
#

if (event.getTo().getBlockY() < 5)

slim cairn
#
       if (event.getTo().getBlockY() < 10)
        {
            player.teleport(new Location(player.getWorld(), 1, 73, 0));
        }
    }
```?
eternal oxide
#

and cancel the event

slim cairn
#

how?

#

return;?

eternal oxide
#

event.setCancelled(true)

slim cairn
#

k ty

#

It doesnt tp me to said cords

#

It just sort of keeps me bouncing around at y 10