#help-development

1 messages · Page 698 of 1

smoky oak
#

is it included now or something?

eternal oxide
#

yeah, you don;t need to specify javadoc dependencies

tender shard
#

if you want to keep the javadoc thing for whatever reason, then use spigot-api

#

spigot doesnt have javadocs

eternal oxide
#

javadocs are API only

smoky oak
#

ah

#

i just thought it screwed up the same way it did with the api

tender shard
#

it's not needed to add the javadocs, just do "Download sources" in IJ

#

but still, what do you even need CraftBukkit classes for?

smoky oak
#

i just wanted to know if it'd be available if i needed it

#

i once again forgor to register the event listener

#

cuz I'm insisting on separating them out

upper hazel
#

how to allow breaking only certain blocks

tender shard
#

no clue what that is

#

is that a command executor? a listener? your onEnable() ?

upper hazel
#

createRegion

#

metod

#

worldguard api

orchid trout
#

cancel block break event when you dont want the block being broken?

#

cant you check what region it is with worldguard

upper hazel
#

I create a region and I want blocks to not break in this region, but not all

#

to break those blocks that are in the List

#

allow

#

to break

tender shard
#

then listen to BlockBreakEvent, check if the block is inside your region (I'd create a separate worldguard flag for that, instead of hardcoding one region), and then if it's inside your region, check your list?

upper hazel
#

Is it possible to change flag parameters?

#

flag parameters cannot be changed?

tender shard
#

StringFlags

upper hazel
#

a

half bane
#

what should I use instead of PlayerEditBookEvent.getSlot()? getSlot() is deprecated but I really need to get the ItemStack or the slot

abstract spindle
#

If I want to register a FurnaceRecipe I have the option between RecipeChoice.ExactChoice and RecipeChoice.MaterialChoice is there a way to register it where it only checks the Type and the CustomModelData ?

tender shard
#

it says it's because it might have been from offhand but offhand hsould return -1

#

it's deprecated since 1.13.1, so very unlikely that it gets removed now

#

it was deprecated in the same commit that actually added offhand support lol

#

I'll open a jira issue

smoky oak
#

can someone explain why setting the cooldown of a material doesnt prevent me from using it -.-
I'm setting the shield cooldown but the player keeps the shield raised, and theres no method in the api to lower a player's shield far as i can tell

#

searching for shield is 0 results

dire marsh
#

Client-side issue, paper has clearactiveitem which can fix that I believe

smoky oak
#

?whereami

smoky oak
#

it needs to work in spigot

dire marsh
#

ok

#

have fun then

smoky oak
#

hm

#

is there a stash of paper's patched server file anywhere?

#

I'm trying to look at the method

dire marsh
#

use plib and send the metadata packet with the active item field

spare hazel
#
 if(blockManager.getBlock(block.getType()) >= account.getLevel()){
            account.setXp(account.getXp() + blockManager.getBlock(block.getType()));
            new RegeneratingBlock(block.getType(), block.getLocation()).runTaskLater(SkyMineCore.getInstance(), 400L);
            if(account.calculateRankup()){
                player.sendTitle(SkyMineCore.getInstance().getTextManager().getText("account.levelup"), null, 30, 200, 70);
                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "eco give " + player.getName() + " 50000");
            }
        }else{
            e.setCancelled(true);
            player.sendMessage(SkyMineCore.getInstance().getTextManager().getText("block.error.lowlevel"));
            return;
        }```

why cant the player Mine Stone Which Needs Level 1 When He Is Level 2?
#

oh wait

#

im so dumb

#

i know

#

i should create a RegeneratingBlockManager Class

#

and asign each block a offTime or something

#

each 10s i remove 1 offtime from all of them

upper hazel
#

can i make an exception for certain blocks? How

#

i try create regions

#

but need allow break blocks in this list

smoky oak
#

iirc handle was part of spigot wasnt it?

#

yea i aint figuring this out

grizzled oasis
solar jungle
#

HI!! I'm seeking assistance to implement a feature on my Minecraft server. What I aim to achieve is sending a warning message to players attempting to join the server with versions earlier than 1.16.5.

cobalt thorn
#

There are examples there

solar jungle
#

But I want to create my own plugin for this.

cobalt thorn
solar jungle
#

No

cobalt thorn
#

What are you using

solar jungle
#

I'm just using my plugin, and that's it

cobalt thorn
#

Player cannot join in older version or newer

#

Only in the spigot version

solar jungle
#

Yes, but now I'm going to add ViaVersion. However, I want to get the code first, and then I'll add the ViaVersion plugin.

remote swallow
#

via version is open source

young knoll
#

It also has an api to check the players version

cobalt thorn
solar jungle
cobalt thorn
solar jungle
#

So, ViaVersion is needed, right?

cobalt thorn
#

Via.getAPI().getPlayerVersion(player)

#

This is how you get it call it when the player is login

solar jungle
#

ViaVersion shows up in red for me.

cobalt thorn
spare hazel
#
@EventHandler
    public void onBlockDropItem(BlockDropItemEvent e){
        if(e.isCancelled()) return;
        
        if(e.getItems().get(0).getItemStack().getType() == Material.ANCIENT_DEBRIS){
            e.getItems().get(0).getItemStack().setType(Material.NETHERITE_INGOT);
        }
    }``` guys will this work? _no i wont try it and see bcz i only have 4GB ram and i cant have 4 things open at the same time_
undone axleBOT
spare hazel
#

😐

solar jungle
#

Via.getAPI().getPlayerVersion(player)

cobalt thorn
solar jungle
cobalt thorn
gilded granite
#

how i can add fake players in tab with nms?

solar jungle
cobalt thorn
solar jungle
cobalt thorn
#

And plus

solar jungle
cobalt thorn
#

?learnjava

undone axleBOT
sterile token
#

Which one returns the value if it already exists the key, or in case it doesnt exists create it, to then return the value?? Im dougthing btween computeIfAbsent() or putIfAbsent()

cobalt thorn
# solar jungle Yes

I recommend you to learn about java and maven too so you don’t have problems

sterile token
#

oh right, really thanks morice

solar jungle
sterile token
cobalt thorn
undone axleBOT
sterile token
sterile token
cobalt thorn
sterile token
#

oh perfect, its exactly what i expected. But i was getting an NPE, will see it. Maybe the NPE is caused inside the cooldown itself

#

Soryr for tagging also, and again thanks

cobalt thorn
solar jungle
sterile token
solar jungle
sterile token
#

But also why trying to create your own via version? There is no need to reinveint the wheel when it was alreadt invented

cobalt thorn
sterile token
#

I will check into the tab api i have, which get the version from the client

cobalt thorn
#

I sent even an example

sterile token
#

he?

cobalt thorn
sterile token
#

