#help-development

1 messages · Page 743 of 1

valid burrow
#

also

young knoll
#

You can print any object

valid burrow
#

IT WORKS JUST FINE IN THIS CLASS

#

like

#

IT DOES NOT MAKE ANY SENSE

#

seems to already be an int too

young knoll
#

I mean you could just check the return type

valid burrow
#

i mean but it does have to be another error cause

valid burrow
#

this works

#

100%

#

and its like

#

the same code

#

idk why it doesnt work here

ivory sleet
#

You call some add function both times

#

Couldn’t that be the issue? (Dk what joiner::add does tho)

valid burrow
#

no i found out the problem

#

it was completly unrelated

#

really stupid too

#

while importing both objects i made an error

#

and because with the second one i imported it directly from my main it worked

#

cause there it was imported propperly

solemn frigate
#

How would I find the current ram, as in what Pterodactyl shows it as?

#

Nah, I'm tryna do it programatically

river oracle
#

Might need jni for that I'm not sure if java can find that

echo basalt
#

it can

quaint mantle
echo basalt
#

uses jni

solemn frigate
#

Might sound like a stupid question, but is JNI a dependency/library?

echo basalt
#

y'know how if you decompile certain java methods

#

they have the native keyword?

#

That means those methods have an implementation in C++

#

JNI is what allows the bridging between java and c++

fluid cypress
#

if there is a PotionEffect.serialize, why isnt there a PotionEffect.deserialize? how am i supposed to get the PotionEffect object back from a serialized uh thing

echo basalt
#

something something BukkitSerializable

#

use the constructor

fluid cypress
quaint mantle
#

Is there a website or smth to update my anvil world to lts version?

echo basalt
#

doubt

#

it's an annoying process

quaint mantle
#

hmm

#

dangg

echo basalt
#

p sure DataFixerUpper might work for you

