#help-development
1 messages · Page 264 of 1
I don't know its a string
Its an updater script that carries over the comments
So it's going through every key / value and then using YAML to write it out
Only when it's writing it out sometimes it removes quotes around the strings
Update, so ConfigurationSection .put removes quotes. Anyone know how to stop that?
it removes them if they are not needed
Its not consistent. It's removing it from a string so when it reloads there is an error
I have key: "&@!" and put changes it to key: &@! so if someone edits my config to change it to key: **** it breaks on load because they see it without quotes and think that's the way to edit the file.
correct
hey so I am trying to release an update for my plugin in which I have added some new vaults to the config.yml file
now, when I load up the new plugin version it does not change the config from the past version at all
however, when it is trying to get the new values from the config, it does that successfully
what the hell is going on
Without seeing any code, it's pretty hard to tell. How are you detecting between old and new versions etc..
*if I delete the config file and regen it with the new version, it does regen with all the new values
?paste
Then how is it suppose to know what version is new and what version is old
so thats why people put the "config-version: 1.4" # DO NOT CHANGE at top of their configs
Yes. But I usually prefer it at the very bottom of the files
But that's personal preference
whats the easiest way to insert all the new values in the config when its old?
cuz say its 3 versions old, then you'll have to insert all the values for all the versions one by one without deleting the old ones because the user could have changed stuff as per their needs
Honestly, I just use a library that i've found to work really well.
Probs not the best way, but it works for what i need it to.
what is the name of the library?
I add that as dependency then just run a check on startup for the config version, using a config_version double in the config.yml and if it's not the correct version, I run the ConfigUpdater.update() method
what is "Arrays.asList()" for
That's for this you want to ignore.
Like stringLists in the config that users add that you don't want being removed when it updates
so like
Groups:
owner: "#6b6b6b&l[#570000STAFF#6b6b6b&l] %prefix%%displayname%%suffix%#ff4a4a>> #14abc9%message%"
admin: "#6b6b6b&l[#570000STAFF#6b6b6b&l] %prefix%%displayname%%suffix%#14abc9>> #ff4a4a%message%"
member: "%prefix%%displayname%%suffix% #14abc9>> #6b6b6b%message%"
For things like that, so it doesn't revert it to config defaults if the user has modified it.
ah
so I have manually put in like "groups.owner" "groups.admin" and stuff?
into the ArrayList
if(getConfigFile().getConfig().getDouble("Config_Version") != 2.10) {
getConfigFile().getConfig().set("Config_Version", 2.10);
getConfigFile().saveConfig();
ConfigUpdater.update(plugin, "config.yml", getConfigFile().getFile(), Arrays.asList("Group_Name_Colour.Groups", "Group_Chat_Colour.Groups" ,"Name_Colour_Items", "Chat_Colour_Items", "Chat_Settings.Chat_Formats.Group_Formats.Groups"));
Utilities.logInfo(true, "Stylizer has automatically updated your config.yml!");
}
Example of how I used it.
My config handling probs aint the best example, but it works good enough
I would like to ask one thing, I have created a plugin similar to luckperms and now I am creating a plugin like discordsrv, and so far so ok, but how do I get the rank from my plugin for ranks and use it in another plugin? do i need to create an api?
Either create an API or if you just want to get what rank it is, as in the name or something. Just use placeholders.
Depends what you're wanting to achieve.
but I basically dont have to put an array there if I dont have any StringLists right?
hm ok
The ArrayList is optional, It's basically just if you want to exclude things from changing in the config. You can just set it to "none"
ConfigUpdater.update(plugin, "messages.yml", getMessagesFile().getFile(), Arrays.asList("none"));
so for something like this, I can add Arrays.asList("database") to avoid it getting changed?
Correct.
But as a good idea, test it before releasing obviously.
yep
whats wrong with this? The method runTaskTimer(Plugin, long, long) in the type BukkitRunnable is not applicable for the arguments (Main, long, long)
You need to add an instance of the plugin as the first arg.
its already added
Again, That should be Plugin plugin not Main plugin
Wait.. you didn't call your main class Main did you...
yes i did
why not
That is a bad idea.
why
?main
Does somebody know a library for resourcepack generation?
I have a problem when opening inventory opens and closes quickly is there a solution?
( e.getPlayer().openInventory )
Spigot version? Got any plugins that mess with inventories? What type of inventories?
Code?
the last 4 fields (is-death-banned etc.) were the ones which were supposed to be inserted in this update
Probably being weird because you have messages in the array list.
I put it in cuz if someone changed any of the previously available message fields then they wouldnt get reverted
It should be JavaPlugin plugin
Not in the stop he was using it.
public class Stylizer extends JavaPlugin { That's where you use JavaPlugin Add it as an extends to the main class.
I removed the fields from the Array and it pretty much worked but removed all my comments
If you don't want anything in the array, set it to "none"
Change the version number to 1.0 or something, and get it to update again and see if it re-adds them
Apart from that, I'm not too sure as it's not my library haha.
so I generated the config with version 1.0 of the plugin
then changed over to the new version
and will "null" in the ArrayList, it updated everything successfully
and didnt revert changes made by me
So it's working now?
yep
the comment problem was occuring because I wasnt saving the file properly :p
thanks for all the help
Yeah, saving is important.
is there a method to make player send message but also log it naturally to console?
#sendMessage doesn't log the message
@quiet ice remember yesterday's maven ProtocolLib thing? now it's the other way around
i did nothing it just happened
maven downloaded ProtocolLib and IDEA can't find ProtocolLib anymore
I really need to find a place to be mentally stable
😂
Use sendmessage, then straight after, use the logger to log it to console
Or create a method that will do both.
Anyone know a simple way to make coral not die when placed?
I dont understand how this shit works
I did find a plugin that does that but holy shit trying to remove the unnecessary shit is pain
Use the BlockFadeEvent
Listen for the BlockFadeEvent and check if the block is coral, and if it is, cancel the event
declaration: package: org.bukkit.event.block, class: BlockFadeEvent
is there any way to make players be able to break specific blocks in a wg region?
You'd need to use the Worldguard API if you're wanting to implement it into a plugin you're making.
im just tryna make a region where players can only break for a example stone
#help-server Is where you'd want to ask then. not in the plugin development channel
oh okay sry
one question, how do I make a sort of leaderboard, more like taking the various data, I'll give an example, I take the kills of all the players, how do I take the player that has the most kills? to make like the first 10 that have the most kills in that server.
you sort the list
There was a plugin which was basically PersistentDataHolder, but for blocks and other stuff, does anyone know the name?
probably asynchronously in the background on specific intervals
and then display that data
Something weird occurs while I'm in my server sometimes the players are invisible and sometimes visible, however if they relog while invisible they become suddenly visible. How can I fix this problem?
message by: decembeer
I'm not sure how to stop a runnable from another class, the docs aren't helping
Example class: https://hastebin.com/zirurexovo.java
Hello everyone, I'm about to start a survival project with some players and I want to program an AntiLag plugin for it.
My ideas so far:
- Command to find out how many entities are in the CommandSender's chunk
- Command to find out how many entities there are in the whole world.
Now I need some more ideas / a way to find out in which chunk most of the entities are. (pls ping me)
Are you using the spigot api or paper api because you asked in both paper and spigot discords.
I would prefer to use the Paper API.
Then you'll get no help here. As this is for spigot api only.
I just said I'd rather use them, not that I wouldn't use Spigot as well.
You need to pick one. Spigotapi or paper api.
Do I have to? There are certainly solutions with both APIs and I can then decide on one.
Why is this happening?
(I am trying to create head with custom texture)
Stack trace: https://paste.md-5.net/ovuluhapim.cs
public ItemStack toItemStack() {
var item = new ItemStack(Material.PLAYER_HEAD);
var meta = (SkullMeta) Objects.requireNonNull(item.getItemMeta());
var profile = new GameProfile(UUID.randomUUID(), "");
profile.getProperties().put("textures", new Property("textures", texture));
try {
var profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, profile);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
item.setItemMeta(meta);
return item;
}
texture is eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmIzYThjZTY2ZGMzOTI3YmI1NDgyYjI5ZTkzNmIzOWQyNDU4OWY5MWU5OTdiYjNkZmQ1NjczOTZlODcxMTIwIn19fQ==
Are you using a spigot server or paper server
I've decided to use paper, thanks
Are you using database to store data?
If yes, just make simple query
anyone?
No need to be a PITA, paper is a fork of spigot and the same code will work on both platforms.
The real question is the impl. Unless they're using paper methods spigot can help
TLDR - don't ask for help about paper methods here
How can I make a chest private (can only be opened by one/multiple players)
pdc entries inside of the tilestate
While I believe that spigot may have dedicated methods for that, it's easier to either abuse worldguard for that or to just deny the PlayerInteractEvent if the interacting player is not in the list of players that may open the block
i once wrote a locking plugin but the code looks terrible
Thanks to PDC locking is a breeze
put player's who can open it UUID in the chest PDC
Then simply check it on interact
Or be me and use a Quadtree instead of PDCs
Lol
Look at this guys solution https://www.spigotmc.org/threads/sqlite_busy-the-database-file-is-locked-database-is-locked-error.581486/#post-4517304
a quadtree is a datastructure where each node has four children right?
im looking into building some weird datastructure to represent functions
wikipedia says each inner node has exactly 4 children
?
It's a pretty valid way to write to a db
Really depends on what he is doing
me omw to use an OctTree to represent abstract shapes instead of a set of lines
what
ill probably make a tree where each node has at most 26 children, to represent each char of a function call lol
soo this java if (blocksStore.contains("blocks store")) { Base.PluginLogger.info("Loaded placed blocks: " + ((HashMap<Location, Integer>) blocksStore.get("blocks store")).size()); return (HashMap<Location, Integer>) blocksStore.get("blocks store"); } else { Base.PluginLogger.warning("Failed to load block store"); return new HashMap<Location, Integer>(); }
says Failed to load block store but my yml is https://paste.md-5.net/ajerurixag.nginx
why dont you do block-store?
custom FileConfiguration probably
hello, I was told, before learning to dev plugins, it would be necessary to learn java at least the basics (+50 hours of lessons) is really necessary? or just one or 2 hours to learn the big bases then I tackle the spigot director?
full script https://paste.md-5.net/upebaxucen.java
I mean you can try, but I am afraid you'll notice pretty early what it isn't that easy
If you know other languages than Java you can pick it up quickly
but yeah public static FileConfiguration blocksStore = new YamlConfiguration(); this is blockstore
only 50 hours lol
50 hours were a really optimistic estimate by my standards to be honest
how do you load it?
wdym?
I only counted the really really necessary stuff, you can't get smaller than that
Then he isn't loading it
thats just an empty config
public static void load() {
//if dosent exist make it
if (!blocksStoreFile.exists()) {
try {
blocksStoreFile.createNewFile();
} catch (Exception e) {
e.printStackTrace();
}
}
blocksStore = YamlConfiguration.loadConfiguration(blocksStoreFile);
}```
How Times to earn a basés?
its not about hours, its about learning stuff till you know well enough how to tackle your problems
I sadly cannot really give a good estimate about learning java thanks to me having learnt is over years with months in between of trying - not hours.
I know well skript (mc)
Nodejs
Php
Html/css
Html/css is not a real language
none of those are really any help. May cut a few hours off your learning
Yes 👀
maybe nodejs could help a little but the syntax is just different
And do you call that method anywhere?
But for spigot, the base of java ar engouh?
I pay 5 $ for it
yep ```java
public static HashMap<Location, Integer> getBlocksStore() {
//check if blocks store is null
if (blocksStore == null) {
//if it is, load it
load();
}
//get the blocks store hashmap from the blocks store file
//return the blocks store hashmap
if (blocksStore.contains("blocks-store")) {
Base.PluginLogger.info("Loaded placed blocks: " + ((HashMap<Location, Integer>) blocksStore.get("blocks-store")).size());
return (HashMap<Location, Integer>) blocksStore.get("blocks-store");
} else {
Base.PluginLogger.warning("Failed to load block store");
return new HashMap<Location, Integer>();
}
}```
dm me if someone intrested
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
wait so how do i fix that?
But for spigot, the base of java ar engouh?
technically they are but I don't like that attitude
Because it always means that someone is going to ask hundreds of questions on here that they shouldn't be asking
i started programing with forge lamo
dont assign it to a new YamlConfiguration()
it will never be null in that way
ahh ok thanks
Ah okkay
Myeah, honestly creating the new instance of YamlConfiguration as late as possible is the proper approach
At least I don't know a better approach in the heat of the moment
there isnt even a point of creating one as you can just call .loadConfiguration(file)
what is the shit called hosting sites use to create and configure servers and give ftp and rcon in web browser ?
panel?
ok yes sort of i looked it up and its multicraft but that pointed me in the right direction
im sure there is probably many now
pterodactyl or however it is written also is a well known one
But I don't know if those have ftp
FTP in web browser is a bit sus anyways
Pterodactyl is really good
I use it myself
Requires a VPS though
mvn reload?
Yes ptero has ftp
me having no idea what im doing as usual
1 sec
I used it too, its kind of good
a little sticky to set-up, but once you understand it
But kind of hard to set up if you do not know what you are doing
You need to define it as a maven dependency
I know how to do it well
Lmao 2 persons one thought
How so?
Not as a IJ whatever dependency
right
Yeah im hobby-sysadmin soo :D
Slap it in the pom.xml
aight cheers blod
After installing it and whatever
i am thinking ab buying a dedicated server and running a lot of server off that, was looking for ways to do that sort of automated-ish
and to give remote access and the likes
Yeah I used to set up lots of servers for people
But now I do not have money for a dedicated
pterodactyl is dope
I have a recommendation for you
Oracle has a free-tier VPS
I bought a dedicated for my dad and it wass super cheap which is why i wanna buy one now
I myself am not too sure about whether that makes sense these days
24GB RAM and 4 Cores for free
And tbh do not use a VPS for gameservers
Although with inflation it might be easily doable
It's worth your time to look into it
Hmm okay
Requires a credit card for human verification, that's the downside
but works pretty well
Bruh I do not have a credit card
credit/debit
The server has 2 Xeon E5s and 8gb of ram, but has space for 768gb of ram so I will add ram as needed
Do not have
Rip
wtf
Oh nvm
Right
it was 350
nah but i could i guess lol which is what got my thinking about setting up a lot of servers
but 2 e5 proc is only like 12 cores total
Thing is that Xeons are Server cpus
overkill tbh lol
yeah
as in a mc gamemode?
Which are meh for minecraft servers with high load
I have one actually
yeah
What you want for minecraft servers to get max performance is something like a i9-12900K
It's not a required thing, but yeah you have a point
Damn why u all so rich
Lmao
It is required if you wanna run a big server tbh
theoretically then if we were talking doing mc servers with those 2 e5s at what amount of ram would it not make sense to add any more? and at how many active servers
If your server grows enough, you'll generate revenue
if 4 cores for 1 server and 8gb per server then thats only like 24gb
Yes for sure
Revenue can go towards Intel i9s and shit
a server can run on 1 core
but if you want a mass-scale one
like 50 players
3-4 cores
yeah
Clockspeed matters too
Clockspeed does not only matter, it is insanely important
let me find the exact spec on that
hmm
Server CPUs are mainly high cores at low clock, consumer CPUs are mainly high singlecore clock
Like Xeon is usually like
12/24 Cores
but 2.4GHz
quick reference guide including specifications, features, pricing, compatibility, design documentation, ordering codes, spec codes and more.
Thats nothing
2.4 is way too low
For minecraft, since they're usually running a single-thread. They have gotten better, a higher clockspeed was useful. It's less obvious but still useful now
For high scale
its stupid that minecraft servers do not utilise multiple threads
they are beginning to, but it's still not that great.
async threading right?
Yes
Well its stupid but it would require a lot of work (and therefore money) for micro$ to change this
the i912900 lists like 6 different clock speeds
but in favour, it'll make lives for developers easy, partially
the game was never designed for things like 50 players
not to mention how hard it would fuck up plugins
Oh yes for sure, but they do not care
So, how to earn spigot librairie ?
Yeah
ticking the world in regions on different threads would yeet the entire plugin eco system
??
or lock on everything, ending up with no benefit
ah you have earned 1 spigot library!
I know some custom server software which actually is 4-5 servers running one world, they only run their part of the region and parse everything between a bridge.
I'm on a quest for my next spigot library
Mammoth Architecture or MultiPaper i think
Well is there a solution for this?
write better plugins
well yea
Yeah but plugins already exist
they're built for a different type of server.
Earn spigot dev, after java existing a doc?hub.spigot.net ?
the same world multiple server thing is an approach for large players counts
So they would all need to get updates a lot
what are you trying to earn mate
If game gets multithreaded, 90% of all plugins and mods get fucked
but that is not regionalised ticking. Its just syncing up servers into one whole 
the servers themselves still tick on one thread
the plugins live on one thread
Spigot développement
Stupid question but; How do I reference IntelliJ dependency in pom.xml?
MultiPaper, but its far from perfect
You are making no sense, what are you trying to earn.
Like
what
Hella buggy, hard to organize, fucks every plugin
He wants to learn java and spigot
You should have added it via the pom.xml in the first place.
a slow migration
seems to work lol
man people are crying when their 1.8 plugin does not work
How do I do it exactly
Minecraft can release single-thread & Multi-thread server
After a year they'll patch out a warning saying that they stopping support for single-thread
lets ask chatgpt to optimize my code \💀
If they were bothered
at best paper gets there
it's not made for that haha
or one of its forks
I agree there, but hard to do and $$$
ask chatgpt to rewrite my single class 1000 line plugin into an actual java project
Lmao
imma ask chatgpt if i can have esex imo 💀
That was when i didnt realize you could use multiple classes
Hahaha real?
lol
yes i am one of those delinquents which learned java through spigot tuts
lmao
Here are a few suggestions for optimizing the CharTree class:
Consider using a trie instead of a tree. A trie is a tree-like data structure that is optimized for searching and inserting strings. In a trie, each node stores a single character, and the edges between nodes represent the characters of the string being inserted. This allows you to search and insert strings in O(n) time, where n is the length of the string.
Use a more efficient data structure to store the children of each node. The HashMap used in the current implementation has a worst-case time complexity of O(n) for searching and inserting elements, which may not be efficient if you need to perform these operations frequently. Consider using a TrieMap or a TreeMap, which both have a time complexity of O(log n) for these operations.
Consider using a char[] or a StringBuilder to store the characters in each node, rather than using a Map. This will allow you to access the characters directly, rather than having to look them up in the Map, which will improve the performance of the insert and search methods.
Use lazy initialization to avoid creating unnecessary nodes. Currently, the Node constructor is called every time a new child is added to a node, even if the child already exists. Instead, you can use lazy initialization to create the child node only when it is needed.
Consider using a switch statement instead of a Map to store the children of each node, if you know that the number of children will be small and fixed. A switch statement can be more efficient than a Map when the number of keys is small, as it allows the compiler to generate more efficient code.
I hope these suggestions help! Let me know if you have any questions.```
i cringe even when i say i know java bc of that
tf is a trie
I still kinda need help
a tree-like data structure that is optimized for searching and inserting strings
I have an external library

says it does not exist
publish the library to maven local
how tf do I do it
i love O(n)
It's been awhile lol
?google moment
Google your question before asking it:
https://www.google.com/
run mvn install in your library
that deploys it to your local maven repo
right
gradle faster
Let's go based maven enjoy3r
i don't love maven at all
but i grew up sticking to maven
just received a review for my 1000 line single classer which says 1.16 in the title saying it doesnt work above y 255 lol
Maven devs just built different
i should have deleted it
♥️
hmm is Math.log the e log or the 10 log?
Did it write any code lol
https://paste.md-5.net/aqinebojoh.java
actually I lied there is 2 other classes
And there is no base X log
always confused cuz there are other programs that do it the other way around
Well it should really be lg for base 10, ln for base e and log for base X
\👍
But log for base e is very very uncommon
(as in it doesn't make sense and I haven't heard or seen it being used that way)
got this
Ran install
I think it's good
i thought lets have a map of rootnodes for each different letter that function names can start with \🤔
it isn't
^
your grip id presumably is fucked
right
meh
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class SuperOvercomplicatedTeleportKiller extends JavaPlugin implements Listener {
private static final int MIN_Y_COORDINATE = 0;
private static final int MAX_Y_COORDINATE = 255;
private static final String SPAWN_WORLD_NAME = "world";
private static final int SPAWN_X_COORDINATE = 0;
private static final int SPAWN_Y_COORDINATE = 64;
private static final int SPAWN_Z_COORDINATE = 0;
@Override
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}
private boolean isPlayerOutsideAllowedYCoordinateRange(Player player) {
// Check if the player's y coordinate is outside the allowed range
Location playerLocation = player.getLocation();
int playerYCoordinate = playerLocation.getBlockY();
return playerYCoordinate < MIN_Y_COORDINATE || playerYCoordinate > MAX_Y_COORDINATE;
}
private void teleportPlayerToSpawnAndKill(Player player) {
// Teleport the player to the spawn location and kill them
World spawnWorld = Bukkit.getServer().getWorld(SPAWN_WORLD_NAME);
Location spawnLocation = new Location(spawnWorld, SPAWN_X_COORDINATE, SPAWN_Y_COORDINATE, SPAWN_Z_COORDINATE);
player.teleport(spawnLocation);
player.setHealth(0);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (isPlayerOutsideAllowedYCoordinateRange(player)) {
teleportPlayerToSpawnAndKill(player);
}
}
}
Bukkit.getServer() meh
looks like it might work
Lmao
oh yeah it'll probably work
you have BiomeLib in both group and artifact id
@olive lance tell it to implement them
You can refer to previous things asked as long as it's in the same thread
oh bet i think its working
noted
it keeps making up new functions and i keep making it define them and it keeps making new ones lol
you're just bad at using it then haha
fast hashmap? lol
how would a hashmap have a O(n) complexity in this case
just no
biggest size it can become is 26
ig there are 26 letters in the alphabet lol
worst case in a hash map is O(n)..
dont think a treemap will give me any advantages, dont need even it to be sorted
I mean, if you need a tree like setup, then tree map makes sense
but yea, hashmaps can be O(n) in worst case
simply due to the way they handle collision
\🥺 i was thinking of a char[26] but that will leave too much empty space
what 
actually Node[26] where the index 0 represents 'a' then 'b' etc
root node should just be an invalid node ig \🤔
creating a way to parse functions for my expression parser
For presence I have arrays that are a few thousand elements large (and mostly unused)
I think I allocate one 65k element array per world - then allocate more the futher the players are spread out
but why would you need to represent functions are trees?
like I know: parsers and stuff, but I don't understand why parsers would need that
cuz when parsing my expression i dont know how long the function string will be so i just start to look for the first character and then keep searching thro the tree
sounds like a tokenization issue
so when i have smth like 6*sqrt(9) i will start looking in the tree for a rootnode 's' and if it exists for 'q' etc till it finds smth
i just thought that was the most optimal way lol
any point to not just parse till (
Yeah that is defo a tokenization issue
now ai is complaining about the array lol
lol
ah yes
sometimes i just need to get rid of the chat history and then it starts behaving normally
How do i create heads with custom textures (base64) in 1.19 spigot?
debugger decided to explore the winNTFIlesystem
not me who thought that String#charAt was a heavy operation
why would it be a heavy operation
i thought it transformed the byte array to a char array
not really heavy too but anyways
utf16 \👀
How can i use packets to change the player vision to a mob visual like when im spectating a creeper?
so charAt is no longer just a chars[index] but instead otherstuff
you gotta force the player to spectate the creeper
bleh
there's no other way
And how?
hmm instead of having a isEndWord field i might just make that node extend the normal node class and add a function call env \👀
where is daddy in the tree
update: it actually worked
Something weird occurs while I'm in my server sometimes the players are invisible and sometimes visible, however if they relog while invisible they become suddenly visible. How can I fix this problem?
Hello, does anyone know whether CompletableFuture#exceptionally treats null specially?
I.e. would code such as
CompletableFuture<RepositoryAttachedValue<Path>> future = remote.getResource(path, executor).exceptionally((ex) -> {
resolverStatus.updateEntryErrored(remote.getRepositoryId(), "", System.currentTimeMillis());
return null;
}).thenApply((rav) -> {
resolverStatus.updateEntrySuccess(remote.getRepositoryId(), System.currentTimeMillis());
write(rav.getValue(), localFile);
return new RepositoryAttachedValue<>(localFile, rav.getRepository());
});
brick my application? So should I instead do .exceptionally((ex) -> /* .... */ throw ex;) or would that make things worse?
you mean that thenApply would threat null as a present value instead of a failure?
so that thenApply would run anyway
Well I just want to know whether return null; or throw ex; is best suited to relay an exception when using .expectionally()
I don't want .thenApply to run when .exceptionally is executed heh
when returning null that wont happen
you still need to handle the exception in the exceptionally method as its a throwable and not a runtimeexception :/
exceptionally goes back to a non exceptional stage
I can rethrow those, yeah
I know, but for some reason the me from 3 months ago thought that null was a special value, so I just want to confirm that
okay
3 months ago geol be thinking wrong 😭
Then just replace all return null with throw t - so easy enough
then wondering why you need to catch them :(
returning null does not fire exceptionally
you can just make a constant exception for special cases
I mean return null in exceptionally block
that just allows the chain to continue, with the new value
Which in this case I don't want to happen (or well in other cases I just want to be able to do that if it is possible to recover)
do the .exceptionally last
then
like
supplyAsync.thenAccept.thenRun.exceptionally
It's not that easy heh
Nah, I'll rethrow that exception
As long as the resulting future completes exceptionally, I wouldn't care
brr
Anyone knows why an arrow would not hit a player? (Dealing 0 knockback, and 0 damage)?
On the hit players' screen it appears the arrow "bounces" off him
Fully charged arrows do deal knockback, which is pretty weird. Mobs also receive knockback, even from uncharged arrows
here's some code in which I'm handling the damage. I'm doing custom damage, so even if the arrow doesn't hit the player, the plugin detects the event and removes some health
Hi, could anyone help with creating custom textured heads?
After some further testing, it appears the arrow hits only like 50% of the time, and does so more when I aim at the top of the player rather than his torso
I have absolutely no idea whats causing this
After some more testing, the arrow seems to hit only when it does more than 2 hearts of damage... WTf?
my toString method can use a lil help
whats wrong with it
children=, }}}}} empty spaces lol
Okay, so it appears the bug only works with custom-enchanted bows (i made my own custom enchants) and it's this code block in particular that's causing it.
Bows that don't have the persistent data container "data" work fine.
oh wait a minute, the "data" pdc also sets the arrow damage to 0 (because I'm not using vanilla's system), perhaps that makes the game think the arrow shouldn't deal KB? hmm
Ahh this appears to have fixed it...
thanks all my imaginary friends that helped me ;)
What part do you need help with? Also what version are you making the plugin for?
newest - 1.19.2
i tried this code:
public ItemStack toItemStack() {
var item = new ItemStack(Material.PLAYER_HEAD);
var meta = (SkullMeta) Objects.requireNonNull(item.getItemMeta());
var profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", texture));
try {
var profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, profile);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
item.setItemMeta(meta);
return item;
}
but it crashes with the following error: https://paste.md-5.net/ovuluhapim.cs
texture is eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmIzYThjZTY2ZGMzOTI3YmI1NDgyYjI5ZTkzNmIzOWQyNDU4OWY5MWU5OTdiYjNkZmQ1NjczOTZlODcxMTIwIn19fQ==
Spigot has an API for this not sure why you're trying to use reflection
what api?
shit i never knew about this, ill try it thx
How can I access name() from annotation?
why combining annotations and methods
probably want to look at Class#getDeclaredAnnotation
It worked! Thank you very much!
Short requestion related to BungeeCord, should BungeeCord chaining with ip forwarding be a supported feature? Would create a pr, and will only be used when online mode is false, which is normally not the case anyway
there is a difference in the code of the plugin between 1.19 and 1.16 for example?
For the Adventure API when using MiniMessage, I format my messages like:
MiniMessage MM = MiniMessage.miniMessage();
String message = "<base_style>Hello my name is <arg0> and I am <arg1> years old!";
Style baseStyle = // Some style that includes a color and TextDecoration.ITALIC
Component c1 = // Some component with just a color, no TextDecoration
Component c2 = // Some component with just a color, no TextDecoration
TagResolver[] tagResolvers = new TagResolver[3];
tagResolvers[0] = Placeholder.component("arg0", c1);
tagResolvers[1] = Placeholder.component("arg1", c1);
tagResolvers[2] = TagResolver.resolver("base_style", Tag.styling((builder -> builder.merge(baseStyle))));
Component c3 = MM.deserialize(message, tagResolvers);
If I sent c3 to a Player, the colors are all correct however entire message will be italic.
I don't want c1 and c2 to inherit the TextDecoration.ITALIC or any TextDecoration.
I want it to simply substitute c1 and c2 into <arg0> and <arg1>, where the rest of the message is italic.
How can I accomplish this?
Tag.styling { it.decoration(TextDecoration.ITALIC, false) }
you can explicitly disable italic
For a custom block breaking system I am making, I have a list of lists of objects to hold the blocks that need to be reset to their normal form and it resets them after 10 seconds of being in the list. I am making the list and putting objects in it as a list of Long (System.currentTimeMillis()), BlockType or Material for the block type to replace, and a Location for the location of the block. Here is the code I use to replace the blocks:
for (List<Object> list : blocksToReplace) {
if ((((long) list.get(0)) + 10000L) <= System.currentTimeMillis()) {
Bukkit.broadcast("test2", "tete");
Material material = (Material) list.get(1);
Bukkit.broadcast("test3", "tete");
Location location = (Location) list.get(2);
location.getWorld().getBlockAt(location).setType(material);
Bukkit.broadcast("test4 - " + material, "tete");
blocksToReplace.remove(list);
Bukkit.broadcast("test5", "tete");
}
}
The broadcasts were me testing, sorry xD
Here is generally what I use for putting something in this:
List<Object> list = new ArrayList<>();
list.add(System.currentTimeMillis());
list.add(currentlyMining.get(UUID).getType());
list.add(currentlyMining.get(UUID).getLocation());
blocksToReplace.add(list);
with this code, I am getting a ton of errors/exceptions. The picture is what the console outputs.
Does anyone know how I can not get these errors. By the way... it works fine and it resets the blocks and everything it just gives this exception for some reason and I wanted to figure out the reason why and not just surround it with try/catch xD
oop
lemme edit that im not done lol
Thanks. I'm a little confused. Where do I disable this?
I want "Hello my name is ", " and I am " & " years old!" to still be italic / inherit any TextDecoration in the baseStyle.
I effectively want to try and replicate what would happen if it was:
Component.textOfChildren(
Component.text("Hello my name is ").style(baseStyle),
c1,
Component.text(" and I am ").style(baseStyle),
c2,
Component.text(" years old!").style(baseStyle)
);
For a custom block breaking system I am making, I have a list of lists of objects to hold the blocks that need to be reset to their normal form and it resets them after 10 seconds of being in the list. I am making the list and putting objects in it as a list of Long (System.currentTimeMillis()), BlockType or Material for the block type to replace, and a Location for the location of the block. Here is the code I use to replace the blocks:
for (List<Object> list : blocksToReplace) {
if ((((long) list.get(0)) + 10000L) <= System.currentTimeMillis()) {
Bukkit.broadcast("test2", "tete");
Material material = (Material) list.get(1);
Bukkit.broadcast("test3", "tete");
Location location = (Location) list.get(2);
location.getWorld().getBlockAt(location).setType(material);
Bukkit.broadcast("test4 - " + material, "tete");
blocksToReplace.remove(list);
Bukkit.broadcast("test5", "tete");
}
}
The broadcasts were me testing, sorry xD
Here is generally what I use for putting something in this:
List<Object> list = new ArrayList<>();
list.add(System.currentTimeMillis());
list.add(currentlyMining.get(UUID).getType());
list.add(currentlyMining.get(UUID).getLocation());
blocksToReplace.add(list);
with this code, I am getting a ton of errors/exceptions. The picture is what the console outputs.
Does anyone know how I can not get these errors? By the way... it works fine and it resets the blocks and everything it just gives this exception for some reason and I wanted to figure out the reason why and not just surround it with try/catch xD
Guys is there a way to change the color of the text after the /?
In the style of components c1 and c2
Thankyou so much!! 😄
CME means you're modifying a collection while iterating through it
use an iterator
or a second list
you're just going to cause another issue if you go through a list relying on list size but then change the size of the list as you go
hmm
go look up iterators
no
yes

