#help-development

1 messages · Page 883 of 1

ornate heart
#

oui oui

paper rain
#

oh okay

#
        for (String key : plugin.getConfig().getConfigurationSection("mineblocks").getKeys(false)) {
            Location location1 = plugin.getConfig().getLocation("mineblocks." + key + ".location");
            if (location.getWorld().getName().equals(location1.getWorld().getName()) && location.getBlockY() == location1.getBlockY() && location.getBlockX() == location1.getBlockX() && location.getBlockZ() == location1.getBlockZ()){

                return true;

            }
        }

        return false;
    }```SOOO this should work?
ivory sleet
#

try it

paper rain
#

ye

hollow beacon
#

ok 11 libraries in and it seems to have worked

paper rain
#

😭 it still doesnt work

ivory sleet
#

you sure you stored it correctly in the first place?

proud badge
paper rain
#

plugin.getConfig().set("mineblocks." + args[1] + ".location", p.getLocation());

proud badge
#

plugin.getConfig() is loaded into ram?

ivory sleet
#

yes

proud badge
#

Ok I didnt know

ivory sleet
#

but I get what u mean

proud badge
#

I thought plugin.getConfig reads the file

ivory sleet
#

yeah, I mean it might be worthwhile storing the locations in a more sophisticated data structure ^^

ivory sleet
paper rain
#

i dont know what im doing bad. im just setting and getting the location 😭

#

I dont know what could go wrong there

paper rain
#

/mineblock add <name>

ivory sleet
#

yk player names are case sensitive

#

or whatever else u use

paper rain
#

no player name

#

its just string name of this mineblock

ivory sleet
#

ye well, in this case ur mineblock names

paper rain
#

yes

#

is it bad?

ivory sleet
#

ugh, well it has pros and cons

paper rain
#

so it maybe doesnt work bcs of this?

ivory sleet
#

i doubt

paper rain
#

😭

ivory sleet
#

im rather unsure tbf, but I mean I would say try to do the command again on a new location and test it

paper rain
#

i tried

#

i restarted server

ivory sleet
#

oh thats why

paper rain
#

i deleted config and load new

#

everything

paper rain
ivory sleet
#

yk that getConfig().set(...) doesnt dump it into the config.yml automatically

#

u need to use plugin.saveConfig() I think

paper rain
#

yeah and saveConfig() do

#

yep

#

im using it

ivory sleet
#

ah alr

paper rain
#

im gonna try debug

#

and print every location

ivory sleet
#

lol ye

#

make sure u print the block x y and z

#

as thats what u're using

hollow beacon
#

why aren't we using the location object

paper rain
#

ok

#

wdym?

hollow beacon
#

location is serializable

ivory sleet
#

he is using it

paper rain
#

im using location

#

object

#

Location location1 = plugin.getConfig().getLocation("mineblocks." + key + ".location");

hollow beacon
#

ah sick

#

and why do you compare x y z then

#

and not do

configLocation.equals(minedLocation)

ivory sleet
#

that'd yield false even if the block location is the same, but the offsets are different

paper rain
#

so i have to just compare the location like (if loc1 == loc2) ? xd

hollow beacon
#

i dont think location.getBlock returns with an offset

#

rather just the center block location

ivory sleet
#

well they're using p.getLocation() for now

paper rain
#

im just saving location to config and than getting it as a location and comparing its blockY, blockZ, blockX

ivory sleet
hollow beacon
#

yeah that would make it a lot easier

ivory sleet
#

I mean like, Location::getBlock basically calls getBlockX, getBlockY and getBlockZ at some point

hollow beacon
#

yeah so why would you do the logic manually

ivory sleet
#

which logic?

hollow beacon
#

the checking logic

ivory sleet
#

there's only the comparison

#

I mean its just three predicates u're invoking

clever lantern
#

is there a packet so i can show player nick when he is invisible (or hidden)?

hollow beacon
#

i dont think so but u can use armor stands

flint coyote
#

Under which circumstances will PlayerMoveEvent#getTo() be null?

clever lantern
hollow beacon
#

yeah I think you can, holographic displays does this iirc

ivory sleet
flint coyote
#

Documentation states so

ivory sleet
#

ah nvm, I was reading paperOhhh docs

flint coyote
#

Eww :(

summer scroll
#

Is there in any way to remove spawn conditions for spawners with spigot api?

late sonnet
# summer scroll Is there in any way to remove spawn conditions for spawners with spigot api?
Minecraft Wiki

A monster spawner is a type of spawner found in a variety of structures. It contains a miniature mob, and constantly spawns instances of that mob as long as a player is nearby and, if applicable for the mob it spawns, if there are valid dark areas nearby. It cannot be obtained as an item in survival mode or moved by a piston, and it only drops e...

rare rover
#

what would be the highest recommended about of sqlite connections for an mc server? I'm making multiple plugins for my server and i'm needing about like 4 connections and i was wondering if that could result in any network problems or something?

young knoll
#

SQLite is a local database

#

So no networking involved

rare rover
#

well that's fair 😅

#

so no apparent issues if i do use more than 2 connections?

young knoll
#

No

rare rover
#

okay, thanks ❤️

summer scroll
young knoll
#

What conditions

summer scroll
#

Everything, I want all spawners to spawn in all conditions.

#

Well, most importantly light level condition.

#

Here's my attempt

        // Try to modify the spawn conditions
        List<SpawnerEntry> potentialSpawns = new ArrayList<>();
        for (SpawnerEntry entry : spawner.getPotentialSpawns()) {
            SpawnRule rule = new SpawnRule(0, 15, 0, 15);
            potentialSpawns.add(new SpawnerEntry(entry.getSnapshot(), entry.getSpawnWeight(), rule));
        }
        // Set the potential spawns
        spawner.setPotentialSpawns(potentialSpawns);
young knoll
#

Ah perfect that’s the one you can clear

#

That should work

summer scroll
#

I've tested it and zombie spawner still act the same.

young knoll
#

Look at the spawner and run /data get block (tab complete the coords)

summer scroll
#

Ooops, I think I forgot to do CreatureSpawner#update

#

I did the update but zombie still won't spawn in daylight.

young knoll
#

Doesn’t look like anything got applied

#

?paste your code

undone axleBOT
summer scroll
#

Perhaps the potential spawns is empty?

young knoll
#

Probably

#

It is by default on spawners

summer scroll
#

I don't really want to create my own spawner system lmao, or do I have to?

young knoll
#

Just check if it’s empty and if so use getSpawnedEntity and add that to your spawnPotentials list

summer scroll
#

It takes EntitySnapshot.

cosmic loom
#

which inventory event is most suitable for dragging an item and clicking it another item

young knoll
#

Yes

#

You can create a spawner entry with that snapshot

quaint mantle
#

is it possible to have 60 ppl on a server with 4gb of ram?

summer scroll
#

How can I get EntitySnapshot object from entity type?

young knoll
#

getSpawnedEntity should give you a snapshot

shadow night
young knoll
#

Depends on a lot of factors

shadow night
#

yee

#

if it's a void world with 2 chunks that can be loaded, that might work

summer scroll
young knoll
#

Hmm that might be a bit of an oversight

#

Make it dark and let one spawn, then try it in the light

summer scroll
#

On dark it spawn the zombie right away.

#

But after that, the zombie keep spawning even on daylight.

#

That's weird.

young knoll
#

Yeah that’s what I figured

cosmic loom
#

what is the full exaplaination of this?/

summer scroll
young knoll
#

Before you setSpawnPotentials, try doing setSpawnedType(null)

young knoll
summer scroll
young knoll
summer scroll
#

set spawned type null -> set potential spawns -> set back the spawned type?

young knoll
#

Hmm then I’m not sure there is much you can do

#

I’ll need to add a setSpawnedEntity(SpawnEntry)

fierce gale
#

Does anyone have experience with Spigot and Paypal IPN?

summer scroll
#

So basically with this way, the spawner need to at least spawn once?

young knoll
summer scroll
#

Ah that makes sense.

#

If I don't want this result then I assume I would need to create my own spawner system right?

young knoll
#

Or use some nms

summer scroll
#

Okay for sure I can use a little bit nms lmao.

wintry lynx
#

Think time asking lol:
Is there a good way to check an entire structure for Spawners? I don't want to iterate through every block since it's VERY slow.

young knoll
#

Spawners are tile entities

summer scroll
young knoll
#

So you can iterate tile entities instead

young knoll
summer scroll
#

Okay, appreciate it.

young knoll
#
CraftCreatureSpawner craftSpawner = (CraftCreatureSpawner) spawner;
NBTTagCompound compoundTag = ((CraftEntitySnapshot) snapshot).getData();

MobSpawnerData.a data = MobSpawnerData.a(new InclusiveRange<>(rule.getMinBlockLight(), rule.getMaxBlockLight()), new InclusiveRange<>(rule.getMinSkyLight(), rule.getMaxSkyLight()));
craftSpawner.getSnapshot().getSpawner().nextSpawnData = new MobSpawnerData(compoundTag, Optional.ofNullable(data);
#

Something like that, although those aren't Mojmap names so it may be a bit different

proud badge
#

How would I loop through every single PDC in a thing, I have the value but I need to find the key?

young knoll
#

iirc there is a getKeys

summer scroll
#

Thank you, will try that.

cosmic loom
#

How to check if item is tools or armor?
or weapons

young knoll
#

EnchantmentTarget is usually good for that

#

Or tags

cosmic loom
#

Thank You

upper hazel
#

do enchantments work beyond lvl 5? I tried to enchant but did not achieve the effect

#

what can replace them?

young knoll
#

Yes

#

Enchantments should work fine up to level 255

upper hazel
#

hmmm

#

you sure?

young knoll
#

yes

upper hazel
#

are there any nuances when adding char to an item via bukkit api

#

I tried to add them but they didn’t work, maybe I needed to add something else as parameters?

young knoll
#

char?

icy beacon
#

He means enchantment

upper hazel
young knoll
#

If you are adding overleveled enchantments you need to use addUnsafeEnchantment (ItemStack) or addEnchant(enchantment, level, true) (ItemMeta)

upper hazel
#

hm ok i will try

#

no, still doesn't work even if the enchantment sharpness 11 sword kills a pig with only 2 hits

#

netherite material....

young knoll
#

Let's see a screenshot

#

of the item

upper hazel
#

Through the command I can’t enchant an item above the basic standard levels

worthy yarrow
upper hazel
young knoll
#

hmm.. I can't exactly read that XD

#

Can someone translate the 3 enchantments and the attrubute?

worthy yarrow
#

sharp 7... thats all I think I know

dapper flower
#

hi, i need to code an always burning furnace, so far I manage to only set blockdata to lit, but even seting to Short_MAX the furnace.burnTime but it doesnt cook anything and just shows as lit

upper hazel
#

it's sharpness and durability

#

and file resistance

young knoll
#

Sharpness 13

#

What's the attribute

upper hazel
#

13

#

durability 11

#

resistance 6

#

Everything else, ignore it, it's just attributes.

icy beacon
#

The attributes are "when equipped (wherever)": +1.6 attack speed

young knoll
#

Okay so that should be

#

7 damage

#

Pig has 10 health

#

So 2 hits is correct

upper hazel
#

with shapness 13? in Netherite??

young knoll
#

You have added a custom attribute

#

Which removes the base attack damage of the sword

#

You need to add it back

upper hazel
#

not damage

worthy yarrow
#

Ew that got formatted kinda ugly... maybe I should go back to 3 space indentation

young knoll
#

Yes as I said

#

You have added a custom attribute
Which removes the base attack damage of the sword

#

You need to add it back

worthy yarrow
upper hazel
#

When adding an attribute, the characteristics of the item are reset to the basic ones?

tame wolf
#

No, it removes them

upper hazel
#

this minecraft pisses me off....

worthy yarrow
#

^ Yeah I thought it was like removed completely ie: 100% customizable item

summer scroll
proud badge
#

how would I get the plugin responsible for a namespaced key, getPlugin or something similar doesnt exist

upper hazel
worthy yarrow
summer scroll
proud badge
#

Im looping through a bunch of namespaced keys rn and I wanna check the plugin responsible for it

#

like here lemme show you

#

Im using NBTToolTips mod

#

see the text before the : is the plugin responsible and after it is the name of the key

sharp heart
#

Is there a way to get the original block (the block at the creation of the world) at a location ?

chrome beacon
#

?xy

undone axleBOT
chrome beacon
#

Why do you need that

sharp heart
flint coyote
#

what?

worthy yarrow
#

Nbt is open source eh? You could check there for how this data is stored in nbt and just relay changes based on what you need

sharp heart
worthy yarrow
summer scroll
#

@young knoll this is the difference between spawner that has spawned before and not.

#

I'm assuming we just need to add the custom_spawn_rules key to the compound tag?

young knoll
#

That's what the code I gave you should handle

dapper flower
#

hi, i need to code an always burning furnace, so far I manage to only set blockdata to lit, but even seting to Short_MAX the furnace.burnTime but it doesnt cook anything and just shows as lit

summer scroll
young knoll
#

Weird

#

ah I see why

#

You are doing craftSpawner.getTileEntity

#

You need to use getSnapshot, which may be private

wise mesa
#

what are some pros and cons of project panama vs jni

young knoll
#

Nope getSnapshot is protected just like getTileEntity

summer scroll
#

getTileEntity is public.

young knoll
#

Not on my screen

#

👀

analog flint
#

guys how do you add sounds when right click on npc in citizen plugin

summer scroll
wise mesa
young knoll
#

Smells like you are not using the spigot api

#

Since it's not public in that

analog flint
#

where do i go

#

sorry i didnt notice

summer scroll
#

Oh yeah I forgot about that, let me change it real quick.

real palm
#

Heya, question again.

I'm trying to add BungeeCord to my pom.xml (Maven) - however as of the Wiki "bungeecord-api" does not exist, only -chat and -parent. What should I do now?

summer scroll
young knoll
#

mhm

#

You'll have to reflection them

dapper flower
#

hi, i need to code an always burning furnace, so far I manage to only set blockdata to lit, but even seting to Short_MAX the furnace.burnTime but it doesnt cook anything and just shows as lit

icy beacon
#

What hosting specs do I realistically need to run a REST API + MySQL database + store (a lot of small) images?

#

Is this enough?

  • 2 threads 3.3GHz
  • 4GB ram
  • 30GB NVME
hybrid spoke
#

but its the bare minimum for a small/medium service

icy beacon
hybrid spoke
icy beacon
#

Well it really depends on how much traction the app will get lol. One user might send like 15-25 requests per minute maybe?

hybrid spoke
#

im a fan of seperating services

#

having an extra database server

#

one for the REST API

#

and maybe even an cdn for the images

hybrid spoke
icy beacon
#

My budget is quite limited. Would it be better to separate things for me then?

hybrid spoke
#

you just have to stock up a bit if you gain more users

dense jay
hybrid spoke
icy beacon
#

I'll keep that in mind. Thanks for helping!

dense jay
sharp heart
#

How can I ensure that an entity is deleted even if the server crashes?

hollow beacon
#

you dont, you remove it on startup

dense jay
summer scroll
real palm
river oracle
#

wait patiently

#

no one is gonna help you if you're being annoying

#

you already posted on the forum too

real palm
#

no

real palm
#

weird, I can't do anything...

river oracle
#

try clearing your cookies

real palm
#

I tried the basics already...

river oracle
#

mmm MD probably disabled list viewing then

#

oh wait that's official sonatype

#

yeah I doubt they'd have that listing public

#

they probably have an official listing somewhere that is prettier

real palm
#

I already got it

#

but thanks 😄

#

right...

cosmic loom
#

How can I implement EnchantmentTarget

upper hazel
#

can anyone help, do enchantments work for more than lvl 8?

#

I was told that yes, but they still don’t work for me

cosmic loom
young knoll
#

EnchantmentTarget.WHATEVER.includes

shadow night
summer scroll
proud badge
#

How would I get a block's x and z coordinates in a chunk?

#

1-16

tender shard
#

(% 16) + 1

slender elbow
#

no

#

it won't work if the coords are negative

tender shard
#

then & 0xF

#
  • 1
shadow night
slender elbow
#

idk why you'd want to +1 them tbh, they go from 0 incl to 16 excl lol

shadow night
#

If chunk is 16 blocks, doesn't mean 0 to 15? 🤔

eternal oxide
#

return Math.floorDiv(value, 16);

#

Works for negative too

river oracle
#

x & 0xF will work

tender shard
#

btw % 16 also works?

proud badge
#

int x = block.getX() % 16; ?

slender elbow
river oracle
slender elbow
#

& 0xf is the right way

tender shard
#

for example -126 is chunk coordinate 2, and -126 mod 16 is 2

proud badge
#

Im trying to put it in an array so

slender elbow
#

also that's for chunks, not the block within the chunk

proud badge
#

2d array*

tender shard
river oracle
#

either way the binary and is a faster operation

#

wait nvm it doesn't matter

shadow night
#

Isn't & 0xF the fastest tho

river oracle
#

I'm not working on an arduino i'm not working on an arduino

tender shard
# tender shard

so I dont see why % 16 should not work. it does work for -126 at least, why shouldnt it work for any other number?

proud badge
#

so like this?

#

Im trying to put the block in an array

river oracle
slender elbow
#

% 16 doesn't work because it doesn't work

#

jshell> -126 % 16
$2 ==> -14

tender shard
river oracle
#

its 2

shadow night
slender elbow
#

it's literally just jshell lol

slender elbow
#

& 16 is the correct way

chrome beacon
#

Can confirm -126 % 16 = -14 in jshell

river oracle
#

that's so weird wtf

#

I just tested it yeah

#

why the fuck

tender shard
river oracle
#

@tender shard apparently it works in math, but ig Java just can't math properly

eternal oxide
#

Math.floorDiv handles it fine

slender elbow
#

that is not the operation they are asking for

shadow night
#

I just tried running it in java and it gave me -14???

slender elbow
tender shard
slender elbow
#

which is always 0 to 16

eternal oxide
proud badge
#

ok, so will this put the first block in the chunk at the first values in the array?

        Chunk chunk = block.getChunk();
        NamespacedKey key = getKey(block.getY());
        PersistentDataContainer pdc = chunk.getPersistentDataContainer();
        byte[][] currentData = ByteFlattener.unflatten(pdc.get(key, PersistentDataType.BYTE_ARRAY), 16, 16);
        byte index = findIndex(chunk, uuid);
        currentData[block.getX() & 0xF][block.getZ() & 0xF] = index;
    }```
