#help-development

1 messages · Page 1215 of 1

lilac tide
smoky oak
#

maybe-not-optional a update to java 21

smoky oak
#

buildtools is available as jar file

#

look on the page for the shell args

lilac tide
#

It doesn't have a pom.xml file or whatever gradle file is

eternal oxide
#

buildtools is a jar or an exe

#

?bt

undone axleBOT
smoky oak
#

no this is about the github project

eternal oxide
#

oh

#

yeah getting convos crossed

smoky oak
#

but you should just be able to make a pom.xml

eternal oxide
#

just import from Git a basic project

lilac tide
#

Do I put anything the the pom file or leave it blank

smoky oak
#

well the usual stuff

lilac tide
#

ok

smoky oak
#

spigot dependency and plugin name specifically

lilac tide
#

is it easier to do gradle or maven

smoky oak
#

eh. i do maven bc im used to it. i honestly cant tell

lilac tide
#

Ive never done either so do you know how long it will take to make the file?

eternal oxide
#

if I were you I'd not touch that BoatRace plugin

lilac tide
#

why

eternal oxide
#

its package names are all wrong

lilac tide
#

ah

eternal oxide
#

you will have to spend so much time just fixing every package

lilac tide
#

I can't find any other ice boat plugins literally anywhere

#

Ill just figure it out thanks for warning me tho

eternal oxide
#

with releases

lilac tide
#

thanks

left jay
#

hey so when i imported auraskills into my server, why are all the files different and also .ymls instead of .javas?

sullen marlin
#

Because that's source code not a compiled plugin

left jay
#

does it matter which i use in my server?

drowsy helm
left jay
drowsy helm
remote swallow
#

You would need to use a build system to compile it

drowsy helm
#

Auraskills comes compiled, just download that

wet breach
left jay
#

and i dont really know how to work with those

drowsy helm
#

Where are you downloading it from

#

It's a jar

#

or are you trying to make your own modifications?

left jay
drowsy helm
#

clone it from github

left jay
drowsy helm
#

I would really recommend watching a video on java basics and how to compile a jar

trim lake
#

HI, I have some coding practice question. When Im creating object based on file data. Should I create the object and just give that data true constructor or is just better to give constructor the file and get that data and assain fields insde the object it self? Constructor is kinda long bcs of that lol. Its mineable block so then Im saving that to map if all is set.

left jay
drowsy helm
#

or just serialize is properly

trim lake
# drowsy helm If i'm understanding whta you're saying, its better to assign variables from con...

Basicly I have minable block witch have some location, maxHP, drops... and other thinks. Those thinks can be set in config file. I was thinking about 1 method:

new MinableBlock(Fie file){
#Read file 
hp = file.getHP()
}

Or just this:

new MinableBlock(int hp, Location location){
this.hp = hp
this.location = location
}

I never used some builder method so I will need to lookup some example for that.

trim lake
#

I need that to be editable true config file so I cant

#

my question is just if its better to doit with 1st or 2nd method, what is better coding practice

drowsy helm
#

second one

#

First doesn't follow SOLID principles

trim lake
#

thanks, thats how Im doing it but constructor kinda starting to be rly big lol, so I should add some another way to do that.

mortal vortex
left jay
spare prism
#

hello. im trying to make items stay on a block using armour stands, but for some items it is too much to put them with a 1 block of y offset and they get stuck into the block. why doesn't it work when I try to add an y offset that is less than 1? it just seems to change nothing

        Vector offset = new Vector(0, 0, 0);
        if (ItemUtils.isSimilarIgnoreLore(itemToPut, SimsItem.WOODOO_DOLL, true)) {
            offset = new Vector(0, 1, 0);
        } else if (ItemUtils.isSimilarIgnoreLore(itemToPut, SimsItem.BLOOD_BAG, true)) {
            offset = new Vector(0, 0.5, 0);
        } else if (ItemUtils.isSimilarIgnoreLore(itemToPut, SimsItem.BONE, true)) {
            offset = new Vector(0, 0.5, 0);
        } else if (ItemUtils.isSimilarIgnoreLore(itemToPut, SimsItem.OCCULTISM_AMULET, true)) {
            offset = new Vector(0, 0.5, 0);
        }

        ritualTable.setContainedItem(player, itemToPut, offset);
    public void setContainedItem(Player player, ItemStack item, Vector offset) {
        this.containedItem = item;

        Location location = block.getLocation().clone().toBlockLocation().toCenterLocation().setDirection(player.getLocation().subtract(block.getLocation()).toVector());

        itemArmorStand = location.getWorld().spawn(location.subtract(offset), ArmorStand.class, stand -> {
            stand.setAI(false);
            stand.setVisible(false);
            stand.setBasePlate(false);
            stand.setCustomName("ritual_table_item");
            stand.setCustomNameVisible(false);
        });

        itemArmorStand.getEquipment().setHelmet(item);
    }
rich cradle
#

Hello, where did CraftItemStack go with spigot 1.21.4 and what should I use instead?

rich cradle
#
dependencies {
    compileOnly project(":common")
    compileOnly("org.spigotmc:spigot:1.21.4-R0.1-SNAPSHOT") {
        exclude group: "com.mojang", module: "*"
    }
}
#

but

#

for some reason, CraftItemStack is shown as from version 1.21.3, but since 1.21.4 it doesn't exist at all.

blazing ocean
#

well, have you run buildtools?

rich cradle
#

nope

#

I'll try it with him now.

blazing ocean
#

you need to run BT if you want to access internals

rich cradle
#

thx

#

then I just need to use spigot on the way out.jar as a dependency when compileOnly?

blazing ocean
#

no, BT publishes spigot to your local maven

#

so refresh gradle

smoky oak
rich cradle
sullen marlin
rich cradle
blazing ocean
#

did you press the reload gradle button in IJ

robust helm
#

bumb

blazing ocean
#

don't use both api and implementation

#

api is enough

robust helm
#

but implementation only doesnt expose it for some reason

blazing ocean
#

which is why you use api

robust helm
#

oh right

#

but api doesnt work with shading into the jar

#

or maybe a different issue but i get NoSuchMethodException

blazing ocean
#

shadow also shades api configurations

robust helm
#

weird

blazing ocean
#

take a look at your shaded jar

robust helm
#

not at home rn

rich cradle
#

why you can't send screenshots here, you understand, it makes everything difficult...

blazing ocean
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

robust helm
#

is there any other possible cause for the exception?

blazing ocean
#

i mean, are you relocating it?

rich cradle
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

rich cradle
#

!verify ItsNayzu

robust helm
undone axleBOT
#

This account is already verified!

rich cradle
#

f

#

wtf

#

Why can't I get verification on my account?

blazing ocean
sullen marlin
#

because that account is already verified on @balmy cliff

blazing ocean
sullen marlin
#

why do you need CraftItemStack anyway

robust helm
#

i can send it later

rich cradle
blazing ocean
#

it's hard to help without knowing the entire buildscript :p

robust helm
#

true. ill look into it later

rich cradle
#

Can you give me a verification role, just please, so that I can send pictures?

blazing ocean
sullen marlin
#

no you need to email support from your forum account email to get the verification reset // see what rad said

spare prism
short pilot
#

