#help-development

1 messages · Page 547 of 1

errant shale
#

1 of 5 enchants

gloomy thunder
#

help

tardy delta
#

import it

celest sonnet
#

Did you try to make an event listener at the bottom? @errant shale

eternal oxide
#

you should not extend Enchantment

errant shale
#

no

gloomy thunder
#

help

eternal oxide
#

yes

quaint mantle
#
    @EventHandler
    public void mushroom(BlockSpreadEvent e) {
        if (e.getSource().getType() == Material.BROWN_MUSHROOM) {
            e.setCancelled(true);
        }
    }```
is that code true ? i tried but not working
#

i need getblock ?

errant shale
#

so is someone gonna help?

celest sonnet
#

What even are the errors tho

hazy parrot
#

you havent imported

errant shale
#

idk

hazy parrot
#

if you are not using notepad for programming, your ide should scream that you havent imported those classes

errant shale
#

this is what i got

hazy parrot
#

have you used chatgpt or smth ?

errant shale
#

im using IntelJI IDEA

#

no

undone axleBOT
hazy parrot
#

just put mouse on it -> alt + enter -> import class

celest sonnet
#

Or if that doesn’t work just click import class

errant shale
#

did

#

thx

#

but i have 1 more script

#

actually 2

quaint mantle
#

i tried getSource and getBlock event still not working is something wrong on my code ?

#

i cancelled all blockspreadevents and worked

#

i try with debug

errant shale
#

how to i send code again?

quaint mantle
#

😮

#

someone more annoying than me

tardy delta
#

?codeblocks

#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
quaint mantle
#

i added debug and not working

errant shale
#

here

young knoll
#

Oh god <1.13

#

Pain

quaint mantle
#

getTypeid

#

is 1.13 method ?

young knoll
#

getTypeId is very old

#

Don't use it

quaint mantle
#

i changed

young knoll
#

you should still have access to getType in 1.12

quaint mantle
#

i wanna cancel the mushroom spread

#

but didnt worked debug and event

#
    @EventHandler
    public void onBlockSpread(BlockSpreadEvent event) {
        if (event.getBlock().getType() == Material.BROWN_MUSHROOM) {
            event.setCancelled(true);
        }
    }```
#

looking

mellow edge
#

can I put TextComponent inside a book?

#

(and then make actions....)

worldly ingot
#

Yes. BookMeta#spigot()

quaint mantle
#

guys i wanna add cooldown to some events
event will not be available within 5 hours after running
for do this i need scheduler ?
if server close or crash tihs cooldown will work after restart ?

eternal night
#

it would not

quaint mantle
#

i need save cooldowns to some file ?
have a guide for this ?

#

i mean add cooldown to evets

static cave
#

Do you mean like. For Example: PlayerChatEvent can only be run every 5 hours?

eternal night
#

I mean

#

spigot has a config api

#

to read and write from config

#

could abuse that

static cave
#

you could save the Unix time of when you last ran it and then check if it has been 5 hours since then

eternal night
#

or just, simple java file read/write api

#

^

#

load on startup

#

write after use (if you can only use it every 5 hours, if its faster, maye only write on shutdown)

quaint mantle
#

alright

halcyon temple
#

just create the data and instad of creating scheduler just check the cooldown when the event is fired if it's important data you can write the data to file every 5min or something like that

quiet ice
#

String.format?

#

prettier in terms of what?

#

JSON formatting?

static cave
#

depends on what IDE you are using?

tardy delta
#

String#formatted

#

or wait for those new string templates

static cave
#

You can change that directly in Intellij

quiet ice
#

Ctrl + A & Ctrl + Shift + F on eclipse. Should also similarly work in IJ

tardy delta
#

ctrl alt l for ij on windows

quiet ice
#

I don't use auto-format these days though as it often does things that I'd rather not have in a very special usecase

static cave
#

Settings > Editor > Code Style > Java

#

you can change a bunch of stuff ther

static cave
# quaint mantle yes
@EventHandler
    public void onChat(PlayerChatEvent e) {
        FileConfiguration config = Main.getPlugin().getConfig();
        if(System.currentTimeMillis() <= config.getLong("lastrun") + 18000000) {
            e.setCancelled(true);
            return;
        }
        config.set("lastrun", System.currentTimeMillis());
        Main.getPlugin().saveConfig();
        // do stuff
    }

This should only allow the event to be run once every 5 hours. Haven't actually tested if it works though lmao

marsh burrow
#

yo, fellers, anyone know of a way to reigster a command on the fly? Im using commandMap, but only the console can execute the command, not players

young knoll
#

Can they not use it

#

Or does it just not show in tabcomplete

marsh burrow
#

console on the left, player on the right

still adder
#

when a player interacts with an "enchanted anvil", it is supposed to consume a certain item and perform a logic, but the player cannot do that. someone earlier said that the issue was that the event is cancelled immediately, but the issue is still there after fixing that. (or i fixed it wrong)

marsh burrow
quaint mantle
#

i wasnt know

#

Anyone got an idea what event to use when i want to convert concrete poweder once it hits water (as a item)

young knoll
#

You need a timer to keep checking if it's in water

strong parcel
#

Is there a way to listen for a block being destroyed by fire?

quaint mantle
#

isnt a droped item some kind of entity?

#

cant i listen to entity move event?

young knoll
#

That does not exist

quaint mantle
#

oh

#

there is no entity move event??ß

young knoll
#

Because it would be insanely laggy calling an event for every entity movement

quaint mantle
#

oh

#

okay

quaint mantle
young knoll
#

Keep in mind that will not catch items that are not directly dropped by the player

quaint mantle
#

oh true..

young knoll
#

There is however an item spawn event

quaint mantle
#

alright

#

thx

quaint mantle
#

i asked chat gpt the same question and it told me BlockPhysicsEvent hes just dumb right?

young knoll
#

It’s not a block

quaint mantle
#

water is not a block?

young knoll
#

Dropped items aren’t a block

quaint mantle
#

i know that

calm robin
#

anyone have any sample code that i could look at where you used to update a players display name on tab, above their player and in chat with protocollib packet stuff?

#

im trying to add a prefix to player names and color their names

#

but it is different color depending on who is looking at them so im using packets

celest sonnet
#

Will checking every single player interact event cause lag?

#

like it only will work if you click a slime on to a piston, checking with if statement

young knoll
#

No

celest sonnet
#

oh ok

young knoll
#

Tons of plugins listen for that event

marsh burrow
#

Any idea why commands registered via CommandMap only console can execute?

unique bay
#

will using a plugin cause lag

quiet ice
#

haha, very funny

young knoll
#

I mean

#

Technically every plugin causes lag

flint coyote
#

Well not really. As long as everything stays below 50ms/tick it's technically not lag

young knoll
#

I guess it requires you to define lag as “an increase in load on the server”

eternal oxide
#

long

#

until 2035 or something

flint coyote
#

?scheduler

#

dang what was the command

eternal oxide
#