shadow night
echo basalt
#

It seems like events don't get fired when a plugin is disabling think3d

#

icky

upper hazel
#

hey what is the best way to change the characteristics of an item if enchantments do not work?

warped jasper
#

Good evening, could I get help with my plugin?

late sonnet
tender shard
#

what

#

the fuck

#

who is this fucking alex that he thinks he knows better than me, whose name is alex too?!

remote swallow
#

thats you

tender shard
#

no

remote swallow
#

you say its profane

echo basalt
#

noob

tender shard
#

i dont even know how to add those shitty checks to IJ

late sonnet
#

well "more actions" for edit that xd

young knoll
#

Thanks I hate it

flint coyote
#

Thanks, I'll just try to understand the source code D:

fleet kraken
#

Hello guys, any way to detect and cancel the dual wield?

flint coyote
#

You mean you want to cancel anyone from putting items in their offhand?

shadow night
lean pumice
#

?paste

undone axleBOT
lean pumice
#

https://paste.md-5.net/ivofomusup.md how i can solve it?

Set<BedWars> bedWars = Lobby.getInstance().getBedWarsManager().getBedWars();

         BedWars bw = bedWars.stream()
                .filter(b -> b.getType() == type)
                .filter(b -> b.getStatus() == Status.LOBBY || b.getStatus() == Status.STARTING)
                .filter(b -> {
                    try {
                        return Lobby.getInstance().getCommon().getApi().getPlayerCount(b.getName()).get() < b.getType().getMaxPlayers();
                    } catch (InterruptedException | ExecutionException e) {
                        throw new RuntimeException(e);
                    }
                })
                 .findFirst()
                 .orElse(null);
