#help-development

1 messages · Page 650 of 1

mighty pine
#

No need to make a record for a thing you need once

ivory sleet
#

How so?

smoky oak
#

what why? It's so damn annoying to extrapolate from the InventoryEvents

spare hazel
#

how can i replace the current item meta with another item meta?

ocean hollow
#

in the first case, it opens the menu, but does not cancel, and in the second, the method passes and is canceled, why is that?

ivory sleet
#

If java was structurally typed that’d be fine

lost matrix
#

Hm, if you got an NVMe SSD then just load your worlds and see if it causes any problems

ivory sleet
#

But since java is not its just gonna flop ur design

ocean hollow
smoky oak
icy beacon
#

I'd assume any competent vps hosting would provide nvme

mighty pine
spare hazel
ivory sleet
#

Bro records arent even that expensive

#

And u still have to define a class

#

Like i dont get ur point

mighty pine
#

Its not about being expensive

ivory sleet
#

No but thats a fact

mighty pine
#

They cost the same at the point of c2

icy beacon
#

if i need it quick I go to the discord

lost matrix
icy beacon
#

if I need to solve a deep problem I go to forums

ivory sleet
icy beacon
ivory sleet
#

Are you gonna Pair<First,Pair<Second,Pair<Third,Fourth>>> or what?

mighty pine
ivory sleet
#

Yes but your system becomes less specific and poorly named

mighty pine
lost matrix
tall dragon
ivory sleet
#

Lets say you define some sort of reusable data class, Quadruple<A,B,C,D>

#

First of all this becomes unnecessarily verbose

tall dragon
#
public class Data<A, B, C, D, E, F, G, H> 
{
}

hear me out...

ivory sleet
#

Second, its less specific and thus a bit more poorly named to the scope of ur system

ivory sleet
#

Because it has a more general name?

mighty pine
#

Ok? Variables have names

ivory sleet
#

Its as if I were to use Map everywhere and avoid defining adapters

ivory sleet
#

There is a reason we use DTO classes, DAO classes and design patterned classes

#

I mean sure you can go with a Map<String,Object> for every dto class

mighty pine
#

What

ivory sleet
#

Hm?

#

We define new classes, give them responsibilities with helpful names, thats pretty basic of a design convention in object oriented programming

lost matrix
#

Wait DataFixerUpper isnt scuffed anymore?

tall dragon
#

exactly!. magnificent idea

ivory sleet
#

It is

#

But it follows a functional design

mighty pine
ivory sleet
#

That is not an excuse for poorly naming ur system

mighty pine
#

Wheres the poor naming

ivory sleet
#

There is a reason u have Map.Entry and not MutablePair instead

#

Sure Map.Entry just holds data

#

But we still decided to create a dedicated class for it

#

and records are built to be created as transparent immutable data carriers

#

Name your system, it comes to show meaningfulness and significant value when you have millions of lines of code

#

In kotlin using these generic data classes are different since they have in built semantics to zip and unzip, transform and map those without becoming ridiculously verbose

smoky oak
#

block damage or entity damage

ivory sleet
#

Same with typescript

#

But in java its a hassle

green plaza
#

Where i can find id of packet "Map Data" for every version? from 1.8 to 1.20

quasi berry
#

I'm attempting to load a nested HashMap (HashMap within another HashMap) from a config. The saving component is finished and works flawlessly. I'm struggling to figure out what I should replace toArray with to get this to work properly.

The HashMap initialization:
public static HashMap<String, HashMap<String, String[]>> playerList = new HashMap<>();