You cant get user version without libraries? Such as protocol lib or via version

cobalt thorn
sterile token
#

oh

cobalt thorn
tender shard
#

it always uses the lowest priority goal that returns true for canUse()

sterile token
#

You can use Random class*

#

what? I didnt catch what you mean with that

tender shard
#

you could just one wrapper goal that then randomly runs one, sometimes th eother goal

sterile token
gilded granite
#

how do i add fake players to the scorebord?

sterile token
gilded granite
#

in the tab yes

sterile token
#

scoreboard != tablist, different things

#

Scoreboard is the one on the right of screen

#

Yeah, best option is to use ProtocolLib because messing without its a disaster and you will lost much time

lilac dagger
#

to be honest, i find it much easier without it

tender shard
#

Same

#

ProtocolLib is much more complicated and messy than the NMS packet constructors

sturdy heron
#

Best option is packetevents

slender elbow
#

eh

near mason
#

naah

#

ProtocolLib is hard

#

without wrappers

#

and i think wrapper is outdated

gilded granite
#

I use nms for packets

#

but idk which packet is it

#

?

#

Im using mojang mappings breh

slender elbow
#

I mean, if you're using nms just see how vanilla/craftbukkit does it?

lost matrix
bleak nacelle
#

can anyone help me setup my plugin i cant update maven i got an error

lost matrix
#

send it

bleak nacelle
#

im using eclipse

lost matrix
#

My guy, this project looks absolutely bombed

bleak nacelle
#

its actually working

#

i just cant import it to eclipse

tender shard
#

Ah yes, eclipse and maven

#

Always fun

bleak nacelle
#

this is the working plugin

lost matrix
#

Und run mvn clean as well before compiling

#

Btw how do you compile?

eternal oxide
#

um, thats not a maven project imported

#

looks more like you decompiled a jar

lost matrix
#

*building artifacts incoming

bleak nacelle
scenic onyx
bleak nacelle
#

yes

tender shard
#

Lol

#

Have you tried extracting it indtead

lost matrix
#

How about you extract this zip and open the resulting folder as project.
No wonder the compiler cant create a folder inside your zip file project...

bleak nacelle
#

eclipse has option for importing zip file i used it

#

ill try manually copying the folder

lost matrix
#

You also have meta-inf files. Are you sure that this is a project and not decompiled garbage?

tender shard
#

Blame epic

bleak nacelle
tender shard
#

Didnt epic send you the source or a github repo link

bleak nacelle
tender shard
#

@remote swallow send source

bleak nacelle
#

i dont think its needed since i can already decompile it

tender shard
#

And then?

#

You create the pom yourself?

bleak nacelle
#

no its in meta inf folder

tender shard
#

Well ok

lost matrix
#

Have fun recompiling this into a jar.
Editing an already compiled jar file is a really bad idea and will lead to problems.

bleak nacelle
eternal oxide
#

decompiling is always a last resort

lost matrix
#

Thats not really the source code. This is what your decompiler thinks the source code could have looked like.

tender shard
#

decompiled code is like if you get a cake and try to turn it back into flour, sugar and eggs

#

the compiler is the blender and oven

#

and I'm the cook

sterile token
#

Eclipse 💀

icy beacon
eternal oxide
#

Eclipse bestest IDE evar!!!

bleak nacelle
quiet ice
#

Can affirm

sterile token
lost matrix
quiet ice
eternal oxide
#

I like old 🙂

quiet ice
#

Cannot even have more than one project open in a single window

#

What is this? An IDE from 1995?

lost matrix
#

Ive also started with eclipse. Its fine.

sterile token
#

i mean is not issue if people like to broke their header using a nasty, outded and 2.000s IDE

bleak nacelle
#

im switching to codeblocks

#

maybe it will work

lost matrix
bleak nacelle
#

oh it doesnt support java

quiet ice
#

We had another person that was adamant about using VI for java ... although A) it was a troll and B) it was ages ago

sterile token
#

i mean eclipse for starting is well not that bad, fbut for huge projects forget about it. It takes ages to compile Maven, its a mess to install maven with it, etc

eternal oxide
#

Its better for large projects. Smaller memory footprint

quiet ice
#

Eclipse's only weakness is kotlin gradle

#

I feel like you used Eclipse for Java EE

eternal oxide
#

Yeah I can;t comment on Kotlin/Gradle, I don;t use them

lost matrix
quiet ice
#

That one does not come with Maven attached.

bleak nacelle
#

can i code in kotlin with eclipse?

sterile token
# lost matrix Why?

Imagine installing an IDE and having to install compiling tools apart, doesnt make sense haha

eternal oxide
#

For java you don;t have to install anythgin in Eclipse

lost matrix
quiet ice
lost matrix
#

XD

quiet ice
tender shard
#

but on windows you indeed cannot

quiet ice
#

wut. what is that of an arbitrary limitation

lost matrix
eternal oxide
#

This would be a nightmare forIJ

bleak nacelle
#

i need name changer plugin which changes tab list name and name above head also in chat name can pay 20$ it already has some things done https://ufile.io/y1i12xpu

sterile token
#

Also why ppl till using build tools? When there are public repos which they already have artifacts up. And in remote!!

tender shard
#

IJ mac supports different projects in one window but they're split up into tabs

lost matrix
tender shard
eternal oxide
tender shard
eternal oxide
sterile token
eternal oxide
tender shard
lost matrix
eternal night
lost matrix
#

right?

smoky oak
#

I'm trying to get around that shield glitch where its apparantly not possible to manually disable it. I've been told to use https://wiki.vg/Entity_metadata#Living_Entity this packet, but can't seem to find much information on doing the protocol manually or protocollib.
Same person mentioned that https://github.com/PaperMC/Paper/blob/master/patches/server/0494-Add-LivingEntity-clearActiveItem.patch its fixed like this in paper, so I tried looking at the paper code, but if i throw the paper.jar into a decompiler it just spits out a list of patches.
Any ideas? I've been stuck for a while now

eternal night
willow yacht
#

What is the best way to pathfind for an arrow to reach a player?

shell robin
#

Can anyone help with WorldGuardAPI knowledge? How do I check if the area where the player is walking is included in the region?

eternal night
#

indeed we don't redistribute jars containing copyrighted mojang work NODDERS

#

codemc is a giant repo a shit load of people that did not make it into maven central can host their stuff in

tender shard
#

But literally everyone can upload to central

icy beacon
quiet ice
#

I should start uploading my plugins to central one of these days

eternal night
#

Yea, but that means you gotta upload content not breaking copyright protections

tender shard
#

Ah thats what you mean lol

lost matrix
eternal night
#

they also come with a public jenkins instance

#

so like

quiet ice
eternal night
#

so like, jitpack

sterile token
#

