#help-development

1 messages · Page 585 of 1

drowsy helm
#

you have to get getTopInventory

#

thats the numbers for raw slots aswell

tranquil prairie
tranquil prairie
# drowsy helm

I tried just manually setting 0-5 to air and that didnt work either

drowsy helm
#

why do you need to clear it anyway

#

are you using it as a menu or smth

echo basalt
#

just go a simple test

tranquil prairie
echo basalt
#
ItemStack stone = new ItemStack(Material.STONE);

for(int index = 0; index < inventory.size(); index++) {
  stone.setAmount(index + 1);
  inventory.setItem(index, stone);
}
#

subtract 1 to each slot and find out

tranquil prairie
#

What

#

Ik the slot number

echo basalt
#

that'll tell you what slot is what

#

ah

#

Are you sure it's accurate though

#

the slot in bukkit is not the same slot in the protocol

tranquil prairie
#

Yeah... you can look it up

tranquil prairie
echo basalt
#

True but there are like 3 different definitions

tranquil prairie
# drowsy helm

Ive tried using InventoryClickEvent and just printing the int slot its in and I get the same results as this

echo basalt
#

Then yeah you're fine

tranquil prairie
#

Well yeah it still doesnt work

#

idk why its so hard to clear it

echo basalt
#

try delaying a tick

river oracle
#

just add it like you would to any itemstack

#

anything you want

#

doesn't mean they'll work

tranquil prairie
#

makes no sense

echo basalt
#

player.updateInventory maybe

orchid gazelle
river oracle
kind hatch
orchid gazelle
#

I love myself for bringing md to add this

river oracle
#

shnitzel

glad prawn
echo basalt
#

you can have a list of keywords

#

and if the first word is in the keywords list

#

y'know

#

Stone would be a bit weird

young knoll
#

Mhm

#

Just watch out for some things

#

Like IRON_INGOT

#

I’m sure a PR could be made for it

#

You could make a feature request

glad prawn
#

Check tool type then split tier xd

young knoll
glad prawn
#

:p

flint coyote
#

create a map in your onEnable and use that

young knoll
#

Wha

#

Why are you casting the entity to fireball

#

And then later checking if it’s a living entity

#

It is

flint coyote
#

it is but you can't just expect it to be a fireball

young knoll
#

And then check if that fireball is a living entity

final monolith
#

The helmet slot is always 34 on every version? is there a class that universally says the helmet slot? something like... Slot#ARMOR_HELMET?

young knoll
#

Yes

flint coyote
#

you should still make an instanceof check before. Otherwise you will get a ClassCastException every time another entity damaged someone

young knoll
#

And you should not blindly cast

young knoll
#

No

flint coyote
#

first check then cast

young knoll
#

You cast to fireball before your check

#

Yes

flint coyote
#

yes

young knoll
#

If you are in modern java you can shorten it

#

But that’s just for the fancies

flint coyote
# final monolith ?

Can't tell you. There is getRawSlot and I'd highly doubt it ever changes but I usually just deal with the latest version so I can't tell you with 100% guarantee

glad prawn
#

GG GR G yo

flint coyote
#

top tier variable names

#

Also creating a new Random instance multiple times

young knoll
#

Wolves need a target to attack

#

Otherwise they just sit there and look angry

flint coyote
#

being angry intensifies

young knoll
#

Mhm

flint coyote
#

They should find their own target, don't they? Or do they only anger one target at a time?

young knoll
#

Nope wolves don’t care

#

They have to have a target

#

Unlike other mobs

flint coyote
#

oh I did not know

#

I mean he could change their TargetSelectorGoal but that's kinda harsh for someone who's new to coding

young knoll
#

Let’s worry about variable names first

glad prawn
#

i still dont know whats that means

flint coyote
#

Those are very GG

glad prawn
#

🤔

flint coyote
#

Poor did you find a solution to your string problem? As in caching your calculation on startup?

#

Fair

#

how is it cursed?

young knoll
#

Probably requires a living entity

#

Idk your ide will tell you

flint coyote
#

Yeah for new tools you can't really adress it without an update but when did minecraft ever add new tools with different versions (gold, diamond etc.)

flint coyote
#

It's about tool types. Pickaxe, axe etc

#

A new material ain't a problem

kind hatch
#

Oh, I see

flint coyote
#

You can workaround that by collecting all tiers

#

basically getting all pickaxes and taking the part before the _

#

And then you would register all types of tools (axe, pickaxe, shovel, sword, hoe did I miss any?) and create a
Map<Tier, List<Material>>

#

Or in reverse for faster lookup.

Material, Tier

#

you would only hardcode the tools then. As long as they don't add different material shields or any other new tool you are fine

#

You could also do a cursed workaround for that by checking for things that have tiers.

E.g. going over the material enum and checking if you find anything that ends the same after the _ and starts once with WOODEN_ and once with DIAMOND_, IRON_ etc.
That's a lot more cursed though

#

welp discord got rid of my underscores

#

you probably still get the point

#

yes that would work

#

the tag

carmine nacelle
#

Hey I used to use this chunk of code for setting armorstand packet info, now im getting an error:
https://hastebin.com/share/vazagutiso.csharp
Error:

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 @1ed6993a)
        at net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata.a(SourceFile:21) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
        at net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata.a(SourceFile:41) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
        at net.minecraft.network.PacketEncoder.a(SourceFile:45) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
        at net.minecraft.network.PacketEncoder.encode(SourceFile:14) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
        at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:120) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:113) ~[netty-codec-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[netty-transport-4.1.82.Final.jar:4.1.82.Final]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
#

I had lost my source code so I decompiled one of my jars, I think the decompiler might've put something in the wrong spot

languid frost
#

Hi, how can i get the interacted slot from a chiseledBookshelf?

(not the lastInteracted one, the one that is being interacted with?)

terse pumice
#

I'm spawning in an ArmorStand with the below code but am finding that it can sometimes cause the server to freeze and then crash from a thread death
https://paste.gg/p/anonymous/9b0a8ffb33154a92a2952b924b2eeb76

It spawns an Armour Stand but it starts flickering on the floor in and out of existence while the server is crashing

river oracle
#
drowsy helm
#

will make your life a million times easier

carmine nacelle
#

it turns out the way this packet works was changed "recently" and thats why it doesnt work now..?

drowsy helm
#

yup every update packets get changed

#

thats why remapped is easier to use

carmine nacelle
#

Can you explain how I can use it again please..? i used to but forgot how

#

its been over a year

carmine nacelle
drowsy helm
#

read that post i sent you

carmine nacelle
#

*its not in my project directory)

drowsy helm
#

they give an example pom.xml

carmine nacelle
#

Nice, I think it auto-found it

#

How does this help my issue though..?

drowsy helm
#

remapped provides packet wrapperes so you don't have to use data watchers and all that

#

I assumed you knew what it was since you said "you are trying to" use it

carmine nacelle
#

Happen to have an example..?

#

Well, I have used it in the past

#

just not for this issue

#

I used it when trying to mess with entity ai

carmine nacelle
#

im also using ProtocolLib

drowsy helm
#

assuming you're using 1.20

carmine nacelle
#

I am..

#

How do you read this website..?

drowsy helm
#

it shows you all the remapped names for everything

carmine nacelle
#

I just see stuff about PackedItems, ClientGamePacketListener..

#

not seeing how to set these values with/without datawatchers

drowsy helm
#