The code in question:

        playerData.getConfig().getConfigurationSection("data").getKeys(true).forEach(key ->{
            @SuppressWarnings("unchecked")
            HashMap<String, String[]> listValues = ((Map<String, String[]>) playerData.getConfig().get("data." + key)).toArray(new String[0]);
            playerList.put(key, listValues);
        });
        Bukkit.getLogger().info("Loading playerList");
    }```

A working similar case in which I load from a String, String[] HashMap:
```    public void loadSyndicateData() {
        syndicateData.getConfig().getConfigurationSection("data").getKeys(false).forEach(key ->{
            @SuppressWarnings("unchecked")
            String[] listValues = ((List<String>) syndicateData.getConfig().get("data." + key)).toArray(new String[0]);
            syndicateList.put(key, listValues);
        });
        Bukkit.getLogger().info("Loading syndicateList");
    }```
ivory sleet
# mighty pine Wheres the poor naming

I guess it can be fine if your component/module is generic itself so becoming more specific might be impossible, else its worthy to be specific imo

green plaza
distant wave
#

what does this mean? i dont use linux

empty basin
#

plugins isnt working, was wonering if it has dependancies?

kind hatch
distant wave
#

okay

empty basin
#

sorry, dont understand

#

sorry im dumb what do i need to do?

green plaza
distant wave
#

?nms

green plaza
distant wave
#

im using gradle, does anybody have this but in gradle?

mighty pine
inner mulch
#

Is there an efficient way to track which blocks have been placed by a player and which are naturally generated?

smoky oak
#

theres a plugin that does that, i dont recall the name rn

smoky oak
alpine urchin
inner mulch
#

thank you

green plaza
#

No other option?

smoky oak
#

well yea i just linked that

inner mulch
smoky oak
#

pretty sure it does

green plaza
inner mulch
hazy parrot
#

Yes, put random flag in block rhat is placed by player

alpine urchin
#

oh

#

actual changes

hazy parrot
undone axleBOT
alpine urchin
#

yeah then cope

#

but theres a page for each version

inner mulch
green plaza
hazy parrot
inner mulch
green plaza
alpine urchin
#

should i give you first aid

#

i’m capable

green plaza
#

Because now i have to spend whole night putting each packet id for every version

alpine urchin
#

what arr you making

#

or doing

#

oh

#

you can look at via’s mappings

#

or other projects

#

that do this already

#

what are you developing to need to do this

green plaza
alpine urchin
#

oh with networking?

green plaza
#

Yeo

#
            clientBound.register(PacketPlayerListHeader::new,
                    reg(0x47, V1_8, V1_8),
                    reg(0x48, V1_9, V1_9_2),
                    reg(0x47, V1_9_4, V1_11_1),
                    reg(0x49, V1_12, V1_12),
                    reg(0x4A, V1_12_1, V1_12_2),
                    reg(0x4E, V1_13, V1_13_2),
                    reg(0x53, V1_14, V1_14_4),
                    reg(0x54, V1_15, V1_15_2),
                    reg(0x53, V1_16, V1_16_4),
                    reg(0x5E, V1_17, V1_17_1),
                    reg(0x5F, V1_18, V1_18_2),
                    reg(0x60, V1_19, V1_19),
                    reg(0x63, V1_19_1, V1_19_1),
                    reg(0x61, V1_19_3, V1_19_3),
                    reg(0x65, V1_19_4, V1_20)
            );
#

I have some of them from bungeecord

alpine urchin
#

why not support one version

#

this is overkill for a project like this

green plaza
#

Do you know what limbo is?

alpine urchin
#

a limbo server?

green plaza
#

Yea

alpine urchin
#

yes

#

you could use my packet library

#

it’s cross platform

#

i implemented my minecraft server in it

green plaza
#

So i am making limbo server that support multiple instances running together, where u can upload small schematic

#

Link?

alpine urchin
#

network related

green plaza
#

You are kinda famous

alpine urchin
#

i prefer not to help individuals in dms cause it becomes a mess

#

😂

green plaza
#

I understand

alpine urchin
#

i don’t wanna come off as some weirdo promoting his stuff

#

but you shouldn’t need to spend much time on that stuff

#

it’s too much work

#

you should focus on the engine itself

#

otherwise thats how projects die

#

everything from scratch is overkill

green plaza
#

Its not going to be public

smoky oak
green plaza
alpine urchin
#

yeah

#

but some people urgently wanna make it from scratch

#

to learn

#

then fair enougj

#

but its overkill

#

you won’t get to your engine

smoky oak
#

i would absolutely self promote would i have any plugin worth bragging about

#

which i dnt

alpine urchin
#

you’ll spend a year on networking

green plaza
#

I have mostly have done everything

alpine urchin
#

is it opem source

#

or private you said right

#

if it were open source i would have loved to see your progress

green plaza
#

Only things that need to be implemented is custom maps, inventory, and schematic (world) support, skin support

green plaza
#

It for example allows you to send data from your game server to the lobby so you can put your custom data from gameserver in lobby scoreboard for example

#

Everything 100% configurable. I am thinking about selling it

#

This is the coolest part so far XD

smoky oak
#

wtf is that console lol

green plaza
alpine urchin
#

lol

smoky oak
#

i dont recognize that GUI style hence the question

#

that some sort of reformatted IntelliJ?

green plaza
smoky oak
#

well im aware of that though i havent bothered to set it up, i dont recognize the IDE youre running

smoky oak
#

ok

green plaza
#

I have this little button and it turns on BungeeCord

smoky oak
#

must shift the buttons around then compared to normal console

#

wdym? Runnables dont self-terminate unless they're only set to run once or you make them stop

green plaza
alpine urchin
#

?xy

undone axleBOT
alpine urchin
#

@quaint mantle you’re developing what

#

why should it run forever

green plaza
#
while(true) {
}
smoky oak
#

wellllll thats not a good idea

#

runnables still run on the same thread

#

that just freezes your server

alpine urchin
#

what are you developing

#

maybe run a task every tick or every few ticks

#

but what are u making

#

you might think you’ve got the right approach

#

but be wrong

smoky oak
#

why?

#

because if that'S all there is cant you just check the inventory when it's opened/closed

#

what you probably want is the inventoryInteractEvent and cancel it if it'd put an egg into the EC

#

no u cant

#

theres events for all that too

#

or they're part of the inventoryClickEvent

shadow night
#

I'm pretty sure inventoryevents handle everything possible

spare hazel
#

how can i get all the keys in a hashmap

smoky oak
#

hashmaps have a method to get all keys, dont know the name

#

check that

spare hazel
#

alr

smoky oak
#

you probably still want that plus whatever other events are applicable instead of doing it over inventoryInteractEvent, unless you do something ilke this

if(event instanceof InventoryClickEvent cEvent){ ...
quasi berry
#

I'm trying to take a config file like this and map it onto a HashMap<String, HashMap<String, String[]>>:

  a51bace4-58c3-4852-bb89-6c788489950c:
    syndicate:
    - test```
This is my current solution but it returns an error (Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null):
#

I'm very new with Spigot dev and Java as a whole so I may be overlooking a far simpler solution as well

#

Unsure why this won't work though

smoky oak
#

if its 'null' you want either to not init that section or insert null into it

#

put that into a temp variable and do an if(temp == null){}else{}

quasi berry
#

Alright I'll give that a go

near mason
#

how to get block state from block data?

rotund ravine
#

Have you tried googling that one

austere cove
#

my guy couldn't find BlockData#createBlockState() 💀

alpine urchin
#

mean staff

austere cove
#

use the latest spigot version

rotund ravine
near mason
#

ok

native bramble
#

In runTaskAsynchronously it says:
Schedules this in the Bukkit scheduler to run asynchronously.
how can i do this?

tall dragon
#

?scheduling

undone axleBOT
alpine urchin
#

Bukkit.getScheduler().runTaskAsync….

native bramble
#

ty

native bramble
#

BukkitRunnable.runTaskAsync

near mason
#

i use BukkitRunnable#runTaskTimer

alpine urchin
#

no

#

Bukkit.getScheduler().runTaskAsynchronously

chrome beacon
#

Just read the wiki page

chrome beacon
#

It tells you what to do

austere cove
#

only scheduling a BukkitRunnable is deprecated

#

all the others work

chrome beacon
#

?scheduling

undone axleBOT
native bramble
scenic onyx
#

hi! i give this error in via version
[19:04:01 INFO]: [ViaVersion] ViaVersion detected server version: 1.8.x (47)
[19:04:01 WARN]: [ViaVersion] This version of Minecraft is extremely outdated and support for it has reached its end of life. You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. Please consider updating to give your players a better experience and to avoid issues that have long been fixed.
[19:04:01 INFO]: [ViaVersion] Finished mapping loading, shutting down loader executor!

#

how i fix it?

alpine urchin
#

it’s asking you to update

#

minecraft version

#

of your server

delicate lynx
#

use a version that is not 1.8

austere cove
#

or fork viaversion to keep 1.8 supported :)