why microsoft would care if people publish their compiled sources. Why didnt they oblise all the devs containing to delete it from their OS? I always asked that to myself

#

Why they appeared public first of all, if they were protected by right licenses

tender shard
icy beacon
eternal night
quiet ice
tender shard
eternal night
#

smh, generating keys lol

#

a difficult operation

quiet ice
#

But it is still straightforward (at least under maven, didn't yet do it under gradle) - yes.

tender shard
#

Actually… someone who cant create a gpg key probably isnt able to write any useful dependency anyway lol

sterile token
lost matrix
quiet ice
#

And if you don't have gpg.skip set to true in the pom it can get difficult for others to work with your project

shell robin
tender shard
quiet ice
#

So if you want to do stuff properly it isn't completely straightforward

lost matrix
sterile token
eternal night
#

what do you mean why

sterile token
eternal night
#

filtered ?

sterile token
#

or leaked /published same thing

eternal night
#

I mean, they are leaked because mojang has to ?

#

how are you going to run a server

#

they permit you the right to have a copy of their work

shell robin
eternal night
#

you just aren't allowed to redistribute

sterile token
shell robin
eternal night
lost matrix
# shell robin Yes but I think it's been answered 😅
Player player = ...;
// Get global region container
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
// Get all regions which are applicable on a specific location
Location loc = player.getLocation();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(loc);
#

Too late. Here comes the spoon 🥄

eternal night
#

they explicitly do not allow redistribution

sterile token
eternal night
lost matrix
smoky oak
icy beacon
eternal night
#

they have the ability to provide a public jar and still prevent you from redistributing

shell robin
icy beacon
#

if I leave my phone in a cafe, you can steal it because now it's in public, but laws say you can't

#

is it stupid?

bleak nacelle
#

i need name changer plugin which changes tab list name and name above head also in chat name can pay 20$ it already has some things done https://ufile.io/y1i12xpu

tender shard
#

?services

undone axleBOT
lost matrix
smoky oak
#

so do i put a 7 in there? or a n where n is the number of previous existing bytes

sterile token
#

But in theory you cant be punished for redistributing something that is already public, do i explain my point?

tender shard
lost matrix
icy beacon
#

laws enforce that you can't

lost matrix
#

Let me show you an example

icy beacon
#

and in the case of a public project, the license is part of the enforcement

lilac dagger
lost matrix
# smoky oak cuz i know neither
  private PacketContainer createDataPacket() {
    // Create the metadata packet
    PacketType type = PacketType.Play.Server.ENTITY_METADATA;
    PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(type);

    // Insert fake entity ID
    packet.getIntegers().write(0, this.entityId);

    // Get the serializers for each data type i want to write
    WrappedDataWatcher.Serializer byteSerializer = WrappedDataWatcher.Registry.get(Byte.class);
    WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
    WrappedDataWatcher.Serializer boolSerializer = WrappedDataWatcher.Registry.get(Boolean.class);

    // Create a list which will contain the data values
    List<WrappedDataValue> dataValues = new ArrayList<>();

    // Add data to the data value list using wrapped values which contain an index and the serialized data
    Byte flags = 0x20;
    dataValues.add(new WrappedDataValue(0, byteSerializer, flags));

    Optional<?> optChat = Optional.of(WrappedChatComponent.fromChatMessage(this.text.replace("&", "§"))[0].getHandle());
    dataValues.add(new WrappedDataValue(2, chatSerializer, optChat));

    Boolean nameVisible = true;
    dataValues.add(new WrappedDataValue(3, boolSerializer, nameVisible));

    Byte armorStandTypeFlags = 0x10;
    dataValues.add(new WrappedDataValue(15, byteSerializer, armorStandTypeFlags));

    // Write the wrapped data value list into the packet
    packet.getDataValueCollectionModifier().write(0, dataValues);

    // done
    return packet;
  }
lost matrix
#

Nope

smoky oak
#

looks like protocollib

#

and the conversation was about that sooo

sterile token
#

Yeah i was going to ask if was ProtocolLib or a custom lib

lost matrix
#

This is how the nms impl looks like

  private ClientboundSetEntityDataPacket createDataPacket() {
    SynchedEntityData data = nmsArmorStandBackbone.getEntityData();
    return new ClientboundSetEntityDataPacket(nmsArmorStandBackbone.getId(), Objects.requireNonNull(data.getNonDefaultValues()));
  }
smoky oak
#

that looks worse lol

lost matrix
#

You literally just pass your armorstand to the packet. Done.
I think this is easier.

tender shard
slender elbow
smoky oak
#

well considering that code allows me to use protocollib and i still have no clue how to do nms :/

smoky oak
#

also its a player im resetting, not an armorstand

slender elbow
#

generally you should be using flags instead

kindred sentinel
#

How to make tab complete like this?

#

<message>

smoky oak
#

implements tabCompleter gives you a method that returns the list of stuff thats shown there

tender shard
slender elbow
#

bleh

#

"configure your regions correctly" - close as not completed, label as question 😛

kindred sentinel
#
  • the color of argument yellow
smoky oak
#

oh idk then sorry

tender shard
#

Or any command framework that supports brigadier

kindred sentinel
#

oh ok thx

#

is there any way to disable minecraft command?

tender shard
#

Dont give permissions for it

kindred sentinel
#

andd is there any way to change minecraft command? Like change simple /me

tidal kettle
#

?paste

undone axleBOT
tidal kettle
lost matrix
tidal kettle
#

??

quaint mantle
#

Or Kits

#

Or smth

#

Main is too ambiguous

tidal kettle
quaint mantle
#

Because Main does not mean anything

tidal kettle
#

I'll take your advice

remote swallow
#

Why do i have 3 pings here

lost matrix
remote swallow
#

Same person i updated a plugin for earlier

remote swallow
tender shard
#

naming the field main is fine, it's private anyway

remote swallow
#

I didnt write it lol

#

I just decompiled the outdated plugin and changed the nms

#

That's why it looks and is so horrid

smoky oak
# lost matrix ```java private PacketContainer createDataPacket() { // Create the metadat...

can i ask for some more help? I'm doing this

initPacket(PacketType.Play.Server.ENTITY_METADATA); //this being an init method
packet.getIntegers().write(0,player.getEntityId());
addValue(8,Byte.class,(byte)0);//this being a helper method

and then send it to the player hit and the players observing said player, but apparantly its not doing anything?
Shouldn't telling a player 'ur not doing anything with your hand' make them lower the shield?

#

theres not even a console error

#

and im running on log = all

tender shard
#

is Server the same as Clientbound?

smoky oak
#

uh good question

lost matrix
#

Clientbound -> bound for client / sending to client

smoky oak
#

no, but there's no entity_metadata apparantly

ivory sleet
#

<Receiver>Bound<PacketName>Packet :)