fleet kraken
tardy delta
lean pumice
#

i have liked it

tender shard
#

oh sorry didnt see the paste

flint coyote
tender shard
#

what's JoinCommand onJoin?

fleet kraken
flint coyote
#

Use the events and check if the offhand slot is involved (for the first two) then cancel them. Shouldn't take too long

fleet kraken
#

I will try it, thank you

#

PlayerSwapHandItemsEvent handle "f" key?

flint coyote
#

yes

vague saffron
#

Please forgive me for being a complete noob at Eclipse, how do I fix this?

The project was not built since its build path is incomplete. Cannot find the class file for org.jetbrains.annotations.NotNull. Fix the build path then try building this project

fleet kraken
#

ok, thanks

eternal oxide
#

Add teh annotation dependency

tender shard
vague saffron
#

I believe it's maven.

tender shard
#

so you do have a pom.xml file?

vague saffron
#

I do not

tender shard
#

do you have a build.gradle or build.gradle.kts file?

vague saffron
#

Neither

tender shard
#

then you're using neither maven or gradle. then you'll have to add jetbrains annotations manually to the project libraries or however its called in eclipse

waxen plinth
shadow night
vague saffron
#

I just installed Eclipse because it's free. I looked at JetBrains but it requires some money to use... even for personal use...