hey intellectuals I seek your wisdom again

#

how could I go about, in a custom factions plugin, have custom mobs created that are friendly to said faction members but not others?
And of course only targeting players

#

My past custom mobs attempts also never save between server restarts so I'd like to know how to do that

spare prism
#

it doesn't work even like that:

    public void setContainedItem(Player player, ItemStack item, Vector offset) {
        this.containedItem = item;

        Location location = block.getLocation().clone().toBlockLocation().toCenterLocation().setDirection(player.getLocation().subtract(block.getLocation()).toVector());
//        Location locationWithOffset = location.clone().subtract(offset);
        Location locationWithOffset = location.clone();
        locationWithOffset.setX(locationWithOffset.getX() - offset.getX());
        locationWithOffset.setY(locationWithOffset.getY() - offset.getY());
        locationWithOffset.setZ(locationWithOffset.getZ() - offset.getZ());

        System.out.println("offset: " + offset.getX() + " " + offset.getY() + " " + offset.getZ());

        itemArmorStand = location.getWorld().spawn(locationWithOffset, ArmorStand.class, stand -> {
            stand.setAI(false);
            stand.setVisible(false);
            stand.setBasePlate(false);
            stand.setCustomName("ritual_table_item");
            stand.setCustomNameVisible(false);
        });

        itemArmorStand.getEquipment().setHelmet(item);

        System.out.println("location: " + LocationUtil.toString(location));
        System.out.println("location with offset: " + LocationUtil.toString(locationWithOffset));
        System.out.println("armourstand current: " + LocationUtil.toString(itemArmorStand.getLocation()));
    }
short pilot
#

if anyone could take a look at me question later 🦜 that would be cool 😢

smoky anchor
chrome beacon
#

^^ That or you use nms goals to make them behave like you want

#

For them to persist properly it's up to you to track their position and respawn them on chunk load and despawn on unload

ivory sleet
#

?ban @agile ether ban evasion

undone axleBOT
#

Done. That felt good.

blazing ocean
#

thanks concluwuwuwubuwuuwbe

chrome beacon
#

oh were they ban evading 💀

blazing ocean
#

yeah

#

gongas' 10e8th account

chrome beacon
#

oh not them again

misty ingot
#
        for (OfflinePlayer guildMember : guild.getPlayers().keySet()) {
            log(guildMember.getName());
            if (!guildMember.isOnline()) continue;
            sendMessage((Player) guildMember, plugin.lang.getGuildChatFormat()
                    .replace("%player_name%", sender.getName()).replace("%message%", message)
                    , false);
        }

to start off, there are 2 guild members and they are both online
a message is sent and both of them receive it (the log line prints both their names too). good.
one of them leaves, and then rejoins the game
a message is sent and only the one who didnt log out gets the message. the log line still prints both their names
im checking whether the offlineplayer is online, and since both of them are in both cases, why does the message only get sent to both of them in the first case?

eternal oxide
#

do not store/reference Player objects, use their UUID

#

get a new Player object when you need it

misty ingot
#

thats why i stored OfflinePlayer
but welp, guess i gotta store only UUID

#
        for (OfflinePlayer guildMember : guild.getPlayers().keySet()) {
            log(guildMember.getName());
            if (!guildMember.isOnline()) continue;
            log("2 "+guildMember.getName());
            sendMessage((Player) guildMember, plugin.lang.getGuildChatFormat()
                    .replace("%player_name%", sender.getName()).replace("%message%", message)
                    , false);
        }

in the second case, even the second log line here prints both their names, but only the one guy gets the message

eternal oxide
#

Don;t cast the offline player to Player, use teh getPlayer() method in OfflinePlayer

misty ingot
#

i see.

#

it did not work

#

guildMember#getPlayer() instead of (Player) guildMember
made no difference

#

man. am i gonna have to switch it all out for UUIDs

eternal oxide
#

the UUID never changes (unless your server is offline)

#

so just get a new Player object from the OfflinePlayer getUniqueId()

misty ingot
#

ye ik but i was hoping OfflinePlayer alone would be fine

eternal oxide
#

it shoudl be

#

unless you are storing a Player reference somewhere and retaining a stale reference

misty ingot
#

i think im gonna switch over to UUIDs for the sake of my own sanity

eternal oxide
#

a new Player object is created each login, so logging out and logging back in means the original Player object is invalid

#

UUID is safest

pseudo hazel
#

or I think when a player dies

#

but not sure

blazing ocean
#

no

eternal oxide
#

same object when they die, but they are temporarily removed from teh player map

misty ingot
#

alright, switched to UUIDs

#

works perfectly

quaint mantle
#

Is it okay to develop a string parser based on the GraalVM Scripting API in my plugin? I'm worried that there might be issues regarding resource usage or optimization.

split gull
#

Hi, I'm looking for a way to use NMS on a large range of versions, my project has multiple modules and i'll handle the versions that way, I'm struggling to find a way to actually NMS, any ideas?

remote swallow
#

multi module project with

#

?nms

split gull
#

kk thanks

split gull
remote swallow
#