if (Instant.now().isAfter(timeStamp, ChronoUnit.MILLIS);

young knoll
#

You could do a repeating task

#

Or a delayed task

#

Yes

#

But it won’t be super accurate as it’s dependant on tps

#

Use an async task and then sync back to the main thread when doing the kick

#

runTaskLater is sync

#

You want runTaskLaterAsyncronously

lavish robin
#

How computationally expensive is a raytrace?

young knoll
quaint mantle
#

can someone link a guide on how to use yml files

frail gale
#

guys

#

IntellIJ Idea showing only blank screen, what can I do

quaint mantle
vocal cloud
#

Restart or reinstall it?

frail gale
#

Hmmm, I fixed it

#

Deleted the entire data folder.

#

But, right now everything is like new haha, time to find the actual folder which is causing this issue

quaint mantle
#

there must be a better way to do this....

young knoll
#

Milliseconds to ticks should be fairly easy

#

1 tick is 50 milliseconds

young knoll
#

Isn’t a Unix difference already in milliseconds

obsidian plinth
#

you around

river oracle
#

average day in Java Development

#

do you have UUID or player object?

#

if you have a player object they're likely online, but you can always check Player#isOnline

young knoll
#

If you have a uuid Bukkit.getPlayer(uuid) != null

river oracle
#

if you have a UUID you can use Bukkit.getOfflinePlayer(UUID) OfflinePlayer#isOnline

#

getPlayer is easier I suppose

young knoll
#

Either works tbh

river oracle
#

Player inherits OfflinePlayer so Player#isOnline is an what you could do

#

though its very unlikely they'll be offline unless you're doing heavy tasks

quaint mantle
#

am i missing something?

 private final VoidCrates main;
    public CrateRegister(VoidCrates main) {
        this.main=main;
    }
    File crateConfigFile = new File(main.getDataFolder(), "crates.yml");

"Variable 'main' might not have been initialized"

young knoll
#

If it’s an event though they are likely online

quaint mantle
halcyon temple
young knoll
#

Main isn’t set when instance variables are initialized inline like that

quaint mantle
eternal oxide
#

you should not have a Player object if they are not online

young knoll
#

Initialize the file inside your constructor

chrome beacon
young knoll
#

Or compile a set at startup

#

You can stream it

#

You should be careful holding reference to a player object

#

It’ll stop it from getting garbage collected when the player disconnects

#

Generally it’s better to hold the uuid instead

halcyon temple
#

yes you can

eternal oxide
#

yes you can

halcyon temple
#

player object has so much unnessarcy fields

#

so it's expensive to keeping it on memory

fluid river
young knoll
#

Bukkit.getPlayer(uuid)

#

Check if not null, then kick

obsidian plinth
fluid river
#

yeah but

#

i lost my old code sources

#

can you call/stream rn?

obsidian plinth
#

give me like 5 i broke sum lol

fluid river
#

?

obsidian plinth
#

here or private

fluid river
#

private ig

#

cuz stream

obsidian plinth
#

call me whenever

quaint mantle
celest sonnet
#
                    event.getPlayer().getInventory().remove(shear);
                    ((org.bukkit.inventory.meta.Damageable) shearMeta).setDamage(damage);
                    shear.setItemMeta(shearMeta);
                    event.getPlayer().getInventory().addItem(shear);```
#

oh fuck i do it wrong every time oml

#

anyone know whats wrong with this code?

fluid river
#

it doesn't work like this

#

you need to get meta, change it and apply back to itemstack

celest sonnet
#

oh

fluid river
#

Damageable shearMeta = shear.getItemMeta();
shearMeta.setDamage(damage);
shear.setItemMeta(shearMeta);

celest sonnet
#

also do you know why it wont let me just put Damageable?

young knoll
#

You’ve likely imported another damagable

celest sonnet
#

oh ur right i did the entity one im such a dumbass

young knoll
#

Make sure you import the right one

marsh burrow
#

I dont understand, this code should work, but only console can execute this new command

young knoll
#

Why are you registering a fake command

river oracle
#

Wtf is a fake command

flint coyote
#

a command that is fake smh

river oracle
#

CommandMap direct insertion make very real commands

#

Not fake ones

young knoll
#

Yeah but like

#

Why

celest sonnet
#

is it in the plugin file

young knoll
#

Are we too cool to register them the normal way :p

marsh burrow
#

im adding the ability to get addons you can just drop into an expansions folder, but these addons need a command to work, cant just drop in into the plugin.yml file

river oracle
young knoll
#

Then use a proper framework

#

Like ACF or cloud

river oracle
eternal oxide
#

there are already command annotations

flint coyote
remote swallow
#

Gradle plug

flint coyote
#

doesn't look that bad actually

river oracle
marsh burrow
river oracle
#

I'd just use acf lol

quaint mantle
#

how do i do colors in the console

river oracle
#

Unless you make your own console

young knoll
#

I believe you can with consoleSender

#

But why

quaint mantle
#

theres this plugin that makes colors in my console

young knoll
#

The console doesn’t need colors

quaint mantle
flint coyote
#

will it sudoku if it doesn't get colors?

celest sonnet
#

can an item not have meta? intellij keeps telling me to assert than item meta is not null....

flint coyote
#

well there is an @Nullable on it

#

Idk when it would be null though

young knoll
#

Air

celest sonnet
#

oh i see what it is thinking

flint coyote
#

oh lol

celest sonnet
#

no i meant not what it was thinking but why it was happening sorry

flint coyote
#

Sorry for the ping, whoever null is

celest sonnet
#

i was confused cause the item meta being referred to was already shears like it had to be to get to that point in the code

#

so i wasnt understanding how it couldnt have meta but i realized that it doesnt like examine my entire code to figure it out

flint coyote
#

The IDE never has any logic to check whether it can actually be null. It's only driven by those annotations. Even after calling "hasItemMeta()" it will tell you that you should do a null check

#

You can savely ignore it

noble lantern
#

alternatively you can suppress warnings thumbs only reccomend that if you generally know what can be null though

#

sometimes intellij wants to warn me because i null checked something that was nested in another class and im not checking it in another, mad annoying

eager jacinth
#

Hello. I have a possibly strange question. I want to add caching to my plugin, but as you may know, maps return reference, which means I can **modify ** retrieved values as I please. This leads to the following problem: I retrieve a value from the cache, modify it, but forget to save it. What should I do in this situation? Should I always return a copy (clone) of the cached value?

noble lantern
river oracle
#

Mmm you should probably be caching a data object tbh not a map that way you define how its edited much more clearly

#

I mean caching a map is fine but IMHO data object just makes more sense

noble lantern
#

Looked at it, never used that before but seems pretty cool, complicated as hell it seems from this javadoc

Looks overly complicated for something like an MC server 😛

#

Whats the benefits of JDO vs just shoving it to some type of map (for smaller datasets like mc servers)?

river oracle
noble lantern
#

ohhh

#

Like a wrapper for the map essentially, i see

river oracle
#

Those are called Data Objects since they just contain data and provide 0 other purposes

#

Well no

#

I think we think the question asker means different things

#

I'm pretty sure he has a cache storing maps

#

Which works but I'd think is less functional than just using a Data Object

zenith gate
#

is there an event for when a trident comes back to the player?

#

i cant find anything on google

noble lantern
# river oracle I'm pretty sure he has a cache storing maps

yeah then he said this; I retrieve a value from the cache, modify it, but forget to save it.

Which led me to belive he took the object in a map and replaced it redundantly, i did this for like my first 4 months of java cause i didnt know how OOP entirely worked 😛

river oracle
#

Too many questions

noble lantern
#

Maybe, need more info tbf

#

I just assume the most simplest thing most of the time

river oracle
#

So many buzzwords my brain is hurting

noble lantern
#

typically works

#

Remember

MC Plugins, not enterprise coding 😛

#

thouuugh

#

unit tests for plugins do be fire

river oracle
#

I unit test my plugins :P

noble lantern
#

i havent touched an ide in sooo long

river oracle
#

What do you do for work?

noble lantern
noble lantern
river oracle
#

I seriously just code commissions while doing school

#

Cuz that's all I can

noble lantern
#

i get too bored of coding mc stuff and end up just playing games for long stretches of time

ik its been a fat minute since ive helped someone in here lol

remote swallow
#

hes so dedicated to the plugin grind he codes comissions while his gf is laying in his bed

noble lantern
#

someone on minehut showed me some insane new stuff with block displays on 1.19, had elevators and stuff it was so dope i wanna learn how to do that

eager jacinth
# noble lantern If you edit an object in a HashMap (Say Player, and you set theyre health) The ...

Maybe I didn't express myself correctly, but... that's exactly what I'm talking about! I add a player to the cache like this:

    public CompletableFuture<Optional<Profile>> getProfile(UUID uuid) {
        Profile cached = cache.get(uuid);
        if (cached != null) return CompletableFuture.completedFuture(Optional.of(cached));

        CompletableFuture<Optional<Profile>> fromDatabase = getFromDatabase(uuid);
        if (Bukkit.getPlayer(uuid) != null)
            fromDatabase.thenAccept(optionalProfile ->
                    optionalProfile.ifPresent(profile -> cache.put(uuid, profile)));

        return fromDatabase;
    }

And simply remove them from the map when they leave. After every change to the player, I save them to the database. But! If I retrieve a value from the cache (map), make some changes, and FORGET to save the changes to the database, then it's THE END

noble lantern
# eager jacinth Maybe I didn't express myself correctly, but... that's **exactly** what I'm talk...

every change your saving to the database?

Why not run an async task, that flashes your cache into your database every x minutes (Even better, sync it with Minecrafts auto-save time that way you dont have data loss) This way whenever you retrieve a value from the cache, you know that if its modified its gonna get saved and you do not have to do anything extra (eg another line of code calling "saveToDatabase")

Also, why remove the player when they leave? What if they are relogging? You'll have to spend all that computing power loading they're data back again, just let they're data sit until a server reboot :p Im sure you arent gonna have gigabytes of cache laying around for some player data or similar

wary topaz
#

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi ecloud download Player");

[18:44:28] [Server thread/INFO]: Unknown command. Type "/help" for help.

Why is this happening? I've even tried it with a /

#

and since the place holder api says it will be removing registerExpansion in it i cant use that

mortal hare
#

but by brigadier dispatcher

#

or it could be that its the bungee command

wary topaz
#

so how could I manage to dispatch it?, and its a spigot server

mortal hare
#

are you running this server under bungee

wary topaz
#

no

mortal hare
#

you should look for developer api notes from placeholder api creators how to do this instead of relying on commands

wary topaz
#

well they dont say to use commands to register it in plugins

#

and you cant cause they removed the api feature for it

noble lantern
#

i would so use requireNonNull if it didnt look so god damn ugly in my code

wary topaz
#

just turn the null inspection off

mortal hare
halcyon temple
#

this will throw exception if the player is null

noble lantern
#

== null is essentially the same

wary topaz
#

ima just ask in the PAPI discord server

mortal hare
#

it will throw nullpointer exception anyways

halcyon temple
#

you can do something like that Optional.ofNullable(Bukkit.getPlayer(uuid)).ifPresent(p -> p.kick());

mortal hare
#

null.kick() will throw nullpointerexception

#

but it would be delayed by jvm

marsh burrow
#

@river oracle tried this api, but still, seems like commands cant be execute by players when making commands like this

noble lantern
#

look into optionals, theyre godsend

halcyon temple
#

actually optionals are good

mortal hare
#

I believe optionals are good but overusing it isnt correct

#

for example i dont use optionals inside internal classes

noble lantern
#

i like using them for database libary purposes, null check hell goes crazy with mongodb

halcyon temple
#

i'm only using them for database methods

mortal hare
#

I've spammed optionals so hard back in the days

#

everywhere

#

constructors

#

methods

#

you name it

#

but each of that optional costs

#

a bit

#

so i've decided to not use it inside internal classes

halcyon temple
#

yeah i agree but i think it's better than Objects#requireNonNull for null check

ivory sleet
#

optionals suck

#

they're good when u return

mortal hare
#

unpopular opinion

ivory sleet
#

no

eternal oxide
#

I dislike Optionals too

ivory sleet
#

they suck because they dont have yes and no derivatives

#

so it fucks with overloading

mortal hare
#

is null and not null not enough for you?

ivory sleet
#

and type inheritance

#

null is fucked

#

but Optional is scarcely better

#

(just for returning)

noble lantern
#

you can use a Map.Entry kek

mortal hare
#

well in cpp you dont have null at all for objects

halcyon temple
#

wtf

mortal hare
#

but nullptr for pointers

noble lantern
#

i used a map.entry before one time to have 2 answers at one time, was whack but also cool at the same time

#

wtf

ivory sleet
#

u should have a

sealed interface Maybe<V> permits Yes, No {

}

#

this way u can subtype optional

remote swallow
#

please dont do that

#

null check first, then use an instance

ivory sleet
#

thats bad

#

dont do thty ithundxr

mortal hare
halcyon temple
#

just go for if (player !=null)

noble lantern
#

hear me out

Sometimes one liners are bad

eager jacinth
mortal hare
#

they literally couple classes together

ivory sleet
#

now u're just creating throw away objects

ivory sleet
#

which is against effective java (unless certain stuff like builders)

#

compile time awareness of subtypes @mortal hare

remote swallow
#

save an instance

mortal hare
#

which seems counter intuitive

#

in oop

remote swallow
#

Player player = Bukkit.getPlayer(uuid)
if (player != null) {
// that future but without optionals

ivory sleet
#

but java is multiparadigm

#

just look at optional that u were preaching about

mortal hare
#

yea statics

remote swallow
#

do that

#

check if its nullable, if it is isnt just get stuff from that, if it is just null check

#

what event is it

ivory sleet
#

just dont do this lol

#

like Optional... ofNullable... ifPresentOrElse...

remote swallow
#

yeah you can just use the event.getPlayer or Player player = ...

mortal hare
#

table.h

    template <typename t_element>
    class Table {
    private:
        const std::size_t m_rows, m_columns;
        const std::unique_ptr<t_element[]> m_contents;
    public:
        Table(std::size_t rows, std::size_t columns);

table.cpp

template<typename t_element>
nonogram::Table<t_element>::Table(std::size_t rows, std::size_t columns) :
    m_rows(rows), m_columns(columns), m_contents(new t_element[getSize()]) {}

anyone willing to help? somehow this code throws unresolved external symbol at the constructor unresolved external symbol "public: __thiscall nonogram::Table<unsigned int>::Table<unsigned int>(unsigned int,unsigned int)"?

maiden geode
#
        PacketPlayOutMapChunk packetPlayOutMapChunk = new PacketPlayOutMapChunk(((CraftChunk) chunk).getHandle(), 65535);
        (((CraftPlayer) player).getHandle()).playerConnection.sendPacket((Packet) packetPlayOutMapChunk);
    }```java
Hello, can anyone help me with this code? I need to modify this to spigotmc api. Couldn't find a solution for that.
halcyon temple
#

they are same

noble lantern
# eager jacinth Hmm... I really hadn't thought about *Async Task* for cache saving. I've always ...

Yeah you would have to make the auto-save task, you can likely just shove it into a BukkitRunnable

Well, in order to avoid unnecessary caching you can just have different cache pools

IE, for some of my plugins I have the hard player data (money, levels, etc) that gets loaded on player join and STAYS loaded until a server restart, its just not worth the resources to keep loading/unloading it, and the size of the data is often time negligable

Then, for things like my KOTH events or auctions, etc I will clear that cache out every so often, as yeah it would get messy, I guess it just entirely depends on how your data is structured and how viable it is to leave stuff cached, in most cases as long as you aren't caching stuff in some type of loop without clearing it, your gonna be fine thumbs (from a memory leak standpoint)

Just remember, unused memory is free memory

mortal hare
#

i prefer declaring variable and then using it across the code

#

that way i can change the variable at any time

ivory sleet
#

^

#

cleaner also

mortal hare
#

it easier to refactor variable than bunch of function calls

hazy parrot
#

had that problem few days ago

ivory sleet
mortal hare
#

it complains

hazy parrot
mortal hare
#

ooh

#

another clion user

#

what a rare find

noble lantern
#

wtf language is this

mortal hare
#

cpp

hazy parrot
mortal hare
#

eh better than visual studio for me

#

it runs faster

hazy parrot
#

had thrown std::bad_alloc and was debugging for two hours, i ran it in vs and error popped "you cant pop empty queue"

#

and that was reason of std::bad_alloc lol

#

phpstorm is superior for webdev

mortal hare
#

some people love apple products, i love jetbrains ones

hazy parrot
#

webstorm is specialized for js/ts, but if doing full stack app phpstorm is the way

mortal hare
#

literally everything that jetbrains made seems high quality

thick gust
halcyon temple
#

can i see your pom.xml

#

or your dependency for spigot

thick gust
#
<?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>groupId</groupId>
    <artifactId>Rpg</artifactId>
    <name>RPGPlugin</name>
    <packaging>jar</packaging>
    <version>1.0</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <!-- This adds the Spigot Maven repository to the build -->
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <!--This adds the Spigot API artifact to the build -->
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.12.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>xyz.xenondevs</groupId>
            <artifactId>particle</artifactId>
            <version>1.8.4</version>
        </dependency>
    </dependencies>
</project>
fluid river
#

?nms

eager jacinth
thick gust
#
    public static void removeNpc(EntityPlayer npc) {
        npc.killEntity();
        npcs.remove(npc);
    }

Why can't I simply remove an EntityPlayer?? i get a console error:

[02:08:25 WARN]: [Rpg] Task #22 for Rpg v1.0 generated an exception
java.lang.NullPointerException: null
        at net.minecraft.server.v1_12_R1.EntityPlayer.die(EntityPlayer.java:404) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.EntityLiving.damageEntity(EntityLiving.java:951) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.EntityHuman.damageEntity(EntityHuman.java:759) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.EntityPlayer.damageEntity(EntityPlayer.java:577) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.EntityLiving.killEntity(EntityLiving.java:129) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at de.rpg.classes.TricksterClass$1.run(TricksterClass.java:51) ~[?:?]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
        at java.lang.Thread.run(Thread.java:750) [?:1.8.0_372-372]
                                EntityPlayer npc = Npc.createNpc(p, "", p.getName());
                                new BukkitRunnable()
                                {
                                    public void run()
                                    {
                                        prismCooldown.remove(p.getUniqueId().toString());
                                        Npc.removeNpc(npc); // <===== THIS LINE OF CODE IS ISSUEING THE CONSOLE ERROR
                                    }
                                }.runTaskLater(Rpg.getInstance(), 20L * 12);
livid dove
remote swallow
#

you didnt understand a word of what i said

#

check the javadocs say the event.getPlayer() is nullable, if it is null check it with an early return OR if it isnt just get it directly from the event.getPlayer

livid dove
#

Aye i did infact

#

misread

#

lol

#

mb

thick gust
#

This seems to work just fine:

    public static void removeNpc(EntityPlayer npc) {
        try {
            PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(npc.getBukkitEntity().getEntityId());
            for (Player all : Bukkit.getOnlinePlayers()){
                ((CraftPlayer)all).getHandle().playerConnection.sendPacket(packet);
            }
            npc.getBukkitEntity().remove();
            npcs.remove(npc);
        } catch(Exception ignored) {}
    }
fierce salmon
#

I made it so when players click items in their inventory, the event is cancelled. The problem is that when a player is in a random slot in their inventory and press a key corresponding to one of the slots in their hotbar, the item can still move there. What can I do to stop this from happening?

fierce salmon
# livid dove What's the code?
if (event.getClickedInventory().equals(event.getView().getBottomInventory())){
            if (event.getCurrentItem().getType() == Material.OAK_BOAT || event.getCurrentItem().getType() == Material.WATER_BUCKET || event.getCurrentItem().getType() == Material.WHITE_WOOL || event.getCurrentItem().getType() == Material.TNT){
                event.setCancelled(true);
            }
        }
livid dove
#

Well for one wacking all those items into a array or something and doing one check for if the array contains the item would be big brain.

2, ur better off looking up the click type method and working with those in ur checks too

echo basalt
#

I dare you to repeat getCurrentItem once more

fierce salmon
#

event.getCurrentItem() :p

livid dove
#

If u need to call something 4 times in a row, uve screwed up

#

Imagine what that'd look like if u had 10 different menus with 9 items each.

That'd be one long ass if chain

fierce salmon
#

facts

#

but how do I check the click type?

fierce salmon
#

ty ty

rare ether
#

Hello, everyone. After extensive contemplation, I find myself on the verge of surrender. As a server owner, I am seeking a solution for a specific biome world generation. My objective is to create small, compact plains islands scattered throughout a Warm Ocean biome. These islands should maintain a distance of approximately 300-1000 blocks from one another. Despite my attempts to develop a custom data pack, progress has been limited due to complications with the worldgen folder. Additionally, I have experimented with plugins such as OTG and Islandcraft. However, OTG proved unsuccessful, and while Islandcraft functioned adequately, it lacked the desired biome compatibility and was only compatible up to version 1.12, whereas Warm Oceans were introduced in version 1.16. I would greatly appreciate any assistance or guidance in finding an alternative solution to this quandary. The accompanying image, created by myself, is provided solely to illustrate the envisioned aesthetic.

#

I cant upload the photo so DM if you want to see

kind hatch
#

?img

undone axleBOT
rare ether
echo basalt
#

no need to ping them

rare ether
#

:I sowwy

echo basalt
#

What if (and hear me out).. you grab all the warm ocean world generation logic

#

and slap in the island generation present on the ocean biome

#

with a little programming magic

brave sparrow
#

slaps roof this bad boy can fit so many islands

rare ether
#

Ok you need to understand, you are probbaly gonna laugh at what ive tried. I downloaded visual code amd told ChatGPT to make me the code. it didn't work 😦 , Ive watched hours of datapack creation and i learned not much 😦

#

legit ive been making servers for a really long time and and mostly comprehead lots of code and copy paste types of things however this has been a challenge and i have no idea where to start

#

Other than my failure to create this type of world, what do you think about the idea of this type of generation?

brave sparrow
#

?learnjava

undone axleBOT
brave sparrow
#

If you want to do it yourself

#

Otherwise

#

?services

undone axleBOT
brave sparrow
#

If you want to find someone to do it for you

rare ether
#

how much would you say a project like this will cost?

#

give or take?

brave sparrow
#

I’ve never really done individual projects for hire, not sure

rare ether
#

Btw, ive gotten ban from Spigot I never understood why I filled out a ban appeal and i really dont understand why i gotten banned. Ive never broken any rules or did sus stuff you know anyone that could help with that

#

just asking because its kinda annoying how the site is blocking me so i need to delete cookies and make another account to see information

echo basalt
#

vpn

rare ether
#

will that do it?

echo basalt
#

no

#

spigot has a few rules

#

duplicate accounts aren't allowed

rare ether
#

Interesting.. so my home IP been blocked?

#

because i made alt accounts?

echo basalt
#

no clue lmao

#

but it's the most common

rare ether
#

thats wack

echo basalt
#

anyways a coupel basic notes

#

if you want services go on the official stuff and ask for them, never here

rare ether
#

by any chance could you give me more information on the island generation present? and how i could find it

echo basalt
#

uhh

rare ether
#

if possible you dont need to

echo basalt
#

Looking at the code

#

making a biome isn't that hard

#

trying to find where the nms code for islands on an ocean is

rare ether
#

ty

#

my journey continues 🥲

echo basalt
#

well

#

You'll need to make a plugin that uses nms to register a new biome that has your fancy generation

#

but

#

it's not THAT hard

rare ether
#

So making a plugin would be eaiser than a datapack

#

so java

echo basalt
#

P much

rare ether
#

ty for that

#

a better heading

echo basalt
#

yeah world generation is quite convoluted

#

apparently you want a warm beach biome with a climate that has a lot of "continentalness"

#

with a not-too-high temperature otherwise it only generates deserts

rare ether
#

Wish me luck im going to learn JDK and Eclipse

fierce salmon
#

how do I make it so players can't use the F key to switch items to their off hand

white root
#

Could you just cancel the PlayerSwapHandItemsEvent?

fierce salmon
#

ty

dire jewel
#

where i can get gens plugin?

quiet ice
wet breach
quiet ice
#

Well at least making it not an enum would allow for the possibility of future improvements

wet breach
#

maybe, just need to hope mojang doesn't do any weird or crazy things in regards to it

oblique kettle
#

is there a way to turn off the server-sided anticheat?

wet breach
oblique kettle
wet breach
#

because if you are the server owner this isn't a question you would ask as you would simply do it

#

not sure why you think such a community as this would help you do shady things

#

or wouldn't point it out

oblique kettle
#

how can my question be related with anything shady

wet breach
#

I already told you

#

we are not dumb here o.O

oblique kettle
#

how is my question shady

brave sparrow
#

@wet breach I think they mean the vanilla anticheat lol

oblique kettle
#

I'm just looking for the programically way to do that since I received no response in #help-server

#

I just assumed that it was something that can be done with plugins

brave sparrow
#

It’s in your server.properties

wet breach
brave sparrow
#

It’s the allow-flight option

wet breach
#

every once in a blue moon we get people like this

oblique kettle
#

it's ok, i understand lol

oblique kettle
brave sparrow
#

If not, there’s not much you can do about it short of actually modifying the server afaik

hybrid spoke
#

there is an option for that

brave sparrow
#

Is there? Good to know

hybrid spoke
#

not sure if its named after the console spam "moving too quickly"

#

just know there is

oblique kettle
#

yeah that

wet breach
#

as far as programmatically goes, yes there is plugins that alter this stuff as well

#

I just don't know of any off top my head except NCP which allowed you to alter some things to your liking

hybrid spoke
#

ah its the elytra check as it seems

#

at least reddit says that

oblique kettle
#

yeah i was playing around with tridents with high riptide levels

#

wanted to get rid of the rubberbanding lol

oblique kettle
wet breach
#

NCP = NoCheatPlus

#

not sure if has been updated at all to take in new things, but it did give you options to modify the values of some things like I said

dire marsh
#

there's a ncp updated fork

quiet ice
#

You're dead

quaint mantle
#

whats the method of Player to get what block the player is looking at

quiet ice
#

Do raytrace

halcyon temple
#

Player#getTargetBlock

quiet ice
#

Or that I guess

twin venture
#

hi question does EntityDamageByEntity Event -> event.getFinalDamage calucate the armors , enchantments , potions player have on them?

sage patio
#

hi

#
    public void onPlayerJoin(PlayerJoinEvent event) {
        NLGangs.sqlManager.createPlayer(event.getPlayer().getName());
    }
#
public void createPlayer(String name) {
        try {
            if (!playerExists(name)) {
                PreparedStatement preparedStatement = Database.getConnection().prepareStatement(
                        "INSERT IGNORE INTO players" +
                                " (NAME,KILLS,DEATHS)" +
                                " VALUES (?,?,?)"
                );
                preparedStatement.setString(1, name);
                preparedStatement.setString(2, String.valueOf(0));
                preparedStatement.setString(3, String.valueOf(0));
                preparedStatement.executeUpdate();
            }
        } catch (SQLException exception) {
            exception.printStackTrace();
        }
    }
#
public boolean playerExists(String name) {
        try {
            PreparedStatement preparedStatement = Database.getConnection().prepareStatement(
                    "SELECT * FROM players WHERE NAME=?"
            );
            preparedStatement.setString(1, name);
            ResultSet resultSet = preparedStatement.executeQuery();
            return resultSet.next();
        } catch (SQLException exception) {
            exception.printStackTrace();
        }
        return false;
    }
tardy delta
#

you're blocking the main thread for too long

sage patio
#

very nice

#

and why?

tardy delta
#

cuz database calls take x hundred millis, one tick is max 50ms

#

do it async or block the async pre login event (async already so doesnt matter)

sage patio
#

i can't understand

#

connecting to the database tooks so long?

tardy delta
#

no executing the query

sage patio
#

it was fine on Java Connection

#

i switched to the HikariCP and this happens when someone joins

sage patio
#

in the database

tardy delta
#

cuz databases are slow

#

especially sql ones

sage patio
#

my problem with Connection was that it kept dropping out all the time

tardy delta
#

probably still lagged, configure your connection pool better

remote swallow
#

do the sql async

#

and fuck you too discord

#

@sage patio do the sql async with completablefutures

sage patio
remote swallow
#

💀

sage patio
#

why should a fucking sql be fine with Connection and fucked up with Hikari

remote swallow
#

bc hikari uses connection pools

sage patio
#

well its not important any more

#

thanks for all help

sage patio
#

lol

eternal oxide
#

also use try with resources, as you are not closing your RS

rapid trout
#

Hi is there a way to make a player's item and armor invisible? I tried hidePlayer() but the problem is that the player couldn't be hit by other players anymore

wet breach
blissful pawn
drowsy helm
#

invisibility does the inverse of that

#

just use packets

sullen marlin
#

Entity#sendEquipmentChange

#

or something like that

#

?jd-s

undone axleBOT
rapid trout
warm mica
#

Do not execute blocking code on the main thread. Do not execute blocking code on the main thread. Do not ...

hybrid spoke
flint coyote
#

Exactly. Stop the main thread to execute blocking code on another thread

round finch
#

I love using the main thread and freeze the entire server

#

Good plugin idea

hybrid spoke
#

oh thats the /freeze command everyone always talks about

flint coyote
#

A lot more visible than a chat message anyway

round finch
#

5 sec for each diamond

#

Couldn't be better

flint coyote
#

The question is: is a plugin considered harmful and deleted from spigot if it did exactly that?
But obviously mentions exactly that behaviour in the description?

#

In short: Is it harmful if it says it's harmful?

wet breach
flint coyote
#

Well I think freezing the server on purpose might aswell be malicious

#

As it's considered DOS

wet breach
#

well its not malicious if its made known that is what it does

flint coyote
#

By using a seperate thread. Or simply use Schedulers

wet breach
#

you can't unless you are making another thread that is not the main one sleep

flint coyote
#

Depends on your usecase. You rarely need your own thread

#

What do you want to achieve?

quiet ice
#

So there is probably not much of a difference

flint coyote
#

The initial delay and the delay between runs. It's in the guide

quiet ice
hybrid spoke
#

"hah i will troll the user by giving him op"

quiet ice
#

Yeah it was that sort of stuff

flint coyote
quiet ice
#

It was more of a backdoor

young knoll
#

Can’t imagine why a backdoor would be removed

tardy delta
#

scary

quiet ice
#

Open source backdoor????
Impossible.

flint coyote
#

Lmao

#

Like people watch open source code before installing

#

That's not open source, you are lucky

#

If it was community edition however...

muted dirge
#

guys i have a problem using vault-api

#

RegisteredServiceProvider Is Null.

flint coyote
#

I don't know that api. Isn't there a vault discord?

river oracle
river oracle
#

You have to

#

It's a plugin afterall

muted dirge
#

:|

river oracle
#

What

muted dirge
#

im lookin' for a solution

river oracle
#

I provided you one

hybrid spoke
#

show us your plugin.yml

muted dirge
river oracle
#

I'd try just doing depend softdepend doesn't guarentee load order

muted dirge
river oracle
#

Oh also

#

?main

hybrid spoke
muted dirge
young knoll
#

Also make sure you have an economy plugin installed

river oracle
#

Essentials is one

muted dirge
#

thanks for reminding me

flint coyote
muted dirge
hybrid spoke
muted dirge
flint coyote
#

Softdepend is just "load when it's there or ignore it" while depend is "if it's not there don't load this plugin"

muted dirge
#

thanks for your help guys ❤️

hybrid spoke
#

take the L

#

yeah okay i auto deploy

river oracle
#

Frrr

flint coyote
#
reversedepend: this
hybrid spoke
#

if i depend on them and mine loads first i will spam your github with issues

flint coyote
#

Time to delete the repo

young knoll
#

loadbefore: spigot

hybrid spoke
#

then the spigot 1 star reviews fly in

flint coyote
#

this is the way

muted dirge
#

what time is it

flint coyote
river oracle
flint coyote
#

isn't time relative? who knows what time it is

hybrid spoke
muted dirge
flint coyote
vocal cloud
#

<t:1685965506>

flint coyote
# hybrid spoke and?

Idk that's just rude. That's like buying a car without wheels and then writing a review that the car does not drive

flint coyote
#

It's not like you knew it probably won't drive

hybrid spoke
#

but it doesnt

#

so i can review that

flint coyote
#

I mean you would tell the truth. But the 1 star rating would be kinda weird

hybrid spoke
#

i can live with that

flint coyote
#

Well then

hybrid spoke
#

now i will look for fabsi on spigot and begin my journey

flint coyote
#

If that's what makes you happy

river oracle
hybrid spoke
muted dirge
flint coyote
#

Coding is love

muted dirge
#

where are you from

hybrid spoke
#

coding is depression

flint coyote
#

only if it doesn't work

#

As soon as you fixed that annoying bug that you searched 2 hours for it's big yay

hybrid spoke
#

if it works its a "won, but at what cost" since its work related

flint coyote
#

I'm not talking about coding for work

#

I don't enjoy coding for my work either

#

mostly because of all that shitty legacy support I have to deal with though

dire marsh
#

Don't deal with it then

hybrid spoke
#

the only thing that makes me at least a bit happy is a fancy UI

flint coyote
#

customers will be mad

hybrid spoke
#

since im a backend guy

#

but coding for every day for a decade now also has its downsides

flint coyote
#

I hate building UIs

hybrid spoke
#

thats why im happy if its fancy

dire marsh
flint coyote
#

oh yeah as long as I don't have to build it, that's great

dire marsh
#

but it is

hybrid spoke
#

not in a business environment

dire marsh
#

if plugins keep supporting 1.8 then people feel like they have a right to plugins supporting legacy versions

flint coyote
#

Well if you distribute software you kinda have to support it for a few versions/years

#

I won't support 1.8 or any legacy minecraft version - ever.
I was talking about commercial/business development

hybrid spoke
#

if we would drop our legacy shit 70% of the software wouldnt work anymore

flint coyote
#

sadly that's true

hybrid spoke
#

and rewrite it would cost too much

#

so we just stumble over it with both eyes closed

flint coyote
#

Everybody loves technical debt

#

except the developers ofc

river oracle
#

Cant wait to get a job and be writing 20 year old backend in nodejs while wanting to die the whole time

flint coyote
#

You should work with banks

#

They pay well

#

and are always 10 years behind in technology

#

(or more)

eternal night
#

can also recommend ^

hybrid spoke
#

dont they use assembler

flint coyote
#

cobol mostly

eternal night
#

you are thinking of cobol yea

river oracle
#

Guys the decimal number are longn

#

Cobol is awesome

eternal night
#

I mean, its free money with cobols decimal math

river oracle
echo basalt
#

tfw the tech debt is older than you

wise mesa
#

is a player object safe to use after a respawn

flint coyote
#

The player object does not change after death afaik

eternal oxide
#

do not hold references to Player objects

flint coyote
#

You can if you wipe the data on disconnect

eternal oxide
#

bad practice

#

use UUID and you have no cleanup to do

flint coyote
#

I would argue with that statement. It's perfectly fine to hold a player object if you wipe the data on a disconnect anyway.

#

Not cleaning on disconnect is bad pratice

eternal oxide
#

No

flint coyote
#

why keep data in memory when it's no longer required

undone axleBOT
eternal oxide
#

Holding a reference to a Object that is in a WeakHashMap is bad practice, you prevent GC and have to manage cleanup. Use UUID, you don;t prevent GC, you don;t have ANY cleanup to do. You respect the contract

flint coyote
#

How do I not have any cleanup when I store a UUID in a hashmap/list/whatever? How else would it get removed?

#

that just keeps uuids laying around that are then checked in loops or whatever the list/map is used for

eternal oxide
#

UUID is persistent, Player is not

flint coyote
#

I know but you have to wipe it anyway

eternal oxide
#

what you do with yoru UUID storage is upto you, but using UUIDs will not break GC in Bukkit

#

Holding Players means you MUST cleanup or you prevent Bukkit properly releasing that Player and nstp GC on it

flint coyote
#

Cleaning it up on disconnect (which you have to do anyway) will not break it either

#

or should do

eternal oxide
#

You really are not understanding

#

In Bukkit Players are stored in a WeakHashmap. They do so for a reason. When a Player object is dropped it's free for GC to clean it up, without any outside inteference.
You holding a Player reference breaks that cleanup.

flint coyote
#

Well it's only dropped on disconnect

eternal night
#

Keeping an entity reference across tick is a pretty meh practice

flint coyote
#

if they start to change player objects in between ticks a lot of things will break

eternal oxide
#

When it's dropped makes no difference, Holding a reference is bad practice

eternal night
eternal oxide
#

reference by UUD and you'll never have an issue

eternal night
#

already doesn't work for any other entity with chunk unloading etc

#

giving player instances special treatment because the server happens to maintain a single player instance for you

#

is a bit meh

hybrid spoke
#

you should always clean up your resources no matter in what context

eternal oxide
#

True

flint coyote
eternal night
#

yea its backed by a map

hybrid spoke
#

just cast player to humanentity and tada

#

problem solved

eternal night
#

plain hashmap impl I think

#

concerning that java's uuid only shift some bits for their hashcode , that should be pretty fast if it doesn't collide too much

river oracle
#

Legacy versions just need to be dropped at this point

eternal night
#

I really hope whenever material registry stuff drops it does at least break some old things xD

#

just so people update

vocal cloud
#

inb4 someone brings up 1.8 combat sad

river oracle
#

Same here

dire marsh
#

when new combat snapshot, jeb?

river oracle
#

I didn't like it at first but I've warmed up to it

dire marsh
#

I like both, and pretty good at both, but generally lean towards 1.9 combat because clicking just hurts after a while. (referring to 1.8 v 1.9)

eternal night
#

I did like his combat snapshots tho

#

the "hold down to spam" thing

#

was kinda nice

dire marsh
#

I believe that got some hate because it was too lenient in its timing

eternal night
#

I mean, everything in regards to combat is gonna get hate xD

hybrid spoke
#

pvp scene is toxic anyways

#

they will always find something to hate

eternal oxide
#

I like being able to rapid click (1.8) but I'm not willing to lose API functionality to keep it.

#

I don;t PVP but I do panic click when mobbed

hybrid spoke
#

how does a pensioner rapid click

pseudo hazel
#

I think its a different discussion with pve compared to pvp

eternal oxide
#

The problem is not how do we rapid click, it's how do we stop once we start.

hybrid spoke
#

when the parkinsonian kicks in

eternal oxide
#

exactly. very common behavior in the elderly

hybrid spoke
#

gets banned for autoclicker

vocal cloud
#

Honestly, when people started making guides on how to add tape to your mouse to click faster I think 1.8 PvP fell off https://www.youtube.com/watch?v=AWDBDZp3Y14

grip tape is very useful for drag clicking , in this video i will be showing what the best grip tape is for drag clicking or ways to drag click better and get high cps

Subscribe:https://www.youtube.com/c/DigitalSmile?sub_confirmation=1

Discord Server : https://discord.gg/U6scmhq

Drag clicking with flex tape (by cake progress)
https://www.yout...

▶ Play video
hybrid spoke
#

oh yeah and all the clicking techniques

#

butterfly, jitter, mouse abuse

#

and so on

dire marsh
#

These days it's a lot of: "where do you draw the line at cheating"

agile anvil
#

You have to show who has the biggest (click)

eternal oxide
#

My view it's cheating when you spawn items instead of earning, or you use ANY assistance when competing against others.

dire marsh
#

ANY assistance
rip all those fancy mouses

eternal oxide
#

if its just PVE there is no competition so anything goes

hybrid spoke
#

rip my double click mouse

hybrid spoke
#

if i want to play survival its like 10 mins farming wood

#

then cheating some diamonds

eternal oxide
#

Thats fine

hybrid spoke
#

prebuilding my house in creative to have a better start

#

and never find a stop

eternal oxide
#

You are only cheating yourself out of enjoyment

#

you may as well have a play end credits button 🙂

lyric turtle
#

Hi, im using ProtocolLib, i want to clear nodes in ClientboundCommandsPacket, problem is that there is nothing like getNodes method in PacketContainer, what can i do about that?? is there any work-around??? maybe there is easy way that i dont see. problem is that there is no ProtocolLib's discord server or anything so i cant ask them.

eternal oxide
#

why are you messing with packets for commands?

lyric turtle
eternal oxide
#

Not really anything to do with Spigot then

lyric turtle
echo basalt
#

prolly this

#

nvm its not

eternal night
#

Concerning that that packet exposed brigadier types I'd be surprised if pl has abstractions for it

#

Unless it reimplemented those types or exposes brigadier

livid dove
lyric turtle
vital ridge
#

?paste

undone axleBOT
lyric turtle
vital ridge
#

I'm trying to create custom persistentdatacontainer and then store it in my custom spawner. But I get an error at a serialization method in my custom persistent datatype class.
Error: https://paste.md-5.net/oxekubejey.cs

quaint mantle
#

i have this on the top of my command

File crateLocationFile = new File(main.getDataFolder(), "locations.yml");
        YamlConfiguration locationFile = YamlConfiguration.loadConfiguration(crateLocationFile);
        ConfigurationSection locations = locationFile.getConfigurationSection("locations");

and when i try do this later on

ConfigurationSection crateEntry = locations.createSection(args[1]);

it says

Cannot invoke "org.bukkit.configuration.ConfigurationSection.createSection(String)" because "locations" is null
eternal oxide
#

you have to set to place a section, and it can't be empty

quaint mantle
#

what

#

i have to set to place a section?

eternal oxide
#

you have no locations section

quaint mantle
#

i do

eternal oxide
#

not in the file you are reading

quaint mantle
#

...

eternal oxide
#

that section is empty, it will do nothing

quaint mantle
#

its still a section?

eternal oxide
#

it will return null

quaint mantle
#

so what do i do to it to make my code work

#

how do i make it not return null

eternal oxide
#

if locations == null then set

#

when you want to add a location

#

is it a list?

quaint mantle
#

thanks

#

no

#

it stores coordinates

eternal oxide
#

in what?

#

a list?

#

a map?

quaint mantle
#

string

#

so like this @eternal oxide

#

if (locations == null) {
ConfigurationSection crateEntry = locations.createSection(args[1]);
crateEntry.set(args[1], targetCrate.getLocation().getX() + "," + targetCrate.getLocation().getY() + "," + targetCrate.getLocation().getZ());
}

#

or what

fluid river
#

what's this lol

eternal oxide
#

no

#

creATE YOUR SETRING, THEN CONFIG.SET(LOCATIONS", STRING)

#

err caps

#

I'm not retyping it

quaint mantle
#

ok

quaint mantle
# eternal oxide no

GM BRO 🙂
can u help me for idea ?
if u help: i wanna give cooldown to cow milking
and i think this: when players right click the cow with bucket i added cows to hashmap key and i add unix time to data and
i control with if like this if(unixtime > cowtime ++ 30k) do somehing; else(cancel event;

#

is this good idea ?

vocal cloud
#

Don't cow's have PDC? You could just read/write from the PDC and it'd give it a level of persistence as well

quaint mantle
vocal cloud
#

?pdc

quaint mantle
#

ty

candid plover
#

Can someone help me? I put reloadConfig but my configuration is not saved, just in case I restart the server

flint coyote
#

Reload does not save it

#

reload would re-read it if you changed it manually

#

you have to call save

candid plover
#

How do I save the configuration so that it updates in-game?

flint coyote
#

wdym by updates in game?

#

You change it on the file system by hand and then want the changes to be effective in game?

candid plover
#

For example, I changed the name of the item in the configuration, but it receives the old

flint coyote
#

in that case reload should be fine since you did the saving manually

candid plover
#

reloadConfig()?

flint coyote
#

yes

candid plover
#

does not work.

#

😭

#
 try {
      MainKits.getPlugin().reloadConfig();
      sender.sendMessage("§aConfigurações reiniciadas com sucesso.");
    } catch (Exception error) {
      sender.sendMessage("§cOcorreu um erro ao reiniciar as configurações.");
    }```
vocal cloud
#

The config you're writing to is the getConfig()?

flint coyote
#

I noticed that my reload method looks like this:

private FileConfiguration cfg;
//.....
public void reload() {
        plugin.reloadConfig();
        cfg = plugin.getConfig();
    }

I'm not sure if it is required. You can however try to do the same and see if that changes anything

candid plover
eternal oxide
#

you have to update your config reference if you reload it

flint coyote
#

in that case it is actually required :)

eternal oxide
#

or stop storing your config in a temp variable and access it directly with getConfig()

candid plover
#

ohh, ok

#

I am going to try, thanks.

fierce salmon
#

Whenever I try and clear everything from my custom config file, it just reappears. How can I fix this?

#

nvm i figured it out

#

I just need to disable my plugin to be able to edit it

rare ether
#

anyone got the dependency for FastAsyncWorldEdit?

wise mesa
#

random generation is working

#

i mean idk i haven't actually made it randomly generate

#

it just makes little squares that pretend to be rooms

#

to visualize

#

now i gotta port the code over

#

but that'll be easy

#

sometimes it doesn't work thouhg and idk why

#

oh well

fierce salmon
#

I am trying to make my plugin tell the player how long it takes them to complete the parkour. After completing the parkour, instead of giving me a normal number, it gave me 1.685975912549001E12 for some reason. Here is my code: https://paste.md-5.net/ucupeceyef.cs

eternal oxide
#

your timing is in milliseconds

fierce salmon
#

but like

#

why is it displaying that many milliseconds

#

Like i dont want 12 digits

eternal oxide
#

convert it to minutes and seconds

fierce salmon
#

the parkour takes 8 seconds to do

#

so the milliseconds should be 8000

#

and I divide it by 1000 to make it 8

#

but it still shows as a huge number

warm mica
#

Possibly because you never set a start time

#

Current time millis is 1685976882702

#

and you should store/get them as long and not as double

fierce salmon
#

oh ok

fierce salmon
eternal oxide
#

there is no decimal point in these values

#

you are talking about formatting the display of the result

warm mica
fierce salmon
#

ok

#

so when grabbing the values of parkourstarttime and parkourendtime, what variable type would i grab?

warm mica
#

Note that your server will heavily lag because of that plugin, there is likely no need to store these values within a config file

#

and to save/reload it each time

fierce salmon
#

should I just store it in HashMaps?

warm mica
#

Yes, unless you actually need that information permanently

fierce salmon
#

Only some of it I need permanently

warm mica
#

Then only store that permanently. And try to reduce the usage of config.save(), that can heavily decrease your TPS. One option would be e.g. an async scheduler that stores it each minute or something

#

and config.reload() shouldn't be used at all there, you already have everything loaded

fierce salmon
#

ok ty

river oracle
#

What would be the best way to go about a event happening 24 hours in the future. Should I just have a sync timer running and checking the time every tick?

eternal oxide
#

use a scheduledExecutor

river oracle
mortal hare
#

man clion's warnings are so sometimes annoying

#

Clang-Tidy: Overloaded 'operator++' returns a non-constant object instead of a constant object type

#

i add const as a return type

#

Clang-Tidy: Return type 'const typename nonogram::Table<t_element>::Row::RowIterator<t_finalElement>' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

eternal oxide
#

egjava LocalDate nextDate = LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.MONDAY)); Long midnight = LocalDateTime.now().until(nextDate.atStartOfDay(), ChronoUnit.MINUTES); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(()-> { /* Code here */ }, midnight, TimeUnit.DAYS.toMinutes(7), TimeUnit.MINUTES);

mortal hare
eternal oxide
#

that schedules to run every monday

mortal hare
#

i add rvalue modifier, it still complains

river oracle
river oracle
eternal oxide
#

yes, just increase the pool

river oracle
#

Does spigot have a default pool I could use / is there one I could just use

eternal oxide
#

not a real world time one

#

its all based on ticks in Bukkit

river oracle
#

Hmmm well all I'd be doing is someone enters a command for my plugin and a task is scheduled for a day later

#

I'd assume bukkit would be fine

eternal oxide
#

what do you need to do 1 day later?

river oracle
#

It notifies a group of players and starts the event after a day

#

The code for starting the event would be similar for each group I'd ideally save the time stamps, save relevant data and restart the tasks on server restart

mortal hare
#

people say java is bunch of boiler plate, wait till they see cpp's boiler plate in order to implement an iterator method:

typename nonogram::Table<t_element>::Row::template RowIterator<t_finalElement> nonogram::Table<t_element>::Row::template RowIterator<t_finalElement>::operator++(int) const & {

}
hazy parrot
#

Til you can override increment

#

Also what ampersand after const means lol

mortal hare
#

it means that rvalues cannot use this

#

basically you increment lvalue