eternal oxide
fervent robin
#

for community version

#

Whats the best solution?

tender shard
# vague saffron I just installed Eclipse because it's free. I looked at JetBrains but it require...

intelliJ is free, and imho it's much easier to use. I wrote a small blog post about how to setup a project in IJ using maven (which saves you from a ton of issues in the future): https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/

fleet kraken
vague saffron
eternal oxide
vague saffron
#

Google and Stackoverflow don't offer much advise regarding Java. I normally code C# and PHP sites. :/

tender shard
#

huh? the internet is full of java tutorials 🥲

#

?learnjava

undone axleBOT
vague saffron
#

Like I said I'm VERY new.... like... 10 minutes new... xD

fervent robin
tender shard
#

i think the problem is that you put the CachedRowSet into the (...) resources part of the try / cache

#

does it really fail while populating it, or when you try to use it later?

fervent robin
#

Thats also with moving the CachedRowSet into the body of the try ^

vague saffron
tender shard
#

If you got a pom.xml file, you have to use maven to compile, not eclipse's builtin biuld system - but idk, I haven't used eclipse in 4 years or so

#

Try Right click proejct -> Run as -> Maven build

vague saffron
#

I installed the community edition of intelj

flint coyote
proud badge
#

wait, is it even possible to modify an array after its been created?

#

what im doing might not even work

fervent robin
#

array[index] = value

proud badge
#
        Chunk chunk = block.getChunk();
        NamespacedKey key = getKey(block.getY());
        PersistentDataContainer pdc = chunk.getPersistentDataContainer();
        byte[][] currentData = ByteFlattener.unflatten(pdc.get(key, PersistentDataType.BYTE_ARRAY), 16, 16);
        byte index = findIndex(chunk, uuid);
        if(index != 127) {
            currentData[block.getX() & 0xF][block.getZ() & 0xF] = index;
        }
        if(currentData.length == 0) {
            return;
        }
        pdc.set(getKey(block.getY()), PersistentDataType.BYTE_ARRAY, ByteFlattener.flatten(currentData));
    }``` i'm getting the 2d array from the PDC and modifying it
#

Wait whats the default value for the unused slots, cause ik byte cant have null

young knoll
#

0

proud badge
#

Ok thats not good I need to rework everything 💀

slender elbow
#

xd

tender shard
#

what are you even trying to do

proud badge
#

A system that stores a player's UUID in a block (storage efficiently)

#

using PDc

#

wait if I put
byte[0][5] to something, will the below values auto get filled to 0?

#

k it doesnt matter either way I just fixed it

#

byte[][] currentData = ByteFlattener.unflatten(pdc.get(key, PersistentDataType.BYTE_ARRAY), 16, 16); lets say the PDC doesnt have anything, will it just return an empty 2d array?

fervent robin
young knoll
#

Depends what ByteFlattener.unflatten does

proud badge
young knoll
#

pretty sure array1d is gonna be null

slender elbow
#

if the pdc doesn't have anything for that key, it'll return null

proud badge
#

but I thought primitive data types cant be null

slender elbow
#

an array is an object

young knoll
#

Array isn't a primative data type

proud badge
#

Ok I see

#

Ill add a pdc.has and if it doesnt ill make a new one

tender shard
#

PDC computeIfAbsent when

proud badge
#

ok, how do I just make it empty?

#

without this error

vague saffron
#

Could not get HEAD Ref, are you sure you have set the dotGitDirectory property of this plugin to a valid path?

So close...

#

Nevermind commented out the plugin from the pom.xml

proud badge
split lichen
#

I'd greatly appreciate some input from anyone better versed in ProtocolLib than myself here - I'm trying to intercept tab completion packets and send a new one in their place, but I'm not sure how to do that specifically. This is what I've got so far

worldly ingot
#

Ehm... why?

#

You know we have events for this purpose, right?

river oracle
#

I'm sorry whats an event?

split lichen
#

Please inform me if that's the case, my goal is to intercept the tab complete packets in order to send a separate completion when a player performs /version + tab

river oracle
#

?jd-s

undone axleBOT
worldly ingot
worldly ingot
#

So you probably want the former, TabCompleteEvent

split lichen
#

Is it possible to send custom completions instead of the regular ones with commands, including their arguments?

#

If I were to attempt to disable /plugins + tab for example

worldly ingot
#

Yeah you can clear the suggestions in that event and add your own. That list is mutable

#

Or even just setCompletions(new ArrayList<>()); if that's more your cup of tea :p

fervent robin
#

I am so confused

split lichen
#

How would I check if the player attempts to do a list of specific commands though, I don't want to clear all chat completions

worldly ingot
#

getBuffer() gets you the command that is being tab completed

#

I think it includes /? I don't remember off the top of my head

fervent robin
split lichen
worldly ingot
#

Your prepareStatementWithParameters() method is using a try-with-resources which closes it at the end of the method scope

river oracle
#

^ you want to not use try with resources here, but honestly I would reccomend not returning a PreparedStatement instead take one as a parameter

young knoll
#

Tis why we don't return result sets / statements

worldly ingot
#

If you remove your try statement in your second method there you'll be fine. You're already assigning the value in a try-with-resources in your executeQuery() method

fervent robin
#

Alright thanks

fervent robin
river oracle
#

you can do this in a static method too

#

it decouples it from your class

#

plus would allow you remove the query parameter would also allow you to have a void return type

fervent robin
river oracle
#

no simply don't execute the query within your method

#

overall its poorly designed

worldly ingot
#

whut

#

Oh, yeah, no, you're fine. I'd just keep them as internal utility methods to facilitate creation of other more public methods that don't return an SQL type

sonic mountain
#

I'm making a /sell plugin in version 1.6.4, and all the items sell normally, except the lapis lazuli

worldly ingot
#

In an ideal world, callers of your methods there aren't going to interact with much SQL API at all

river oracle
#
    private final void addParameters(PreparedStatement statement, List<?> parameters) throws SQLException {
            for (int i = 0; i < parameters.size(); i++) {
                s.setObject(i + 1, parameters.get(i));
            }
        }
    }

tbh I'd personally do it like this. You really shouldn't be passing around AutoClosables IMHO try with resources is really nice to make sure everything gets shut down I prefer to leverage that

dapper flower
#

How to detect the movement of an item from an inventory to another inventory? basically i want to block the player from putting fuel into a furnace

young knoll
#

InventoryClickEvent

dapper flower
#

that way i block all kind of clicks, i just want to block the ability of puting an item in a single slot

worldly ingot
#

Or InventoryMoveItemEvent if you're talking about hoppers

dapper flower
#

i tried InventoryMoveItemEvent, but it doesnt catch the event even with a logger in it

#

if there is a way to get the position of the clicked item in the inventory using InventoryClickEvent

#

i could use that but i dont know of such method

fervent robin
ashen schooner
#

hey guys can i have a problem where whenever i save my yaml config the formatting gets messed up. below is an example before it gets saved
`settings:
debugMode: 'false'
updateChecking: 'true'
chatFormatting: 'true'

