#development

1 messages · Page 128 of 1

lyric gyro
#

The path is the setting path

#

For example "messages.command.fail" or "ability.peepeepoopoo.strength.multiplier"

hollow thorn
#

Hey, just wondering if its possible to change the color of a slimeball

lyric gyro
#

sure with a resource pack

west socket
#

Anyone have ideas on how to go about making an entity's nametag always visible?

#

I've tried Tping an armor stand every tick, but its too slow and tends to lag behind.

#

I've also tried small stand riding the entity, but it appears to far above the head.

#

I know theres a way to do this, not exactly sure how though

lyric gyro
#

setCustomNameVisible should do the trick

west socket
#

Don't believe that works in 1.8. If you don't want to help me further because of that, that fine.

hoary scarab
#

I used it in 1.8 yesterday

west socket
#

How?

hoary scarab
#

By..... using it....

#

Idk how else to explain that lol

west socket
#

Odd, It wasnt working for me

hoary scarab
#

I used 1.8.8

#

Idk about 1.8

west socket
#

Nope

#

Doesnt work

#

1.8.8

hoary scarab
#

If I have to turn on my pc.... 🤦

west socket
#
Zombie zombie = (Zombie) spawnLoc.getWorld().spawnEntity(spawnLoc, EntityType.ZOMBIE);

        zombie.setMaxHealth(50);
        zombie.setHealth(50);

        zombie.setCustomName(displayName);
        zombie.setCustomNameVisible(true);```
#

Only displays when hovering over entity

#

What client were you using?

#

It seems that some PVP clients have that patched

hoary scarab
west socket
#

But vanilla ones don't

#

So its not possible that any mod was fixing it for you?

hoary scarab
#

Nope

west socket
#

Strange

#

Because this def isnt working

hoary scarab
#
minionAS.setTicksLived(Integer.MAX_VALUE);
minionAS.teleport(loc);
minionAS.setBasePlate(false);
minionAS.setSmall(true);
minionAS.setMaximumNoDamageTicks(Integer.MAX_VALUE);
minionAS.setCustomName(pl.getMessageMethods().addColor(name));
minionAS.setCustomNameVisible(true);
minionAS.setArms(true);
minionAS.setGravity(false);
#

@west socket ^^^

cerulean birch
#

is it normal that when I get a player's uuid from a string UUID.fromString() and when I get it from Player#getUniqueId(), the 2 uuids != each other? I'm pretty sure equals() works but for some reason == doesn't even though the hash function seems like it should produce the same result?

dusty frost
cerulean birch
#

.-.

#

i thought it compared hashCode, am dumb

dusty frost
#

nope

west socket
#

I wonder how hypixel does the always visible entity nametags. I don’t think they’re using armorstands

cerulean birch
#

they have a modified version of spigot so there's a chance they adjusted entities/armor stands for that, wouldn't be the first time. no clue tho

west socket
#

Hmm

#

Yeah I can’t really figure out how to do it

#

I tried using packets, but it still lags behind

warm steppe
#

use holograms

west socket
#

Wym

#

Like teleporting armor stand every tick?

hoary scarab
sage kettle
ionic kite
#

How could I make it possible to start and stop servers with commands?

hoary scarab
#

I think the way subservers starts them is starting a new java app

broken wave
#

After this problem can we please go back to my error

west socket
west socket
ionic kite
west socket
#

Should be able to

#

I do it with a bungee proxy plugin

ionic kite
#

Ok

#

Thank you!

west socket
#

Np

broken elbow
#

yeah. they have eggs for many games and types and there's so many more maintained by the community\

#

but by default they have a velocity one as well

hushed timber
#

I have a rlly rare problem, a few weeks ago i bought a domain and set it all up, now, a few weeks later almost everyone (but weirdly not everyone) can join with the domain, when they join it says "connection refused: no further information". And i talked to like a bunch of dev friends and no one knows whats wrong.

#

idk how to fix

#

at first it was only me

#

then after a few days it was a few ppl

#

now its almost everyone

past ibex
#

there's probably one that will show minecraft related records.

hushed timber
#

alr thank you ill check it out later when i get home

past ibex
#

but I'd assume it's related to the DNS record accidentally being removed and it works for people who cached it

hoary scarab
#

So I am using ((CraftWorld) loc.getWorld()).getHandle().setBlock(bp, m, 2); But for some reason sand is still falling and netherportal blocks break... Any idea's why?

past ibex
#

he copied a spigot tutorial with 1.14 nms

signal lintel
#

Hi.
How to use Relational placeholders?
Player one is target or watcher?
Who is player two then?

past ibex
#

I'm unsure what the value you need is but it likely changed

#

can always bruteforce it lol

#

keep resetting a nether portal until you can run that code and not break it

dense drift
#

player two is the viewer

hoary scarab
#

I know exactly which tut you are talking about though

hoary scarab
hoary scarab
leaden sinew
hoary scarab
hoary scarab
broken wave
tight junco
#

id like to say, i recommend using

@Override
public String onRequest(OfflinePlayter player, String params) {
  // placeholder shit
}
#

how are you registering your expansion

broken wave
#

I will try the other method you sent me

tight junco
#

You can also do

if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
  paper.register();
}
``` ![CB_fingerguns](https://cdn.discordapp.com/emojis/662639647284920320.webp?size=128 "CB_fingerguns")
atomic trail
#

This should be able to be static right?

    private static final Map<String, InfectionKit> loadedKits = new HashMap<>();

    public static InfectionKit getKit(String kitName){
        return loadedKits.get(kitName);
    }

It's in a KitManager class, so there's only one instance of it

tight junco
#

be able to be static sure, should be static no

atomic trail
#

Why not?

tight junco
#

because no CB_fingerguns

#

personally i avoid static methods like the plague

atomic trail
#

But... why? lol, still not sure when to use it and when not to

broken wave
#

I made everything static when i was starting in Java

atomic trail
tight junco
#

Generally for static you'd want to use static for methods that can stand on their own

#

i believe

atomic trail
#

So it shouldn't be static since the Map is outside the method?

dusty frost
#

the ideal is that static methods should be pure

#

anything with state should be a normal object

atomic trail
#

How would you define a "state"?

#

Not sure what you mean by it

dusty frost
#

things that change over time

#

a variable is state

atomic trail
#

It only changes on startup

dusty frost
#

that hashmap is state

#

you modify the hashmap surely?

atomic trail
#

Yeah on startup I do

broken wave
#

Bad news, error still occurs

dusty frost
#

use an immutable map if that's an actual static mapping

atomic trail
#

immutable map just means that it can't change its keys or values after instantiation right?

dusty frost
#

yeah and makes it not stateful

atomic trail
#

Could probably do that yeah, just need to change some stuff

broken wave
#

So placeholderAPI is not null and is enabled, just the PlaceholderExpansion.getPlaceholderAPI() returns null

atomic trail
#

Since I used loadedKits.put() inside a foreach loop, will just create a temp map for that

dusty frost
#

🥴

atomic trail
#

Just the one by google?

#

Or is it not an actual class

#

But a princip

dusty frost
#

yeah it's a class in Guava

leaden sinew
atomic trail
#

So proper usage would be creating a temporary hashmap, storing the data inside that, then using ImmutableMap.copyOf(tempMap) right?

atomic trail
dusty frost
#

i mean that's real funky

#

builders exist

dense drift
#

yup

atomic trail
#

Not sure how a builder would be used for an immutable map though

dusty frost
#

so you can... build it?

dense drift
#

to add the entries and then build it ^

atomic trail
#

Build it how?

#

Got this ImmutableMap.Builder<String, InfectionKit> builder = ImmutableMap.builder();

#

where I added the keys and values with put() in the loop

#

Just not sure how to apply it to the map from there

dusty frost
#

builder.put()

atomic trail
#

Yes well that's how I add keys and values? builder.put(kitName, kit);

#

I mean this loadedKits = builder; when I apply the data or whatever from builder to the immutable map

dusty frost
#

you .put things to the builder

#

and when you're done, you do .build()

#

then you have an immutable map

atomic trail
#

Oh so I delete this? ImmutableMap<String, InfectionKit> loadedKits;

dusty frost
#

not sure, I don't know what you're doing lmao

lyric gyro
#

loadedKits is your immutable map
you use the builder to build the map as you need
once you're done with the builder, .build it, it returns the built immutable map which you assign to loadedKits

atomic trail
#

Basically this

private static final ImmutableMap.Builder<String, InfectionKit> loadedKits = ImmutableMap.builder();

public void someMethod() {
for(String kitName : ClassesConfig.getKits()){
    loadedKits.put(kitName, someKitValue);
  } 
  loadedkits.build();
}
#

Dunno if that makes sense at all

lyric gyro
#

no

dusty frost
#

depending on your config lib, you could probably just get an immutablemap straight from the config

lyric gyro
#

you do not want to store the builder

dusty frost
#

also yeah lol

lyric gyro
#

the builder is the "intermediate stage" you use to actually fill in the values

#

when you call .build, it returns the built immutable map

#

that is what you want to store

atomic trail
dusty frost
#

jfc

atomic trail
#

Think I got it now then

#
private static ImmutableMap<String, InfectionKit> loadedKits;

public void someMethod() {
ImmutableMap.Builder<String, InfectionKit> builder = ImmutableMap.builder();
for(String kitName : ClassesConfig.getKits()){
    builder.put(kitName, kit);
  } 
  loadedKits = builder.build();
}
lyric gyro
#

there we go

atomic trail
#

No errors at least, so thx everyone

atomic trail
#

Does this subtract 1 after or before comparing? if(!isActive && currentCooldown-- == 0)

dense drift
#

no, postfix (--x) does that

atomic trail
#

?

#

So it does it before or after comparing? lol, I assume after then?

high edge
#

before?

dense drift
#

a = 5
b = --a (4)
c = a-- (4)
a is now 3

graceful hedge
#

isnt it 3?

dense drift
lyric gyro
#

a is now 4
he was referring to this I think

graceful hedge
#

^ye

dense drift
#

Ups

graceful hedge
#

excuse me for the nitpick tho

dense drift
#

nah nah

atomic trail
dense drift
#

it will

atomic trail
#

Okay so if I did if(--x == 5) it would compare (4 == 5) insteaD?

dense drift
#

javascript, but java works the same

stuck hearth
#
if(x-- == 5) {
 print("okay");
}
if(x == 4) {
 print(me too")
}
atomic trail
#

Perfect, thanks

dense drift
#

--x = subtract 1 from x and then use the new value of x
x-- = use the value of x and then subtract 1

fiery pollen
#

wait what does --x do?

dense drift
#

¯_(ツ)_/¯

stuck hearth
#

hmm

fiery pollen
#

yeah but i don't understand

#

ow is it the same as x--?

atomic trail
#

It's the order of actions that matters

dense drift
#

yes

dense drift
#

so I have these two modules, app depends on core, and on core I have this line properties.load(getClass().getClassLoader().getResourceAsStream("sql/hikari.properties")) and now it says that the inputStream parameter is null. What would be the proper way to access resources from the core module?

lyric gyro
#
        List<String> region = PostBE.instance.getConfig().getStringList("regions");
        int randIndex = new Random().nextInt(region.size());
        String randomRegion = region.get(randIndex);
        p.sendMessage("Test" + randomRegion);
    }
}
regions:
  - 'test'
  - 'test1'
  - 'test2'