you can use PacketPlayOutEntityMetadata

#

in protocol lib it should just be the index

#

idk the packet name in protocol lib tho

carmine nacelle
#

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

#

thats for that part, but as for setting the values...

#

how do you do it without datawatchers..?

drowsy helm
#

i think ive confused you

carmine nacelle
#

yes

drowsy helm
#

if you're using protocol lib you have to use datawatchers

carmine nacelle
#

lol

drowsy helm
#

im just saying protocol lib sucks

carmine nacelle
#

why?

#

whats wrong with it

drowsy helm
#

its abstracted so much to the point where you have to be doing stuff like this

#

where other methods just have wrapper classes

carmine nacelle
#

So how would I spawn an armorstand and set its attributes with just a normal packet in 1.20?

#

without plib

drowsy helm
#

PacketPlayOutSpawnEntityLiving, PacketPlayOutEntityTeleport, PacketPlayOutEntityMetadata

#

using nms

carmine nacelle
#

NMS is the devil lol

#

Dont I need to do something special to use default packets..?

#

they arent showing in intellisense as options

drowsy helm
#

to send it or just use it in general

carmine nacelle
#

both

hazy parrot
#

?nms

carmine nacelle
hazy parrot
#

You can import tho but don't have intellisense?

carmine nacelle
#

no option for PacketPlay...

drowsy helm
#

can you use any nms imports?

hazy parrot
#

If you can import, try to invalidate cache

carmine nacelle
#

lientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(ClientboundEntity, )
or do you need to do this instead when using mojang mappings..?

carmine nacelle
#

Ah...yep

#

with mojang mappings you gotta do the above instead.

#

(my armorstand entities are spawned with the following), they arent actual entitties they're just packet entities

PacketContainer packet = this.protocolManager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
                packet.getIntegers().write(0, holoIDs.get(curHoloLine));
                packet.getUUIDs().write(0, holoUUIDs.get(curHoloLine));
                packet.getIntegers().write(1, 1);
                packet.getDoubles().write(0, hologram.getLineLocation(curHoloLine).getX());
                packet.getDoubles().write(1, hologram.getLineLocation(curHoloLine).getY());
                packet.getDoubles().write(2, hologram.getLineLocation(curHoloLine).getZ());
                packet.getEntityTypeModifier().write(0, EntityType.ARMOR_STAND);
flint coyote
#

Is it possible to have a clickable link in a book that is not yet signed?

carmine nacelle
# drowsy helm can you use any nms imports?
                ClientboundAddEntityPacket spawnPacket = new ClientboundAddEntityPacket((Entity) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND));
                for(Player all : Bukkit.getOnlinePlayers()) {
                    ((CraftPlayer) all).getHandle().connection.send(spawnPacket);
                }

Unsure of spawning an ArmorStand packet with this system, then being able to modify it later..?

drowsy helm
#

just use the entity id for the next packet

carmine nacelle
#

Can a "fake" entity even have an id?

drowsy helm
#

the entity still exists it just isnt spawned in server side

#

you can still treat it as a regular entity

carmine nacelle
#

Which part of the ClientboundAddEntityPacket even determines the type? it looks like an entity has to already exist to spawn it..? kinda weird

languid frost
drowsy helm
#

it takes it in the constructor

#

(int arg0, UUID arg1, double arg2, double arg3, double arg4, float arg5, float arg6, EntityType arg7, int arg8, Vec3 arg9, double arg10)

carmine nacelle
#

Hmmm..

#

doesnt really explain what most of them are..

#

Like what are you supposed to put for arg0, arg2, arg3..

#

im guessing position? but it doesnt really say

drowsy helm
#

there was a resource for it im tryna find it

carmine nacelle
#

not sure why it needs an ID and a uuid both

drowsy helm
#

look through the deobfuscated code and see how they convert entity to that in the constructor

#

and youll figure out what the params are

carmine nacelle
#

hmm ok I think I get that part now

#

but can I just make the ID the same as the UUID..?

#

weird it needs both

drowsy helm
#

Ones entity id

#

Not sure what uuid is for

carmine nacelle
#

Just generate a random ID for ID then..?

flint coyote
vast ledge
livid dove
#

It's mainly a paper lirary but does have a way to be implemented into spigot.

noble lantern
hasty obsidian
#

How to check for item

vital sandal
livid dove
#

How does it not work? Does it error? Does it not function? Does it turn your players into pig's?

Need a bit more than just "doesn't work"

#

My brother in christ be patient.

vivid cave
#

How to check if an InventoryView is opened or closed ?

glad prawn
#

But why ArrayList<Object>

livid dove
glad prawn
#

Can u show full code

#

Well

glad prawn
livid dove
#

*I'm about to go into a conference for the UK aerospace so I'm gonna be a bit busy 😅

glad prawn
#

Oh okay..

slow temple
#

is buildtools.jar supposed to give a craftbukkit.jar

eternal oxide
#

only if you force it

#

no one should be usinc CB anymore

vivid cave
#

How to find an Inventory(View) container id ?

#

i need it for SetSlot packets

glad prawn
#

Move vanishedPlayers to outside the method, it should be a instance variable instead.

#

Idk why it is Object instead of UUID xd

flint coyote
vast ledge
flint coyote
vast ledge
#

why would you need a writable book with clicks tho

flint coyote
#

I use them to write configuration ingame. And there's also documentation in there.
Would be cool to have clickable links (e.g. to the Material enum)

#

but guess they'll have to mark and ctrl+c

vast ledge
#

wait, couldn't you check for a click and use a packet to the open link ui?

flint coyote
#

open books are entirely clientside

vast ledge
#

rip that's annoying

flint coyote
#

can't even properly format them

#

as there's a clientside formatter

vast ledge
#

idk why it's client-side, if it were server side it would be a lot better

#

Same with the speed calculations and reach in mc

flint coyote
#

Basically I wanted the blue part to be clickable but it's fine like that aswell

vast ledge
#

can you not make it a formatted item

#

and why do you need it to editable again?

flint coyote
#

so you can edit things on the next page

vast ledge
#

you can create a click able component

#

and redirect it to a sign or anvil

vivid cave
#

Can someone help me with ClientboundContainerSetSlotPacket?

vast ledge
#

if you need input

flint coyote
#

neither are big enough

#

What if you wanna add a list of 20 effects here? Or locations?

vast ledge
#

you can create a button that checks or unchecks the options

vivid cave
#

Can someone help me with

vast ledge
#

and then have an integer or float input for the level

flint coyote
#

Maybe for a future version. That's all part of an engine. The potion effect configuration etc is not part of the engine but of different plugin using the api

dark arrow
#

hey how do i auto save the built plugin to my server file , i am using intelligi

slow temple
#

im using intellij and am new to plugin making
import net.minecraft.server.v1_19_R1.EntityTypes;

#

gets an error, how to get nms working

vast ledge
#

you need to use buildtools

slow temple
#

i did

flint coyote
#

I might use extra inventories for enums. But then again there's enums with 1000+ entries (Material). I guess I'll see what user feedback I get

vast ledge
dark arrow
vast ledge
vivid cave
#

more like "super_annoying_guy" than "super_cool_guy" ngl

#

i had the same question

#

toxic part of stack overflow

slow temple
tender shard
#

you can run it anywhere you like, except on remote folders like onedrive etc

glad prawn
#

can i run outside of my computer

vital sandal
#