scenic onyx
scenic onyx
#

ok

quasi berry
smoky oak
#

whatever gives you the null thign

spare hazel
#

why are these codes giving an error on player join?
playerjoin listener:

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent e){
        if(e.getPlayer().isOp()){
            e.getPlayer().getInventory().addItem(new TestShovel().build());
        }
    }

test shovel class:

public class TestShovel extends CustomItem {

    {
        setId("TXT");
        setMaterial(Material.WOODEN_SHOVEL);
        setName("txt");
        setRarity(Rarity.EPIC);
        setAdditionalLore("txt!");

        addStat(Stat.DEFENSE, 69f);
    }

    public void onBlockBreak(BlockBreakEvent e){
        e.getPlayer().sendMessage("TXT");
    }
}

custom item class:

public abstract class CustomItem {
    //variable removed dis limit

    public ItemStack build(){
        ItemStack item = new ItemStack(material);
        ItemMeta itemMeta = item.getItemMeta();
        Multimap<Attribute, AttributeModifier> modifiers = itemMeta.getAttributeModifiers();
        ArrayList<String> lore = new ArrayList<>();

        if(stats.size() != 0){
            for (Stat key : stats.keySet()) {
                lore.add(ChatColor.RED + key.getName() + ": " + ChatColor.GRAY + stats.get(key));
            }
        }
        lore.add(ChatColor.GRAY + additionalLore);
        lore.add("");
        lore.add(rarity.getColor() + "" + ChatColor.BOLD + rarity.getName() + " Item");

        itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_UNBREAKABLE);
        itemMeta.setLore(lore);
        itemMeta.setUnbreakable(true);
        itemMeta.setDisplayName(ChatColor.AQUA + name);
        itemMeta.getPersistentDataContainer().set(HypixelCustomItems.getPlugin().getItemKey(), PersistentDataType.STRING, id);

        item.setItemMeta(itemMeta);
        return item;
    }