Any1 knows why he picks a random word from the 3, and then send aswell the word 'test'?

dense drift
#

p.sendMessage("Test" + randomRegion);
maybe?

lyric gyro
#

^ Have a picture for this 1, but can't send it here

neat pierBOT
#
FAQ Answer:

You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.

lyric gyro
#

stupid of me

#

HAAH

#

Sorry

lyric gyro
spiral prairie
#

i dont understand

lyric gyro
#

Like,

regions:
  spawn:
    {cords here}
    - 'command here'
#

Like that

spiral prairie
#

ConfigurationSection#getKeys

lyric gyro
#

Thanks bud

#
        Random random = new Random();
        ArrayList<String> regions = new ArrayList<String>();
        regions.addAll(PostBE.instance.getConfig().getConfigurationSection("regions").getKeys(true));
        String randomRegion = regions.get(random.nextInt(regions.size()));

should this work?

graceful hedge
#

ye

lyric gyro
graceful hedge
dense drift
#

yes, em

lyric gyro
#

;d

#

is the class that line is in extended by a class from another module?

dense drift
#

no, only instantiated

lyric gyro
#

huh

dense drift
#

you don't understand what I meant to say or? xD

lyric gyro
#

no, it should work

lyric gyro
dense drift
#

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.net.URL.toURI()" because the return value of "java.lang.ClassLoader.getResource(String)" is null

#

ah

#

WAIT

#

and that change doesn't fix it

lyric gyro
#

no

lyric gyro
#

without getClassLoader and with a leading / in the path

dense drift
#

java.nio.file.FileSystemNotFoundException 🤡

lyric gyro
#

yes because Path.of stuff

dense drift
#

let me seee

#

I use that to read sql scripts from the resources folder, if that's not obvious xd

lyric gyro
#
regions:
  house:
    - 'test'

  spawn:
    - 'test1'

  idk:
    - 'test2'

How do i get the information now? I got the random path but now i want the information from that random path.

dense drift
#

final var query = new String(getClass().getResourceAsStream("/sql/tables/" + script + ".sql").readAllBytes()); 💥 @lyric gyro

lyric gyro
#

not sure what you mean by "💥" exactly but not closing the stream is a bit 😬

dense drift
#

ah shit

#

ups

#

I got used to Files.readString and such

#

thank you emily

formal crane
#

I am creating a yml file for every backpack in my game but whenever i try to get that yml file (read & write) i can't use this.
This is the class where i create the yml file & get the yml file: https://paste.helpch.at/awadipatub.cpp
This is how i get things from that config: new BackPackCreator().getConfig(main, uuid).getString("test")

prisma briar
#

?di

neat pierBOT
formal crane
#

Is that the cause of it not working?

formal crane
formal crane
#

What if i have a method in my second class and i try to use that in a third class

#

How does that work?

sterile hinge
#

dependency-inject your second class into your third

prisma briar
formal crane
# neat pier

But in the example it does things in the onEnable

sterile hinge
#

that's just one example

prisma briar
formal crane
queen plank
#