@tender shard could you help me a bit in parsing anvil chunk format

noble lantern
slow temple
#

i cant find minecraft in the net folder of .m2/repository after running buildtools

quaint mantle
noble lantern
#

will be something very cool once i get this smoothly workin :p

quaint mantle
#

Ohh oki

slow temple
vivid cave
#

What do inventoryMenu.active & inventoryMenu.checkReachable do ?

#

lemme rephrase it:
what does it mean that an InventoryMenu is active, what does it mean that its reachable ?

noble lantern
#

@drowsy helm @shadow night I know you two were talking about this yesterday and i just wanted to finally get off my lazy ass and try this xD

I converted most of forge's IEnergyStorage into spigots :p You can create an infinite amount od energy types, similar to how you can create infinite amount of Economys with vault :p

#

still really proofy of concept but :p

shadow night
#

NICE

drowsy helm
#

ouu fancy

#

have source?

shadow night
#

thats so cool

noble lantern
#

yes one moment

#

ill just show you my exmaple plugin for now, i still dont have source on GH

#

?paste

undone axleBOT
flint coyote
#

@tender shard how did the benchmark go?

somber scarab
#

hi guys

#

hows ur stuff

#

and other stuff

shadow night
#

having energy stuff without mods is really cool

somber scarab
#

If there is a project like that being worked on, Im 100% down

shadow night
#

you are in the right place then

somber scarab
#

we can make a general power lib that many plugins can use

noble lantern
#

BukkitEnergy (Impl of IEnergyStorage) https://paste.md-5.net/cudejecifi.java - this is made in mind similar to Vault's Economy where all plugins can hook into this class an effortless share energy between plugins

Example plugin from above (I made it one class just for simplicity sakes): https://paste.md-5.net/osiladitec.java - I need to make a Machine impl and this will be 10x shorter but i just got this entire API working, trying to mimic vaults compat feature where every plugin can easily use it

somber scarab
#

oh yea

shadow night
#

wow thats cool

noble lantern
#

sec im gonna push this to gh

somber scarab
#

make a mineing drill

shadow night
#

maybe that will get integrated into bukkit or spigot once

noble lantern
#

loool nah

somber scarab
#

why would they?

shadow night
#

why not

noble lantern
#

if that was the case vault would of been implmeneted long ago

shadow night
#

hmm, true

#

a lot less problems

torn shuttle
#

why is my math so god damn cursed

sullen marlin
#

How many plugins have energy lol

torn shuttle
#

I'm so close

#

why is it not doing the resolution math right arbitrarily

#

I can tell it's 2x what it should be, I'm pretty sure

#

oh actually it's not even mapping all sides correctly that's fantastic

noble lantern
#

they look like theyre overlapping almost CH_Kek

torn shuttle
#

it's 2x too large

shadow night
#

it definitely looks weird

torn shuttle
#

it's only doing this for multi-textured projects

#

it's not resolution-specific either

noble lantern
torn shuttle
#

because that resolution works just fine for other sizes

shadow night
noble lantern
vivid cave
#

Anyone knows

  • what is inventoryMenu.active and inventoryMenu.checkReachable
  • what should i put in the revision/stateId parameter of ClientboundContainerSetSlotPacket ?
  • should I put rawSlot or slot in ClientboundContainerSetSlotPacket ?
shadow night
#

doesn't forge energy exist since like 1.12?

#

yeh thats not much

torn shuttle
#

how is the uv source right for only one coordinate....

#

it's not even exactly 2x

#

weird because it looks exactly like 2x hm

#

ok no I was taking stupid pills it was 2x

#

minecraft please

slow temple
#

is there someone who can teach me how to get nms because im dumb

eternal oxide
#

?nms

eternal oxide
#

much has changed

torn shuttle
#

mappings are your friend

slow temple
#

ok

noble lantern
#

you can do it without any NMS now

Take a look into Noteblocks for the easiest way (and if you do not care about losing note block functionality)

#

Mushroom blocks are another one but more annoying to work with, as when they break they update all surounding BlockFaces and meh annoying

torn shuttle
#

noteblocks are great for this

#

easy to make too

noble lantern
#

yeh same i love noteblocks, always works amazingles and no ones gonna be using noteblock banjos 💀

#

yep unused states (instruments + notes)

torn shuttle
#

you don't need to lose much in noteblock functionality

#

iirc there's a lot of unused data in there

noble lantern
noble lantern
torn shuttle
#

it's been 2 or 3 years since I last checked but I thought you had a lot of usually unreachable states with the noteblocks you could use, if you jammed it just right

#

never actually used that knowledge though so ymmv

#

though that might change soon

noble lantern
#

cant wait till mojang gives us more modding power

humble lynx
#

How about player heads?

noble lantern
#

those are easy sec

#

modern mc right @humble lynx ?

humble lynx
#

I mean you get a customized block, slightly smaller

noble lantern
#

ohh

torn shuttle
#

pretty sure you can customize mining speed

noble lantern
#

you mean for custom blocks lol

#

i use heads for crops 😛

noble lantern
torn shuttle
#

yall going to be using my amazing custom model api before you know it

noble lantern
#

olivo has a really good demonstration of it

#

ngl magma

#

could it render build-craft style pipes? Thonk

#

or just tubes

torn shuttle
#

they're just models

#

you can render anything that fits the model rules

humble lynx
#

i have been sad because i was looking at blockbench/mythic mobs for ages thinking it was revolutionizing minecraft but it's just a bunch of texturepacks

#

😦

noble lantern
#

is that public?

#

or still indev

torn shuttle
#

I am ironing out the last few bugs

#

probably release 1 this week

#

trying to figure out where my scaling math went wrong rn

noble lantern
#

is just resource packs

humble lynx
#

ehh

noble lantern
#

but youll never notice

#

because its automatic

humble lynx
#

wait what

#

what if the player doesn't want tp's?

noble lantern
#

yeah most good devs will make it where the resoruce pack gets sent to the client

torn shuttle
#

you can enforce resource packs

noble lantern
humble lynx
#

plus atm i'm trying to make a plugin that uses armour stands and vanilla blocks to mimic mobs

torn shuttle
#

but if players don't want them then you can't really do much about it, they're literally refusing the content

noble lantern
#

^

#

you CAN tho disconnect them 😛

#

if they reject

humble lynx
#

true

torn shuttle
#

yeah you can force it to be rp-only

#

if they don't want it then hey too bad

humble lynx
#

is there anything else you can do to the player if they refuse the rp? like deny them access to a world?

torn shuttle
#

this sucks

noble lantern
#

resoruce packs arent per world really so no point your better just kicking em off if you wanna force packs

humble lynx
#

ah dang

noble lantern
torn shuttle
#

the way I got it to work sucks

#

I don't know why 128x forces me to manually divide by 2

#

the math isn't right

#

bet 512 is also busted...

slow temple
# eternal oxide ?nms

is it ok if the net.minecraft.server part has the [warning] prefix in cmd after buildtools was run

eternal oxide
#

follow the page to the letter and you'll have no warnings

torn shuttle
#

I wonder how much traffic I would need to handle if I allowed people to host their RPs on my hardware

twin venture
#

hi , i made a custom gui plugin (Shop for my server..)

and i have problems with potions , enchanted golden apple ..

it does not show slot 1 ,2 ,3 , and slot 34

noble lantern
#

my plugins resource pack is 190mb so theres that xD

twin venture
#