Chat - Moderation

hexChat: 'true'
antiSwear: 'true'
antiChatRepeat: 'true'
chatCooldown: 'true'
chatCooldownTime: '3'

Chat - Customization

joinFormat: 'true'
leaveFormat: 'true'
motdDelayTime: '3'
motd: 'true'
announceFormat: 'GRADIENT:e34034[ANNOUNCEMENT]</GRADIENT:e0af26>GRADIENT:b2de43%message%</GRADIENT:49d1cf>'now here is after it gets saved settings:
debugMode: 'false'
updateChecking: 'true'
chatFormatting: 'true'

Chat - Moderation

hexChat: 'true'
antiSwear: 'true'
antiChatRepeat: 'true'
chatCooldown: 'true'
chatCooldownTime: '3'

Chat - Customization

joinFormat: 'true'
leaveFormat: 'true'
motdDelayTime: '3'
motd: 'true'
announceFormat: GRADIENT:e34034[ANNOUNCEMENT]</GRADIENT:e0af26>GRADIENT:b2de43%message%</GRADIENT:49d1cf>`
you can see that announceFormat gets the single quotation marks removed

#

this is how i save the messages
`public static void saveMessagesGroups()
{
try
{
groups.save(groupsF);
groups = YamlConfiguration.loadConfiguration(groupsF);

        msg.save(msgF);
        msg = YamlConfiguration.loadConfiguration(msgF);

        words.save(wordsF);
        words = YamlConfiguration.loadConfiguration(wordsF);

        settings.save(settingsF);
        settings = YamlConfiguration.loadConfiguration(settingsF);

    }
    catch (IOException iOException)
    {
        console.sendMessage("&4Error Plugin Config Cant Be Saved. The plugin will not work correctly!");
    }
}`
orchid brook
fervent robin
#

?paste

undone axleBOT
fervent robin
#

@ashen schooner

ashen schooner
#

i have been trying to figure this out for hours and i just cant

orchid brook
#

quotes around string values are optional in yaml no ?

ashen schooner
#

yes but some strings have it others dont

#

that is whats bothering me

#

this is the whole yaml

young knoll
#

Remove them all then

ashen schooner
#

it then empties out the whole config

ashen schooner
# young knoll Remove them all then

if i remove the quotes from around these the whole config breaks
chatFormat: '%prefix%&7%player_name% &b%arrow% &7%message%' noGroupChatFormat: '&7%player_name% &b%arrow% &7%message%'

do you know what can cause that?

young knoll
#

Ah

#

yeah yaml doesn't like stuff starting with %

kind hatch
#

Also, true and false don't need to be encased in quotes if those are actually boolean values,

ashen schooner
kind hatch
#

Depends on how you setup your code.

ashen schooner
#

so like ConfigManager.settings.getString("settings.updateChecking").equalsIgnoreCase("true")

young knoll
#

Yeah that works

kind hatch
#

It does??

young knoll
#

Pretty sure you can just use getBoolean though

kind hatch
#

^ Would recommend that

young knoll
kind hatch
#

If I have a value of section: 'true'
#getBoolean("section") should fail since it's a string right?

young knoll
#

Pretty sure spigot's config api will convert it

dapper flower
ashen schooner
#

okay thanks guys i did not know the % thing

kind hatch
ashen schooner
#

i have one more question tho

#

i switched to maven in idea and now i have this target folder

#

the files often get placed completely wrong inside of it

#

and in order for the build to work i have to rearrange it everytime

#

is there a way to automate this?

civic sluice
#

show your pom.xml

ashen schooner
tender shard
tender shard
#

except to copy out the finished .jar file

young knoll
#

No

sullen canyon
young knoll
#

You were imagining it

tender shard
#

oh

#

dang

young knoll
#

:p

pure dagger
#

hi, i want to get an advancement so i used:

new NamespacedKey("minecraft", "story/balanced_diet")
but it says it's deprecated, what should i do?

shadow night
tender shard
young knoll
pure dagger
#

i dont get it

tender shard
#

are you trying to get a vanilla advancement?

#

or adding your own?

pure dagger
#

yes yes

tender shard
#

ah yeah then do what coll said

pure dagger
#

"minecraft" as first arguments

#

okay thank you ❤️

viral hazel
#

can you help me?

tender shard
#

add .toString() on titleColor

#

or insert + "" + between titleCOlor and the next ChatColor

#
ChatColor.FIRST_COLOR + "" + ChatColor.SECOND_COLOR
viral hazel
#

? like thi?

tender shard
#

yes

viral hazel
#

thanks

tender shard
#

np

viral hazel
#

Can you help me? where is the problem?

tender shard
#

give the book to yourself, take it in the main hand, then enter /data get entity <yourname> SelectedItem, then show the output

#

I guess for a written book you'll have to set an author and title or sth

viral hazel
fervent robin
#

Is there a better way to check if a player clicks a specific item in your inventory other than by comparing by item name?

tender shard
viral hazel
#

and why text is not in the center?

fervent robin
tender shard
# fervent robin custom item i created

or: Why you should NEVER use NBT tags again! Spigot 1.14.1 added the biggest improvement that (in my opinion) ever made it into the Bukkit API: The Persistent Data Container (PDC). It can be used to store custom data on Entities, TileEntities, and ItemStacks. Using a bit of math, it can also be used to...

tender shard
wide coyote
#

if its a premade code i guess it was made for chat or motd

viral hazel
tender shard
#

you can't center text reliably

#

what if the player uses a custom font or sth?

viral hazel
#

only a few private players play on this server and no one has their own fonts so I want to centralize it because of that

kind hatch
#

Centering text isn't the easiest task since each letter is a different width. There is a thread that has a utility class that does this for you, but it isn't 100% perfect. That and it was mostly made for chat centering.

viral hazel
#

ohh okay

tender shard
viral hazel
kind hatch
#

What method are you using for hex codes?

viral hazel
#

String serverInfoHexColor = "99B080";
ChatColor serverInfoColor = ChatColor.getByChar(serverInfoHexColor.charAt(0));
meta.addPage(centerText(serverInfoColor + "This book is about server..."));

tender shard
kind hatch
#
public static final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");

public static String formatHexColorCodes(String string) {
  Matcher matcher = HEX_PATTERN.matcher(string);
  while (matcher.find()) {
    string = string.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
  }

  return string;
}
tender shard
#
ChatColor titleColor = ChatColor.of("#123456");
hasty oyster
#

Any way for me to disable loading/generating the end? I just don't want the end, and I have allow-end: false in the spigot.yml config ):

[20:58:06] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
[20:58:07] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[20:58:07] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[20:58:07] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[20:58:07] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[20:58:08] [Worker-Main-10/INFO]: Preparing spawn area: 0%
tender shard
#

allow-end is in bukkit.yml

#

not spigot.yml

sullen marlin
#

if allow end is false (in bukkit.yml) it won't load; unless you have a multiworld plugin like multiverse also choosing to load it

hasty oyster
#

Cheers guys!

#

Can I do the same for the nether? allow-nether? :)

sullen marlin
#

that's in server.properties, but same

hasty oyster
#

Gotcha, thanks

tender shard
#

btw @sullen marlin is nether and the_end always called <default-world-name>_nether and <default-world-name>_the_end?

sullen marlin
#

not if you disable the inbuilt ones and add one via a multiworld plugin

tender shard
#

yeah sure, but the builtin ones?

sullen marlin
#

I think so

tender shard
#

ok thx

tender shard
#

wrong chatcolor import

#

you need to import the net.md_5.bungee.api one

viral hazel
#

ohhh yesss

#

my bad

sharp heart
#

Hello, with paper there is the method "#setPos" to set the location of an entity with the "ClientboundAddEntityPacket".
How to do it for spigot, so that could be compatible with every forks ?

sharp heart
#

Because setPos is a method from Paper I guess

sharp heart
tender shard
#

then setPos is an NMS method

sharp heart
#

so why do I get this error ?

kind hatch
#

Probably because it was added in later versions.

tender shard
sharp heart
#

maybe..

tender shard
#

setPos is called e on 1.19.4

#

not a_

sharp heart
tender shard
#

are you not using automatic remapping or sth?

sharp heart
#

thank you

kind hatch
#

?mappings

tender shard
#

huh why not 🥲

undone axleBOT
kind hatch
#

Wait

sharp heart
kind hatch
#

What's the command for remapping?

tender shard
#

?switchmappings

tender shard
#

?nms

kind hatch
#

Ah

tender shard
#

you just use the mojang names (setPos) in your code, and the remapping plugin turns that into the obfuscated name again (a_, e, ...)

tender shard
#

do you use maven or gradle?

sharp heart
#

gradle

tender shard
sharp heart
#

yes but I need BuildTools

tender shard
#
plugins {
    id "io.github.patrick.remapper" version "1.4.0"
}

dependencies {
    id "org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:remapped-mojang"
}

tasks {
    remap {
        version.set("1.19.4")
    }
}
tender shard
sharp heart
#

this is really long

tender shard
#

what do you mean?

sharp heart
#

I don't have a good internet connection

tender shard
#

oh yeah well it takes quite a while on first time

sharp heart
#

In my memories it took me 1h to download a jar

#

Can I use SynchedEntityData to define location, instead of doing it with setters from Display entity ?

sullen marlin
#

why do you even need packets for this

sharp heart
#

To avoid using BuildTools

sullen marlin
#

?

#

Display entities are in the API

sharp heart
#

setPos method wasn't in 1.19.4 I guess

tender shard
#

setPos is NMS

sharp heart
#

so my plugin is compatible from 1.20.1 to 1.20.4, but not 1.19.4

tender shard
#

you just teleport the bukkit entity

sullen marlin
#

.teleport is how you move entities with the API

tender shard
#

why do you need to use NMS for display entities?

slender elbow
#

using nms is anti version compatibility

sharp heart
sullen marlin
#

.setPersistent(false)

tender shard
#

damn

sharp heart
#

damn

slender elbow
#

sniped

sullen marlin
#

sniped

#

get gud kiddo

tender shard
#

tree fiddy

dire saffron
#

Having an odd issue where i can join my "SimpleSMP" but no one else can they get "Already connected to this server"

eternal oxide
#

Wrong place but you are probably not forwarding ports if using Bungee

fervent robin
#

Line 5 is the problem. I have a CompleteableFuture<Boolean> that returns if the player confirmed in the GUI. The problem is how do I provide a completable future that I can return with the getResult method? If I just initialize it to a constructor then its bad practice?
Class: https://paste.md-5.net/hozewusoca.cs

tender shard
#

if you want to return a boolean from your future, just use CompletableFuture.supplyAsync(() -> { ... });

fervent robin
tender shard
#

no

#

it's a static method

#
CompletableFuture<Boolean> myFuture = CompletableFuture.supplyAsync(() -> {
  Thread.sleep(1000); // Wait some time
  return true; // return the boolean
});
fervent robin
tender shard
#

also why are you creating a new one here? you're supposed to complete the existing one, not create a new one

#

it looks like what you actually wanna do is to create an "empty" future right?

#

in that case yeah just use the constructor

tender shard
#

and then call complete on it later

#

make the field final so you don't accidentally change it later lol

fervent robin
#

lmao thanks

#

u should get discord helper role u have been helpful asf all the time

worthy yarrow
noble lantern
#

wow that threads still poppin

#

nice

worthy yarrow
#

eh

#

The uh post I'm talking about is something I've been working on for like 3 days so it's now been posted / covered up twice

tender shard
#

how does this look

worthy yarrow
#

bold the coords perhaps?

wise mesa
#

okay so I think I'm going insane, I need some help with this

#

okay so I have a record class like so:

worthy yarrow
wise mesa
#

and I have this snippet of code

#

where structure is of type StructureBlockInformation

desert loom
#

you're mutating the minLocation

wise mesa
#

oh my god

#

thank you

tender shard
#

stupid records not being immutable by default

#

oh

#

nah it's a location kek

#

stupid locations not being immutable

tender shard
worthy yarrow
rough drift
#

Almost mwash

#

I would do (Orange color)%home-name% (Gray like |)in (Orange color)%world% tbh

worthy yarrow
tender shard
worthy yarrow
#

would be cool but idk how you would achieve that

tender shard
#

works great

fervent robin
#

I get this a SQL syntax exception on this?

DROP TABLE quests;
DROP TABLE quests_rewards;
DROP TABLE quests_rewards_commands;
DROP TABLE quests_rewards_items;
tender shard
#

show the exception

young knoll
fervent robin
# tender shard show the exception

Caused by: java.lang.IllegalStateException: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DROP TABLE quests_rewards;
#

The tables exist and even when I added "IF EXISTS" it still failed

tender shard
#

are you using a separate execute("...") thing for each line?

fervent robin
#

no

tender shard
#

you need to

fervent robin
#

oh

#

thanks

tender shard
#

np

#

why 🥲

#

yay finally

young knoll
#

Does /home (no args) take you to your first home

tender shard
#

it takes you to your home called "home", if any

young knoll
#

I guess that works

tender shard
#

I stole the essentials behaviour

#

/sethome -> sets home named "home"
/home -> goes to home called "home"

young knoll
#

I swear I remember essentials /home just showing a list of homes if you have more than one

#

Maybe I’m insane

round finch
#

@young knoll nope u right

#

i just did it on b1.7.3 server

tender shard
#

oh yeah true. However /sethome sets a home named "home"

young knoll
#

I remember always getting annoyed about having to do /home home

tender shard
#

Basics does not have that issue!!!!1111

round finch
tender shard
#
home-list: "<green>Available homes: <gold><homes></gold></green>"
home-list-entry: "<hover:show_text:'<gold><name></gold>\nX: <gold><x></gold> <gray>|</gray> Y: <gold><y></gold> <gray>|</gray> Z: <gold><z></gold> <gray>|</gray> <gold><world></gold>\n<color:#994499>Click to teleport</color>'><gold><click:suggest_command:'/home <name>'><name></click></gold></hover>"
home-list-separator: "<gray>, </gray>"

yeah that is very easy to read right

round finch
#

html style

tender shard
# young knoll I remember always getting annoyed about having to do /home home

do you have a better idea for the placeholders? Currently it uses <name>, <x>, <y> but someone could have declared global tags in custom-tags.yml with those names, so I think maybe module-specific tags should have a special name, e.g. <%name%> - although that is probably something people wouzld use for custom PAPI tags in custom-tags.yml lmao. So maybe <$name> <$x> etc?

#

<_name>
<$name>
<%name%>

hm...

#

ok tags must be this

tender shard
#

why does IJ complain about this?

fluid river
#

yo guys

#

i'm trying to make EventListener system in a unity game

#

Currently i have made a class loader on c# inside the project which basically loads all of the mods in game's mods folder

#

now i need to code degraded spigotmc code for unity game

#

anybody want to participate(help me understand how to make an event system)?

#

my first mod basically changed a cube mesh to sphere and applied nicholas cage's face as a texture 🙂

#

What i currently don't understand is why event needs a handlerlist

#

and what is PluginManager actually for if it doesn't store a Collection<Listener> or Collection<EventHandler>

#

or if it does, how is server avoiding bottlenecking when 9999 events happening at the same time are sent to 9999 listeners and processed

#

and also when some of them are cancellable, listeners process their cancellation 💀

#

There are also custom events(which i'm gonna implement by adding components which extend AbstractEvent to gameobjects on the scene)

fluid river
fluid river
#

but server is somehow 20tps most of the time

wide coyote
#

why wouldn't it be

fluid river
#

because there are lots of events happening in the world?

#

i guess

wide coyote
#

without listeners its just an empty for loop

#

listeners and their actions make it take time

fluid river
#

yeah but what bout internal listeners?

wide coyote
#

like?

fluid river
#

idk some

#

server sends packets

#

idk if they are also handled by listeners

#

some internal ones

wide coyote
#

iirc packet handling is done by another thread

#

events (at least many of them) are in the same thread as bukkit

fluid river
#

don't mods also use event system?

wide coyote
wide coyote
fluid river
#

forge mods with @EventHandler

#

shit

wide coyote
#

i never made mods but i doubt they do

fluid river
#

it's even worse

wide coyote
#

lol

#

just leave it

#

he is not an active user ig

#

didn't even got the username

fluid river
#

well, they do

wide coyote
#

that is not related to the server

fluid river
#

but modded minecraft still doesn't lag much

wide coyote
#

forge does that i guess

fluid river
#

trying to make game moddable

wide coyote
#

it would work the same way

fluid river
#

so that's related not to the server, but to my problem 🙂

wide coyote
#

shouldn't matter

fluid river
#

what the hell is Event.handlerList

#

why

wide coyote
#

i have no idea what that is

wide coyote
#

i guess that would help

fluid river
#

maybe

wide coyote
#

not quite sure if that would skip the events from happening or add them in a queue or smth

fluid river
#

yeah i would definitely need a queue

#

tho tickrate should probably be on 50-60 like fps

#

like in csgo where it's 64

wide coyote
#

sometimes 128 ig

#

and i guess in cs2 its 256 i believe?

#

i am not sure

fluid river
#

i don't know

#

never played

wide coyote
#

it sucks

#

don't bother to download

#

anyways, ticking system should be your go to answer

fluid river
#

i guess

#

but do i really use just the:

wide coyote
#

i think so

fluid river
#

this feels kinda cringe

wide coyote
#

if you got any other ideas just as performant as this is, use it

fluid river
#

one list for everything happening in the game

wide coyote
#

how else would it work tho?

fluid river
#

separate list for every type of event xD

#

Much memory would be used but time is saved

wide coyote
#

maybe a map with eventtypes, listeners

fluid river
#

cuz imagine

wide coyote
#

or table idk whatever its called in c#

fluid river
#

c#'s hashmap

#

on every event happening i need to select which listeners to send event to

wide coyote
#
    public void processQuest(Event event) {
        for (HandlerWrapper wrapper : registeredHandlers) {
            Method handler = wrapper.getHandler();
            if (handler.getParameterTypes()[0] != event.getClass()) continue;

            Quest quest = wrapper.getQuest();

            try {
                handler.invoke(quest, event);
            } catch (IllegalAccessException | InvocationTargetException e) {
                e.printStackTrace();
            }
        }
    }
#

this is a method i used 2 years ago

#

it was made for a quest plugin

fluid river
#

hashmap is probably a good solution actually

wide coyote
#

registeredHandlers was a set in this plugin but yeah like i said its old lol

fluid river
#

getting all event types which are not abstract

#

like this actually

#

since EventDescription is abstract

worthy yarrow
#

  defaultBalance: 100
  ######################################################################################################################
  setCoins:
    sendSetCoinsMessage: true
    setCoinsMessage: "&fYou have just set &c&l%player%&r's balance to &a&l%playerBalance%"
  ######################################################################################################################
  addCoins:
    sendAddCoinsMessage: true
    addCoinsMessage: "&fYou have just added &c&l%amount% &rto &a&l%player%&r's balance!"
  ######################################################################################################################
  removeCoins:
    sendRemoveSuccessMessage: true
    removeCoinsSuccessMessage: "&c&l%coins% &rhave just been removed from your account!"

    sendRemoveFailMessage: true
    removeCoinsFailMessage: "&c&lYou do not have enough coins to perform this action! You currently have %currentCoins%!"
  ######################################################################################################################

How do we feel about this?

worthy yarrow
#

Also I think it's worth mentioning setcoins / addcoins method is for admin command usage hence the notifyTarget object

#

RemoveCoins I was handling a bit differently functionality wise... however I don't think the notify target is necessary there

#
private final EconomyManager economyManager = new EconomyManager(this);
 @Override
    public void onEnable() {
        registerCommands();
        enableLogInfo();
        loadConfig();
    }

    private void registerCommands(){
        getCommand("coin").setExecutor(new CoinCommand(this, economyManager));
    }

Also would this be correct initialization of economyManager? or am I just dumb

echo basalt
#

playerUUID -> playerId

#

Don't use public variables

worthy yarrow
#

What do you think of the configurablility options?

echo basalt
#

public variables icky

worthy yarrow
# echo basalt public variables icky

mmmm....

    public boolean sendSetCoinsMessage;
    public String setCoinsMessage;
    public boolean sendAddCoinsMessage;
    public String addCoinsMessage;
    public boolean sendRemoveSuccessMessage;
    public String removeCoinsSuccessMessage;


    public boolean sendRemoveFailMessage;
    public String removeCoinsFailMessage;```
