#development
1 messages · Page 128 of 1
Hey, just wondering if its possible to change the color of a slimeball
sure with a resource pack
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
setCustomNameVisible should do the trick
Don't believe that works in 1.8. If you don't want to help me further because of that, that fine.
I used it in 1.8 yesterday
How?
Odd, It wasnt working for me
If I have to turn on my pc.... 🤦
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
Minecraft
Nope
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 ^^^
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?
That’s an armorstand…
== compares reference equality, not content
nope
I wonder how hypixel does the always visible entity nametags. I don’t think they’re using armorstands
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
Hmm
Yeah I can’t really figure out how to do it
I tried using packets, but it still lags behind
use holograms
Tried with iron golem too yesterday
You can try Zombie#addPassenger(as)
With as instanceof ArmorStand and renamed as you want (+invisible -gravity)
How could I make it possible to start and stop servers with commands?
I think the way subservers starts them is starting a new java app
After this problem can we please go back to my error
Yeah, good idea, but it’s too far above the head
Pterodactyl API is useful for this if you are using it
Can Pterodactyl start and stop servers in Velocity Proxy
Np
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
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
use https://dnschecker.org/all-dns-records-of-domain.php or something similar to see if the records are still valid
there's probably one that will show minecraft related records.
alr thank you ill check it out later when i get home
but I'd assume it's related to the DNS record accidentally being removed and it works for people who cached it
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?
Why?
he copied a spigot tutorial with 1.14 nms
Hi.
How to use Relational placeholders?
Player one is target or watcher?
Who is player two then?
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
player two is the viewer
Honestly I think I've been using this method before that ever came out lol
I know exactly which tut you are talking about though
???
2 = no physics or updates, 3 = physics + updates
Why not use the Bukkit world?
Because I don't want physics or updates....
declaration: package: org.bukkit.block, interface: Block
Physics only. Not including the updates to blocks next to it, lighting etc...
I get this error message when loading my plugin - https://paste.helpch.at/ugowogimuv.coffeescript, Maven, MC version 1.18, PAPI version 2.11.1, depending PAPI, <scope>provided</scope> in pom.xml. PlaceholderExpansion class is here https://paste.helpch.at/popemipana.java.
id like to say, i recommend using
@Override
public String onRequest(OfflinePlayter player, String params) {
// placeholder shit
}
how are you registering your expansion
In my ClassManager, https://paste.helpch.at/gihurojiva.cs
I will try the other method you sent me
You can also do
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
paper.register();
}
``` 
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
be able to be static sure, should be static no
Why not?
But... why? lol, still not sure when to use it and when not to
I made everything static when i was starting in Java
Same usually, but in this case it simplifies a lot
Generally for static you'd want to use static for methods that can stand on their own
i believe
So it shouldn't be static since the Map is outside the method?
the ideal is that static methods should be pure
anything with state should be a normal object
It only changes on startup
Yeah on startup I do
Bad news, error still occurs
use an immutable map if that's an actual static mapping
immutable map just means that it can't change its keys or values after instantiation right?
yeah and makes it not stateful
Could probably do that yeah, just need to change some stuff
So placeholderAPI is not null and is enabled, just the PlaceholderExpansion.getPlaceholderAPI() returns null
Since I used loadedKits.put() inside a foreach loop, will just create a temp map for that
🥴
yeah it's a class in Guava
You can use Map.ofEntries I think
So proper usage would be creating a temporary hashmap, storing the data inside that, then using ImmutableMap.copyOf(tempMap) right?
?
yup
Not sure how a builder would be used for an immutable map though
so you can... build it?
to add the entries and then build it ^
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
builder.put()
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
yes
i don't know what this means
you .put things to the builder
and when you're done, you do .build()
then you have an immutable map
Oh so I delete this? ImmutableMap<String, InfectionKit> loadedKits;
not sure, I don't know what you're doing lmao
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
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
no
depending on your config lib, you could probably just get an immutablemap straight from the config
you do not want to store the builder
also yeah lol
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
I cant in this case, theres like about 100 lines of code in between, to create the kit
jfc
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();
}
there we go
No errors at least, so thx everyone
Does this subtract 1 after or before comparing? if(!isActive && currentCooldown-- == 0)
no, postfix (--x) does that
before?
a = 5
b = --a (4)
c = a-- (4)
a is now 3
isnt it 3?
The Java increment operator increases the value by one of a the variables. Decrement Operator reduces the value by one of the variables. The postfix operators first return the variable value, then increment
a is now 4
he was referring to this I think
^ye
Ups
excuse me for the nitpick tho
nah nah
Not rly what I meant, more like this
int x = 5
if(x-- == 5) {
print("okay");
}
Will it print or not?
it will
Okay so if I did if(--x == 5) it would compare (4 == 5) insteaD?
javascript, but java works the same
if(x-- == 5) {
print("okay");
}
if(x == 4) {
print(me too")
}
yes
Perfect, thanks
--x = subtract 1 from x and then use the new value of x
x-- = use the value of x and then subtract 1
wait what does --x do?
¯_(ツ)_/¯
It's the order of actions that matters
yes
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?
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'?
p.sendMessage(
"Test"+ randomRegion);
maybe?
^ Have a picture for this 1, but can't send it here
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.
Oh
stupid of me
HAAH
Sorry

And how could i do it with a path?
i dont understand
ConfigurationSection#getKeys
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?
ye
that line is in the core module?
altho ArrayList constructor takes a Collection<? extends String> in your case you could go with
List<String> regions = new ArrayList<>(PostBE.instance.getConfig().getConfigurationSection("regions").getKeys(true))
in case you favor fewer lines :3
yes, em
Well, the less lines the better right?
;d
is the class that line is in extended by a class from another module?
no, only instantiated
huh
you don't understand what I meant to say or? xD
no, it should work

this is the class https://bitbucket.org/gabrielstancele/p6-t6-stancele-gabriel-patru-gabriela-leu-nicoleta/src/5e9cc8b157c0ab64e0abff71dda78b60359b7a0e/core/src/main/java/ro/ucv/proiect/core/database/DatabaseManager.java#lines-30 and there I instantiate it https://bitbucket.org/gabrielstancele/p6-t6-stancele-gabriel-patru-gabriela-leu-nicoleta/src/5e9cc8b157c0ab64e0abff71dda78b60359b7a0e/app/src/main/java/ro/ucv/proiect/app/Main.java#lines-11 (ignore the project name or the fact that we are using bitbucket 😄 )
mmh try doing getClass().getResourceAsStream("/blah...") (note the leading /)
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
no
,
without getClassLoader and with a leading / in the path
java.nio.file.FileSystemNotFoundException 🤡
yes because Path.of stuff
let me seee
I use that to read sql scripts from the resources folder, if that's not obvious xd

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.
final var query = new String(getClass().getResourceAsStream("/sql/tables/" + script + ".sql").readAllBytes()); 💥 @lyric gyro
not sure what you mean by "💥" exactly but not closing the stream is a bit 😬
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")
Use dependeny injection, you're creating a new instance each time.
?di
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
Is that the cause of it not working?
And what if there is no main in that class (the method is in a other class)
What is your goal here?
What if i have a method in my second class and i try to use that in a third class
How does that work?
dependency-inject your second class into your third
Passing your second class to the third class.
that's just one example
I still don't know what you're trying to do.
Oh i see, ty
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?
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
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 :))
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);
}
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;
}
}```
Craftbukkit ??
Ur joking, right?

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
hello?
is any staff there?
sry for being impatient but this is a lil time sensitive
With your MC server?
yes
You can DM @neat pier
ok done
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! 😦
did you get the msg?
I did.
ok
Epic, try #general-plugins please.
ok sorry didnt know which channel my bad
So is that even possible (the thing i sent barry)?
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();```
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
maybe some code would help 🙂
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
params would be playerlevel
not the entire placeholder
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?
so here's how placeholder expansions work:
There's a format to it: %identifier_params%
Your identifier is rpge, and so for a placeholder %rpge_playerlevel%, params would be playerlevel
np :D
sry i didnt know u could respond with barry and i didnt see u typing in discord
All good man
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
Does your ActionItem have a Logger field? Thats probably not serializable
it doesn't, the AuctionItem has
int bid;
UUID maxBidder;
UUID seller;
ItemStack item;
even removing all references of the logger doesn't fix anything
here's the full error message if it helps
https://www.curseforge.com/minecraft/bukkit-plugins/holographic-displays
is this compatible with Spigot 1.18.2?
Doesn't seem like it
alright, it's cause itemstack doesn't like being serialized
took me far longer than it should've
I get this when trying the commands https://gyazo.com/3e204a76cb82befd2b220df418a9cb29
Is there DeluxeMenus version for 1.8.9?
probably not then
Whats the actual error?
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
ah
okay
"An internal error occured while attempting to perform this command"
Is what I get told, when using /holo commands for the plugin
Send the error from console, thats just a message
ok
To answer your question, yes, it is compatible
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
If you look on that page, it says that the latest supported game version is 1.17
If you dont need coding help, move to #general-plugins
check holographicdisplays/decentholograms they r better than holos
Its a longshot with this one, but does anyone know what can cause this?
My worlds name is "xbox" and for some odd reason when I type or pullup players menu I have this tag next to my name https://gyazo.com/dafba423b03027de3109571db06c04fa
Also on the other hand when I die this happens
https://gyazo.com/d4004407d40be5f52c1138d88756d6b0
Please help find the cause of this, its extremely annoying and I simply cannot figure it out.
do you use multiverse core
setting 'chatprefix' to 'false' failed! is what it said
prefixchat*
it is false, just checked the config
you changed it manually snd its false or you didnt change anything and it was on false already
it was default false
when you restart server or do mv reload is it still on false?
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
oke and you still have the prefix now? did you check it
ok
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();```
i used the website to search up my domain but i dont know how to interpret the results lol. https://dnschecker.org/all-dns-records-of-domain.php?query=lucidsmp.net&rtype=ALL&dns=google
can you tell me what the results mean when u get the chance?
thanks so much btw <3
What is your subdomain to connect?
So 162.210.100.160 is your IP?
Can they join directly with the IP?
idk but i'd prefer them join with "lucidsmp.net"
want me to ask someone who has had the problem to join with the ip directly?
Yes
srv record?
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
That has to do with advancements I believe, since recipes are given as reward when you complete an advancement
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
Do you require them to have the recipe unlocked in order to get it?
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
Well, if they have the recipe, whats the point of unlocking it?
All vanilla advancements have that

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
I see, my bad
uhm, how can I disable item despawn on crystal explosions?
(specifically crystal explosions)
Anyone know why /setworldspawn may not be working?
https://gyazo.com/34c47c6d346872e18258cc2bc512c96b
These are my plugins
u dont have op
I am op
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
download essentials, and essential spawn plugins
then do /setspawn
that should resolve your problems
and it will have the /inform or rules command
Okay, by any chance with essential interfer with any my current plugins
Okay
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
alright
if you are on like 1.8 or 1.12 i think you might need to check teh older versions
EssentialsX ?
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
sryyyyyyy
honestly I thought development was asking general development questions
Yeah, about plugin development 😅
Not configuration help
You're*
This gives a ConcurrentModificationException, but not sure how else a set should be configured inside a method called in a runnable?
Code: https://paste.helpch.at/upoqoxiqew.java
Error: https://paste.helpch.at/ewolezuduw.rb
Yeah I was thinking using an Iterator, just havn't used them much so not sure how it would be used in this case
for (Iterator<CooldownAbility> it = toCount.iterator(); it.hasNext(); ) {
CooldownAbility ability = it.next();
if (ability.count()) it.remove();
}```
So I need the checker?
Like this wouldn't fix it?
for (Iterator<CooldownAbility> iterator = toCount.iterator(); iterator.hasNext();) {
iterator.next().count();
}
Count just returns void atm
d;jdk collection#removeif
default boolean removeIf(Predicate filter)
throws NullPointerException, UnsupportedOperationException```
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.
1.8
filter - a predicate which returns true for elements to be removed
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.
true if any elements were removed
Oh nice, what is a predicate though?
Object to boolean function
toCount.removeIf(Predicate.isEqual(ability.currentCooldown == 0));?
Using an iterator does the same according to IntelliJ though
you dont need removeIf and the loop
removeIf removes all the elements that satisfy the predicate
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();
}
}
could as well do this
toCount.removeIf(ability -> {
ability.count();
return ability.currentCooldown == 0;
});```
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?
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
Heya! Im trying to pregen my world but the server keeps crashing... https://cdn.discordapp.com/attachments/860768926522933268/956380223270703124/unknown.png
is there anything i can do abt this?
Corrupted chunk?
Use dinnerbone coordinate calculator to find what region file the chunk is in
yes use dinner bone calculator to divide by 32 then divide by 16
array equality is special iirc
Yeah just made my own contains method
It would be better to store the coords as a long, I know paper has a method to convert it.
I don't use paper. And the intarray makes it easier to use/read
🥶
the int array is a bad idea. use a proper data type for that instead
also, use a set
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
wtf
not the O(n^2) contains implementation
that is actually painful to read
no. you want to store tuples with exactly two elements each. you don't want to store an arbitrary amount of ints per entry in your list
Make it better lmao
an array implies an unknown length
this is not an unknown length, it's literally two values
I could use pair's too
even better, a 2-vector
Hurrah
Still using int arrays though.
😵💫
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
each to their own ig
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)
So basically you got feedback and decided to completely ignore it
lol jk. But yeah I'm using int arrays
Yeah everyone but you is wrong
Not wrong... There might be "better" methods but this is what I am currently using.
Also if you didn't read the convo I even said another "better" method then what I am using lol

And you still chose not to use it
And that method is definitely not right
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?
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
It's not an Enum
But yeah, moving the lore to the instantiation of the InfectionKit instances then
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)
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);)
Oh.. I think I forgot to type the type up there but I did include it in my code
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
void initializePieces(char a[][], char b[][]);
The error is: an array may not have elements of this type
The underline only appears on the second [], does it not take multi-dimensional arrays?
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 
"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!
do you know what a for loop is?
no sorry don't do that
what, why not?
huh?
@gilded moth this seems useful https://www.programiz.com/cpp-programming/passing-arrays-function
Oh thanks!
like i sad i am not a good coder i java jet have so many school things
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
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!
can you pls help me? if i send code?
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.
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)
can you help with loop now?
or do you have time to help me to learn loop?
not now but I'll be available later tho
Emily
So the one thing that’s required for every loop is a condition.
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
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
LegacyComponentSerializer
as cookie said youd need a component serializer
which one depends on your use case but most likely either legacy or plain
Thanks!
for (String message : list) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
}
Huh?
he provided you the code you need to convert a list of messages into color.
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!
Feel free to follow this if you don't know how to code.
Having some issues with triumph gui: https://cdn.discordapp.com/attachments/948739346696110091/956668644618829905/javaw_fvO2LcNjtM.mp4
When closing the gui with BaseGui#close and then reopening it with BaseGui#open, the button previously clicked does not work anymore
is there a way to fix this?
damn
that's crazy
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
vault is missing I guess
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
economy is null if they dont have an economy plugin installed
Isn't Vault the plugin itself an economy plugin?
no
Oh
vault is an api so that plugins can interact with economy plugins
it does not do anything apart from that
So I also need a perms and chat plugin I assume
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
oh right. this as well.
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.
Sounds like he needs blitz join plugin
(or mine /s)
Oh no conclure….
oooh yes
I never thought you’d snoop to the join plugin
Eh whatever I like conclure
lmao
:3 well purple apes are pretty lit too huh
Probably dont need the chat one, so LP and then some econ plugin, which is recommended?
they provide everything xD
Never heard of CMI I think
So it's basically like Essentials but better?
Ah alright
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
you must use mounting im p sure
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
Is there a way to output Adventure Components to a server? Logger only takes String.
PlainTextSerializer or use the console sender
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.
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
So currently I use HoloDisplays for my signs/holos, however is there a way to limit how far they are seen?
Dose anyone know, how to make Java read the bbmodel file so i can put there animation into armorstand
A bbmodel file just contains json
That it?
Just open a .bbmodel file with a text editor
wahts x tho
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?
keep only 1
What if you keep a set of integers and do removeAll { !ids.add(it.id) }
wdym keep a set of ints
val ids = mutableSetOf<Int>()
isn't there something like distinct in kotlin?
Sets dont allow duplicates, once the id n is added, the other elements with the same id will be removed from the array
Ahhh
distinctBy { it.id }
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
#Google my friend
Hi guys, can I ask for code review for a reusable class I wrote?
It simplifies the use of the Metadata API.
https://gitlab.com/Arphox.HobbyProjects/minecraft/mcdevkb/-/blob/master/reusables/MetadataProxy.java
Nice but like why the underscore as prefix for the instance variables
You can access an instance variable by using this inside given class
For two reasons:
- in methods this way I can easily see if something is instance variable and not local/param
- I don't have to use
this
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
Why avoid Optionals? I mean I am not against Optionals or next to them, I just see that it is a pattern to use optionals in java.
Pattern?
I see optionals being used in many places, that's how I mean pattern
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.
I understand, thank you. I will stop using Optionals if I don't have to.
Actually, I just realized they are reference types so it even comes with extra heap allocations.
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
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.
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
I expect the compiler to be able to detect such straightforward stuff as if a variable has been updated and make it final if it is better
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
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?
Optional is better than nullable
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
it forces you to check
Not really
you can call ::get if you want to without checking
calling "best" way is too bold, if allocations matter optional is worse in perf
whereas by doing blah.blah() there is no requirement for you to think about it
Not necessarily
every modern language has modern ways of handling nullability
Optional.get().blah() is not any better than blah.blah()
the overhead is minimal, if you're writing code where performance is that important then java is not the right language lol
Yes because Java’s null is unoptimized
yes it is
Nah
if a function returns an Optional you as the programmer must at least consider that it might not exist
You’d do that with @Nullable type also?
if a function returns a nullable variable there is no such guarantee
why write a game server in java then :DDDDDDD
nvm this is just off topic, let's ignore it as it is granted
sure, but that's just a warning and it's easy to not notice
well yeah, but you'd be stupid
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
if f returns an Optional<T> then f().blah() isn't gonna compile
Of course static analyzer might provide better support for optional
whereas if it returns @Nullable T then it will compile, just with a warning
what?
the compiler is a static analyser
example calling get() without checking isPresent() would yield a warning
you do not understand me
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
Yes pretty much the same when invoking any method?
it is an active process of saying "i know this will not be null"
the contract is implicit there
You’d still think if the method is annotated with @Nullable
also it is really annoying to have warnings when the program flow guarantees that the value is present, but the compiler is not smart enough to understand it.
One bad point for optionals
f().b() doesn't say anything about f() returning null
optional.get() doesn’t either say if it’s empty or not
@Nullable would have the exact same problem tbf
I don't know what is @Nullable.
I basically rely on @NotNull only, if it doesn't say it won't return null, I will check for it. And I think it is enough for me, I don't require Optionals.
if you have to call .get() all the time, you're not even using optionals properly anyway
the point is that you don't call get unless you know for sure that it won't be empty
it's the same as optional, except it's just a warning
public @Nullable String maybeAString()
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
sure
It looks like the same as not having @Nullable there at all, since objects can always be null, unless @NotNull
except with optional you also get all of the chaining benefits AND compile time "safety"
I detest null also
But I sure think it’s better than Optional
At least in Java as of the present moment
at runtime it's the same, but it signals to the IDE that "this can be null and so it should be checked"
literally how
"safety"?
the only benefit is the minor overhead difference
But shouldn't we check for null even when this annotation is missing? It doesn't say it can't be null.
It’s just as unsafe as @Nullable if used without care
I just don't get the value of the @Nullable annotation. /shrug
you have to think about it, even for a second
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
depends, while that's technically true a lot of more modern codebases will say "everything is not null unless it has @Nullable"
it literally doesnt
i can write f().b() and it will compile just fine
yeah theres a warning but i can ignore that, or not notice it
optional forces you to decide what youll do if there's not a value here
that is the point of any type safe system
it stops the programmer from making stupid mistakes
Yes but I mean whenever you invoke a method you’ll always know that it might be null
like forgetting to null check
then you know it's not safe to invoke
this is my point too :/
so we should just null check everything!
Yes exactly lucy
problem solved!!
Hilarious
As said Java null sucks
there is no such thing as modern coding principles
which is why you use the other optional methods
But optional doesn’t make it better imho
and optional is a million times better
it does
Literally not
Not really
it literally is
nah
you are choosing to write .get
.get is a very weak use of optional
you’re choosing to write literally everything
there are other and frankly better methods
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
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
don't do that then
If you’re being careless with anything at all the output will be bad no matter what
T whatever = someOptional.orElse(default)
the orElseX are good for avoiding that
I am not saying optional is bad
you cant be careless with optionals
It’s just not any better than null
you must think about it
Yes you can lol
otherwise it wont compile
Wat
carelessless would be not bothering null checking
^
blindly .get()ing would be negligence
yeah but this is another variable already, which is my problem. in case of normal values, after null check I just continue using that parameter variable
two different things
alright then T whatever = someMethodCall().orElse(defaultValue)
null checking is easy to forget
calling .get() all the time is just being stupid
it is a different thing
I’d say both cares are the same lucy
For instance IntelliJ would even warn you when incoming methods on @Nullable returns
alright and what if it's not annotated with nullable?
Just as optional.get()
they're only warnings
yeah
Then it’s unknown nullability
and only intellij
easy to ignore and easy to forget
Nah
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
Yes but it doesn’t enforce more because you use optional tho lol
it literally does
Breh
Ye they don’t
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
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
I mean I would rather have java adding sth like kotlin
ITS THE SAME THING
can we just agree to disagree and move on? 😄
just less verbose
besides, null checking is an arrow code speedrun
Not necessarily
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
You’re just as dumb if you ignore that normal returns won’t be null at all
optional, just like kotlin forces you to think about it
so we null check everything!
that's the solution
Idk
Java null sucks anyways, but still stand by the point using optional isn’t any better
the solution is type safe, compile time null handling
optional is that
it's the exact same as ? in kotlin
Kotlin enforces at compile time tho, optional doesn’t
...
very well
also the optional object can be still null too. it shouldn't be but it can
it literally does
no lol
no it can't
then youre using it wrong
it doesn't compile?
oh actually
You can blindly write get()
misunderstood you sorry
Kotlin actually enforces it
how?
how is someFunc()!! any different to someFunc().get()
they do the exact same thing
no I mean for instance you can return String?
or you can return Optional<String>
and both of them require an explicit step to say "i am sure this won't be null"
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
what are you talking about
?
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
Same
please don't have a stroke
? 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
java itself is more verbose though so that's just following the pattern
well yeah sure
Can you guys move to #dev-general ?
no
Woah, calm down bucko
it's the only thing where kotlin is better than java
You’re joking
shots fired
Sounds like this dude doesent code kotlin but Ight
Kotlin superior to java
thats not what the conversation was about but ok
Now it is
pls listen to matt & gaby or i'll go on a power trip
Piggy
yes?
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
Is it a good design to pass around streams instead of collections when I think the caller wouldn't need all elements?
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)
i think returning streams is considered an anti-pattern
It depends
because theyre stateful 😞
:<
Brian Goetz has some good points on it, but not sure where that was
Try to change data to Object...
ideas btw?
streams return streams
streams bad ??
Streams are anti-pattern!!
https://stackoverflow.com/a/24679745 found it
I am literally going to kill you
no
not as much as a hitman tho
how much
lol
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?
yes stay on topic please.
why would i?
Objects::isNull
No favourite IDE arguments.
Ahh, I see. Thank you :))
Don't mini mod.
Don't big mod.
I'm massive
That argument died out already since we all know Netbeans is the best
excuse me?
Notepad
anyone know how to disable hitboxes on things like signs? (texture packs are fine)
not sure that's possible
actually, adventure mode would do the trick
you could do a bit of trolling and add a bunch of invisible armor stands to block the hitbox maybe
right?
For breaking yeah
It'd make it so you can't hit it yeah