#

thats how I remember it

tender shard
#

yeah but IIRC protocollib does it the other way around

#

thats why I asked

ivory sleet
#

haha thats so troll

sterile token
tender shard
tender shard
ivory sleet
tender shard
#

agree

lost matrix
smoky oak
#

so you're saying it didnt actually hit the player, or you saying I've been deleting metadata accidentally?

lost matrix
#

Your metadata packet is probably so ridiculously invalid that the client just ignored it.

kindred sentinel
#

Do people create local chat using

for(Player player : Bukkit.getOnlinePlayers()){
    Location playerLoc = player.getLocation();
                        if(playerLoc.distance(sender.getLocation()) <= chatRadius){
                            player.sendMessage(message);
                        }
}
```?
worldly ingot
#

The recipients list of the chat event can be altered, although I'm unsure if that's still the case in modern versions with chat signing

#

Also, distanceSquared() > distance() to avoid a square root operation

river oracle
#

not a big fan of square root choco?

worldly ingot
#

It's just unnecessary and not fast

river oracle
#

personally I think its fun to make those crazy ass numbers

river oracle
ivory sleet
#

well we arent much better

worldly ingot
#

Just square root computations because there aren't any specific instructions on it on most architectures

kindred sentinel
worldly ingot
#

I mean you can try it. It may work

#

If not, then yes your only option is to do what you proposed

river oracle
kindred sentinel
#

I'm not sure that i can understand what you meant

ivory sleet
livid dove
lost matrix
lost matrix
river oracle
lost matrix
#

You cant dump the messages this way

river oracle
#

why would you want to dump them though?

#

ig if you want true local chat history

lost matrix
#

And you would really want to read 50 messages you had nothing to do with, dont you?

valid burrow
#

i keep getting this error for too many chas in a prefix but how is this "§4§l[Owner] §4" more then 16 chas

#

am i just dumb

#

am i missing something

tender shard
worldly ingot
#

You're assuming modern CPUs

tender shard
#

Yeah well i think modern is like last 15 years or so

#

I only tried on my i7 9700k and m2 max so yeah no clue about otherd

livid dove
# lost matrix Pretty neat

Next job is an inventory menu with a central activate button and 8 surrounding icons that cycle through X symbols (one cycle per click) to do adresses to other portals :L

tender shard
#

imho using distanceSquared is unncessary especially for the chat

livid dove
#

imho distance squared not mattering in the modern day and age is fair, but it doesnt hurt when we're dealing with a single threaded duct tape machine that we call a game.

Every little helps as they say in tesco lol

#

i.e. if someone signs off their letter with a curly fancy f rather than a normal f, then who the hell is gonna complain its "unnesecary" ? lol

#

Its like when folk go OTT with the "Enterprise code" issues.

Once had a guy get upset because I javadoc'd one of my plugins fully

#

Like, my brother in code, I decided to add a little extra effort in, why are you mad xD

ivory sleet
#

what version ru on

valid burrow
#

i know that 1.8 limits characters

#

BUT THERE IS NOTHING THATS 30 CHARACTERS LONG

#

LIKE

livid dove
#

Someone do the funny how old is 1.8 comman d

young knoll
#

In this video we will take an in depth look at the fast inverse square root and see where the mysterious number 0x5f3759df comes from. This algorithm became famous after id Software open sourced the engine for Quake III. On the way we will also learn about floating point numbers and newton's method.

0:00 Introduction
1:23 Why Care?
3:21 The Cod...

▶ Play video
valid burrow
#

it says theres something 30 characters long and i have no idea where

#

like

#

it doesnt exist

kind hatch
#

Don't use 1.8 ¯_(ツ)_/¯

#

Those limits were removed in later versions.

valid burrow
#

i know

#

i like the new versions too

tender shard
valid burrow
#

but i also like 1.8 pvp and i like making plugins for that too x)

tender shard
valid burrow
#

where does the data for the teams get saved

#

is there a way i can delete all existing teams

tender shard
#

I'll just run JMH and check whether distanceSquared is actually faster. Should take 33 minutes

valid burrow
#

i think that might be causing the problem that theres still a team existing with too many chas

wild mica
river oracle
tender shard
#

isn't that kinda a genius way to turn coordinates into country?

#

it just uses a grayscale image and then uses that to get the correct country

wild mica
tender shard
#

AnaloguePowered

#

i think

#

or Powerable? sth like that

tender shard
#

yeah Powerable are the "end consumers" of redstone, AnaloguePowerable are the wires etc (things that don't just have yes/no power, but a value between 0-15)

lost matrix
river oracle
#

I did one the other day that took an hour and a half

quiet ice
#

I mean that is the idea

river oracle
#

ik I just didn't expect them to take that long

#

I thuoght maybe like a couple mins per not basically 10 or more minutes per

wild mica
river oracle
#

PlayerInteractEvent Plus Material check?

#

you don't even need block data for that

wild mica
#

Yes, but I want to control the redstone materials it can interact with.

tender shard
lost matrix
#

Already on it 😄

tender shard
#

how does your code look like though? we should be using the same i guess

lost matrix
#

Different testing methods might be more beneficial

valid burrow
#

how can i get the team a player is in

lost matrix
#

Ah ok so you get the invocation time per 1k and i the throughput

tender shard
#

yeah I thought maybe it's easier for JMH if the method takes longer than 0.0000000000001 second lol

lost matrix
#

But my result look pretty conclusive currently...

tender shard
#
Benchmark                         Mode  Cnt     Score    Error  Units
DistanceTest.testDistance         avgt   25  1645,770 ±  4,010  ns/op
DistanceTest.testDistanceSquared  avgt   25  1635,375 ± 11,381  ns/op

#

exactly the same

#

well almost

lost matrix
#

i would be sceptical on this one

tender shard
#

why?

lost matrix
#

Increase the number of positions and change the setup level to @Setup(Level.Iteration)
You are burning the same numbers into the cpu cache.

tender shard
#

the number of positions?

lost matrix
#

Yes, and change the positions every iteration

tender shard
#

it does that

lost matrix
#
Benchmark                          Mode  Cnt    Score    Error   Units
DistanceOverhead.distance         thrpt   10  471,200 ±  5,791  ops/us
DistanceOverhead.distanceSquared  thrpt   10  582,115 ± 10,796  ops/us

But for me it comes down to very similar results.
Squared is only slightly slower.

#

I mean still ~20% slower

tender shard
#

squared is slower?

lost matrix
#

Yes 20%

#

Wait

#

Huh?

#

Ok this needs a more intricate benchmark. brb

worldly ingot
#

That's literally impossible KEKW

#

distance() calls distanceSquared()

#

Unless you wrote your own impl

lost matrix
#

Well we had a more low level impl. Maybe there is some cpu magic that detected a vector distance calculation
and uses some specialized instructions for that. But now im curious.

tender shard
#

I'll now run it again with @Setup(Level.Invocation), so caches cannot have any impact anymore

lost matrix
#

Ill do two tests. One with volatile primitives

tender shard
#

here's my updated version that, like spigot, just takes the return value of distanceSquared and throws it into Math.sqrt https://github.com/mfnalex/Bench-DistanceSquared/blob/main/src/jmh/java/test/DistanceTest.java
It also creates new random doubles for each single iteration (so a loooooot of times)
and it also compares distanceSquared and distanceSquaredStandalone (which doesn't use a "nested" method)

GitHub

Contribute to mfnalex/Bench-DistanceSquared development by creating an account on GitHub.

lost matrix
#

Be careful with Invocation levels. Only makes sense if your tests last beyond 1ms

bleak nacelle
#

Is it possible in minecraft spigot to simulate ball moving?

#

like when looking from the sky

#

it will look like football is moving

#

20 ticks per second

lost matrix
livid dove
# tender shard here's my updated version that, like spigot, just takes the return value of dist...

Or hear me out, it won't make a difference so it doesnt matter? Maybe some people dont wanna work with squared roots as they are stinky to debug? Maybe some people hate using the Math methods or maybe I they are just scared of Squares (and, like cultured developers, love hexegons and the humble octogon more).

We have 2.4 billion seconds in an average life time, use em to make cool stuff rather than prove a point that , in the grand scheme of things, doesnt make a difference eitehr way :L

slender elbow
kind hatch
lost matrix
#

Facepalm

slender elbow
#

i mean that's still a good measure

#

just take the inverse :kappa:

livid dove
#

But was the measure squared?

#

lel

tender shard
#

for me it was basically equally fast

#

1645 vs 1635

livid dove
#

Excelent

#

job done

#

its fine

tender shard
#

let us be, it's interesting

lost matrix
tender shard
#

maybe it's m2 max magic

#

I'm running it again with Setup set to Iteration

livid dove
#

How about a compromise. If you carry on with it @lost matrix has to make a new thread guide on the topic 😉

tender shard
#

that's ok

livid dove
#

Well volunteered smile

lost matrix
#

no?

livid dove
#

lol

#

Too late

lost matrix
#

Tha fk

livid dove
#

Mfnalex said no

#

*said yes

#

You are bound by ancient bukkit law

tender shard
#

yeah but I don't have anything to say here

lost matrix
livid dove
#

THE BEACONS HAVE BEEN LIT

tender shard
#

people only have to accept what I say if they're decent people and not imbecile plebs

livid dove
#

Ohhhh

#

so Smile can do what he likes then

#

😉

#

xD

tender shard
bleak nacelle
lost matrix
livid dove
#

YES NEW THREAD HERE WE GO

#

Give Mfnalex credits in it 😉

tender shard
#

because that is the definition of imbecile

#

i really stopped hating gradle but the kotlin-dsl thingy is really bugged in intellij

lost matrix
#

You are doing that, dont you...

tender shard
lost matrix
#

Ok i dont think this makes sense with the average time setup

Benchmark                         (numberOfElements)  Mode  Cnt    Score    Error  Units
DistanceOverhead.distance                      50000  avgt   10  230,759 ± 15,473  us/op
DistanceOverhead.distanceSquared               50000  avgt   10  238,201 ± 19,281  us/op
tender shard
livid dove
valid burrow
#

okay maybe something else is wrong here i cant even connect when i delete every single plugin from the server it still trows that error what else could it be

livid dove
#

There is an over 10000 overlap

lost matrix
#

How is this your full build.gradle file?

quiet ice
#

the buildSrc folder?

lost matrix
valid burrow
#

i took down every plugin and it still trows that error

lost matrix
tender shard
valid burrow
#

what do i do at this point

#

pray?

lost matrix
valid burrow
#

i ran something that shouldve cleared all existing teams

#

where would that be stored? can i manually delte it from a world file or somethng?

#

cause its getting really annoying

#

finally

#

i found it

#

incanse anyone ever needs to

#

its located in data/scoreboard.dat

tender shard
#

?paste

undone axleBOT
tender shard
#

as expected, distance is the slowest, but distanceStandalone is only a tiny bit faster than squared

#

so that means, the most significant overhead isn't Math.sqrt but actually the nested method call lmao

#

@worldly ingot isn't that funny

slender elbow
#

choco is funny sometimes yeah

#

virtual dispatch bad

#

/jk 🤓

tender shard
#

choco should change his name to chicken

slender elbow
#

McFly

tender shard
#

1.21 gigawatts

lost matrix
tender shard
#

Yeah distanceSquared is overrated

#

At least today

#

Would be interesting to run this in kvm with as little passed through cpu flags as possible

quiet ice
#

That being said people must not ignore the fact that performance is stacking. A bit of slow code on it's own isn't bad but when it is bundled with other slow code it actually gets slow

tender shard
#

Yeah but normally you dont run it millions of times per second if you only use it to code a local chat plugin

lost matrix
#

True. But we are speaking about millions of invocations per tick here before a noticable difference can be seen.

tender shard
#

How to waste time 101

quiet ice
#

I mean given that we are only working with primitives there is no serious performance impact

tender shard
quiet ice
#

Primitives are really really fast

#

Objects are fucking slow

tender shard
#

My neighbour is pretty primitive and he‘s quite slow

#

His name is Marvin

quiet ice
#

You should go to bed, it's after midnight

tender shard
#

I'm doing the uberman sleep schedule

worldly ingot
#

JUST USE DISTANCESQUARED. SAVE YOURSELF A CLOCK CYCLE aPES_MadTyper

lost matrix
#

For some reason i sometimes actually fall into a triphasic sleep schedule while being in my semester break

tender shard
#

yeah I also have that, since years now. I sleep like 4-8am, then again 2 hours in the afternoon and again like 1-2 hours in the evening lol

#

but not on purpose

lost matrix
#

Im so glad that my responsibilities are at a minimum for a month. I can just do whatever until i pass out 🙂

tender shard
#

during my worst drinking phases I always fell asleep at random places like at the computer or in the bathtub lol

lost matrix
tender shard
#

a friend of mine once wanted to go like 3 stations by train and woke up in berlin (he lived in NRW)

lost matrix
#

XDD

tender shard
#

yeah that never happened to me

lost matrix
#

Same. And im in the middle of munich so a ride could take me pretty far if i wasnt careful.

worldly ingot
#

but muh precious clock cycles

#

I've been C++ing too much lately

tender shard
#

we can make a deal. a compromise

class Location {
  // Protects Choco's precious clock cycles and mfnalex cannot complain about readability anymore
  public boolean isDistanceLessThan(Location other, double distance) {
    return distanceSquared(other) < distance*distance;
  }
}```
lost matrix
candid galleon
#