I'm looping over a big area, and need the block for each location in said area. So, is this origin.clone().add(x,y,z); or this new Location(world, originX + x, originY + y, originZ + z); faster? Or are they just identical in speed, since they are doing the same thing?

lyric gyro
#

Which one is faster doesn't really matter, it's probably in the microseconds if not nanoseconds. Personally I'd go with the second option but you use whichever one looks more readable to you

queen plank
#

Ok, no worries then. I got a bit scared as the areas can be a few thousand blocks long (in each direction), which is a lot of blocks. Might go with the first one then, looks better imo. Thanks :))

lyric gyro
#

Hey there, I'm trying to make OOP code. I'm trying to learn some more about OOP.

#

I'm trying to make a system where I can create as many classes as I want, in a folder named Hats.

#

(for context: I'm going to give 3D Hats to players)

#

I tried to polymorph, but no success so far

#
package hats;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;

public class Hat extends ItemStack {

    private ItemStack itemStack;
    private ItemMeta itemMeta;
    private String displayName;
    private int customModelData;
    private ArrayList<String> lore;
    private String permission;

    public Hat(String displayName, int customModelData, ArrayList<String> lore, String permission) {
        this.displayName = displayName;
        this.customModelData = customModelData;
        this.lore = lore;
        this.permission = permission;

        itemStack = new ItemStack(Material.CARVED_PUMPKIN);
        itemMeta = itemStack.getItemMeta();
        itemMeta.setDisplayName("" + ChatColor.RED + ChatColor.BOLD + displayName);
        itemMeta.setLore(lore);
        itemMeta.setCustomModelData(customModelData);
        itemStack.setItemMeta(itemMeta);
    }

    public ItemStack getItemStack() {
        return itemStack;
    }

    public ItemMeta getItemMeta() {
        return itemMeta;
    }

    public String getPermission() {
        return permission;
    }
    public String getDisplayName() {
        return displayName;
    }

}
#
package hats;


import java.util.ArrayList;

public class TopHat extends Hat {

    public TopHat(String displayName, int customModelData, ArrayList<String> lore, String permission) {
        //super();
    }
}

#

^ I tried giving all the data in the super, but no success when I did TopHat.itemStack;

#

(My current code -> I had to try a different way, it works but I don't think this is OOP

@EventHandler
    public void clickEvent(InventoryClickEvent e) {
        Hat topHat = new Hat("Top Hat", 199901,
                new ArrayList<>(Arrays.asList(ChatColor.GOLD + "The First ever hat of ProtoType")),
                "prototype.top_hat");
        Hat farmerHat = new Hat("Farmer Hat", 199902,
                new ArrayList<>(Arrays.asList(ChatColor.GOLD + "Excellent hat for the Farmer among us!")),
                "prototype.farmer_hat");

        Player p = (Player) e.getWhoClicked();

        if (e.getView().getTitle().equalsIgnoreCase("" + ChatColor.AQUA + ChatColor.BOLD + "Cosmetic Wardrobe")) {
            if(e.getCurrentItem().getItemMeta() != null)
            switch (e.getCurrentItem().getItemMeta().getCustomModelData()) {
                case 199901:
                    p.sendMessage("one");
                    giveCosmetic(p, topHat.getDisplayName(), topHat.getPermission(), topHat.getItemStack());
                    p.closeInventory();
                    break;
                case 199902:
                    giveCosmetic(p, farmerHat.getDisplayName(), farmerHat.getPermission(), farmerHat.getItemStack());
                    p.closeInventory();
                    break;
                default:
                    p.closeInventory();
                    break;
            }
            e.setCancelled(true);
        }
lyric gyro
#

Does anyone know why this doesn't work?
So I want to replace Mushroom soup or potion with air in the player's hotbar (first 9 slots of inventory). Only one mushroom soup or potion not all.
But it doesn't seem to work.

                            for(int i = 0; i<player.getInventory().getSize()-1; ++i) {
                                ItemStack item = player.getInventory().getItem(i);
                                if(item.getType().equals((profile.getRefill() == Refill.SOUP ? Material.MUSHROOM_SOUP : Material.POTION)))
                                    player.getInventory().getContents()[i].setType(Material.AIR);
                                    break;
                            }
                        }```
dense drift
#

Craftbukkit ??

warm steppe
#

Ur joking, right?

shell moon
red badger
#

big awkward lol

hushed timber
#

umm can i talk with a trusted/support in dms real quick?

#

i have a problem with my server but i dont think i should share it to public knowledge

#

or is there like a ticket system?

#

its very important

hushed timber
#

hello?

#

is any staff there?

#

sry for being impatient but this is a lil time sensitive

mental cypress
#

With your MC server?

hushed timber
#

yes

mental cypress
#

You can DM @neat pier

hushed timber
#

ok done

jaunty atlas
#

hello I have a quick question, I am using Deluxemenu and having an issue and getting error in console when I try and make my ranks cost in-game monies, is there any way of getting help with it and if I use pastebin to show you the code? I am very stumped! 😦

hushed timber
mental cypress
#

I did.

hushed timber
#

ok

mental cypress
jaunty atlas
#

ok sorry didnt know which channel my bad

hushed timber
#

So is that even possible (the thing i sent barry)?

mental cypress
#

Chill.

#

I was responding to the message lol

formal crane
#

I don't know much about sql, when i try to use the code below i get this error: https://paste.helpch.at/sabugoduce.md

ps2.setString(1, p.getUniqueId().toString());
ps2.executeUpdate();```
royal burrow
#

Hello Everyone, I am working on a plugin and have made a PlaceholderExpansion internal class. I have added a placeholder in the onRequest method, and registered the class in my main file. PAPI see my plugin as registered, I get no errors in the console however my custom placeholder is not working. I clearly missed a step but I cant see what step I missed from the docs. Could anyone shed some light on this?

#

Im making custom placeholders that people can use on a scoreboard or in a menu to show the stats of my plugin

pure crater
#

maybe some code would help 🙂

royal burrow
#

Absolutely!

#

Expansion Class:

package net.kreavian.rpgessentials.expansion;

import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import net.kreavian.rpgessentials.rpge;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class rpge_PlaceholderExpansion extends PlaceholderExpansion {

    private final rpge plugin;

    public rpge_PlaceholderExpansion(rpge plugin) {
        this.plugin = plugin;
    }

    @Override
    public @NotNull String getIdentifier() {
        return "rpge";
    }

    @Override
    public @NotNull String getAuthor() {
        return "Samuel 'Shinykey' Heinicke";
    }

    @Override
    public @NotNull String getVersion() {
        return "1.0.0";
    }

    @Override
    public boolean canRegister() {
        return true;
    }

    @Override
    public boolean persist() {
        return true;
    }

    @Override
    public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
        //placeholder: %krvrpgessentials_playerlevel%
        if (params.equalsIgnoreCase("krvrpgessentials_playerlevel")) {
            return String.valueOf(rpge.getPlayerStats(player.getUniqueId().toString()).getLevel());
        }

        return null; // Placeholder is unknown by the Expansion`
    }
}
#

Registering in main plugin:

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            getKrvLogger().info("Registering Kreavian Placeholders!");
            new rpge_PlaceholderExpansion(this).register();
        } else {
            getKrvLogger().warning("Could not find PlaceholderAPI! This plugin is required.");
            Bukkit.getPluginManager().disablePlugin(this);
        }