the weird thing is it show the 4th potion , but not the first and second and third .. in the gui ..

#

and when i did some debugging ..

#

this is my custom config :p

torn shuttle
#

this is really annoying

humble lynx
#

what about where the items are being loaded into the gui?

twin venture
#

wait a moment ..

torn shuttle
#

the scaling issue looks completely arbitrary

#

it just hates a few of the models

twin venture
#

you mean this one .

vital sandal
#

how about the config?

humble lynx
#

config was posted, didn't see anything wrong

twin venture
#

i send it

twin venture
twin venture
humble lynx
#

item1 and item2 share the same slot?

noble lantern
humble lynx
#

in your config

twin venture
#

its a List of Item [custom Class data for the itemstacks]

vital sandal
#

There are 2 slot 1 ?

noble lantern
twin venture
#

yeah i know it was 1, 2

#

i changed it to see if something wrong but its stil l same .

humble lynx
#

maybe slot 0, slot 1?

twin venture
#

i tried 0 , 1 too

#

all other items works fine ..

noble lantern
#

its likely your getAllItems method doesn't have anything for those slots, hence why its null and continuing on it (as your using item.getSlot() instead of a counter)

twin venture
#

oh ok

noble lantern
#

thats why iwas asking what the method body was and what the Item class was :p

twin venture
slow temple
noble lantern
#

where are you loading the map at exactly

#

thats what i wanna see

twin venture
#

i think i know why .. bcz its the same material , and in maps you can't have duplicate?

noble lantern
#

suspicious

#

i only just opened the config and saw that

twin venture
hard socket
noble lantern
#

0, 1, 2, 3

Not sure why you have same slot twice though 😛

noble lantern
hard socket
torn shuttle
#

oh my god I found the issue

#

and it's blockbench

#

do you see it

humble lynx
#

I'd debug by seeing if other items work in the first three items as well, if you're still having problems with the first 3 items then you can rule it out of your config and look at your code instead.

noble lantern
#

-96 -> -128?

torn shuttle
#

top right, bottom

#

see a mismatch?

#

the uv thinks it's 2x larger than the image

noble lantern
#

this is why i could never be a modeler

#

i would go insane

torn shuttle
#

imagine not only being a modeler but manually exporting this through your own code

#

and then getting it to display in mc

#

ok I have a theory

#

a game theory

#

yep

#

ok so

#

this is dumb

#

turns out blockbench has 1 uv size per project

#

so I could have 17 different textures all of different sizes but blockbench exports them all as if they were of the maximum size

#

so i need to resize the uv twice, once to adjust it to the size of the image I'm making a uv map for and then to adjust for the size MC expects UVs to be

#

which is up to 16x16

#

... I think, maybe I only need to do it once for the project size, gotta test it

quartz spruce
#

Hello, I have a question. How do I make a paginated message ?

twin venture
#

i fixed it ..

so the probm with the hashmap , i was setting the material name same for potions , and in hashmap you can't have duplicate keys ..

vivid cave
#

Anyone knows

  • what is inventoryMenu.active and inventoryMenu.checkReachable
  • what should i put in the revision/stateId parameter of ClientboundContainerSetSlotPacket ?
  • should I put rawSlot or slot in ClientboundContainerSetSlotPacket ?
eternal oxide
#

why are you messing with nms inventories?

vast ledge
#

tf is a paginated message

quartz spruce
#

A message that has pages

#

So like
Message
next page previous page

quaint mantle
#

With a book o how

trim creek
#

And also commands 😆

young knoll
#

Pretty much

icy beacon
#

with ACF, if I use the acf-paper & PaperCommandManager, will it still work fine on spigot? i know this isn't the paper server but maybe someone knows

undone axleBOT
icy beacon
#

i'm not developing rn i'm just wondering

#

i'm even away from my pc

young knoll
#

Iirc yes

torn shuttle
#

it works... it's... beautiful

#

only two issues left

quaint mantle
#

What is that

torn shuttle
#

the model is for a tower defense game but that doesn't really matter for what I'm doign right now which is the plugin that generates the resource pack and manages the models from blockbench files and files with a custom extension

quaint mantle
#

So cool man

torn shuttle
#

I just have to fix the rotations and figure out why basic towers aren't displaying now

hard socket
#

is this the best way I can do it?

icy beacon
young knoll
#

Why not container.has

#

Also please add a nice if (item == null || !item.hasItemMeta) return false;

tender shard
#

I'd rather do it like this:

public static int getLevelofMyCustomEnchantment(ItemStack item) {
  if(item == null) return 0;
  if(itemMeta == null) return 0;
  return itemMeta.getPdc().getOrDefault(myKey, PersistentDataType.INTEGER, 0);
}
hard socket
#

I am not getting the level

#

I am checking if the enchant already exists

tender shard
#

well but you need the level at some point. and checking if the enchantment exists is simply checking if th elevel is > 0

#
public static boolean hasMyCustomEnchantment(ItemSTack item) {
  return getLevelOfMyCustomEnchantment(item) > 0);
}
#

looping over the keys is definitely unneccessary

#

either use has or getOrDefault and check if it's > 0

hard socket
#

will do that

flint coyote
#

Alex were there interesting results on toList vs collector?

quartz spruce
#

So does anyone know how to make a message with pages

young knoll
#

Clickable components

#

Just two simple buttons that go to the next and previous page