//getters and seters removed

    public void addStat(Stat stat, float amount){
        stats.put(stat, amount);
    }

    public abstract void onBlockBreak(BlockBreakEvent e);
}```
tall dragon
spare hazel
tall dragon
#

dont you have a console open where you can copy it?

spare hazel
#

yes but its windows server 2012 so the cmd isnt that long and it can fit half an error message

tall dragon
#

well get the log then i guess yea

#

and copy the error from there

spare hazel
#

ok lemme copy it

smoky oak
#

discord plugin

#

writes logs to a channel

spare hazel
#

yes i know

#

oh hell nah man i cant copy from an rdc to my pc

tall dragon
#

u cant even just download the log file??

#

we cant help much without a tracktrace

torn shuttle
#

there's no way to a plugin in drafts is there

spare hazel
tall dragon
#

your hashmap is null

#

probably forgot to assign it

#

but you removed the vars so cant see

spare hazel
#

oh wait ur right

#

im so dumb

maiden thicket
#

sorry i didnt read above that msg

shadow night
maiden thicket
#

doesnt via have like 3 plugins including viaversion to support up to like 1.7

torn shuttle
#

yes

maiden thicket
#

Yeah

#

Mb

austere cove
maiden thicket
#

Oh I mean I don't think the devs would stop supporting it but isk

#

Idk

#

I assume if they stop supporting that means they would abandon ViaRewind and ViaBackwards or whatever it is

#

Because it defeats the purpose of the plugin then

spare hazel
#

just a personal question: is it just me or does your brain also reset to factory settings every like 5 minutes and you forget what were you doing and you check your code to remember again

maiden thicket
#

When IJ instant builds im like ah because my goofy ass built it already

tall dragon
maiden thicket
#

3 hours?

#

Who let you sleep

#

Coders dont sleep

tall dragon
#

yes they do

shadow night
#

maybe I should stop coding while high

tall dragon
#

while its day of course

maiden thicket
#

True

#

We be nocturnal

tall dragon
maiden thicket
tall dragon
maiden thicket
#

Or code ur own list that deletes an object if it exists already

#

ez

shadow night
#

I don't even know what that code is for lmfao

#

"if the list contains the player, add the player to the list"

spare hazel
shadow night
#

lmao

#

well, at first I actually just looked at how essentials did that and copied lmao

spare hazel
#

did they do it without packets?

grim ice
shadow night
woeful valve
#

Hello

spare hazel
woeful valve
#

How I add enchantment to a sword sharpens

#

Sharpness (in code)

spare hazel
shadow night
spare hazel
#

i dont think so

woeful valve
#

How I put sharpness i the bracket

shadow night
#

javadocs be like

woeful valve
spare hazel
tall dragon
#

except its not an enum but sure

woeful valve
#

No way to do that via name.addenchantment(…)

spare hazel
#

at this point im too tired to open Intellij idea to tell you
can someone else help him?

woeful valve
#

Ok

young knoll
#

If you want to use the name you need to get the enchantment by namespaced key

tall dragon
#

that would only stop the respawn anchor block stop from exploding

#

it would not stop the explosion itself

#

iirc

tender shard
#

yeah just download angelchest free and extract the .jar, it's in there somewhere lol

#

here it is

#

crafting slots are 41, 42, 43, 44 and result is 45

shadow night
#

I definitely was high

#

like, what, why

shadow night
#

To have crafting slots

#

And why is that amazing image showing inventory slots not pinned in this channel

torn shuttle
#

fuck you chatgpt, I had it write a single snippet of code just to see how it would work and it injected a bug that delayed my release by 4 hours and is pushing to have me have a heart attack by the time I'm 35

#

I even had a solution for what it was doing in another plugin, I just wanted to see how it would do

grim ice
#

for that

grim ice
#

it's self-explanatory

#

how numbering works

torn shuttle
#

FreeMinecraftModels and the EternalTD plugin I've been working on

#

it was the last issue

#

I'm just doing a clean install to double check

shadow night
grim ice
#

it's only worth $448

torn shuttle
grim ice
#

of one's time if you're an average developer

shadow night
#

Wtf how much do you get per hour

grim ice
#

according to google

#

the average ai dev

#

gets paid 62.5 per hour

#

😀

torn shuttle
#

yeah we're def the average ai dev in here

grim ice
#

💀

torn shuttle
#

sorry did you say something I couldn't hear you over the sound of my lambo revving

shadow night
torn shuttle
#

this one sounds bad I think I'll crash it and buy a new one

grim ice
#

I'm bad at math

grim ice
#

I wrote a 4 instead of a 2

shadow night
#

Lol

torn shuttle
grim ice
#

😭

#

tbh

#

I'm wondering what should I do

#

do I go for the generic doctor shit

#

or do I go for AI

#

but I'm not sure how well paying AI is in algeria

#

💀

tall dragon
grim ice
tall dragon
#

perfect then

grim ice
#

so this requirement is fullfiled

alpine urchin
#

they just won’t put any effort in fixing further bugs

#

or any improvements

#

that message was more of a warning lol

#

begging you to update

austere cove
#

Its gonna stay supported followed by the devs just wont support it

alpine urchin
#

?

austere cove
alpine urchin
#

my point is it will still run

#

and should work fine

austere cove
#

Either way is there are issues the devs wont fix, you have to do it yourself

alpine urchin
#

yes

#

it’s not like it will no longer run on 1.8

#

eventually maybe

#

eventually maintaining all these versions will be too much

#

protocol changes too much

#

minecraft 2.0

quaint mantle
#

1.8 -> newest is hell

alpine urchin
#

viatimetravel

shadow night
#

Developing for 1.8 is awful

#

Developing for 1.20 is amazing

native bramble
#

how can i check that player hold left click?

smoky oak
#

in what context

#

inventory? world?

native bramble
#

world

tall dragon
#

there really is no reliable way to do that i believe

native bramble
#

click on block

smoky oak
#

doesnt that event trigger when you release aswell

tall dragon
#

yea true

native bramble
#

BlockDamageEvent

tall dragon
#

this one i believe

smoky oak
#

unfortunately that only works on blocks. If you hold left click at air all bets are off

#

the playerInteractEvent doesnt trigger if you stop attacking air cuz it's one punch you throw, not a continuous action

native bramble
#

i want to do punch sound when player kicks the door

quaint mantle
#

Is it possible to create a custom packet in BungeeCord?
I know it actually is, but how would I do it?

quaint mantle
#

Thanks tho

hazy parrot
#

Cool jetbrains logo

smoky oak
#

anyone know of a way to scan for maximal depth (number of method calls before termination of function) of java source code?

eternal oxide
#

pass a counter

smoky oak
#

without executing i meant

#

actually I'll just stuff a temporal restraint onto it, that'd work too

eternal oxide
#

thats probably not too accurate

#

depends what you are doing though

smoky oak
#

restricting threads to not cause time out errors

#

long story

vocal cloud
#

Sounds like bad code scareDog

smoky oak
fading stratus
#

I need a plug-in dev for an smp plug-in

smoky oak
#

you would usually look for people like that on the spigot searching for devs thing

fading stratus
#

Where is that?

smoky oak
#

spigotmc forums iirc

fading stratus
#

K

smoky oak
#

?services

undone axleBOT
quaint mantle
#

One question to the custom packet registration, is the ID field the minecraft packet id? For example; In BungeeCord source code, the "KeepAlive" packet is registered as this:

TO_CLIENT.registerPacket(
                    KeepAlive.class,
                    KeepAlive::new,
                    map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
                    map( ProtocolConstants.MINECRAFT_1_9, 0x1F ),
                    map( ProtocolConstants.MINECRAFT_1_13, 0x21 ),
                    map( ProtocolConstants.MINECRAFT_1_14, 0x20 ),
                    map( ProtocolConstants.MINECRAFT_1_15, 0x21 ),
                    map( ProtocolConstants.MINECRAFT_1_16, 0x20 ),
                    map( ProtocolConstants.MINECRAFT_1_16_2, 0x1F ),
                    map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
                    map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
                    map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 ),
                    map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F ),
                    map( ProtocolConstants.MINECRAFT_1_19_4, 0x23 )

Does this means, in Minecraft 1.8, the KeepAlive packet has the packet ID 0x00?

silver robin
quaint mantle
#

Aight, thanks

desert tinsel
#

What Player#hasAI returns? just asking

buoyant viper
#

hopefully False... expandssia

#

but also just fck around n find out, getLogger().info("Sentience? " + getPlayer().hasAI());

quaint mantle
#

🗿

young knoll
#

🤔

quaint mantle
#

As the player doesn't have an AI

#

It's controlled by "something else"

#

A naturally spawned EnderDragon for example, will return true, because the game has control over what the dragon "thinks"

#

If basically means that the entity "exists" by himself, it has thoughts, feelings, loves and cries, have goals, or simply exists and nothing else, like an empty recipient, with no soul

wide coyote
#

okay that was kinda deep for a development convo

torn shuttle
#

finally

#

it is done

#

it's out

#

I can rest

smoky oak
#

whatd u do

torn shuttle
#

or rather, go do maintenance on my other plugins

echo basalt
#

It's not hard

young knoll
#

They pay people

simple schooner
#

wtf

torn shuttle
#

not only did I not pay people it's not even a particularly neat page, I didn't have much time to make it

#

I'm leaving in two days and still have two more plugins to do updates and bugfixing for

simple schooner
#

I finally made it working after 1 day and a half

livid dove
#

Well done my man

#

Now imo, first thing you should do asap , as its ur first plugin, is find the bit that kicked ur arse the hardest. The bit uve just got working. And make a comment rn explaining, in detail , what the issue was and how you solved it

#

Future you will thank you

simple schooner
livid dove
#

So go into detail , with a comment in ur code in the area where u finally fixed it

#

It'll help with retention n shit

simple schooner
#

i didn't know nothing about schedulers till now lol

simple schooner
#

finally now time to add the "new line" feature

#

I wonder how I'm gonna implement this

echo basalt
#

generic types woeisme

livid dove
quasi berry
#

Can someone tell me why the selected line returns "java.lang.NullPointerException: Cannot invoke "java.util.List.toArray(Object[])" because the return value of "org.bukkit.configuration.file.FileConfiguration.get(String)" is null"

This is the config: data: a51bace4-58c3-4852-bb89-6c788489950c: syndicate: - test

livid dove
#

Not entirely sure but my guy, as a general note MockBukkit is brilliant for solving issues like thi

#

The debugger literally gets rid of 90% of the guese work

echo basalt
#

is this cast safe?

#

Got brain fog atm

quasi berry
# wet breach Why are you casting?

I'm trying to load these values into a HashMap<String, HashMap<String, String[]>>, if there's a better way to do it that would be super helpful as well

livid dove
# echo basalt ugh

Never gonna work im afraid. Ran into this exact issue before.

it will always bee Class<T> which, in a cruel twist of fate, will never be considered okay for Class<? extends GameMapTemplate<?>>

wet breach
#

The api lets you get lists

echo basalt
#

Yeah but T extends GameMapTemplate<?>

wet breach
#

Also syndicate is not a configuration section

livid dove
young knoll
#

Ah we love java generics

livid dove
#

Its really dumb in some generics

#

Sorry kid, i'll save you trouble now, its a fucking bust

echo basalt
#

fucking

#

java cli

livid dove
#

If you manage to solve it, legit gg. But I dumped 12 hours of my life into that rabbit hole

simple schooner
#
plugin.textDisplayMessage = plugin.textDisplayMessage + "\n" + newLineText;``` in theory, this should create a new line right?
young knoll
#

