#help-development

1 messages · Page 1540 of 1

eternal night
#
@EventHandler(priority = EventPriority.WHATEVER)
earnest sonnet
#

I don't think in this case it's going to work like what he wants

quaint mantle
#

okay

eternal night
#

they will still both be executed for each player chat

quaint mantle
#

yeah well thats what i need to fix tho

eternal night
#

then event priority isn't the right tool

quaint mantle
#

like i dont want to run the RecoverEmailVerify after the player has finished the RecoverEmailSetup

earnest sonnet
#

I do think that creating a map and doing that may work better

eternal night
#

if you want separate logic for the same event you will need to store some state of the player in like a Map<UUID, PlayerState>

earnest sonnet
#

or manipulating the string of the player

quaint mantle
#

i do have that

#

if (user.getSettingUpEmail().getPhase().equals(SetupPhase.SETUP)) {

earnest sonnet
#

that's not a map though

eternal night
#

oh then event order could be the right tool for you

earnest sonnet
#

oh wait my bad

eternal night
#

tho you would run out of space on the event priority list rather quickly

quaint mantle
#

yea

eternal night
#

I'd suggest, instead of having two listeners, run the respective code from a single listener just in two different methods later on

quaint mantle
#

ohh

#

okay

eternal night
#

that way you are sure that setting their phase to verification does not affect the current event execution

quaint mantle
#

now it works thank you

#

oh and another thing whats an like regex thing for Pattern that only allows numbers?

eternal night
#

\d matches a single digit

quaint mantle
#

okay

opal juniper
#

if two plugins have EventPriority.HIGHEST do they just do rock paper scissors or something?

eternal night
#

order of registration

#

which is implementation detail soooo

#

yes, rock paper scissors xD Tho the order won't change during runtime 😂

opal juniper
#

🙃 Thanks

noble spire
#

did that, fixed that issue, back to the same problem though, and excluding either packages doesn't fix it :(

opal juniper
#

yikes that message was 12hrs ago

#

what is ur issue

noble spire
#

I'm using Discord4J, it runs fine on its own, but when I try running it through spigot it gives me an error on runtime: ```java.lang.NoSuchMethodError: 'boolean io.netty.handler.ssl.SslProvider.isAlpnSupported(io.netty.handler.ssl.SslProvider)'

I'm pretty sure this is because discord 4j uses: `io.netty:netty-handler:4.1.60.FINAL` 
Where as spigot uses:
`io.netty:netty-handler:4.0.0.Beta1-SNAPSHOT`
#

(stack trace, although not very helpful imo) java.lang.NoSuchMethodError: 'boolean io.netty.handler.ssl.SslProvider.isAlpnSupported(io.netty.handler.ssl.SslProvider)' at reactor.netty.http.client.HttpClientSecure.<clinit>(HttpClientSecure.java:79) ~[?:?] at reactor.netty.http.client.HttpClient.secure(HttpClient.java:1073) ~[?:?] at discord4j.common.ReactorResources.lambda$static$0(ReactorResources.java:41) ~[?:?] at discord4j.common.ReactorResources.<init>(ReactorResources.java:54) ~[?:?] at discord4j.rest.RestClientBuilder.initReactorResources(RestClientBuilder.java:262) ~[?:?] at discord4j.rest.RestClientBuilder.build(RestClientBuilder.java:243) ~[?:?] at discord4j.core.DiscordClientBuilder.build(DiscordClientBuilder.java:85) ~[?:?] at discord4j.core.DiscordClientBuilder.build(DiscordClientBuilder.java:73) ~[?:?] at Discord.DiscordBot.main(DiscordBot.java:94) ~[?:?] at Discord.DiscordBot.<init>(DiscordBot.java:77) ~[?:?] at MC.MCMain.onEnable(MCMain.java:14) ~[?:?]

opal juniper
#

Shade it 🙃

noble spire
#

wdym?

opal juniper
#

Do you use maven?

noble spire
#

yup

opal juniper
#

So

noble spire
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Thing</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.discord4j</groupId>
            <artifactId>discord4j-core</artifactId>
            <version>3.1.5</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.7</version>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17-R0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>
#

(is my pom)

opal juniper
#

So add the plugin

#

?paste

undone axleBOT
noble spire
#

wdym?

#

oh

opal juniper
noble spire
#

upload the code?

opal juniper
#

Something like this

noble spire
#

ah I see, I'm not great at maven

opal juniper
#

then, you run mvn package

noble spire
#

oh nice

#

(I just read the docs)

opal juniper
#

although change teh scope of the spigot depend

#

cause if not u will shade that

#

<scope>provided</scope>

noble spire
#

Should I build it differently? Currently I'm using intelij's build function

opal juniper
#

then <scope>compile</scope> on discord

#

yes

#

run mvn package

noble spire
opal juniper
#

well, you can make a terminal at the bottom if intellij

noble spire
#

I'm upgrading all my packages, and will see if that fixes it

noble spire
opal juniper
#

ok

noble spire
#

ohhh wait does maven need to use java 16 or java 8?

#

I might just change to a different java discord library then ig

quaint mantle
earnest sonnet
#

have you tried regex?

tame coral
quaint mantle
#

so I have an Inventory in another class and I want to check if the player clicked in that Inventory, how should I do it?

@EventHandler
public void onMainmenuClick(InventoryClickEvent e){
        if (e.getClickedInventory() = )
    }
quaint mantle
#

there is no .getTitle() in 1.17?

hybrid spoke
#

#getView()#getTitle()

quaint mantle
#

no

hybrid spoke
#

just upload it to imgur

#

and post the link

quaint mantle
hybrid spoke
#

not loading

#

just paste it

#

?paste

undone axleBOT
quaint mantle
#

we cant paste images

#

in that link

hybrid spoke
#

your code

#

..........

quaint mantle
#
@EventHandler
    public void onMainmenuClick(InventoryClickEvent e){


        if (e.getClickedInventory().getView() = )
    }
#

its spigot 1.17

hybrid spoke
#

e.getView().getTitle

quaint mantle
#

I have one query, I am getting the title from configuration which will have color codes &e like this and if I check the the title, will it work like that?

earnest sonnet
noble spire
#

(or write a script to verify emails)

#

with confirming

tame coral
#

You can't have a domain list as new domains can be created every now and then

noble spire
quaint mantle
noble spire
#
  • some json parsing
tame coral
#

Yep

quaint mantle
#

and what do i have to get from the dns to like check if it is like existing domain

noble spire
#

compare the two links

#

if it has an empty string in the data field, then it's not a domain

#

otherwise it is

noble spire
quaint mantle
#

that it even passes an invalid domains like the cd.d

#

and thats when the error occurs

noble spire
#

oh I see, what's your error?

#

You should just be able to catch the error and tell the user that it doesn't exist?

quaint mantle
#

well in the try/catch block it can catch like some wrong details and stuff

#

like wrong smtp configuration from the host

burnt current
#

Thank you very much, I had forgotten.
but now, when i click the item i get the Error message "clickedItem" is null

quaint mantle
#

show code

burnt current
noble spire
#

Okay, ig use the DNS lookup too?

quaint mantle
#

you should check before initializing the clickedItem if its null ex.

if (event.getCurrentItem() == null) return;
ItemStack clickedItem = event.getCurrentItem();
burnt current
#

ah well ok. But after that, the item clicked on should still be null according to the console, right?

quaint mantle
#

?

#

i dont think so if you checked

quaint mantle
#

would i use the split("@")?

noble spire
#

yeah exactly, if you've already made sure it looks like a email first

quaint mantle
#

okay

cold field
noble spire
cedar latch
#

Noob question: Does this mean new file or a new class under the onEnable/onDisable?

noble spire
#

hmmf don't know how to explain this

#

(i'll let someone else probably)

opal juniper
#

What is going on?

burnt current
noble spire
unreal quartz
#

?learnjava

undone axleBOT
cedar latch
quaint mantle
#

you need to create a new .java in your package

opal juniper
#

Then yes - refer to LMBishop's message

cedar latch
opal juniper
#

Yes this

cedar latch
#

Thanks!

quaint mantle
#

Yes

hybrid spoke
noble spire
#

I'm about to get murdered

hybrid spoke
#

also if, make sure to close it in a finally clause of a try catch since any thrown exception can interrupt the closing and force a memory leak

quaint mantle
#

or like is this good too?

try {
                String[] hostname = message.split("@");
                InetAddress.getByName(hostname[hostname.length - 1]);
            } catch (UnknownHostException exception) {
                user.getSettingUpEmail().setPhase(SetupPhase.NONE);
                player.sendMessage("Invalid address!");
                return;
            }
noble spire
#

Also, unrelated question, what's the use of finally instead of just putting code afterwards, e.g.:

  try {
    // Do something that raises an exception
  } catch (Exception e) {
    // Do something
  } finally {
    // Do something that will always be run afterwards
  }
  // But also shouldn't this?
unreal quartz
#

if you return from the try block

#

finally is also called

earnest sonnet
noble spire
#

ohh, and it'll run if the catch block raises an exception too?

tame coral
#

Even in a function where try has a return statement ?

noble spire
#

gotcha

#

nice

hybrid spoke
#

finally is being called every time

tame coral
#

Oh I see

wispy plume
#

Hey, does anyone have maven dependency of the whole Bungeecord, not just api?

tame coral
#

just put bungeecord instead of bungeecord-api i guess

wispy plume
#

Ain't work

#

I've tried xd

tame coral
#

Found this

#

might help

wispy plume
#

This doesn't even give the API xD

#

I guess I have to compile it myself from the src, and install using maven

maiden briar
#

Coming back on my problem: I have a (working) jar file in my /src/main/recources. When I try to copy the jar, it gets corrupted. I have tried almost everything, but can't find a solution. I do this because I want to remove the old jar after an update

#

As I found out, Maven might be a problem (with compiling)

maiden briar
unreal quartz
#

do you have any sort of resource processing

wraith rapids
#

inb4 it's a filtered resource

#

i don't know if maven is smart enough not to filter non-text resources

maiden briar
#

I have <filtering>true</filtering>

wraith rapids
#

that means it's a filtered resource

maiden briar
#
<resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>src/main/resources/TvheeAPI-FileRemover.jar</exclude>
                </excludes>
            </resource>
        </resources>
#

But I can't find a way to exclude it from Maven

#

From the filtering

wraith rapids
#

why is it a separate jar anyway

#

just preload your classes and delete the jar

maiden briar
#

How to do that?

wraith rapids
#

unsafe is one way, but is not strictly necessary

#

what you are doing once again seems very silly

maiden briar
#

I use the jar to remove the old version from my plugin after x seconds

#

I can't find any other way

wraith rapids
#

that is silly

maiden briar
#

And Maven does copy my .png file without any problems

wraith rapids
#

have the server delete it

maiden briar
#

Yes is that possible then?

wraith rapids
#

bundling random jars and invoking them through the command line is thoroughly silly

maiden briar
#

Yes so I don't want to use command line, I just copy the file remover, remove the file, and if the new jar boots up it removes the file remover

wraith rapids
#

and won't even work in many environments

maiden briar
#

Ok what would you do then?

wraith rapids
#

have the server delete the file after the plugin is unloaded

maiden briar
#

Ok and how am I gonna do that?

wraith rapids
#

with, for example, a thread

maiden briar
#

I don't understand, can you show some code?

wraith rapids
#

threads you spawn stay running even after your plugin unloads

#

same goes for asynchronous bukkit tasks that have already started but not finished

maiden briar
#

Ah that is nice, but I can't delete the old file in the old file with File.delete()

wraith rapids
#

i doubt your other jar would have much success in deleting it either, then

maiden briar
#

Yes, but then the problem is: how can I notice the new jar about the file?

#

Because there are more .jar files in the plugins folder

wraith rapids
#

search the directory

maiden briar
#

Creating a txt file or smth?

wraith rapids
#

or look in the updates directory

#

ideally the latter as that is a preexisting standard

maiden briar
#

Yes

wraith rapids
#

open up each jar in the updates directory, read their plugin.yml

maiden briar
#

And after the plugin unloads, I can even delete it with windows explorer

wraith rapids
#

if their name matches and their version is > than the current version, replace the old jar with that jar

maiden briar
#

And then check if the name is the same

#

Yes

spare prism
#
[13:50:46 INFO]: Vault has not been found on this server. Disabling the EconomyManager.
[13:50:46 INFO]: [Vault] Checking for Updates ... 
[13:50:47 INFO]: [Vault] No new version available```
Hello, how can I fix this?
EconomyManager.java: https://paste.md-5.net/nuzetatefo.java
#

?paste

undone axleBOT
vital ridge
#

?paste

undone axleBOT
ivory sleet
#

You need a plugin that provides an implementation of the vault api interfaces

vital ridge
#

i also included bungeecord in my maven dependencies

#

and repositories

ivory sleet
#

Nuxoria you’re trying to load the class JavaPlugin in bungeecord context

vital ridge
#

WHat should I change?

ivory sleet
#

Idk you never sent any code

vital ridge
#

I mean what code should I send? It doesnt point to my code

#

Main class?

ivory sleet
#

That would solve the problem with an economy

ivory sleet
vital ridge
#

oops

#

didnt mean to do that

#

Here thats my main class

ivory sleet
#

You can’t extend JavaPlugin in a bungeecord server

#

The class isn’t provided (loaded) anywhere this ncdfe is thrown

solemn relic
#

For some reason this stops working after a while... The event doesnt even seem to get called

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onSpawn(ItemSpawnEvent e) {

        Item item = e.getEntity();

        Bukkit.getScheduler().runTaskAsynchronously(Core.getInstance(), () -> {
            for (Collector c : Core.getInstance().collectors) {

                if (e.getLocation().getChunk() == c.getChunk()) {

                    if (c.getFaction() == null) return;

                    if (!Core.getInstance().drops.contains(item.getItemStack().getType())) return;

                    c.depositDrop(item.getItemStack().getType(), item.getItemStack().getAmount());
                    item.remove();

                }
            }
        });

    }
vital ridge
#

So I should just extend plugin?

ivory sleet
#

Easier said that any spigot specific class shouldn’t be used in a bungeecord context

#

Yeah pretty much look at the wiki page nuxoria

ivory sleet
solemn relic
#

Same outcome

ivory sleet
#

Maybe try doing it sync

#

Oh fair

solemn relic
#

I have tried tons of stuff lol

#

I dont get it

ivory sleet
#

Hmm have you debugged with like print statements or something?

#

Anyways Idk if using == to compare chunks is a good idea

solemn relic
#

Thanks!

wraith rapids
#

iirc removing entities async is sort of fine

ivory sleet
#

Oo

wraith rapids
#

calling the remove method on the bukkit wrapper only sets a flag

ivory sleet
wraith rapids
#

the server will look at the flag synchronously and actually remove the entity synchronously

ivory sleet
#

Ah NNY makes sense

wraith rapids
#

i'm a pretty sensible guy

solemn relic
#

Soo many bugs lol

ivory sleet
#

Ahh lmao

#

Good luck (:

solemn relic
#

Thanks!

ivory sleet
vital ridge
#

Okay I made my whole plugin in spigot and I want it for bungeecord

#

do I basically need to recode bunch of sht?

wraith rapids
#

yes

#

bungeecord is not a minecraft server

#

it is only inevitable that if you write something for a minecraft server, you'd have to rewrite parts of it for it to work on bungeecord

vital ridge
#

I mean I have commands events etc

#

They are all different in bungee as i understand

ivory sleet
#

Yes they’re

#

Literally everything is different except the chat api

#

And some common libs

#

Like netty and possibly guava

iron condor
vital ridge
#

Gosh well

#

Illneed to recode everything pretty much

wraith rapids
#

you probably can't even do what you're trying to do on bungee

#

again, it is not a minecraft server

#

there are no players in the common sense, there are no worlds, there are no entities and there are no blocks

vital ridge
#

Sht wait

#

I have a plugin

#

which uses database to store nicknames etc

#

1 mysql database

#

If i enable it on all the spigot servers connected to the bungeecord

#

they should use the same database?

#

if the credentials are the same

#

in their configs

wraith rapids
#

yes, you probably won't need anything on the bungeecord server in that case

quaint mantle
#

Hi, I'm trying to build a server to bedrock and java, I already can do it but I can't put mojang commands, and I'm confused, because I went to your site (https://www.spigotmc.org/go/commands-yml) and I didn't understand anything. Can u help me?

BukkitWiki

Commands.yml - Official BukkitWiki

wraith rapids
#

i can't understand anything you're saying, either

proud basin
#

eternal oxide
#

toString()

iron condor
#
CoordinatesObfuscator\src\main\java\org\warp\coordinatesobfuscator\CoordinatesObfuscator.java:14:18
java: cannot access org.bukkit.Bukkit
  bad class file: /.m2/repository/io/papermc/paper/paper-api/1.17-R0.1-SNAPSHOT/paper-api-1.17-R0.1-20210627.045602-51.jar!/org/bukkit/Bukkit.class
    class file has wrong version 60.0, should be 55.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

what does that mean?

eternal oxide
#

Thats Paper not Spigot

iron condor
#

paper is a fork

#

so I thought I could ask here

eternal oxide
#

This Discord is for Spigot not Paper

maiden briar
#

@wraith rapids issue fixed, thx for your help

ivory sleet
#

@iron condor it requires java 17

#

class version 60.0 = j17

iron condor
#

thanks

maiden briar
#

How can I set the MOTD in bungee? They made it a bit complicated with MotdInfo and MotdItem

#

And also, how can I get the MOTD?

#

I see smth like ServerPing#getDescriptionComponent, can I cast this to TextComponent?

crude hound
#

hi, how can I use the onInventoryClick event bet just after the player clicked?

ivory sleet
#

schedule a task 1 tick after

crude hound
#

ok

#

thx

#

work fine

vital ridge
#

I have a nick blacklist. If you name yourself &eshit, it gets detected, but for some reason, &esh&bit for example doesnt get detected? Im checking if the nickname contains any string from blacklist. What should I do?
My check:

final String noCharMessage = e.getMessage().toLowerCase().replaceAll("&", "");
                    if (!noCharMessage.contains(str.toLowerCase())) {
#

i tried replacing all the chars with empty space, thought dumbly that maybe that stops something

ivory sleet
#

use replace

#

replaceAll takes regex

vital ridge
#

u sure that will fix anything?

#

.contains should detect even with chars tho

#

cuz even with chars it still contains the string letters in the blacklist

ivory sleet
#

Well if u wanna get rid of chatcolors use ChatColors.stripColors iirc

vital ridge
#

the chars still remain in the message using that

#

You just wont see the colors anymore

ivory sleet
#

what chars?

vital ridge
#

colors

#

&e &a etc.

ivory sleet
#

oh yea you need to translate them then also

#

my bad

vital ridge
#

Wait

#

I just need to use the casual chatcolor translate method?

#

doesnt it like translate the chars back to colors again?

maiden briar
#

It won't show the MOTD, hover, etc, but if I login, I can just join the server without problems, this server is hosted under Bungee and in Bungee I try to change the MOTD, hover, etc

ivory sleet
#

e.getMessage().toLowerCase().replaceAll("&[a-fA-F0-9]{1}","")

maiden briar
#

You forget the &r

vital ridge
#
[a-fA-F0-9]
#

what does this represent?

ivory sleet
#

oh yeah add that also

wraith rapids
#

{1} is redundant

ivory sleet
#

any character between a-f, A-F and any number 0-9

#

is it?

#

oo

wraith rapids
#

yes

#

[a-f] matches 1 character in the range a to f

#

[a-f]{1} matches 1 character in the range a to f

ivory sleet
#

fair

vital ridge
#

The {1} is lil bit not understandable? It like counts every character?

#

every single one?

#

in the range of specified

wraith rapids
#

{} is the number of matches required

#

{x} requires the preceding pattern to match x times consecutively

wild marten
#

Hi, so im using
player.setCooldown();
to set an cooldown for a specific itemstack but no matter how long i put in the ticks section, it still around 2-3 seconds

wraith rapids
#

a{5} matches 5 consecutive a characters

vital ridge
#

oh okay

#

so if i use 5

#

there needs to be 5 colors used?

wraith rapids
#

then it would need to be &aaaaa

maiden briar
wraith rapids
#

instead of &a

vital ridge
#

oh okay

wraith rapids
#

to match multiple colors, you'd do (&[a-f]){5}

#

which would match &a&a&a&a&a

vital ridge
#

I should be good with the method above

wraith rapids
#

yes

#

but the {1} is redundant so you can remove it

vital ridge
#

Im worried tho if they do example &bsh&a&a&ait

#

or its still detected?

ivory sleet
#

yeah

wraith rapids
#

it's a replaceall

vital ridge
#

oh okay

wraith rapids
#

it will match &b and &a and &a and &a

vital ridge
#

ohh okay

#

yeah gotchu

#

ill implement it

#

and see wassup

maiden briar
vital ridge
cedar latch
#

Hi i want to be able to check if an item (custom) is in a dispenser and then doing some other code. How would this be possible?

frosty tinsel
alpine radish
#

how to add softdepend in bungee?
softdepend and softdepends wont work

clear fable
#

Hey guys! I really need some help with packets. I am using protocol lib to send entity metadata packets with the invisible bit set to true. I send these whenever a player joins. It works correctly until the server has to update that byte with actual data. For instance when a player sneaks (part of the same byte in the entity metadata packet) spigot overwrites my custom invisibility with the "actual" data from the server. How can I prevent that from happening and make sure that the invisibility bit never unsets? I am trying to use an outgoing packet listener but I have been having a lot of trouble with it and I finally have decided to ask for help (I've been debugging for 4 hours :/). Here is my code for turning a player invisible for another player: java public void setInvisible(Player target, Player sendTo) { PacketContainer packet = pm.createPacket(PacketType.Play.Server.ENTITY_METADATA); packet.getIntegers().write(0, target.getEntityId()); WrappedDataWatcher watcher = new WrappedDataWatcher(); WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(Byte.class); watcher.setEntity(target); watcher.setObject(0, serializer, (byte) (0x20)); packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects()); try { pm.sendServerPacket(sendTo, packet); } catch (InvocationTargetException e) { e.printStackTrace(); } }

wild marten
#

yea

clear fable
#

no i cant use the spigot one

wild marten
#

why not

clear fable
#

i need an invis packet i dont need to hide the players

wild marten
#

o

clear fable
#

i want the effect where players are invisible but only transparent using the Team "seeFriendlyInvisibles" thing

#

but i also need players to see themselves as not invisble

#

hence why i need to send custom packets to each player

wild marten
#

Hi, so im tryna set a cooldown for items and im using
player.setCooldown(<material>, <ticks>);
to set it but no matter how long i put in the ticks section, it still around 2-3 seconds, any1 know how to fix this?

alpine radish
#

whats "player"

clear fable
#

u mean like attack cooldown?

wild marten
#

player is Player

#

and cooldown is like the enderpearl cooldown on newer versions]

#

this is on 1.17

clear fable
#

does that even work for other items?

alpine radish
#

https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/HumanEntity.html#setCooldown(org.bukkit.Material,int)

void setCooldown​(@NotNull
Material material,
int ticks)
Set a cooldown on the specified material for a certain amount of ticks. ticks. 0 ticks will result in the removal of the cooldown.
Cooldowns are used by the server for items such as ender pearls and shields to prevent them from being used repeatedly.

Note that cooldowns will not by themselves stop an item from being used for attacking.

Parameters:
material - the material to set the cooldown for
ticks - the amount of ticks to set or 0 to remove```
#

type /version

clear fable
wild marten
#

running latest version

wraith rapids
#

register an outbound packet listener that filters metadata packets

wild marten
#

ofc as soon as I come here, my problem just magically fixes itself

#

istg this happens so much

#

String.valueOf()?

alpine radish
#

just use ()

wild marten
#

o

#

ye put in brackets

alpine radish
#

"xxx " + (5 - 2) + " yyy"

wraith rapids
#

that's not a cast, for the record

#

that's an implicit String.valueOf() call

#

you can't cast a double to a string because a double is not a string

clear fable
clear fable
alpine radish
#

softdepends doesn't works

clear fable
#

ah ok

#

weird

tardy delta
#

how does this not work?

wraith rapids
#

did you set it as the executor

tardy delta
#

ah found it

cedar latch
#

Hey guys what am I doing wrong here?

eternal night
#

not java at least

cedar latch
#

wdym?

tardy delta
#

whats the error?

eternal night
#

getConsoleSender is a method

#

this is not how you use methods in java

tardy delta
#

ah didnt see it 👀

#

lol

cedar latch
#

Then what should I put in thee?

wraith rapids
#

learn java

calm whale
tardy delta
#

does this support color codes?

public static void logWarning(String message) {
        Bukkit.getLogger().warning("§c" + message);
    }
#

🙄

wraith rapids
#

don't use the bukkit logger

#

use your plugin's logger

calm whale
wraith rapids
#

and in no fucking circumstance use that

tardy delta
#

does the plugin's logger supports colors?

wraith rapids
#

yes, but it is slightly more involved than just piping shit to the console sender

#

that said, using the console sender as a logger is the wrongest possible way to log messages

tardy delta
#

yea xd

calm whale
rigid otter
#

Can anyone give me javax.annotation maven repo(repository code and dependency code) that is used by spigot?

ivory sleet
#

Google?

clear fable
#

ok now im running into an even weirder problem? somehow modifying the data in a packet causes more of the same packet type to be sent, but only if I'm changing the data everytime. its rly weird idk how to describe it

rigid otter
lapis relic
#

"javax.annotation mvnrepository"

wraith rapids
#

look at the spigot pom.xml

#

that will specify the version

ivory sleet
#

Also thought that was exposed as a transitive dependency with spigot api

wraith rapids
#

dunno

#

i don't use javax annotations

ivory sleet
#

Myeah I use checkersqual or what it’s now called

calm whale
#

I would like to know how I could generate a specific biome in a specific area, I don't to replace the chunks roughly, I would like to have the smooth biome border from world generation. Here is my topic: https://www.spigotmc.org/threads/generate-specific-biome-at-0-0.513026/

wraith rapids
#

you'll never get any help for that here

#

i'm not saying it's an invalid question, but it is definitely beyond the area of expertise for literally everyone here

#

maybe try spam pinging md69, he might have a solution

calm whale
#

oh damn

ivory sleet
#

Yeah that problem can be challenging as it probably goes down deep inside nms

wraith rapids
#

this is of course because the bukkit world generation api is like 5 years out of date conceptually and was hamfisted as shit to begin with

#

using nms is by this point easier than trying to use the api

rigid otter
tardy delta
#

how can i make this work?
Bukkit.getLogger().warning(ChatColor.RED + message);

#

i got just this

rigid otter
#

For me, I experienced it just in some console, idk too

maiden briar
#

Bungeecord has no "disablePlugin" method, how can I disable the current plugin so I can remove the file with File.delete() ?

weary pagoda
#

to save every single data of a user what should I do?

earnest sonnet
weary pagoda
#

I would like that when the user has the phone number it is saved, so as to prevent another user from exiting the same number, and that they are saved even if I turn off the server

tardy delta
#

phone number :/

#

this is spigot i guess

weary pagoda
#

yes for an RP server

earnest sonnet
#

Database

tardy delta
#

ah

#

yml file is also possible

hybrid spoke
#

database of your choice

#

mongodb, mysql, sqlite, yml, json

weary pagoda
#

where can I see something to understand how it all works? I am not very practical

hybrid spoke
#

at google

tardy delta
earnest sonnet
tardy delta
#

ah yea depends

wraith rapids
#

youtube tutorials are almost always trash anyway

weary pagoda
#

is it possible to hack nasa?

earnest sonnet
#

Autocorrect corrected Json to join

earnest sonnet
soft dragon
#

Can you help me fix this: org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
I compiled using maven and copied the jar into the plugins folder, then this error got in the console 😦

tardy delta
#

lmao hacking nasa

tardy delta
soft dragon
tardy delta
#

remove that

soft dragon
#

Because i want to define "Mooshroom"

tardy delta
#

then it will work

soft dragon
#

But then its giving error on my IDE

soft dragon
proud basin
#

What is better json or yaml?

noble spire
#

i'd go yaml for spigot-related things

summer scroll
tardy delta
#

yea i'm now using that

noble spire
#

How do you use maven to build a spigot plugin? (ig you need to specify to include plugin.yml), but I've never used maven in this way before, also, when running mvn package, I get this error.:

[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper

If I change $JAVA_HOME to java 1.8, it works, although I'm working towards making it for 1.17 which requires Java 16.

Current pom.xml: https://paste.md-5.net/quxuloseta.xml

tardy delta
#

just use the things your ide includes

noble spire
#

ik how to use that, but I'm trying to use maven

#

also it lets me use maven plugins

#

like maven-shade-plugin

tardy delta
#

which ide are you using?

noble spire
#

intellij

tardy delta
#

do you have that maven popup window at the right?

noble spire
#

the maven refresh icon thing?

tardy delta
noble spire
#

oh yeah

tardy delta
#

try doubleclicking on package there

noble spire
#

awesome, but 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 41, column 21

#

oh wait that's a pom problem

tardy delta
#

include that in your pom.xml i guess

noble spire
#

okay, I've got a couple more issues but I think I can fix them

hybrid spoke
tardy delta
#

the fact you recognises it says alot 😂

noble spire
#

xD caught in 4k

earnest sonnet
#

🤣

noble spire
#

if you didn't know, Win+Shift+S is a shortcut on windows to select an area to screenshot

#

rather than print screen

#

although clearly you have nothing to hide

tardy delta
#

using shareX 🤤

earnest sonnet
#

Dammit, I shouldn't have installed lights hot

tardy delta
#

too lazy to press ctrl

noble spire
#

oh nice

earnest sonnet
#

Lightshot* autocorect is killing me

lapis relic
#

general moment

hybrid spoke
#

no need to shame for it

earnest sonnet
#

🤣

tardy delta
#

🤡

noble spire
#

for some reason the server booster colour makes me think they're all mods

#

although I know they're not

hybrid spoke
#

i am a god

tardy delta
#

you are noob yea

hybrid spoke
#

says the one using jd gui

tardy delta
#

🥰

noble spire
#

says the one who spotted jd gui before looking at what the screenshot was actually for

hybrid spoke
#

i did

tardy delta
#

😂

hybrid spoke
#

but jd gui is shit

noble spire
#

o, so you use intellij's in built one

#

then

#

sus

rocky glacier
#

How can i fix that i rly can’t find a solution:
org.bukkit.plugin.RegisteredServiceProvider<?> required java.lang.Object

tardy delta
#

but something in the <> ?

hybrid spoke
proud basin
#

Would File userdata = new File(Bukkit.getServer().getPluginManager().getPlugin("Core").getDataFolder(), File.separator + "PlayerDatabase"); make a new folder?

noble spire
#

so you use a decompiler enough that you spent time finding a nice one

#

even more sus

eternal oxide
rocky glacier
#

If i put T in it it says cannot resolve symbol T

tardy delta
#

hahahahahaaa

#

put a class inside it

#

smh

wraith rapids
#

no, instantiating a file does not modify the contents of the filesystem

hybrid spoke
wraith rapids
#

a file is just a dumb wrapper over a path that points at a filename on the disk, which may or may not exist

noble spire
#

lol

wraith rapids
#

yes

#

use mkDir or whatever it's called to actually create the directory

compact haven
hybrid spoke
wraith rapids
#

instantiating a File object does not modify or even necessarily read the filesystem

#

a file object is just a dumb wrapper over a path that points at a filename, which may or may not exist

#

calling methods on the file just defer to the filesystem with the given path

soft dragon
#

I type MushroomCow but it need to type MushroomCow.Variant.BROWN

tardy delta
#

ki

rocky glacier
eternal oxide
#

If you didn;t add bStats you should leave it alone. Its not yours

rocky glacier
#

I have perm to update plugin from 1.14.4 to 1.17

#

Bc the dev is inactive for years and lives in korea and i asked him and he sayed yes

eternal oxide
#

If its in your code just remove it. If its not then you didn't add it. A LOT of plugins use bStats. If you try and remove it you will piss off a lot of devs

#

If you don;t want to use it then thats your choice, but to try and remove it is crazy.

rocky glacier
#

It‘s not my plugin i only have the perm to decompile and update to 1.17

#

Bc i cant fix that error i mentioned

eternal oxide
#

Then you have no need to remove an rsp

#

all you do is delete any reference to bStats in yoru plugin

rocky glacier
#

In the orig files is <?> working but not in my case

noble spire
hybrid spoke
#

maybe you should send us the code

#

so we could help you better

rocky glacier
#

The whole or just of the file where the error is?

soft dragon
#

bStats is just

#

metrics for your plugin usage

hybrid spoke
soft dragon
#

not reely important!

eternal oxide
#

Why work with decompiled? If the author gave permission surely he has the source you can use.

hybrid spoke
#

bstats is for many devs important

tardy delta
noble spire
rocky glacier
#

I messaged him but hes not online anymore

#

Isk why

#

Idk why

tardy delta
#

like this

noble spire
#

nope, thanks got it

hybrid spoke
eternal oxide
#

ok, well if you have issues with your code its probably easier for you to show some code and ask whats up, than trying crazy hacky stuff.

noble spire
#

(I really don't know much maven cheers)

tardy delta
#

xd

proud basin
#

This should create a new file if it doesn't correct? ```java
File f = new File("PlayerDatabase", File.separator + uuid + ".yml");
if (!f.exists()) {
f.createNewFile();
}

hybrid spoke
proud basin
#

Can't that's why I am asking, just writing downs notes for later

hybrid spoke
#

what should i do with it?

rocky glacier
proud basin
#

?paste

undone axleBOT
rocky glacier
#

Ight wait

hybrid spoke
hybrid spoke
rocky glacier
quiet ice
#

conventions exist ffs

quiet ice
hybrid spoke
rocky glacier
#

@hybrid spoke Line 153

proud basin
#

gonna go test it out

#

ok yea it makes it awesome!

rocky glacier
quiet ice
#

Looks like an obfuscated plugin to me

proud basin
#

I feel like im doing this wrong I'm getting a NullPointerException here ```java
FileConfiguration playerData = YamlConfiguration.loadConfiguration(f);

wraith rapids
#

'here'

#

f is null

proud basin
#

how can f be null the file is there

wraith rapids
#

because f is a field

#

or a variable

#

it doesn't care about the underlying filesystem

quiet ice
#

which is null

earnest sonnet
#

Not a file name

quiet ice
#

if it is not null it is still null, and if you are sure that it is not null (like really sure) then report it to the library devs

wraith rapids
#

chin and nose man needs to put fewer spec points in the chin and nose and more in java

tardy delta
#

😂

proud basin
#

but f is File f = new File("plugins/Core/PlayerDatabase", File.separator + uuid + ".yml");

earnest sonnet
#

Print it

tardy delta
#

what is the "prefix" of severe again?

wraith rapids
#

SEVERE?

earnest sonnet
wraith rapids
#

depends on the logger, really

tardy delta
#

yes

wraith rapids
#

most things use either ERROR or SEVERE iirc

tardy delta
#

ah oke

earnest sonnet
#

Yep that

proud basin
#

I see what's happening the player that got killed file is being made

#

that's why im getting a null

dire otter
#

Is there a way to decrease/freeze ticks when no players are online? There's EmptyServerOptimizer and Hibernate but they Thread.sleep() which is a pretty meh solution (not to mention the server ends up running several thousands of ticks behind). Carpet for Fabric has /tick freeze, which is exactly what I am looking for

wraith rapids
#

disable spawn chunk loading for all worlds

proud basin
wraith rapids
#

the server will still tick but since there is nothing to tick, the ticks will only cost a fraction of a ms

dire otter
#

That is indeed one solution, I hoped for something even cleaner

wraith rapids
#

there is none without extensively modifying the server source

stone sinew
soft dragon
#

Can you help me? My code isnt working... When Moshroom is hit by lightning, the plugin must send message that the cow is hit my lightning but it isnt doing it...

MAIN:
`package com.protonmail.darkhacker8604.moobloom;
import org.bukkit.command.CommandExecutor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.MushroomCow;
import org.bukkit.event.Listener;

import org.bukkit.plugin.java.JavaPlugin;

@SuppressWarnings("unused")
public final class Moobloom extends JavaPlugin implements Listener, CommandExecutor {

FileConfiguration config = getConfig();

@Override
public void onEnable() {
    // Plugin startup logic
    getLogger().info("onEnable is called!");

    config.addDefault("MoobloomRandomSpawn", false);
    config.addDefault("LightningStrikeTransform", true);
    config.options().copyDefaults(true);
    saveConfig();
    // Enable our class to check for new players using onPlayerJoin()
    getServer().getPluginManager().registerEvents(this, this);
    getServer().getPluginManager().registerEvents(new StrikeTransform(MushroomCow.Variant.BROWN), this);

}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}`
StrikeTransform:

`package com.protonmail.darkhacker8604.moobloom;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

public class StrikeTransform implements Listener {
private final Object MushroomCow;

public StrikeTransform(Object mushroomCow) {
    MushroomCow = mushroomCow;
}

@EventHandler
public void onEntityDamageEvent(EntityDamageEvent event) {
    if (event.getEntity() == MushroomCow) {
        if (event.getCause().equals(EntityDamageEvent.DamageCause.LIGHTNING)) {

// Bukkit.getServer().getConsoleSender().sendMessage("MUHSROOMCOW IS STRIKE BY LIGHTNING OMG");
for(Player allPlayers : Bukkit.getOnlinePlayers()) {
allPlayers.sendMessage("Hi, I must be now moobloom");
}
}
}
}
}`

wraith rapids
#

depending on setup it might take longer than 30 seconds to spin up which would time out the connecting client

stone sinew
undone axleBOT
wraith rapids
#

learn java

#

you clearly have absolutey no clue what you're doing

soft dragon
#

thanks for giving me tool, that is formating the java

stone sinew
# soft dragon https://paste.md-5.net/ijoqoputac.java

Why is main registering events with no events.
if(event.getEntity() == MushroomCow) should be if(event.getEntity() instanceof MushroomCow) or if(event.getEntity().getType() == EntityType.MushroomCow)
everything else looks fine but I could be wrong

hybrid spoke
#

why is your Moobloom class implementing listener and commandexecutor?

proud basin
#

I was about to ask that

stone sinew
#

I already did lol

soft dragon
hybrid spoke
#

getServer().getPluginManager().registerEvents(this, this); not needed in your onEnable since your Moobloom class does not contain any events

hybrid spoke
soft dragon
proud basin
#

oof

hybrid spoke
#

FileConfiguration config = getConfig(); you could just use getConfig()

stone sinew
hybrid spoke
#

if (event.getEntity() == MushroomCow) { this will not work since its not the same obj in the heap

stone sinew
hybrid spoke
stone sinew
hybrid spoke
#

i was concentrated on roasting his code

soft dragon
#

haha

stone sinew
hybrid spoke
hybrid spoke
#

just a redundant ref on the stack

stone sinew
#
FileConfiguration c = getConfig();
c.isSet("Path")
c.getBoolean("Path")
c.getString("Path")

getConfig().isSet("Path")
getConfig().getBoolean("Path")
getConfig().getString("Path")
```Top one is alot cleaner to me.
wraith rapids
#

debatable

hybrid spoke
#

even the fact that its a single letter identifier makes it unclean af

stone sinew
stone sinew
earnest sonnet
#

🤣 🤣

hybrid spoke
#

in your first example i would have to look up what c is. in your second one i would already know it by flying by

stone sinew
hybrid spoke
#

but you do know what obfuscation is?

eternal oxide
#

You seem to not understand what obfuscation is intended to do

stone sinew
#

But we know exactly what they do 😉

eternal oxide
#

Yes, its whole purpose is to make it difficult to read the code

stone sinew
#

And also it doesn't matter what I name my fields or methods because its not suppose to be read by others in the first place

quasi flint
#

?paste

undone axleBOT
wraith rapids
#

getConfig().ifSet("Path", String.class, (v) -> this::doThing).elseDo((c,p) -> c.set(p, "defaultValue")).save()

quasi flint
#

With this code i have a little problem

wraith rapids
#

the cleanest

quasi flint
#

When i fall under lets say y 30 i die 2 times

hybrid spoke
quasi flint
#

whatever i tried i everytime dont respawn or die 2 times

#

no matter what

#

can someone help?

stone sinew
wraith rapids
#

don't argue with opinions

stone sinew
quasi flint
#

yes

wraith rapids
#

as in, don't come into an argument with your opinion

quasi flint
#

sat here like 2 hours no clue

hybrid spoke
stone sinew
wraith rapids
#

because it objectively isn't

hybrid spoke
stone sinew
wraith rapids
#

spitting mad facts broh

stone sinew
#

I took up someone elses plugin and hated the code ever since

true agate
#

Hello, I edited the message,properties of bungeecord.jar and made this change, restart=\u00A7b\u00A7lSven \u00A73〢\u00A7cProxy restarting. How do I put all files together as a jar again?

hybrid spoke
stone sinew
hybrid spoke
stone sinew
quasi flint
#

kk

true agate
#

I can't send screenshot here

#

I got that file by extracting the jar

hybrid spoke
stone sinew
true agate
proud basin
#

Why isn't text being made in the file ```java
FileConfiguration playerData = YamlConfiguration.loadConfiguration(playerKiller);
int kills = 0;
playerData.set("kills.amount", kills);

#

no errors

hybrid spoke
#

since you never save it

hybrid spoke
stone sinew
quasi flint
true agate
proud basin
#

I am saving it though

stone sinew
proud basin
#
File playerKiller = new File("plugins/Core/PlayerDatabase", File.separator + uuid + ".yml");
            System.out.println(playerKiller);
            if (!playerKiller.exists()) {
                playerKiller.createNewFile();
            }

            FileConfiguration playerData = YamlConfiguration.loadConfiguration(playerKiller);
            int kills =  0;
            kills = kills++;
            playerData.set("kills.amount", kills);
            
            
            playerData.save(playerKiller);

            File playerKilled = new File("plugins/Core/PlayerDatabase", File.separator + uuid0 + ".yml");
            if (!playerKilled.exists()) {
                playerKilled.createNewFile();
            }
            System.out.println(playerKilled);
            FileConfiguration playerData0 = YamlConfiguration.loadConfiguration(playerKilled);
            int deaths = 0;
            playerData0.set("deaths.amount", deaths);
            
            
            playerData0.save(playerKilled);
stone sinew
proud basin
#

just testing stuff

hardy swan
#

sorry for asking noob question, is there a method in Material to get eye-pleasing names like Grass Block

#

or must we like format the GRASS_BLOCK string ourselves

final fog
true agate
hardy swan
final fog
#

Haven’t done java in a couple of weeks so 🤷‍♂️

#

Not something I can confirm

hardy swan
#

I somehow remembered Material#name() doing the job but somehow it is exactly like #toString() now

final fog
#

What does that return

hardy swan
#

GRASS_BLOCK lol

final fog
#

Oh

hardy swan
#

I thought I remembered it returning Grass Block

#

maybe I was using LocaleLib then idk

final fog
#

What are you even working on

#

Just curious

#

Lol

hardy swan
#

economy plugin

#

lmao

final fog
#

Neat

quasi flint
#

Quick question: When i respawn the player after setting his health to 0 and respawning him with player.spigot.respawn, why doesnt the respawn button go away

#

He has to click the button once again

quasi flint
#

fixt it with delayed task

reef wind
earnest sonnet
#

?paste your plugin.yml too

undone axleBOT
reef wind
#

edited it

earnest sonnet
#

Not sure, try to docompile the plugin and the plugin.yml to see if it's the same

opal sluice
#

Hi, I have an issue with the 1.17

java.lang.LinkageError: loader constraint violation: when resolving method 'void com.sk89q.worldedit.regions.CuboidRegion.<init>(com.sk89q.worldedit.world.World, com.sk89q.worldedit.math.BlockVector3, com.sk89q.worldedit.math.BlockVector3)' the class loader org.bukkit.plugin.java.PluginClassLoader @6b35854 of the current class, fr/zetioz/autochunkregen/schedulers/RegenScheduler, and the class loader org.bukkit.plugin.java.PluginClassLoader @5a4546a1 for the method's defining class, com/sk89q/worldedit/regions/CuboidRegion, have different Class objects for the type com/sk89q/worldedit/world/World used in the signature (fr.zetioz.autochunkregen.schedulers.RegenScheduler is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @6b35854, parent loader 'app'; com.sk89q.worldedit.regions.CuboidRegion is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @5a4546a1, parent loader 'app')
#

I don't quite understand how could I solve this kind of problem :/

#

Tried to specify the actual class path

#

But doesn't work

reef wind
brittle loom
#

Hello, since 1.16 blue fire has been added to the game. Does anyone know how set a player in blue fire? I can't find the method for it.

cyan bluff
#

How can I damage a player and base its damage reduction on what armor the player is wearing?

#

1.17 btw

tired nacelle
#
Caused by: java.lang.ClassCastException: class org.bukkit.event.player.PlayerQuitEvent cannot be cast to class org.bukkit.entity.Player (org.bukkit.event.player.PlayerQuitEvent and org.bukkit.entity.Player are in unnamed module of loader 'app')

Why it throws me this error, i checked up and the class is implementing Listener. (also hi.)

wraith rapids
#

learn java

#

it says the issue in plain english

#

PlayerQuitEvent cannot be cast to class Player

tired nacelle
#

even PlayerDeathEvent, PlayerJoinEvent, PlayerKickEvent?

#

like what? one hour ago worked fine

wraith rapids
#

none of those are Player

#

a Player is a Player

#

an Event is an Event

#

you wouldn't cast an aeroplane to an orange, would you?

tired nacelle
#

no

wraith rapids
#

would you cast a tree to a bucket?

tired nacelle
#

no

wraith rapids
#

then why are you trying to cast an Event to a Player

tired nacelle
#

i just want to get the Player from Event

wraith rapids
#

then call getPlayer

#

don't cast things

#

casting doesn't change what things are

#

it only changes how they are treated

#

but you can't treat an Event as if it were a Player

#

because an Event is not a kind of Player

tired nacelle
#

.. ok.

wraith rapids
#

you can cast PlayerDeathEvent to PlayerEvent

#

and you can cast PlayerEvent to Event

#

and vice versa

#

because PlayerDeathEvent is a PlayerEvent

#

and a PlayerEvent is a Event

#

PlayerDeathEvent extends PlayerEvent extends Event extends Object

stone sinew
#

So I keep getting Caused by: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled when I stop my server...
In my onDisable() I run Bukkit.getScheduler().cancelTasks(this); but its still not canceling my async tasks it looks like.

eternal oxide
#

you can not use the scheduler during the disable

stone sinew
eternal oxide
#

you need to call a cancel on each task, not use teh scheduler

mortal hare
#

cancel the task inside the runnable

stone sinew
mortal hare
#

it depends on the situation

stone sinew
mortal hare
#

you can do it via getting plugin manager and checking if plugin is loaded but its dirty hack

stone sinew
#

Nah Ill just save the task ID's

eternal oxide
#

just track your tasks and cancel them. Its not difficult.

mortal hare
#

Bukkit.getScheduler().cancelTasks(this) that's really dumb that it wouldn't work

wraith rapids
#

just track the tasks themselves

stone sinew
wraith rapids
#

no point in stripping it down to the id

#

and yes that does cancel all tasks, async or not

#

however, asynchronous tasks that are already running will not be interrupted or terminated

wraith rapids
#

if you are scheduling a new task inside your asynchronous tasks, you will want to ensure that your plugin is enabled

#

ideally, however, you would wait for these tasks to complete in your onDisable, blocking until they are complete

wraith rapids
#

with code

#

logic

#

completable futures or dedicated threads come to mind

stone sinew
#

Seems like just adding Plugin.isEnabled() fixed the error.

wraith rapids
#

yes, that will of course make things not get scheduled if your plugin is already disabled or disabling

wraith rapids
#

the issue, then, obviously is that things don't get scheduled

#

so you have to account for the possibility that things don't get scheduled

hybrid spoke
reef wind
slim kernel
#
new BukkitRunnable() {
            @Override
            public void run() {
               
            }
        }.runTaskTimer(Main.getPlugin(), 0, 15L);

I know how to cancel a normal scheduler but how can I cancel a Runnable like that?

wraith rapids
#

that's not a runnable

#

well, i suppose it is a kind of runnable

#

whether you use BukkitRunnable or BukkitScheduler, you get an object out of it that implements some sort of a cancel() method

#

in the case of the BukkitScheduler, the runTaskTimer() method returns a BukkitTask, which implements the method

wraith rapids
#

in the case of a BukkitRunnable, the runnable itself implements the cancel method

#

in the case of runAsyncTask or whatever those old methods are called, you'll have to use the returned task id with the scheduler to cancel a task by id

stone sinew
#

World.isChunkLoaded is async safe right? I forgot if it was this method or another one.

wraith rapids
#

it generally doesn't explode but it isn't absolutely safe either, iirc

stone sinew
#

Which method was async safe then?

wraith rapids
#

probably none

#

the whole chunk shit isn't really built for threading

#

but, it generally doesn't explode, so it's probably "fine" to call it

digital plinth
#

is there a way to like set the player base damage?

wraith rapids
#

just, you might get some stale data or whatever

digital plinth
#

like make the player's fist do like 4 hearts instead of one

stone sinew
#

Yeah I've used it before. Just checked my last async method.

wraith rapids
#

it shouldn't be much more complicated than a map get with some extra bells and whistles so it shouldn't destroy anything

mortal hare
wraith rapids
#

but it's not synchronized so there is a possibility of getting stale data

mortal hare
#

getting incorrect data

wraith rapids
#

aka stale data

mortal hare
#

in that particular thread

#

like if you set some data in main thread

stone sinew
#

so what NNY said lol

mortal hare
#

and access data

#

on the other thread

#

you'll get older result

#

since Thread caches fields independantly from each other

#

if you're running on single core processor that wouldn't be a problem

#

but nowadays there's not many lol

stone sinew
#
Bukkit.getScheduler().runTaskAsynchronously(pl, () -> {
    locations.forEach(l -> {
        if(l.getWorld().isChunkLoaded(l.getBlockX() >> 4, l.getBlockZ() >> 4)) {
        }
    });
});
``` This is all its for
mortal hare
#

since cache on these methods are not flushed manually, its undefined when the cache will be accessible to another thread

#

i wouldn't bet this is safe

wraith rapids
#

do the check synchronously and then do the process asynchronously

mortal hare
#

what if player loaded the chunk

stone sinew
#

no errors so far lol

mortal hare
#

and thread said it didn't

#

due to cache

stone sinew
#

then it will be loaded in the next check

quaint mantle
#

Hello, im currently working on a plugin and im experiencing quite a complicated issue. If anyone wants to help me in private messages, please do i will appreciate it

mortal hare
wraith rapids
#

and since all of the things you are doing are asynchronous, the chunk may unload or load while your process is running

mortal hare
#

there's probability

wraith rapids
#

so you need to constantly ensure the chunk is still in fact loaded

#

consider placing a plugin ticket on the chunk to ensure it stays loaded during your async execution

mortal hare
#

you see Bukkit scheduler is technically just a thread pool, its undefined when its pool cache gonna flush

stone sinew
#

Well I keep the chunk of the minion loaded but not chunks in the radius of said minion. And I've used that method for 2+ years so seems to work fine xD

wraith rapids
#

famous last words

stone sinew
wraith rapids
#

until one day a race condition hits and the world gets nuked or something

mortal hare
#

Bukkit API is not thread safe. You're just lucky that you haven't encountered any problem due to synchronization

#

i've had these kinds of problems with my GUI library

wraith rapids
#

at any rate, it's probably "fine"

stone sinew
#

Yeah no problems from 1.8.8 - 1.17 so 🤷 (with that method)

mortal hare
#

yapperryapps

#

what ide do you use?

wraith rapids
#

probably mspaint

stone sinew
mortal hare
#

can you decompile on there, the isChunkLoaded method

#

and paste it here

#

to see what's going on

#

im running ST4 so can't do that quickly as Intellij does

stone sinew
#

I don't use eclipse's decompiler

#

one sec though

wraith rapids
#

it defers to the nms chunk provider

#

i can't see how it works on spigot as paper has extensively modified these parts for async chunk loading and shit

mortal hare
#

^^

#

maybe it works

#

because paper loads chunks in async

wraith rapids
#

and I have zero intention of tarnishing my system with splögget sources

mortal hare
#

that could be the case

#

because if chunks are async in paper

#

there should be some kind of synchronization

wraith rapids
#

paper's chunk shit is definitely more robust

mortal hare
#

involved

#

maybe that's why it works for you

#

because you used paper all the time

#

or its forks

stone sinew
#

I don't use paper

#

never have (for personal use), Only for testing other users problems.

jade perch
wraith rapids
#

yeah paper definitely has special handling for those calls being done off the main thread

nova notch
#

how do i shift the player's eye location forward like 5 blocks?

#

why is that my name on here

#

tf

jade perch
#

That's your spigot name

#

Weirdo

nova notch
#

oh

wraith rapids
#

linking is for pussies

nova notch
#

anyway if someone knows ping me

wraith rapids
#

Location::add

ivory glacier
#

Could someone tell me when exactly does the clear weather ticks reset when people sleep?

#

My server is perpetually on clear weather because we sleep every night and I want to have rain too

quaint mantle
#

is possible make a custom invocation like the invocation of the wither?

wraith rapids
#

i don't think you know what invocation means

quaint mantle
#

I am sorry if you did not understand what I tried to ask.

mortal hare
reef wind
mortal hare
#

invoke the method, is basically execute that method.

mortal hare
digital plinth
#

so when player is under the affect of weakness, they cant dmagae anything with their fist, is there a way to make their fist deal half a heart even under weakness?

reef wind
quaint mantle
mortal hare
#

for example WorldObjectReference.spawnEntity(LocationReference, EntityType.Wither);

quaint mantle
#

I know, what I mean is that you build something and an entity is generated.

mortal hare
#

use the on place event

#

and check the sides

#

i guess

quaint mantle
#

is complex

mortal hare
#

i like its theme

quaint mantle
mortal hare
#

i don't have any. You need to make a logic inside the block place event

reef wind
#

Material is made for many IDEs so your IDE might have it too.

cyan bluff
#

How can I give a player a potion effect without using the deprecated method & with a time?

quaint mantle
#

(Google translate)

wraith rapids
#

there isn't really any better way without overengineering the whole thing

wraith rapids
#

is there a question

eternal oxide
#

he was replying. Get a proper Discord client noob

glossy barn
#

wym? i was replying to someone earlier

wraith rapids
#

i can't see replies

eternal oxide
#

Need some magoo glasses

wraith rapids
#

should update ripcord but no effort

proud basin
#

Is it possible to get the file name without the extension

mortal hare
#

just use substring

glossy barn
#

or split it on '.'

wraith rapids
#

not every file has an extension

eternal oxide
#

FilenameUtils.removeExtension(fileNameWithExt)

#

apache commons

glossy barn
#

that works too

wraith rapids
#

if you do use substring or split, you need to make sure that the filename actually has an extension