#help-development

1 messages ยท Page 837 of 1

lost matrix
#

I can think about 3 ways on the spot that would perform significantly better

#

*Trading memory for CPU time that is

proud badge
#

Ok what are the methods? (I can't use anything outside of coreprotect due to server having over 100 days worth of structures)

lost matrix
#

Lets explore one straight forward method.
When a chunk loads, query placed blocks in this chunk, create a small data structure like a

record BlockPos(int x, int y, int z){}

And throw them in a HashSet you can check sync in your BlockBreakEvent or whatever.

#

You can query async as chunks rarely get interacted with in the first few hundred millis after loading.
Just prevent interaction with chunks that have not been synced.

proud badge
#

wouldnt this still have the same performance issues? You're still doing database lookups on every block in that chunk. Maybe this would be even more laggy

lost matrix
#

Doesnt CoreProtect have a query for all blocks within a chunk?

proud badge
#

i dont think so but lemme check

lost matrix
#

Ah i remember.

#

Disgusting

proud badge
#

Oh performLookup works on a radius

#

Not a chunk

quaint mantle
#

one of my favorite things to do is comment every line of code in my plugins, the most verbose shit too :)

proud badge
#

personally I hate comments, I try to remove all comments

lost matrix
#

That is literally counter productive. Write code that needs no comments instead.

quaint mantle
#

๐Ÿ‘

lost matrix
#

Your choice ๐Ÿคท

quaint mantle
#

i javadoc my bitch to high hrothgar

lost matrix
#

Some people just love writing unclean code i guess

quaint mantle
#

i mean the code is clean

#

just not the javadocs

lost matrix
#

If you comment every line then it is stained as hell.

lost matrix
#

Btw CoreProtect is used for logback, not prevention. Youll have a hard time either way.

proud badge
#

Ik

#

Im not trying to cancel any events

#

what happens if I try to cancel an event after the event has passed

lost matrix
#

Nothing

quaint mantle
#

I mean

#

nvm

proud badge
#

ok chatgpt told me to do this, lets hope it didnt lie

#

(this is a temporary fix until I figure out how to do that chunk loading thing)

lost matrix
#

What data structures are those 3 "queues"?

proud badge
#

that is an arraylist

lost matrix
#

Hm. calling remove on an arraylist iterator is really not that great.

proud badge
#

Rip

lost matrix
#

Wait they are public, static, mutable and not even final?
This is the highest order of static abuse.

proud badge
#

._.

#

Well I need to add/remove things to them so I cant make them final

proud badge
#

I thought final means cannot be modified anymore?

lost matrix
#

Do you add elements from the main thread, and poll elements from other threads?

grim hound
#

because final only makes read-only the very defined object

grim hound
#

but you can perform methods on it

#

including add/remove

grim hound
lost matrix
# proud badge yes (I think)

Use a ConcurrentLinkedQueue then. It allows adding elements by a single thread and removing elements from it
by multiple threads, while not blocking either the producer nor consumer.

proud badge
#

replace ArrayList with ConcurrentLinkedQueue you mean?

lost matrix
#

Let me write a quick example.

proud badge
#

ok

lost matrix
# proud badge ok
  private static final Queue<Alert> alertQueue = new ConcurrentLinkedQueue<>();

  public static void addAlert(Alert alert) {
    alertQueue.add(alert);
  }

  public static void processRemainingAlerts(Consumer<Alert> consumer) {
    Alert next = alertQueue.poll();
    while (next != null) {
      consumer.accept(next);
      next = alertQueue.poll();
    }
  }

Or if you dont have enough experience with Consumers you need to do the null check externally:

  private static final Queue<Alert> alertQueue = new ConcurrentLinkedQueue<>();

  public static void addAlert(Alert alert) {
    alertQueue.add(alert);
  }

  public static Alert getNextAlert() {
    return alertQueue.poll();
  }
steel swan
#