echo basalt
#

Yeah that's not great

#

What you should do instead is just have a sendMessage method

#

Where you pass a message identifier

#

And if that message exists, it gets send

#

It it doesn't, whatever

worthy yarrow
#

Hmm yeah that sounds a lot better haha

#

How does the structure look so far?

#

Other than the addressed issues ofc

echo basalt
#

Give me a second I'm dealing with a plugin that decided to nuke all of its player data in a production server

worthy yarrow
#

How lovely

twilit wharf
#

I am having a problem with my plugin where on server shutdown it isnt reliably removing entities from the world. I need them to be deleted when the server shutdowns, and I am doing so by the onDisable event. Should I be doing it based off an EventHandler for world unload or something similar? Or is my issue elsewhere?

worthy yarrow
twilit wharf
#

well yeah

#

I was not talking about my code structure

#

I was talking about how I listened for server shutdown

worthy yarrow
#

I'm also not sure if running a slight delay might help

twilit wharf
#

I think that the world would be unloaded by then though no?

wet breach
worthy yarrow
#

I'm not sure if that's detectable, since onDisable means your plugins disable

twilit wharf
#

thats the issue, if the only way to delete the entities is on startup, how does someone with my plugin ever get rid of the entities?

worthy yarrow
#

reloading the plugin

