#help-development
1 messages Ā· Page 369 of 1
you replace {MESSAGE} with message, replace it with "%2$s" instead
%2$sis the string format placeholder for the 2nd arg in the string passed through so would replace it with the message when ran, would stop the change to have messages doubled on some servers
format = format.replace("{MESSAGE}", "%2$s");
yeah
Same
this
any other chat plugins?
It has to have something to do with this method because if I disable it I can see name in chat
Negative
somethings like replacing it with air
Vault, luckperm, Papi, via
ive got no idea what would cause that to happen
something else is modifiying chat im guessing
I will attempt to find out
Luckperms might be
unless TEST is on the display name
luckperms doesnt touch chat
you got essentials chat?
As well as the tablistname
How, if not how would display the suffix and prefix?
No, that's what my plugin repalces
through its api
What api?
luckperms never has modified chat
luckperms api
I mean luckperms api modify the chat format
If not how does they displayed their format?
Doesnt make sense
straight from their discord
luckperms or its api does not modify chat on its own
something has to change it getting info from the api
Hmnn so how do they display their palceholders so?
So what could it be
who is they
you got essentials or something
im pretty sure they modify base chat for some reason
no, I listed the 4 plugins
Luckperms, how does they display the format for placeholders?
they store all the data in a database, you can request info about a player through their api prob
and it would call it from the db
No no
you dont udnerstand my point
Soem minutes please, i will finish coding and send you the message translated to english
somehow the message is being formatted elsewhere and you formatting breaks something
idk how that would work
Wait, Vault doesnt format the chat?
on its own no
How they work so??
how who work
If none of them (Vault nor Luckperms) modify the chat format, how luckperms format is displayed, doenst make sense...
its not luckperms format
...
he is setting the players display name
lol
Hee?
Thats not what he was asking
He was asking something related to chat format, didnt he?
context is important
^
the chat format is displaying the display name
"chat format is displaying the display name" no sense, not even translated
OHH bruh now i understand
base server doesnt format chat
I thought he was having issue with custom chat formatting, which was being overriden by anothe rplugin. I mean thats what i have readen
š¤¦āāļø
the format works in game but somehow wont show the display name in console
That looks cursed, xD
how so? It's native placeholder support and then papi addition onto it?
You're replacing on format, which you declared as a string literal of "%2$s". How can that ever replace anything.
It was changed to that for testing
And changed back
To an actual format string
What are you currently running?
I don;t see you fetching YOUR format from anywhere
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(AsyncPlayerChatEvent event) {
if (CHAT_ENABLED) {
String message = event.getMessage();
Player player = event.getPlayer();
event.setMessage(ChatColor.translateAlternateColorCodes('&', message));
String format = CHAT_FORMAT;
format = format.replace("{PREFIX}", getChat().getPlayerPrefix(player));
format = format.replace("{NAME}", player.getName());
format = format.replace("{SUFFIX}", getChat().getPlayerSuffix(player));
format = format.replace("{MESSAGE}", "%2$s");
format = colorize(translateHexColorCodes(this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, format) : format));
event.setFormat(format);
}
}
you are reading the default format from teh event
ah ok
Thje formatting works perfectly
The problem is the message in the console
That's ingame, good, amazing, beaituful, whatevber
And that's the console
yes
That's the issue
console only displays message
negative
It will display the name of the sender
And I had it working with this exact code to even display colors
only if yoru format contains a %s
the initial %s is the players name, the second %s2whatever is the message
you are removing the %s so console can only display the message
show your base format line
dafuq? if i set the format to be something like "server name >> %2$s" it would show in console
is that because i have the %2$s or something
CHAT_FORMAT: "{PREFIX} {NAME} {SUFFIX}&e&lĀ» &7{MESSAGE}"
yes, theres no %s in there
I believe console needs it
Ok lets run a test
its been many years since I wrote a chat plugin so I may be talking out my arse
one sec
https://github.com/mfnalex/BungeeCore/blob/master/BungeeCore-Spigot/src/main/java/com/jeff_media/bungeecore/spigot/listeners/ChatListener.java that would replace the message in game and in console
String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage());
PlayerConnection.this.server.console.sendMessage(message);
So the result from String#format is sent to the console sender as is, it seems like.
That line shouldn't be necessary
What version are you on?
Cause it will show duplicate
Cause by default all chat messages are sent to console anyways
That's an excerpt from craftbukkit
latest paper
See?
That's exactly what I'm doing
The only difference with alex's is how he gets the player nickname
I'm gonna have to laugh so hard if that's paper specific behavior, xD. Would be very, very weird tho.
It's not
Have you checked the source?
I'm telling you if I downgrade to a few versions before
It works
Perfectly
And that code hasn't been changed at all
My plugin version that is
you sure you've nto got your plugin jar in there twice?
If you downgrade the console shows the full message?
I just tested my old version
[11:18:45] [Async Chat Thread - #1/INFO]: [Not Secure] :dev: TSans_ test
nvm it did work before
:dev: is the correct prefix
Okay something definitly is wrongly coded
Also database, just contains 464 ms of time played for that player
in theory 1000 mili-seconds = 1 second, doesnt make sense tho
I will have to recheck whole code
So... what have you changed now?
Can i get an explantion of why getting that result?
We need to see some code for that
right
How are you tracking the players time?
1m im writting the math i follow
Pretty much nothing at all
The chat method has stayed the exact same
@lost matrix
I saving the players time into a mongo document as a long value, and once his join the proxy, the data is loaded into redis cache, this is dnne over Bungee
Also, when he left the server i update the cache with the differece of ms he played, and save it to redis cache, to finally save his cache into mongo document and get removed from redis cache
I'm loosing track of what doesn't work and what you're switching up, xDD. All I can tell from looking at the source is that paper handles chat packets completely different in comparison to spigot, which is why I can't really provide any further help on why that behaves as weirdly as it does for you.
The only problem here is that messages are sent to console incorrectly. That's it. This has worked on spigot and paper for a while now. Without an issue
I get what your issue is by now. But why don't you think that it's a paper issue when it doesn't work after upgrading? Seems like they changed their internal behavior. Kinda follows by logic.
What is your eviction policy for the redis cache? Or is it just a redis map?
Because it's worked before on paper and spigot
before is the keyword here.
Before as in 3 years ago and today?
This is from yesterday
less than 24 hours ago
Oh, that's what you mean by before, lol
As seen here
Have you printed out the final format, at the bottom of the event block?
I did at one point. let me do that again
I dont know what means eviction, but im using redis hset(namespace, cache key, cache value), where the key is the player uuid, and value is his data in json string
That is working perfect, also the mongo saving
It must be issue related to math on spigot side
I will send my bungee code, in case im missing something
[00:41:53 INFO]: [BetterPrefix] [STDOUT] §4ADMIN§r §4ADMIN§r TSans_ §r §e§l» §7%2$s
Ignore the double admin that's was my doing
Alright so not an RCache.
Then you should have some session scoped data:
long sessionStartTime;
long sessionEndTime;
long timePlayedTotal;
onJoin -> sessionStartTime = now
onQuit -> sessionEndTime = now
then
timePlayedTotal += sessionEndTime - sessionStartTime
I think its the same logic, but written different
Also the issue is not related to that tho
Is mainly in spigot side, where i have the actual logic
But i prefer to start from there, in case there is an issue there
???????????????????????????????????????????????????????????????????????
user.setPlayed(System.currentTimeMillis() + user.getPlayed());
???
Are you actually only using a single long for evaluating 3 time states?
Im just saving the ms difference
Isnt how most plugin do it?
I'm wondering what $s is all about. %2 refers to the second argument to String#format, which is the message (first is playername).
I added that to test too
It still wasn't working without
But now it suddenly
Worked?
i will open a thread its a mess this channel
This logic is flawed.
If a player has played for 1day in total but he only plays for 10s now then
he loses time...
No, because he can do it only once
[00:47:56 INFO]: [BetterPrefix] [STDOUT] &4ADMIN&rTSans_ &e&l>> &7This is the actual test
Ok I see what the issue is............
mthfker that's so dumb
Why is that a thing
Oh yeah smile, you are right, my logic is wrong written
Yes its still broken tho
Because let me explain how it works
So you found the issue? :-:
Lets make a thought experiment:
JOIN:
now = 100_000
played = 10_000
>> played = now + played
played = 110_000
LEAVE: (after 1000 time)
now = 101_000
played = 110_000
>> played = now - played
played = -9_000
???
[00:47:56 INFO]: [BetterPrefix] [STDOUT] &4ADMIN&rTSans_ &e&l>> &7This is the actual test
^^^ works
[00:41:53 INFO]: [BetterPrefix] [STDOUT] §4ADMIN§r §4ADMIN§r TSans_ §r §e§l» §7%2$s
You see?
For some reason § was never changed...
So I assume console just can't read that character
Let say, you invite to play on the network, so i join and if play for x time, i will receive some points and then that ability will get locked, because you can only get invited by 1 player
I will open a thread
its imposble LMAO, i cant concentrate on my issue seeing another guy spamming code haha
The console will happily render § as well as &, where § will be translated to color control sequences, while & will just end up "as is". I don't really think that this was the problem.
Timestamps related
Yeah, seems like it works pretty sporadically, xDD
Let's see if it stays fixed this time
And there you go
Jesus that was the dumbest error I've seen
Still not sure what the error was then
But so dumb
translateAlternateColorCodes is also just replacing & with §, xDD.
Don't think that this was the issue.
xd?
I mean all I changed was
format = colorize(translateHexColorCodes(this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, format) : format));
event.setFormat(format);
to
format = translateHexColorCodes(this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, format) : format);
event.setFormat(ChatColor.translateAlternateColorCodes('&', format));
That's litearlly it
so you removed your colorize method call
ah
yus
sup guys
Hi#
Why?
Hey guys, what you doing rn
Fighting with my serializer impl
trying to figure out how to setup a subdomain in azure
Yeah gl with that
Everything takes money with amazon
its azure not amazon
I meant
azure is microsoft
they are not the same
I'm interested into looking into making a plugin autoupdate
But I don't know how feasible this is because I don't see pretty much anyone doing it. Must be a reason for that
ok goog
i wont go bankrupt anytime soon
idk why it says 0 though, i thought it was 70dollars per month
they probably have a free limit
that is if its under a certain limit it doesn't charge you but starts doing so once its over the threshold
or you have a free trial period
I'm using azure student
ok, that is fine doesn't mean you don't have a free trial period
or they don't charge students instead the organization the student is part of
yo imagine they are charging my school
š
lets pray its not like that
Okay something weird is happen, post login debugg messages are not being displayed into proxy console
One of them is because your plugin should work with the backend online/offline, what happen if your site goes down well the plugin, it must continus working as it should
Whut
Worst idea ever
Auto update? Admins will hate you
Introduce one bug and get rekd
Auto update is nice for normal desktop apps but not for any server things
what do you mean autoupdate
like get latest update and download it?
i mean its probably possible
make it and let me know if it works š
cmi lib be like
fuck cmi lib
it auto updates and doesnt delete the old version
I already expressed my feelings about CMI in the 1 star review I gave it a few weeks ago
I usually do not give any <5 star ratings on spigot
but for CMI, I just had to
it's been 15 months now since my bug report that is still valid, without getting an answer from the dev
I got a few useless answers from their supporters
the colour picker is the only nice thing in it
the actually really only nice thing in CMI is their portal feature
lmao when googling one of my plugins, it starts off with a few pictures made by me, then a bunch of weird youtube videos (none of which I watched), then it starts to continue with a mixture of weird things, tattoos, and other videos about my plugin haha
Yeah that makes sense tbh
I love it when I spend my morning troubleshooting, looking in the main class and realizing I did not register the event listener
Can anyone help me? My axe is not getting lore.
https://justpaste.it/cr1ow
man my bad thank you
np
hi
does java have a queue data structure?
or can i just use an ArrayList as a queue?
if it has proper runtime complexities for the usual operations of a queue?
actually nevermind, i might not need random access, i could just use a linked list, nevermind.
ok i have another question though, how do i go about implementing a hashmap with two keys? like both key pairs have to match to get the value. Java stores things as references, and i am not really sure how to deal with that, unlike C++ where things are probably always going to be stored as values or memory pointers.
i was thinking of making two hashmaps to store the key pairs, like HashMap<key, HashMap<key, value>>(); but i was wondering if there is a more efficient way to do this in java.
storing two key pairs for a value.
or combining the two key pairs into one key of some sort.
to match values against.
auto update is fine if it only works if the admin approves it
e.g. a clickable message, like "Yo, admin, wanna update?"
then it's fine
and in that case, you can use CraftBukkit's auto update feature
This guide explains how to install most basic plugins on your server. You must already have a running CraftBukkit server set up and have knowledge of how to use the Minecraft server console. If you do not have a server set up please go to Setting up a server and follow the instructions there. This guide does not cover setting up an SQL database ...
note: the wiki is wrong. the "update" folder must be in plugins/update/ and NOT in plugins/<yourplugin>/update
Hmmm
oh actually the wiki is right, I was just too stupid to read it properly
I still see practically no one doing this
Even with a "wanna update?"
They just say, "go update, idiot"
well I would be glad if a plugin would have this
if a plugin would mock me to update, I would do. And it would be handy to be able to do it with one click
however, it could never work for paid plugins
if (std::shared_ptr<int> spt = gw.lock())
hey guys
can you do smth like this in java
exactly
apart from instanceof clause
I'm surprised no one has made a library or addition
To stop leaks
Like a normal cpp licensing system
can you add variable declarations inside if statement in java?
erm sure?
ik you can cast with instanceof and create a variable since jdk 16 iirc
i wonder if you can declare custom ones yourself
like
if (Player player = event.getPlayer(); player.getUniqueId() == this.id) {
player.sendMessage("Hey!");
}
can you do smth like this
by attaching the variable to that if block only
in java
in cpp its legal
but idk if its legal in java too
no, but why would you
that will not work
if(...) expects an expression
that evaluates to true or false
that way you're releasing stack objects quicker
if you dont need that object besides in that if statement
i mean that would work only for primitives for java but still
seems neat feature to have tbh
TL;DR: No, this doesn't work in java
š¦
just don't worry about it
String test = "asd";
if (test.equalsIgnoreCase("asdasdasdasdasd")) {
player.sendMessage("Hey!");
}
// If you stop using "test" now, your "test" variable will automatically be garbage collected.
this is how it works in java
closest thing that exists to this is
if (player instanceof Player player) {
player.sendMessage("Hey!");
}
i guess
jdk 16
no I get what you mean
I was confused because you said "releasing stack objects quicker"
well it releases stack primitives faster tho, since it goes out of scope quicker
but yea
its just cleaner to look
in some ways
yeah, maybe it WOULD
but a reference is only a mere 8 bytes or so
(on 64 bit)
why would you worry about it
the beautilfuleness of java is that you do not have to worry about this. no offense, but the compiler and the JVM are usually much smarter than you
they know exactly when they can dispose stuff
once a reference is unreachable, it'll get flagged for future GC
(you could manually trigger GC, but that's usually considered a bad choice, because... it's not up to you to clear up garbage - you are the owner of the house, not the house's cleaning lady in java)
is there any specific reason why you worry? if so, please explain it
I am assigning a namespacedkey to an itemstack on a give command. I am later checking for that key in an eventlidtener. Does it need to be the exact same key object or can I initiate a new one with the same name?
You can init new object with same name, but you can also just keep static reference
As you don't really need to create new object every time
But it will work eather way
Thanks
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
The maven warehouse does not exist, how to solve it?
with "warehouse", you mean "dependency" right?
- did you even define any property called "spigot.version"?
?paste your pom.xml
(just copy/paste your whole pom.xml into that, then click on the "save" button in the upper right corner, then send the URL)
run buildtools with the "--remapped" flag
example:
java -jar BuildTools.jar --rev 1.19.3 --remapped```
ok, thank you
if you still got any troubles, feel free to ping me
ok
Ive got a question, how do i add xyz to playe.getLocation?
what i want to do:
world.strikeLightning(loc //+ 1x, 0y, 0z)
jesus alex is in a good mood today
You want to spawn the lightning relative to the player but slightly changed?
yes!
player#getLocation#getX
player#getLocation#getY
player#getLocation#getZ
And you can just do player#getLocation#getX + 1
Does that answer your question @tawny remnant ?
Isnt there some method like #add or smth on location
halfway
If you need to store the location
But he just wants to spawn a lightning
Don't need to keep it
That simulates +overload
?
strike(player.getLocation().add(1,0,0))
reverse engineering?
How to get playerHead with Base64 textures without using GameProfile?
Excuse me bro, the buildtools.jar work is done, what do i need to do next?
gradle or maven api dependency
or mineskin api
with https requests
MineSkin.org allows you to generate skin texture data for Minecraft which is signed by Mojang.
but this would only work with premium accounts
if that's doable for you can also fetch it from mojang restful auth api
if you need functionality of custom textures, you need to use GameProfile option or use a wrapper that wraps the internal stuff for you
What's the issue with Profile?
I'm doing custom heads like that. Is there a issue with doing it that way?
nvm my bad, i've thought you only need to retrieve base64 texture value
you cant use https based api in that case
as @frank kettle said, what's wrong with using GameProfile in that case?
You could access the texture using the PlayerProfile as well if you don't want to access NMS in this case depending on which version you are on (1.18+)
I dont think you can acces it with SpigotAPI
You can
I'm doing it on 1.19.2 without any nms or different apis
Guys help me pls
Why BungeeCord (Infdev 20100618 port) gives me id error when i m trying to connect to the server?
BungeeCord
https://github.com/DOh1221/BungeeCord-Infdev/
Error
https://paste.md-5.net/jarayeviji.makefile
I'm on 1.19.2 and I cant
It's just Profile
PlayerProfile this class is basically a wrapper for the GameProfile
ah, ok, thx
I can check my code in few minutes when I'm on the computer
But there's surely a way.
The texture is encoded in an url though so you would need to extract it from there if required
The url should look something like this: http://textures.minecraft.net/texture/<texture here> if you call #toString() on it
sorry I do not really recall - what's the problem?
yeah but
what exactly is the problem?
any error messages?
if yes, please send a screenshot of the error message
the buildtools.jar work is done, what do i need to do next?
? no?
I guess it needs to import local dependencies
Try updating / reloading the project
click this button in INtelliJ
the "maven reload" button
still any errors? If so please, tell us the error you are getting
the maven tab is usually in the upper right corner
?
I mean, BuildTools.jar he gave me a jar
spigot-1.19.2.jar
Don't need to import this jar locally?
That's not the remapped jar
buildtools automatically installs all the dependencies into your local repository
if you ran buildtools with the "--remapped" flag, you normally just have to reload your project (see screenshot above)
no need to copy any files
so PlayerProfile is the same as GameProfile?
I understand.
I have no problem. go get busy
More or less
so can I create a playerhead with custom texture using PlayerProfile?
Yes
PlayerProfile is spigot's wrapper for GameProfile
so yeah, its the same, but it isnt
Is there any way to make lightning not make fire?
how? š
Well that is way faster than explaining it here
thanks you
x)
saving your blog then
np
this your blog?
very good
I'm currently trying to add a new Event to spigot (to contribute it, see here https://hub.spigotmc.org/jira/browse/SPIGOT-7261)
For that I need to modify nms classes however I still don't fully understand how I am supposed to do that.
For example since 1.17 I think it was the nms package structure is retained on runtime so do I need to do that as well when contributing to nms or simply follow the instructions provided on the CraftBukkit stash README
have you read this?
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
the second link
scroll waaay to the bottom
second link, second bottom most headline
No I haven't seen this one yet, the other urls I already saw
the "usual" work flow is like this:
I mean I currently have a net.minecraft.server package in my project however it doesn't yet contain all files only already modified ones
-
clone bukkit
-
apply your changes
-
commit/push your changes to bukkit
-
clone craftbukkit
4a. run this weird "applyPatches.sh" thing -
implement your bukkit changes
5a. run "createPatches.sh" -
commit/push your changes to craftbukkit
oh wait
I just see, you only submitted a "feature request" yet, right?
Yeah that's more or less it
I've a way to implement it so I wanted to try it out
If it even makes sense
I doubt that it'll get approved. and even if you or someone else would create a custom event for it - you'd have to implement it for EVERY vanilla strucuture, otherwise this event would be pointless
I also forked the repositories and got stash access as well
Your Commissions: 105⬠/ hour + VAT
Means: answer plugin question?
so yeah my opinion is: your feature request will be kept open for years, without anybody implementing it. unless you do it yourself, but then you gotta take ANY vanilla structure into account, then it might get merged
Well it would be implemented in the chunk generator itself so I think it will work
That's what I'm trying to do x)
however
hmm well if you implement this event for EVERY structure... why not
sounds like a nice addition
Yeah exactly, that's also the point of the Event
I'm 100% in favor of this addition
<3
just added a comment to that request - if you could make it possible to maybe even change the location, this could be very useful to destroy those usual "structure finder" hacks
e.g. where people can look for 3 to 4 buried chests, and then they can derive where e.g. desert temples are
how do i do the player.getRightClicked? Its not working for me
@EventHandler()
public void PlayerInteractEvent(PlayerInteractEvent event, PlayerInteractEntityEvent entityEvent) throws InterruptedException {
Player player = event.getPlayer();
Player clicked = (Player) player.getRightClicked;
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
also your code obviously throws a syntrax error because "getRightClicked" is not a field, but a method
...
fixed it already
@EventHandler()
public void PlayerInteractEvent(PlayerInteractEvent event, PlayerInteractEntityEvent entityEvent) throws InterruptedException {
Player player = event.getPlayer();
Player clicked = (Player) entityEvent.getRightClicked();
yeah you added () and that fixed it, right?
two things I wanna tell you:
- PLease use code tags
Then your code doesn't look like this:
myCode() {
but it'll isntead look like this:
myCode() {
second: check out the following links. It's not being unfriendly, but trust me - checking out "basic java tutorials" will help you be able to code spigot plugins much faster
?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.
I personally can recommend the third link ^
So after asking this question on the Forums (here: https://www.spigotmc.org/threads/no-sound-when-using-entities-as-sound-source.591444/#post-4547211) i wanted to know whether someone here knows how the playsound method works:
Whenever i call
Player.playSound(entity, sound, volume, pitch)
there is no sound being played on the client (1.19.3). It doesn't matter if the entity is the player himself or another entity. Only if switched out to
Player.playSound(entity.getLocation(), sound, volume, pitch)
there is a sound.
I'm unsure if that is possible with my implementation
my function is not getting called
heyyy
is getNearbyEntities() method still considered unoptimized?
i dont know why but when i put this it makes an error
does any1 know why i get this error when compiling
while my ide is not complaining
shoulnt this just work fine?
I'd use file:// repos just to be sure, but it should work I guess
did u reload ur maven
i sure did
Is there any other error?
no, only that when i try to compile
oops wrong reply
how does that work
wait isnt that import different? one says com.bedwars and one com.andrei1058.bedwars
can anyone help me? my function is not getting called.
https://justpaste.it/bc37r
we use ?paste here
does that matter on system dependencies ?
im not sure actually
it does not.
its just so weird. idk how to fix it
Give the full maven log
i also tried invalidating caches as that sometimes fixes it
can someone help me with this?
<repositories>
<repository>
<url>file://${project.basedir}/deps</url>
<id>local-potemkin-repository</id>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>empty</groupId>
<artifactId>modlauncher</artifactId>
<version>999.0.0</version>
</dependency>
</dependencies>
ok let me try that
oops, it should be "file://", not "file:(("
The layout within your deps folder would then looks somewhat like that:
.
āāā empty // {group}
āāā log4j // {artifact}
āĀ Ā āāā 999.0.0 // {version}
āĀ Ā āāā log4j-999.0.0.jar // {artifact}-{version}.{type}
āĀ Ā āāā log4j-999.0.0.pom
āāā modlauncher
āāā 999.0.0
āāā modlauncher-999.0.0.jar
āāā modlauncher-999.0.0.pom
the .pom files are not required per-se but can be useful from time to time
(however the folder can be named in any shape or form - it needn't necessarily be "deps" - can also be "libs" or whatever)
tried this
You must also add the version thingy
o u also add the version as folder?
ArtifactId is the file Name?
basically the path is "{group}/{artifact}/{version}/{artifact}-{version}.{type}"
nah, it's the artifactId as declared in the pom
Same goes for {group}. And in 90% of cases {type} will be "jar"
<dependency>
<groupId>empty</groupId>
<artifactId>bedwars</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
got this rn
but that doesnt do it yet
The file name must follow "{artifact}-{version}.{type}", so bedwars-1.0.0.jar in your case
(also make sure to declare it as provided unless you want to shade the dependency in)
what return get()
still got the same compiler error tho :/
people expect to buy a plugn for 4⬠and then expect me to invest my lifetime to add their "special feature" that NOBODY else cares about
Okay... Could be down to the IDE using a different compiler or a different classpath
Whatever the cause it is a bit hard to figure out I guess
Could you show the whole build log?
I mean, what do these people expect
ah wait heres a bit more of an error message
[ERROR] bad class file: C:\Users\Bertg\.m2\repository\empty\bedwars\1.0.0\bedwars-1.0.0.jar(com/andrei1058/bedwars/api/events/player/PlayerItemMoveEvent.class)
[ERROR] class file has wrong version 55.0, should be 52.0
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.```
yeah, you're compiling with the wrong java version
Try compiling with a JDK 17 or whatever class file version 55 is
I'm totally cool in adding new features - but when someone says "ugh I just paid 15⬠(which is like 10 minutes of my work)" now says "I WANT!!!! you to add this: XYZ" then wtf
And that's one of the reasons I'm not touching minecraft in a high capacity
Although from my experience people are rather understanding when it comes to me not implementing stuff (in fact I very rarely get feature requests)
Hi, guys, quick question for you. Is it possible to edit nickname above head without using any API or NMS? I heard about PlayerProfile in Spigot, i tried that, it seems not to work for me. Any ideas?
We get this question sooo often... Answer is: NO.
Why is there no API for this yet?
what's your "usual" job if I may ask? just curious
It's awesome thing to do in your server, but most people don't want to touch NMS
@quiet ice its compiled with java 11
no. this gets asked every day, someone should PR it
I dont even know if there's an open feature request for it eixsts
I just found out that there is a typo in the package name org.bukkit.craftbukkit.generator.strucutre - is that something that should be fixed or just doesn't matter now that its in there for some time?
where is the typo?
or
Isn't it structure instead of strucutre
yeah its in the code
you got a javdocs link?
NMS
didn't rename it
?paste
Modding galimulator, though mostly focusing on the backend side of things so I'm just spending my time reinventing the wheel and writing APIs noone will have a use for
for the bukkit api it isn't the case though, only in craftbukkit
I know that you do this ASM stuff, but didnt know that you actually make money with that . nice!
my action isnt getting called what do i do
IS THERE NO PR TO FIX THAT NAME?!
NOT EVEN A JIRA ISSUE?!
I don't think so, guess nobody noticed
damn damn
Nah I don't make money with it yet (I don't get money at all), but chances are that it may make me money in the future thanks to it meaning that I have very close ties to the game's developer
I didn't notice as well until I was writing the whole package name in class for an import and eclipse was like: 'No this class doesn't exist, try spelling structure wrong'
internal names are so important 
open an issue on jira please
that is
erm
Is it actually worth to touch NMS, when we have such a beautiful thing as Spigot?
"peinlich" as we call it in german
exactly xD
yeah I will
The package exists for a good half year now... I guess it is still possible to change it
Bug ticket?
reflection will be a dick
just a tiny classloader hack
You would need to intercept any Class#forName calls and such
no problem
Which just means Mass ASM
we already do that
Yeah, commodore through the bukkit Unsafe
huh, thought it was a simple remapper and that only paper did the more complicated stuff
- we should get it fixed
- for "older" plugins, still no problem
every spigot plugin has its own class loader
that is right but a classloader on it's own isn't needed
commodore for a random typo in a non important package name seems bleh
In fact, you could only use javaagents for that.
Yeah it's not public API anyways
Hi, I am currently generating a custom block and I have a problem when I break a block below my custom block it refreshes and the note block texture appears. How can I prevent this from happening, thanks in advance and have a nice day.
why is this not getting called
did you register the listener?
i dont think so cause i dont know how
uh, yeah then that is your issue.
But I don't remember the code on how to register events, should be in the PluginManager class - look it up yourself
its in my main class
?jd I meant that PluginManager class
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
default linked list is linked both ways
that being said a list implementing java.util.RandomAccess is usually more performant than a linked list
i select my collections with this lol
why do we listen to you again?
where do you get all this esoteric stuff from anyways
are you one of those people that just remember random stuff for no reason?
I mean concurrency is stuff you should have heard
ConcurrentHashMap allows to iterate over it while you remove or add objects for example - really useful if you just want to be dumb and not care about performance
tbf i usually dont have to worry about concurrency in my stuff
Queues are useful for writing Stack machines or well ... queues, alongside other things
HashMap for example does not support
for (Map.Entry e : map.entrySet()) {
map.remove(e.getKey());
}
ConcurrentHashMap does. Same goes for ArrayList vs CopyOnWriteArrayList (I and many other just call it COWArrayList)
iirc that throws a concurrentmodificationexception right?
Yep, but not for concurrent collections
Anyone know how i can keep applying effect to a Player that is wearing a certain helmet? Ive got the itemstack ready.
ConcurrentHashMap is really useful
but i love IdentityHashmap even more
although its not advised to be used š¦
but its in theory faster than hashmap, since it compares values by their memory locations instead of compare method
create scheduler that applies the effect when helmet is equipped. It checks if the helmet is still equipped, removes itself if it is not, and applies the effect otherwise
also create scheduler on login and plugin load
Why does hashmap compare values?
to hash values and compute indexes
no, it uses mathematical equation to determine the index in the internal array
if you specify the same object the same index would be calculated
what
doesnt hashmap support duplicates?
I heard first time about ConcurrentHashMap and that type of list
yea it does
a duplicate key gets overriden
Ya. I looked it up i see.
what are you on about
does it not
do you mean hashset maybe
Not for keys.
and as I see it seems super useful. Why I have gone on the hard way of doing these type of things xD
ah
it does, that's why Buckets exist to store multiple values in the same index
A hashset uses a hashmap internally if I remember correctly
hashmap does not guarantee O(1) time complexity every time, since hash collisions could occur (two different objects get the same index)
Yes
The average is O(1)
you shouldnt use hashmaps
they could be slower actually
than just iterating couple of indexes linearly
hashmaps are fine
if you have a lots of objects (lets say a player object hashmap), its ok, but if you store something that's really not big, its not worth it
Hashmap supports key value pairs
if you want to "map" a value to another value
generally just use a Hashmap'uh
yeah so why are you saying we shoulnt be using them lol
what else would people use hashmaps for
Youād be surprised
there are situations where you wouldnt need to use it, lets say you store 10 entries of data and want to find something from that object
comparing the objects with hashmap would be slower than iterating it one by one in that case, since amount of objects is small
so how ould you store that if not in a map
but then you cant map values
well nvm
but if you have an option not to map it and the data set is small dont
I see what you mean now
are you saying that if you wanna get a mapped entry from a small map you might as well iterate through it instead of using .get()?
like obv dont use a map if you dont have to map any values
public V get(Object key) {
Node<K,V> e;
return (e = getNode(hash(key), key)) == null ? null : e.value;
}
final Node<K,V> getNode(int hash, Object key) {
Node<K,V>[] tab; Node<K,V> first, e; int n; K k;
if ((tab = table) != null && (n = tab.length) > 0 &&
(first = tab[(n - 1) & hash]) != null) {
if (first.hash == hash && // always check first node
((k = first.key) == key || (key != null && key.equals(k))))
return first;
if ((e = first.next) != null) {
if (first instanceof TreeNode)
return ((TreeNode<K,V>)first).getTreeNode(hash, key);
do {
if (e.hash == hash &&
((k = e.key) == key || (key != null && key.equals(k))))
return e;
} while ((e = e.next) != null);
}
}
return null;
}
that would be pointless I feel, if I was making such a structure and I knew smaller maps would be slower than iteration I would build iteration into the map structure for smaller data sets
in terms, this is what get called when you use map.get()
its a big ass algorithm right?
what about if you can skip that, just by iterating 10 entries each by each by using list
so how does the code iterate over a hasmap
hashmaps take more space on memory and inefficient for small data
but for moderate data amounts its faster
Microoptimizing Java lesgo
1000 checks < vs one hashing function and couple iterations internally
so you'd basically have to do some benchmarking to figure out at which point in map size it's more efficient to iterate than the typical method
but why does the hasmap itself just not switch to iteration if the data is small enough
that sounds like a design flaw
because that map is not a list
data is not stored linearly
its scattered due to hashing
you'd have to iterate all of the indexes available in the internal array to find values
If you are that concerned about few nanoseconds use cpp or rust at that point
Looking to hire an experienced enough plugin dev to teach others from the ground up, message me for more info!
for plugins
good joke
yeah i was about to say the difference in performance is negligible lol
it depends on the context
well it depends on what data you use, sometimes it could have a big impact
when will recruiters learn its best to just say what you want instead of doing this whole "message me" schtick
Hi, I have a question, is it possible to make a plugin that, after the player performs an action, I will enter the command for him using his nickname
sure
I just default to using whatever structure works best for the readability and logic of the code, and then trust that the implementation works with me
sounds simple
There are times where using HashMap can be a serious performance detriment simply due to GC overhead
its ok, i dont say its wrong, im just saying there are situations when the performance of the specific operation is crucial (99% of time it doesnt matter)
In that case you'd want to use Int2ObjectMap or similar.
It only really gets funky once you want concurrency.
Not always
Isn't there Collections.synchronizedMap which could do the job
For claim protection plugins concurrency is useful to some degree
It's a scam.
It is?
Yes.
Well then manual lock work I guess
Yeah, but CHM is faster there - but GC overhead strikes again
So in one of my plugins I wrote my own concurrency map algorithm that is like 20 times faster than CHM (10638525.246 ± 72978.176 ops/s vs 226600144.895 ± 5339520.216 ops/s)
so, just pr it into java then
It was a very specialised algorithm, outside of minecraft it has little use
Hey, is there a way to open a book to a player without using NMS but ProtocoLib ? I can't find out how to do it
yeah makes sense
It basically allows to store an object at a 2D coordinate value. Memory would explode if you store values at coordinates that aren't close to each other
declaration: package: org.bukkit.entity, interface: Player
I'll take a look thanks
I hope that's what you meant, should be quite compatible too, as I think it has been there for ages.
I just want to open a book to a player like he did a right click on a written book that's it
Yeah, that's it then
Ok thanks, i'll try when I can
try (!(utils.blockDrops.get(uuid))); instead of just !utils
im trying to get skin from a uuid gotten using the URL request on mojang's api
but the uuid is returning differently without the "-"
is there a way to fix this?
just use UUID.fromString method
well
then u didnt see the image
im using that
the uuid is null if the UUID has no "-" in it it seems
call me an idiot but isnt the - part of the uuid
public String getSkinURL(String uuid) {
String uuidWithDashes = uuid.substring(0, 8) + "-" + uuid.substring(8, 12) + "-" + uuid.substring(12, 16) + "-" + uuid.substring(16, 20) + "-" + uuid.substring(20);
try {
URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuidWithDashes);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String response = reader.readLine();
reader.close();
JSONParser parser = new JSONParser();
JSONObject jsonObject = (JSONObject) parser.parse(response);
JSONArray propertiesArray = (JSONArray) jsonObject.get("properties");
JSONObject propertiesObject = (JSONObject) propertiesArray.get(0);
String skinURL = (String) propertiesObject.get("value");
return skinURL;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
found this online if it helps
so the dashes are always in the same places?
seems so
8-4-4-4-12
Its a special representation of uuids. They are always in the same location.#
^
just the 2nd line, everything else is useless for me
ty
String uuidWithDashes = uuid.substring(0, 8) + "-" + uuid.substring(8, 12) + "-" + uuid.substring(12, 16) + "-" + uuid.substring(16, 20) + "-" + uuid.substring(20);
ItemStack bookItem = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) bookItem.getItemMeta();
bookMeta.setTitle("§cGrade Custom");
bookMeta.setAuthor("Antasia Network");
bookMeta.addPage("§fBravo ! Si tu lis ce message, tu peux maintenant obtenir un grade §ac§bu§cs§dt§eo§3m §fpendant §e30 Jours §f!\n" +
"§fPour choisir ton grade customisé, il te faut cliquer sur le bouton juste en dessous de ce message et écrire dans le chat le grade " +
"§fque tu souhaite.\n\n" + mainComponent + "\n\n" + component);
bookItem.setItemMeta(bookMeta);
player.openBook(bookItem);
So I tried but got an error, above their is my code but I got this error :
java.lang.IllegalArgumentException: Book must be Material.WRITTEN_BOOK
Make sure you actually compiled this and replaced your old plugin
If it still happens pls show the whole stack trace
Ok, I'm sure it's compiled but i'll try
and if the whole stack trace is too big for discord with what can I send it ?
Heya, how can I save a players uuid and a score to yaml, Iām quite new to Java and am not sure how I would go about doing this.
?paste
Ok thanks
?config
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
java.lang.IllegalArgumentException: Book must be Material.WRITTEN_BOOK
Yes, it is a written_book
I sent my code here
true
I just finished implementing the event and as of now you aren't able to modify the location of a structure however you would be able to cancel its' generation.
Lets see if it will be merged or not or if I need to do changes x)
Show the code around PlayerJoin.java line 112 and make sure its line 112
Try opening an empty book without changing the meta first
Ok
like just doing
ItemStack bookItem = new ItemStack(Material.WRITTEN_BOOK);
player.openBook(bookItem);```
?
@EventHandler
public void onJoin(PlayerJoinEvent event) {
ItemStack bookItem = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) bookItem.getItemMeta();
bookMeta.setTitle("§cGrade Custom");
bookMeta.setAuthor("Antasia Network");
bookMeta.addPage("§fBravo !");
bookItem.setItemMeta(bookMeta);
Bukkit.getScheduler().runTaskLater(this, () -> {
event.getPlayer().openBook(bookItem);
}, 20);
}
Works for me no problem
š„²
Update your server
It is updated
Can someone help me fix this? Whenever the correct ingredients are in the "ingredient" and "fuel" slot, no output items are produced and the "No recipe found for ingredients: X, X" is produced in console, which means that the "outputs" List is null. Why is it null?
Is this plugin related? We need more context.
š
just throw a hashmap at it
looks like me when using nano
apparently for some reason std::string with shared_ptr arent very good friends
Word after inserting an image
:(
why is this using sessionserver btw?
im using api.mojang
is there a different?
it uses rest api provided by mojang
from the website
to gather data
basically it asks data from mojang servers directly from the web
api.mojang does the same
but in the encapsulated form
if we're talking about premium accounts
its just a way to get data without relying on minecraft's codebase much
cause im getting error cause of "too many requests" on api.mojang
and wanted to know if there was a different way to do such thing without those limitations
there's a request threshold
requests are rated by mojang servers in order to prevent Ddos attacks
was just curious, there's always work arounds such things.
there's no workaround apart from caching the data locally
Can i somehow make lightning not set things on fire?
after retrieving it
is there a prefered option or both work the same way?
you cant bypass rate limit of mojang web api
well, im doing this everytime i do the comamnd, what i can do is make server update it on its own every X minutes and not on players requests. and then manage this myself so it doesnt reach the limit and updates correctly.
unless your dad is bill gates lol
just asking if api.mojang or sessionserver.mojang have different limitations
if both are the same then i will just use api.mojang
@frank kettle https://wiki.vg/Mojang_API
here's a good topic for you to read
all public apis are rated
as this website tells
this isn't why the rate limit exists
i checked it for the "username to uuid" thing
yea but one of the reasons is
the rate limit exists to evenly spread out the bandwidth usage, basically it doesn't allow one server to consume more and prevent others from being able to access
also it says there sessionserver is red(service unavailable)
you can just lag the shit out of those servers
but the other dude sent code using it, so was wondering
that is false
you obviously have no clue how switches work, the rate limit is there for QoS, not anti-ddos nor would it stop one
it doesn't allow one server to consume more that is what i initially meant.
yes what I meant by that is for the servers that behave
it spreads out the bandwidth to more behaving servers
if servers would send a lot of requests it would be too hard access that api without any interruptions
the bad servers are going to ignore the rate limit and shove packets its way regardless
tru
You can't stop ddos with rate limit
Omg
I like discord not scrolling
Nvm
discord scrolling on linux is awful
I don't see any issues with it
you can fix this with an argument to enable experimental gpu acceleration
But I am also using discord within firefox, so that could cause it
Basically the issue in the video is Discord is failing to hook up to the GPU for hardware acceleration.
Here is what you put in terminal for discord to actually hook up to your GPU and run properly: discord --enable-gpu-rasterization
havent found it yet
but ye i stopped dualbooting cuz windows found it funny to erase my linux os
oh is it that simple
Windows periodically does that if they are on the same drive it's weird and dumb
Going through some of my test code I made a few months ago and tried to implement sql databases. I have found that runTaskAsynchronously is depreciated. Is there a way to do the same thing as it seems to stop the plugin from being activated
?scheduling
or just read the javadocs
it shouldnt stop the plugin from being activated unless youre using a newer server version
the dude who spammed ultfoods?
Just got three 5 stars from brand new accounts
Yeah I'm looking at ult foods