idk of any guides that exist for gradle but its not hard, similar setup but parent shades submodules of nms vers using project('tag)

split gull
#

alright, thanks a lot

robust helm
blazing ocean
#

you mean for publishing to maven?

#

i heard it's bad practice, but tbh no idea, but shadow shades transitively from my experience

robust helm
split gull
#
  1. is there a way to change the path of the remap task?
misty ingot
#

if i have a string like

"(3*5)+7"
how can i convert this into an actual formula that i can calculate the value of and return, say in this case, 22
(the string may or may not have spaces)

split gull
remote swallow
#

,pings fine, you dont need to use any of the bt files for anything, just setup the task. if you use something to rename the jar output you need to tell the remap task that

split gull
blazing ocean
misty ingot
#

i think its time to copy parts of my parser from the time i made a programming language

misty ingot
vague dawn
#

hey, somebody really good with HikariCP dependency? I have a problem, one dude help me to use this database dependency instead of the "basic" one from java. I manage it to work, but now i am getting this error: https://pastes.dev/BHMpqFoZdJ

in all methods i am closign the connection after getting what i want, here i will send you the config:

HikariCP config: https://pastes.dev/JzlZHhfnE4
DB manager: https://pastes.dev/aEvy3C6na8
DB Schem: https://pastes.dev/ZoRAsgp12W

Tell me, how to fix it or what do you want me to send more? thx Guys

remote swallow
#

you need to run db interaction async

vague dawn
#

what do u mean? can you help me with that?

remote swallow
misty ingot
#

for pom.xml

remote swallow
#

its on central im guessing

misty ingot
#

central has upto v0.0.3

#

latest is v1.0

slender elbow
#

crunch

misty ingot
#

nice

paper viper
#

Use crunch

#

It’s way faster than expr4j or any other libs out there

misty ingot
#

hm

#

alright

sand hollow
#

//Interact with Inventory
@EventHandler
public void onInventoryInteract(InventoryClickEvent e) {
if (!(e.getView().getTitle().equals(skillTreeMenuName))) return;
if (e.getClickedInventory() != e.getView().getTopInventory()) return;
if (!(e.getWhoClicked() instanceof Player player)) return;

    e.setCancelled(true);
}

This seems to work as intended. Someone somehow still managed to take items out of the Inventory. Someone knows why and how to fix it?

mortal hare
#

this is probably the worst i've seen

sand hollow
mortal hare
#

that's not my code

remote swallow
#

new prompt time

mortal hare
remote swallow
#

fr

#

taste the rainbow

quasi gulch
#

When i set the explosion Radius of a wither skull it stays at 1 and doenst explode like the power i set it to. The debug Message gives me the value i set but idk why the explosion is so small. With the other mob Ghast i did the same and it worked

granite pond
#

I know Trial Chambers and the Vaults are relatively new, but is there a way I can see what Vaults players have claimed?

#

-# Really new to plugin development, so any help would be massive, thanks

river oracle
#

You'd need to track it yourself

#

With either a database or player pdc

#

?pdc

granite pond
river oracle
#

If it's not in the java docs no probably not

#

?jd-s

undone axleBOT
river oracle
#

I can't find anything

granite pond
#

724, 6, -3632 has the following block data: {z: -3632, y: 6, config: {key_item: {id: "inecraft:ominous_trial_key", count: 1}, loot_table: "inecraft:chests/trial_chambers/reward_ominous"}, id: "inecraft:vault", server_data: {rewarded_players: [[I; 145043703, 131353225, -1271894333, 1934907291]], state_updating_resumes_at: 45932790L}, x: 724, shared_data: {}}

Ignoring the fact that I have to fix my console for not spitting all info, the data I need is stored in the block itself under server_data: {rewarded_players: []}

river oracle
#

Yeah we don't have api exposed for that it looks like

granite pond
#

darn, I'll have to figure it out then

kind hatch
#

Wonder if it can be exposed easily.

river oracle
#

That api is pretty blegh doesn't cover everything

granite pond
#

Alright, I don't expect any code out of this ask, I'm just asking if it's possible with the current APIs:

  • Detect when a player is within a structure, such as a Nether Fortress or Trial Chamber
  • Check for certain blocks within that structure, such as Vaults
  • Interaction Entity support.
    • I would need to summon them at specific locations with specific sizes with a glowing effect
misty ingot
#
    @Override
    @NotNull
    public String getIdentifier() {
        return "guilds";
    }

    @Override
    public String onRequest(OfflinePlayer player, @NotNull String params) {
        if (params.equalsIgnoreCase("test")) {
            return "success!";
        }

        if (params.equalsIgnoreCase("test2")) {
            return "wow!";
        }

        return null; //
    }

(PAPI integration)

%guilds_test% doesnt return "success!"
what am i doing wrong?

#

the docs are quite bare bones so im a little confused

remote swallow
#

are you registering it

misty ingot
#

well about that too

fluid river
misty ingot
#
        // papi integration
        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            new PapiExpansion(this).register();
            log("PAPI found. Initiating integration process...");
        } else {
            log("PAPI not found! Skipping integration process...");
        }

papi is installed, it is softdepend and is in loadbefore
but it says papi not found every time
(papi loads in console)

sand hollow
fluid river
#

Should all be called InventorySomethingEvent

#

for shift clicks and right clicks

#

i don't rly remember

#

?javadoc

remote swallow
misty ingot
#

cant you check the type of click in that event

remote swallow
#

it shouldnt be loadbefore it should only be a soft-depend

misty ingot
#

well it didnt work then either

fluid river
#

shouldn't it be loadafter

misty ingot
#

i added loadbefore after i saw it didnt work, to test

remote swallow
misty ingot
fluid river
misty ingot
#

anyway

#

removing loadbefore doesnt fix it

fluid river
#

i need sree fpigot lessons

remote swallow
#

what do you have in ur plugin.yml

misty ingot
#
name: '${project.name}'
version: '${project.version}'
main: com.siliqon.cosmicGuilds.CosmicGuilds
api-version: '1.13'
prefix: '${project.name}'
load: STARTUP
authors: [ SiliQon ]
softdepend:
  - "PlaceholderAPI"
description: '${project.description}'
remote swallow
#

have you ran a clean build

fluid river
#

load startup 💀

misty ingot
remote swallow
#

do you use maven

fluid river
#

mvn clean package

misty ingot
#

sec

#

running clean package

sand hollow
misty ingot
fluid river
remote swallow
#

im sane and i use gradle

blazing ocean
misty ingot
#

yeah rad i saw the link on your profile

fluid river
#

never used gradle in my life

misty ingot
#

anyway um didnt work

blazing ocean
misty ingot
#

is load: STARTUP the reason? it shouldnt be right

#

the docs said nothing about that

remote swallow
#

do you modify worlds for anyhting

misty ingot
#

no

remote swallow
#

remove the line

misty ingot
#

done

fluid river
#

🙂

#

now try it and see

remote swallow
#

run a clean package again and check

fluid river
#

?tas

undone axleBOT
misty ingot
#

works

#

how

#

how did load postworld fix it

fluid river
#

never use load startup anymore

remote swallow
#

because it loads before worlds, papi doesnt

misty ingot
#

i c

fluid river
#

unless you are absolutely sure you need it

granite pond
#

I remember there was a way to run a server instance of Minecraft from within IDEA, how can I set that up again?

misty ingot
#

well, time to go crazy with papi

fluid river
#

daddy

misty ingot
#

saves so much time

#

the console log appears in IDEA terminal

fluid river
#

send him a guide how to set it up

#

🙂

fluid river
misty ingot
#

its just a profile if he wants i could copy paste that

misty ingot
fluid river
#

eclipse maven

misty ingot
#

eclipse is just too featureless for me to be able to bare it

#

too plain

granite pond
misty ingot
#

too "i dont put butter on my toast" for me

fluid river
#

well, but it's light and fast and distributed as a zip

misty ingot
blazing ocean
#

however it is paper

remote swallow
#

and gradle

fluid river
#

xd

#

ebic what's your last plugin

remote swallow
#

oh god i dont even know

#

probably a comission

fluid river
#

is it any better than Pen is ban

blazing ocean
remote swallow
#

run spigot when

blazing ocean
fluid river
#

also using old netbeans with Swing

kind hatch
#

Can the PDC grab vanilla values or does it only work with custom data put into it?

remote swallow
#

it can read stuff in the pdc container with namespaced keys it can create afaik

fluid river
remote swallow
#

you could technically just insert something random into pdc with data merge but its pointless

misty ingot
#

EEEEEEEE my brain

#

my brain is making that sound is that normal

fluid river
#

and now pdc is like separate thing for plugins to use

pseudo hazel
#

its just a section of the item meta

fluid river
fluid river
misty ingot
#

currently working on my biggest plugin yet
and my fingies huwt 😦

pseudo hazel
#

skill issue

remote swallow
#

get the statistic plugin

blazing ocean
#

I've never had my fingers hurt from coding before lmao

misty ingot
#

i already have statistic and wakatime

remote swallow
#

whats the java real line count

misty ingot
#

1618

#

6 hours logged on wakatime today

remote swallow
#

light work

fluid river
#

i swear pen is ban was like 1000

misty ingot
#

well most of the finger hurting is from the gah damn messages.yml file

blazing ocean
#

1.6k loc is nothing