trim creek
spare hazel
#
@EventHandler
    public void onPlayerJoin(PlayerJoinEvent e){
        if(HypixelSkillCore.getInstance().getPlayer(e.getPlayer().getUniqueId()) == null){
            HypixelSkillCore.getInstance().createPlayer(e.getPlayer().getUniqueId());
            e.getPlayer().sendMessage(ChatColor.GREEN + "Welcome To servername! Your SkyblockSkills Account Has Been Created");
        }
    }```

is it gonna make it so the account is saved inside the actual main class or is it gonna just save the account on a virtual main class on this class?
#

im not really experienced with oop

young knoll
#

The actual main class

spare hazel
torn shuttle
#

is anyone here familiar with a display size trick one could use to make items on an armor stand larger?

chrome beacon
#

Use display entities uwu

torn shuttle
#

have you noticed how that doesn't even get close to answering my question?

chrome beacon
#

Someone here is probably familiar with it

#

There you go

smoky anchor
torn shuttle
#

I just want to make it larger

#

I know there's a trick somewhere but I have no clue of what it is

smoky anchor
#

mind you it will change it for players as well for said slot

torn shuttle
#

wdym

smoky anchor
#

for example: if you change third person slot main hand
it will be scaled when a player holds it as well, not only armor stand

torn shuttle
#

that's fine they will never be able to get this one

#

how do you do it?

#

oh actually I think I might already be using the method you were mentioning

torn shuttle
#

I have the head slot scaled up 4x

#

yeah that one I have implemented

smoky anchor
#

that is the maximum
If you want more then use display entities

torn shuttle
#

I know there's one more trick I can use in armor stands, that's what I'm trying to figure out

chrome beacon
#

Why don't you want display entities

torn shuttle
#

model engine does it and refers to it with

#

I guess I already did the display sizes but I can only go up to 80

#

not 112

#

so I'm trying to squeeze it a bit more

smoky anchor
#

you can scale the model to use the whole 3x3x3 in combination with the display size
that would be the maximum for armor stand ye

torn shuttle
#

hm am I being dumb or something

chrome beacon
#

Well you are just making it harder for yourself

torn shuttle
#

I want this to work on versions that didn't yet have display entities

chrome beacon
#

Then combine multiple armorstands

torn shuttle
#

how am I only getting 80 out of this and not 112

smoky anchor
#

literally.... why
Unless you're making for 1.8.9 or 1.12 (for performance) I see no point in supporting older versions

brazen violet
#

fileconfig.addDefaults to write in file or?

chrome beacon
#

?configs

undone axleBOT
smoky anchor
#

then tell people to use the newer version smh

eternal oxide
#

Don;t bother. make them update

#

1.20 is a great point to break off new versions

torn shuttle
#

you guys do whatever you want to do, I don't care to be review bombed with people asking to support more than two minecraft versions

eternal oxide
#

2 right now. it won;t be long before it's 5

smoky anchor
#

Actually... is there any other program for models nowadays ?

torn shuttle
#

there's nothing magical about the model

#

it works just fine in model engine and it doesn't work on my plugin because... reasons?

smoky anchor
#

dafrick is model engine

torn shuttle
#

the plugin I'm about to shakedown for their lunch money

#

I just need to figure out this limit thing and then do some rotation work

young knoll
#

It’s a neat plugin

#

Needs more display entity tho

torn shuttle
#

huh this is really odd

smoky anchor
spare hazel
#

what listener is used for checking if an entity damaged the player or vice versa

flint coyote
#

EntityDamageByEntity

torn shuttle
#

I think I might be on to the issue

#

I'm starting to suspect that the model size boundary is not symmetrical

spare hazel
flint coyote
#

use instanceof

dawn ledge
#

Hi,
I have used this code : ```public class TNT extends net.minecraft.server.v1_16_R3.EntityTNTPrimed {

public TNT(Location loc) {
    super(net.minecraft.server.v1_16_R3.EntityTypes.TNT,
            ((org.bukkit.craftbukkit.v1_16_R3.CraftWorld) loc.getWorld()).getHandle());
    this.setPosition(loc.getX(), loc.getY(), loc.getZ());
    this.addScoreboardTag("zombie");
    this.setFuseTicks(0);
}

}```
to create a custom explosion in 1.16.4
But today I want to do the same with display entities but I don't know how to do it in 1.20
Can somebody help me ?

spare hazel
#

like this?

flint coyote
#

yes

spare hazel
#

alright thanks

torn shuttle
#

ok... yeah I think I might be on to it

#

yknow minecraft it would be really cool if you told me what the model boundaries are

#

that way I wouldn't have to just guess

torn shuttle
#

not quite

smoky anchor
#

blockbench even disallows you to go further if you have the item/block model type

torn shuttle
#

it's not symmetrical into negative values

smoky anchor
#

what ?!

torn shuttle
#

yeah that's the issue I ran into

smoky anchor
#

I think you're doing something wrong tbh

torn shuttle
#

no

#

this is confirmed I am reading the mc logs

smoky anchor
#

-16 to 32 in all axis I believe

torn shuttle
#

well I can tell you this much, -22 is too much

smoky anchor
#

ye exactly

torn shuttle
#

-16 to 32 sounds possible

smoky anchor
#

that should be the boundry since: block is 16 pixels
and a corner is 0, 0, 0
it is not symmetrical since it is not from "center"
It is just the way it is, you have to work around it

torn shuttle
#

yeah that's basically what I just found out

smoky anchor
smoky anchor
torn shuttle
#

I read a bunch of wikis, guess I didn't find the correct page

smoky anchor
torn shuttle
#

yeah that would be it

#

well now how do I fix this

smoky anchor
#

define "fix"

torn shuttle
#

make it work

#

I could recenter every model and then offset it

spare hazel
#

what is the algorithm that minecraft uses to calculate the damage taken with armour points(when you wear an armour it increases)

dawn ledge
torn shuttle
#

which would work but that means model in high negative or positive values won't work

#

which... I mean is that really a problem in the first place

smoky anchor
dawn ledge
#

just the way that I implement that in my code

smoky anchor
dawn ledge
smoky anchor
#

Ok so.. do you know how to spawn any entity with Spigot ?
Do you already have some code I could work off ?

icy beacon
#

what word can i use to signify both "enter" and "leave" lol

#

naming problems

#

Region???Listener

torn shuttle
dawn ledge
#

but idk how to do this

icy beacon
smoky anchor
dawn ledge
#

ha

smoky anchor
dawn ledge
#

ok what is your proposition ?

smoky anchor
#

If you want to do this then go to fabric or whatever
'cause then you would not really be using the Spigot API
Which I suppose is why you're here

#

I guess you could create a method that spawns the entity (tho ppl here will not really like that I bet)
With all the settings you want

dawn ledge
spare hazel
#

Field 'uuidToPlayerMap' may be 'final'
what is final in java?

#

i get this warning very often

hazy parrot
#

If its for variable, it means it won't be changed

spare hazel
#

isnt that static?

icy beacon
#

No

hazy parrot
#

Final can alao be method or class, final method means that it cant be overriden in child class and final class means that class can't be inherited

icy beacon
#

a static variable is a variable that can be accessed without creating an instance of a class basically

#

a final variable is a variable that cannot be reassigned

hazy parrot
spare hazel
#

oh alright

quaint mantle
#

hmm yes, high quality code

smoky anchor
#

ignoring the look of the code
I guess I can see why you use variable names starting with capital letter but it does not look right

twilit roost
#

is there something like BungeeCord Build Tools?

remote swallow
remote swallow
twilit roost
quaint mantle
#

My eyes are burning rn because of my code 😂

#

Everything bad

smoky anchor
#

honestly... ditch optionals

quaint mantle
#

I guess that's an improvement?

smoky anchor
#

ye that is slightly better I guess
But then the optional is kinda pointless lol

tawdry canopy
#

Hi ! I am currently making some plugins and the question came to me: where can I securely hide my database logins ? I know that .jar can be uncompiled and I prefer to have a secure plugin. Any ideas about this ?

quaint mantle
icy beacon
#

and if you do give access there's almost way to hide info anyway

#

if it's not a private plugin then why would there be internal login and password data

tawdry canopy
flint coyote
#

Why do you require database credentials in a public plugin?

remote swallow
#

yeah hiding stuff isnt gonna happen if ur os and public

icy beacon
#

why are there login and password in a public plugin

#

hardcoded

remote swallow
#

the db stuff should be supplied by end user

icy beacon
#

^

tawdry canopy
#

I'm doing tests with those but I'm using data stored on database to use it in a website

remote swallow
#

what

#

add a line for it in config, add random data that similar to default without it working on a db

icy beacon
#

anyone knows how to get a TabPlayer from a Player? i want to show a scoreboard (https://github.com/NEZNAMY/TAB/wiki/Feature-guide:-Scoreboard#api) to a player but i do not know where to get a TabPlayer object
i currently see the way of fetching a player at PlayerLoadEvent and mapping them to their UUID for future access (and removing the object from the map when player leaves) but it seems like so much hassle and i was wondering if there was a "proper" way to do it

tawdry canopy
#

So full user-providing for the db

quaint mantle
#

Create a thread instead

icy beacon
#

perhaps

quaint mantle
#

uhh why is my custom mob double dying?

#

it cant die either

smoky anchor
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

quaint mantle
#

i would have no idea what code to provide tbh

icy beacon
#

the code for your custom mob?

#

and perhaps any code that does something with its behavior

quaint mantle
#

zombie:

public class TestZombie extends CustomEntity {
    public TestZombie(Location loc) {
        super(EntityType.ZOMBIE, loc, "%%COLOR_GREEN%%Test Zombie");

        this.setAggressive(true);
    }

    @Override
    public void initItems() {
        setItemSlot(EquipmentSlot.HEAD, CraftItemStack.asNMSCopy(new QuacHelmet().getItem()));
    }
}
#

custom entity:

public abstract class CustomEntity extends PathfinderMob {
    final Location location;
    public CustomEntity(EntityType<? extends PathfinderMob> entityType, Location loc, String displayName) {
        super(entityType, ((CraftWorld) loc.getWorld()).getHandle());
        location = loc;

        this.teleportTo(loc.getX(), loc.getY(), loc.getZ());

        this.setCustomNameVisible(true);
        this.setCustomName(Component.literal(ColorUtils.translateStringWithColor(displayName)));

        initItems();
    }

    public void initItems() {

    }

    public final void spawn() {
        ServerLevel nmsWorld = ((CraftWorld)location.getWorld()).getHandle();
        nmsWorld.addFreshEntity(this);
        this.setHealth(this.getMaxHealth());
        EntityBase entityBase = EntityBase.getEntityBase(this.getBukkitEntity());
        entityBase.updateStats();
    }
}
icy beacon
#

what signifies that it can't die

quaint mantle
#

now stuck with a zombie that cant die

quaint mantle
quaint mantle
#

I would recommend spawning the entity for the server, and then select the players you don't want to see the entity

#

And send them the entity destroy packet

#

how would i

quaint mantle
#

Of course it does, because you are spawning the entity for each client
Spawn it "for the server" and the server will spawn it to each client

#

After that, if you don't want player X to see or interact at all with that entity that you just "spawned", send player X the entity destroy packet, which constructor should be the entity you've just spawned ID

#

PacketPlayOutEntityDestroy packetDestroy = new PacketPlayOutEntityDestroy(new int[]{myCustomNMSEntity.getId()});
Not sure if that stills the constructor

#

But it was smth like that

#

Then send that packet to player X

quaint mantle
wraith bane
#

I want to create a GUI for my plugin, what would be the simplest way to do that (I want to use some library to make it easier)

quaint mantle
quaint mantle
cinder abyss
#

Hello, how can I get the item who was used to place a block ?

quaint mantle
#

After that, you don't need to spawn it for each client

#

As the server already does that

#

well i dont do that

#

but i still get this issue

#

Then that part of the code is being run twice at some point

#

I would recommend you to debug

wraith bane
quaint mantle
#

If you see the debug message twice, then it means that somethnig is being run twice

#

If you are using an scheduler for spawning the entity, try to make it singleton, or add some kind of validation before spawning

#

i think i fixed it

#

had smt to do with my custom stats system

#

every LivingEntity NEEDS and EntityBase, which creates on entity spawn but i had getType().isAlive() instead of instanceof LivingEntity, it also checks this if it takes damage so if i killed it with /kill it and it didnt have EntityBase it added the EntityBase when it got killed resulting it in having health whilst dead

#

new issue, it does not attack me

#

dont i want to automatically target the nearest player? or do i have to put that in a tick function or smt

icy beacon
#

the docs for PlayerFishEvent are ambigious "Thrown when a player is fishing"

#

is the event called whenever a player starts fishing

#

or when they catch something

quaint mantle
icy beacon
#

this makes me 100 times more confused

#

the method is not annotated with nullable/notnull too

quaint mantle
#

how about

#

u add a debug

#

and find out

icy beacon
#

actually there's getState nvm

#

it was buried

quaint mantle
#

Lets say i want to another variable to the damage event, like a boolean, so if that boolean is true i can change the dmg and whatever, what would be the easiest/best way to do this

torn shuttle
#

pog it works

#

gg no re

zealous osprey
#

damn, sick

smoky anchor
quaint mantle
#

Any guide to create tablist on 1.8

undone axleBOT
drowsy helm
quaint mantle
drowsy helm
#

If it extends zombie it should inherit it’s pathfinder goals

quaint mantle
#

it does not extend zombie

#

it only extends my customentity class

#

which extends pathfindermob

drowsy helm
#

Oh interesting

quaint mantle
#

this is a thing

spare hazel
#

ChatColor.DARK_AQUA + "" + ChatColor.BOLD
or
ChatColor.BOLD + "" + ChatColor.DARK_AQUA

#

which one is correct

quaint mantle
#

1st

spare hazel
#

thx

drowsy helm
#

It doesnt matter

quaint mantle
#

for me bold then color dont work

quaint mantle
drowsy helm
quaint mantle
drowsy helm
#

there you go you can pathfind

#

and just pass it through pdc

#

of the entity

#

depends on the context of the boolean

#

like is the variable based on the entity in the damage event or some outside factor etc

quaint mantle
#

well i have like an ability where i call Entity.damage(dmg, cause)

#

i want to pass it in there

#

and be able to access it in the EntityDamageByEntity event

drowsy helm
#

what is the boolean exactly?

icy beacon
#

i was wondering, why is buildtools so dependent on java version? i tried running bt for 1.12.2 with java 19 but it required java 8. shouldn't it be backwards compatible?

#

(i need 1.12.2 for a commission)

drowsy helm
#

because yeah unless you make some extended impl of EntityDamageByEntity event then youll have to do some workaround

quaint mantle
#

so basically "isAbiltiyDamage"

drowsy helm
#

gotcha

#

i mean you could tag the entity with some abilityDamage flag

#

then remove it after the event

quaint mantle
#

is that the best way to do it tho

drowsy helm
#

so it needs to be compiled in 8

drowsy helm
#

i.e subtract the health manually then call your event

#

other way around sorry since it's cancellable

quaint mantle
# drowsy helm i mean you could just make your own event and do the damage manually
public class CustomEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
    public boolean isAbilityDamage() {
        return isAbilityDamage;
    }

    private final boolean isAbilityDamage;
    public CustomEntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, double damage, boolean isAbilityDamage) {
        super(damager, damagee, cause, damage);
        this.isAbilityDamage = isAbilityDamage;
    }
}
#

would that work

drowsy helm
quaint mantle
#

i could

drowsy helm
#

then handle the health subtraction

quaint mantle
quaint mantle
drowsy helm
#

apply a velocity

#

then can send a packet for the hit animation

quaint mantle
#

it seems like the should be an easier way for this, no?

drowsy helm
#

i mean this isnt that complicated

#

im pretty sure you can do 0 damage and it will apply knockback and do the hit animation still

glass mauve
#

why is MapPalette.matchColor() deprecated and still used internally?
is it fine to still use it?

drowsy helm
#

yeah its fine to use

quaint mantle
# drowsy helm im pretty sure you can do 0 damage and it will apply knockback and do the hit an...
 @EventHandler
    public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
        if(event.getEntity() instanceof LivingEntity livingEntity) {
            EntityBase entityBase = EntityBase.getEntityBase(livingEntity);

            entityBase.takeCustomDamage(event.getDamager(), event.getEntity(), event.getCause(), event.getDamage(), false);

            event.setDamage(0);
        }
    }

entityBase.takeCustomDamage is literally just a call for the new event

#

that would right?

drowsy helm
#

deprecation note just says magic value

#

looks good to me

quaint mantle
#
public static void connection() {
        String conenctionString = "url";

        ServerApi serverApi = ServerApi.builder().version(ServerApiVersion.V1).build();

        MongoClientSettings settings = MongoClientSettings.builder()
                .applyConnectionString(new ConnectionString(conenctionString))
                .serverApi(serverApi)
                .build();

        try (MongoClient mongoClient = MongoClients.create(settings)) {
            MongoDatabase database = mongoClient.getDatabase("Plasmify");

            try {
                Console.sendConsoleMessage("&aSuccessfull connecting to &2" + database.getName() + " &amongodb database.");
            } catch (MongoException me) {
                me.printStackTrace();
            }
        }
    }

im getting this error: java.lang.NoClassDefFoundError: com/mongodb/MongoException

glass mauve
#

ok so the colors of a map in minecraft is limited:
will matchColor return the byte thats already mapped to the closest color in the limited palette?
for example:
Color(1, 1, 1)
will matchColor return the byte of the literal color or first map it to the closest color (0, 0, 0)
in this case and then return the byte?

quaint mantle
#

wait @drowsy helm, the EntityDamageByEntityEvent has a parameter called "DamageCause" which is an enum, couldnt i add custom values to enum to check if its abilityDamage??

drowsy helm
quaint mantle
drowsy helm
#

cant be extended unfortunately

quaint mantle
#

why cant u just add custom values to and enum 😩

#

that wouldve made it SO much easier

drowsy helm
drowsy helm
quaint mantle
drowsy helm
#

wait is the error during runtime or in your IDE

quaint mantle
#

there is no errors

drowsy helm
#

im getting this error: java.lang.NoClassDefFoundError: com/mongodb/MongoException

#

?

quaint mantle
#

yes

drowsy helm
#

so you are getting that error

#

or you arent?

quaint mantle
#

yes, only that error

drowsy helm
#

yes is that during runtime or in the IDE

quaint mantle
#

runtime

drowsy helm
#

yeah so its a shading issue

quaint mantle
#

I misunderstood sorry

#

So shanding means?

drowsy helm
#

so basically java needs to have the library during runtime, shading is just providing the library inside of the jar for java to use

eternal oxide
#

Use libraries feature of plugin.yml

quaint mantle
#

can you provide an example pls?

drowsy helm
#

i always forget that exists

#

yeah the libraries thing will be far easier than shading

#
libraries:
   - org.mongodb:mongo-java-driver:3.12.14
#

i believe

eternal oxide
#

needs a version too

#

yep

icy beacon
spare hazel
#
player.sendMessage(ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "------------------------");
                    player.sendMessage("   " + ChatColor.AQUA + "" + ChatColor.BOLD + "SKILL LEVEL UP " + ChatColor.DARK_AQUA + "Woodcutting " + ChatColor.DARK_GRAY + RomanNumber.toRoman(getPlayerAccount(player).getWoodcutting().getLevel() - 1) + ">>" + ChatColor.DARK_AQUA + RomanNumber.toRoman(getPlayerAccount(player).getWoodcutting().getLevel()));
                    player.sendMessage("");
                    player.sendMessage("   " + ChatColor.GREEN + "" + ChatColor.BOLD + "REWARDS");
                    player.sendMessage("       " + ChatColor.DARK_GRAY + "+" + ChatColor.GREEN + getPlayerAccount(player).getWoodcutting().getDamageRewards() + ChatColor.BLACK + " Damage");
                    player.sendMessage("       " + ChatColor.DARK_GRAY + "+" + ChatColor.GREEN + getPlayerAccount(player).getWoodcutting().getHealthRewards() + ChatColor.RED + " Health");
                    player.sendMessage("       " + ChatColor.DARK_GRAY + "+" + ChatColor.GREEN + getPlayerAccount(player).getWoodcutting().getDefenseRewards() + ChatColor.AQUA + " Defense");
                    player.sendMessage(ChatColor.DARK_AQUA + "" + ChatColor.BOLD + "------------------------");

how do i make it so the messages dont come one by one

icy beacon
#

but maybe i just did it wrong

icy beacon
#

it did work well with java though

#

yeah i like kotlin

icy beacon
#

though i use java as well, it's also cool

drowsy helm
#

is it delayed when sending or smth

quaint mantle
spare hazel
drowsy helm
drowsy helm
spare hazel
#

i dont want a 0.0001s delay between sending messages

glass mauve
#

hm so MapCanvas.getPixel is also deprecated and I should use MapCanvas.getPixelColor which returns a Color object
instead. So I want to compare a new pixel color Color pixel with the current Color on a specific position on a MapCanvas.
The pixel provided by the user is any Color though and that means I first need to map the provided color to the
MapPalette's limited number of colors and the matchColor method returns byte instead of a Color object.
Do I really need to turn the Color into a byte then back to a Color and then compare with the current Color using getPixelColor?
or is it again fine to use the deprecated methods in MapCanvas which uses bytes instead of Color objects

drowsy helm
#

then use that reference

quaint mantle
drowsy helm
#

your sendMessages are hanging waiting for the methods to execute

drowsy helm
icy beacon
#

can't you send one message with multiple lines?

icy beacon
#
player.sendMessage("""
text
text
""");
quaint mantle
#

@drowsy helm it doesnt work like this since when u melee hit somebody the EntityDamageByEntity gets called right? thats fine, call the custom damage event and it does the knockback and effect, but with custom damage like the ability i have to call the takeCustomDamage function cus else i cannot pass in that it is an ability, so does that mean i have to make the damage effect and knockback myself?

icy beacon
#

because with yaml iirc you can

message: |-
  text
  text
eternal oxide
#

call Class.forName(... to load the driver

quaint mantle
#

wait thats WAY easier

drowsy helm
#

its the only real way of doing it if you want to pass the variable in the params

quaint mantle
#

the reason i wanted to pass in the isAbilityDamage is so i can calculate the dmg with different stats

#

but if i just move that into a seperate function

#

its not needed to pass it in the event

glass mauve
#

also what is the difference between getPixel and getBasePixel:
getPixel:

Get a pixel from the canvas. If no color is set at the given position for this canvas, then null is returned and the color returned by getBasePixelColor(int, int) is shown on the map.
getBasePixel:
Get a pixel from the layers below this canvas.
what is a pixel from the layers below the canvas?

#

is there always a default layer?

quaint mantle
# quaint mantle its not needed to pass it in the event
public void takeDamage(Entity damager, DamageType damageType) {
        //Calculate damage;
        double finalDamage = 0d;

        
        EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, entity, EntityDamageEvent.DamageCause.CUSTOM, finalDamage);
        Bukkit.getPluginManager().callEvent(event);
    }
#

@drowsy helm maybe i need to have installed JDK Development Kit?

drowsy helm
#

you wouldnt be able to compile without jdk

eternal oxide
#

should be Class.forName("mongodb.jdbc.MongoDriver");

glass mauve
# glass mauve hm so `MapCanvas.getPixel` is also deprecated and I should use `MapCanvas.getPix...