spare hazel
#
public boolean isEmpty(){
        return  head == null &&
                body == null &&
                legs == null &&
                feet == null &&
                hand == null;
    }```
is there any way to make this less copy pasted looking? this is currently the worst part of my code
glad prawn
#

its ok lol

spare hazel
#

can an entity's Equipment Slot be null?

#

like their chestplate

#

why iis this place so silent

#

im waiting for someone to answer so i can countinue my coding session

merry cove
#

!boots.getType().equals(Material.AIR) yup it's air not null.

#

there may exists a null out there, but idk.

glad prawn
#

wait

#

nvm

spare hazel
#
            entity.getEquipment().setBoots(equipment.getFeet() == null ? equipment.getFeet() : new ItemStack(Material.AIR));

did i do this wrong

#

no im making like a custom entity builder

hybrid turret
#

So I think I managed to serialize the Inventory-Contents now.
The json-String now outputs

"[ItemStack{ACACIA_PLANKS x 64}, ItemStack{ACACIA_PLANKS x 64}, ItemStack{ACACIA_PLANKS x 64}, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]"

Does it even work like that? bc I don't know how to deserialize now. I tried this and that but I can't get anything to work really

lost matrix
lost matrix
#

"If the mob has nothing on his feet: Put nothing on his feet"
Thats what you wrote

spare hazel
#

i fixed it
i changed == with !=

pseudo hazel
blazing ocean
#

is there any way to unregister an event handler?

blazing ocean
#

thx

spare hazel
#

How can i add mvn install to the run lifecycle or whatever its called idk

hybrid turret
#

i never worked with serializing stuff, I don't get it :(

#

yeah toString was dumb asf lol

lost matrix
# hybrid turret nnnnnnnnmaybe

ItemStacks implement ConfigurationSerializable. You can just throw it in a config. Same goes for a List<ItemStack>

FileConfiguration config = ...;
List<ItemStack> items = ...;
config.set("some.items", items);
hybrid turret
#

Damn then I misunderstood the FileConfiguration class whoops

#

for some reason i never realized that you could use FileConfiguration for json

#

Lol

#

Or… can u?

#

This is messing with my head

harsh totem
#

I know that raids get harder when you start them with higher levels of bad omen but does it work when the bad omen is higher than V?
I tried it and it doesn't seem harder

shadow night
harsh totem
#

I don't know for sure, it just doesn't seem hard when I used bad omen X

shadow night
#

Well, it would make sense for mojang to limit bad omen to 5 to prevent it from being way too hard

lost matrix
#

Make it harder yourself with some code 🙂

sick edge
#

Cant normal items like chest show an enchantment glint I feel like they should be able

sick edge
hazy parrot
sick edge
#

😔

hazy parrot
#

There are few more blocks, but chest is one of them

pseudo hazel
#

mostly ones with weird models dont have a glint

naive bolt
#

What is the differance between
setTotalExperience
and
setExp

pseudo hazel
#

setExp is just a value for the current level

#

like the progress towards a new level

#

from 0 to 1

#

where 1 is a full bar

#

you can use it to manipulate how full the bar is

naive bolt
#

So if I want to add 1 full level to the bar I would use which one

#

I was thinking something like this
player.setExp(player.getExp() + Integer.parseInt(eventData));

pseudo hazel
#

you use setLevel(getLeve() + 1)

naive bolt
#

Ah yes. Didn't see that one. Thanks

smoky oak
#

I need some design advice

I have a bunch of passive abilities, and a bunch of event they depend on. Currently, I'm using an abstract class with empty methods that get called by the events, but i want to be able to say 'player handler, this this this that ability' without hard-coding it.
My two ideas are:

  1. void event(Event event) -> if(event instanceof AbilityEvent abilityEvent)
  2. doing a HashSet<Class, List<Listener>> and register by event class and listener

I'm fairly certain neither of those is anywhere close to the optimal solution. Any advice?

pseudo hazel
#

wdym without hardcoding it

smoky oak
#

if they're not coded into the class extending the abstract player handler. that's what im doing right now, but i want to be able to switch abilities around easily by editing a config

young knoll
#

You can give the player a list<consumer<event>>

smoky oak
#

wym?

#

why do i only get a consumer api result for 1.12 lol

young knoll
#

Consumer is a java class

pseudo hazel
#

consumer is java

young knoll
#

Ignore the Bukkit one

pseudo hazel
#

bukkit has consumer because it existed before jaba

smoky oak
#

k

young knoll
#

It’s from Ye old days before java 8

smoky oak
#

oh thats funny

#

so how would this work?

#

would i still need a set of methods for events calling the consumer(s)?

young knoll
#

You would just loop the list and call accept(event) on each

smoky oak
#

and it would do the instanceof automatically?

young knoll
#

You can do a bunch of funky generic stuff to make it only receive certain event types

smoky oak
#

i think i understand consumers

#

is the filtering done automatically?

young knoll
#

No

smoky oak
#

like if i put a Consumer<InventoryClickEvent> into a List<Consumer<Event>> and throw in a PlayerLeaveEvent it just crashes then?

pseudo hazel
#

each implementation would decide what to do with the event

young knoll
#

You could instead use a map<class, list<consumer>> to make sure you only activate the right ones

smoky oak
#

well i thought about that but it felt wrong

#

Consumer<Event> and in the consumer event instanceof then?

young knoll
#

You can do that too, yeah

smoky oak
#

hm

#

i mean i cant just pass event cuz thats an interface

#

i already have it separated into the different events

#

feels weird merging then splitting it again

#

urgh

#

both of those feel wrong lol

young knoll
#

Yeah generics are kinda annoying

#

Yay type erasure

naive bolt
#

It would load fine like 10 mins ago and I didnt change the api version

eternal night
#

don't use paper-plugin.yml

naive bolt
#

Im not

#

this is my plugin.yml

#

I did have paper plugin but removed it

eternal night
#

make sure the jar you are running does not have it

naive bolt
#

I deleted my build folder and rebuilt again. Seems to be working now, Thanks

eternal night
#

👍

smoky oak
#

uh

#

im trying to link intellj and github desktop, can someone tell me why my intellij doesnt recognize its in a git dir, and how to solve it?

#

alright let me change that question, how do i make it recognize the git dir and not use my name it somehow got?

#

bleh screw it im just gonna log in

#

that didnt help bruh

#

can i please get some help here? Even logging in to github and saying 'clone repository' on the intelliJ dialogue does still shift my name back to my real name

drowsy helm
#

Wdym ‘link’?

eternal night
#

I mean, what is your name in the systems git config ?

#

like what does git config user.name return

smoky oak
#

uh

#

i dont think i can change that

eternal night
#

you can lol

smoky oak
#

no like i know but i am not supposed to

#

github desktop can use per-project settings tho

#

isnt there a thing like that in intellij

eternal night
#

Well yea, you run the config command in your git repo

#

intellij should respect that

#

like, in your project dir you'd run git config user.name "Not my real name"

smoky oak
#

wouldnt that screw over the global config?

eternal night
#

it overwrites it in the project

#

but only in it

#

if you want to edit the global config you'd have to run with --global

smoky oak
#

i see

#

and all this to use git in intellij lol

eternal night
#

I mean, or git anywhere

#

that is just how git works lol

smoky oak
#

nope

#

git user spits out moterius

eternal night
#

literally yes KEKW

smoky oak
#

intellij shows my real name

eternal night
#

what does ?

#

git config user.name ?

smoky oak
#

but in intellij its like 'created by: Full legal name'

#

and yes i did close ij, did the change, restarted it

eternal night
#

created by ??

smoky oak
#

no, it shows my full name

eternal night
#

do you mean the file header..

smoky oak
#

the name after that person icon

#

im also fairly sure the commits are done under that name there

eternal night
#

I mean, if old commits that create those types have your full legal name as author

#

then sure, your git integration will show that

smoky oak
#

they dont

eternal night
#

you'd have to edit the old commits

smoky oak
#

stupidly enough it worked with another project and i have no idea why

#

the weird thing is in intellij it shows the initial commit as 'Moterius' and the dated commit as 'Legal Name'

eternal night
#

I mean, what does git log show

smoky oak
#

oh thats curious

#

the commits are under different accounts

eternal night
#

Welp /shrug

smoky oak
#

where does git log pull from btw?

eternal night
#

the command ?

smoky oak
#

ye

#

like

eternal night
#

from .git ?

#

like

#

huh

smoky oak
#

dafuq

#

it said 'legal name' cloned the repo, but i was logged in as moterius when i did that tho?

eternal night
#

cloned?

smoky oak
#

yea i pushed it from github desktop cuz THERE account switching works

eternal night
#

I mean pushing does not matter

#

where you commit from matters

smoky oak
#

wait a sec

naive bolt
#

How can I make this not as resource intensive. Can I get a singular offline player instead of scanning through them all?

    private String getOfflinePlayer(String uuid, String author) {
        try {
            UUID id = UUID.fromString(uuid);
            for (OfflinePlayer offlinePlayer : Bukkit.getOfflinePlayers()) {
                if (offlinePlayer.getUniqueId().equals(id))
                    return offlinePlayer.getName();
            }
        } catch (IllegalArgumentException e) { //Invalid UUID or CONSOLE
            //Nothing, just get the default
        }
        return author != null ? author : uuid;
    }
eternal night
#

I mean, just Bukkit.getOfflinePlayer(id), dunno if that properly reads last known name tho

smoky oak
#

wait

#

is it using my account i logged in with only while pulling the repo

#

why

spare hazel
#
@EventHandler
    public void onEntityDeath(EntityDeathEvent e){
        LivingEntity entity = e.getEntity();
        CustomEntity customEntity;

        if(entity.getPersistentDataContainer().has(IranSkyEntities.getInstance().getEntityID(), PersistentDataType.STRING)){
            customEntity = IranSkyEntities.getInstance().getEntityManager().getEntity(entity.getPersistentDataContainer().get(IranSkyEntities.getInstance().getEntityID(), PersistentDataType.STRING));
        }else{
            return;
        }

        customEntity.onEntityDeath(e);

        new BukkitRunnable(){
            @Override
            public void run() {
                for(ItemStack drop : customEntity.getDrops().getDrops(false, 0)){
                    entity.getWorld().dropItemNaturally(entity.getLocation().add(0, 1, 0), drop);
                }
            }
        }.runTaskLater(IranSkyEntities.getInstance(), 1);
    }```
does this code need further optimization?
sick edge
#

I am using the adventure API and lores...is there any way to set italics to false for all lore components? Right now im setting it to false on every component)

glossy venture
eternal night
#

I'd suggest a helper method

worldly ingot
#

You should only need it on the first component for each line though

#

Child components will inherit style

sick edge
#

How are the lines defined I thought each element in the list is a new line but it didn't work when just setting it for the first...and the Component.newLine() adds this weird symbol so I just added an empty text component

worldly ingot
#

That's correct

#

Every entry is a new line, and yes, use an empty component for an empty line

#

You may also be able to use null, but an empty component is better and is constant anyways

eternal night
#

I mean, just throw a ```java
public static Component roman(final Component component) {
return component.decoration(TextDecoration.ITALIC, false);
}

#

static import it everywhere

#

and then you can just ```java
lore(List.of(
roman(text("First line"))
));

worldly ingot
#

I was just about to complain to you about calling that method "italic"

sick edge
#

Yeah I guess Il do that thx guys

worldly ingot
#

ty

eternal night
#

shushhhh

#

but yea, adventure gets a lot nicer if you static imports its stuff

#

so its a lot less verbose

worldly ingot
#

Could also probably save yourself a step and pass a String instead and create the text component in the method

#

¯_(ツ)_/¯

eternal night
#

but then you can't use text("red", RED)

#

you'd have to .color(RED)

worldly ingot
#

Yeah? Well, you smell

eternal night
worldly ingot
#