branchless programming does exist

river oracle
lost matrix
#

Thats what he was on about, right. Branchless programming

tender shard
#

did somebody mention crack

candid galleon
#

basic arithmetic

lost matrix
#

no, bad alex

candid galleon
#

it's generally not worth using unless you know what you're doing

worldly ingot
#

I mean jumps do use quite a few clock cycles 👀

candid galleon
#

that vid helped me learn about it

lost matrix
#

It makes the code so fking painful to read as well

worldly ingot
#

but yeah, unless you're writing software in the 1960s and trying to send something to the moon, you don't have to follow that technique lol

tender shard
candid galleon
#

if you're coding in java you shouldn't be worrying about that kind of optimization

#

brooooo why can't we use external emojis

river oracle
#

you can if you boost

quiet ice
worldly ingot
candid galleon
#

have yall seen the java programmer that tried out python

river oracle
quiet ice
#

Given that the CPU attempts to predict the branch the code uses. If it doesn't guess correctly it may have to wait

lost matrix
tender shard
candid galleon
#

only 31 lines

#

:poggies:

tender shard
#

it has more config options than actual lines of source code lol

candid galleon
#

should just import *

lost matrix
tender shard
candid galleon
#

i've been coding wrong my entire life! all those lines wasted

lost matrix
#