this would be the approach using the deprecated methods

    public boolean setPixel(@Nullable Color pixel, int x, int y) {
        byte pixelIndex = MapPalette.matchColor(pixel);
        byte currentPixel = canvas.getPixel(x, y);

        if (pixelIndex == currentPixel) {
            return false;
        }

        canvas.setPixel(x, y, pixelIndex);
        return true;
    }

and this would be the approach without deprecated methods

    public boolean setPixel(@Nullable Color pixel, int x, int y) {
        pixel = MapPalette.getColor(MapPalette.matchColor(pixel));
        Color currentPixel = canvas.getPixelColor(x, y);

        if (pixel.equals(currentPixel)) {
            return false;
        }

        canvas.setPixelColor(x, y, pixel);
        return true;
    }

the non deprecated method got some kind of double conversion

rough drift
river oracle
#
    private void scrubSiegeData(DomainInfo domainInfo) {
        SiegeDeclaration declaration = this.declarations.remove(domainInfo);
        System.gc();
        declaration.cancelTask();
        System.gc();
        SiegeDeclaration.deleteFile(domainInfo);
        System.gc();
    }

Any way I can improve this method guys???? I'm just kind stumped on how to improve performance here

eternal oxide
#

A joke I hope

drowsy helm
#

dont

#

even