Make an overload

eternal night
#

true

#

overload would be nice

#

make an overload for minimessage and legacy

slender elbow
young knoll
#

Adventure? I hardly know her

smoky oak
#

hey @eternal night can u use git to use a specific account instead of using the name in user.name ?

#

I've noticed that some of my commits were 'verified' and some not

eternal night
#

verified means your GPG signature on the keys are valid

smoky oak
#

well yea it ought to be valid when i create the repo online

#

but how do i tell git to actually commit using that account and not some random name

opal juniper
#

make sure you set them globally

smoky oak
#

cant

#

but that wouldnt help either

#

its just values stacked onto

#

its not 'me'

#

just 'someone named like me'

#

like the creation commit is credited to my account

#

but all commits after that are credited to 'Author: Moterius'

#

i dont think I'm supposed to put that thing in my user.name am i?

crystal shuttle
smoky oak
worldly ingot
#

I've a feeling they probably don't support 1.8.8 either though lol

young knoll
#

Why doesn’t optifine run on spigot

opal carbon
#

real

#

md5 needs to add optifine

hybrid turret
#

I'm yet again a bit confused. In my event to open an iron door by hand if the key in the player's and the door's (using CBD) PDC match, I had the following code:

// in PlayerInteractEvent-method
BlockState state = block.getState();
Openable ironDoor = (Openable) state.getData();
ironDoor.setOpen(!ironDoor.isOpen());
state.setData((MaterialData) ironDoor);
state.update();

This was supposed to open the door. Which it did. (The conditions are (finally) done with early returns instead of kamehameha code)
Now it throws an error.

#

Which I just realized, I can't show rn bc i don't have minecraft on this pc

#

shit

young knoll
#

Material data

#

Oh no

#

Wait pdc isn’t in 1.12

#

Why are you using material data

hybrid turret
#

Anyway: This code opened the door before (at least when I clicked the bottom half, bc the key was only saved in there fsr) and now it doesn't

hybrid turret
young knoll
#

Use BlockData

hybrid turret
#

Oh right

#

yeah i just read it

#

Lol

#

wait, but it wants MaterialData from me what

#

ah, setBlockData ig

#

alright i guess for now i'll try if that fixed it once i get home.
otherwise i'll be back :))

#

thanks

young knoll
#

Pretend material data doesn’t exist

#

Don’t look at it

hybrid turret
#

Yeah, that's what I usually do with deprecated stuff xd

#

but i was a lil blind when i read the documentation

young knoll
#

There is no material data in ba sing se

hybrid turret
#

i really just had to google what "ba sing se" means lmao

inner mulch
#

Hello, I've created a tabCompleter for a command, does anybody know if it is possible to add suggestions, that you cannot tab, but recommend what can be there

for example:
/pay <Player> <amount>
in this case i dont want the player to be able to tab <Player> or <amount> in his command, i just want him to see it as a recommendation.

hybrid turret
#

isn't that what Syntaxerrors are for?

worldly ingot
#

The Bukkit API doesn't support this, no

smoky oak
inner mulch
worldly ingot
#

No

worldly ingot
#

But you could use a library like Luck's Commodore to use Brigadier which would support that

smoky oak
#

a command library but idk what exactly it does

worldly ingot
#

Brig is Mojang's command library

young knoll
#

It’s Mojangs command system

#

That they have made open source

worldly ingot
#

We just don't expose it in Bukkit is all

young knoll
#

Because choco is bad

worldly ingot
#

It's hard!

inner mulch
#

