#development
1 messages ยท Page 120 of 1
ah well, you might want to share some code then
sheep class and what uses it: https://paste.helpch.at/dorehemaqa.java
that shouldn't even compile? what version is that?
1.8
oh wait, I forgot to accidentally deleted the Player p as a parameter to the constructor, ignore that
๐ yeah idk about 1.8
I'd say check how CraftWorld.spawnEntity does it but nowadays it's just creating it and adding it to the world
but that uses a EntityType enum
right?
Any ideas why I might be getting this error? Maybe I am just stupid, kinda almost 2am so, sorry if I am just dumb.
Currently getting this warning: https://paste.helpch.at/iwecazuxid.md
It happens when the api.getTotalOf(category, UUID.fromString(player), null); which is from Statz returns null, but the confusing part is, I am already checking if it isn't null? Am I checking it the wrong way?
var listOfPlayers = db.getStringList("players");
for (String player : listOfPlayers) {
var stat = api.getTotalOf(category, UUID.fromString(player), null);
if (stat != null) {
dataOfPlayers.put(UUID.fromString(player), (int) Math.round(stat));
}
}```
Caused by: java.lang.NullPointerException: Cannot invoke "me.staartvin.statz.datamanager.player.PlayerInfo.getDataOfPlayerStat(me.staartvin.statz.datamanager.player.PlayerStat)" because "info" is null
clearly something is null
in this case: info variable
I didn't declare thar variable, it's from Statz.
The thing I am confused with is that I am already checking if it's null or not?
legit so confused, will probably just go sleep lol
Does anyone know what this is? How would I decode it into plain-text? (if possible)
where do you get that from?
ExcellentCrates stores items like that
right, it is probably a base64 string
That's what I thought too, but this doesn't look right to me
that's fucking cursed
Do you know why that decoder isn't working correctly?
Is there a way to see when spigot calls certain classes/events (in intellij)?
the find usages thing doesn't show it :((
probably because it is an object and can't decode it to plain text
it's the NBT you're looking at
Oh
it will work if you are including the sources jar
ohh
im just doing spigot dependency
paperweight-userdev relieved
is it complicated
not in the slightest

Aka ugly git
uh
it's very easy, you just need to add the repo in the settings.gradle, the plugin in the build.gradle and add the paperDevBundle https://github.com/PaperMC/paperweight-test-plugin
does it support 1.17?
it's 1.17+ yes
mojang mappings
oh
but it produces two jars when you build it with reobfJar
but then wouldn't it give errors if i use it in my code?
ah
like gradlew shadowJar reobfJar?
just reobfJar
it produces a "dev" jar which is mojmapped and a "normal" jar which is sp*got mapped
(re-obfuscated)
sp*got
๐ฅฒ
spoogot
btw in gradle kts, how do I assign a task to a variable?
i've seen it before but i forget :((
so for ex instead of finalizedBy(tasks.getByName("taskName")) it'd be finalizedBy(taskName)
Gotta censor it, it's bad to swear in here
tasks {
val mySuperCoolTask by registering(TaskType::class) {
// stuff
}
}
ah mb ๐
ty :DD
edited
what about existing tasks?
tasks.blah?
or tasks.named<TaskType>("blah")
ty it all works :))
What does no damage ticks time mean
I have a bug on my current spigot, and i don't bother fixing it AT ALL cuz i cba
is this correct
if (((Player) e.getEntity()).getLastDamage() < 500) e.setCancelled(true);
or is it 20
fuck nvm
it will always be cancelled as damage is unlikely to ever go that high
Anyone has any ideas for this? I quite confused with the issue lol
You are checking whether its null or not...but the null part happens in the API call
at Statz-1.6.2.jar//me.staartvin.statz.api.API.getTotalOf(API.java:42)
well what can I do if that's from the api itself?
i love how the javadoc link is dead
i would guess its a problem with statz, not you
ask for support on the statz discord.
probably your best bet.
are you checking if the player data is even loaded?
might be irrevant, probably actually idk
You should probably attempt to cast it to PlayerInfo since thats what that variable returns if its not null.
Simple...alert them
they haven't updated the plugin for over a year lol
Apparently the playerInfo is getting null...
you dont /reload
max you should do is plugmans reload but still then since your using an external api just restart when you make changes
No plugman
im saying if your gunna do it use plugman to reload your plugin, but you should just restart
better off
tho ive found alot of database performance issues w8th sqlite when i reloaded and figure out why so its a aid and a curse at the same time
Hi, so I've made a spring boot application but I've a little problem, the application when runned on intellij works perfectly but when compiled (using gradle + shadowjar) it prints me some error and don't recognize the application.properties https://www.toptal.com/developers/hastebin/ejelagemaz.yaml
Hey guys.
I have a problem with my placeholder
sec
oh
I found it
It dont request the placeholder again
But how do I request a placeholder if I use it in a itemlore
an item you're making in your plugin @tiny tulip ?
yeah
You'll have to have something updating it every second/tick/whatever
for debugging stuff I used this to update the boots
ItemStack itemStack = boots.getItem(); ItemMeta itemMeta = itemStack.getItemMeta(); List<String> loreList = itemMeta.getLore(); for (int i = 0; i < loreList.size(); i++) { loreList.set(i, PlaceholderAPI.setPlaceholders(player, loreList.get(i))); Bukkit.broadcastMessage("Replaced: " + loreList.get(i)); } itemMeta.setLore(loreList); itemStack.setItemMeta(itemMeta); NBTItem placeholderBoots = new NBTItem(itemStack); player.getInventory().setBoots(placeholderBoots.getItem());
?codeblocks
Use codeblocks for formatting code or configuration files:
```<language name>
<your code here>
```
For example:
```yaml
test:
- โhiโ
- โthereโ
```
Produces:
test:
- โhiโ
- โthereโ```
ItemStack itemStack = boots.getItem();
ItemMeta itemMeta = itemStack.getItemMeta();
List<String> loreList = itemMeta.getLore();
for (int i = 0; i < loreList.size(); i++) {
loreList.set(i, PlaceholderAPI.setPlaceholders(player, loreList.get(i)));
Bukkit.broadcastMessage("Replaced: " + loreList.get(i));
}
itemMeta.setLore(loreList);
itemStack.setItemMeta(itemMeta);
NBTItem placeholderBoots = new NBTItem(itemStack);
player.getInventory().setBoots(placeholderBoots.getItem());
ty
is there a reason you're making an NBTItem then going right back to ItemStack?
this uses the existing lore and parses it again
it seems like you cant update the item meta directly on an nbt item
so if the existing lore is %player_name% it'll make it cj89898
but next time the existing lore is cj89898
at least not with the api im using
so it returns cj89898
ohh
still confused as to why you even need the NBTItem here
just setBoots(itemStack)
it stores some stuff on the item.
flyspeed and so on
must be stuff I can't see
because you literally make the item and add the itemstack
like, the lines are back to back
yeah i mean it was for debugging and stuff xd
prob. going to change that in a code cleanup or smth
ok ๐
the problem with updating placeholders on an item is that you need to store the original lore/name somewhere
I might have an idea ๐ฎ
Hey, im trying to import org.apache.commons.mail, and I've tried importing it into the build script, but it doesent recognize it.
badlion ๐คก
thank you very much ๐
yes, its badlion.wtf for a reason lol
I also own badlion.gay
buy is.gay and make badlion.is.gay
Hello, can someone help me to get if a world is unloaded.
https://upload.skyslycer.de/firefox_BFpNxnPZJc.png if you can afford, you can afford ยฏ_(ใ)_/ยฏ
Is it typo in javadoc for spigot api 1.18?
when you want to use for example getBlockType or getBlockData it say for Y y โ 0-255 but the world are bigger in 1.18.
Which class?
ChunkSnapshot has these methods
both methods on the javadocs say y - world minHeight (inclusive) - world maxHeight (exclusive)
Can't find any docs saying anything about 0-255 on that either though
Which class is that though? I am curious 
ChunkSnapshot
@NotNull
Material getBlockType(int x, int y, int z)```
Get block type for block at corresponding coordinate in the chunk
x - 0-15
y - world minHeight (inclusive)
z - 0-15
block material type
You're probably not looking at 1.18
I use
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-rc3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Why not 1.18.1?
I have access to new BLOCK_MARKER also, so should not be older version.
Only if maven not use right javadocks
Is it any api diffrens?
Well that's a RC version, so very likely to be incomplete
Not sure, but it's likely since RC isn't final
yeah rc3 wtf
it what maven suggested lol
Actually the suggestion comes from IJ
Same problem in 1.18-R0.1-SNAPSHOT, but in 1.18.1-R0.1-SNAPSHOT it are updated to the new javadoc.
well, i didn't even know IJ suggests artifacts to you
i just use the one the wiki recommends ๐
ether way is fun they not update javadoc from 1.18.1
With how big Bukkit is i'm sure there are still places mentioning the wrong thing
yeah ๐ is really big
if my code works in 1.18.1 way do I need change api version? ๐
I mean I run api 1.16.5 when fix it for 1.18 before soo XD
because they you get the correct javadocs for your version that are natively supporting?
either support 1.18 or 1.18.1, supporting a release candidate sounds weird
true ๐ But could even be wrong in latest too ๐
you found a annotation that hadnt been converted from 1.17.
My plugin support from 1.16+ and forward right now or at least working with no problem ๐
if your supporting 1.16 then build against 1.16?
do you not see +
arent you supposed to build against the earliest versions your supporting? /g
Not really
I not make a separated jar for every version XD
like ive never supported more then latest on my plugins so not really sure how it works as long as you dont build against a later java version that doesnt support it
Is not mater soo much I will really fast see if something not work in 1.16 (it will complain it not find x class).
such as building in java 17 when you support minecraft 1.16 since quite alot of people use java 11
I use 11 no issue, can even use 8 ๐
let me guess, you compile using jdk 8?
yes but not run a 1.18 server on 8, but the plugin can be on 8.
obviously
I can say at least paper updated 1.16.5 so you can run java 16
switch expressions are a godsend
they really are
if you not use latest 1.16.5 it will not run on newer an 15
that's why I don't support legacy versions ๐
switch expressions are java 14 right?
yea
you mean like steam or is it lamba functionality you mean (iยดm not 100% up to speed with that)?
no, switch expressions
switch(case) {
case arg1,arg2,arg3 -> doSomething();
}
int dayOfWeek = switch (Date.today()) {
case Date.SUNDAY -> 0;
case Date.MONDAY -> 1;
case Date.TUESDAY -> 2;
default -> -1;
}```
something like that
yeah i know inside switch, but what i see it look like something like lamba or what is now called.
that's literally the point of switch expresions
what you listed was already possible, just with a worse syntax using fallthrough
exactly
Would any of you happen to know Discord.js? I'm looking for one to hire...
i thought that was the point of switch expressions
im stupid lol
the point was to make them expressions in addition to being statements ๐
I created a request, I was just seeing if I could speed up the process since no one has contacted me yet ๐
Thank you though!
I have not use switch like that, only use switch like normal if/else if statement lol.
yeah that's what switch expressions allow you to do
very concise and beautiful
var worldName = switch(deathLocation.getWorld().getName()) {
case "world" -> "The Overworld";
case "world_nether" -> "The Nether";
default -> deathLocation.getWorld().getName();
};
๐
that's from one of my projects
pretty cool could be something I could use in next plugin some not need support for older minecraft versions ๐
well yeah and var is a pretty big one too
var is just a generic type right?
like how in python you dont have to define a variable type
it does local type inference
it is explicitly not like dynamic languages such as python
the compiler still knows exactly what type everything is at compile time
sexy
right!
Has anyone successfully sent a custom spigot plugin message to bungee? I can't get it to work :/
bungee -> spigot works perfectly though
code to listen: ```kt
@EventHandler
fun PluginMessageEvent.onPluginMessage() {
val bytes = data
// val jsonStr = DataInputStream(ByteArrayInputStream(bytes)).readUTF()
logInfo("tag: $tag, data: ${String(bytes)}")
val input = ByteStreams.newDataInput(bytes)
val channel = runCatching {
input.readUTF()
}.getOrNull() ?: run {
logInfo("Failed to read channel")
return
}
val jsonStr = runCatching {
input.readUTF()
}.getOrNull() ?: run {
logInfo("Failed to read json string")
return
}
Console:
tag: minecraft:register, data: spg:party/update[insert-unknown-symbol-here]spg:party/warp
Failed to read channel
and the code to send data: kt
val out = ByteStreams.newDataOutput()
out.writeUTF(channel.channel)
out.writeUTF(gson.toJson(data))
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray())
spg:party/update is one channel and spg:party/warp is another, sent in separate plugin messages
not sure why they're both in the same log separated by an "unknown character" symbol
(looks like this: https://i.imgur.com/XSeEKuP.png)
Did you register it?
yes
is any player online?
because it's registering multiple channels and that's how writeUTF does the thing
wdym?
minecraft:register tells the server "ayo my bro, register these channels for custom payload"
followed by the channels
is this in the server or in the proxy?
you should check the channel you're expecting to read from before reading the actual data ๐
how?
should I replace BungeeCord with my own channel name?
it's this
yes
well, are you using a custom channel?
tag always printed minecraft:register or minecraft:brand
brand is sent from/to the client, register is the one responsible for telling the other end to, well, register a new channel
ill try replacing BungeeCord with my own channel and seeing if it appears in the tag
make sure to register them as outgoing/incoming channels first 
oh
i only registered incoming
(on server)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
:stress:
๐ญ

still no worky :((
just get good
same logs, basically same code except that I removed val channel = ... and out.writeUTF(channel.channel)
and this time I registered outgoing
ill try using BungeeCord
nvm still won't work
๐
๐ญ
Anyone have a good working screenshare plugin for 1.16.5
@paper hollow don't post in multiple channels, stick to one
Use a debugger. Debug the player's client to see what it is actually sending.
The packet is sent and everything. The invoke methods just aren't altering the armorstand class
how do you know they don't alter it?
Debugged and I sent a screenshot of what they look like.
so you debugged the reflection method call and it changes nothing
in plugin.yml if I have version: '${project.version}' it returns a version not in my pom.xml
Any ideas? Been stuck with this for weeks and would like to get it done.
Double check your debugging.
I have
debug by attaching to the process and stepping line by line
printing isn't correct debugging
so you are changing the armor stand item properly?
also, the spawn living packet has no fields to set the properties
that's the entity metadata packet
Not setting a field. Getting what the field displays
it doesn't send the entity metadata to the client
look at the packet, there's no field for metadata
I mean, I told you the issue if you are setting metadata correctly. The spawn entity packet does not send the client it's metadata.
You need PacketPlayOutEntityMetadata
oh right, 1.16 might include it
I don't see the metadata field
yeah, checking the wiki there's no metadata field in 1.16 either
Yeah noticed that. How does it work then???
PacketPlayOutEntityMetadata is used instead
No I mean how does the original method work but not with reflection?
Idk
Like the methods are exactly the same, classes too it makes no sense.
Apparently... DataWatcher is supposed to automatically send the metadata packet. DataWatcher is created in the constructor of the EntityLiving.
IT WORKED!!!! Fucking hell all these weeks for it to be fixed by a separate packet that DataWatcher is suppose to send. ๐คฆ
Thank you @past ibex
Great now I have an issue with "varargs" in the constructor of the destroy packet.
are you using VarInt?
I got it to work.
playoutDestroy.getDeclaredConstructor(int[].class).newInstance(new int[] {(int) getId.invoke(stand)})
I was only using
playoutDestroy.getDeclaredConstructor(int[].class).newInstance(getId.invoke(stand))
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOONโข๏ธ
I need some help with Plugin Messaging between Spigot (Paper) and Bungeecord. My messages never arrive on the proxy and I can't figure out why.
This is the sending side (spigot) and I confirmed that the player.sendPluginMessage(...) part is being called:
private BukkitMessengerGateway(Plugin plugin, Server server, SchedulerAdapter scheduler, IncomingMessageConsumer consumer) {
...
server.getMessenger().registerOutgoingPluginChannel(plugin, CHANNEL);
server.getMessenger().registerIncomingPluginChannel(plugin, CHANNEL, this);
}
@Override
public void sendOutgoingMessage(String encodedMessage) {
new BukkitRunnable() {
@Override
public void run() {
Collection<? extends Player> players = server.getOnlinePlayers();
Player p = Iterables.getFirst(players, null);
if (p == null) {
return;
}
dispatchMessage(p, encodedMessage);
cancel();
}
}.runTaskTimer(plugin, 1L, 100L);
}
protected void dispatchMessage(Player player, String encodedMessage) {
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF(encodedMessage);
player.sendPluginMessage(plugin, CHANNEL, out.toByteArray());
}
This is the receiving side (bungeecord), but the Event is never fired:
private BungeecordMessengerGateway(BungeecordBootstrap bootstrap) {
...
this.proxy.registerChannel(CHANNEL);
this.proxy.getPluginManager().registerListener(bootstrap.loader(), this);
}
@EventHandler
public void onIncomingMessage(PluginMessageEvent event) {
if (!event.getTag().equals(CHANNEL))
return;
event.setCancelled(true);
if (event.getSender() instanceof ProxiedPlayer) // message from proxy -> server
return;
sendToAllServers(event.getData());
}
The full source code can be found here:
- Bungeecord: https://github.com/sVoxelDev/sChat/blob/refactor/api-2/platform/bungeecord/src/main/java/net/silthus/schat/bungeecord/adapter/BungeecordMessengerGateway.java#L82
- Bukkit: https://github.com/sVoxelDev/sChat/blob/refactor/api-2/platform/bukkit/src/main/java/net/silthus/schat/bukkit/adapter/BukkitMessengerGateway.java#L91
How can I convert a 32 bits encoded md5 hex string to a 128 bits encoded md5 hex string? Is that even possible?
I thought all md5 were 128 bits
it is, but it becomes 32 bits once encoded in string by using hex

huh
are you talking about bits or characters
I md5 a file, it gives me byte[], I convert that to Hex using some util function and pass that to another service, which has at some point to convert this MD5 hash encoded as Hex to its base64 representation
is that even possible?
at a glance it sounds like you're converting the byte to base16 correctly, but then instead of converting from base16 to base64 your service converts the base16 ascii characters to base64
yes, correct
which means that the bytes in the base64 encoded value will not be equal to your original bytes
are you trying to revert to the original byte array?
in that case just reverse the steps: decode it from base64 into (your ascii value) byte array, then convert that into a string
then decode the resulting string from base16 to a byte array
I see, ok then, thanks God it is possible to convert that thing to base64
i believe it would be better to revert the changes and then produce base 64
Can anyone help me with h2? I'm trying to create a table, and its saying theres a syntax error but its not saying what the error is. Ive been looking at it, and I cant see anything that would cause a syntax error. Any ideas?
https://pastebin.com/raw/FMDT0qNN
please ping me if you reply
SOLVED
turns out I should be surrounding the keys with `
if I use version: '${project.version}' in plugin.yml it returns 5.1.0 which is not what is in pom.xml
changing <version> in pom.xml will change that value
you would think, but not in my project
<version>5.1.0-Snapshot-4</version> is what is in pom
tried running a clean build?
how does one do that in intellij
in the maven tab, first run the clean task, then run the package task
rebuild project
You need to run clean package to build with maven
I have not used or see where I can run a clean package
I did google search from what Emily said and I think I have done a clean install, in Maven tab I ran clean and it only had one issue with Jobs and me using Latest I couldn't figure out the right version number
after doing that, it says I have many errors
still returning 5.1.0 leaving off the Snapshot-4
I know IntelliJ ha s a bug about this I guess my IDE has that issue
im so confused. Im using h2 embedded. I get an error about invalid sql with this:
update `STATISTIC_DEATHS` set value=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? where id=?
yet it looks fine, and everything i've run it through says its fine.
It doesnt even give any info. it just says this: (then the statement and stacktrace after) org.h2.jdbc.JdbcSQLSyntaxErrorException: (Message 42001 not found); SQL statement:
Any ideas? Please ping me
Probably need to escape value, as it is a reserved keyword in H2, so it's getting really confused
ahh
that is most likely it, thank you
hmm, it still seems to not like it (although there is a different code this time)
[18:54:09 WARN]: update `STATISTIC_DEATHS` set "value"=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? WHERE id=? [42122-210]```
looking at the javadocs, it says that 42122 is COLUMN_NOT_FOUND
although im not sure why it wouldnt be found
is there a way to open the file and see what colums it says exist?
ok
when something in sql doesn't work, just backtick everything 
nope, same thing :/
[19:02:23 WARN]: update "statistic_deaths" set `value`=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? WHERE id=? [42103-210]```
oh wait
you quoted the table name?
backticks ๐
this is why ORMs exist lmao
ORM?
object relational mapper, lets you abstract away most DDL and DML
[19:06:42 WARN]: update `STATISTIC_DEATHS` set `value`=8.0, namecache=?, prefixcache=?, suffixcache=?, hourly_delta=?, daily_delta=?, weekly_delta=?, monthly_delta=? WHERE id=? [42122-210]``` ๐ฉ

it'd be nice to know which column it thinks doesnt exist
where can i find out more? or can you tell me more?
oh shoot sorry for ping, forgot to turn it off
ok, looking at the datbase file, it seems like it made all of the column names caps for some reason
so ig thats why its not working?
is it possible to disable that?
dude I dunno, from what I've been reading, H2 seems like some crazy shit
https://hibernate.org/ this is the classic Java ORM
apparently
thanks, ill look into that at some point
for now, any (preferably sql) flatfile databases that are usable?
ive been using sqlite, but it turns out that sometimes it just decides to hang a thread every hour (sometimes less) for some reason
oh weird, I haven't had any problems with SQLite
though to be fair, I also just run a MariaDB in Docker for all my testing stuff
yeah
I've been using SQLite for my project for a few weeks and I haven't ran an issue where it'd hang like that
found it
DATABASE_TO_UPPER is true by default
hmm, still getting the column not found
it looks like it is the correct case now, but its still missing one of the columns apparently
Pretty sure it has something to do with disabling / enabling autocommit possibly
Oh?
can you elaborate on this? or where you heard this?
dont add the item to the menu, set specific slots.
The integer is only set if condition is true right? Without the usage of brackets
if(cooldownTime == 0) prepare();
int tempCount = cooldown-cooldownTime;
this is why lack of brackets is horrific
especially in one-liners
if the condition is true, prepare will be called
Yeah I know, just wondering
^
but the int tempCount will happen regardless
Not the integer?
Okay good, I always use brackets, just got a bit confused
use brackets, use multi-line
Hello, my Minecraft plugin saturates my server (I can't execute other commands as long as this plugin is running) Is it possible through a code to stop this plugin or avoid this?
im having difficulty adding papi support to my plugin
more specifically, here: https://github.com/srnyx/geeksmp/blob/master/src/main/java/com/commandgeek/GeekSMP/Setup.java#L190-L213
i wanna be able to use placeholders in the header/footer
what do i need to do in order to achieve that?
already tried following that but im lost
i dont know that much about coding tbh
just thought it'd be pretty simple to add papi support
Can I check is a ecloud module downloaded? For example: check is "Vault" module of papi ecloud downloaded?
Maybe
int repeat = 3;
public void runnable(){
new BukkitRunnable() {
@Override
public void run(){
if(repeat != 0){
// Do sth
repeat--;
}
}
}.runTaskLater(plugin, delayIntTicks, repeatDelayInTicks);
}
With this the runnable will never be cancelled
Runnable with a runnable?
Use the code above remove the outside runnable and add cancel() if repeat == 0
oh hi motf
dont suppose you could help me with papi? cause i still dont rly understand how to add support for it in my plugin
#development message
What's your error when you try this?
#development message
well i havent tried exactly that cause its not rly what i wanna do
that has the msg inside of the code, but i wanna have it use what i specify in plugins/Plugin/config.yml
I'm not sure exactly what you mean, could you give an example of what you want to input and output?
its code for tab header and footer
it already has some built-in placeholders, but i wanna replace those with papi
Do you mean like item = PlaceholderAPI.setPlaceholders(player, item)?
would that allow for any papi placeholder to be usable?
Yes
oh, where do i put that?
preferably so that they will work anywhere in the plugin
but if that requires a lot more work than just allowing them in tab header/footer should be fine
You can do it wherever you have item = item.replaceAll("%tps%", ServerManager.getTPSString()); or any other replacement
so this: java for (String item : items) { item = item.replaceAll("%tps%", ServerManager.getTPSString()); item = item.replaceAll("%online%", String.valueOf(Bukkit.getOnlinePlayers().size())); item = item.replaceAll("%max%", String.valueOf(Bukkit.getMaxPlayers())); header.append(item).append("\n"); } would become this?java for (String item : items) { item = PlaceholderAPI.setPlaceholders(player, item); header.append(item).append("\n"); }
for future reference right?
yeah
alr ty
using nms or not, how can I make a sheep, who has a player as their passenger, rotate with the players head? (1.8 btw)
it worked! tysm :D
hm now i have the issue where tab is only being updated when a player joins/leaves
how do i make it update on a timer or something?
Could u explain the diff between those? JavaDocs too is kinda misleading
replaceAll uses regex, while replace doesn't
So there is cons for that?
It isn't really about cons, if you want to replace %hello% then you use replace, if you want to replace something like (\w+) you use replaceAll
Ooโฆ.okayโฆ
if you use replaceAll it'll compile the expression as regex which will affect performance.
Weird names thhoo
there's not really many use cases for replaceAll, generally you want to call that method on your compiled regex pattern
How does replace workโฆmatch the chars in the string and replace?
yes
Hmmโฆthx
public static long lastTabUpdate = 0;
public static void tabUpdate() {
long time = new Timestamp(System.currentTimeMillis()).getTime();
if (Math.abs(lastTabUpdate - time) > 1000) { // 1,000 milliseconds (1 second)
updateTabMetaForAll();
lastTabUpdate = time;
}
}
public static long lastFiveMinuteUpdate = 0;
public static void fiveMinuteUpdate() {
long time = new Timestamp(System.currentTimeMillis()).getTime();
if (Math.abs(lastFiveMinuteUpdate - time) > 300000) { // 300,000 milliseconds (5 minutes)
updateTeams();
updateAllRoles();
if (DiscordManager.smpChatChannel.asServerTextChannel().isPresent()) {
DiscordManager.smpChatChannel.asServerTextChannel().get().updateTopic("**Online Players:** " + Bukkit.getOnlinePlayers().size() + "/" + Bukkit.getMaxPlayers());
lastFiveMinuteUpdate = time;
}
}
}```
thats what i have rn
but it isnt working
why do you need math.abs? Time only moves forwards
i just copied the code from another piece of the plugin
which someone else made a bit ago
doesn't matter, I guess people could change their clock while running the server and this would handle it
yeah that's what they want you to think
so do u know y it isnt working?
this is what the updatetabmeta stuff does:
public static void updateTabMeta(Player player) {
if (Main.config.contains("tab-meta.header")) {
List<String> items = Main.config.getStringList("tab-meta.header");
StringBuilder header = new StringBuilder();
for (String item : items) {
item = PlaceholderAPI.setPlaceholders(player, item);
header.append(item).append("\n");
}
player.setPlayerListHeader(ChatColor.translateAlternateColorCodes('&', header.toString().replaceAll("\n$", "")));
}
if (Main.config.contains("tab-meta.footer")) {
List<String> items = Main.config.getStringList("tab-meta.footer");
StringBuilder footer = new StringBuilder();
for (String item : items) {
item = PlaceholderAPI.setPlaceholders(player, item);
footer.append(item).append("\n");
}
player.setPlayerListFooter(ChatColor.translateAlternateColorCodes('&', footer.toString().replaceAll("\n$", "")));
}
}
public static void updateTabMetaForAll() {
for (Player online : Bukkit.getOnlinePlayers()) {
updateTabMeta(online);
}
}```
ping me if u reply
i think i might know why
it isnt be "triggered" by anything, so it never runs
so how can i make it be triggered every second or something
idk what im saying tbh im so tired lol
Use the bukkit's scheduler
So, I need to get the content of a message and its attachments with JDA. There's a method for attachments that returns an InputStream but as a CompletableFuture. How can I make my CompletableFuture#supplyAsync wait for for the completables of the attachments?
public CompletableFuture<String> getContent(Message message) {
return CompletableFuture.supplyAsync(() -> {
for (var attachment : message.getAttachments()) {
attachment.retrieveInputStream(); // CompletableFuture<InputStream>
}
})
}```
d;jda message$attachment#retrieveinputstream
@Nonnull
public CompletableFuture<InputStream> retrieveInputStream()```
Enqueues a request to retrieve the contents of this Attachment.
The receiver is expected to close the retrieved InputStream.
Example
public void printContents(Message.Attachment attachment)
{
attachment.retrieveInputStream().thenAccept(in -> {
StringBuilder builder = new StringBuilder();
byte[] buf = byte[1024];
int count = 0;
while ((count = in.read(buf)) > 0)
{
builder.append(new String(buf, 0, count));
}
in.close();
System.out.println(builder);
}).exceptionally(t -> { // handle failure
t.printStackTrace();
return null;
});
}
CompletableFuture - Type: InputStream
I mean you have an example reee
Yes but by supplyAsync completable gets completed before I get access to the content of the attachment
join ?
Could you tell me what you wanted to do exactly?
Wait for all the message attachment futures?
or like uh
yea
Where do you return the string in there?
wait for them to complete and then get the data of the InputStream and join them all into a string
of each?
ahh
return CompletableFuture.supplyAsync(() -> {
final var builder = new StringBuilder();
for (var attachment : message.getAttachments()) {
final var in = attachment.retrieveInputStream().join();
try {
builder.append("### ").append(attachment.getFileName()).append(" ###\n")
.append(new String(in.readAllBytes()))
.append("\n");
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return builder;
});```
I'm like 90% sure this is not right xd
INSERT INTO SwagLord
(uuid,lastknownid,level,points,upgraded,playervariables) values (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE SwagLord SET lastknownid = ?, level = ?, points = ?,upgraded = ? ,playervariables = ' ? ' WHERE uuid = ' ? '
im getting an index out of range exception for my sql program
java.sql.SQLException: Parameter index out of range (11 > number of parameters, which is 10).
this is so annoying pls help
ping me immediately if you have got an answer cuz this is pretty urgent
many thanks and take my knees in advance
'?' is a string, not a parameter
but if i unquote the question marks,
and load my json strings in,
it just gives me syntax error
so how do i set json string into the parameters?
show the error
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
'SET lastknownid = 'Notch', level = 0, points = 0,upgraded = 0 ,playerva' at line 1
and the rest are just the stack trace
many thanks,life saver
pretty sure i didnt set the quotation marks near notch btw
yeah they are added by the sql driver, that's correct this way
I think the update part does not need the table name and the SET in that case
^^
alr that makes sense
will try it,thx a lot
Does anyone have an issue with 1.18 where if you restart the server after a few tries it will freeze on```
[09:07:05] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[09:07:06] [ServerMain/INFO]: Reloading ResourceManager: Default, bukkit
This is not a 1.18 problem, it has happened to me on older versions too. Also, #minecraft
Also #minecraft
Yeap forgot about that channel.
Does this just mean that the schematic is simply too big for sk89q to handle? https://paste.helpch.at/utetazufaf.md
(worldedit)
Yeah so I've found out that it's because the chunks aren't generated
@viral charm check out the full example here: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion#full-example-2
You'll have an identifier for all placeholders (ex: in %player_name% identifier is player)
and then the params (in the example) is your actual placeholder you want them to use
I'm having an issue where something along the lines of
Clazz instance = this will evaluate to null when I use Clazz.getInstance()
Does anyone know how I would use intellij to get more information on what's going on? Or how I should go about debugging this?
*Clazz being some class in my plugin.
*While "instance" is an object belonging to the super class of type "the super class"
static access?
Yes
Dont use the singleton pattern for this
What I'm using this for is for an API class.
In the main plugin it instanciates a class DeclaringApi (example) that extends an abstract class API with methods like getControllerX() and so on.
Use the bukkit service manager, or just provide as a non-static method. You can get the plugin's instance anyway
The reason I wanted the class API is so that all the main functions are in one place. I know about the service manager but I kind of gave up because i ended up still using static access because I don't care for priority when accing the API
External. I was trying to make something easy to use. Pretty much like how TAB does their API implementation
Again, avoid static access for this case
I mean I'm more so trying to find the problem because up until my 4th project (this current one) it was working just fine. This might be outside the realm of Minecraft dev and more of a general java question.
you're most likely having an issue with the order of initialization and usage
Maybe but these "other projects" have depends for this API. Also this API plugin have startup procedures and according to my log messages it become fully loaded. What makes things worse is that the other projects load in fine it's only this new one having issues. I might throw the code up in the morning but I have been genuinely baffled at this
well you can just attach a debugger and see what's wrong
@dense drift thanks for the pull request
te pup varule
You mean Issue, no problem xD
Hey is it possible to create a world that only has a specific size? For example generate a world that is 5000x5000
Thank you! Had also looked through that but I'm not quite grasping it. In if(params.equalsIgnoreCase("placeholder1")){ would I swap "placeholder1" for e.g. "%balance%" and then is it within return plugin.getConfig().getString("placeholders.placeholder1", "default1"); that I somehow connect it to my plugin, e.g. registering that %balance% is the number of (for example) coins that a player has
god damn it 
System.out.println("-------> IS API NULL? " + (Bukkit.getServicesManager().getRegistration(JAGAPI.class) == null));
This is null
however it is declared and set/registered.
does it show up when you iterate through getRegistrations?
just like , iterate and print
don't try to match anything
yeah i'm 100% sure you're shading the api in KingDefense
so the Class ref is the one in its own jar, rather than the one in the api
you right, is there a page where I can easily understand shading with my pea sized brain (also thank you)
if you're using gradle, the user guide for the shadow plugin; if you're using maven the usage guide for the maven-shade-plugin
perhaps some other guide about the topic out there but none that I know of
alright I'll look into it. I'm still using maven atm
for maven basically: the dependencies you want to shade have to have <scope>compile</scope>, what you don't want to shade <scope>provided</scope> (or if it's a transitive dep somewhere, check out the page on exclusions)
Does anyone know a good ArmorEquipEvent lib?
yeah paper-api
I don't get why Spigot hasn't added it
It has to support Spigot
just shade it smh
Shade all of paper?
that would be cool
lol
Replace their jar with paper
Yes
I want to move a players helmet across a bungeecord server, what would be the best way to approach this problem? Do I have to use a SQL database?
Would be probably the best
oof, so no easier way then to set up the entire database? ๐
You could use a map on a bungee/velo server
And just store the data there
And use pmc
Never used that before, do you think you could point me into a direction of what to read up upon or an example where this is done? ๐
Plugin Messaging
Basically the plugin sends the helmet data to the bungee when leaving
Bungee stores it
And sends it to the server the event points to
(Ig there is a server switch event or smh)
anyone know how to rotate a sheep through spigot or NMS?
I have the yaw/pitch I need
and I tried teleporting it with a location with the set yaw/pitch
and that didnt work
Entity#teleport
I tried that
How is PaperMC NMS used in 1.18.1?
Like what is the dependency
Paperweight plugin for gradle
hey gaby can you help me out in #general-plugins
Someone got any idea how this is done in kts?
processResources {
eachFile { expand version: version }
}
From groovy btw
processResources {
expand("version" to rootProject.version)
}
That's how I do it in one of my projects.
Thank you!
you shouldn't identify item stacks by their name/lore/etc to begin with
what are you trying to achieve?
and what does that do..?
Is name not a valid parameter in kts?
You don't need it maven("link here")
right okay, what you want is a Map<String, ItemStack> that maps the identifying key ("sword") to the corresponding item stack
are you familiar with maps?
fuck no
Otherwise you'll double up
NBT
.
generally speaking you want to construct the lore and display name from the data, never the other way around
Yeah, I'm just saying if you're going to use the name as a key, just filter/find the list
Would be nice to have though
Why?
Not saying it's the best idea, just saying if they're stuck to it
For readability when there's a lot of different repositories
And if I have to remove one I want to remove the correct one
Sometimes a bit difficult with just the links
I guess?
Ye ig
Anyone got an idea what this means? lol
I'm completely new to kts
Error:
e: C:\Users\45512\Desktop\JAVA\Infection\build.gradle.kts:54:5: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val TaskContainer.shadowJar: TaskProvider<ShadowJar> defined in org.gradle.kotlin.dsl
You need to import ShadowJar reference
Similar to how you do with Java, once you type ShadowJar it'll show the imports you can use
Nothing shows
Might be because of the thing in the top
@pulsar ferry Sorry for the mention if it's annoying, just not sure why I'm not getting the code insights
You're probably not getting insights because it hasn't compiled for the first time yet
Comment everything that is currently erroring out and try getting it to refresh without errors
Would make sense yeah, this can't be commented out though
Cause: paperweight requires a development bundle to be added to the 'paperweightDevelopmentBundle' configuration, as well as a repository to resolve it from in order to function. Use the paperweightDevBundle extension function to do this easily.
Got it paperDevBundle("1.18.1-R0.1-SNAPSHOT")
Yeah
Nope, it has to decompile and recompile the server so it takes some time for the first time
I guess the paper bundle does contain a lot
yeah well, it's the entire server, decompiled, remapped, with generated sources, patched, re-compiled
it is a pretty bit
Makes sense, and it's just my laptop which isn't the best so yeah lol
Takes a bit
Wait PaperMC uses forge?
Which type do I use though?
Fixed mostly
Is there a reason why PlayerPortalEvent doesn't get called when the player enters the exit end portal inside the end, and is there a workaround to be able to cancel it?
.get().archiveFile
Probably the teleport/changeworld event? Though that sounds like a bug and these other events would trigger for other reasons as well
The wording seems to be oddly specific
Called when a player is about to teleport because it is in contact with a portal which will generate an exit portal.
Is there any gradle compiler plugin just like maven-compiler-plugin? I'm trying to use this https://codehaus-plexus.github.io/plexus-compiler/ on Gradle, I can't figure it out.
What are you trying to do?
I'm not sure what the maven compiler plugin does, but I never needed anything else than plain gradle and shadowJar
What the fuck in the fuck is that
How do i fix this
https://prnt.sc/26vg4kk
@dense drift @lyric gyro it's to fix the issue that I have, basically I have an issue with using PlayerDataInfo class, I get bad RuntimeInvisibleParameterAnnotations attribute error on compile.
I found the solution here https://www.spigotmc.org/threads/cannot-access-net-minecraft-server-v1_16_r3-packetplayoutplayerinfo-playerinfodata.497496/
after this i have been scratching my neck for the past 30 mins
just cant resist it thanks to you
๐คฃ๐คฃ
val colors = mutableMapOf<String, Color>()
Color::class.java.declaredFields
.filter { it.type == Color::class.java }
.filter { Modifier.isStatic(it.modifiers) }
.forEach { colors[it.name] = it.get(null) as Color }```
What would be a better way to create a map directly from the second code, instead of using that `forEach`? My goal is to get all `Color` static fields on a `Map<String, Color>`
Oooohhh .associate { it.name to (it.get(null) as Color) }
What has best performance, an array or HashMap with integer as key?
It doesn't really matter, the difference would be extremely minimal
A map is normally more organized
It has other advantages as well, an array is of fixed size
a*
But if course a map has overhead.
Unless you're running thousands of not tens of thousands of read/write ops a second, a map is fine
Sir this is Java
No datatype is faster than an array, if you are using it like an array
does anyone know how I can hotswap my plugins?
Hi
I'm having an issue with PlaceholderAPI API
I created my placeholder as following in the doc
I'm receiving my [17:54:10] [Server thread/INFO]: [PlaceholderAPI] Successfully registered expansion: anarchynetwork_skyblock [1.0.0]
In logs
But my placeholder seems to be dead
Show code
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new AnarchySkyblockPlaceholder(this).register();
}```
wdym it's dead
using debugger
in intellij
and run configuration
I mean its dead cuz i cant use it
papi list display my placeholder รฉlรฉment
But papi parse player %anarchynetwork_skyblock_balance% display the placeholder
Not 0 or value
try papi parse me
Its same
pretty sure the problem is that your identifier has a _.
Ummm what?
java.lang.AssertionError: AssertionError (GSON 2.8.8): java.lang.IllegalAccessException: Can not set final java.util.UUID field net.valdemarf.infection.players.PlayerData.uuid to java.util.UUID
It should be able to set it?
isn't it because it's final?
Yeah, fields cant be final if you plan to deserialize the class
Worked in another plugin though, which surprises me
Unless I'm reading it wrong... it might be because they are 2 different objects?
Can not set final java.util.UUID [...] to java.util.UUID They should be the same
It is because of the final
It should just work though
net.valdemarf.infection.players.PlayerData.uuid This part is what makes me think otherwise. Try debugging it
Possible. You could try reflection and make it accessible.
What makes you think otherwise?
Wouldn't know how to do that sadly
That its not the normal UUID object from java.
Again debug it. Maybe the wrong UUID object is being passed.
Field f = Class.getField("FieldName");
f.setAccessible(true);
f.setField(Object, Object);
setAccessible only makes it public, it doesn't change it from being final
Yes but allows you to change its object.
final has nothing to do with it
This is where it's from PlayerData dbPlayerData = GSON.fromJson(playerDataDocument.toJson(), PlayerData.class);
The error
java.lang.IllegalAccessException?
It's the fact that it's a record, you cannot reflectively modify record components so you'd have to provide your own TypeAdapter
So somewhere in that code it looks like its returning net.valdemarf.infection.players.PlayerData.uuid instead of java.util.UUID
Since java 9, final is effectively useless outside of compilation, if you have reflective access, you can change it anyway.
๐
I guess it's PlayerData.class?
IDK You only showed 1 line of code. Debug and find out lol
Well not sure how to debug this
public void deserializePlayerDataSet() {
Set<PlayerData> playerDataSet = playerManager.getPlayerDataSet();
// Deserializing - getting an object from json in the database
for (Document playerDataDocument : getPlayerDataCollection().find()) {
PlayerData dbPlayerData = GSON.fromJson(playerDataDocument.toJson(), PlayerData.class);
playerDataSet.add(dbPlayerData);
}
}
Read through PlayerData and find out what is returning the wrong object.
There's really not much in the class
Use your IDE's search function and search for net.valdemarf.infection.players.PlayerData.uuid
See if thats imported anywhere
.
Hmm, why does your record have getters? 
This hasn't been required in other plugins though
Isn't that normal? As long as it's immutable
Records already provide getters
It either wasn't a record or you provided an adapter
It's used exactly to reduce bloat
This has previously worked
Oh
final PlayerTime playerTime = new PlayerTime(...);
playerTime.duration();
playerTime.uuid();
Oh nice
It was a record with no TypeAdapter though
this
Alright so the record should work even though it's final, GSON already sets it as accessible using reflection, so final shouldn't be an issue, not sure what else could be the problem though?
how can i make it so that placeholders arent parsed against a player (instead just like the server)?
trying to make placeholders work in discord channel topic
this is what i have rn:
if (DiscordManager.smpChatChannel.asServerTextChannel().isPresent() && Main.config.contains("discord.smp-chat-topic")) {
List<String> items = Main.config.getStringList("discord.smp-chat-topic");
StringBuilder topic = new StringBuilder();
for (String item : items) {
// item = PlaceholderAPI.setPlaceholders(player, item);
topic.append(item).append("\n");
}
DiscordManager.smpChatChannel.asServerTextChannel().get().updateTopic(topic.toString().replaceAll("\n$", ""));
}```
Most efficient way of choosing 3 random players from a set of players?
What's that for? I think you can use null as player
Remember you cant update topic of the channel too often (i think its just twice every 10 minutes, unless that changed)
its to update the discord channel topic of a specific channel (specified via config.yml). ill try null
oh i thought it was every 5 mins, ill have to update the period then realized once every 5 mins is the same as twice every 10 mins
alright it works!
but now i need to find a way to get rid of the color code symbols, i tried adding on .replaceAll("ยง[a-fklmnor0-9]", "") (after .replaceAll("\n$", "")), but that didnt work
i assume its because its not replacing it from the placeholders, only the raw text
There's a ChatColor.stripColors method
not sure if im applying it right (it doesnt work like this):
List<String> items = Main.config.getStringList("discord.smp-chat-topic");
StringBuilder topic = new StringBuilder();
for (String item : items) {
item = PlaceholderAPI.setPlaceholders(null, item);
ChatColor.stripColor(item);
topic.append(item).append("\n");
}
DiscordManager.smpChatChannel.asServerTextChannel().get().updateTopic(topic.toString().replaceAll("\n$", "")
);```
when is it assigned? sorry, i dont know much java, just adding small things to a plugin
item = ChatColor...
so this is when it was first assigned?
item = PlaceholderAPI.setPlaceholders(null, item);
ohhhh
i see what u mean
it's first provided by the for loop you're iterating
then reassigned with the value setPlaceholders return
then you'd need to reassign it with the value stripColor returns (just like it's doing with setPlaceholders)
so does this all seem right?
for (String item : items) {
item = PlaceholderAPI.setPlaceholders(null, item);
item = ChatColor.stripColor(item);
item = item.replaceAll("[*_~]", "");
topic.append(item).append("\n");```
and just so i understand, what exactly are the "items"?
List<String> items = Main.config.getStringList("discord.smp-chat-topic");
whatever is set in that section in the config
ah ok (also it worked)
so all the item = things will affect the text i put into the config? if so, how can i make item = item.replaceAll("[*_~]", ""); only affect placeholders? cause i still wanna be able to use discord formatting in raw text
so all the
item =things will affect the text i put into the config?
they won't, no
you're only changing the local "copy" of it
ye ye thats what i mean
like whatever i put in the config setting will be affected by every item =
instead of just the placeholders being affected by them
ex: i put in *server*, it would become server instead of server, and if i put in %tps% it will become 20.0, 20.0, 20.0 instead of &a*20.0, &a*20.0, &a*20.0
Yeah, once a config is loaded in memory, you have to use FileConfiguration#set to modify its content, modifications done on objects get from config won't do anything to the file itself
yea yea ik
i mean the "copy"
Hey, anyone have SQL knoledge?
Im trying to run
SELECT * FROM stats WHERE 'uuid' = '5c06626c66bf48a984cbf2683e6aca87'
On this db
And the ResultSet keeps returning empty
This is the code I'm running
query.executeQueryAsync((resultSet, e) -> {
if(e != null) {
e.printStackTrace();
save();
} else {
try {
Bukkit.broadcastMessage("Getting data!");
if (resultSet.next()) {
wins = resultSet.getInt("ms_wins");
System.out.println(wins + "");
kills = resultSet.getInt("ms_kills");
System.out.println(kills + "");
} else {
System.out.println("Returned Null!");
}
} catch(SQLException throwables) {
throwables.printStackTrace();
}
}
});```
Keeps returning "Retuned Null!"
well i guess that's because you are checking if the e != null instead of e == null
not sure tho
& if it's equal to null anyway(that's what appears to be the case) then that's another whole problem
Iterate through the set, have a 45% chance for each iteration, count how many players you have, done, also might want to scramble the set so you don't have ordered shit
e is an Exception
oh yeh i forgot that sql query throws exception lol
@bold ridge what happens if you execute the query manually?
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOONโข๏ธ
uhhh
that's not really how you're supposed to make Guis
you're just supposed to use the builders, like on the wiki
I mean yeah, defining GUI stuff is basically a markup language
Just with a little code thrown in
And you can still open it with a command?
Then go use that one?
oof
why 1.16? 2 versions behind latest?
Compared to 1.16, 1.17 and 1.18 are both improvements lmao
1.18 especially
no like, they don't
i literally run 1.17 and 1.18 servers
that's not a lot lmao
margin of error
i run 100+ player servers on 1.17 and 1.18
nope, Paper
'bout 16GB of ram
Aikar's Flags, a few optimizations
you need like 4GB of ram for a 10 player server
and even that's kinda overkill
Thank god
Java 16 can run Java 8
Why on earth would you want to stay in 2014?
Because it's old, outdated, doesn't have any of the new language features or optimizations, among many other reasons?
Minecraft moving to the latest java version was the best thing they ever did
Every Java release is stable
That's why they take so damn long'
I mean there is
You're outdated and unsupported
Java 8 LTS support is ending this year iirc
Ah, next month
Can't believe it's not sooner
Java 8 is literally decrepit at this point
Extended support
That means nothing unless you're paying Oracle lmao
Get with the decade man, using the latest is where it's at
Look at the freaking bstats graphs
There are more people using 1.8 than people using 1.16
ye but using 1.8.8 is for PvP purposes bro
& 1.7.10 aswell
& those who use 1.8.8 includes the biggest mc server, hypixel
I mean yeah, while I don't agree that that's a good idea, at least they have a reason lmao
mhm
Just go check if your plugins support latest version
Chances are they do
Considering 1.17 has been out for like a year, yes
Unless you're doing some spicy reflection stuff, any plugin will work backwards
oh my god lmao
Yes, it is
Uh, not true at all
Because Optifine hadn't been released yet or something?
There are very few changes in the client between 1.17 and 1.18
And, since you love stability so much, 1.18 runs Java 17, which is an LTS release
I have a feeling your tests are not representative of much
I mean, do whatever you want
Server-side software doesn't affect clientside FPS
It just baffles me why anyone would lag behind versions like this
What exactly changed between 1.17 and 1.18 that affects FPS so much?
New worldgen lowering FPS? that's funny
There totally was
And also that's huge lmao
Those test results aren't even valid then lmao
Well, luckily for us, it's not then, is it?
And don't get me started on using Lunar Client in newer versions
Cause there are a lot of better alternatives
Fabric, for one
Their whole monetization scheme is pretty rough, don't really want microtransactions in my block game lol
And they don't provide anything better than Forge besides I guess you don't get to choose the mods?
Sure, but you still see everyone else's purchaes
Then why use Lunar at that point?
Just use Forge, or, even better, Fabric
...
Oh if only Forge and Fabric had all of those!
Oh wait, they do
And Lunar just repackages them
if only forge and fabric were modding platforms
Oh wow, people can't handle dragging jars in every once in a while
Oh my god!
I'm not really sure what you mean by that lmao
As in, after a new Minecraft release?
Cause Lunar also has to do that
Hence why they didn't have Optifine when you did your test
Or CurseForge?
Lunar doesn't provide nearly any value unless you can't handle a one-time setup of about 10 minutes every 6 months
So I guess that says something about your playerbase lmao
Wow, you can do that with the mod platforms they use too!
Just download some mods and run
Just as good, especially on Fabric
See but I don't get to pick what mods Lunar gives me
And they usually don't have the best
For instance, Optifine is not very good
The Fabric suite of performance mods is far superior
That's a me issue? Optifine being closed source, poorly written, and maintained by one person?
That's funny
Well yeah, that'll happen when you have an incumbent
Same story when we had Risugami's Modloader and Forge came along

see now that's what I'm talking about!
hey BM, did you know that mc and most performance mods don't do entity culling *based on occlusion?
yeah I got it a bit ago, it's a standalone mod that does it
Saves hundreds of FPS when you're above a base with a million chests or something
let me find it
2.6 million downloads, don't know how I never saw it before
ayyyo
oh damn, he swapped from the MIT license to a weird custom one?
compensation.```
This is the only difference lmao
if paper is so good where is hangar ๐ฅฒ
damn so true
How do i create this:
@Override
public void run() {
}
}, 0, 300*20);``` in normal java?
no bukkit
you mean timer?
i think so
@Test
public void givenUsingTimer_whenSchedulingTaskOnce_thenCorrect() {
TimerTask task = new TimerTask() {
public void run() {
System.out.println("Task performed on: " + new Date() + "n" +
"Thread's name: " + Thread.currentThread().getName());
}
};
Timer timer = new Timer("Timer");
long delay = 1000L;
timer.schedule(task, delay);
}
probably that
you can also search "create timer task java" in google maybe
Question, im trying to use dynmap, but im getting an error. this is my code
MarkerSet markerset = api.getMarkerAPI().createMarkerSet("id", "label", api.getMarkerAPI().getMarkerIcons(), false);
int cornerAX = chunkX * 16, cornerAZ = chunkZ & 16, cornerBX = cornerAX + 15, cornerBZ = cornerAZ + 15;
double[] x = new double[] {cornerAX, cornerBX};
double[] z = new double[] {cornerAZ, cornerBZ};
AreaMarker marker = markerset.createAreaMarker("id", "label", true,
world.getName(),x,z, false);
marker.setFillStyle(1, 0x42f4f1);```
ty
remember i said maybe, but google it, probably there is another solution
ScheduledExecutorService > Timer
There you have, a solution
what is the function that runs forever?
i mean updates forever
on spigot
maven
modrinth
hey is it sensible to increment unicode character inside a string by 100 in a loop?
will it mess with the index or whatsoever?
what
Modrinth deez nuts
MarkerSet markerset = api.getMarkerAPI().createMarkerSet("setId", "Display Name", null, false);
int cornerAX = chunkX * 16, cornerAZ = chunkZ & 16, cornerBX = cornerAX + 15, cornerBZ = cornerAZ + 15;
double[] x = new double[] {cornerAX, cornerBX};
double[] z = new double[] {cornerAZ, cornerBZ};
System.out.println(markerset);
AreaMarker marker = markerset.createAreaMarker("id", "label", true,
world.getName(),x,z, false);
marker.setFillStyle(1, 0x42f4f1);```
Im using dynmap api and im getting this error
https://paste.helpch.at/gakadoxotu.cs when i sout markerset it isnt null
line 86 is the areamarker
what packet is sent when items are displayed to a player? I need to change their lore / name
add if (markerset == null) return; after the markerset line
wait so if I debug the minecraft server in intellij while I'm in my plugin's project, I can hotswap?
it sounds too easy
Best way to (de)serialize items? Can base64 be avoided?
Need it to JSON format
Using GSON API btw
I just need Material, Displayname, Lore and Amount
then register a type adapter for it
Paper has a useful API for item serialization
pretty sure JSON serialization is like, the easiest of the serialization
i think it's part of the base64ification
the real cool stuff is binary serialization ๐
straight into the db
Wait they got a class for it?
Didnt know that
maybe this one doesn't use Gson lol
but what's so wrong with Base64?
this one looks good
i dont think that supports some stuff tho
but for Material, Displayname, Lore, and Amount it'll work
Has anyone worked with player skins and packets, and gotten a client error about the packet length being too long?
final GameProfile playerProfile = ((CraftPlayer) player).getProfile();
final GameProfile profile = new GameProfile(
uuid,
player.getDisplayName()
);
profile.getProperties().removeAll("textures");
Property textureProperty = playerProfile.getProperties().get("textures").iterator().next();
String texture = textureProperty.getValue();
String signature = textureProperty.getSignature();
profile.getProperties().put("textures", new Property("textures", texture, signature));
return profile;
It only happens for some people
Are these peps using 1.8?
1.18
what packet?
One sec
PlayerInfo
final GameProfile profile = this.getCopyProfile(player, uuid);
final PacketContainer playerInfoPacket = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
final StructureModifier<EnumWrappers.PlayerInfoAction> action = playerInfoPacket.getPlayerInfoAction();
final StructureModifier<List<PlayerInfoData>> infoData = playerInfoPacket.getPlayerInfoDataLists();
final List<PlayerInfoData> playerInfoData = new ArrayList<>();
playerInfoData.add(
new PlayerInfoData(WrappedGameProfile
.fromHandle(profile),
0,
EnumWrappers.NativeGameMode.fromBukkit(GameMode.CREATIVE),
WrappedChatComponent.fromText(profile.getName()))
);
action.write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER);
infoData.write(0, playerInfoData);
return playerInfoPacket;
Iโll check in a few minutes
Can this not be used to increase movement speed? Since max is 1 https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#setWalkSpeed(float)
You can go up to infinite movement speed practically with attributes
Ah yeah attributes, forgot about them



