#help-archived
1 messages Ā· Page 116 of 1
Hey guys, does anybody know how to change player's block collision to one block height?
@jolly ember Is there any way?
you can try posting a ticket but it might get closed if the issue is not obvious from the stack trace and there are no reproduction steps
md_5 will u play mc dungeons
So, the Spigot APIs are now the BuildTools?
ye
Use Maven to use the SpigotAPI @formal wharf
I dont like Maven, I cant get BT from that for some reason
@jolly ember https://www.spigotmc.org/resources/crawling.69126/
Repo stuff is amazing Jat, you should try it
use gradl
I haven't learned the whole Repo stuff so I just import an APi
Easier for me right now
maximum a day normally for me
rip, i added someone manually because i thought paypal api had a fart however now this happened š
lol
is there any plugins that can fix item sorters on paper 1.15.2.
also, god i regret choosing this name
@jolly ember https://www.spigotmc.org/resources/crawling.69126/
@undone narwhal I found out that changing riptide flag can change collision box to one block height, but i don't know how
Have find source code on how to do it
at least i know now to how to put player to tunnel
@frigid ember this isn't paper support go to our discord.
isn't paper a branch of spigot?
We are separate projects
Because he is a part of the core team working on said project?
ok?
hey guys, should I close my sql connection once I've finished to execute my queries
and reopen it when I need it
use a pool
things like hikari can make it easy to manage some stuff, can easily set the min connections to something low if you're not expecting to use it much, but, it can also handle scaling up the pool if needed
ok thanks
Heya guys, im looking for a Modpack Maker š
Spigot doesn't support mods, try looking into technic. I found an article from them that you may find interesting https://www.technicpack.net/article/building-your-own-modpack.7.
We don't provide support for that here as this is mainly for plugin focused issues.
ohhh okay thank yuo
Hello i keep getting errors can you please help me? Thanks
Seems you hadn't import the jar
@cursive lily you are using eclipse?
yer
i recommend you intellij idea is 1000 times better than eclipse
ok
ok
Start by watching tuts online "create spigot plugin intellij" to familiarize with the ide
ok i was watchng one
you can use maven or gradle
You can, it's an option the plugin
@floral isle Material etc is Xseries in your lib right?
is it possible for me to kick someone, sending the player thru Plugin Message to check someone on bungee then send back?
Thanks for the help
Okay
@frigid ember You can do it, but doing this every tick is going to be really heavy
ok
@cursive lily it is better or not intellij idea of āāeclipse
Can a normal player see what plugin message i'm sending?
they'll see it if you send it to them š
Or do you use bungees channel?
@floral isle ill tell you later sorry thanks tho
Hi guys I'm not that experienced with files and wanted to ask if there's a good way of creating a new file whenever a command is executed and also read stuff from this file?
Are you using the spigot api?
hi
Yes
Then perhaps take usage of the FileConfiguration system
use a config
Or maybe another would be can you give items "values" and read them later?
Like a damage value or something
You can load a YamlConfiguration with YamlConfiguration.load(file);
Yeah but how do you make it so it can read every file?
Do you do that with a for loop?
yeah
K thanks!
And how would you create the file?
public TeleportUtils(main main) {
file = new File(main.getDataFolder(), "locations.yml");
if(!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
Would that work?+
but replace "locations.yml" with name
Uhm
You never check if the file exist itself and only create it based on its parent
}
if(!file.exists()) {
try {
file.createNewFile();
}catch(Exception ex) {
ex.printStackTrace();
}
}
So you would need this to right
Yeah
K thanks
Well Iādnt check if the parent file exists or not. Just call mkdirs on it if current file doesnāt exist
public TeleportUtils(main main) {
file = new File(main.getDataFolder(), "locations.yml");
if(!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if(!file.exists()) {
try {
file.createNewFile();
}catch(Exception ex) {
ex.printStackTrace();
}
}
These two combined should work
if (!file.exists) {
file.getParentFile().mkdirs();
try {
file.createNewFile();
} catch (Exception ignored){}
}```
Ohhh ok thanks!
You might not want to ignore the exception
But will it try to create the parentfile everytime it detects that has not been created yet?
it has not been created yet*
Every time it loads the current file it will try creating parent dir
Overwrite what?
I donāt believe so
I will try
And to add values I would just do cfg.set("damage",0) as an example
if cfg was the yamlconfiguration right?
Yeah that's what I thought
Do this instead
FileConfiguration config = YamlConfiguration.load(file);
config.set(ādamageā, 0);
config.save();
No but a reference is always handy if youāre going to use the config over several times
Yeah that's true
And saving is necessary after youāve written in the config with code
Yeah
Why do newer versions of spigot overwrite old(1.8 worlds) and make them incompatible to reverse back to 1.8 worlds and use on a 1.8 server.
Do they?
because the save data format changes
minecraft has never been backwards compatible
slots start at 0
ie 0-53 not 1-54
yeah
md5, I was about to find out what was wrong and it's easily reproducible. if the server.properties has no gamemode set, like so:
gamemode=
world creation results in a NullPointerException
No fallback value???
I think that's user error, but I also think it should be handled. maybe a warning on startup would suffice?

hey there, I have a question, what kind of license is associated with the Craftbukkit mappings?
Hello im currently getting an issue where when i put the plugin in the plugins folder that it doesn't show up? Please help! Thanks in advance
Any errors N
@dusty owl GPL I think ?
Hello, I keep having issues with my worldborder. I was wondering if anyone knows how to properly configure worldborder for overworld and nether. Do you have to keep in mind the 1/8 rule? Or do I set worldborder in Nether and Overworld as the same radius?
Lukeos main class doesnāt need to be final
no
@cursive lily do you have compiled the yml?
actually
Did you create a plugin.yml
Thatās not an error nor a warn
yer the plugin.yml is good
Is there a line saying that your plugin is enabled
Can you send you plugin.yml?
nope
^^
The answer was for me Trixone lol
plugin.yml
Is the your plugin a jar file in the plugins dir ?
oh
the plugin is a jar and is in the plugins folder
What if you open it?
In what package is your plugin.yml?
open the jar
Yh
does nothing
@dusty owl GPL I think ?
@undone narwhal I think so, but is not specified with any kind of file....
Open w/ winrar or winzip
So you can have a loon what files exist in that jar
@dusty owl CraftBukkit git has a GPL license file
ok let me try
when i exstract with win rar it creates a folder with some stuff in it
What stuff
extract**
Is there the plugin.yml file?
like pom.yml and
yml or xml?
no pom.xml
Are you building your jar the right way?
Youāre using maven?
Uh well how do you export your project into a jar?
@dusty owl CraftBukkit git has a GPL license file
@undone narwhal I know but the mappings are not part of that specif path even if they are part of bukkit (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/mappings)
this and then running package and then it creates a jar file @naive goblet
using run maven build
^^ If you want that nice little menu with all maven commands, navigate to View > Tool Windows > Maven
yer thats the menu
@dusty owl Yep but it is related to so it keeps the same license
While there is no another license
nice, I think so, but I wanted to be sure
I thought mc couldn't be sublicensed @undone narwhal
well, is not a sublicense of mc (Spigot uses patches to avoid using mc code)
One question again xD
How can you use numeric id's instead of the Spigot Materials?
Nevermind I think I found it
well, is not a sublicense of mc (Spigot uses patches to avoid using mc code)
@dusty owl they cant patch whole of mc
sure, they patch what they need, but the file server.jar is downloaded when you start the server the first time, so they are not really ridistributing the mc code itself (btw I read the cose once, in the past so Idk if it works in this precise way lol)
So I'm kinda new to plugins, but how would I go about making a plugin support multiple versions in one jar
Not importing or using NMS
multiple minecraft versions, or multiple environments support?
the net.minecraft.server import
Just stick with the bukkit api, most of the bukkit api stays the same across all versions.
It is
for backwards support
nope
š¤¦
Just use 1.8 spigot API.
not everyone
Yeah i mean like 1.7, 1.8, 1.9 all in one jar rather then making people have to download a specific jar
but I do use 1.15.2 time to time
I dont
respect idisappointment's choices
or whoever
They wanna support whatever, let them.
idisappointment, if you need more support dm me as one is not allowed to give support for legacy versions
well glhf i ain't helping
You can write it in the lowest version that should be supported and then it should work with all versions upwards from the oldest one
1.8 supports all
There is no guarantee of support when using legacy versions
dm me @tiny horizon
will do
But I mean many devs still go with it so it exists unofficial support
That's why I said it " should" work
1.12.2 and lower has so many issues
name a few
Name them
We're talking about issues right?
name them
@frigid ember today im ur side
LES GOO
LOl
name them
@sturdy oar These aren't really issues more like inconviniences
There are some issues, not really important
Name them
Except sticky packets
But we all should use new versions
^
imma leave, i don't have time to waste with people who keep glorifying 1.8
We don't glorify it
I donāt see any issues except for that 1.8 might be a little old
You can change it with code lol
Now I'm glorifying it
Maintaining 1.8 plugins literally means: keeping all devs wasting time supporting older versions that are not that differents
Pvp can be found almost like 1.8 with a simple code line in 1.15.2
Windows 10 is a little old anyway
Glorifying ok
Because no one provides valid points which is why its a no end issue.
If you want support for most versions make it compatiable; e.g. nms for somethings
1.15 still doesnt have hitboxes, blocking etc.
Shields blocking all damage lmao
There is nothing new
But idk
if 1.8 is so great why only 14% of the servers using it š¤·āāļø
It's younger
There is no Windows 11 or 12 or 13 or 14 or 15
Not every plugin or spigot has bstats
And how do oyu get these?
@sturdy oar comparing server amount is kinda misleading
I'd say comparing between 160'000 different servers is enough
I can open 10,000 1.8 servers on 80 machines does that mean it has players?
True
i love
Aren't you bored of legacy stuff, nms cross versions?
you should compare player counts
i even made a packet api for it
It takes like 20 seconds to add support through nms
exaguration
Ichatbasecomponent no longer has a byte as a constructor in 1.12+
I don't have that time for people staying 1.8 because it has more FPS or a blocking sword functionality
Again your choice as it is theres
i still use 1.15.2
just some 1.8 pvpers are ignorant
and just do it because they are influenced by others its "bad"
That is the sad part.
This is my choice yes, but if other devs like you still use 1.8 then you're destroying the potential targets of my plugins you know?
Ngl bees is lit af
?
what do you mean
you will still get an audience
as your plugins are optimized for 1.15.2
We make universal plugins optimized for all
Honey blocks are really nice though
Yup
You're really everything but not smart...
???
Let's move to general guys
And the Nether Update has some nice stuff aswell
that was kinda rude
How can you make an armor stand follow an entity (not the player)
Just so an entity can have a custom name that you can always see
Not only when you look at it
Or do you use bungees channel?
@hoary parcel if i use bungees channel, can they view my plugin message?
Nah, those shouldn't ever reach the client
I have this question:
I'm caching data from a database (either MariaDB or SQLite) and
I'm saving data inside a Set , it's a set of PlayerData which is an object that contains 5 fields (UUID, username, and 3 integers). This set would be able to be accessed concurrently, to achieve this i used CopyOnWriteArraySet
However I'm worried that with databases with lot of rows this could kill the performance
should I worry or not?
yeah but let's say someone has 10'000 rows
CopyOnWriteArraySet would copy those objects each time
it's accessed
I could technically solve this by using Futures and making requests perform their work on other threads
But it just seems like an improper fix and just throwing the "load issues" somewhere else
I mean, could syncronise access to the set
well I already optimized a lot of stuff by using parallelStream
I think i should try generating a database with random values and see how it performs
hey anyone have an idea how i could prevent players from using items with lore in the 2x2 crafting? ive already tried using inventory drag which for some reason didnt trigger every time, and inventory click which doesnt give off the result slot
why lambda
I need help with a plugin that I am making a plugin that show your rank / prefix from luckperms in the scoreboard on the right and in the TAB
You're not giving us any information about what part you need help with
So I made a plugin that is show a scoreboard on the right
it look slike this
on the %PlayerRank% needs to be the prefix /rank of a player
Dutch by the way what you are seeing there
Did you code the scoreboard plugin? If so just hook to PlaceholderAPI
a own made plugin
Ok then hook to PlaceholderAPI and use it's placeholders or create your own
so Placeholder API in the plugins as a libarary and in the server him self?
Wdym?
It's up to you but I recommend adding PlaceholderAPI support
We have a lot of custom plugins on ower server sutch as that coins
@sturdy oar I'm interested into your parallel data using with database. If it doesn't bother you, can you please keep me up to date with all you try etc?
Error: https://pastebin.com/Jq3V6iVm
Method: https://pastebin.com/g6SkenRz
Anyone can help me? im was trying to start a server with Hamachi, but a Appeared " FAILED TO BIND PORT " I've tried everything and I couldn't solve it.
If you know how to help me, send me a message in private.
@sturdy oar I'm interested into your parallel data using with database. If it doesn't bother you, can you please keep me up to date with all you try etc?
@undone narwhal wdym
guys how can i make like this shop system ? when buy armor auto equip
what have you tried so far
Is this your plugin, or someone else's?
no its cubecraft egg wars shop
contact them then?
like im not getting what you trying to achieve
if you're developing a plugin just listen to the click event
and equip the armor to whoever clicked
There is no reason to use that
Do as ExtraLimo and FendiTony77 said
also you might want to check the player's current inventory
you don't want to just yeet their currently equipped armour
If the slot is not free move the armor to the inventory
If the inventory is full, drop the armor (or send a message that tells to free the inventory)```
simple as that
If you want to rip it compleatly you also need to equip it if the armor is better
i just want auto armor wear when i buy. so need coding with "eclipse" ?
Either find a plugin that does that
or made your own
I'd also suggest you don't use Eclipse
rather IntelliJ IDEA
@hoary parcel what is npe
^
is google that hard to use
so i cant make this plugin :/ bcs i dont know coding
.8ball is Google hard to use?
this is not paper
But we have cafebabe here, no?
Yes
?8ball is DuckDuckGo better than Google
Yes
?8ball are you not retarded?
No
perfection
sorry for reposting but i kinda didnt get a response the first time
does anyone have an idea how i could prevent players from using items with lore in the 2x2 crafting? ive already tried using inventory drag which for some reason didnt trigger every time, and inventory click which doesnt give off the result slot
Statistics š¤ š
you could technically check the ItemMeta?
ive also now tried looping through the recipe matrix and setting the result to air if it detects an item with lore
but that didnt work for some reason
wym tony
- Listen to the PrepareItemCraftEvent
- Check items in the recipe
- Cancel event if items contains lore
like i said i already tried
also you cant cancel prepare item craft
thats why i tried setting the result to air
Ow I didn't see that
what handles the /help command?
the text doesnt fit on screen so it finishes off with ...
and i want to fix that
i dont have that plugin
i cant seem to edit anything, i dont even know where /help gets its information about those commands
you mean config?
no
plugin.yml
it's an embedded resource used by the server to manage plugins and provide info about them
every plugin has one, since it's required by the server
If I #set() in a custom yml, do i have to #save() afterwards?
https://gyazo.com/461756e2d9018a8ed477de47ba1fae9c - Anyone knows how to fix this problem?
when I open it just works but when I add it in my file manager it doesnt
Did you load your css?
how do i make an event run every tick
create a bukkit runnable schedule a repeating tick task
Hey,
I have a created a plugin and its in a Teamchat , but on my localtest Server is all ok, on my main Server it won't go, can anyone help ?
Are they running the same version of spigot? Are there any errors?
how do i make a projectile source
no errors and the Same version
.runTaskTimer is this a repeat task
yes
use that
store the bukkittask i recommend
so you can cancel it later
Did you load your css?
@undone narwhal ?
What do you exactly mean with this :p
Location loc = turret.getLocation();
turret.teleport(loc.setDirection(ent.getLocation().subtract(loc).toVector()));
Location loc2 = turret.getLocation();
Fireball ee = loc2.getWorld().spawn(loc2, Fireball.class);
ee.teleport(loc2);
ee.setShooter(turret);
Vector y = turret.getVelocity();
int x = 40;
ee.setVelocity(y.multiply(x/20));
}``` whats wrong with the setsshooter
We don't know what the turret is
an entity
all entities got int the world
in
and then narrowed down using if
Entity cannot be converted to ProjectileSource
https://gyazo.com/461756e2d9018a8ed477de47ba1fae9c - Anyone knows how to fix this problem?
when I open it just works but when I add it in my file manager it doesnt
Entity cannot be converted to ProjectileSource
What is the best way to check to see if a player has permission to right click a block without using any APIs?
public static Set<String> getLocations() {
if (dbFile.getKeys(false) != null) {
return dbFile.getKeys(false);
} else {
return Collections.emptySet();
}
}
second line has NPE, how can i prevent that
@remote socket dbFile is null
But it's not...
Are you checking? Do a sysout if dbFile == null
First check section than get keys
private static FileConfiguration dbFile;
public static void setup() {
file = new File(Bukkit.getServer().getPluginManager().getPlugin("IChest").getDataFolder(), "database.yml");
//check exists
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
dbFile = YamlConfiguration.loadConfiguration(file);
}
Different class
Yeah that could be why, I had the same issue the other day
How are you accessing that class?
ChestsDatabase.setup();
ChestsDatabase.get().options().copyDefaults(true);
ChestsDatabase.save();
Don't make it static, no need
Remove all of the static modifiers
Put this in your class that has the setup() method:
static SetupData inst = new SetupData();
public static SetupData getInstance() {
return inst;
}```
But change "SetupData" to your class
Then on your main class, put this:
SetupData data = SetupData.getInstance();```
if(im.hasEnchant(Enchantment.BINDING_CURSE)) why isnt this working
then onEnable, put this:
data.setup();```
Why do some client bound packets contain an entity id where it is unnecessary, for example the Client-bound Entity Velocity packet.
When sending it you already specify who you are sending to, as the entity id must be specified in the packet constructor, does this mean I can send velocity to one player only and the rest won't see it?
if 2 seperate events on 2 differnet plugins have the same name will that cause errors
Yes retrooper
No euanPC
org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:80) ~[spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) [spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:353) [spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:210) [spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:784) [spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
Caused by: java.lang.InstantiationException: com.javaminecraft.Elytra
at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_241]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
... 7 more
Caused by: java.lang.NoSuchMethodException: com.javaminecraft.Elytra.<init>()
at java.lang.Class.getConstructor0(Unknown Source) ~[?:1.8.0_241]
at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_241]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot.jar:git-Spigot-e7dc2f5-a8ec1d6]
... 7 more```
Can you send the main class?
I realllyyyy need some help with vectors
?paste
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
If anyone wants to take at my question more in depth:
Its fairly advanced, and I need someone who has a fairly deep understanding of Minecraft's implementation of vectors
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
@hollow thorn Do not create a constructor. Instead override the onEnable() method!
Remove your constructor and move the stuff inside to the onEnable
wut?
Your public Elytra(Plugin plugin)
Your remove it
And the two lines inside you move it to the onEnable
does CompletableFuture#thenAccept block the thread if the supplier is async?
Nop
Maybe it won't block but it will work synchronized
@sturdy oar u can duckduckgo it
I've read google but i think it depends from the context
@frigid ember nice help...
@sturdy oar Reading something on CompletableFuture whithout mentioning the Spigot stuff only main thread is not the reality ^^
you had asked what an NPE was .-.
@remote socket is your problem solved?
I'm pretty sure it won't block the thread and work synchronized then you can use Bukkit methods but not sure 99%
You should try a thread.wait(5000) to check
ill just try and see if it doesn't crash
What is the best way to check to see if a player has permission to right click a block without using any APIs?
Player#hasPermission("nameyourpermissionhere")
@remote socket is your problem solved?
@paper pumice Yes, thank you very much š
Np
and I mean like not a String permission, I mean like has physical access
I mean like, if they can build/break basically
Like for example, if they're in their own territory or whatever
if they are in survival, they can always break?
But if they are in a territory that isnt' theirs
Ah
Towny, factions, etc
if you have any stuff like worldGuard or GriefPrevention limiting that, you'd need to hook into their API
You have to check Factions, wg or other API
Is there a way to do it without API?
no
Nop
Ok np
thank you
Just another quick question, do you guys know, if I use FactionsUUID API to check if they can break/build, do you think that will work for other Factions plugins such as SavageFactions, MassiveCore etc?
If FactionsUUID and SavageFaction are forks of Factions then you should use Factions API
Ah ok
I know that Factions has an API
Can you do lambda like this?
toBeRemoved.forEach(ItemStack -> quests.remove(ItemStack));
isn't SavageFaction standalone?
@ashen stirrup Use method reference
forEach(Quest::remove)
yeah it's much shorter, i end up using method reference pretty often
Oh okay, would it work though?
I'll test lmao
does anyone know how to add acceleration to a vector?
Oh yeag
there's no such thing named "acceleration" in a vector
I don't want the vector starting out at max speed. I want the vector to have 0 speed and then gradually work its way up in speed
I understand that
@ashen stirrup Even use quests.removeIf() if you don't want to create another list
Which is why I'm trying to figure out how to apply acceleration to entity movement in minecraft
@sturdy oar
you could gradually resize it
It'll throw a concurrent modification error?
you get that if you try to add stuff into a list while you're iterating it
@frigid ember Minecraft uses Velocity, I think you just have to input a vector then it will calculate trajectory with all other forces (gravity etc)
Can someone who knows luckperms help me?
@ashen stirrup not with a removeIf !
I'm in voice
What's the issue?
@undone narwhal yes I understand that, but again, Minecraft applies speed based on the vector
I want to instead have a parabolic effect
where once it peaks at a certain speed, it decelerates
@ashen stirrup My defult can see /brush as well as a couple other commands
If you want a graduating speed then you'll need to iterate an increasing velocity
Set the permission to false?
As Fendi said
I dont want them to see it... its coming up as an auto selection for pressing "tab" to auto insert
fuc
@sturdy oar did the Not async method block the thread?
am still writing
anyway I'm supplying asynchronously so it shouldn't
the consumer should apply on the main thread as soon as the CompletableFuture has been finished from what I've understood
For sure
I mean i could even run that async, it's just sending messages to a player
and messages can be sent async
Yep!
since they're just packets
You really don't need to run that async at all
???
wut
I'm assuming getUsername() is just returning a variable
Like a getter
In which case that code's runtime can be measured in microseconds
I'm searching for all PlayerData objects in a set that match a given UUID
if the database is huge, that could take some time
After the "i don't want to leave 1.8 because it is more performant", the "this is useless to fetch all the data async" š
@gleaming helm You want to put all the players data in Ram?
It's useless when that code can be easily modified to run in constant time in microseconds
Is that fetching data from files?
playerData is already in memory
No, it's fetching data from a CopyOnWriteArraySet,
but i don't need an hashmap
And set the key as the thing you want to look up by
i'd have to rewrite the entire code
You do if you want your code to be remotely efficient
to have the UUIDs as keys
Yeah why wouldn't you do that from the beginning
Sounds pretty idiotic to me
Has nobody here heard of time complexity before?
Sounds strange to force someone to modify his entire structure without knowing even its functionality
And if you really care about your code running really fast, for the love of god don't use a fucking stream
Omg here we go again
what's wrong with stream lol
Stream are perfectly fine unless you're calling them 1000 times every second
š
O(1) isn't always guaranteed in an hashmap
š yes it is
it could be up to O(N) in the worst scenario
driver does not support get/set network timeout for connections. (feature not supported)
My Friends cant Join my Server and i got this warn
If you want to know how a hashmap does lookups,
It hashes the key
And looks up the value at that bucket
O(1) time
How do I create a IChatBaseComponent with a string in NMS?
more keys could have same hash
Doesn't matter if you have 2 buckets or 2 billion buckets
spigot 1.15.2 api?
Yeah if they have more than 1 hash then you're using a dumb hashcode
UUIDs have a perfectly good hashcode implementation
So if your keys are UUIDs then you're going to be totally fine
driver does not support get/set network timeout for connections. (feature not supported)
My Friends cant Join my Server and i got this warn
@frigid ember does not exists in 1.15 I guess
I honestly had HashMap<UUID, PlayerData> before
why would it be in the bungeecord package
So you're saying i wouldn't need to make searches through the hashMap concurrent?
that's dumb
for some reason IChatBaseComponent.a("") is null
NMS Net Minecraft Server.
sure
Nobody Owes you Support bro.
mainComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
mainComponent.setColor(ChatColor.GREEN);
player.spigot().sendMessage(mainComponent);```
why would you create a component with NMS
You need it in a packet?
if there's an API
im not going to abandon my api and use protocollib now
Now everybody here needs to shut the fuck up and stop giving answers if they don't know the answers.
What is Your API?
it is kinda annoying when u guys ask why or say u don't need it
hashmaps are not guaranteed to be O(1) @gleaming helm Most of the time is indeed the case, however if you actually look at the implementation especially starting in Java8, after a certain threshold it becomes TreeMaps which is O(log n)
You. Don't. Need. NMS. To. Send. Chat. Components.
^
@keen compass it's log n worst case lol
holy shit chill
I need a chat component
O(1) average case
yeah frostalf , i think I should change anyway
Better than an O(n) search
using a set is just making things worse for me i think
And far good enough to call it "instant"
O(1) isn't average case, it is when a certain limit is hit because after there is so much data you can't remain in constant time for lookups
see now u just don't support and say " you don't need it"
I use this tbh
https://github.com/KyoriPowered/text
perfectly handles chat components
It
i wont add some random large massive chat api in ma api bro
Anyways, most of the time Hashmap is good enough. Very rarely do you actually need something better unless you really are just handling that much data
api now
thanks for effort tho
@keen compass when you say that the time complexity diverts from O(1) average case, how much data are we talking about?
@keen compass thank you, I'll change to ConcurrentHashMap asap
I don't think someone would ever have a table with more than 100'000 rows for my plugin
@gleaming helm you can't say I don't need it
I need it
How do I convert a string to a ichatbasecomponent
the static function named "a" returns null
I also checked it is nullable
@steady cedar its hard to say exactly at what number, there is a threshold starting with Java8 that the HashMap becomes a TreeMap. so if I had to guess it be somewhere in the millions.
Why would you want to use an iChatBaseComponent when you can just use TextComponent which is included in the fucking API for you
it is in NMS
and figure it out
Why would you use NMS when you can use the standard API
to do the exact same thing
it takes in an IChatBaseComponent
What are you sending NMS packets for?
Retrooper we don't provide NMS support here
Retrooper answer the Idriz question please
I am curious as to why you need NMS chat stuff
where
this is Spigot support, not Mojang obfuscated code support discord
only thing I can think of is if you wanted to manipulate the packet before the server gets it or after the server sends it
Man
He's a skid
Who doesn't know what he's doing
And comes here asking for support for plugins that he's skidded and is passing off as his own
That's what he does
ANSWER THIS QUESTION THEN WE CAN HELP: Why do you need a iChat component? What will be the usage
?xy
Precisely please
seems like an XY problem
i want to send an nms packet i said
Man
Asking about your attempted solution rather than your actual problem
a clientbound chat packet
the method named "a" returns null
and it also is annotated with the Nulalble
so I wanna know how
yes
Decomplie spigot is your best option
how do i debug plugins in eclipse
LOL
You can read messages from those blocked
i open all ur msgs
I don't know ErikDa, intellij team
just have to press the + icon
Who's going to tell him to fuck off
Yeah, I know, just kinda funny how he used it as an excuse to avoid answering my question
and now he suddenly listens to what I have to say š¤”
@frigid ember is there a specific reason you need to use packets to send chat messages to the client?
Dude if you can't properly explain why you want to send a chat packet, I'm going to tell you to just use the spigot API to accomplish the exact same task
Please answer here
these guys will say "He's a skidder"
Well, without knowing your reason I can't really help is all
all that crap
Man all your code is skidded from open source repos, you have no right to any closed source code
Would i declare the field as Map<> or ConcurrentHashMap<>?
Just like that
Map is fine
ty
Like that
@sturdy oar is it an API?
then use ConcurrentHashMap
What
??
??
declare it as map tho
Concurrent means it wil be modified by diff threads
if it was an API you default to lowest base and let others determine what they want
i'll check what cool methods it provides, and see if it's worth it
Are you retarded @keen compass
no i think he's right
deadass
i have so many blocke dit says so many blocked messages
Just use HashMap or ConcurrentHashMap if its not an API @sturdy oar
@keen compass why?
^
because if you back it by a Map, it will be slower
What
well it has a lot of other methods that I would be missing if i generalize with Map
You don't need to use them ^
why is kevin so toxic
consurrenthashmap is just for threads, i doubt it has anything new imo š¤
to send a packet
What?
and are not present in hashMap
Is casting an object heavy?
Then use a ConcurrentMap??
Not at all @undone narwhal
Cool, then put a Map
You can measure the time in microseconds
casting wrong is a bit heavier i think
And cast only if you need these methods
So just don't cast wrong?
exactly
Supposing you know what is what lol
it wasn't that funny
i haven't said i did
@sturdy oar the reason I say go with HashMap or ConcurrentHashMap if its not an API, is because only you are using therefore you don't need to worry about breaking the contract with the API if you later want to change it. With Map, you can turn that object into other maps without breaking the contract with the API and thus having to change your implementation to make it work.
Yeah I figured that out
What.
That must be one of the dumbest things I've ever read
With a map you can put(), you can get() you can contains(), you can clear(), you can do a bunch of things
But you don't really ever need to use the lower level methods
The map handles it for you
Is there any method you'd lose with using a Map instead of a HashMap that you do need @sturdy oar?
I'll put my money on no.
I've seen some on ConcurrentMap that I could use
so definetively using ConcurrentMap at least
Okay, use a ConcurrentMap then
It's actually
this has a name hold on
yeah it's part of the SOLID principles
Liskov Substitution Principle
But i mean ,i don't think there's an issue with using ConcurrentHashMap
i don't
your api would become obsolete
How are you so sure?
i don't plan to provide an API, or ever change that
Okay, somebody will have to maintain your legacy software at one point and wants to change it
š
better rewrite it lol
and even if i were to provide an API, i could just return a copy of that as a map
just like i did for iconomy
Just let the person make their program. Can't always worry about the future if it isn't certain. As the person explained they don't plan on making an API for it, therefore changes to the code even if its later on, isn't going to be harmful lol. And if someone else ends up maintaining it, then its that future persons problem XD
Yeah but this is what fucks over most people who have to maintain your legacy software
lol
Don't be a dick to them
also it's more about good practice, I guess
^
Nobody would be maintaining my resource except than me anyway
As long as it is well documented it really isn't an issue
since I use lombok and many don't like it
And you don't know that
If you think screwing future maintainers of your software is funny, you've clearly never worked on corporate software
You can put 20 javadocs above that ConcurrentHashMap
Except this isn't corporate software, more of a private project from the sounds of it
doesn't change the fact that if someone wants to change it they're gonna have to do extra work
And that makes your opinion about legacy software about 20x less valid
Also also the people who use your software will have to make assumptions
Except this isn't corporate software, more of a private project from the sounds of it
@keen compass Yes this code have been made only by me, i have no team working with me
Doesn't mean you won't in the future