#

Console log:

[20:37:53 INFO]: [Kreavian RPG Essentials] Registering Kreavian Placeholders!
[20:37:53 INFO]: [PlaceholderAPI] Successfully registered expansion: rpge [1.0.0]
[20:37:53 INFO]: [Kreavian RPG Essentials] DataManager Initialized!
[20:37:53 INFO]: [PlaceholderAPI] Placeholder expansion registration initializing...
[20:37:53 INFO]: 0 placeholder hook(s) registered!
#

From what I can tell PAPI recognizes it, but my placeholder is not getting replaced

dusky harness
#

not the entire placeholder

royal burrow
#

Im not following sorry, wouldnt I want to make it something like that to prevent conflicting with another plugin that would have that same placeholder name?

dusky harness
royal burrow
#

ooooooooooooh

#

Yep thats exactly where I was not understanding! thank you!

dusky harness
#

np :D

hushed timber
mental cypress
#

All good man

inner jolt
#

error code when i attempt to convert list to json using gson
java.lang.reflect.InaccessibleObjectException: Unable to make field private volatile java.util.logging.Logger$ConfigurationData java.util.logging.Logger.config accessible: module java.logging does not "opens java.util.logging" to unnamed module @447b5a44
code:

public static List<AuctionItem> auctionHouse = new ArrayList<>();

...

GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();

logger.info(gson.toJson(auctionHouse));```
#

just wondering if anyone's ever had this issue before, there are no results for it on google

#

converting a normal arraylist to gson works fine but for some reason it doesn't work here and it's making me pull my hair out

#

i've spent an hour on this

dense drift
#

Does your ActionItem have a Logger field? Thats probably not serializable

inner jolt
#

even removing all references of the logger doesn't fix anything

#

here's the full error message if it helps

red badger
#

Doesn't seem like it

inner jolt
#

took me far longer than it should've

chilly horizon
#

Is there DeluxeMenus version for 1.8.9?

red badger
#

So what do you use for Holos? or most people?

#

Like floating text

dense drift
#

Whats the actual error?

red badger
#

^

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

red badger
#

ah

#

okay

#

"An internal error occured while attempting to perform this command"

#

Is what I get told, when using /holo commands for the plugin

dense drift
#

Send the error from console, thats just a message

red badger
#

ok

dense drift
#

To answer your question, yes, it is compatible

red badger
#

MinecraftServer.lambda$0(MinecraftServer.java:306) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3450-Spigot-fb0dd5f-4ed5af5]
at java.lang.Thread.run(Thread.java:833) [?:?]

^ all my console says

#

It should be compatible, but not working?

#

I installed the plugin correctly too

dense drift
#

If you look on that page, it says that the latest supported game version is 1.17

red badger
#

ah rip, so 1.18.2 wont work

#

Alrighty

cinder forum
red badger
red badger
#

yes

cinder forum
red badger
#

setting 'chatprefix' to 'false' failed! is what it said

cinder forum
red badger
#

it is false, just checked the config

cinder forum
red badger
#

it was default false

cinder forum
red badger
#

checking now

#

yes

#

|| enforceaccess: 'false'
prefixchat: 'false'
prefixchatformat: ''
useasyncchat: 'true'
teleportintercept: 'true'
firstspawnoverride: 'true'
displaypermerrors: 'true'
enablebuscript: 'true'
globaldebug: '0'
silentstart: 'false'
messagecooldown: '5000'
version: '2.9'
firstspawnworld: Xbox
teleportcooldown: '1000'
defaultportalsearch: 'true'
portalsearchradius: '128'
autopurge: 'true'
idonotwanttodonate: 'false'||

#

is my settings in the config

cinder forum
red badger
#

yea

#

still there

cinder forum
#

brb

#

im in school

red badger
#

ok

formal crane
#

I don't know much about sql, when i try to use the code below i get this error: https://paste.helpch.at/sabugoduce.md

ps2.setString(1, p.getUniqueId().toString());
ps2.executeUpdate();```
warm steppe
#

hikaricp

#

also INTO not INFO

#

@formal crane

hushed timber
#

can you tell me what the results mean when u get the chance?

#

thanks so much btw <3

past ibex
#

What is your subdomain to connect?

hushed timber
#

wdym?

past ibex
#

So 162.210.100.160 is your IP?

hushed timber
#

the ip of the domain

#

yeah

past ibex
#

Can they join directly with the IP?

hushed timber
#

want me to ask someone who has had the problem to join with the ip directly?

past ibex
#

Yes

warm steppe
#

srv record?

dense galleon
#

Anyone know how to have a recipe require two items to be in the inventory to be unlocked?

#

Right now I have it so that either one of two items needs to be found

#

But i'd want all two components to be found to unlock the recipe instead

dense drift
#

That has to do with advancements I believe, since recipes are given as reward when you complete an advancement

dense galleon
#

Yeah, that's what I meant 😅

#

This is what I have right now

#

Though I'd want the user to require both the copper ingot and the amethyst shard in their inventory

#

Now it works so that only one of the two is needed

dense drift
#

Do you require them to have the recipe unlocked in order to get it?

dense galleon
#

Nono

#

They get the recipe through the advancement

#

So it needs to be like

#

(has_copper_ingot && has_amethyst_shard) || has_the_recipe

#

That's how I am imagining it

dense drift
#

Well, if they have the recipe, whats the point of unlocking it?

dense galleon
#

All vanilla advancements have that

dense drift
dense galleon
#

I think that if that's not present, if a player crafts an item without the use of the recipe book the advancement wont be completed

#

You know how if you craft an item without the use of the recipe book, you unlock its recipe on there

#

Without the has_the_recipe condition that wont happen

dense drift
#

I see, my bad

worn jasper
#

uhm, how can I disable item despawn on crystal explosions?

#

(specifically crystal explosions)

red badger
#

Anyone know why /setworldspawn may not be working?

terse belfry
#

u dont have op

red badger
#

I am op

terse belfry
#

do /setworldspawn

#

copy that

red badger
#

I did, however it does tell me I set the world spawn point etc etc, however when a player dies they spawn somewhere else

#

its strange

terse belfry
#

download essentials, and essential spawn plugins

#

then do /setspawn

#

that should resolve your problems

#

and it will have the /inform or rules command

red badger
#

Okay, by any chance with essential interfer with any my current plugins

terse belfry
#

Essentials is a well trusted and highly famous plugin

#

no

#

it will not

red badger
#

Okay

terse belfry
#

most servers to all have essentials

#

Download the version of essentials related to your server tho

#

if you have the latest server jars like 1.18 1.17 1.16 i think the latest version of essentials should work

red badger
#

alright

terse belfry
#

if you are on like 1.8 or 1.12 i think you might need to check teh older versions

red badger
#

EssentialsX ?

terse belfry
#

yes

#

and download EssentialsSpawn

#

it's separate

#

it might be inside the zip file that you get

#

i think

#

so see if EssentialsSpawn is inside the zip file, if not, download it separetly

red badger
#

I didn't get a zip, came in a .jar

#

Found it though

lyric gyro
red badger
#

sryyyyyyy

red badger
#

honestly I thought development was asking general development questions

lyric gyro
#

Yeah, about plugin development 😅

red badger
#

ohhhhhh

#