because the size would not change for all objects lower than it if i removed an object at a higher index
or not size index
and we are going lower as we go
cool kids use removeIf
well don't come back crying in a few weeks about how you had to rewrite it all
you are writing yourself into a corner
how
following bad code practices like they one you are currently insisting on doing creates quirks you have to work around later down the line which will eventually lead you to having to rewrite everything because you built your system on pillars of kerosene
but hey your time is yours to waste
we'll see I guess
Is there a particular reason why you use Objects instead of just a simple class/record?
you're going to be in for a bad time if you try to make this not through oop
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
second one from the bottom
I already did the sololearn course
I recommend the second one from the bottom, it's how I got started
ive already started
don't stop until you have a good idea of how oop works
but I forgot all of sololearn because I never used it as I learned 💀
I don't know that there is a worse way of doing what you're trying to do now that I am looking at it
https://hastebin.com/otitezatak.java and replace Object in your list with "BlockReplace" and you can add this class as inner class, way safer
thanks
lmao
maybe if you tried to directly modify the jvm so you can really brick something
Or learn Kotlin, way faster to work with:
data class BlockReplace(
val expire: Long,
val material: Material,
val location: Location
)
val blocksToReplace = mutableListOf<BlockReplace>()
blocksToReplace += BlockReplace(System.currentTimeMillis() + 10_000L, ..., ...);
val curTime = System.currentTimeMillis()
blocksToReplace.removeIf {
if (it.expire <= curTime) {
// ...
true
} else false
}