hello, i have a problem with a scoreboard
i have this code
inside a new BukkitRunnable() { public void run() {

my goal is to show life to the player and a sidebar scoreboard. The sidebar works fine, but for the health, it resets to 0 every seconds.

i thought that itwas because it was in the new BukkitRunnable() { public void run() { that updates every second, but idk how to fix it

proud badge
lost matrix
remote swallow
#

is deque deck or de-queue

lost matrix
#

add -> appends an element on the left
poll -> removes and gets the element from the right

sullen marlin
#

De-queue

#

Double ended queue

remote swallow
#

GET SHIT ON @river oracle MD AGRESS WITH ME

river oracle
#

deck

young knoll
#

It's actually pronouned Dairy Queen

proud badge
#
                        String previousOwner;
                        List<String[]> lookup = CoreProtect.getInstance().getAPI().blockLookup(i.getBlock(), 2147483647);
                        if (lookup != null) {
                            boolean hasPlaced = CoreProtect.getInstance().getAPI().hasPlaced(i.getGriefer(), i.getBlock(), 2147483647, 0);
                            boolean hasRemoved = CoreProtect.getInstance().getAPI().hasRemoved(i.getGriefer(), i.getBlock(), 2147483647, 0);
                            if (!hasRemoved && !hasPlaced) {
                                for (String[] result : lookup) {
                                    CoreProtectAPI.ParseResult parseResult = CoreProtect.getInstance().getAPI().parseResult(result);
                                    if (parseResult.getActionId() == 1 && !parseResult.getPlayer().startsWith("#") && !parseResult.isRolledBack()) {
                                        previousOwner = parseResult.getPlayer();
                                        finalDoAlerts.add(new Alert(Bukkit.getPlayer(i.getGriefer()), i.getBlock(), previousOwner, i.getMaterial(), i.getDrops(), i.getBlockData()));
                                        break;
                                    }
                                }
                            }
                        }
                    }``` 
Where/how should I use the queue in this area?
lost matrix
#

Not done reading but...

steel swan
#

but i know where the bug is from, idk how to fix it tho

lost matrix
steel swan
#

cuz when i do what i did usually , it does this

#

do i need to delete the old score?

grim hound
#

since the display set treats it like a player's name

#

so either reset all and set your info once again

steel swan
#

how do i do that?

grim hound
#

or reset only one and have it set

steel swan
grim hound
#

so either Scoreboard#resetScores

grim hound
steel swan
proud badge
#

does this look about right?

grim hound
#

the previous value

#

or the name shown in this case

#

so like

steel swan
#

what?

#

if the value has changed it will fuck things up

grim hound
#

but the display name

#

like reset the previous line

#

and add a new one with the same order value

steel swan
grim hound
#

store it

steel swan
#

the value has changed, how do i get the last one

grim hound
#

in maybe an array

#

store each change

#

in the array

#

and reset the previous array's element

steel swan
#

bro are you sure there is no other way? this seems way too complicated for nothing

grim hound
#

if null then don't

grim hound
steel swan
#

so i store whats shown as a in a String list?

grim hound
#

string array

#

since it's already a fixed size enumaration

steel swan
#

and right here before it loops again i store all the values?

grim hound
#

right after you update

#

the value

#

and before updating again

#

get the previous string stored

#

reset the scoreboard object

#

and store your new value

#

and show it on the scoreboard

young knoll
#

I just have my scores be static

#

And change prefix + suffix

steel swan
#

like this?

#

(s8 can be null so i check)

grim hound
steel swan
grim hound
#

don't use a List

steel swan
#

its an array

#

litterally what u told me

grim hound
#

are you sure?

steel swan
sullen marlin
grim hound
steel swan
#

why shouldnt i use that?

grim hound
#

String[] array = new String[14];

grim hound
#

you just don't need it

#

and it's more clear to use an array in this case

proud badge
steel swan
#

ok but i still can?

steel swan
#

ok

#

but when i have them in a list/array

#

what do i do next?

young knoll
steel swan
#

like what do i put here

#

how do i delete the old score

grim hound
grim hound
steel swan
grim hound
#

but probably with the Scoreboard#resetScores

grim hound
steel swan
grim hound
#

since the scores returned will be immutable

steel swan
#

like scoreboard.resetScores(scores.get(11));

steel swan
grim hound
steel swan
#

why???

grim hound
grim hound
steel swan
grim hound
#

it's a list

steel swan
#

yeah

grim hound
#

then it should work

#

but make sure to check for nullability

#

if it's null don't reset the score

#

cuz another error

steel swan
#

like this?

grim hound
#

for now it can be done like that

steel swan
#

i love you

grim hound
#

why would they do this

grim hound
steel swan
#

YES

#

BRo

grim hound
#

niiice

steel swan
#

thank you SO MUCH

grim hound
#

I was totally guessing

steel swan
#

YOU HAVE no idea how much things i tried

steel swan
grim hound
steel swan
#

thx man

#

really apreciate it

#

u wanna know smth funny

grim hound
#

ai no problem

grim hound
steel swan
#

i had to redo the whole thing cuz using ArrayList didnt work, so i used scored[] like u said

#

should have listened to you from the begening lol

#

but thx man

proud badge
#

Wait this is a thing? since when

#

I've been setting hashmaps and checking playedamageevent

grim hound
#

1.8

#

it's an Entity thing

#

but should work for players as well

young knoll
#

Not sure it will

#

But ya can try it

floral kindle
#

Does anyone know an alternative way to do entity.damage(1, player); work?

rapid trout
#

I'm trying to give a glowing effect to an entity visible only to a player, does anyone know why my code doesn't work?

EntityPlayer entityPlayer = ((CraftPlayer) p).getHandle();
PacketPlayOutEntityEffect packet = new PacketPlayOutEntityEffect(
   silverfish.getEntityId(),
   new MobEffect(MobEffects.x, 10, 1, false, false)
);
entityPlayer.c.a(packet);
half arrow
#

any libs for handling pages on gui's? or is it simple enough to do?

umbral ridge
#

It was fairly simple for me. took me an entire day though
other public apis:

#

but their code is horrible from what i can see

umbral ridge
#

im sure theres better examples

umbral ridge
grim hound
valid basin
#

How to use textcomponent and how to show hover text on book on version 1.8.8?

#

I've tried many different approaches I could find online, none worked

#

is it actually possible to have a book with hover even on 1.8.8?

grim hound
grim hound
vocal cloud
#

1.8.8 lacks a lot of QoL features

grim hound
#

cool nickname

valid basin
grim hound
valid basin
grim hound
#

but I don't think that it was

vocal cloud
#

It's the most optimized version if you've written your own lol. It's nowhere near as optimized as what we have today

young knoll
#

Technically every version was more optimized than the next

#

Less features = less cpu usage

vocal cloud
#

The current version is extremely optimized compared to what came before. However, the feature creep has slowed it down. The correct description would be "it's the version that has a dedicated PvP community" that's the only reason it's used so much

#

99.9% of 1.8.8 servers fail because they rehash the same experience that other larger more active servers provide. You'd have more success attempting a unique experience on the new versions with cool mechanics unavailable to the 1.8 experience.

grim hound
#

is there a different kick packet for the login phase?

ivory sleet
grim hound
ivory sleet
river oracle
#

@ivory sleet I actually got a working parser ๐Ÿฅณ my MiniMessage syntax clone is functioning!!! the parse time is pretty decent too

ivory sleet
#

W

river oracle
#

<yellow>random <gradient:red:blue><bold><%name></gradient></bold><click:run_command:test command><underline><red>click here</click><blue> to <bold>FEEL</underline> it idk how I feel about my placeholders but they work pretty well for now

grim hound
minor junco
#

That's how I handle it, it comes with a default prefix/suffix of ${...}

river oracle
young knoll
#

Excuse me papi has made it so you legally have to use % with minecraft

#

I donโ€™t make the rules

river oracle
#

otherwise my tags would look like
%yellow%

#

and that's dumbn

young knoll
#

Exposed

half arrow
#

Snitch exposed

young knoll
#

Fuck

half arrow
grim hound
#

how can I get the user's ip address from the Channel object?

quaint mantle
#

has anyone here used mockbukkit before

gleaming grove
quaint mantle
gleaming grove
quaint mantle
#

Anyone here have experience with Guice (DI)?

quaint mantle
ivory sleet
#

But we switched to dagger

quaint mantle
#

Is this correctly implemented?

quaint mantle
#

Just now ๐Ÿ˜”

#

What's dagger?

ivory sleet
#

imo a better di framework

#

since guice can sometimes be giving overhead during runtime

#

like if you have a class thats frequently created

#

But it looks fine

#

Tho I suggest reading up about DOs and DONTs for guice

#

For instance field injection is generally something you want to avoid

#

iirc

quaint mantle
#

In dagger github they say its for android, I guess android it's not required, or I am looking to the wrong repo

ivory sleet
ivory sleet
quaint mantle
#

๐Ÿ˜‚

ivory sleet
#

:^)

quaint mantle
#

Anyway, thanks for the advise

ivory sleet
#

Yeah gl

quaint mantle
ivory sleet
#

On a unit level, just mock the bukkit interfaces with mockito

#

On an integration or system level, use mockbukkit

#

**

quaint mantle
#

Alr

quaint mantle
#

Also for tdd am I making a test for every single class

#

I've found this

#

You might be interested on it

#

lol

ivory sleet
#

Which is time consuming if youโ€™re not used to tdd

quaint mantle
#

But it makes your program sustainable right

ivory sleet
#

There are also issues regarding ur test infrastructure that will appear if youโ€™re new to tdd like the fragile test problem

quaint mantle
#

Or bug free

ivory sleet
#

And it can serve as a quality check for when u change stuff in ur code

#

And when u refactor stuff

#

And it serves as a documentation source

quaint mantle
#

wdym documentation

ivory sleet
#

Your tests document ur code

quaint mantle
#

Like how an impl should work?

ivory sleet
#

Nah but for instance if I have a vector test class

#

And I have tests like
givenZeroVector_doesReturnZeroVectorWhenMultipliedWithScalar
givenANonUnitVector_doesHaveMagnitudeOfOneWhenNormalized

#

these document what my methods do, in particular Vector#magnitude() and #multiplyScalar()

quaint mantle
#

Oh ok

shut field
#

I have a question about how to use BuildTools

#

how do I get the version of it with all the CraftBukkit stuff

#

is it this? adding the compile CraftBukkit?

ivory sleet
#

You only want the craftbukkit stuff or what exactly?

shut field
#

I want it to include the NMS stuff is what I meant, sorry

#

like CraftEntity

young knoll
#

?nms

shut field
#

awesome thank you ๐Ÿ™‚

#

how do I know which file in the work folder is the right one to use?

#

there's multiple called like "server" and "minecraft_server" and "mapped"

sullen marlin
#

Use maven or gradle

shut field
#

which has CraftCreature?

#

ohhh i see lemme try that

sullen marlin
#

Also

#

?xy

undone axleBOT
shut field
#

how to get NMS

#

wooooo! got it thanks all

#

๐Ÿคฉ

#

๐Ÿ˜

stark knoll
#

I want to report a spigot programmer

wet breach
sullen marlin
shut field
#

for the getHandle()

distant wave
#

How can i spawn a mob with custom velocity? Like a bat

#

Using nms i meant

distant wave
quaint mantle
distant wave
cursive sundial
#

25.12 07:58:29 [Server] Server thread/ERROR Could not load 'plugins/images-2.3.0.jar' in folder 'plugins'

Does anyone know why this happens?

upper hazel
#

how create spawn item in vanila structure system

#

i mean i can get structure location?

#

or for it need custom generation?

proud badge
#

what would be something like .setInvisible(), but it also hides their armour and doesn't remove the player from tab?

sullen marlin
#

uh .hide will do the first part but not the second

proud badge
#

im aware

#

is there something that will do both parts?

halcyon hemlock
#

Hide them and add temporary entity in tab?

slate tinsel
#

Hello! Right now I save all my projectiles in an "ArrayList", but I thought I'd add so I can see what coords each projectile has passed with a BukkitRunnable task that adds a projectiles coords every tick from when it's fired. How could I do this?

eternal oxide
#

why are you saving entities in a list?

valid burrow
valid burrow
eternal oxide
#

My point is there may be a MUCH better way than tracking transient Entities

#

Which is why I asked why he was doing that

proud badge
#

Where do I specify which command I want to complete tab for?

hazy parrot
#

Command#setTabCompletion

#

Or smth

eternal oxide
#

are you trying to do multiple command tab complete in one completer?

proud badge
#

I'm trying to suggest those things when I run a command

#

Where would I specify that command name?

hazy parrot
#

Oh I didn't notice, afaik completer doesn't work for base command

proud badge
#

Rip, how would I do it then?

#

Put it in same class as CommandExecutor?

hazy parrot
#

Isn't it vanilla behavior to complete base command?

#

I might be wrong

eternal oxide
#

implement TabExecutor instead of CommandExecutor

#

your code you shoudl add any which partial match

#

you can do that with a string partial match, sec

proud badge
#

Thanks, also, how would I put a suggestion inside of a suggestion?

#

for example if they type tp I want to suggest a few things

hazy parrot
eternal oxide
#

add all your possible args to a LIst

#

then StringUtils.copyPartialMatches

valid basin
vocal cloud
eternal oxide
#

is that using Bungee chat component?

umbral ridge
#

man, who codes for christmas? yall need to take a break

eternal oxide
#

Sitting here waiting for the family to flock in

#

an hour or two, then I can be a hermit again

umbral ridge
#

xDD

shadow night
#

I don't got christmas, I got a family with covid

halcyon hemlock
proud badge
#

player.teleport puts me on the corner of a block. How could I make it put me in the center?

eternal oxide
#

Location#add(0.5,0.0,0.5)

#

may have to do a new Vector

proud badge
#

Ok epic

#

Also: Is it possible to save things such as Location Block etc with sqlite? With json I couldn't

eternal oxide
#

it's ConfigurationSerializable so saves straight to yaml

#

it's just 3 doubles and a name

glossy venture
#

hi does anyone know how to use the FAWE api with 1.8 (java 8) in a project and specifically use it to paste schematics asynchronously? ik this probably isnt the appropriate discord but i cant find the fawe discord and im wondering if there is someone who may have experience with this

#

right now i parse the schematic and complete the paste synchronously, which lags the server for like 10 seconds

#
public CompletableFuture<EventContainer> pasteMapAsync(EventMap map, boolean canReuse) {
    if (canReuse && this.presentValidMap == map) {
        return CompletableFuture.completedFuture(this); // nothing to do
    }

    if (this.presentValidMap != null) {
        resetMap();
    }

    final WorldData worldData = LegacyWorldData.getInstance();
    final com.sk89q.worldedit.world.World world = new BukkitWorld(getWorld());

    try {
        ClipboardFormat format = ClipboardFormat.findByFile(map.getSchematic().toFile());
        if (format == null)
            format = ClipboardFormat.SCHEMATIC;
        ClipboardReader reader = format.getReader(Files.newInputStream(map.getSchematic()));
        Clipboard clipboard = reader.read(worldData);

        // perform paste of the new schematic
        Operation pasteOperation = new ClipboardHolder(clipboard, worldData)
                .createPaste(world, worldData)
                .to(new BlockVector(0, 0, 0))
                .ignoreAirBlocks(false)
                .build();
        Operations.complete(pasteOperation);

        map.onPaste(this);
        presentValidMap = map;
    } catch (Throwable t) {
        throw new RuntimeException("Failed to paste map `" + map.getName() + "` into event container `" + world.getName() + "`", t);
    }

    return CompletableFuture.completedFuture(this);
}
#

current code

#

ive used a completeable future here to make it future proof for when itll be asynchronous

upper hazel
#

what enum need for enchantments

#

why in bukkit enchantments that are not in the game

#

Like DAMAGE_ALL

shadow night
#

that's sharpness

upper hazel
#

lol

orchid trout
upper hazel
#

saving money for Christmas

umbral ridge
orchid trout
#

yweezg]]

umbral ridge
peak depot
#

Why is event.getConnection().getUniqueId() null in PreLoginEvent? (BungeeCord)

eternal oxide
#

preLogin = not yet logged in, so no clue who it is, so can;t have a uniqueID

grim hound
#

I am confused

steel swan
#

hello, im trying to do smth wich is to prevent certain types of items to drop when a player dies. BUt there is not a e.setDrops() for PlayerDeathEvent. Any idea on how to do it?

chrome beacon
#

You can just remove the drops you don't want from the list

remote swallow
#

ooo olivo booster again

chrome beacon
#

I won Nitro giveaway uwu

remote swallow
#

fancy

chrome beacon
#

1 month pink

remote swallow
#

get it from helpchat or somewhere else

chrome beacon
#

Somewhere else

steel swan
chrome beacon
#

yes

remote swallow
#

you win anything on helpchat giveaways?

steel swan
#

Okey thx

chrome beacon
remote swallow
#

lol

#

have you won stuff 2 years running lol

chrome beacon
#

tbh not sure but maybe

glossy venture
#

i know its unsupported

#

idc

grim hound
shadow night
#

I am confused all of the time

glossy venture
#

wondering if anyone knows how to use the FAWE api in 1.8 to paste a schematic asynchronously

chrome beacon
#

Just use the api async

glossy venture
#

didnt work for me but thats probably because i was using pure worldedit api

#

using the BukkitWorld wrapper

chrome beacon
#

what about it didn't work?

glossy venture
#

idk how to import the FAWE api into my project as its for java 17

glossy venture
# chrome beacon what about it didn't work?

i basically did

CompleteableFuture.runAsync(() -> {
  // ...
  
  Operations.complete(pasteOperation);
});

using BukkitWorld from the worldedit api as the world adapter, which appereantly uses Block#setType from the bukkit api to set each block which the async op catcher caught

chrome beacon
#

uh I believe that's all I had to do last time I tried FAWE

#

don't remember though

#

go ask in their discord

steel swan
chrome beacon
#

?tas

undone axleBOT
shadow night
glossy venture
chrome beacon
peak depot
#

Why does the first person that types something in Chat after I canceled 1 ChatEvent Message get kicked?

chrome beacon
#

chat verification failure?

#

or what's the kick message

peak depot
chrome beacon
#

and what version is the server running

peak depot
# chrome beacon How did you cancel the message
    @EventHandler
    public void onMessage(ChatEvent event) {
        if(event.isCommand()) return;
        if(!(event.getSender() instanceof ProxiedPlayer)) {
            return;
        }
        ProxiedPlayer player = (ProxiedPlayer) event.getSender();
        if(module.getManager().isBanned(player.getUniqueId(), true)) {
            if(module.getManager().isBanActive(player.getUniqueId(), true)) {
                event.setCancelled(true);
                player.sendMessage(new TextComponent(module.getPrefix() + "ยงcDu wurdest aus dem Chat gebannt!\nยง7Verbliebene Zeit: ยงa" + module.getManager().formatRemainingTime(module.getManager().getTime(player.getUniqueId(), module.getManager().getReasonID(player.getUniqueId(), true)))));
            } else {
                event.setCancelled(true);
                module.getManager().unmute(player.getUniqueId(), UUID.randomUUID());
            }
        }
    }``` 1.20.1
chrome beacon
#

Or disable chat verification

peak depot
#

how

chrome beacon
#

Server.properites I believe

grim hound
#

If I want to get the Player's ip from a Channel object, do I just use Channel#remoteAddress?

peak depot
chrome beacon
umbral ridge
#

Olivo is pink!!!

slate tinsel
#

Hello! Right now I'm running this code to check if a Location is valid for a player, i.e. that player fits in and can be teleported to the position. But it seems that it gives different results when the Player's bouding box is changed, is it possible to make it fixed and if so what dimensions etc. should it have?

    public boolean isLocationValid(Player player, Location location) {
        Location tempLocation = location.clone();
        BoundingBox playerBox = player.getBoundingBox();

        boolean a = !playerBox.overlaps(tempLocation.getBlock().getBoundingBox());
        boolean b = !playerBox.overlaps(tempLocation.add(0, 1, 0).getBlock().getBoundingBox());

        Log.info("Location: " + location + "isLocationValid: " + (a && b));
        Log.info("PlayerBox: " + playerBox);
        return a && b;
    }```
small current
#

hey. how to know if a player is moving or standing?

#

i check if the length of the velocity vector is 0, but it doesnt always work

orchid trout
#

playermoveevent?

river oracle
#

@staff @staff

young knoll
#

uhh

#
        if (end == -1) {
            throw new IllegalStateException("the token that started a capture at index %d never ended. Capturing: %s".formatted(start, string.substring(start)));
        }
#

Remove that, unnecessary if statement

river oracle
#

@Staff @staff my code isn't working

#

@young knoll @staff its not working

young knoll
#

I will set you on fire

rough drift
#

LOL

distant wave
#

whast the difference between PlayerProfile and GameProfile?

remote swallow
#

paper and mojang

#

iirc

#

wait

#

ah

#

bukkit and mojang

proud badge
#

What is the best way to save Bukkit objects persistently (like ItemStack Location etc)?

chrome beacon
#

context

#

why are you saving them

rapid trout
#

I am trying to give a glowing effect to an entity visible by one specific player with protocollib but the player crash when the pack is sent.

PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);

                        packet.getIntegers().write(0, silverfish.getEntityId());

                        WrappedDataWatcher watcher = new WrappedDataWatcher();
                        WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(Byte.class);
                        watcher.setEntity(silverfish);
                        byte index0Value = watcher.getByte(0) != null ? watcher.getByte(0) : 0;
                        watcher.setObject(0, serializer, (byte) (index0Value | 0x40));

                        packet.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());

                        try {
                            ProtocolLibrary.getProtocolManager().sendServerPacket(p, packet);
                        } catch (InvocationTargetException enT) {
                            throw new RuntimeException("[X] ", enT);
                        }

Packet encoding of packet ClientboundSetEntityDataPacket (ID: 84) threw (skippable? false)
java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$b (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$b are in unnamed module of loader java.net.URLClassLoader @504bae78)

 lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$b (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$b are in unnamed module of loader java.net.URLClassLoader @504bae78)
bold hollow
#

Why it sais "Required type: capture of ? extends Player"

@EventHandler
public void CreateNPC(PlayerJoinEvent event) {
for (Player p : Bukkit.getOnlinePlayers()) {
if (p != event.getPlayer()) {
Bukkit.getOnlinePlayers().add(p);
}
}
}

proud badge
#

(ItemStack Location)

distant wave
proud badge
#

so how I understand AsyncPlayerChatEvent is fired on an external thread?

#

So I can do some things on there that wouldnt harm the main one?

remote swallow
#

Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. Iโ€™ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...

#

for 1.18.1+

distant wave
#

ty

chrome beacon
proud badge
#

An alerting/reporting system to staff, that requires saving of ItemStack and Location. Also ItemFrame in some cases and some other objects

chrome beacon
#

You can use a database

proud badge
#

Ok I'll do SQLite

#

as its stored on disc

#

Whats better?
I need to get a player's face from craftar.com api for discord relay, should I use PlayerChatEvent and open an async task, or just use AsyncPlayerChatEvent?

young knoll
#

I would use a completable future

proud badge
#

completable? do you mean compatible?

young knoll
#

no

quaint mantle
#

promise

#

Jdk decided to good idea to name it CompletableFuture

quiet ice
#

promise is such a bad name

#

It is a future that can be explicitly completed (via #complete), as it's name implies.

remote swallow
#

who would call it a promise

#

is it called promise because they promise to run it or some shit

pseudo hazel
#

js calls it that

#

and yeah pretty much

#

glorified lambda programming

river oracle
#

Java Script javas disabled younger brother everyone pretends to like because they feel bad

pseudo hazel
#

well yeah, the first person using it for their website environment just made a mistake and now the www hinges on it

grim hound
pseudo hazel
#

idk why they share a name

river oracle
grim hound
#

Since java was popular at the time

pseudo hazel
#

hmm could be

#

now we are still seeing the consequences xD

#

one thing js got us though is json

#

which is handy from time to time

river oracle
#

Js isn't bad but Node is a mistake

pseudo hazel
#

all frameworks are a mistake xD

#

all trying to fix a broken system

mellow edge
#

I cannot use spawnParticle in spigot 1.8?

river oracle
#

My main complaint is using it for things it's not meant for

river oracle
undone axleBOT
river oracle
#

Old version old problems

mellow edge
#

nvm I'll just execute a command :)

neat wolf
#

Hello, does anyone know how to do send a custom map to a player like this only using packet ? (in 1.8)

neat wolf
#

is the code public?

mellow edge
#

or I can just use protocollib actually

grim hound
grim hound
neat wolf
#

thank

grim hound
#

Just go into the constructor classes

proud badge
#

If a method is deprecated, what could I use to find the nonprecated alternative?

grim hound
#

Some deprecated can be used just fine

proud badge
#

this.itemInHand = player.getItemInHand().clone();

inner mulch
#

Can you set a blocks damage?

proud badge
grim hound
neat wolf
#

do you have the link of the lib you use to create the itemPacket pls?

inner mulch
proud badge
grim hound
#

I made it by hand

neat wolf
#

mybad i didn't see

#

thank

grim hound
#

But should work just fine

uncut folio
#

i have a question
if i run 2 SyncRepeatingTasks does the timer of the second task override the first one?
i have 2 tasks, one running every 5 seconds and one every 100 milliseconds but it seems like both are running every 5 seconds

pseudo hazel
#

show us the code you used to create the tasks

uncut folio
#

give me a sec

grim hound
uncut folio
#
 int schedulerID1 = Bukkit.getScheduler().scheduleSyncRepeatingTask(testPlugin, () -> {
           //task 1
        }, 0L, 100L);

        int schedulerID2 = Bukkit.getScheduler().scheduleSyncRepeatingTask(testPlugin, () -> {
            //task 2
        }, 0, 5L * 20);

Bukkit.getScheduler().runTaskLater(testPlugin, () -> {
            Bukkit.getScheduler().cancelTask(schedulerID);
            Bukkit.getScheduler().cancelTask(schedulerID2);
        }, 16L * 20L);
kind hatch
#

20 * 5 is 100

chrome beacon
#

^^

kind hatch
#

So both are running at 100 tick intervals

uncut folio
#

ah i see now
sorry about that lol

mellow edge
#

I never used protocollib before; is it FOSS?

chrome beacon
#

Yes

kind hatch
uncut folio
#

gotcha

inner mulch
#

Is it possible to set a blocks breakstate (the cracks when you break it?)

kind hatch
#

With packets yes.

mellow edge
chrome beacon
#

the api can do that too I believe

tender shard
kind hatch
#

Noice. When was that added?

young knoll
#

A while ago

inner mulch
inner mulch
#

Can you tell me how?

#

Pls dont tell me packets

grim hound
#

Not packets

#

But what exactly do you wanna do?

grim hound
grim hound
grim hound
inner mulch
#

Hmm

#

I would like to have the break value rhat the player sees

#

So i guess the spoofed

grim hound
#

Or even a map map

inner mulch
#

I guess persistentblockdata from fnalex would be good for this, thanks for block pdc to alex

grim hound
#

And listen to like, dig event? (I don't remember the name)

inner mulch
#

Blockdamageevent

grim hound
#

Ye that

#

And get the stored value, do if spoofed value + current mined >= maxMined

inner mulch
#

Yeah thats probably the best way

grim hound
#

Block#breakNaturally and remove the stored value

grim hound
inner mulch
#

Thanks

grim hound
proud badge
#

Any way to make links clickable in chat? For example when a player sends a link others can click on it

#

My chat system sends a message to all online players, instead of using the vanilla one

#

due to chat reporting

kind hatch
#

Use components and send the message to everyone.

umbral ridge
young knoll
#

Not when you manually muck with chat

proud badge
#

indeed

#

so how could I make it clickable when I manually muck with chat

tender shard
proud badge
#

thats not what im trying to do. Im trying to make URLs clickable in chat when a player sends a URL in their chat message. Not have a custom chatcomponent with a url

tender shard
#

where's the difference? check what they send, parse (e.g. with regex) for valid URLs, and replace that part with a clickable component

brisk estuary
#

hey does anybody know how I can have like moving blocks/items? I don't know if you guys have ever played in a prison game mode, but there is an enhancement that is called boomerang and it's just a gold plate floating around that breaks blocks. Do you have any idea on how it can be done?

kind hatch
slate tinsel
#

If I'm going to calculate if a player will take fall damage from a position, what do I need to think about more than the height?

rotund ravine
#

Potion effects

#

Blocks that could slow them either at the buttom or on the way down

kind hatch
#

Velocity

slate tinsel
#

About like this then? Will add velocity and may fix a little better structure, etc. for which materials

    public boolean shouldTakeFallDamage(Player player, Location location) {
        World world = player.getWorld();
        int topBlockY = world.getHighestBlockYAt(location);

        for (PotionEffect effect : player.getActivePotionEffects()) {
            if (effect.getType().equals(PotionEffectType.JUMP) || effect.getType().equals(PotionEffectType.SLOW_FALLING)) {
                return false;
            }
        }

        for (int y = topBlockY + 1; y < location.getBlockY(); y++) {
            Location tempLocation = location.clone();

            tempLocation.setY(y);
            Material blockMaterial = tempLocation.getBlock().getType();
            
            if(blockMaterial == Material.WATER || blockMaterial == Material.LAVA || blockMaterial == Material.COBWEB || blockMaterial == Material.SLIME_BLOCK) {
                return false;
            }
        }

        return location.getY() - topBlockY > 3;
    }```
proud badge
#

What does this mean translated to english?

tall dragon
#

u can do it shorter ;d

proud badge
#

ah ok

minor junco
#
Bukkit.getScheduler().runTaskLater(GriefAlert3.getInstance(), hologram::delete, 5 * 20);

^ in english

pseudo hazel
#

yeah, usually the blue text is clickable and will do what its saying, the one starting with "Replace lambda ..."

shadow night
#

Yes

pseudo hazel
#

then you can see what its changing

shadow night
#

If it can be shortened, shorten it

spare hazel
river oracle
#

clean code is a dumb goal, but this, this can be improved

shadow night
#

Clean code doesn't exist

river oracle
#

have you read the book or whatever

#

theirs a bunch of goals to achieve clean code!!

shadow night
#

Why

#

If your code is readable and doesn't hurt peoples eyes, it's clean enough

river oracle
shadow night
#

I don't read books

#

I don't read

#

I don't

#

I

spare hazel
river oracle
#

gross legacy chat

#

I'm sorry for your loss

spare hazel
river oracle
#

not if you use MineDown or make your own chat parser

spare hazel
#

if it aint broken, dont fix it

river oracle
#

it is broke though

#

so it does need to be fixed

#
<gray>+<green><$rewards> damage
spare hazel
#

its alright it works for me

river oracle
#

1.8?

sterile sapphire
#

About like this then? Will add velocity and may fix a little better structure, etc. for which materials


import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;

public class MenuListener implements Listener {

    @EventHandler
    public void onMenuClick(InventoryClickEvent e){

        if(e.getView().getTitle().equalsIgnoreCase(ChatColor.GRAY + "Land Shop")){

            //Make sure the player clicked on an item and not on the inventory
            if(e.getCurrentItem() == null) {
                return;

                //make it so that players cannot move items in the inventory
            e.setCancelled(true);

            }

        }

    }

}```
#

not sure on why it wont work

shadow night
spare hazel
tall dragon
#

nested runnables denting

spare hazel
tall dragon
#

id prolly use Futures

spare hazel
kind hatch
tender shard
kind hatch
#

^

tender shard
#

hellow shadow

pseudo hazel
#

yeah this is terrible to view on mobile

silent slate
#

Hi, im coding something and need a little inspiration:

What im trying to do is save Inventories, 2 to be exact.

A "json" format of what im trying to do is something like this:

UUID:
"world_name":
buildmode: boolean
Inventory_build: Inventory
Inventory_normal: Inventory

Im trying to save that data and dont really get how i could do that. Could someone give me a bit start help. This data should be saved permantently, so for example in a file. But i also need to be able to set it using functions in java. Im going to provide these functions here:

  • Boolean hasBuildMode(UUID, world_name) = returns buildmode
  • Inventory getnormalInventory(UUID, world_name) = returns Inventory_normal
  • Inventory getbuildInventory(UUID, world_name) = returns Inventory_build
  • Boolean hasEntry(UUID, world_name) = if data of this uuid and world exists
  • void setBuildMode(UUID, world_name, boolean)
  • void saveInventory(UUID, world, Inventory_normal/ Inventory_build) = saves the inventory, when switching between build mode and normal mode
  • void addEntry(UUID, world_name, boolean, Inventory_normal) = adds a entry to the file system and creates a empty inventory for the inventory_build variable

Thanks again for any help. Im really frustrated about this, because ive been trying to get a solution for this for ages

kind hatch
#

Hemlo

tender shard
#

hamlet

tender shard
kind hatch
quaint mantle
#

how does this look guys for a custom item config

{
  "damageMultiplier": 5,
  "material": "DIAMOND_SWORD",
  "name": "<red>Yo",
  "lore": [
    "My lore <yellow>XD"
  ],
  "unbreakable": false
}
tender shard
quaint mantle
#

yeah i can convert later

#

I just really like the gson api

pseudo hazel
#

apart from that looks pretty standard

#

which is a good thing for configs

silent slate
tender shard
quaint mantle
#

uh

#

cause im using json

pseudo hazel
tender shard
kind hatch
pseudo hazel
#

then later you can add config file stuff to it to actually load save to file, but usually you dont have to do anything fancy

#

unless it doesnt change much, then I wouldnt worry about caching anything

silent slate
pseudo hazel
#

why

kind hatch
#

You can make it save however often you want, it's just important to know that writing to disk every time will result in a performance hit.

pseudo hazel
#

I would just save and load whenever players change dimensions or log in / out and when the server gets restarted

silent slate
#

wouldnt it be the best then to ONLY save on Disable

kind hatch
#

Not necessarily

silent slate
#

whats pro and con there

kind hatch
#

It's better to save on both disable and on an interval.

#

That way if the server ever crashes, it'll only be however long the interval is behind.

silent slate
#

ok

tender shard
silent slate
#

ok

#

when having that yaml config, i know how to set data, but how to extract it?

pseudo hazel
#

the same way you save it

kind hatch
#

By using the #getX() methods provided.

pseudo hazel
#

but you get instead of set

tender shard
silent slate
#

okay, and to save to file id guess u use saveConfiguration?

kind hatch
#

#save() but yea

silent slate
#

ok

#

thanks so much, if any more questions rise, ill ask

quaint mantle
#

@tender shard

#

im looking at the itemstack serialize thing rn

#

and

#

is there a way to have it include all possible fields

#

like lets say the item wasn't unbreakable

#

then is there a way for it to include the value unbreakable: false still

silent slate
#

Okay, ive also got a Question. Right now i am saving the following:

UUID + world + buildmode, Inventory

The problem i see here is that there are 2 Inventories PER world, so i need to save the 2nd inventory too, how could that work?

kind hatch
#

Save it as a second subsection. You had the structure, you just gotta use it. :p

uuid:
  world:
    build_inventory: <data>
    normal_inventory: <data>
silent slate
#

Yeah i know, but how could i use .set to set it?

Currently im using this for 1 Inventory:

uuid + "." + worldName + "." + buildmode, build_Inventory

kind hatch
#

You'd just point to the second one you want to save to.
uuid.world.build_inventory
uuid.world.normal_inventory

#

The dot just denotes that you want to access a subsection.

rotund ravine
silent slate
#

thank u

kind hatch
#

There's no commas.

#

Only dots.

silent slate
#

yeah but commas is for setting the value isnt it?

kind hatch
#

For the function yea, but in the path string no.

#

config.set("uuid.world.build_inventory", inventoryData);

silent slate
#

So should i rather use this:

uuid.worldname.buildmode.inventory_build, Inventory

uuid.worldname.buildmode.inventory_normal, Inventory

or rather

uuid.worldname.buildmode, Inventory_normal

uuid.worldname.buildmode, Inventory_build

So should i add another subsection, does that make it easier getting the inventory later, because otherwise 2 items would be in the same subsection

kind hatch
#

You'd use the first 2.

silent slate
#

okay, thanks

kind hatch
grim hound
#

the class works fine I guess

#

it's just that

#

the get returns negative numbers

#

after incrementation

hazy parrot
#

Isn't there atomic long in jdk?

quiet ice
#

there is

quiet ice
#

Honestly, I'd use a Varhandle for this, no need to to use an AtomicInteger in the background with FloatToIntBits

#

Just make sure that the underlying field is volatile

grim hound
#

how is that relevant tho?

quiet ice
#

They probably meant AtomicFloat in JDK; which does not exist strangely enough

#

Probably because few CPUs support atomic addition of floats (given that floating-point arithmetic operations takes a few cycles)

shadow night
#

what are atomic objects even for

quiet ice
#

Basically wrapping a field in a way that can only be accessed and written to in an atomic manner.

#

Useful in thread-safe environments as atomic operations do not suffer from race conditions by definition (however, that does not grant you immunity from programmer mistakes. While a single operation is atomic, a block of operations may need to be locked anyways depending on the situation)

quiet ice
#

Anyways, @grim hound - if you have not figured it out on your own (or if you implemented it without too much thought):

The easiest non-atomic way of adding two floats together would be as follows:

    public void add(float f) {
        this.bits.set(Float.floatToRawIntBits(Float.intToFloatBits(this.bits.get()) + f));
    }

however, as I said that is not atomic. So either you need to synchronize stuff - which in your case is nonsensical - or use CAS as follows:

    public void add(float f) {
        int bits, result;
        do {
            bits = this.bits.get();
            result = Float.floatToRawIntBits(Float.intToFloatBits(bits) + f);
        } while (!this.bits.compareAndSet(bits, result));
    }
grim hound
quiet ice
#

Whoever wrote that impl has no idea what he wrote

silent slate
#

Hi, im back just to make sure this is gonna work:

public static YamlConfiguration storage = new YamlConfiguration();

    public static void loadBuildMode() {
        YamlConfiguration.loadConfiguration(new File("buildData.yml"));
    }

    public static void saveBuildMode() throws IOException {
        storage.save(new File("buildData.yml"));
    }```
quiet ice
#

Like, this impl is extremely terrible as A) it is factually wrong and B) it should be using varhandles instead, but I digress.

tender shard
grim hound
slender elbow
#

uh yeah that is not how you add floats lol

grim hound
quiet ice
#

Uh I could try but I'd make the one or the other mistake. But I shall see.
But if you don't get how atomic ops work, are you sure you should be using atomic objects in the first place?

grim hound
#

I do understand how they work

grim hound
#

I don't get how their implemented

silent slate
quiet ice
#

ah well then. Have some patience - I'll try to whack up something

grim hound
#

appreciate it G

tender shard
silent slate
#

thats it?

tender shard
#

also you should use a File inside Plugin#getDataFolder()

silent slate
#

yeah ill make sure to get that

#

and how to save?

kind hatch
#

YamlConfiguration#save(File file)

silent slate
#

so this would make sense?

public static void saveBuildMode() throws IOException {
storage.save(new File("buildData.yml"));
}

silent slate
#

yeah, with plugin.getDataFolder

grim hound
#

and File.seperator

silent slate
#

?

tender shard
#

just do ```java
new File(plugin.getDataFolder(), "buildData.yml");

silent slate
#

okay, finally:

public static final Plugin plugin = mondlw.laserserver.laserservermanager.LaserServerManager.getPlugin(mondlw.laserserver.laserservermanager.LaserServerManager.class);

    public static YamlConfiguration storage = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "buildData.yml"));


    public static void saveBuildMode() throws IOException {
        storage.save(new File(plugin.getDataFolder(), "buildData.yml"));
#

a bit too static, but we can fix that

quaint mantle
#

i think u can just do JavaPlugin.getPlugin

silent slate
#

why unamused @tender shard

tender shard
#

because everythingโ€˜s static

silent slate
#

still waiting for a tutorial why static abuse is bad ๐Ÿ˜‚

tender shard
#

You cant reuse that class

#

Then you just do new Config("filename.yml")

silent slate
#

and ur smart

#

im not

hazy parrot
#

@silent slate

silent slate
#

read it, the part i understood that its not garbage collected and fills up ram, so bad performance

quiet ice
#

@grim hound Okay, honestly it is actually completely pointless to do so as you can simply use VarHandle to wrap all your atomic operations.
So it would basically look like

public class AtomicFloatVarhandle {
    private static final VarHandle VALUE;
    private volatile float value;

    public float get() {
        return this.value;
    }

    public void set(float value) {
        this.value = value;
    }

    static {
        try {
            VALUE = MethodHandles.lookup().findVarHandle(AtomicFloatVarhandle.class, "value", float.class);
        } catch (ReflectiveOperationException e) {
            throw new IllegalStateException("Unable to obtain varhandle of object", e);
        }
    }
}

all other operations (e.g. setOpaque can be easily converted to their VarHandle equivalents. Since the methods of VarHandle are signature polymorphic, no overhead is incurred through autoboxing.)
So getAndAdd would look like:

    public float getAndAdd(float value) {
        return (float) VALUE.getAndAdd(this, value);
    }

yeah...

silent slate
#

The problem for me i think is that its soo easy and so helpful and i havent really had a problem with it ever, because my code isnt that complicated

quiet ice
#

I knew varhandle was the way to go, but I did not imagine it to be that easy tbh

silent slate
#

?paste

undone axleBOT
silent slate
#

i get this error

#

It says something about casting ItemStack to inventory. tell me what code u need

quaint mantle
#

Why are you casting itemsrack to inventory

silent slate
#

well i dont really know where and why and how

#

i think its the setBuildMode method, im gonna send that

quiet ice
quaint mantle
#

What type is "storage"

silent slate
#

public static YamlConfiguration storage = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "buildData.yml"));

#

Yaml

quaint mantle
#

Well you cant save inventories in yaml

#

You need to save itemstackd

quiet ice
#

?jd-s

undone axleBOT
quaint mantle
#

So it gives you itemstackd

silent slate
#

each single one?

hazy parrot
#

Save it as array of itemstack

quaint mantle
#

Yea

quiet ice
#

Yeah, Inventory is not serializable

silent slate
#

so i can i do a function that loops through the inventory and adds the Itemstacks to a ArrayList?

hazy parrot
#

Quick tip, Inventory#getContent already returns array of itemstack

silent slate
#

ok

quaint mantle
#

Quick tip turned to important tip

silent slate
#

this ?

storage.set(uuid + "." + world + "." + "normalinventory", player.getInventory().getContents());

quaint mantle
#

?tryitout

#

Aw man

hazy parrot
#

?tas

undone axleBOT
silent slate
#

there is a website for this??

#

๐Ÿคฃ

quaint mantle
#

3rd time that i tried to use a cmd today and failed

proud badge
#

Hi, its my first time using SQLite. I'm trying to save an index+a custom object (alert). What should I type near the "alert" ?

#

unless im doing everything wrong

chrome beacon
#

uh don't make sql statements in the constructor

proud badge
#

damn im following a youtube tutorial rn

#

is this true?

hazy parrot
#

Report that YouTube channel

#

You are following

proud badge
hazy parrot
#

It's always kody

proud badge
#

indeed

proud badge
hazy parrot
#

It is in fact true

proud badge
#

Rip

hazy parrot
#

That is where you have to learn sql and normalizations

quaint mantle
proud badge
#

Rip

#

thats why im asking if its true

quaint mantle
#

Imagine following a spigot tutorial about sql... just follow a normal one

quiet ice
#

A problem with constructors is that you are rarely aware that it is doing network IO.
So you can easily find yourself doing blocking network IO on the main thread if you do such network IO in the constructor.

quaint mantle
#

SQL Tutorial for Beginners - Learn complete SQL from basics to advance in one video.
This course is for beginners (with zero knowledge in sql) and through this course we'll be learning various topics including sql basics in hindi, data types, database structure, basic CRUD operations, functions, operators, aggregation, nested queries, joins, cte...

โ–ถ Play video
proud badge
#

ok

#

epic

#

is this SQlite/
?

quaint mantle
#

I dont understand what he is speaking but ye

quaint mantle
#

Sqlite is a database and sql is language

proud badge
#

Ok

quaint mantle
#

I think

proud badge
#

Idk i havent done this before

#

all I used before is json

quaint mantle
#

No

#

No

#

Sqlite also language

hazy parrot
#

*there might be few syntax differences between sqlite and mysql

proud badge
#

But can SQLite store things such as ItemStack Location etc?

hazy parrot
#

No, you have to make tales yourself

proud badge
#

._.

hazy parrot
#

Tables

proud badge
#

so I have to deserialize literally everything into strings/integers

hazy parrot
#

Not everything is out of the box

remote swallow
#

Only thing with built in serialisation is yaml

proud badge
#

Maybe I should go with yml then

hazy parrot
#

Sql is good learning experience

proud badge
#

My code has lots of bukkit objects inside of custom objects

#

I aint deserialising all that

quaint mantle
#

The contents of the yml

proud badge
#

why cant I just save the yml in my plugin's configuration folder?

quaint mantle
#

You can

#

But learning sql is also good

quiet ice
#

Just use ObjectOutputStream/BukkitObjectInputStream then

quaint mantle
#

But dont forget to do SerialId or smth

quiet ice
#

Java's serialization API is a dangerous choice anyways lol

quaint mantle
#

I had issues in the past cuz i forgot

quaint mantle
#

Good resource

quiet ice
#

My suggestion was more of a half-joke than something to take seriously

quaint mantle
#

Oh

#

Well i still like data files more than yml

steel swan
#

Is there a way to use packets in 1.20.2? cuz i dont find any protocolLib version for 1.20

quaint mantle
#

Protocollib is already for version 1.20

#

It never needs an update

quiet ice
#

Like, you use that API if you want to write something and be done with it.
But if you want to write a stable and secure application, ObjectOutputStream is incredibly dangerous

quiet ice
#

Like, you can easily find yourself making a mistake somewhere

quiet ice
steel swan
quiet ice
#

Could spigot please remove the supported minecraft versions list?

steel swan
#

so there is a 1.20.2 version?

quaint mantle
quiet ice
# steel swan what?

You get the latest release of from their CI instance (probably a jenkins server), as is the case with most plugins

proud badge
#

whats a good website to decompile a .db file?

quiet ice
#

It usually does support any version that has been released a few weeks ago

quaint mantle
quiet ice
steel swan
quiet ice
#

I swear to god, if I find the link in under a minute

quaint mantle
#

Geol going in rage mode

steel swan
#

thank you

scenic onyx
#

what is this?

proud badge
#

ok epic I have a .db file, what could I use to view it?

quaint mantle
#

Then it will work

silent slate
#

Okay, ive gotten it working (partly)

If i turn buildmode from on to off the inventory doesnt get loaded correctly (doesnt change). If im going off to on it loads it correctly.

Also i dont see a file in the folder so im unsure if its being saved correctly or saved at all.

There are no errors in the console when changing the buildmode from off -> on or from on -> off

quaint mantle
quiet ice
# quaint mantle Geol going in rage mode

The amount of times I need to hunt down links for people and find it in a matter of seconds is horrifying.
Yes, I don't expect less knowledgeable people to know what a jenkins is, but seriously?

quiet ice
#

the worst questions are still IJ-specific questions though

chrome beacon
silent slate
quaint mantle
#

Ij means intellij right

silent slate
#

xd

#

its pretty easy id say

quaint mantle
#

S a r c a s m

quiet ice
#

well it is more akin to "why does this application not start?", when stuff is obviously missing from the runtime classpath while being present on the compile-time classpath

silent slate
#

dont know that sh*t

#

still same question tho

quaint mantle
#

We cant help ya with your path if you dont show us

#

We only saw the inventory part

silent slate
#

literally sent the code

#

?paste

undone axleBOT
silent slate
#

here you go, whole thing

#

(toggleBuildMode isnt converted yet and doesnt get used)

quaint mantle
#

Do you even call your save function

silent slate
#

yes

quaint mantle
#

Where

silent slate
#

in a timed functioin in my main class

#

scheduler.runTaskTimer(this, () -> {
try {
BuildUtils.saveBuildMode();
} catch (IOException e) {
e.printStackTrace();
}}, 0L, 20L);

quaint mantle
#

Thats useless

#

But ok

silent slate
#

why

#

and also onDisable btw.

eternal oxide
#

saving every second? A bit extreme

silent slate
#

temporary

quaint mantle
#

I would save the runnable in a variable, and after toggle start it to save

#

But taskLater

silent slate
#

i dont understand

quaint mantle
#

Mond does the file even exist

#

The buildData.yml

silent slate
#

it wasnt created yet

#

plugin should create it, shouldnt it?

quaint mantle
#

...

silent slate
#

it doesnt

#

...

#

Now i got this

Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class [Lorg.bukkit.inventory.ItemStack; (java.util.ArrayList is in module java.base of loader 'bootstrap'; [Lorg.bukkit.inventory.ItemStack; is in unnamed module of loader java.

quaint mantle
#

Gtg sleep wait for someone else to answer

silent slate
#

good night and thanks for all the help

echo basalt
#

bros working on an anticheat barely knows java

silent slate
#

thats a bug

echo basalt
#

a beginner one

quiet ice
#

ItemStack[] stacks = ((List) whatever).toArray(ItemStack[]::new);

silent slate
#

i was learning some code (trying to understand it) from another anticheat and its staying this ever since

#

im not even working on that anticheat rn

silent slate
quiet ice
#

I donno, read the stacktrace

#

probs line 42 and line 43 though

#

whatever would then be your storage.get(...) call

silent slate
#

now its a Object() though

#

and not a itemstack()

#

can i cast it to Itemstack like this?

#
ItemStack[] normalInventory = (ItemStack[]) ((List) storage.get(uuid + "." + world + "." + "normalinventory")).toArray(ItemStack[]::new);```
ivory sleet
#

No no no

#

Or actually yes

#

im just blind I reckon

silent slate
#

im too

#

too long at my monitor makes me blind