We should host some coding challenges here in spigot 🙂

tender shard
#

yeah

#

but with a caveat

river oracle
#

Coding Challenge write a basic plugin and following OOP correctly

candid galleon
#

99% of people fail!

kind hatch
#

(IMPOSSIBLE)

tender shard
candid galleon
#

but my singleton :madge:

river oracle
tender shard
lost matrix
#

Be prepared for a 4h discussion between some of us what correct OOP impl looks like.
There is no crown truth to this.

river oracle
kind hatch
lost matrix
tender shard
#

proper oop is making everything static and then claiming "yeah well but it's not an object because objects isv § 90 BGB are only körperliche gegenstände"

tender shard
#

Civil Code (BGB)
Section 90 Concept of the thing

Things within the meaning of the law are only physical objects.

#

bad translation

#

basically it says " a computer program is not a thing because you cannot touch it"

river oracle
#

I see

tender shard
#

same like water, unless it's physically "contained" within a container like a glass

candid galleon
#

What did one interface say to the other?

"Let's keep in touch, but don't call me, I'll call you."
#

How do you compliment an OOP programmer?

Tell them they have class.
lost matrix
#

The challenge should be a plugin which allows player eine Anzeige nach StGB § 223 Körperverletzung, if he attacks you.

tender shard
#

dude, nobody wants your puns. git out. or I'll commit a murder

#

damn I missed the opportunity to include "pushing" it too far, too

candid galleon
#

you're really pushing it

tender shard
#

yeah realized it after I sent it

#

so everyone what are we throwing into JMH now?

#

String.contains vs iterating over the chars?

river oracle
#

Sure why not

tender shard
#

super async chat filter

lost matrix
#

Show the overhead of ConcurrentHashMap in a single threaded environment

#

Actually... i wanna know this myself. brb

river oracle
#

I'm in the mood to write some stupid ass java code right now

#

lets see what Hell I can conjure up

glad prawn
#

Mood drops after 5 minutes of coding

river oracle
undone axleBOT
tender shard
lost matrix
#

Tha fk. How many cycles do you test for?

#

Ah you have a ton of methods

tender shard
#

yeah put, get, remove, contains

#

1000 elements each

lost matrix
#

Well, get remove contains are pretty much equivalent, no?

#

For tables

tender shard
#

probably, yeah. we'll see

lost matrix
#
Benchmark                                    (numberOfElements)  Mode  Cnt  Score   Error  Units
ConcurrentMapOverhead.containsConcurrentMap                 500  avgt    5  7,995 ± 0,121  ns/op
ConcurrentMapOverhead.containsConcurrentMap                5000  avgt    5  7,883 ± 0,029  ns/op
ConcurrentMapOverhead.containsConcurrentMap               50000  avgt    5  8,202 ± 0,250  ns/op
ConcurrentMapOverhead.containsMap                           500  avgt    5  7,430 ± 0,185  ns/op
ConcurrentMapOverhead.containsMap                          5000  avgt    5  5,999 ± 0,115  ns/op
ConcurrentMapOverhead.containsMap                         50000  avgt    5  8,092 ± 0,099  ns/op
tender shard
#

huh it's slower for 500 than for 5000

lost matrix
#

Yes. But im only testing a single key. Let me also iterate over all keys like you do.

tender shard
#

imagine jvm pulling a volkswagen and goes into turbo mode when it detects a benchmark

lost matrix
#

XDDD

tender shard
#

JIT compiler: "contains? sure, return true, it's probably there"

lost matrix
#

Quick, compile everything to binaries and use a GraalVM, he is doing a benchmark

tender shard
#

is it called Graal because of the holy grail?

lost matrix
#

no idea

tender shard
#

i always have to think of indiana jones 3 when I hear "graalvm"

lost matrix
#

dude what

tender shard
#

have you not seen it?

#

he's looking for the holy grail but then nazis capture his father, sean connery

lost matrix
#

Was this the face melty ij?

tender shard
#

so then he only tries to find his father but to do he actually has to get the holy grail because his father was shot and only be healed through the grail

#

the nazis are stupid and choose the wrong grail (a shiny one) and then the main nazi dies

#