#

why

orchid trout
#

call System.gc() some more and i think it should do the trick

river oracle
drowsy helm
#

while true loop with System.gc()

river oracle
drowsy helm
#

both

river oracle
#

thx <3

glass mauve
# river oracle ```java private void scrubSiegeData(DomainInfo domainInfo) { SiegeDe...

[...]
There is no guarantee that this effort will recycle any particular number of unused objects, reclaim any particular amount of space, or complete at any particular time, if at all, before the method returns or ever. There is also no guarantee that this effort will determine the change of reachability in any particular number of objects, or that any particular number of Reference objects will be cleared and enqueued.

river oracle
#

so what your saying is I need to keep calling it to ensure it eventually works

#

got it

drowsy helm
river oracle
#

so the while true loop

#

is the solution

glass mauve
river oracle
#

is there ever a legitament reason to ever fucking call System.gc() like why does it exist

drowsy helm
#

i could condense that whole hting into like 10 words

#

"This method may not have any effect"

#

done

river oracle
glass mauve
torn shuttle
#

I don't have the foggiest clue of how to do rotations with models

umbral pendant
#

ty

river oracle
chrome beacon
glass mauve
#

manually but its not guaranteed 💀

torn shuttle
#

it rotates just fine at 0 0 0 for the origin but the origin scales in crazy ways compared to the raw model probably due to the scaling