twilit wharf
#

if they want to remove the plugin*

worthy yarrow
#

or when you run the entity cleanup logic

#

perhaps you provide a command or something for the clear entitys

twilit wharf
#

ig I could add some extra logic to allow a cleanup command or what not

#

but that would be a pain for both me and the consumer

worthy yarrow
#

Could allow for single chunk cleanup as well

#

might be nicer tbf

twilit wharf
#

the plugin handles everything automatically (by deleting on startup) so the consumer never sees the issue until they go to delete the plugin. its not something they would regularly need to do

#

so I guess I will just make a "disable" command which just disables the entirety of the plugin so that it can be removed without the left over entities

#

(the entities are the plugin)

worthy yarrow
#

"its not something they would regularly need to do" I think this answers your question, you just simply need to make cases for when this function needs to come into play

twilit wharf
#

yeah the best case would be delete on shutdown

#

oh actually

worthy yarrow
#

hmm

twilit wharf
#

does that make it not able to save?

sullen marlin
#

yes

twilit wharf
#

thats exactly what I need, I didnt realize that existed

worthy yarrow
#

md with a hot fix

#

Big W

wet breach
#

on startup you take those locations, load the relevant chunks, remove your entities if you need them removed

twilit wharf
#

I already do that, the plugin functions fine except for deleting it