the only actual "code save" there is the += instead of .addAll
the entire rest can be coded in java in the exact same line length lol
Ok yea Java copied data classes,.. and you also have Lombok, but for example you don't have to write the last closure as parameter :p
wow xD
lmao
blocks.removeIf {
}
vs
blocks.removeIf(it -> {
});
you don't need lombok if you don't know oop in the first place
switch now 🔫
And you also have null safety, coroutines, higher-order functions, inline etc. :D
and a stdlib you get to carry everywhere with enough parameter overload to jump ship the second my eyes have to witness it
its a subjective thing
¯_(ツ)_/¯
Hi, i've an EventException: null error in InventoryClickEvent and there is my code
no, you have a cme
player.closeInveotry() removes them from the viewer list 
Yea you have to try it xP
it has 1 viewer always
I have had the opportunity to try kotlin xD
and the closeInventory executes after for loop
you are modifying the list as you go through it
which you can't do
its alright, I would not switch to it over java for the added functionality it delivers
especially with the pretty damn bright future java has ahead
In becoming like C++? xd
hmm
so how should i close that inventory?
clone the list to a new list is the easy and lazy way to do it
how do you guys send a remove player packet in ProtocolLib
this is my first time to try it
so far i created a packet container and I don't even know more than how to send a packet through it lol
ProtocolLib has a Wiki for sure, did you read that?
?
game?
no, this is terraria
hytale actually
where o.o
I'm looking through code all over GitHub and i still don't get it so a wiki won't be bad ig
class tree
JavaDoc isn't a wiki
yes still
Well well-written javadocs can still act as a wiki
90% of all wikis are fully stupid
If you are looking for something more beginner friendly, probably go for packet events and make retropper happy 
oh you're MmdGIO's friend, what are you trying to do with packets?
especially given that https://wiki.vg/Protocol exist a wiki is not needed here
a well written wiki won't disappoint you 😉
Well written javadocs even more so
https://github.com/iiAhmedYT/ModernDisguise
update my lib
A good wiki is worse than a good javadoc imo
nah retrooper sucks
I mean idk
good wikis are great, especially for their convenient download button at the top of the page where i can steal enums
really convenient
you came all the way here, write that packets too, i'm sure Mmd will have information about that too
Oh yeah, and those legacy Java 7- javadoc pages are absolutely trash
@iron palm 'D
he is a good guy believe me xd
he's a good guy i know
usage is inconvenient to me tbh
lemme show u smth
hence why I suggested potentially switching libraries
its a very very generic framework
btw don't look at the code (for now)
oh you're working on that commission
also yeah this is not a good way of doing it
bringing Rust into Minecraft
I'll use him being a friend with me on both accounts as a support service
yes thats why i told u xd
Is there an easy way to find NBT tags on a spawner ItemStack so I can change the spawner type
but not for now i really want to try ProtocolLib xd
well a quick google search gets you https://www.spigotmc.org/threads/how-to-send-a-packet-using-protocollib.506726/
ah shit I gotta post my NMS tutorial in a week
oh wait i can use elseif insted of if in a else
lol
It's more that there's a packet to send multiple blocks at once
which ever you actually needed
how exactly can I send in the newest version sound packets with protocollib?
this gonna make devs go out of business 💀
WHAT
i know all that
so what is your issue 😂
Yup 💀 💀
that AI stuff?
Yup
Literally type in Make me a minecraft spigot plugin that messages new players the word "Hello" when they join.
I used it to fix a bug with my database caching system
i still can't find how can i choose what to do in the INFO_UPDATE packet
where deleting an entry would delete all of them
i'm gonna type all of rust story in that for my plugin 😂
fr
https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/events/AbstractStructure.html#getPlayerInfoActions()
https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/wrappers/PlayerInfoData.html
declaration: package: com.comphenix.protocol.wrappers, class: PlayerInfoData
declaration: package: com.comphenix.protocol.events, class: AbstractStructure
@topaz cape
Iran 💀
Guys keep it secret
lol
its all over tiktok
F*ck
no point
the owners said they were gonna monetise it
Yep
so I suggest abusing the crap out of it before you cant
ok
2b $ they can earn
hot
Is there a way to change spawner time while its an ItemStack
is it possible to place a block hitbox, or something resembling one (full block) off-grid? I tried shullkers but they snap to the block grid, but im unsure if theres not another option.
I can simulate one of course by teleporting the player there or by telling their client they're standing on a shulker and remove it when they walk off but i really dont want to have to do that geometry & it might break sneaking
👍🏽 thank you
iirc with an armorstand and shulker passenger combo
obviously use sparingly 😅
that still doesn't tell me how to make the player leave 
you want to remove them from the tablist right ?
let's say that yeah