I mean generally the solution is to just cast

#

But it’s annoying that you have to

young knoll
livid dove
#

nothing helped

#

Though tbh, I saw like what? 3-4 generics in that gamestate class shit?

My man you are probably approaching the problem wrong if ur relying on 3-4 generics

quasi berry
livid dove
#

In one dang method

wet breach
#

I am sure maybe one of the others may be kind enough to help on the code end

echo basalt
#

getStringList

inner mulch
#

Is it more efficient to have all the, for example BlockBreakevent stuff, in one listener, or would the more organised varient of having blockbreakevents for each category of something impact perfomance?

wet breach
livid dove
young knoll
#

They are called with reflection, but it’ll get optimized after a while

#

Alternatively you can have one actual listener that just calls various other methods for each thing

inner mulch
#

i want to have 5 skills, mining, foraging and so on, i want to have all of the kinds of blocks belonging to one skill in one listener

inner mulch
wet breach
#

Not if you do it right. What you want is easily done with a few classes and a single listener for it

livid dove
wet breach
#

Just map the blocks to the skills

inner mulch
inner mulch
livid dove
#

*Aye have it as a Set<Material> in each of the skills and have one singular block break event. Have it check if the player has a skill, then check the Set<Material>.

wet breach
#

Hashmap is one way. Not the only way. Could use enum

livid dove
#

I'd go with Set<Material> for the skill check itself and then enum for the XP imo

inner mulch
#

i never used an enum

livid dove
#

time to learn son

inner mulch
#

im not really experienced

livid dove
#

Hey

#

everyone starts somewhere

#

enums are a very useful tool for values that wont change 🙂

inner mulch
#

i'll look into that

livid dove
#

Defo worth adding to your tool kit

young knoll
#

Stuff in minecraft always changes :p

livid dove
#

Infact you know what makes this easier

young knoll
#

Enums are so 2012

inner mulch
#