originally I was asking why /setworldspawn wont work, but good point

icy shadow
#

Not configuration help

lyric gyro
#

You're*

atomic trail
dense drift
#

could iterate over a copy of toCount

#

or Iterator thinkfused

atomic trail
#

Yeah I was thinking using an Iterator, just havn't used them much so not sure how it would be used in this case

dense drift
#
for (Iterator<CooldownAbility> it = toCount.iterator(); it.hasNext(); ) {
  CooldownAbility ability = it.next();

  if (ability.count()) it.remove();
}```
atomic trail
#

So I need the checker?
Like this wouldn't fix it?

                for (Iterator<CooldownAbility> iterator = toCount.iterator(); iterator.hasNext();) {
                    iterator.next().count();
                }
dense drift
#

im not too sure, you can try

#

there's also this

atomic trail
#

Count just returns void atm

dense drift
#

d;jdk collection#removeif

uneven lanternBOT
#
default boolean removeIf(Predicate filter)
throws NullPointerException, UnsupportedOperationException```
Description:

Removes all of the elements of this collection that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller.

Since:

1.8

Parameters:

filter - a predicate which returns true for elements to be removed

Throws:

NullPointerException - if the specified filter is null
UnsupportedOperationException - if elements cannot be removed from this collection. Implementations may throw this exception if a matching element cannot be removed or if, in general, removal is not supported.

Returns:

true if any elements were removed

atomic trail
#

Oh nice, what is a predicate though?

graceful hedge
#

Object to boolean function

atomic trail
#

toCount.removeIf(Predicate.isEqual(ability.currentCooldown == 0));?

#

Using an iterator does the same according to IntelliJ though

icy shadow
#

you dont need removeIf and the loop

#

removeIf removes all the elements that satisfy the predicate

atomic trail
#

Changed it to this which works

                for (Iterator<CooldownAbility> iterator = toCount.iterator(); iterator.hasNext();) {
                    CooldownAbility ability = iterator.next();
                    ability.count();

                    if(ability.currentCooldown == 0) {
                        iterator.remove();
                    }
                }
dense drift
#

could as well do this

toCount.removeIf(ability -> {
  ability.count();
  return ability.currentCooldown == 0;
});```
keen quarry
#

How can i make like a "boolean list" in my config.yml?
I want to be able to enable and disable commands from my config. Example: ```yaml
Commands:

  • help: true
  • rules: false
  • vanish: true
And how can i then read if for example "help" is true or false?
hushed badge
#

config.getBooleanList("Commands")

#

actually no

#

if those are ur only commands, just do config.getBoolean("Commands.help/rules etc") and register them that way

#

if u have lots of commands, then id recommend doing it via config.getConfigurationSection("Commands"), and iterating over its keys

keen quarry
#

Hmm okay, will have to look into that

#

Thanks for the help!

hushed timber
past ibex
#

Corrupted chunk?

#

Use dinnerbone coordinate calculator to find what region file the chunk is in

lyric gyro
#

yes use dinner bone calculator to divide by 32 then divide by 16

kind granite
#

array equality is special iirc

icy shadow
#

They're reference types

#

So

#

Same semantics apply

hoary scarab
#

Yeah just made my own contains method

leaden sinew
#

It would be better to store the coords as a long, I know paper has a method to convert it.

hoary scarab
#

I don't use paper. And the intarray makes it easier to use/read

dusty frost
#

🥶

sterile hinge
#

the int array is a bad idea. use a proper data type for that instead

#

also, use a set

hoary scarab
#

the int array is a bad idea
How so? Has the exact use case I'm using it for lol

#

Just List.contains didn't have the use case I needed

sterile hinge
#

wtf

dusty frost
#

not the O(n^2) contains implementation

kind granite
#

that is actually painful to read

sterile hinge
hoary scarab
icy shadow
#

Just use Arrays.equals man

#

If you wanna go down this route

kind granite
#

an array implies an unknown length

#

this is not an unknown length, it's literally two values

icy shadow
#

True

#

I love type safety

hoary scarab
#

I could use pair's too

icy shadow
#

That would be better

#

AND it has a properly defined equals method

kind granite
#

even better, a 2-vector

icy shadow
#

Hurrah

hoary scarab
#

Still using int arrays though.

kind granite
#

why

#

why would you do that

icy shadow
#

😵‍💫

hoary scarab
#

Cause that's what I'm making use off. And thats one spot that only uses 2 ints. I have other code that has more then 2 lol

kind granite
#

each to their own ig

hoary scarab
#

The method that made me switch to using int[] wasn't even the problem so I could have left it as my old method 🤦
(My math for minX and maxX (and z) were double negatives)

leaden sinew
leaden sinew
#

Yeah everyone but you is wrong

hoary scarab
#

Also if you didn't read the convo I even said another "better" method then what I am using lol

graceful hedge
leaden sinew
#

And that method is definitely not right

atomic trail
#

This is called everytime an inventory is opened with TriumphGUI, but it seems a bit bad for performance, any suggestions?
https://paste.helpch.at/aqegadoxur.cs

Like can I store it but still update it somehow?

sterile hinge
#

if your InfectionKit is an enum, create an EnumSet without the kits you want to ignore and reuse that

#

and yeah, you can avoid the ItemMeta stuff by reusing an itemstack ig

sterile hinge
#

ah I see

#

totally misread that part

atomic trail
#

But yeah, moving the lore to the instantiation of the InfectionKit instances then

gilded moth
#

Hello, I have some questions about C++. How do I declare a function prototype for one which takes arrays as its parameter?

#
int f(int arr[][]);

^ this doesn't seem to work without defining the size 🤔

#

I'm completely new to C++ (this is my first semester learning it hahaha)

lyric gyro
#

you need to specify the array type
I forgot if you can use [] in function parameters tho but it'd be something like int func(int arr[][]); (if not you need to use pointers which… eeh int func(int** arr);)

gilded moth
#

Oh.. I think I forgot to type the type up there but I did include it in my code

zenith harness
#

Hi, i need help with translateAlternateColorCodes but i can't code so good but i hope some one can go in vc call with me

need it to translate a list of messages with codes, it's in a plugin that sends a random message every 20 minute

tag me pls

gilded moth
#

The underline only appears on the second [], does it not take multi-dimensional arrays?

lyric gyro
#

mm alright my memory was failing me, you either need to specify the size (foo(int arr[][5]) (an array of 5 int arrays)) or take them as pointers
orrr do it the safe and proper way and use the array type in the stdlib, but I'd understand if it's for a school assignment and you're not allowed to actually use the right thing peepoSMILEEEEEEEE

gilded moth
#

"but I'd understand if it's for a school assignment and you're not allowed to actually use the right thing"
😭 😭 😭

#

I'll try, thanks for your info!

zenith harness
lyric gyro
#

what, why not?

#

huh?

zenith harness
lyric gyro
#

I strongly suggest you get the Java basics down before jumping into making plugins for loops are day 1 of Java. It's okay if you learn Java as you make plugins but there are a handful of things you absolutely need to know beforehand

#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

zenith harness
pure crater
#

no

#

learn some basic stuff and then ask for help

#

or actually

#

don't say "can you pls help me?"

#

instead, come and ask an actual question about something specific you need help with

#

you don't go to your English teacher with your essay and ask him/her "can you help me?" right? You have to go up to him/her with good questions to ask.