remote swallow
#

code configs >>>>>

misty ingot
#

i know, the last lua project i made had 12k LOC

pseudo hazel
#

statistic plugin?

misty ingot
#

but its a bit for a single day right

blazing ocean
#

Adn about 500 hours of kotlin in the past year

misty ingot
remote swallow
#

i have 44 minutes today and 50 minutes yesterday

misty ingot
#

i wanna learn kotlin so i can also dip my feet in android app dev for fun but i just cant be bothered to learn another forkin language

misty ingot
gentle nexus
#

would soming like
public enum enumname{enum1(Material.DIAMOND); }
work ?
cause uh it isnt for me
also Material isnt importing for me at all which is also weird

remote swallow
#

i have a solid 720 hours total on waka

fluid river
#

tas*

misty ingot
#

racist.

gentle nexus
fluid river
#

just brutally import it

gentle nexus
#

mainly Material isnt importing so i cant try it

remote swallow
#

?tryandsee

undone axleBOT
misty ingot
#

also plez use ``

remote swallow
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
pseudo hazel
misty ingot
#

codeblock is easier on the eyes

blazing ocean
misty ingot
#

public psa over, back to papi integration

blazing ocean
#

i only started using it last year

remote swallow
blazing ocean
#

may 2024

misty ingot
#

i only have waka on IntelliJ otherwise i feel like some guy from waka woulda emailed me to close vscode for once

remote swallow
blazing ocean
remote swallow
#

i joined jan 2, 2023

blazing ocean
#

i have 70 hours less whilst having jjoined a year and a couple months later than you

#

that's a tad bit concerning isn't it

misty ingot
#

only times i open IntelliJ is either when im getting paid to do it or the 3 am motivation

remote swallow
#

yeah becausei have like 6 month breaks

#

2023 was my bes tyear

#

last year was horrible

granite pond
misty ingot
#

welcome again

quasi gulch
#

When i set the explosion Radius of a wither skull it stays at 1 and doenst explode like the power i set it to. The debug Message gives me the value i set but idk why the explosion is so small. With the other mob Ghast i did the same and it worked. Anyone has any idea why?

rough ibex
#

Does it work with commands? Might be a mc bug

quasi gulch
#

What Tag is Yield? its not seperate in mcsatcker

#

Ohh i see that WitherSkull doenst have explosionPower tag only the fireball does. Why is it in the api then?

#

Is that a mc bug or an API bug?

mortal hare
#

wtf..

#

Direction class set by strings

nova notch
#

wtf

mortal hare
#

this has to be the most cursed codebase i've ever seen

#

well at least it partially works

#

im in a rush of completing uni assignment

#

so i might as well just refactor this project

nova notch
#

also why's there only one right/left shouldn't it be 2

#

it's like they said north is up, east is right, etc

mortal hare
#

idk

#

im refactoring this into enum class

#

for now

#

just to cleanup the codebase

#

i dont wanna mess with angle values as they're used for javafx image rotations for now

nova notch
#

oh it's 2D?

mortal hare
#

yea

nova notch
#

that would make more sense

mortal hare
#

what's even more weird that entity has two directions, one for moving and another for the same? i dont understand it

kind hatch
#

How does one convert the way minecraft stores UUIDs into actual UUIDs?
[I;57179296,818891836,-1944241363,-681820176] --> 03687ca0-30cf-4c3c-8c1d-3b2dd75c3ff0

mortal hare
#

UUID.fromByte maybe?

blazing ocean
mortal hare
#

doesnt it also depend on UUID version of how its being parsed?

kind hatch
blazing ocean
#

no idea