drowsy helm
#

can you change the anchor point?

torn shuttle
#

that's what the origin is

#

and it's what I'm trying to figure out

chrome beacon
river oracle
river oracle
#

you know what fuck it just use Unsafe for everything

chrome beacon
#

New spigot fork with automatic gc

river oracle
#

no GC needed

drowsy helm
#

i would love pointers in java tho

#

like actual pointers

chrome beacon
#

Never had a need for them in Java

drowsy helm
#

not that whack ass reference shit

#

jsut makes some things way more efficient

#

i thought they were useless until i started using c++ a fair bit

hazy parrot
#

Why would you need pointers in java

#

I can't think for any usecase

drowsy helm
#

same reason you use them in other langs

umbral pendant
#

weirdest sentence alive ngl

hazy parrot
umbral pendant
hazy parrot
#

And dynamic allocation would make no sense

drowsy helm
#
  1. can use pass by ref
  2. more precise memory management for large chunks of data
hazy parrot
#

Java is already effectly passed by reference

ashen bolt
#

I'm working on a menu and am currently trying to open a inventory/menupage by clicking an item. However, the new inventory will have invisible items. anyone know what I am doing wrong?

hazy parrot
#

You shouldn't even dynamicly allocate in cpp anymore, one of few reasons I can't think of is if object must outlive current scope

ashen bolt
#

public class SwitchMenuItem extends MenuItem {

  final String destination;
 public SwitchMenuItem(final String name, final String destination, final Material type){
    super(name, type);
    this.destination = destination;
 }

@Override
public void onClick(InventoryClickEvent event){
  Inventory inv = event.getInventory();
  MenuManager manager = DynMarket.getMenuManager();

  event.getWhoClicked().closeInventory();
  manager.deleteMenu(inv);
  if(destination == "Main"){
     manager.openMenu(new MarketMenu(), (Player)event.getWhoClicked());
  }
   manager.openMenu(new CategoryMenu(destination), (Player)event.getWhoClicked());
}

}

#

this is the item class

drowsy helm
#

pls use code blocks

#

and when you say "will have invisible items"do you mean some items dont show up?

ashen bolt
#

None of the items will,

drowsy helm
#

the way you worded it sounds like you plan on making items invisible

ashen bolt
#

but I can click on them

eternal oxide
#

you should not open a new inventory inside a click event

ashen bolt
#

How should I open a menu inside a menu then?

eternal oxide
#

delayed 1 tick

#

scheduler runTask

drowsy helm
#

first

#

if server crashes then you have some data retained vs none at all

river oracle
#

I always keep in memory until the last possible moment to reduce DB calls. Though in any sense it'd be practical to set it up with a LoadingCache that provides you with an instance of the object regardless. With your cache though make sure you setup a refresh time that saves than loads the data back into the cache.

in short. Use a cache of Caffeine and set it up to refresh and such.

drowsy helm
#

probs userId

#

depends on your usecase

ivory sleet
#

Whoever said java is pass by reference, that’s wrong, java is pass by value and has been that for a long time if not forever, semantically java is pass by value which is different to semantically being able to pass by reference

drowsy helm
#

^

hazy parrot
#

I said effectly

#

Same reason I added italic for "java is passing pointer", because you don't need to pass pointer or reference to edit actual object like you have to do in cpp

drowsy helm
#

"an extra db call" can stack up when theres alotta players

river oracle
#

Essentially its a Map with a shit ton of features. With a loading chache you have a CacheLoader interface you implement that gives you allows you to use your key to create a very basic empty object to be filled with data. It then adds your object to the cache without needs a Map.put call. Essentially with a LoadingCache you never need to add to the cache it'll always be added automatically when you try to get something from the cache, but it'll just return an object every time.

https://www.baeldung.com/java-caching-caffeine

Using caffeine for cacheing has so many other bennefits other than LoadingCaches too
e.g. RemovalListeners, EvictionListeners, Timed removal, Time refreshing etc

ivory sleet
#

Java is really and effectively pass by value

#

Because by the definition of pass by value you go by semantic language specification

#

I mean sure implementation wise, java may be pass by reference (picking on ur words a bit now)

drowsy helm
#

thats the same trap that mineplex fell into

somber scarab
#

yo guys wtf??

I tried adding a config file.

river oracle
#

you kinda gotta remind yourself that even if you run it Async DB calls are still an expensive as hell operation. So you should use them sparingly, intelligently, and elegantly

hazy parrot
# ivory sleet Java is really and effectively pass by value

I wouldnt call effectly passed by value if you can mutate object sent into method arguments for example. Also, we were talking about should java have pointers, as you can already mutate object, it makes cpp style send by reference redundant in java

quaint mantle
#
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, getEntity(), EntityDamageEvent.DamageCause.MAGIC, finalDamage);
        Bukkit.getPluginManager().callEvent(event);

Does this just not work? my entities aint taking dmg anymore

river oracle
#

?pastge

undone axleBOT
somber scarab
#

oh my bad

spare hazel
#

i know its not about plugin development but HOW THE DUCK DO I FIX COULDNT SAVE SETTINGS IN INTELLIJ IDEAAAAAAA

drowsy helm
#

im not saying that method in particular is bad. Just the idea that "one extra db call" is a dangerous train of thought