lyric gyro
#

I can help you learn what a for loop is, you're trying to compete in a rally race without knowing what the pedals in a car do. First get the very very basics learned, then you can move on onto bigger things (like making plugins)

zenith harness
#

or do you have time to help me to learn loop?

lyric gyro
#

not now but I'll be available later tho

lyric gyro
#

Emily

lyric gyro
#

No matter the type of loop

#

while(true) for example, the condition is whiles only argument. a for loops is for(;true;) {}

#

Now with for loops you can also give it a start and action.

#

for (int i = 0; condition; i++) {}

#

So it’ll keep adding 1 to i until your condition is met. It’s p much just jumping back in memory and running the routine again until a condition is met. Not all of that’s required for for loops tho. Cuz you can make an infinite loop with just for(;;)

#

Condition is always in the middle tho

steady ingot
#

How would I properly convert an Adventure Component to string? A simple .toString() call would give the entire component in an ugly string, not just the message itself

haughty parrot
#

LegacyComponentSerializer

kind granite
#

as cookie said youd need a component serializer

#

which one depends on your use case but most likely either legacy or plain

steady ingot
#

Thanks!

warm steppe
neon wren
neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

neon wren
#

Feel free to follow this if you don't know how to code.

spiral prairie
lyric gyro
#

damn

broken elbow
#

that's crazy

atomic trail
#

What does it mean if rsp is null?

        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            LOGGER.error("RSP is null");
            return false;
        }

Using VaultAPI btw

broken elbow
#

vault is missing I guess

atomic trail
#

Then the debug above would print

        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            LOGGER.error("Vault is null");
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            LOGGER.error("RSP is null");
            return false;
        }
#

And it didnt

#

Oh I might need to add it to plugin.yml lol

icy shadow
#

economy is null if they dont have an economy plugin installed

atomic trail
#

Isn't Vault the plugin itself an economy plugin?

icy shadow
#

no

atomic trail
#

Oh

icy shadow
#

vault is an api so that plugins can interact with economy plugins

#

it does not do anything apart from that

atomic trail
#

So I also need a perms and chat plugin I assume

icy shadow
#

not necessarily

#

but if you want to use those features, yes

atomic trail
#

Will use LP for perms but what would you recommend for the others?

#

Wait LP isn't listed? as supported perm plugin

#

And vault doesnt even support 1.18 yet... rip

broken elbow
#

it works on 1.18 just fine

#

there was no need for an update

#

but why do you need the chat features? are you just experimenting?

#

and also LP has vault support yes.

lyric gyro
#

Sounds like he needs blitz join plugin

graceful hedge
#

(or mine /s)

lyric gyro
#

Oh no conclure….

dusky harness
lyric gyro
#

I never thought you’d snoop to the join plugin

graceful hedge
#

yeah

lyric gyro
#

Eh whatever I like conclure

graceful hedge
#

lmao

lyric gyro
#

Doesent have an ego

#

Humble man

graceful hedge
#

:3 well purple apes are pretty lit too huh

atomic trail
icy shadow
#

99% of the time it'll be essentials or CMI

#

or idk, some item based one

graceful hedge
#

cmi provides eco implementation?

#

wow

broken elbow
#

they provide everything xD

atomic trail
#

Never heard of CMI I think

broken elbow
#

its paid. not worth it in my personal opinion. some people like it

#

idk

atomic trail
#

So it's basically like Essentials but better?

broken elbow
#

well

#

depends what you mean by better

#

if better means quantity, then I guess so

atomic trail
#

Ah alright

west socket
#

I'm trying to use packets to have an armorstand track an entity perfectly, but they keep desyncing, any idea on how to fix this?
https://youtu.be/Pe9hPRLfC-k

lyric gyro
#

you must use mounting im p sure

west socket
#

Don’t think that works

#

I’m pretty sure this is the way to go about doing it

#

The location calculation is just fucked up

steady ingot
#

Is there a way to output Adventure Components to a server? Logger only takes String.

pulsar ferry
#

PlainTextSerializer or use the console sender

prisma briar
#

So basically I want to create an in-game transaction using real life money for spigot plugin and I'm using Midtrans for the payment gateway and they have a java wrapper (https://github.com/Midtrans/midtrans-java).

However I'm stuck on how to receive notification whenever the payment is paid or anything else. I need help with listening to http request.

lyric gyro
#

data class TestHolder(val test:Test)

data class Test(val id:Int)

arrayOf(A bunch of TestHolder objects)
#

How can I remove all Test with the same id from the array

dense drift
#

array.removeAll { it.id == x } maybe

red badger
#

So currently I use HoloDisplays for my signs/holos, however is there a way to limit how far they are seen?

orchid turret
#

Dose anyone know, how to make Java read the bbmodel file so i can put there animation into armorstand

upper jasper
#

A bbmodel file just contains json

orchid turret
#

That it?

upper jasper
lyric gyro
dense drift
#

Ah, you said same id

#

Ups

#

If you have 3 elements with id n, do you want to remove them all or to keep only 1?

lyric gyro
#

keep only 1

dense drift
#

What if you keep a set of integers and do removeAll { !ids.add(it.id) }

lyric gyro
#

wdym keep a set of ints

dense drift
#

val ids = mutableSetOf<Int>()

sterile hinge
#

isn't there something like distinct in kotlin?

dense drift
#

Sets dont allow duplicates, once the id n is added, the other elements with the same id will be removed from the array

#

Ahhh

thorn cape
#

How would I go about making a universal plugin. Like something that would work on bungee/spigot/etc. and have it all in 1 jar instead of multiple

median glen
graceful hedge
#

Nice but like why the underscore as prefix for the instance variables

#

You can access an instance variable by using this inside given class

median glen
graceful hedge
#

But like, it breaks java naming conventions, and yes you don’t have to but you really should

#

Also personally I would avoid enforcing Optional to possible consumers of that class, instead have nullable returns, Ik Java null isn’t the best

median glen
graceful hedge
#

Pattern?

median glen
#

I see optionals being used in many places, that's how I mean pattern

graceful hedge
#

Such as? It’s used in Stream for Java itself, scarcely anywhere else. Some libraries decorate everything with Optional which first of all makes the code extremely verbose, more verbose than what it has to be. Like sure if you really detest java null that much it might be fine to rely on optional in your personal internal layer. But when exposed to other layers or if it’s an api exposed to the consumers of the entire world I’d avoid it. If people really want to use optional they could just create an adapter of said class which delegates and wraps every nullable with Optional.

median glen
graceful hedge
#

Yeah well the little overhead optional comes with is negligible, but I genuinely believe just using the built in null that java encloses itself on is better than optional mainly due to how it’s “sort of” better supported, tho I’m not totally against. Was just asking/is curious to why? Like if you had any particular reasons. 😅

#

But Arphox some good things about your code

#

Your methods are decently large

#

Not too large that is

#

Excellent use of explanatory variables

#

The one and only comment that is present would be acceptable from my pov

median glen
#

Thank you, much appreciated.
Another java question, should I make all local variables and parameters final?
As I code, my style prefers immutability but should I explicitly state it with the final keyword, or are they just bloat?
In decently sized methods (so not large) they should be just bloat I guess.

graceful hedge
#