pseudo hazel
#
@Override
    public @NotNull UUID fromTag(Tag<int[]> tag) {
        int[] data = tag.getValue();
        if (data.length != 4) {
            ConsoleMessenger.bug("Could not parse UUID from file", this);
            return UUID.randomUUID();
        }

        long mostSig = (long)data[0] << 32 | data[1] & 0xFFFFFFFFL;
        long leastSig = (long)data[2] << 32 | data[3] & 0xFFFFFFFFL;

        return new UUID(mostSig, leastSig);
    }```
#

so yeah bit shift

#

here is the other way if you are interested ```java
@Override
public @NotNull Tag<int[]> toTag(UUID value) {
int[] data = new int[4];

    long mostSig = value.getMostSignificantBits();
    data[0] = (int)(mostSig >> 32);
    data[1] = (int)mostSig;

    long leastSig = value.getLeastSignificantBits();
    data[2] = (int)(leastSig >> 32);
    data[3] = (int)leastSig;

    return new Tag.IntegerArrayTag(data);
}```
blazing ocean
#

i will never understand bitshifting magic

mortal hare
#

its not that hard, it just looks scary, its arithmetic but on bit level

pseudo hazel
#

np

kind hatch
#

I had a method to convert uuids to the 4-int format, but I couldn't figure out how to reverse it. :p

pseudo hazel
#

yeah

kind hatch
#
public static int[] toMCFormat(UUID uuid) {
    long least = uuid.getMostSignificantBits();
    long most = uuid.getLeastSignificantBits();

    return new int[]{(int) (least >> 32), (int) least, (int) (most >> 32), (int) most};
}
pseudo hazel
#

its a bit of low level magic

wet breach
#

just know that the bits don't wrap around. So if you shift to the right, those bits are lost

pseudo hazel
#

yeah, just shift the bits

blazing ocean
#

bitmasking tho

wet breach
#

bitmasking is just where you are assigning meaning to invidual bits

#
0000-1111

now if you translate this to decimal its very easy to know that you only have values 0-15 and and that is how you get your 0x02 or so notations

#

so if its 0x08 then that means your mask is 1000

#

0x08 = 1000
0x07 = 0111
0x08 + 0x07 = 15 = 1111

#

so not that hard 😛

pure dagger
#

hey, should i make it more readable for users? and how

camps:
  - area:
      corner1: "100,64,100"
      corner2: "200,80,200"
    generation_area:
      corner1: "120,64,120"
      corner2: "150,80,150"
    block_to_generate: "STONE"
    generation_interval: 20

  - area:
      corner1: "300,64,300"
      corner2: "400,80,400"
    generation_area:
      corner1: "320,64,320"
      corner2: "350,80,350"
    block_to_generate: "IRON_ORE"
    generation_interval: 40
misty ingot
#

is it meant to ever be intentionally edited by users?

#

also why you storin location in string

pure dagger
#

im asking more about camps being a list

misty ingot
#

then yes, make it readable

pure dagger
#

but how ?

noble lantern
misty ingot
#

how can i go about sorting a hashmap by values?

eternal night
#

you dont

#

hashmaps don't have order

misty ingot
#

doesnt have to be in place

eternal oxide
#

use a SortedMap instead, if you need order

eternal night
#

isn'T that on key

eternal oxide
#

you can use a comparator

eternal night
eternal oxide
#

ah no my mistake

eternal night
#

I mean, do you need it fully sorted, do you need only the largest/smallest value?

eternal oxide
#

you are correct its still on key, you are just able to supply a comparator to order how you want

misty ingot
#

i need it fully sorted

#

descending order

eternal night
#

if you need it fully sorted just, new ArrayList(map.entrySet()) and then Collections.sort that with a comparator grabbing values

#

(then ask yourself how often you need this sorting and maybe find a better impl of this)

misty ingot
#

well

kind hatch
#

It took longer than expected for me to write this. :p
I am jank

misty ingot
#

its a leaderboard
sorting guilds by the amount of xp they have

eternal night
#

is this for some esoteric fork

#

or are you planning on PRing this to spigot

kind hatch
#

Probably a PR to spigot

eternal night
#

???

quasi gulch
#

When i get the Target of an EnderDragon 1sec after changing his Phase its always null. Even when he launches a DragoBall the target with enderDragon.getTarget() is null why?

eternal night
#

you have a reference to the vault block entity in that type

#

as the snapshot

#

make VaultServerData#getRewardedPlayers public

#

and just call that

#

don't do whatever the fuck this is

pure dagger
eternal night
#

if you need inspiration, look at any of the other subtypes of CraftBlockEntityState

#

they all do that the same way

kind hatch
#

I didn't even know VaultServerData existed...

eternal night
#

uuuf

misty ingot
#

i think im going to just rethink how to get the top guilds

#

fuck maps

#

or well ill still need maps but, a better approach nonetheless

paper viper
#

What are you trying to make?

misty ingot
#

guild leaderboard sorted by guild xp

#

Guild is a custom class, which has all the guild data

#

i want a List<Guild> with the top x guilds by xp

#

i have a list of all Guild(s)

paper viper
#

Does it must be a List

#

Can you use a set

misty ingot
#

anything that is ordered and i can iterate over at the end, cuz the rankings cant just move around

paper viper
#

Use a TreeSet

#

With comparator

kind hatch
#

Frick. Need to remember how to make patch files. :/

eternal night
#

iirc spigot had some weird bash script somewhere

remote swallow
#

cb

#

or if its a spigot feature, spigot

blazing ocean
kind hatch
#

rebuildPatches? I only have makePatches and applyPatches

eternal night
#

makePatches then

#

sorry, rebuildPatches is the paper task

kind hatch
#

Hmm, I wonder why it doesn't work now.
I ran makePatches, but what else do I need to do to test the new CB jar?

#

I don't typically do these kinds of patches

#

So I am confused here

remote swallow
#

you dont really need to run make patches till the end

#

modify what you want, run package/install of cb and test

#

use cb as a dep in ur build system and the same cb jar as the server

kind hatch
#

Yea, I do that for normal stuff, but is it the same when adding in patches?
Does this just automatically get used?

remote swallow
#

when you want to push to git then makePatches and it will find the new file and make the patch

kind hatch
#

I have already ran makePatches, but I want to test this.
Do I need to make the PR first?

remote swallow
#

you can test without making the pr

#

all the patch matters for is git, bc you cant put nms on git

kind hatch
#

How though?
I have already made changes to bukkit and installed them.
I modified the net.minecraft VaultServerData file to make the method public.
The impl for CraftVault is now short.

@Override
public Set<UUID> getRewardedPlayers() {
  return getTileEntity().getServerData().getRewardedPlayers();
}

Yet, I get errors when trying to test now.

#

So what am I missing here?

remote swallow
#

run the install goal on craftbukkit and run craftbukkit as the server

kind hatch
#

Install ran.

#

Craftbukkit jar I am going to use.

remote swallow
#

if that still doesnt work i have a final idea

kind hatch
#

Error I receive

eternal night
#

otherwise people will end up editing that set by acceident, I don't think that is what people want

#

or at least I wouldn't, maybe md vibes with that

remote swallow
#

reading that error, im confused how ur getting a no such method on bukkit if you installed bukkit too

eternal night
#

the server they run compiles a wrong bukkit version I guess?

#

just, don't use build tools to build shit there, its ass

kind hatch
#

Hmm, I made the change to clone the set and I recompiled everything and it now works?

#

Java moment I swear

#

Oh well, now to do the PR.

#

Because this is a patch, do I need to exclude the file I added into the nms folder?

remote swallow
#

do not commit nms

#

of everything you can do, do not commit any nms

#

only thing that needs pushing is Craft classes + the most recent patch of the nms class

kind hatch
#

How come I don't have a patch file then?

remote swallow
#

run makePatches again, double check its in nms-patches/path/to/nms/file

#

(makePatches requires the decompile-abcdefg dir from bt passed as an arg)

worldly ingot
#

You need to copy/paste the vanilla file from work/decompile-xxxxxx into the CraftBukkit directory (same package though), make the changes you need to make in the CraftBukkit project, then in the root of the CraftBukkit directory run ./makePatches 'path/to/work/decompile-xxxxxx'

#

The files in the work directory should stay vanilla. That's how the CraftBukkit scripts know what's changed

#

Then yeah, don't commit the NMS .java file, you want the generated .patch file instead

kind hatch
#

For some reason when I do that, there aren't any patch files that show up.

remote swallow
#

does it send any output to console?

worldly ingot
#

And did you copy the files from decompile-xxxxxx into CraftBukkit but keep the work files clean?

kind hatch
#

Yes

#

Wait

#

I think it made it, but didn't auto add it to git.

remote swallow
#

that might do it

worldly ingot
#

Yeah it's a new patch so you'd have to git add . it (or add it via whatever git program you're using)

remote swallow
#

if you use intellij just right click and git > add

kind hatch
#

There we go

worldly ingot
#

Sick 😎

remote swallow
#

do i see a missing // CraftBukkit

worldly ingot
#

Would rather a PAIL instead

kind hatch
#

So now I just commit those two files and submit it for review?

#

PAIL?

remote swallow
#

ill let choco explain

worldly ingot
#
+    public Set<UUID> getRewardedPlayers() { // PAIL - package private -> public
remote swallow
#

do pails not get cbnamed

worldly ingot
#

I've always interpreted it as "please add in later" but I don't really know its true meaning lol. We use it for access changes so it can be added to the access transformer at a later date

#

Nope

remote swallow
#

how many pails actually get added to AT

worldly ingot
#

It's usually done in the next MC update

worldly ingot
#

You can tack on that comment into your patch manually though. Don't need to edit in source and regenerate. It's already a changed line

remote swallow
#

choco dont hide the fact you write all your patches manually

worldly ingot
#

I definitely did for the first one

#

I thought that was how git patches worked lol

remote swallow
remote swallow
#

would just like to say 1 word as a comment

#

javadoc

worldly ingot
#

I'll leave it in the PR as well but the PAIL only has to be in the patch file. No need for it to be in CB 😄

kind hatch
#

Ah, woop

#

Double woop

remote swallow
#

javadocs are easy to fix, same for the craft class

worldly ingot
#

Also, I don't think it's nullable 🤔 Is it?

kind hatch
#

I think the field can be empty

worldly ingot
#

Seems like it's initialized and kept non-null

eternal night
#

Do note that Collections.unmodifiableSet does not create a copy

worldly ingot
#

Correct

eternal night
#

tho spigot only has snapshots on BEs

#

so its whatever, mb

worldly ingot
#

Yeah I think it's fine

eternal night
#

Yea, was about to scream given live BE would be rather yucky if that set starts changing

kind hatch
#

Doesn't this field being here on this specific vault and not the other one indicate that this field can be null?
Or is this just an ingame thing on how it displays data?

eternal night
#

no

#

the codec just emits the default value (empty set) when writing

#

which is what you are doing when converting that to SNBT

worldly ingot
#

Nullability of a type can't be inferred from the output of its data in SNBT. It's all code, babyyyy 😎

eternal night
#

until mojang changes it

#

what then HUH, MR API designer

worldly ingot
#

If Mojang chooses to unnecessarily write rewarded_players: [] into their SNBT, I'll eat my own shoe

remote swallow
#

what kind of shoe

#

bc you could eat a cake shoe and thats no fun

worldly ingot
#

Yeah like one of those "Is it cake!?" things but it's a shoe

remote swallow
#

im voting its the biggest fuck off winter boot cake shoe you can get made

rugged flower
#

Hi! Im currently making a plugin for a friend and i need an inventory name. When i try to use e.getWhoClicked().getOpenInventory().getTitle() i get this error:

[23:50:53 ERROR]: Could not pass event InventoryClickEvent to attachments v1.0.0-BETA
org.bukkit.event.EventException: null
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:203) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a]
    at net.minecraft.util.thread.IAsyncTaskHandler.B(SourceFile:136) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a]
    at net.minecraft.server.MinecraftServer.bv(MinecraftServer.java:1249) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a]
    at net.minecraft.server.MinecraftServer.B(MinecraftServer.java:1242) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a]
    at net.minecraft.util.thread.IAsyncTaskHandler.b(SourceFile:145) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a]
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1207) ~[spigot-1.21-R0.1-SNAPSHOT.jar:4226-Spigot-146439e-2889b3a]
    at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

Caused by: java.lang.IncompatibleClassChangeError: Found interface org.bukkit.inventory.InventoryView, but class was expected
    at attributes.Main.inventory_click_event(Main.java:118) ~[?:?]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.21-R0.1-SNAPSHOT.jar:?]
    ... 21 more

Is there an alternative way to get inventory name without me having to rewrite half of my plugin??

drowsy helm
rugged flower
#

how can i check then if the currently opened inventory is the specific one im looking for (not type but the custom one)?

drowsy helm
#

check out this resource

rugged flower
#

Thanks! I will take a look at it tomorrow (its like 1am for me rn). Now just of curiosity - Is there an actuall method to get currently opened gui name or is it like completly inaccessible from 1.21+? Because you see im making a plugin for a very very small server and the source you sent seems a bit like an overkill for what im trying to do. And if there is not welp still thanks for the source i will make sure to check it out deeper tmr.

drowsy helm
#

But keep in mind inventory name is the easiest thing to spoof, and there HAVE BEEN massive cases of exploits being used with it

#

So it's not "overkill" its the correct way of doing it

rugged flower
#

The issue with that is as i showed i get this error

rugged flower
drowsy helm
#

That's usually a version incompatability problem

remote swallow
#

1.21 has been superceeded by 1.21.1

#

update

drowsy helm
#

I'm guessing you're using a jar artifact and not maven/gradle?

rugged flower
#

yup

#

then i am supposed to replace and external jar with a newer version?

#

if i understand correctly

drowsy helm
#

yes, but Ideally you should be using a proper build tool manager

remote swallow
#

(and you should update your server)

rugged flower
remote swallow
#

they should not be running plain 1.21

#

it has been superceeded by 1.21.1

#

you are physically not able to build 1.21 you will always build 1.21.1

spring hawk
#

hey i was wondering if its possible to transfer some features from 1 plugin to another. for example there is this combat log plugin i like that has no elytra use while in combat but doesnt kill on log and the other has no elytra off in combat but kills when someone logs out in combat, i was wondering if i could combine the two in some way?

drowsy helm
spring hawk
#

i do not sadly

drowsy helm
#

Then no

spring hawk
#

do u know if someone is able to do it for me?

drowsy helm
#

If you're really adamant about it, hire a dev to do it

#

?services

undone axleBOT
drowsy helm
#

No ones going to do it for free

spring hawk
#

oh okay i jsut assumed since its as simple as copy and paste

#

but okay

wet breach
#

milage varies depending on model

drowsy helm
spring hawk
#

ah alright

remote swallow
#

there is most likely a way to make the combat log plugin that doesnt kill on log out kill them on log out

spring hawk
#

yeah i figured but i just dont know how to

#

so i figured id ask here

remote swallow
#

im guessing it has docs or a support discord that can help better than we can

wet breach
spring hawk
#

m its done by an indemendant developer that doesnt rly speak english that i tried asking

spring hawk
remote swallow
#

afaik combatlogx is able to do what you want with some configuration

spring hawk
rugged flower
#

like makes the entire plugin go to trash kindof doest work

#

so i have no idea what to do at that point

remote swallow
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

remote swallow
#

applies to all version after 1.18 too

rugged flower
#

ahh

#

that makes

#

a LOT of sense

#

where can i get the jar tho

remote swallow
#

run buildtools

#

?bt

undone axleBOT
rugged flower
#

thanks i have some errors tho with the build tools i will propablly try fixing them tomorrow because its way to late for it today but that turned out to be very helpfull

#

Actually i managed to fix it today

#

Thanks to all of you guys for help it works now have an amazing day!

vestal vector
#

sorry chat i have a noob question. I never been in contact with spigot API, this is my first time. I want to fix an old bukkit plugin then i decompiled it and adapt all outdated code. then i realized that i don't know how to compile it to .jar again correctly because what i get by decompiled are just codes, not a entire project. development document confused me, should i create a new project to copy all code in? what should i do?

chrome beacon
#

Yeah make a new project and move the decompiled code there. Add all dependencies and fix all decompile errors

#

Then you can start updating

vestal vector
#

well... thank you! i'll try 😄

short pilot
#

hey fellas

#

how can u make a sidebar

#

and update it on change of chunk

main juniper
#

How does one post their plugins on spiggot or sell plugins on spiggot?

summer scroll
#

Once you do that, you will be able to create a resource with "Premium" as the category

split gull
#

Hey, when i use build tools it seems like it has some trouble with some versions
I've tried multiple times, the build is successful but it doesnt put the remappings in the .m2 folder
these are the versions it doesnt do that with: 1.21.2, 1.20.5, 1.20.3, any help?

#

im only missing those

summer scroll
split gull
#

so i should just not worry about those?

summer scroll
#

Yes probably

#

I remembered someone had this issue previously and md_5 answered it directly

split gull
#

ah i see

#

hey, does this by any chance mean that the nms are the same for those versions?

quaint mantle
eternal oxide
#

Do not cancel an event on MONITOR

sullen marlin
#

Yeah there's no reason at all to use the missing versions

split gull
# shadow night Mostly yes

Alright, thanks, do you also happen to know if there's a way to use Mojang mappings nms on 1.16.5? (Pre 1.17)

sullen marlin
#

They are client compatible with the newer version, and are usually released only days later/with important fixes

#

1.17 is only 4.5 years old at this point lol

split gull
shadow night
split gull
#

Yeah they dont

split gull
#

Or is there a way to give build tools the mappings and it works like that

sullen marlin
#

What are you trying to do

split gull
#

My plugin supports 1.16.5-1.21.4

shadow night
sullen marlin
#

You should be able to adapt the sample specialsource pretty easily

#

You'll just need to grab the Mojang mappings from Mojang

split gull
#

You mean the json file listed in the Minecraft wiki for each update?

sullen marlin
#

Otherwise it should be basically the same, just not automatically installed to maven

shadow night
#

Websites like mcassets actually let you easily download mappings iirc

split gull
#

Alright then, when I get back to my PC I'll try all of these things, thanks guys

sullen marlin
#

Definitely start with the newer versions haha

#

Or better yet, the api

summer scroll
#

?mappings

undone axleBOT
summer scroll
#

uhhh, where's the guide that alex wrote

split gull
quaint mantle
#

?paste

undone axleBOT
buoyant viper
quaint mantle
#

Any thoughts?

quaint mantle
buoyant viper
quaint mantle
#

It didn't help as well

short pilot
#

hey fellas, how can you make a sidebar show up in spigot api

#

simple question 😭😭

split gull
#

iirc you need to set the tile for any line to show up

short pilot
#

and then update fields ig like current territory of the chunk you are standing in

kindred valley
misty ingot
#

i keep failing to realise that its 1.21 already like what

undone axleBOT
river oracle
#

You'd be surprised

sullen canyon
#

?howold 1.5.2

undone axleBOT
short pilot
misty ingot
#

who the actual hell uses 1.5.2

#

i mean sure you can use it but what exactly do you need it for

#

i am extremely curious

#

?howold 1.21.4

undone axleBOT
misty ingot
#

now that one i can accept

#

?howold 1.13

undone axleBOT
sullen canyon
#

?howold 1.4.7

undone axleBOT
smoky oak
#

🤦
the bot aint wrong im just stupid

#

also

#

#bot-commands

misty ingot
#

right

smoky oak
#

please dont spam this channel lol

misty ingot
#

didnt mean to

smoky oak
misty ingot
#

the oldest version ive played is 1.7-ish, also a modpack, now discontinued

#

but that was a long time ago

#

i dont get it tho, why stick to THAT old a version

smoky oak
#

short answer curiosity

#

found it in the ftb launcher

misty ingot
#

no no playing it is fine, but actively supporting it is mental

echo basalt
#

TIL me and horses have a lot in common

misty ingot
#

nice joke, i shall steal it

#

it is the greatest honour i can bestow

wet breach
# misty ingot i dont get it tho, why stick to THAT old a version

mods add a lot of stuff. updated versions of MC has a lot of stuff now to the point you actually need decent hardware if you want to use everything it provides. 1.7 doesn't have all this which is fine if you intend to use mods anyways since they add the stuff you want to begin with and therefore it is manageable in terms of playing when you add stuff to nothing, versus adding more to what is already a lot

#

I routinely use versions like 1.7 or 1.8 as a base for custom servers since I don't have to spend time removing unneeded stuff since its not there

misty ingot
#

hm

wet breach
#

however, what I don't support is people coming here wanting support for outdated stuff because they can't figure out how to maintain it lmao

#

that is annoying

eternal oxide
#

But, but pvp

wet breach
#

yeah, the spam clicky pvper's that can't be bothered to do anything more then that -.-

#

I never did like mc for pvp and it simply isn't designed for hardcore pvp and I doubt it ever will be

#

not as long as the client gets to dictate stuff lmao

eternal oxide
#

I didn't pvp but I did like spam clicking after panicking the fuck out when mobs attacked me

#

Then there was something about jump attackign for more damage or something!? That was all beyond my abilities

wet breach
#

lol

misty ingot
#

i used to do a lot of 1.8 pvp on hypickle but just grew out of it

echo basalt
#

I'm at work I'm not gonna open that link

smoky oak
#

its sfw* but ig it shows on your logs lol
*unless you toggle that

amber fjord
#

i would know

wet breach
#

sure people make it work while pulling their hair out

#

and then contribute to the bald people population because of it

amber fjord
#

not really

#

have you seen the smp scene?

wet breach
#

the protocol is simply not designed for it and there is nothing you can do about it unless you have a custom client and fix the protocol

amber fjord
#

oh you mean the way it was coded

#

yeah for sure

misty ingot
#

how do people go about grabbing the full displaynames of players for their plugins?
say a server owner set some rank prefix or whatever for their player with some plugin and some suffix with another plugin
how would i go about grabbing a player's full displayname (offlineplayer too)

vestal vector
#

sorry for another noob question, i'm new in spigot, do we have a faster way to test debug just like postman to javaweb? i'm just looping compile then put it in a server then join the server to test, i feel dumb and tired now...

eternal night
#

hot reload exists

vestal vector
#

thank you 🙂 i'll read it now

wet breach
#

do note that hotswapping doesn't work for everything

#

and sometimes you may need to create your own custom agent or modify an existing one

#

just depends what you are doing

echo basalt
#

some jdks like it more than others too

amber fjord
smoky oak
hushed spindle
#

when you do Server#getEntity(UUID) i assume this will return null if the given entity is in unloaded areas, right?

#

and if not, is the area loaded to make the given entity valid again

misty ingot
smoky oak
#

try this

amber fjord
#

if not youll just have to pull from the actual saved data

#

if you cant convert the type i mean

smoky oak
#

pretty sure casting offlineplayer to player causes an exception

#

wait it doesnt

#

huh

misty ingot
#

ill try and see

misty ingot
#

ill cast offline to player and see if it works on my private server

smoky oak
#

still recommend the method instead of the cast tho

eternal oxide
#

you can;t cast to player

#

just use the correct method

misty ingot
#

what is the correct method?

eternal oxide
#

I just posted it

misty ingot
#

oh wait i see it

#

im blind

#

i literally had your link open

smoky oak
misty ingot
#

alright well if the user's permissions plugin uses vault then rainbows and sunshine otherwise too bad

amber fjord
#

oh yeah i forgot that one existed

eternal oxide
amber fjord
#

offlineplayer.getPlayer()

#

smh

eternal oxide
#

only works if teh player is online

amber fjord
#

oh

misty ingot
smoky oak
#

getplayerprefix is marked public

#

so just call that

amber fjord
#

Yeah you might just have to construct it using the logic and data from the other plugins

misty ingot
#
    public static String getPlayerDisplayName(Player player) {
        return plugin.vaultChat.getPlayerPrefix(player)+player.getName()+plugin.vaultChat.getPlayerSuffix(player);
    }
    public static String getOfflinePlayerDisplayName(OfflinePlayer player) {
        return plugin.vaultChat.getPlayerPrefix(null, player)+player.getName()+plugin.vaultChat.getPlayerSuffix(null, player);
    }

i just did this

#

now to check it

smoky oak
#

hey qq if writing an api is it worth doing extremely detailed error handling?

eternal oxide
#

depends

smoky oak
#

go on

eternal oxide
#

if its a recoverable error, yes

#

if not, pass it on

smoky oak
#

what about assuming default values?

eternal oxide
#

like?

smoky oak
#

inclination = 0

#

this is for location math nonsense

#

gods do i hate vector math

eternal oxide
#

defaults are fine, so long as you are not retunign it for ALL errors

smoky oak
#

ah

#

what about a pair<Severity, value> (record?) as return value?

eternal oxide
#

like, player does not exist should not return a default value

smoky oak
#

oh i have an idea

eternal oxide
#

if you are returning an error you may as well just throw the exception

smoky oak
#

make everything an object, which has to be instantiated with the desired error level / error handling type?

#

ie, throw / assume defaults for example

eternal oxide
#

if I were using an API I'd rather know teh specific error rther than something you have wrapped it up in

misty ingot
#

works perfectly

#

les goo

smoky oak
misty ingot
#

anyone whos using a chat system that doesnt use vault can cry me a river im not supporting anything other than vault for prefixes rn

kind hatch
eternal oxide
smoky oak
#

i mean what you throw to the calling plugin ll

#

coz it means you have to handle it there if its not runtime

eternal oxide
#

you throw the original error

smoky oak
#

fair enough

eternal oxide
#

exception

#

making changes to it will only make teh dev and your life harder

#

they report an error to you, you then have to cross reference your error to try and figure out the original exception

smoky oak
#

what if its not an actual exception, but rather a 'the data you gave me is malformed'?

eternal oxide
#

theres always a suitable exception, or you create your own

#

throwing yoru own exception is fine from your own API

smoky oak
#

noted

eternal oxide
#

so long as its not being used to control the flow of the code

smoky oak
#

can you elaborate on that?

eternal oxide
#

in your example of malformed data..

#

if you create an exception for MalformedDataException it should simply be an exception, they should not use it as a type of switch

unreal willow
#

excuse me, does anyone know how to encrypt php code? (closed source)

smoky oak
#

oh jesus i have the image of someone iteratively inputting data until it no logner throws an exceptoin

eternal oxide
#

lol

wet breach
#
To create a custom exception in Java, follow these steps: 

    Create a new class that extends Exception or one of its subclasses.
        If you want your exception to be checked (meaning the compiler forces you to handle it), extend Exception.
        If you want your exception to be unchecked (like RuntimeException), extend RuntimeException. 

    Provide constructors.
        You'll typically want to provide at least two constructors:
            A no-argument constructor.
            A constructor that takes a string message as an argument. 
smoky oak
wet breach
#

encrypt php code?

#

thats a new one for me lmao

eternal oxide
#

are you thinking of encrypting php code you are going to distribute to prevent the customer reading it?

unreal willow
smoky oak
#

git blame

eternal oxide
#

yeah, not going to happen

chrome beacon
#

People will edit it

wet breach
#

and distribute it too

eternal oxide
#

php code has to be readable by the php parser so can't be encrypted.

graceful sphinx
#

does anyone have a server for datapack help?

chrome beacon
graceful sphinx
#

no i someone elses, but i want it for new version since owner does not give any sign of life

#

tool Trims

chrome beacon
wet breach
#

lol

wet breach
# smoky oak

this is equivalent to telling someone there is cotton candy in the walls

smoky oak
#

well you might live in america but here in europe we use proper bricks

wet breach
#

lol

#

only because you didn't really have much of a choice since odds are your house is probably like 200 years old XD

smoky oak
wet breach
#

true

eternal oxide
#

Our slaves only knew how to make them out of bricks

smoky oak
#

were civilized here elgar, we call them 'working class'

eternal oxide
#

lol

graceful sphinx
chrome beacon
#

Brick houses don't survive earthquakes as well so you'd need to account for that

graceful sphinx
smoky oak
#

yea but we dont get earthquakes here kek

graceful sphinx
#

right u have floods fire tornados

#

mb

eternal oxide
#

we had a tiny one about 15 years ago (UK) due to fracking.

smoky oak
#

the most exciting thing in middle europe in the last two decades was the partial eclipse in like 2014

eternal oxide
#

I've seen one eclipse in my lifetime and that was around 1999 in teh UK

#

wierd as heck

smoky oak
#

partial or total

#

i wish the one here wouldve been total, it wouldve looked so much more amazing

eternal oxide
#

pretty sure it was a totl

#

yep it was a tot

smoky oak
#

darn

#

im jelous

eternal oxide
#

I remember ghoing home to watch it with the girlfriend

smoky oak
#

i really really wanted to see the corona

eternal oxide
#

the odd darkness was the wierdest thing

smoky oak
#

inner clock screaming eh?

eternal oxide
#

it went totally silent as all the birds got so freaked

#

Its hard to describe the darkness. It isn't something you ever experience at any other time

smoky oak
#

sighs in too-broke-to-travel

eternal oxide
#

I was lucky it was at my home 🙂

misty ingot
#

i dont remember a time when we got a total solar eclipse in my lifetime

smoky oak
#

i heard the next one in europe is in like six decades

eternal oxide
#

If you get teh chance I'd recomend it, its quite the show

misty ingot
#

the next one here is in 2034 and its going to only barely scrape by my country

eternal oxide
#

next looks to be in 2026

misty ingot
#

i dont even plan to be here that long

eternal oxide
#

closest to you would be Spain

smoky oak
#

yea no

#

i dont even know the language

misty ingot
#

you dont know spainglish? bummer

eternal oxide
#

it will reach from Iceland to spain and cover most of teh UK upto 96% in Cornwall (South West)

#

I live in SW UK so I'll be waiting for it

misty ingot
#

anyway, until 2034, back to IntelliJ

eternal oxide
#

^ thats some dedication

smoky oak
#

nah

#

that means 20:34

eternal oxide
#

could be a typo

smoky oak
#

yea

#

its more semiintellij

misty ingot
#

wakatime would disagree

#

whys there two different Java(s)

smoky oak
#

one of those is clearly running SQL instructions

eternal oxide
#

case

#

JAVA Java

misty ingot
#

i dont remember using a more advanced form of java

#

or is it screaming at me

#

BOO! JAVA!

#

nothing scarier than having to use java

smoky oak
#

2nd

#

def 2nd

granite pond
pliant topaz
#

but i've seen many partial ones, next ones gonna be next year

#

the one from 1999 was also a total here

tranquil ferry
#

hey if i message
Thanks for buying this plugin!! Please join DC (link) in people who buy my plugin... is it a self promotion and violence of rules??

#

i have seen people do it so... lmk

glossy laurel
#

guys, can someone explain me am I tripping or what

#

one of the allowed constructors

#

the constructor it cannot resolve

#

like what??

blazing ocean
#

show code

#

of both the ctor and your usage

glossy laurel
#
        Gui gui = new Gui(player, 4, displayName);
    }```
#
        this(rowCountToMenuType.get(rowCount).create(player, component));
    }```
blazing ocean
#

what components are you using

glossy laurel
#

I imported the wrong component

#

shit

#

🤦‍♂️

#

thank you anyways

torn shuttle
#
    @Override
    public List<String> getSuggestions(CommandSender sender, String partialInput) {
        if (validValues.isEmpty()) return new ArrayList<>();
        List<String> suggestions = new ArrayList<>();
        for (Integer validValue : validValues) {
            if ((validValue + "").startsWith(partialInput))
                suggestions.add(validValue+"");
        }
        return suggestions;
    }

man I'm feeling lazy today

blazing ocean
#

+ ""

torn shuttle
#

peak lazy

#

bet it should work