ok :( So implementing something like this would be worth it?

worldly ingot
#

Probably not

floral drum
#

hi mr chocolate

worldly ingot
#

Unless your commands are very complex (LuckPerms for example), it's probably not at all worth switching to a Brigadier based command system

#

It's a totally different way to write commands and significantly more complex

young knoll
#

Hey

#

It works with bedrock tho

inner mulch
#

ok

#

?

#

you can do something like this in bedrock?

worldly ingot
#

Sometimes I don't like when Coll opens his mouth aPES_MadTyper

floral drum
#

does mr chocolate hate me

worldly ingot
#

No I was just mid conversation lol

smoky oak
#

actually

#

why can't we just have an event for tab completion or smth

worldly ingot
#

We do

smoky oak
#

no like

#

when you press tab

worldly ingot
#

We... do...?

smoky oak
#

wait rly?

smoky oak
#

oh interesting

worldly ingot
#

If you mean completing player names in the chat box without a command, that's not server driven and so we can't have an event for that

smoky oak
#

yea u might wanna use that then lol

worldly ingot
#

pls no

#

If you're writing your own Command then you'll want to use a TabCompleter :p

smoky oak
#

well ye, tab completer to return a list of online player names

#

you can intercept it then right?

young knoll
#

Don’t we have methods to add custom chat completions

worldly ingot
#

Yes

young knoll
#

Or is that downstream

smoky oak
worldly ingot
#

Both

young knoll
#

You don’t need the event unless you wanna mess with other commands or something

#

You can accomplish everything with just TabCompleter

smoky oak
#

tab completer doesnt allow you to cancel the tab completion, does it?

young knoll
#

What do you mean by cancel

worldly ingot
#

You could remove all the suggestions

smoky oak
#

no like

#

urgh whatever lol

young knoll
#

^ just return an empty list

smoky oak
#

its what the guy above said

worldly ingot
#

Well that's what cancelling would do

smoky oak
#

to show args but not allow em to tab

worldly ingot
#

Oh

eternal night
worldly ingot
#

No, that's not how that works

young knoll
#

I don’t think the event can do that either

eternal night
#

I doubt anything can lol

young knoll
#

If the client can see a suggestion, it can use it

eternal night
#

yea

worldly ingot
#

There are argument context suggestions, Bukkit just doesn't expose Brig to be able to use those

young knoll
#

Not yet

smoky oak
#

cant you send a packet with 'this is in your chat' if you make changes to a command youre typing?

young knoll
#

No

eternal night
#

no lol

young knoll
#

There is no “this is in your chat box” packet

eternal night
#

that would be fucking insane lmao

young knoll
#

Omw to make a plugin that constantly overrides the chat box with deez nuts

#

You wanna tpa to someone? Too bad deez nuts

eternal night
#

omw to have the server switch your chat right before you send it, have your client sign it, have someone report you for it, get you banned

smoky oak
#

i mean it should only work when you make changes to the message

#

not when you send it

compact haven
#

y’all this does exist

#

it’s a json run action

eternal night
compact haven
#

it’s not the same but it’s similar

eternal night
#

Are you talking about the click action on a component that suggests a command ? KEKW

compact haven
#

mhm

eternal night
#

not a packet tho

compact haven
#

correct

#

not a packet

smoky oak
#

isnt everything a packet

compact haven
compact haven
smoky oak
#

ah

compact haven
#

client doesn’t say “hey I clicked this” then the server processes it and sends “well hey there’s a suggest command thingy here, this is your new chat box”

floral drum
#

nerd

sick edge
#

Does someone know how i can give infinity potion effects (Am using Int.MAX right now but it still shows the time)

sick edge
#

Thx my bad

spare hazel
#

im so fucked
i forgot to make a backup of my custom items plugin and i already sent the laptop that contained it to heaven

celest notch
#

Am i allowed to ask resource pack questions here because im using a resource pack in my plugin

#

Hello?

spare hazel
lofty badge
#

who can help me with wpf? i need make a simple program with animations

spare hazel
#

Cannot resolve file 'C:\Users\xxxxxx\Downloads\plugin\src'
how can i fix this

sick edge
#

When a player drinks milk I have a handler that reapplies some potion effects but now I get a Ticking Player error. Do I have to schedule the reapplying of the effects or can I do it through the event or smth like that? (Im on Paper if that may cause it)

slender elbow
#

reproduce on spigot. does it err on spigot? if yes, share the error + code; if it doesn't, go to paper discord and share the error + code in there

young knoll
#

Probably best to just delay it a tick and see if that works

hybrid turret
#

damn

#
Caused by: java.lang.ClassCastException: class org.bukkit.material.Door cannot be cast to class org.bukkit.block.data.type.Door (org.bukkit.material.Door and org.bukkit.block.data.type.Door are in unnamed module of loader java.net.URLClassLoader @108c4c35)
        at com.github.shioku.serversystem.listeners.player.KeyListener.onUseKeyOnDoor(KeyListener.java:68) ~[?:?]
        at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        ... 22 more
#

that's the exception that's thrown

#

oh- wait

#

nvm, same thing with Openable

#

line 68 is one of these depending on what is correct now

Door ironDoor = (Door) state.getData();
Openable ironDoor = (Openable) state.getData();
slender elbow
#

don't use getData

#

use getBlockData

worldly ingot
#

Unsure why you have a BlockState too

young knoll
#

Yay confusion

#

Some blocks have both a state and data class

worldly ingot
#

BlockState = Minecraft block/tile entity
BlockData = Minecraft block states (e.g. chest[facing=north])

#

Very unfortunate naming scheme but it is what it is

young knoll
#

Mojang also doesn’t bundle the states into a single object

hybrid turret
grim ice
#

someone did that

#

in roblox

#

the exact same thing pretty much

hybrid turret
#

uhm wait what i'm confused now

worldly ingot
#
Block block = // ...
Door door = (Door) block.getBlockData();
door.setOpen(true);
block.setBlockData(door);```
hybrid turret
#

yep, that was it

#

Now I only have to fix the problem wth the key only being saved in the bottom block

#

any ideas? :/

worldly ingot
#

Door has a half state to get whether it's the top or bottom half. You can use that to call Block#getRelative(), then do the same thing to that state

#

If you have the top half, get relative to BlockFace.DOWN. If you have the bottom half, get relative to BlockFace.UP

tranquil dome
#

How do I get the TextComponent in the AsyncPlayerChatEvent? I'm using both the spigot api and the bungeecord api.

#

I need to get the font that was set to the text component

worldly ingot
#

You can't. Bungee components haven't really extended beyond sending messages to players, and books. So at the moment there's no API for it. I'm adding a lot more API but even that PR doesn't have support for AsyncPlayerChatEvent because it's such a nightmare to implement it in lol

tranquil dome
#

Aw

#

Is it possible to get the server texture pack's font through spigot?

worldly ingot
#

If you want the data in a font, no. The server doesn't care about that information, only the key of the font

#

Resource packs can provide multiple fonts as well. It's not just one singular font

shut shoal
#

Hello how about, I wanted to make a query, I last Friday uploaded a premium plugin but it is still waiting for approval means that I must wait longer or there is something that does not comply, or they themselves warn me if something is missing to solve?

young knoll
#

You will get notified if something is wrong

#

Just gotta wait

shut shoal
#

How much does that take?

tranquil dome
#

I see, I guess the only solution would be to have users upload their texture pack to my plugin folder and write something to read that out.

shut shoal
#

I uploaded a zip file of the plugin with a gift from schematic, that's fine or i should upload only the plugin because it is an inclusive that gift of the plugin

hybrid turret
#

Can I get the block above the blockPlaceEvent.getBlock()?
As, iirc, the CustomBlockData-API just saves the data to the chunk with the coordinates as key (or something like that) so I need the coordinates above to save it to the whole door. otherwhise the check for the key will fail.

young knoll
#

Yes

#

You can use getRelative to get the block above

hybrid turret
#

I see thank you very much :D

river oracle
young knoll
#

It can vary a lot

#

Depends on how much is in the queue and how busy the reviewers are with other things

valid burrow
#

anyone here know how to work with dates

young knoll
#

what about them

valid burrow
#

they suck

#

mainly because there is java.util.date and java.sql.Date

#

and they both are the same

#

but also arent

#

well

#

anyone have an idea how i can convert a Date into the remaining time until that date

#

cant find anything

young knoll
#

Date.toInstant

#

Duration.between(Instant.now(), your date as an instant)

valid burrow
#

oh thats pretty simple

#

thx

#

oh no its not simple :D

#

at java.sql.Date.toInstant(Date.java:316) ~[java.sql:?]

#

forgot its a fk sql date

#

i hate all of this

young knoll
#

Ah

#

I'm sure there is some way to convert it

mystic herald
#

yeah

valid burrow
#

it

#

its simple but still

#

its fking anoying

#

like

#

why cant they just use the same object

#

if they are both imported from java

mystic herald
#

yeah

valid burrow
#

WHY ARE THEY NOT THE SAME

mystic herald
#

YEAH

young knoll
#

I didn't even know sql data was a class

#

:p

sterile token
#

I would like to get memory refreshed about how i can achive this structured using typed lambda arguments? I will use it for my menu api. I would like to achive an structure similar to the next:

MenuAction action = ((MenuClickEvent event) -> {
    event.getPlayer().sendMessage("Clicked item " + event.getSlot() + " from " + event.getMenu().getView().getTitle());
});

MenuItem item = ItemBuilder.of(Material.BLA).action(action).build();
eternal night
#

respectively, any interface with a single method to implement

river oracle
#

Yeah but functional interface is lingo

eternal night
#

the annotation ?

#

I figured you meant the @FunctionalInterface annotation which

#

ah

#

yea

#

that is that then

#

talkiing about the same thing NODDERS

warped shell
#

The error says I cant cast a double to an int, but I saved the data as an integer

#

and read it back as an integer

eternal night
#

snakeyml might just always parse back a double

warped shell
#

its json

eternal night
#

types are not really guaranteed to remain the same

#

oh

warped shell
#
{
  "LastRound": 4,
  "LootLocations": "MORIA:-27:242:229_MORIA:-27:242:235_",
  "Dungeon": "MORIA",
  "Level": 1,
  "SpawnLocations": "MORIA:-16:245:251_MORIA:-18:247:221_MORIA:-42:245:219_MORIA:-40:241:251_MORIA:-26:242:232_"
}```
#
        if(map.containsKey("Level")){
            level = (int) map.get("Level");
        }```
eternal night
#

I mean, might still be the same issue ?

warped shell
#

ye

eternal night
#

Cast to Number and run intValue

warped shell
#

aight

#

tbh i didnt know Number was a class lmao

eternal night
warped shell
#

ye its saving as a double

#

thx lol

warped shell
#

lmao

celest notch
#

i'm trying to make custom blocks using a resource pack and armorstands with retextured player heads, the custom player head works when i hold it in my hand or offhand but when i put it on an armorstand it reverts to the default steve head texture how do i fix this?

Also is related to spigot because im spawning the armorstands with a plugin

hybrid turret
#

I did it! The key thing works now! (It just looks a bit asynchronous how the 2 halfs of the door open, is this fixable?)

eternal oxide
#

stream

#

db access is VERY slow

#

ns for sorting the list, seconds for counting the db

eternal night
#

loaded into list at server start gives me geol (pepe_hand_heart_2) flashbacks KEKW

celest notch
#

so all the support ppl doing something else rn?

eternal night
#

Yep

celest notch
#

k i'll just wait then

#

hows yall day going

hybrid turret
#

How do I disallow an iron door to be opened by redstone?

quaint mantle
#

guys is this okay?

SomeClass <- an interface
AbstractSomeClass impls SomeClass <- abstract class
SomeClassImpl extends AbstractSomeClass

But in AbstractSomeClass I have a bunch of util methods that are for the child classes

lost matrix
lost matrix
celest notch
#

code's pretty basic it just spawns an armorstand and sets its head to a player head with the correct custommodeldata

lost matrix
#

Why do you use heads for that?

celest notch
#

so they can be put on armorstands

shadow night
#

I thought you can put anything onto anything from code

lost matrix
#

You can put anything on an armorstand

celest notch
#

is there an issue with using a player head though?

lost matrix
#

Sounds like it might be an issue. Or the model data is not applied properly.
One classic would be forgetting to set the ItemMeta back on the ItemStack.

celest notch
#

i definitely did that its not a problem with the plugin its more likely to be a problem with resource pack as i can do it manually and it still doesnt work

#

i can send resource pack if you want

lost matrix
#

Use a stick and check if it helps

hybrid turret
#

thanks lmao

glad prawn
#

cast

young knoll
#

If you go to the doc linked one of the first methods

#

Is getTrim

#

Cast the meta to armor meta

#

I mean obviously you should check first

#

But yeah

#

Mhm

glad prawn
#

ArmorTrim armorTrim = ((ArmorMeta) player.getInventory().getHelmet().getItemMeta()).getTrim();
check for not null then getMaterial()

remote swallow
#

Kek visual bukkit

quaint mantle
river oracle
#

Why wouldn't it be

#

I think you should figure out an answer to that first

quaint mantle
#

like ik its allowed by why is it allowed

#

my only guess is that from an API standpoint, the API user will not need to know about the util methods

#

that I added to the abstract class

tribal quarry
#

is anyone familiar with TAB? to get it sort "colorful" placeholders?

#
  sorting-types:
  - "PLACEHOLDER:%bedwars_player_prefix%:§cR ,§9R "
#  - "PLACEHOLDER:%bedwars_player_prefix%:§7[Spectator] ,§cR ,§9B ,§aG ,§eY ,§bA ,§fW ,§dP ,§7G ,§7 ,"
  - "PLACEHOLDER_A_TO_Z:%bedwars_player%%"

this is what i tried so far

#

no luck

#
  sorting-types:
  - "PLACEHOLDER:%bedwars_player_prefix%:&cR ,&9R "

still

#

i tried removing the space, but still getting the same results

#

R Groovy should move to top, which remains on bottom

#

thats tab 4.0.6 btw

glad prawn
#

huh wat is output of that placeholder

tribal quarry
peak depot
#

Hey, I got an little CoinAPI module that I put in my maven now if I try to use it as an dependency in another project this error comes up: https://paste.md-5.net/quzomifimu.rb I got the api as an jar exported and its also in the plugin folder

glad prawn
tribal quarry
#

nvm, created an additional placeholder and fixed it, should i open an issue on TAB's repository for this?

young knoll
#

Well

#

Read it

orchid gazelle
#

how do I control speed/length of Vectors? If I were to multiply my vector, it would multiply in speed but I don't want that

young knoll
#

What do you want then

orchid gazelle
#

I want it to just continue in one direction

#

infinitely

#

with slow speed

fossil lily
#

If I change an item's meta, do I need to put it in the inventory again to update it?

orchid gazelle
young knoll
#

Yeah

golden wren
#

which event is fired when dirt becomes grass when the dirt is next to grass? the three events i can see are BlockGrowEvent, BlockFormEvent and BlockSpreadEvent and i have no clue which of the three it is

orchid gazelle
young knoll
#

Don’t think so

young knoll
#

Could be wrong though

orchid gazelle
young knoll
#

Yes

golden wren
orchid gazelle
#

alright thanks

sick edge
#

If I want to add some custom crafting recipes only for specific players how could i do that I dont really see where I can change the outcome in a handler

sick edge
young knoll
#

PrepareItemCraftEvent or CraftItemEvent

sick edge
#

Yeah but I cant change the outcome of PrepareItemCraftEvent or am I missing something and the other is a click event

#

Wait im dumb I can

#

Theres a custom Inventory for that stuff

young knoll
#

Yeah you can get the inventory and setResult

steady yoke
#

Does anyone know why internally on the bungee servers (not the main one) the users' IPs are the same as the server? How can i fix this?

eternal oxide
#

did you enable IP forwarding on Bungee?

steady yoke
#

that's why?

lunar mica
#

Any idea why in BukkitRunnable "return;" didnt work but cancel() with local TaskId work?
just asking

delicate lynx
#

well what are you trying to do?

lunar mica
#

just for cancel task

mortal hare
#

what is the regular expression of the plugin name?

young knoll
#

Well

#

Return doesn’t cancel

delicate lynx
#

then use the cancenl method to cancel the runnable...?

mortal hare
#

im pretty sure plugin.yml wiki documentation isnt correct about allowing (0-9,a-z,A-Z,_) characters only in plugin names

lunar mica
mortal hare
#

because i've tried hyphen before and it works just fine for a plugin name

young knoll
#

It ends the current execution

#

It doesn’t stop the next execution from happening

lunar mica
#

alright thanks

solemn frigate
#

Might be a stupid thing to ask, but in the following code:
getServer().dispatchCommand(getServer().getConsoleSender(), "d"); System.out.println("t");

does the code wait for the command "d" to be fully executed before it prints "t"?

inner mulch
#

How do I use my own Plugins as an API in other plugins ? (i couldnt really find any in-depth ressources)

solemn frigate
#

Okay thank you

worldly ingot
#

Then in your plugin.yml be sure to add it to your depends

inner mulch
worldly ingot
#

Yeah, build your project with mvn clean install and it will install to your repository with the groupId, artifactId, and version you've set

#

Then you can use those in your dependent project

inner mulch
#

okay, thank you

grand flint
#

What would be a good way to protect a generated structure, an optimized way because it would need to protect hundreds of structures, these are generated with the world generation with datapacks

fluid cypress
#

i can do player1.openInventory(player2.getInventory()) to see and modify someone elses inventory, i can even do player1.openInventory(player2.getEnderChest()) and modify that, but, is there a way to do the same with armor slots? without having to create my own class, inherit from Inventory and all that thing

paper viper
#

couldn't you just check block location if its within some bounding box if its a rect prism

fluid cypress
wet breach
slender elbow
#

such as the infamous dodecahedron

worldly ingot
#

Bukkit's bounding box doesn't. It's just a min/max x/y/z

slender elbow
#

concave dodecahedron

ivory sleet
smoky oak
#

question:
no main manifest attribute, in .\InputTranslator-1.0-SNAPSHOT.jar
but

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>3.3.0</version>
  <configuration>
    <archive>
      <index>true</index>
      <manifest>
        <addClasspath>true</addClasspath>
      </manifest>
      <manifestEntries>
        <mode>development</mode>
        <url>${project.url}</url>
        <key>value</key>
      </manifestEntries>
drowsy helm
#

decompile and see if its being put in the dir

smoky oak
#

i just hardcoded the path now

#

bleh

#

'example code' my ass lol

grand flint
#

Maybe I could use the worldguard API?

deep herald
#

@rotund ravine how would i code it?

#

cause cmd map is annoying to use

rotund ravine
#

Sec

#

?jd-s

undone axleBOT
deep herald
#

i dont understand java docs

rotund ravine
deep herald
#

i just wanna put it in my plugin lol

rotund ravine
#

Use the event methods, not whatever is in the commandmap

deep herald
#

u realise im trying to block the tab completion

rotund ravine
#

I did not

deep herald
#

LOL

eternal oxide
deep herald
compact haven
#

wait Player#sendMessage with a string is deprecated?

#

since when? lmao

rotund ravine
#

In Paper

compact haven
#

ah

eternal oxide
#

not in Spigot its not

compact haven
#

sounds like a ?whereami moment but I won't complain

#

so wait, are you trying to just block all tab completions?

#

or just the ones like /plugin:<tab>

#

beautiful, thank you

echo basalt
#

any way I can omit all the try catches for jdbc stuff?

#

looks ugly to me

#

I can do it for preparedstatements but resultsets are annoying

remote swallow
#

Lombok

echo basalt
#

I mean inside a lambda

remote swallow
#

Painfully

echo basalt
#

oh fuck off

#

pls don't force me to wrap ResultSet

#

but remove all the shitty throws SQLException

worldly ingot
#

Could alternatively write a new consumer whose accept() method throws SQLException

echo basalt
#

oh shit yeah that's

#

a thing

zealous scroll
zealous scroll
#

Every time I run the server it's random ones. Though the ones I'm noticing most are the Block Place/Break events and the normal Piston and Extend/Retract events

ivory sleet
#

frost, do you know anything about gen zgc?

wet breach
ivory sleet
#

yeah, I met the guy who is the project leader for it today, sounds like they have done a lot since it was first introduced as an idea merely

wet breach
#

If i recall it does alright with mc now i think. Aikar was one of the few that ran a bunch of tests with it

echo basalt
#

grr why can't we have interfaces with fields woeisme

ivory sleet
#

yeah back some time ago

echo basalt
#

well technically we can but it's funky

worldly ingot
#

Interfaces with fields are abstract classes lol

ivory sleet
#

or documented, would be very interesting

echo basalt
#

yeah but you can't extend multiple abstract classes

ivory sleet
#

the diamond problem

worldly ingot
#

No, you cannot

#

And for that same reason, interfaces do not have fields

echo basalt
#

pain

worldly ingot
#

No multiple inheritance for you

wet breach
#

Not that i know of. Last he did a test it acted weird when it came to high memory allocations

echo basalt
#

I could make like a proxy class

#

but ehh

#

effort

wet breach
#

Otherwise it did better then the default gc

ivory sleet
echo basalt
#

easy fix

ivory sleet
#

which is why they sorta made gen zgc

wet breach
#

For mc that is. But mc is a weird application in itself too to be fair lmao

echo basalt
#

just leave a todo and let the later me figure it out

ivory sleet
#

i suppose, since some objects dont need to be checked up on as often

#

yeah true frost

wet breach
#

Maybe i could do some tests this weekend with it

ivory sleet
#

well I m gonna see if I can get a good zgc impl for minecraft servers coming weeks, I know you're knowledgable in these kinds of fields, you wouldn't mind if I kept u up-to-date?

wet breach
#

Dont mind at all

ivory sleet
#

👍

remote swallow
#

I want to believe zgc stands for ze garbage collecter but it probably doesnt

ivory sleet
#

lol yeah, I mean maybe

#

you could pull a joke regarding the Gen ZGC also lol cuz Gen Z

echo basalt
#

I think I managed to break my gradle env

#

average gradle moment

#

might need to restart my pc

wet breach
#

Sort of like reorganize where are all the pointers are at

ivory sleet
#

ah yeah

#

so I know there is some work where java is caching boostraps since the jvm bootstrap process tend to follow quite the same procedures

wet breach
#

Contiguous memory is generally always better instead of being split all over the place lol

ivory sleet
#

as by an optimization to increase jvm bootstrap time

#

yea frost true

wet breach
#

And then maybe at some point java can satisfy the people who want java to truely release memory back to the system lol

ivory sleet
#

foreign mem api might do that on a basic level?

wet breach
#

Maybe. Currently and has always been the case once java asks the system for memory java wont give that memory back for the system to use

#

Minor issue these days given servers have gigs of ram now

ivory sleet
#

fair enough

wet breach
#

But you know some people are still picky with the free memory on a system lol

ivory sleet
#

well I got to know recently that serial is becoming extremely popular

wet breach
#

I do like how far java has come in terms of development 🙂

ivory sleet
#

yea its very nice

wet breach
#

Interesting that there will be developers who will have never experienced the horrors of old java lmao

ivory sleet
#

oh yeah def

zenith gate
#

!paste

#

?paste

undone axleBOT
quaint mantle
#

And libs folder 💀💀

celest notch
#

who even uses the libs folder anymore maven is just easier

echo basalt
#

fun times

thin iris
#

how do i turn an image into like a map / on item frame

echo basalt
#

small little painful process called uhh

#

the map api

#

With packets, you need to convert all the colors from the rgb spectrum to the map palette

#

With bukkit, you just make a map view with the api and render the image

thin iris
#

i’m trying to put my ai image bot into mc maps

quiet ice
#

Are you talking about all these projects that are not on a maven repo? This is still standard practice

quiet ice
#

Yeah all these things have been a non-issue for decades. Lambdas are the most recent addition of the lot

#

I personally did not use lambdas when I started as I had no idea how they work and was too scared to figure out

#

May even have been J7.

#

Preview releases are a J9+ thing

#

So you are right with J8 then. Although I could swear that J7 introduced it and J8 introduced the needed utility classes such as consumer, supplier, etc.

#

But I might confuse it with invokedynamic

#

Internet says Java 8. Indy was introduced in J7 - lambdas probably were an afterthought afterwards

halcyon hemlock
#

Spigot 👍

#

wdym

#

I want to make some kind of method which returns the same as the getHandle method

#

maybe like

#

MobUtils#getHandle(LivingEntity) not sure how I'd do it though

wet breach
#

Personally i dont really use lambdas except couple of things lol

mellow snow
#

someone know an actionbar api?

#

Because I need to send an action bar like this:
Api.sendActionBar(target, ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("venendo-ammanettato")))
Api.sendActionbar is an example

shadow night
#

player.spigot().sendMessage(...) allows you to send action bars

mellow snow
#

and I cant use ChatColor

vast raven
#

I'm making a handle the protocol in order to let a player see tilentities in a threshold

#

When updating from 1.12 to 1.17, I'm getting some issues sending player the packet

shadow night
vast raven
#

They told me that starting from 1.17 you have to send the entire chunk to show a send a packet of a tile entity

#

But even sending the chunk it doesn't work

mellow snow
#

or he give me an error

shadow night
mellow snow
#

but idk why the code give me an error

shadow night
#

Show the code and the error then ig

mellow snow
#

ok wait a second

#

p.spigot().sendMessage(p, ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("venendo-ammanettato")));

shadow night
#

That's not how it works

#

Give me a minute

mellow snow
#

o

#

wait

#

I miss a thing

#

wait

#

wtf

#

Now it works

#

p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("venendo-ammanettato"))));

shadow night
#

Yes

mellow snow
#

Yesterday I made the same thing

#

OO ok

#

probably import the wrong class

shadow night
#

Maybe

mellow snow
#

Thanks for help

#

I'm stupid

covert silo
#

Setting up Testing Environment

vast raven
#

?paste

undone axleBOT
lost matrix
lost matrix
lost matrix
halcyon hemlock
#

Actually that's a great Idea

#

Or maybe class generic thing

#

getHandle<EntityZombie>(entityLiving)

lost matrix
#

This results in an unchecked cast

halcyon hemlock
#

If you're talking to me

lost matrix
#

You cant really make this method generic because of the uncertain relationship between
the bukkit and the nms entity.

#

So lowest possible member like zacken schowed

halcyon hemlock
#

Yeah let me try that

vast raven
vast raven
halcyon hemlock
#

What is even going on

lost matrix
lost matrix
# halcyon hemlock Why the hell does this even work 😂
public Entity handle(org.bukkit.entity.Entity entity) {
    return ((CraftEntity) entity).getHandle();
}

This is probably the best you can do. Afterwards you can always do an instanceof check and cast.
Or if you really want to use the generic method, at least add type constraints to the generic type
and if you want to be safe then you need type inference from a class parameter and a class type check.

quiet ice
halcyon hemlock
halcyon hemlock
#

I usually just need to get the handle for checking if the nms class implements an interface

lost matrix
# halcyon hemlock I think It's good enough for me
public <T extends Entity> T handle(org.bukkit.entity.Entity entity, Class<T> nmsType) {
    Entity raw = ((CraftEntity) entity).getHandle();
    if(!nmsType.isInstance(raw)) {
      throw new IllegalArgumentException("Missmatch of nms and bukkit type.");
    }
    return (T) raw;
}

This would be with constraints and inference.

halcyon hemlock
#

For example, like this:
I would just check

EntityZombie zombie = BukkitWrapper.getHandle(livingEntity);
if(zombie instanceof ISlayerMob iSlayerMob){
  println!("hello");
}
lost matrix
halcyon hemlock
#

I did get what you mean by the generic stuff

#

I'll keep it in mind

mellow snow
#

I have a problem with the handcuffs plugin. Practically everything works, but when the person is handcuffed to five hits he only gets one. What could be the problem?

lost matrix
# mellow snow I have a problem with the handcuffs plugin. Practically everything works, but wh...
  • The plugin doesnt properly count the hits
  • An exception is being thrown on the first hit
  • Wrong configuration
  • Using /reload or other garbage like plugman
  • A hit counts 5-fold
  • A recursive call of the EntityDamageEvent which triggers 5 hits in one tick
  • It doesnt count hits but damage and one hit did 5 damange
  • The action to apply the actual hits to a player was faulty
  • An old entry of a hit counter was not removed

And it could go on for a while

mellow snow
#

I'll try to stop and restart the server

#

It'isnt plugman

mellow snow
#

Wait It's the safe-teleport

vast raven
#

manda il codice

lost matrix
# mellow snow Nothing of this

I was actually being sarcastic with this list, to show you that it could be literally anything.
We needed more infos like code/exceptions to actually help.

vast raven
vast raven
undone axleBOT
mellow snow
vast raven
mellow snow
vast raven
#

sto per avere un infarto

#

comunque ripeti il problema

mellow snow
#

prende solo una hit ogni tanto

vast raven
#

cazzo vuol di una hit ogni tanto

mellow snow
#

ok ho fixato

#

era quello schifo di essentials buggato

vast raven
#

zio

#

?learnjava

undone axleBOT
vast raven
#

sono del partito NSSJ mi dispiace

mellow snow
# vast raven zio

non è questione di impare java, è questione che il player per lasciarlo li viene tippato ed essentials ha la merda del safe teleport di base e si buggava per quello

#

il plugin funziona tutto

vast raven
#

però se usi quel codice su un server ti conviene andare in cambogia

#

fidati impara java prima di andarci su spigot

hushed spindle
#

how would i go about checking if a projectile shot is one of the extra projectiles from multishot?

#

checking if shot from crossbow and if pickup status is disallowed?

vast raven
lost matrix
#

So with the metadata and the usual data watcher wrappers

#

Alright let me check

grim ice
#

do i install intellij

#

im thinking of jus eclipse

lost matrix
#

I got the serializer and all, i just cant figure out the data index for it...

#

*If this is really part of the metadata. Im suspecting there is another packet for this.

#

Already checked. Paintings dont have that either

#

Im looking at that right now as well XD. But it seems so odd to have a fp rotation instead of a discrete one...

grim ice
#

reasons on why intellij >

#

?

#

i mean, i never used eclipse

#

so

#

idk if its better or not

lost matrix
shadow night
#

When I look at eclipse I get the feeling it wasn't updated for ages

lost matrix
#

Alright, good to know

grim ice
#

or at least the ones that make a difference

lost matrix
#

I was thinking about that but im assuming the client just snaps it in place

vapid anvil
#

intellij just feels more modern tbh

#

and it has some incredibly good refactoring tools

lost matrix
# grim ice what are those features?

Static code analysis (+ jetbrains annotations)
More integrated build tools
And then for me the built-in profiler and syntax support for SQL are quite nice to have

#

This stuff just helps so much

buoyant viper
#

onJoin(EntityDeathEvent

shadow night
#

Lmal

shadow night
lost matrix
#

Yeah i rewrote that in my sandbox plugin real quick

shadow night
#

"This value is null and will produce nullpointerexception"
Mf this shit literally has an annotation that injects the value

mortal hare
# lost matrix

yea static code analysis + jetbrains annotations are a godsend

lost matrix
mortal hare
#

its less error prone to write non faulty code

lost matrix
#

DB support is insane

#

It checks your queries for syntax errors and if you connect it to your DB then it can also
type check everything with your current schema

lilac dagger
#

that's nice

lost matrix
#

Oh. And the MC dev plugin for Intellij. Also a good selling point.

sick edge
#

Is there a class that contains all mobs that have a spawn egg so that I can easily get a list of all spawn eggs (Mobs seems to have a bit more) or should I just filter all theMaterials once for example when my plugin starts or a fixed list I create myself with all materials?

tall dragon
#

yea i think filtering thruh all materials and grabbing the ones ending on "_SPAWN_EGG" should do it

#

as far as i know there is no way to get all monster eggs in the api

sick edge
#

An if I run it once every time the plugin runs with a static list or smth like that should be the best so its a bit version dynamic right?

tall dragon
#

yea just grab them when the plugin enables

shadow night
#

What if my plugins main class has a constructor

tall dragon
#

pretty sure an error will be thrown

shadow night
#

Why

tall dragon
#

hmm it depends if the constructor has parameters

#

if its an empty constructor it would work i guess

#

cuz the pluginloader cannot pass anything & woulnt know what to pass

scenic onyx
#

?paste

undone axleBOT
halcyon hemlock
#

sup everyone

scenic onyx
#
public static FileConfiguration config = new FileManager("config.yml", QuestAddon.getInstance()).load().getConfig();

    private static String DATABASE_URL;
    private static String IP = config.getString("MySQL.IP");
    private static String PASSWORD = config.getString("MySQL.Password");
    private static String USERNAME = config.getString("MySQL.Username");
    private static String NAME = config.getString("MySQL.Name");

    public static void load(QuestAddon plugin) {
        try {
            File dataFolder = plugin.getDataFolder();
            if (!dataFolder.exists()) {
                dataFolder.mkdirs();
            }

            DATABASE_URL = "jdbc:mariadb://"+ IP + "/" + NAME + "?useBulkStmtsForInserts=true";

            Connection connection = DriverManager.getConnection(DATABASE_URL, USERNAME, PASSWORD);

            PreparedStatement statement = connection.prepareStatement("CREATE TABLE IF NOT EXISTS quest_completed (uuid VARCHAR(36), questName VARCHAR(255))");
            statement.executeUpdate();
            statement.close();

            connection.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    private static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(DATABASE_URL, USERNAME, PASSWORD);
    }
#

how i can redolve it?

mortal hare
scenic onyx
#

I have it, i am hosting it

eternal night
#

what do you mean you are hosting the driver

grim ice
#

man

scenic onyx
#

I have hosting it in my dedicate

#

??

eternal night
#

we are talking about the driver

#

not the database itself

mortal hare
#

you're hosting mariadb server, but you need a .jar file with mariadb driver in order for java to know what kind of database to connect to. JDBC is just an API, JDBC driver jar does all the SQL connection for you wrapped inside JDBC api calls

mortal hare
#

i havent touched RDBMS for a while, how to load the driver alongside the spigot server though? Is there any functionality provided by spigot to load those drivers or you need to manually load with classloaders?

scenic onyx
#

I think you have to open the file and it installs the drivers, at most I create a lib in the plugin and put it as a library

#

is a fork of MySQL mariadb

eternal night
#

but they are not requesting the mysql connector

mortal hare
#

no way

#

i've managed to write 10+ classes

#

and it built succesfully

#

and it works

tall dragon
#

lies

mortal hare
tall dragon
#

its gotta break somehwere!

mortal hare
#

idk it works as i expected rn

sick edge
#

Is there any good way to filter between normal and hostile mobs?

ocean hollow
#

is there a way to remove the black color on an entity when it is in a block?

#

I mean this, maybe there is a method that allows you to remove this dark color

lilac dagger
kind coral
#

how to check if an item is wearable?
such as elytra and armors? do i need to make a utility class?

lilac dagger
#

this seems like the job of a switch

kind coral
#

or just a list with some items and then a contains

lilac dagger
#

it's slower than a switch

#

a switch is log n

kind coral
#

also true but still you'd need to update it every version in both ways

#

i am asking if there is a spigot way

lilac dagger
#

you can look in Material and see if there's any materialdata

sick edge
lilac dagger
#

some items have common material data like wallsign

kind coral
#

sadly no they do not share information

sick edge
worldly ingot
#

EntityType#getEntityClass() will get you the class for that entity. You can check if it's an Enemy

sick edge
#

Ah perfect thats what its called thx

worldly ingot
#
List<EntityType> hostileTypes = new ArrayList<>();

for (EntityType type : EntityType.values()) {
    if (type.getEntityClass().isAssignableFrom(Enemy.class)) {
        hostileTypes.add(type);
    }
}```
sick edge
#

And that also works with the abstract ones right?

dry hazel
young knoll
#

Needs more streams

lilac dagger
#

stream is a choice

echo granite
gritty juniper
#

Just switching from gradle to maven seems to do the trick for me, didn't change anything else.

worldly ingot
#

You don't always have to use a stream for things

#

Especially for such a trivially small task

#

But yeah, sure, do what'cha want

young knoll
#

It's more of a lifestyle

sick edge
gritty juniper
sick edge
gritty juniper
#

IDK bro, on Gradle it wouldn't send the skull and crossbones in chat it would just send some weird characters, Maven just made it work.

sick edge
#

Did you have smth like this:

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
}
gritty juniper
#

Don't think so.

hasty prawn
#

Yeah that's what Emily meant when they said compiling with utf-8

onyx fjord
#

is anyone aware what this property does in texture properties?

#

and when it's false?

young knoll
#

afaik no

worldly ingot
#

No, we don't

smoky oak
#

depends

#

are you sanitizing your input

worldly ingot
#

^

#

That's why we use PreparedStatements

#

It handles the sanitization for us

#

idk what API that is but surely there should be some way to use prepared statements for that

ocean hollow
#

I really can’t figure out how to fill the matrix with empty elements