Well, using final can optimize your code by compiling into less instructions. I don’t use it unless it’s for fields or constants.

#

Entirely up to you actually

#

Only thing you don’t have to add final to is the receiver parameter

#

As that still can’t be mutated

median glen
graceful hedge
#

Well, the compiler can sometimes infer certain things if a variable is final

#

Thus reducing the amount of necessary bytecode instructions

#

Altho it’s pretty negligible still

#

Anyways by receiver parameter I mean

class Obo{
void(Obo this);
}

#

Obo this does not need final because iirc you won’t be able to reassign the value of this anyways

median glen
#

I don't understand this stuff, can you elaborate what is this?
As I know, low level the methods have the instance as a parameter (since instance methods are basically normal methods with an instance as a parameter), so what is this explicit parameter?

icy shadow
#

Optional is better than nullable

graceful hedge
#

Anyways let me bring up to points

final is good because it reduces the conceivably potential mistakes us developers might make so it’s a way of defensively writing code

but I would also argue for that if you have reasonably long methods (a method should on do one thing) and reasonably many parameters then you’ll be able to keep track of the parameters anyways

icy shadow
#

it forces you to check

graceful hedge
#

Not really

icy shadow
#

it does

#

if something may or may not exist, Optional is the best way of handling it

graceful hedge
#

you can call ::get if you want to without checking

icy shadow
#

that is still checking

#

by writing .get you have said "i know this will exist"

median glen
icy shadow
#

whereas by doing blah.blah() there is no requirement for you to think about it

graceful hedge
icy shadow
#

every modern language has modern ways of handling nullability

graceful hedge
#

Optional.get().blah() is not any better than blah.blah()

icy shadow
graceful hedge
#

Yes because Java’s null is unoptimized

graceful hedge
#

Nah

icy shadow
#

if a function returns an Optional you as the programmer must at least consider that it might not exist

graceful hedge
#

You’d do that with @Nullable type also?

icy shadow
#

if a function returns a nullable variable there is no such guarantee

median glen
icy shadow
graceful hedge
#

Optional as well

#

You can be as oblivious with Optional as with regular null

icy shadow
#

well yeah, but you'd be stupid

graceful hedge
#

The only good thing about optional is that allows you to build computations around possibly absent values which is a higher abstraction than null itself

#

Other than that it’s pretty much the same as normal null

icy shadow
#

if f returns an Optional<T> then f().blah() isn't gonna compile

graceful hedge
#

Of course static analyzer might provide better support for optional

icy shadow
#

whereas if it returns @Nullable T then it will compile, just with a warning

icy shadow
#

the compiler is a static analyser

graceful hedge
#

example calling get() without checking isPresent() would yield a warning

icy shadow
#

you do not understand me

graceful hedge
#

Oh sorry for the plural auto correct

#

Perhaps I don’t

icy shadow
#

you as the programmer have to actively type .get

#

you are thinking about what you're typing

#

and you have chosen to write .get

#

knowing what it does

#

and knowing the constraints it enforces

graceful hedge
#

Yes pretty much the same when invoking any method?

icy shadow
#

it is an active process of saying "i know this will not be null"

icy shadow
graceful hedge
#

You’d still think if the method is annotated with @Nullable

median glen
icy shadow
#

f().b() doesn't say anything about f() returning null

graceful hedge
#

optional.get() doesn’t either say if it’s empty or not

icy shadow
median glen
icy shadow
#

the point is that you don't call get unless you know for sure that it won't be empty

icy shadow
#

public @Nullable String maybeAString()

graceful hedge
#

And if you get a return where it’s annotated with @Nullable you’d effectively have to consider a null check as well

#

It’s not much different

icy shadow
#

sure

median glen
icy shadow
#

except with optional you also get all of the chaining benefits AND compile time "safety"

graceful hedge
#

I detest null also

#

But I sure think it’s better than Optional

#

At least in Java as of the present moment

icy shadow
icy shadow
graceful hedge
#

"safety"?

icy shadow
#

the only benefit is the minor overhead difference

median glen
graceful hedge
#

It’s just as unsafe as @Nullable if used without care

icy shadow
#

bruh

#

that is the point

#

Optional forces you to care

median glen
#

I just don't get the value of the @Nullable annotation. /shrug

icy shadow
#

you have to think about it, even for a second

graceful hedge
#

I mean I’d say it’s the complete same for just regular null, or at least similar enough to make the difference negligible if anything

icy shadow
icy shadow
#

i can write f().b() and it will compile just fine

#

yeah theres a warning but i can ignore that, or not notice it

graceful hedge
#

optional.get().b()

#

same thing applies

icy shadow
#

....

#

you chose to add .get(), knowing what it implies

kind granite
#

optional forces you to decide what youll do if there's not a value here

icy shadow
#

that is the point of any type safe system

#

it stops the programmer from making stupid mistakes

graceful hedge
#

Yes but I mean whenever you invoke a method you’ll always know that it might be null

icy shadow
#

like forgetting to null check

kind granite
icy shadow
graceful hedge
#

Yes exactly lucy

icy shadow
#

problem solved!!

graceful hedge
#

Hilarious

icy shadow
#

every line should be if blah != null

#

every single line

graceful hedge
#

As said Java null sucks

icy shadow
#

there is no such thing as modern coding principles

kind granite
graceful hedge
#

But optional doesn’t make it better imho

icy shadow
#

it does

graceful hedge
#

Literally not

icy shadow
#

you still havent given a reason for it not

#

the .get() argument is stupid

graceful hedge
#

Not really

icy shadow
#

it literally is

graceful hedge
#

nah

icy shadow
#

you are choosing to write .get

kind granite
#

.get is a very weak use of optional

icy shadow
#

it is an active decision that you have made

#

and yes

graceful hedge
#

you’re choosing to write literally everything

kind granite
#

there are other and frankly better methods

icy shadow
#

it is usually a bad use of optionals

#

if you use .get all the time, you're doing it wrong

#

that is not an argument for optionals being bad

median glen
#

If I get an Optional<T> as parameter, I hate creating another local variable just for the value itself after I checked if the value is present (and doing other stuff it is not present).
I get it that it can be mitigated by writing fluent code but that is not always the case at all

kind granite
#

don't do that then

graceful hedge
#

If you’re being careless with anything at all the output will be bad no matter what

icy shadow
kind granite
#

the orElseX are good for avoiding that

graceful hedge
#

I am not saying optional is bad

icy shadow
graceful hedge
#

It’s just not any better than null

icy shadow
#

you must think about it

graceful hedge
#

Yes you can lol

icy shadow
#

otherwise it wont compile

graceful hedge
#

Wat

kind granite
#

carelessless would be not bothering null checking

icy shadow
#

^

kind granite
#

blindly .get()ing would be negligence

median glen
kind granite
#

two different things

icy shadow
#

null checking is easy to forget
calling .get() all the time is just being stupid

#

it is a different thing

graceful hedge
#

I’d say both cares are the same lucy

#

For instance IntelliJ would even warn you when incoming methods on @Nullable returns

icy shadow
#

alright and what if it's not annotated with nullable?

graceful hedge
#

Just as optional.get()

kind granite
#

they're only warnings

icy shadow
#

yeah

graceful hedge
#

Then it’s unknown nullability

kind granite
#

and only intellij

icy shadow
#