so only one listener and no organisation :(?

livid dove
#

@inner mulch you ever used the "Material" in spigot?

inner mulch
#

yes

livid dove
#

Material is an enum 🙂

inner mulch
#

oh

young knoll
#

For now

livid dove
#

So listen, imo you could get away with aving one single method that is like 20 lines long max

wet breach
livid dove
#

Step 1:
Check if the player has a skill
Step 2:
Check the skill's Set<Materials> to see if it equals the broken block
Step 3:
Do ur funky xp stuff via the Enum

#

Then it doesnt matter what skill, what block, what action etc. All done in 20 odd lines :L

inner mulch
#

My Internet was broken

livid dove
#

no worries man

#

it wont be the only approach

#

might not even be the "best" approach

#

but hey every day is a learning day

simple schooner
#

YOOO ITS SOO COOOOOL

#

OMFG

inner mulch
#

what?

simple schooner
#

i couldn't believe it'd work

hybrid sapphire
#

damn why u so amzed

echo basalt
#

Let him enjoy his first plugin

livid dove
#

Mhm.

simple schooner
echo basalt
#

A set is basically an unordered list

simple schooner
#

U can even create it through a custom gui 🤩

echo basalt
#

With a different internal structure

#

It's a collection

quasi berry
hybrid sapphire
#

thats nice

#

im new to js myself

#

im making an annihilation plugin

echo basalt
quasi berry
#

just cast it to an array then? alr

livid dove
# inner mulch wait how do i use a set?

https://youtu.be/QvHBHuuddYk

Yeet!

This man will basically take you from 2/10 to at least 5/10 just from learning the various concepts he teaches

Full tutorial on Sets and HashSets in Java!
Thanks to Mailgun for sponsoring this video! Go to https://mailgun.com/john to try Mailgun today.

☕ Complete Java course: https://codingwithjohn.thinkific.com/courses/java-for-beginners

What exactly are Sets and HashSets in Java? How are they different? How do you use them, and how are they different...

▶ Play video
young knoll
#

Sets also don’t allow duplicates

#

Well, hashset doesn’t

livid dove
quaint mantle
#

Is there a way to change the client's skin that they see or is that done client side

echo basalt
#

There is a way

#

it's hacky

quaint mantle
#

Does the player info packet get sent to themself?

inner mulch
livid dove
inner mulch
#

:( ok

livid dove
#

Trust me moment you know about those 2. (Use this guys channel) you will weep with joy 😉

inner mulch
# livid dove Trust me moment you know about those 2. (Use this guys channel) you will weep wi...

What are abstract classes and methods in Java, and how and why would you use them?
Also, what's the difference between an abstract class and an interface?

Abstract classes can seem like a wacky, complicated Java concept, but they're pretty simple. We'll explain them in just a few minutes in this beginner Java tutorial video lesson.

How do I ma...

▶ Play video
simple schooner
#

bald supremacy

livid dove
#

Essentially, imagine being able to make a "skill" class, that has fields like the set of materials, the name, the effects to call etc.

And then being able to make specific classes that use that skill class as a "parent"

#

So you have all the same building blocks, but decide the specifics in each class

inner mulch
#

okay

livid dove
#

Imo abstracts and interfaces are the difference between 100 lines of code per class and 20-30 lines per class (if done right haha)

echo basalt
#

abstract factories

#

@livid dove contrary to what you said

#

all the map caching works

#

Minigame lib is starting to take shape

#

shit my ip

#

eh whatever this bitch works

echo basalt
wet breach
echo basalt
#

eh this works

simple schooner
#

how do you iterate through an hashmap

young knoll
#

Iterate over the entries

#

.entrySet iirc?

simple schooner
#

uhm, I'll take a look on those

quasi berry
#

I'm working on creating a basic land-claim plugin in which I'll need to store data for syndicates (basically factions). I need to store a variety of values for each created syndicate such as tags, banner patterns, player lists, role configurations, etc. This seems like an issue that is best tackled with a HashMap (which each syndicate name as a key) and the rest as a list of values- however in certain cases I'll need to have further lists for those values while for others I won't. What is the best way to tackle this problem?

#

I'm open to any and all suggestions including a complete restructuring if needed

young knoll
#

Map<String, Syndicate>

#

With syndicate being a custom class that holds everything you need

quasi berry
#

Is there any good documentation on using classes for data storage?

young knoll
#

You just make a bunch of fields

#

And methods to interact with them

opaque scarab
#

When item entities move, EntityMoveEvent is triggered right?

#

I did a test where I send a message (don’t judge me) if a moving entity is an instance of an item entity, but nothing shows up.

river oracle
#

for some reason I can't find BlockSign in CraftBukkit

#

should be around here, but It's just not

#

I also did an entire project search its imported and used in places, but literally just doesn't exist outside of that as a class

echo basalt
#

might not have been patched

river oracle
#

what do you do to make a new patch

echo basalt
#

it's on the readme

river oracle
#

alrighty

distant wave
#

Does anyond know how can i get auth lib in my plugin?

#

Do i just need to use it as gradle dependency?

echo basalt
#

Yeah

#

com.mojang:authlib:1.6.25

river oracle
#

How do you get a CraftBukkit block from NMS

distant wave
#

Ye i know

river oracle
#

from NMS is what I meant

echo basalt
river oracle
#

thanks

echo basalt
#

It's just a wrapper class

river oracle
#

ahhh i see

echo basalt
#

It's more of an adapter class actually

river oracle
#

I'm pretty new to a lot of NMS stuff trying to get used to this stuff so I can PR more

#

tryna add some event rn

#

also so I can just leverage more of the server

#

and patch shit in if I ever need on private servers

echo basalt
#

ye

#

I'm just happy with getting my minigame lib to work nicely

#

Takes like 50 lines to add a new minigame

#

Half of those are loading the map from a config file

river oracle
#

are you allowed to add params to methods in NMS or am I going to have to hack

echo basalt
echo basalt
river oracle
#

ahh okay

echo basalt
#

got maybe 5 hours on this project

#

but it worky

#

And cleanup is basic too

river oracle
#

I hadn't touched minigames and was expected to make and maintain a game engine now that's some practice :P

echo basalt
#

I wrote a guide like last week

river oracle
#

on what

echo basalt
#

minigames

river oracle
#

ahhh

#

Woulda been nice a year ago xD

echo basalt
#

I was absolute doodoo at minigames a year ago

unkempt peak
echo basalt
#

It's really basic and I need to write like 19x more content

unkempt peak
#

Fair enough

echo basalt
unkempt peak
#

thanks

river oracle
echo basalt
#

probably

#

I'm just going off memory

river oracle
#

its just called use spigot doesn't have it mapped, but mojang map says triggeredEvent lol

echo basalt
#

patched spigot maybe like a year ago

river oracle
#

meh fuck it I can always change the Reason if I get it wrong

round citrus
#

Hey I need help with a plugin that I'm using

river oracle
#

@echo basalt do you know how to remake patches? not sure what I'm supposed to be targeting my path towards when I do

#

nvm figured it out sorry for the ping

random wedge
#

Anyone know if there is an event for when the item for suspicious sand/gravel gets generated? It looks like the LootGenerateEvent isn't getting called for it even though it triggers a loot table generation. I suspect there's a missing event or it was missed for getting added to the LootGenerateEvent since it's such new API

unkempt peak
#

You've tested it with other loot tables right?

round citrus
#

How do I get this to work i'm trying to make a command where if the warp exists it'll delete it and give you $500 if it doesn't it won't do anything it'll just say it doesn't exist. Delete_warp:
command: /del
type: RUN_COMMAND
runcmd:

  • '/delwarp $arg1'
  • $Script$%if%$arg1==$arg1
  • '/eco give * 500'
  • $Script$%else%
  • $text$doesn't exist
simple schooner
#

is that even java

round citrus
#

I have been messing with it and I just can't figure it out trying to just create a command

eternal oxide
round citrus
#

I asked there but no one helped

eternal oxide
#

then be patient. This is not the right channel

round citrus
#

okay

unkempt peak
simple schooner
#

dont know what that is

#

holy shit I finally finished my hologramm plugin

#

omg this is soo fucking cool!!!

#

4 days in to learning and I already made my first big project

unkempt peak
#

Actually I think it's a custom script of some sort for that plugin, but skript is a plugin that basically allows you to make simple plugins in a scripting language.

unkempt peak
simple schooner
#

and u can create it through a custom gui

#

ISN't THAT COOl

#

Eeeee

#

and your created holograms are stored so that you can delete it anytime you want to

unkempt peak
#

Ey that's cool

simple schooner
#

it only took 500+ lines of nested code

#

xd

remote swallow
#

how are holograms stored

simple schooner
#

idk how to make my code fancy, I'm new to java

simple schooner
remote swallow
#

what about restarts

simple schooner
#

i wont show you the code you will vomit

remote swallow
#

that map wont exist

unkempt peak
#

Could be worse

simple schooner
unkempt peak
#

Yeah is it saved to file?

simple schooner
#

nope

#

😭

#

do I have to

unkempt peak
#

Well looks like ya got some more work to do

simple schooner
#

fuuuuuuuuuuuuuuuu

#

how to not make the file show in the server's file folder

unkempt peak
#

If you want advice on saving things just ask

unkempt peak
chrome beacon
unkempt peak
simple schooner
#

ok

chrome beacon
#

Either store in pdc or use a file that users can edit/remove

simple schooner
chrome beacon
#

?pdc

chrome beacon
#

?morepdc

undone axleBOT
simple schooner
#

damn, I don't know how to work with apis

unkempt peak
eternal oxide
#

?configs

undone axleBOT
unkempt peak
#

I would use a yml

simple schooner
#

i'll just store this in a yaml file

simple schooner
#

welp this will take another 1 day

#

😭

#

or maybe less

#

idk

unkempt peak
#

Just load the yml to memory and save onDisable

gray saddle
#

how do i obfuscate my .jar file

simple schooner
#

my code is nested, it's super hard to navigate and find things

#

luckily ctrl + f exists

unkempt peak
#

Or if you want to get fancy serialize it to dat file

chrome beacon
#

Or just use PDC

simple schooner
chrome beacon
#

Which saves to the data files

unkempt peak
simple schooner
#

it's only been like 4 days since I started learning

chrome beacon
#

Chunk

simple schooner
#

😭

#

i dont know what those are

unkempt peak
#

ig that could work

chrome beacon
#

So you can load and unload when needed

simple schooner
#

im gonna take a rest for now, I have been working for like 8 hours

#

my brain got melted

chrome beacon
#

Instead of always keeping things in memory

simple schooner
#

i didn't even eat lunch

unkempt peak
#

Idk I mean unless your expecting a vary large amount of holograms to be stored the memory would be pretty negligible

chrome beacon
#

Very minor optimization but yeah 🤷‍♂️

simple schooner
#

i dont even know how I made this work

#

i mean the code is nested with alot of if statements

#

😭

#

IT HURTS my eyes everytime I look at it

chrome beacon
#

Time for rewrite using your new knowledge

simple schooner
unkempt peak
#

lol well maybe research DRY

simple schooner
#

also look at how many hashmaps I made

#

most of them I didn't even need

unkempt peak
simple schooner
#

I could just get rid of them and everything will work fine

simple schooner
unkempt peak
#

So,,, why do you have them?

simple schooner
#

idk man I just dont bother on changing stuff, I don't wanna break it

unkempt peak
#

What in the world where you even trying to accomplish here??

simple schooner
#

i dont know

#

😭

#

my brain got melted

#

im an idiot

unkempt peak
#

I'm sorry I know your just starting but it's hard not to laugh about that abomination

#

Maybe try learning a bit more java before you jump into your next project lol

simple schooner
#

I'm aware of my mistakes I just dont bother on removing them

#

😭

#

I dont wanna break it

simple schooner
unkempt peak
#

So you just leave a bunch of useless code in your project?

unkempt peak
#

lol fr tho there are alot of really good resources out there for learning java

simple schooner
#

im about to go crazy

#

but hey atleast its functioning well

#

:DDDD

unkempt peak
#

Please get the fundamentals down before jumping into another project. It will save you and other people alot of time and pain trust me.

simple schooner
#

i thought I could grasp java because I'm familiar with lua

#

:C

#

turns out I was soo wrong

simple schooner
simple schooner
smoky oak
#

as stupid as it may sound, grab a thin (!) book about learning java and read it front to back. Helped me immensely with C++

simple schooner
#

i dont have money to buy books

smoky oak
#

some of those are available for free online

#

worst to worst go to w3schools

unkempt peak
simple schooner
#

Okay i'll learn the fundamentals :CC

unkempt peak
simple schooner
#

okay

#

welp bye bye now I'm gonna eat

unkempt peak
#

Good luck, I think you could be a great dev. Seems like you have a lot of enthusiasum about making projects.

#

Oh also check out Alex Lee on youtube @simple schooner

simple schooner
#

I will, thank you for your suggestions.

unkempt peak
#

If you help on something specific in java or spigot feel free to @ or dm me

simple schooner
#

Okay thank you

near mason
#

returning false on command doesn't do anything except the usage message right?

eternal oxide
#

correct

round finch
#

Is hashmaps in hashmaps acceptable?

unkempt peak
round finch
#

🤣

smoky oak
#

you should see some of the stuff i did

#

by the way

unkempt peak
#

I would usually wrap something like that in an object to make it easier to use

smoky oak
#

nested hashmaps of any depth are considered 'equal' as an argument

#

so HashMap<String, HashMap<String, Object>> and HashMap<String, HashMap<String, HashMap<String, Object>>> as the only elements in a method signature dont work as overloading parameters

unkempt peak
#

It really depends on what your storing and how your using it

unkempt peak
remote swallow
smoky oak
#

im writing this from memory sue me

round finch
#

IDK what propper way to store stuff
Maybe it depends on what you're making hmm

smoky oak
#

alright now im not worried 🤣

unkempt peak
unkempt peak
#

I'd say generally it's not the best idea but it can be acceptable in some situations

neon nymph
#

Hi guys, I have a question. Which is better resource-wise when setting up a minigame network, having one server per lobby and per map, or having only one server for all, lobby and maps included?

Follow up question, how does a server treat the ram dedicated to it? I don't have much knowledge on that field yet. If we dedicated 4gb to a server, does it keep those 4gbs all to itself or does it allow other servers as well to share it? For instance a system has 8 gb ram total and I'd like 3 servers with 4gb ram dedicated to each running in it

smoky oak
#

well

compact haven
#

but it depends on exactly how you specify the allocation

#

for example, -Xms4G will eat 4G in heap regardless

#

but -Xmx4G will scale to at most 4G

#

as for a minigame network, welll xd

smoky oak
#

Keep in mind that MC is (mostly) single-threaded. I would really, really recommend running separate servers and disabling nether / end in em for your lobbies and minigames

unkempt peak
#

You should never over allocate though, that's a great way to get a memory crash

compact haven
#

^ my recommendation as well, separate servers with as much as possible disabled

unkempt peak
#

There's no reason for it

unkempt peak
compact haven
#

as for proper architecture of a large minigame server, you'd be auto scaling with containers

#

but doge_kek that's once you get several hundred players at least

#

pepeThink and make sure you aren't allocating all 8GB of an 8GB system (example)

#

the system takes a small amount of memory as overhead for the OS

unkempt peak
#

Yeah that's a good point

compact haven
#

so, to be safe, block out like 1.5gb as unusable. or if you want exacts, you can run htop on your env. with no servers running and figure out around how much your system takes at idle

unkempt peak
#

If your running windows for some reason leave at least 2-4 depending on the version

smoky oak
#

welllll windows 10: 8 GB for OS + Chrome

unkempt peak
#

Yeah fr

#

4gb would be the absolute minimum on windows 10 and that's with only the server running

smoky oak
#

only 1.5 GB of that is chrome

#

everything else is background stuff that doesnt seem to add up to 6GB

unkempt peak
#

I don't think windows 10 eats 6.5gb by itself, at least not if you kill start up apps and everything that isn't necessary

neon nymph
#

I see, thanks for the knowledge dump guys lol, I learned a lot 😄 I now know what to search, I'll just google the rest later

smoky oak
#

i do disable auto startup unless necessary, but i've discovered that even with that a good deal of stuff launches itself if installed anyways

#

for example you cant disable wacom drivers auto startup

#

you'd have to uninstall em

unkempt peak
#

Yeah some stuff can be real stubborn

compact haven
#

you can't disable Wacom drivers? doge_kek

#

isn't that just for drawing tablets

unkempt peak
smoky oak
#

try 400

smoky oak
unkempt peak
#

Well a driver wouldn't be in auto boot

smoky oak
#

to be fair it just sits there and eats 40MB

#

so eh

unkempt peak
#

Might be in task scheduler, if not you would probably have to do a regedit or something

compact haven
#

or perhaps it's in device manager

smoky oak
#

isnt that only current devices?

compact haven
#

but honestly 40MB isn't worth the hassle of enabling the driver anytime you want to use the tablet

compact haven
#

among WiFi drivers as well, since those always fuck up on my laptop

smoky oak
#

ah, and yea it is

#

i remove my mouse, my input devices decrease

#

i no longer go to device manager since i learned windows has a shortcut to force a restart of your graphic drivers

#

control shift windows b

#

it beeps and freezes for 20 seconds tho

lilac dagger
#

is there a way to warn this with annotations?

#

i already have the not null

compact haven
#

what

sullen marlin
#

Warn what

lilac dagger
#

i want to prevent null values

unkempt peak
#

Ey what's up md_5

compact haven
#

in arguments?

lilac dagger
#

from being passed to path

compact haven
#

then a contract, no?

sullen marlin
#

Is Path.of annotated?

lilac dagger
#

yes

remote swallow
#

the entire thing cant be null

sullen marlin
#

It's varargs

remote swallow
#

its entries can

sullen marlin
#

You need two annotations, I think it's possible that way

remote swallow
#

@NotNull String @NotNull ... nodes

lilac dagger
#

oh

#

thank you

compact haven
#

though varargs as a whole can't be null

#

to my knowledge, nodes != null

formal bear
#

Is there some structure API or I need to create one myself? I want to create some sort of preset housing.

compact haven
#

only nodes[0] == null

smoky oak
#

theres a struct api for the structure blocks

#

someone made a lib too ive used it

quaint mantle
#

is there a way to make commends in the plugin.yml

smoky oak
#

cant recall the name

sullen marlin
#

Yes, search the javadocs for structure

smoky oak
#

redlib maybe

remote swallow
sullen marlin
quaint mantle
#

comments

#

sorry

sullen marlin
#

# comment

remote swallow
#

what for

smoky oak
#

yea thas the name

quaint mantle
quaint mantle
unkempt peak
#

How big is your plugin yml?

formal bear
smoky oak
#

howd u make that text so big md_5?

remote swallow
#

markdown

smoky oak
#

#h1 text

quaint mantle
smoky oak
#

nope

unkempt peak
#

Also are normal yml comments not allowed in plugin yml?

remote swallow
#

its just the hashtag

smoky oak
remote swallow
#

E

smoky oak
#

text

#

ah

#

also why is that a channel

#

i mean yea it's accurate but not really descriptive

sullen marlin
smoky oak
#

iirc # works

remote swallow
unkempt peak
#

I thought they meant normal "#" comments weren't working in plugin yml

compact haven
#

literally any valid comment in the spec should work, considering the yml is parsed by snakeyml

#

am I wrong?

#

pretty sure I've used comments in plugin.yml before

unkempt peak
#

Yeah it should be irrelevant

#

to the parser

compact haven
#

right

quaint mantle
#

If i set another permisson as a child does the child get the parents permisson or the parent the childs permisson

unkempt peak
#

Every child will be included in the parent if that's what your asking

#

Well actually it would be parent.*

sullen marlin
#

It's whatever the parent is, * isn't treated specially by Spigot, although most permissions plugins treat it as a wildcard

unkempt peak
#

Oh ok

quaint mantle
#

so if i have
permisson.fly
permisson.walk

and i set walk as flys child, fly will be able to do both

#

sorry my brain is to slow for this rn

unkempt peak
#

wdym? the parent is "permisson" and it's child is fly

smoky oak
#

A.B is child of A

#

I'm not sure you can make A.B child of A.C

unkempt peak
#

right

#

I don't think so

quaint mantle
#

okay thx

lilac dagger
#

if I have GameStartEvent and SpleefStartEvent, and i Bukkit.callEvent(new SpleefStartEvent()); does it trigger for GameStartEvent too or do i have to call for that separately?

remote swallow
#

unless spleef start even also calls gamestart event you have to call it urself

lilac dagger
#

yes it does call

#

i mean it extends it

unkempt peak
#

That doesn't necessarily mean the super is called

#

I'm not actually sure how spigot handles this

lilac dagger
#

hmm, i'll do a test then just to be sure

#

i've seen some events that trickle down

#

so i expected it worked for custom events too

compact haven
#

it's not a trickle down, but inheritance is supported

#

for example, if you have SpleefStartEvent that extends GameStartEvent, then listeners to GameStartEvent and SpleefStartEvent will trigger once for a SpleefStartEvent

wet breach
lilac dagger
#

awesome

wet breach
#

Because that is how some of the events work in the bukkit api

compact haven
#

yep, that's all you have to do

wet breach
lilac dagger
#

on another note, why's intellij enforcing this when it's not even adding it in the pom file

lilac dagger
#

yeah i meant trickle up

wet breach
#

Probably to know if it needs to change styling rules or whatever else

#

Netbeans does this but doesnt enforce setting anything in particular for a project unless you tell it to. Handy when you need different settings for just a single project

unkempt peak
#

Do people actually still use netbeans lol

remote swallow
#

md does

unkempt peak
#

wait fr?

#

that's crazy