#

but now I can just delete all of that code

#

and just do what md said

worthy yarrow
#

I mean

#

You could leave what you have and implement extra functionality... just keep expanding it

twilit wharf
#

wdym

worthy yarrow
#

As in every single case for when a user needs to clear entities

#

It's really just extra user functionality benefit ya know?

twilit wharf
#

in my plugin the entities are text displays that are passengers to entities and show their health, they should never need to be cleared (their visibility and what not is handled elsewhere, dont worry about that)

#

the only reason they should ever be deleted is on shutdown

worthy yarrow
#

ah gotcha

twilit wharf
#

yeah

worthy yarrow
#

no worries then

#

you got exactly what you needed then haha

twilit wharf
#

yep

#

can always count on md

worthy yarrow
#

always pops outa the woodworks too

#

Sucks being self taught over spigot api and not knowing all the solutions D:

twilit wharf
#

not sure there is any other way to learn spigot

worthy yarrow
#

There's always another way

#

Doesn't mean it will be the best

#

So I'd listen to md

twilit wharf
#

pretty sure everyone, including the tutorial makers are self taught, there are not really "docs" from the developers of spigot themselves, just the community in the forums

#

the javadocs are a lifeline

worthy yarrow
#

Well I just meant that my experience is not as extensive as others, and to just have this information on command is impressive. I get the docs are easily available but it's hard to sometimes search for what you need

twilit wharf
#

ah yeah, I just let github copilot tell me what it thinks is best, half the time it has a brilliant solution, the other half it leads to me to the right answer through some javadoc digging

worthy yarrow
#

Plus they can just take "what your function does" and be like oh you gotta do it like this or this and it's pretty cool imo

#

I sent my towny addon to the head dev guy of towny advanced, and he liked it, put it through some ai thing and it gave me an a+ haha

wet breach
# twilit wharf pretty sure everyone, including the tutorial makers are self taught, there are n...

Javadocs are not hard to understand. The part that can't really be conveyed is how everything is implemented. Implementation of an API can be different even if the API itself is the same. IE, order of events are not necessarily guaranteed for example. So an event coming before another is sometimes just a coincedence and can't be relied that in the future to not change. Some of us here have been doing programming long before MC came around 😛

worthy yarrow
wet breach
#

sometimes yeah

worthy yarrow
#

I also hate looking through docs for long periods of times

wet breach
#

As for the entities problem you can do what MD said, but I would still implement a method that checks on startup that they didn't stick around

#

this isn't a new problem

twilit wharf
wet breach
#

if you don't know how to read the documentation sure

twilit wharf
#

even though the javadocs outline the actual methods and classes, it doesnt really help with the true implementation of it

worthy yarrow
#

Oh that's why I got stephans udemy course haha

#

just for the spigot basics pretty much... I should probably finish that course because there are still a lot of concepts I have to come back to

twilit wharf
#

I would have never found this.getServer().getPluginManager().registerEvents() in the javadocs, but maybe I am just bad at looking through them

wet breach
#

Once you understand a language, IE java for example. Its not hard to read API documentation and it isn't all that more difficult to devle into the implementation yourself to see how it was implemented or not implemented

#

so someone who actually has been programming in Java for a long time, can indeed pick up something like spigot and code something within the first few minutes

#

without all that much difficulty because Java code isn't suddenly different

worthy yarrow
#

Though to be fair, I learned everything I know about java through minecraft framework / spigot api so

wet breach
#

that isn't a bad thing

worthy yarrow
#

And about 14 pages of java 8 bible

wet breach
#

what is bad and kind of annoying is those new to both come here pestering with a million questions

#

you should first attempt to learn it yourself and do the work yourself before coming here

worthy yarrow
#

Yeah like I said, I got the udemy course for that exact reason. Learn the damn basics and then you can start to learn by yourself

#

by yourself as in without guide from others

wet breach
#

I started programming by first learning web development, then I moved to VB and then it was onto C and C++

twilit wharf
#

thats the other hard part. its difficult to learn a programming language period. I get its not really that hard, but it takes a lot of hours, a lot of practice, and there is always something more to learn. it takes a pretty big amount of information to be able to even make something useful out of a programming language, and that for most people is too much effort. They would rather make something before understanding how its made. That is how I learned, I just didnt ask others questions I just googled until I understood it, or I just ignored it until I eventually leanred about it elsewhere

wet breach
#

and somewhere in there, Java as well

quaint mantle
#

Is js easy to learn

worthy yarrow
#

Well another large part of my learning java was also that when it came to spigot, pretty much everything you know from player experience can be related to the api

twilit wharf
#

just imagine like python, but Java syntax