easy to ignore and easy to forget

graceful hedge
#

Nah

icy shadow
#

the more things that the compiler can enforce, the better

#

you are using a compiled language

#

deferring exceptions to runtime is inherently wasting the compiler

graceful hedge
#

Yes but it doesn’t enforce more because you use optional tho lol

icy shadow
#

it literally does

graceful hedge
#

Breh

kind granite
#

annotations dont enforce anything

#

they just suggest what you should get back

graceful hedge
#

Ye they don’t

icy shadow
#

nullableFunc().blah(), oh, it compiles, all good - oh no, NPE! i forgot to null check, disaster

optionalFunc().blah(), doesn't compile, ok, i've now been forced to think about the empty case, so i'll either write a proper check, or call .get if i know for sure that it won't be empty

#

not compiling forces the programmer to think about the null case

#

an annotation that might give a warning does not

#

and that's ignoring all of the chaining methods that Optional has that can significantly reduce boilerplate

#

every single modern language has compile time null safety now

#

that is not a coincidence

graceful hedge
#

I mean most Java devs think about that null is a plausible outcome anyhow, even if you think one nano second extra when invoking get it’s not much better from just not using optional in the first place at least from my experience

icy shadow
#

.....

#

stop talking about get

graceful hedge
#

I mean I would rather have java adding sth like kotlin

icy shadow
#

ITS THE SAME THING

median glen
#

can we just agree to disagree and move on? 😄

graceful hedge
#

just less verbose

kind granite
#

besides, null checking is an arrow code speedrun

graceful hedge
#

Not necessarily

icy shadow
#

if you write !! blindly in kotlin you're dumb
if you use get blindly in java you're dumb

#

same thing

#

"oh but get might not work sometimes!11!" ok then you're dumb for calling it blindly

graceful hedge
#

You’re just as dumb if you ignore that normal returns won’t be null at all

icy shadow
#

optional, just like kotlin forces you to think about it

icy shadow
#

that's the solution

graceful hedge
#

Idk

#

Java null sucks anyways, but still stand by the point using optional isn’t any better

icy shadow
#

the solution is type safe, compile time null handling

#

optional is that

#

it's the exact same as ? in kotlin

graceful hedge
kind granite
#

...

#

it does

icy shadow
#

...

kind granite
#

very well

median glen
#

also the optional object can be still null too. it shouldn't be but it can

icy shadow
#

it literally does

graceful hedge
#

no lol

kind granite
median glen
icy shadow
#

oh actually

graceful hedge
#

You can blindly write get()

icy shadow
#

misunderstood you sorry

icy shadow
#

so what?

graceful hedge
#

Kotlin actually enforces it

icy shadow
#

how?

#

how is someFunc()!! any different to someFunc().get()

#

they do the exact same thing

graceful hedge
#

no I mean for instance you can return String?

icy shadow
#

or you can return Optional<String>

icy shadow
graceful hedge
#

Yes but for instance in kotlin you have to check for it, Java doesn’t enforce it the same way like if you use get() wrongly

icy shadow
#

what are you talking about

graceful hedge
#

?

icy shadow
#

give me an example of where kotlin makes you check for it

#

please

#

because i just told you that !! and .get() have the exact same semantics

#

kotlin doesnt make you check with !!

#

that's the point

graceful hedge
#

..

#

Swedish class about to begin so guess I’ll continue after that

icy shadow
#

yes please do

#

im about to have a stroke

graceful hedge
#

Same

hushed badge
#

please don't have a stroke

icy shadow
#

? and Optional are the exact same, except 1 is built into the language and 1 isnt

#

they both provide the exact same semantics and behaviour

#

1 is more verbose sure but thats irrelevant

kind granite
#

java itself is more verbose though so that's just following the pattern

icy shadow
#

well yeah sure

dense drift
warm steppe
#

no

terse belfry
#

Woah, calm down bucko

lyric gyro
#

Kotlins nullables win 24/7

#

Over javas shitty optional

sterile hinge
#

it's the only thing where kotlin is better than java

lyric gyro
#

You’re joking

wheat carbon
#

shots fired

pulsar ferry
#

Don't start it again

lyric gyro
#

Sounds like this dude doesent code kotlin but Ight

high edge
#

Kotlin superior to java

icy shadow
#

thats not what the conversation was about but ok

lyric gyro
#

Now it is

wheat carbon
#

pls listen to matt & gaby or i'll go on a power trip

lyric gyro
#

Piggy

wheat carbon
#

yes?

flat anchor
#

hello guys! Who facing with such problem? Can't find case with constructor

Error:
Caused by: java.lang.invoke.WrongMethodTypeException: expected (UUID,String,int,String)Person but found (Object[])Object

Code:

  static Object handleConstructor(
      final @NotNull Constructor<?> constructor,
      final @NotNull Object[] data) throws Throwable {
    final MethodHandle handle = Reflections
        .trustedLookup()
        .unreflectConstructor(constructor);

    return handle.invokeExact(data); // also tried just invoke, but it doesn't help
  }
#

#invokeWithArguments helped

median glen
#

Is it a good design to pass around streams instead of collections when I think the caller wouldn't need all elements?

graceful hedge
#

I rarely return streams, but just some subtype of collection as you can just invoke stream() on it, whether its good or not is another question but I rarely see it being used as a way to transfer data between dependencies (would probably say that returning a more specific collection can be advantageous such as Set, or Map etc since they have convenient methods for specific use cases)

icy shadow
#

i think returning streams is considered an anti-pattern

sterile hinge
#

It depends

icy shadow
#

because theyre stateful 😞

graceful hedge
#

:<

sterile hinge
#

Brian Goetz has some good points on it, but not sure where that was

dense drift
lyric gyro
#

streams bad ??

pulsar ferry
#

Streams are anti-pattern!!

icy shadow
lyric gyro
#

please do

#

end my suffering

#

I will pay you

icy shadow
#

no

lyric gyro
#

not as much as a hitman tho

icy shadow
#

how much

lyric gyro
#

shit's expensive

#

idk i have like 20 bucks

#

and cigs

spiral prairie
#

This server slowly developing into gulag

#

no shit

lyric gyro
#

lol

queen plank
#

I'm playing around a bit with predicates, and I want to remove all occurrences of null from a list using a predicate. I know you can do something like list.removeIf("foo"::equals);, but how do I check for null?

warm steppe
#

cry abt it

#

sky

icy shadow
#

yes stay on topic please.

spiral prairie
lyric gyro
#

No favourite IDE arguments.

spiral prairie
#

xD

#

try the new GulagIDE

queen plank
icy shadow
spiral prairie
icy shadow
#

I'm massive

pulsar ferry
lyric gyro
#

excuse me?

#

Dr. Java

spiral prairie
#

excuse me?

icy shadow
spiral prairie
#

Notepad

lyric gyro
#

i do my discord bots in python in repl.it

forest jay
#

anyone know how to disable hitboxes on things like signs? (texture packs are fine)

icy shadow
#

not sure that's possible

forest jay
#

actually, adventure mode would do the trick

icy shadow
#

you could do a bit of trolling and add a bunch of invisible armor stands to block the hitbox maybe

forest jay
#

right?

icy shadow
#

For breaking yeah

pulsar ferry
#

It'd make it so you can't hit it yeah