indiana jones is smart and chose the most ugly grail because jesus made it himself (and apparently he wasn't very good at making grails)

#

that's indiana jones 3

lost matrix
#
Benchmark                                    (numberOfElements)  Mode  Cnt    Score     Error  Units Normalized
ConcurrentMapOverhead.containsConcurrentMap                 500  avgt    5    4,199 ±   0,050  us/op      4,199
ConcurrentMapOverhead.containsConcurrentMap                5000  avgt    5   53,585 ±   9,624  us/op      5,358
ConcurrentMapOverhead.containsConcurrentMap               50000  avgt    5  830,219 ± 415,882  us/op      8,302
ConcurrentMapOverhead.containsMap                           500  avgt    5    4,129 ±   0,207  us/op      4,129
ConcurrentMapOverhead.containsMap                          5000  avgt    5   50,924 ±   2,807  us/op      5,094
ConcurrentMapOverhead.containsMap                         50000  avgt    5  831,605 ± 435,935  us/op      8,316

Here its scaled up

tender shard
tender shard
#

best scene

lost matrix
tender shard
#

lmao

#

and then someone steals the bad guy's sword

lost matrix
#

How is the benchmark going?

tender shard
#

1 min left

lost matrix
#

Yes. It runs a whole benchmark for each parameter

tender shard
#

ah nice

lost matrix
#
  @Param({"500", "5000", "50000"})
  private int numberOfElements;
tender shard
#

I gotta use that next time too

lost matrix
#

Its really nice if you need to plot the time complexity of a collection.
Simply increase the elements and you get nice plottable data

tender shard
lost matrix
#

You ran it for all modes?

tender shard
#

yes

#

check out remove / avgt time

#

the normal map is twice as fast

#

but the other things, the difference isnt that big

#
DistanceTest.remove_ConcurrentHashMap                                         avgt       8      2802,612 ±    60,472   ns/op
DistanceTest.remove_HashMap                                                   avgt       8      1469,560 ±   105,702   ns/op
round finch
lost matrix
round finch
#

10 + 0 = 10

10 = 10

#

seems pointless variable

tender shard
#

diCtiOnArY

lost matrix
#

stroke?

tender shard
#

Python user

lost matrix
#

Ah. Or js user as well, no?

tender shard
#

Not sure lol

#

I never did anything in js except changing some html stuff

lost matrix
#

be smart, stay apart PES_JesusChristAlt javascript

tender shard
#

You know what would be nice? If someone remade the old lucas arts adventure games like monkey island or manic mansion as mc adventure map

lost matrix
#

jedi knight, jedi academy 🙂

tender shard
#

Haven’t played those

lost matrix
tender shard
#

Is that available for scummvm

lost matrix
#

pardon?

tender shard
#

Is it a point and click adventure?

#

And is it 30 years old?

#

If yes, then yes its available for ScummVM

lost matrix
#

Yeah, its pretty much not

tender shard
#

I see

#

How dare you

lost matrix
#

But i almost started writing a deep rock galactic type of plugin for mc.

#

*on that note

quaint mantle
#

If I want to write a custom functionality for banning, should I make another class for that

#

like

#

new BanActionThing(args).issueOn(target);

gilded granite
#

is there any PlayerBanEvent?

lost matrix
# quaint mantle new BanActionThing(args).issueOn(target);

If you have to ask this question then there is a good chance you should create a ton of new classes.
Some could look like this:

  • BanManager
  • Ban
  • BanType
  • BanListener
  • BanCommand
    etc

But i would def not do

new BanActionThing(args).issueOn(target);

More like

OfflinePlayer player = ...;
Ban ban = new Ban("reason", BanType.TEMP, Duration.ofDays(7));
BanManager banManager = yourPlugin.getBanManager();
banManager.applyBan(player, ban);
quaint mantle
#

I was thinking about something like a

#

BanAction

glad prawn
quaint mantle
#

I might just like

#

hm idk

#

new BanScreen().showTo(Player)

#

lmfao

quaint mantle
#

I have my own little punishment system already

#

now im just making the "front-end" stuff

lost matrix
quaint mantle
#

yeah ig it is

lost matrix
#
new Something().call(somethingElse);

Creates a temporary object for no reason

quaint mantle
#

I also have this

#

I just like the more static typed things

#

instead of

#

getConig().getString("path.path.path")

lost matrix
#

Which is perfectly valid

quaint mantle
quaint mantle
#

I feel like it's just too prone to mistakes and stuff

round finch
#

or you could make ur code look nicer

lost matrix
#

No, i mean preferring staticly typed value access is perfectly valid

quaint mantle
#

oh

#

yay lol

worldly ingot
#

You could write constants for your strings instead

tender shard
worldly ingot
#

For common paths and values it's best to have them all in one place anyways

quaint mantle
#

no

round finch
quaint mantle
#

each one has their own implentation

tender shard
quaint mantle
#

Idk if this is bad or good I need opinions

lost matrix
round finch
quaint mantle
#

constants

#

which is an enum lmao

#

I've never done something like this before

round finch
#

my Ai pf has deepy eyes thb

quaint mantle
#

but it makes it so server owners can set their custom permissions

young knoll
#

Don’t smoke eyes

round finch
#

dont smoke using eyes

worldly ingot
# quaint mantle

Two questions

  1. Why doesn't your withPermission() method just accept a CommandPermissions instance?
  2. Why are you using an enum to begin with? You can use String constants so you don't have to call .getPermission() every time
quaint mantle
sweet kiln
#

Hello! I'm trying to spawn a mob called 'ALLAY' on 1.20.1. But I'm having problems, the problem is this. When I enter the server it spawns, only there comes a time when it stops spawning and not even restarting the server can work. Can anyone help me?

quiet ice
#

That array is funky

#

Ah because this isn't java

sweet kiln
quiet ice
#

The only thing I think may cause this is the fact it despawns but that still makes little sense

glad prawn
#

found

bold gorge
#

I know this isn't a very development issue but I think it would be best to post something like this here? idk shoot me if I'm wrong

What's the best way to advertise a spigotmc library?
I'm making a menus library named Woody and it has some very nice features a lot of libraries don't have (and more creative coming)

issue is advertising and I want to spread the library efficiently.
ping me when responding with some advice

coarse finch
#

hey! im working on a feature for an anticheat, where it tries to detect if someone is spoofing their client. here is my code: ```java
public boolean isLikelySpoofingBrand() {
final String brand = this.getBrand();
final String lunarClientRegex = "^lunarclient:v\d+\.\d+\.\d+-\d{4}$";

return (brand.equals("vanilla") && !this.isVanillaMath()) || // Vanilla doesn't have fast math
        (brand.matches(".*lunarclient.*") && !brand.matches(lunarClientRegex)); // Some clients spoof lunar incorrectly

}```im wondering if there is other methods to detect if someone is trying to spoof their client?

remote swallow
#

Add a config option too

#

Incase it isnt maintained but new popular clients exist

ivory sleet
#

Its rly hard to detect client spoofing tho

#

Cuz like, smart devs will make it unnoticeable

coarse finch
#

when someone joins, or you view their profile, it they are suspected for brand spoofing it says (likely spoofed)

coarse finch
#

like with fastmath

#

ive had lots of players on my server with a brand of vanilla, yet they are using fast math

#

or people with outrageously fake lunar brands

dark jolt
#

This is gonna sound stupid but for Command Execution the one thats not the main one should those be classes in stead of .java

hazy parrot
#

what

drowsy helm
#

huh

#

all your code will be .java until compiled

young knoll
#

Wtf is fast math and how does one even detect that

drowsy helm
#

and all of those files will have a class in it

dark jolt
coarse finch
young knoll
#

I see

quaint mantle
# worldly ingot Two questions 1. Why doesn't your `withPermission()` method just accept a `Comma...

Ok I have more time to explain now, so

  1. I'm using CommandAPI, an API that I did not make. Here's a link to the API: https://github.com/JorelAli/CommandAPI

  2. I wanted the String for the permission to be configurable, and I also have multiple groups of permissions. For example "CommandPermissions, PunishmentPermissions". And I want the server owner to be able to change the permissions. Another reason I didn't do that was because I didn't want to use reflection

GitHub

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13 - GitHub - JorelAli/CommandAPI: A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

candid galleon
#

Why do you want permissions to be configurable?

drowsy helm
#

yeah seems like a waste of time to make them configurable

#

thats something a permission system is supposed to do

opal carbon
slender elbow
#

fast math still exists? lol

opal carbon
#

also i dont think thats even a good check

#

iirc optifine reports as vanilla

coarse finch
coarse finch
opal carbon
coarse finch
# opal carbon who lol

Well for one, badlion automatically enables it, and second, people who don't know what they're doing

opal carbon
#

wow badlion is wierd

marsh crater
#

https://github.com/hibatica/AdagraPlugin/blob/master/src/main/java/me/hibatica/adagraplugin/duels/inventorymanager/DuelInventoryManagerListeners.java

I can't for the life of me figure this out.

If a player is in a duel, I don't want them to be able to move items out of their inventory as they'd be able to dupe duel kits.
also ik, amazing code

GitHub

Contribute to hibatica/AdagraPlugin development by creating an account on GitHub.

stray nacelle
#

why sending item update packet makes item in hand swing :((

grizzled oasis
livid dove
#

So when doing right click interaction events, it continues to proc when holding (and most the time at least triggers more than once) and tends to fire off in pairs. This is nulifying an event where i wish to set on first right click, and nulify on a second right click if at the same location, has anyone bodged together awork around?

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
tall dragon
#

probably this

livid dove
#

Ahhh

#

also thank you cafebabe. Best botty boi

grizzled oasis
#

Hi im trying to provide this

"{skin:\"1\"}"

But the json complited result like this

{
    "criteria": {
        "trigger": {
            "trigger": "minecraft:impossible"
        }
    },
    "display": {
        "icon": {
            "nbt": "{skin:"1"}",
            "item": "minecraft:DIAMOND_SWORD"
        },
        "title": {
            "text": "Hello World!"
        },
        "description": {
            "text": ""
        },
        "background": "minecraft:textures/gui/advancements/backgrounds/adventure.png",
        "frame": "task",
        "announce_to_chat": false,
        "show_toast": true,
        "hidden": true
    },
    "requirements": [
        [
            "trigger"
        ]
    ]
}

But in this way its wrong any fix about for this?

distant wave
#

does anyone know how to get hand used in EntityDamageByEntityEvent and the item used?

grizzled oasis
#

i would assume

distant wave
grizzled oasis
smoky anchor
distant wave
#

id assume thrown potions would be the damager in that case

#
  • you have EntityType.ARROW and EntityType.SPLASH_POTION
smoky anchor
#

well in that case it is always main hand
can't recall any instance of it being offhand

smoky oak
#

Is there a way to temporarily disable IntelliJ ordering of autocomplete? I'm creating a partial EnumSet and with non-alphabetical order keepint track is a bit difficult

distant wave
#

can i check for key in pdc like this? or do i need to store the namespacedkey instance somewhere

#

instance is the plugin instance

smoky oak
#

i hate how it looks but i think that works

distant wave
smoky anchor
#

You do not need to store it
It will work like this as well
Just keep in mind that it may be using a bit more memory/be slower

smoky anchor
distant wave
#

i dont want ot use external dependencies

smoky anchor
#

well then
I hope you never want to do NPCs

distant wave
smoky oak
#

What's the simplest way to test if it's day/night? I refuse to do math using world.getTime if possible since it returns total time

smoky oak
echo basalt
#

and do a range

distant wave
#

btw how would you make a custom persistence data type? should i use classic serialization for it?

smoky oak
#

you've two options

#

the good one and the insane one

#

Illusion or alex, dunno which of em, made a PDC library that takes any data type if i remember correctly, thats the normal solution

#

alternatively you can just turn a object into a byteOutputStream, read that as a string, and shove said string into the PDC

smoky oak
#

I would really recommend using the library :P

echo basalt
#

I barely make public libs

#

and all of my public libs are either on my search index or my gist

distant wave
#

i wrote this simple thing, it should work right?

echo basalt
#

I mean

#

There's probably a better way

#

Like the object's yours

#

You can probably make a byte buffer and write the contents yourself

bleak nacelle
#

why dns takes too long to set up

onyx fjord
#

You mean the propagation?

lilac dagger
#

i had a dns that took a whole day to propagate

#

and the weird thing was that some friends had access to it

smoky oak
#

takes like 1-2 days

bleak nacelle
onyx fjord
#

but you can always flush manually

bleak nacelle
#

it takes time

onyx fjord
#

then use a different dns server

#

you shouldnt rly use your isps

bleak nacelle
#

i switched to cloudflare warp

onyx fjord
#

1.1.1.1?

bleak nacelle
#

yes

#

is the dns server and dns resolver is the same thing?

echo basalt
#

I had some issues with call of duty and cloudflare warp

wary remnant
#

You can manually flush cloudflares DNS cache

rough drift
#

Reading a file from my jar using Files.readString(path inside jar file) always replaces § with § (it's not like this in the jar file), using UTF-8 for both reading/writing

wary remnant
willow yacht
#

Hey everyone, is there way to remove all bad active potion effects from player?

tall dragon
#

sure. but as far as i know you will need to define your own list of "bad" potion effects

#

afterwards you can just loop through and remove them

willow yacht
#

Okey, thanks!

native bramble
#

want to make inventory rollback plugin and have a question: which is the best way to save the data?
i need to save players info(inventory, location, health, exp and other) when player join, quit, world changes and deaths.

It is plugin InventoryRollbackPlus which saves data in this way:
/backups/deaths/<uuid>/<time_in_long>.yml

But is it a better way to save data? Maybe with sqlite?

wary remnant
#

There are many ways. You could save the (gzipped) NBT data

quaint mantle
#

use nbt

#

or sql whatever you like lol

#

you can even use scoreboard

native bramble
#

ok

ivory sleet
#

@quaint mantle u've done modding right? (fabric)

quaint mantle
#

yes

quaint mantle
ivory sleet
#

so lets say I wanna add some "instance variables" to both LocalPlayer objects and ServerPlayer objects while they are valid in session

quaint mantle
#

tell me it in yarn names

ivory sleet
#

I thought of using another class just and add some mixins here and there, but I assume there are better ways

#

ugh let me see

quaint mantle
ivory sleet
#

yeah but then comes the issue

quaint mantle
ivory sleet
#

when I want to write and read

#

as well as handling respawns

quaint mantle
#

thats mixins

near mason
ivory sleet
quaint mantle
#

yes you can