should hide the player as well
so you also need a destroy entities packet
two packets then
any reason you don't use inbuild hidePlayer functionality ?
this is the reason
Line 123
@quaint mantle
what version do you want this for ?
because this recently changed in 1.19.3
i have it implemented in all versions except 1.7.10 which i wanna implement
because im getting paid for it💀
He is allowed to express his sssaaasss j j j
nvm lol 🤣
that is pretty much the only way here, I don't think 1.7.10 has any docs left, especially not for the damn internals
me when non 1.14+ developer 💀
lol when i enter input in my application i get an exception in initializer exception cuz the static block only seems to run at that point \🤔
tf
my entry method calls the Expression constructor and only then the static field in Expression seems to be initialized \🤔
you know whats big too
good
me patiently waiting for nms tutorial to be done
didn’t you start it like@last month
it's the same packet as 1.8 - 1.18
jesus
It's at about 220 lines of text
mhm mhm
hmmmm
what language is that
im sorry
it's a weird style
LOL
nms crash course
nms for dummies
made by ImIllusion, revised by ChatGPT
I literally just paste stuff and say "how can I make this simpler?"
you mean written by chatgpt
really ?
i literally wrote my english assignment with chatgpt
chatgpt does this
then tossing it on chatgpt
i should do the same thing for code revision
and using it to simplify the contents
love it how my static block only gets called when my programming is already scanning for input
does this look like abuse?
What does the h behind the cos,sin,tan mean?
idk im not a mathematician
just saw them in the java.math.expression.parser and decided to add them too
looks like it is hyperbolic
Which is the second hand slot? Because i need to cancel putting items in the second hand
I have been looking online and appear many slots
Yeah that why. its pretty messy
So second hand slot is number 5?
top is how the protocol handles it
bottom is how bukkit handles it
setItem(40) on bukkit makes the client receive at slot 45
Also are you mad with me?
Versioning and clients ugly things
I just see you as the guy that likes to copy my old utils
oh haha i mean i copy because i like your logic
I have really bad logic and problems, i mean im really bad with logical things
but your menu engine is more like JPanale from java from what i have seen
Sorry for pinging 😬
I don't care
What do you mean by IF?
except instead of XML I just make it all with code and configurations
yeah, like the old one, via config.yml
it lets me do stuff like this
funny thing, this new version is compatible with the old configs
I just had to make a ConfigurableLayer thing
and a registry
oh nice
Im really sad tho because i cannot figure how to make to work Jackson stuff 💀
I was planning to use it for making an Yaml and Json based custom library but when ever i give a try i fail it
lol im confused, the FunctionContainer static block isnt called until i enter input in the main method
class should be loaded when calling toString on the class ig
could be
lol my executeNormally method asks for input first and then the statis block is run
looks like the Expression class isnt loaded
That why i dont like statics, always give problems
never got problems
a bunch of classes dont seem to be loaded yet
are you speaking to me?
why do i get nullGlacies and nullHarenae? Can somenone help me? would really appreciate it
smells like O(n) too
where am i supposed to see that
ugh and were are you calling setTitle with that message
uh just dont use that symbol, use & with ChatColor.translateAlternateColors
BRUH MY EYES
cant really find where, that white is hurting me
😂
me too
In my case i use IntelliJ because its more opened in terms of plugins
yeah i consider using intellij too
is there an easier reliable way to tell how many mobs of a type a player has killed, or am I just going to have to make one of the most massive SQL tables
isnt there a statistic?
wym dont use that symbol?
aka player.getStatistic(MOB_KILLS, EntityType.WHATEVR) or smth?
yes, but doesnt tell each type kill exactly
Just a total
I think its just give you the total mobs kill
that symbol fucks up sometimes
I wasn't sure if that was reliable because isn't that wiped idk prob just something heard a long time ago?
and encoding does even more
thats all I need
what symbol
?