#help-development
1 messages · Page 671 of 1
Player#sendMessage(String) is deprecated on paper
it's not
no xf staff here
hmm i don't use paper https://i.imgur.com/tJXC9we.png
its not
lol like that shows anything
Dangit where is choochoo
declaration: package: org.bukkit.entity, interface: Player
where is he
choco my favourite official spigotmc representative
¯_(ツ)_/¯
make ur mom or dad drive down to his house
@austere cove if ur able, they posted a resource on spigot with the same dick pic, i can dm you the link if you need
btw small d
oh
guess im wrong, could've sworn it was
that same dude was yesterday with a thousand alts in the paper discord too 💀
a thousand maybe more like 3
well the old way likely is now its Player#sendMessage isnt it?
Man got some nerve
Sooo i still need to know how to use spigot().sendMessage(). I don't know how to create BaseComponent for it
his verified name kept changing for me.
he probably keeps making new spigot accounts
this just like that same question 2 hrs ago asking same thing if someone was depreciated
its not deprecated, if its deprecated you are using it wrong
it was flashing between two names
he gets banned of 1 discord and now is sending his d pick everywhere and telling us to kill ourself
Paper deprecated basically every string method except that one
Tho it is annotated @Obsolete or something
I know, i need to send action bar but i think it's working only with spigot.sendMessage()
oh ok thx
:c
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Please tell me someone else can deal with it
he is now also banned from the other mutual server
How is if(args[0].equalsIgnoreCase("add")){ an unreachable statement?
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
if (label.equalsIgnoreCase("balance") || (label.equalsIgnoreCase("bal"))) {
sender.sendMessage("Only players can execute this command.");
return true;
} else {
Player player = (Player) sender;
sender.sendMessage("Du har " + formatNumAsMoney((float) Balance.get().getBalance(player)) + "§a$");
return true;
if(args[0].equalsIgnoreCase("add")){
System.out.println("2");
if (sender.hasPermission("money.add")) {
System.out.println("3");
Player target = Bukkit.getPlayer(args[1]);
if (target != null) {
Balance.get().addBalance(target, Double.parseDouble(args[2]));
System.out.println("4");
return true;
}
}
}
banip for discord pls
md has disappeared, sam and foncused are away and choco has decided now to disappear
Why can’t you have a method for both strings and the special components
return true;
if(args[0].equalsIgnoreCase("add")){
That return is why
If its on discord I will manage (or more like yeet) those alts or adele sadly we are not forum staffs :(
¯_(ツ)_/¯
we can do it better I just erase their existence, gimme an addres
Dont think im logged in on spigot forums on my phone lol
someone made a resource with a dick pick as the onyl content
@worldly ingot pls deal with whatever is happening
and it links to a gay porn site
Ohh...
It was because i got too many things and i tried to clean some of it up and i maked some errors becuase of that
no suck
oh pls tell me thats not that oddball wiki entry I seen
Choco you can clutch this, we believe in :)
how could you
Thanks choochoo
Tag me again if choco cant deal w it and ill go start my pc
That was indeed a penis
okay is the IRC channel still alive?
where the bleach
I got it lol. Sorry. I’m dog sitting for my grandma rn
Dog tax?
what dogs
Uhhh, a yorki-poodle mix and a regular yorki iirc
not gonna comment on the picture
I think paper dealt with the same guy, maybe we could ask them for a banlist? (Maybe this is the wrong chat but yeah)
send photo
I'm surprised discords image filter didn't get that
If it’s super urgent sometimes I preemptive ban after talking to some Paper gents
omg its still up? lulz
its not
no
Oh is there a Discord image too I missed? Or did Steel get to that?
Conclure got it
Yeah fairs
O oki
yeah
is his main spigot acc banned?
and one wonders why have no pre-loading turned on...
Yes
Ella and Ariel
At least the one that posted the resource
if possible can one of you just keep their eye on this channel just incase
so small
Im here dw
They’re smol yes
does your grandma live in an RV
Yes
Opposite of the huskies
I’m in butt fuck nowhere ville rn
Even more so then normal?
Exactly
choco visiting IRC with me atm
I am?
your name is here
If I’m in the IRC still it’s probably just my bouncer lol
damn choco so rich to have a boucner
I haven’t logged into it in like 4 years
same I didnt even think it was still up
@remote swallow just let us know if guy attempts anything further, ill be checking in here every so often still tho :)
thought that was all transisitioned to discord
will do
Epic
im dumb. other players can see the outer layer of the skin. but i can't see the outer layer of my own skin unless i die
we could use a permalink for here though I could then put that on the wiki front page and not the IRC link _
Do we not have a permanent invite?
I dunno why Im asking
meant for in this channel since was putting it on the wiki but okay
Oh I believe not sadly
or not nvm apparently someone locked it
Oh :>
that or someone yanked my wiki editor rights dunno
god fucking dammit
Google is quick
i will never unsee the picture 😭
why do i feel like it was his, not even a random one from any porn site
it looked too basic
Omg its actually reallll
i hope discord doesnt ignore my report like it did for the past X years
ItemStack lobbySelector = new ItemStack(Material.NETHER_STAR);
MaterialData test = lobbySelector.getData();
test.setData(Byte.valueOf("debug"));
lobbySelector.setData(test);
return lobbySelector;
Does this work?
lol
u should try
?tryandsee
But I havent seen any1 since 1.8 use mat data
mmmm mats
how to get opposite value using instanceof? !(clickedEntity instanceof Player) isn't working
add more ( '
opposite value of instanceof?
not only that you can even get the casted variable directly
if (!(something instanceOf Something something2))
crazy stuff
should request for instancen’tof
all cool kids use java 17 these days
soon 21?
less boilerplate without destroying readability is cool
you even following what they add or take out?
i like where java is going
virtual threads are very hype
java was always seen as the enterprise language
Based
which is usually ultra LTS
enterprises dont like updating
i know many critical front ends use java
virtual threads... hype for those who cant afford real multithreading
Java 21 won’t be Lts for another few years
??
Well virtual threads is still really multithreading
Its just that a java thread wont be lifetime bound to an os thread per say
literally replaces the need for extending thread
key is you need an OS that can handle it...
Can you detect a left click on someone who's in creative?
ask windows how many threads my TR4 has
you can listen to the interact event then check the game mode of that player?
I think its a shame j21 wont likely ship structured concurrency api, but given its radical changes it’s understandable
Like the PlayerInteractEntityEvent, because that only works for right clicks
21 prob will touch base on it once they know the core of 21 working then push it in 22
it’s interesting to see it keep changing as it keeps trying to follow java’s mission but at the same time not
🙏 i hope we get packets for creative player inventory
PlayerInteractEvent
and for inventory opening 🙏
Yeah well its still preview for j21
what concurrency stuff
is there anyway to create a fake Player and put something in his inventory?
there are many ways to create a fake player
Jep 453 epic
What’s the use case of putting something in it’s inventory though?
i don't want them to be in the map or anything else
i just want to add some item to their inventory
i don't care if the item does not exist anymore
(And 446)
i'm using an api from a plugin
it needs a player by force, gives them some items for some stuff
i dont want the item, i just need the rest of the work by the api
so for this API, you’ve verified it’ll take a fake player or does it require a real one, for creating a player you’d probably need to use NMS
i'm sure it just adds an item to their inventory and nothing else
this is the decompiled code of their api
the only work with the requiered player object is this 4-5 line ^
Still confused on why you’d need to do this, regardless, look up how to create a fake player with nms on the forums, there’s a resource out there.
the NMS can returns a Player?
NMS nothing to do with Player
im trying to make Wave function collapse but only 1 tile exists? when i run /wave it just place 1 stone at ~-25 ~ ~-25
There's also the MockBukkit library, if you're looking to write tests for your plugin. This allows you to create a mock server and add fake players to it.
ig if i create a custom object implementing the player and provide the methods which api needs but doing nothing with it will be fine
for example:
public abstract class FakePlayer implements Player {
// Add a method to mimic the behavior of the API call
public void addItemToInventory(ItemStack item) {
// Do nothing, this is a fake player
}
}
Basically mockbukkit
Yeah, sure, depends on your use case
it seems a little unnecessary since MockBukkit already has all that
Reinventing the wheel is usually pretty hard
btw what abstract means? the ide was saying implement the Player class methods or change the class to an abstract class
Yeah another thing u can do is to use mockito + Junit , if per say an entire emulation of the server is not needed
i just need 2 methods
for that api
^
Basically a class that can't be instantiated, but is meant for subclassing etc.
xii what exactly ru trying to do
an api method from MTVehicles needs a Player
* Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).
* Abstract method: can only be used in an abstract class, and it does not have a body. The body is provided by the subclass (inherited from).
From w3schools
when i use this method of the api the Player may not be online
That sounds catastrophical
i can't give any player to the api method, because it adds an itemstack and sends a message
Why not just use a database or something? And read from that when the player logs in
Sounds like a very hacky workaround
Im quite sure mtvehicles api wont appreciate an invalid player object
this is all the api does to the player
i need to clear all the vehicles in my server every hour, but it has only 1 method to remove the vehicle from the world which it returns the vehicle item to the player, so the player may not be online and i don't want the player to have any vehicle item
Sounds like the API needs changes
then i can't do it with a custom FakePlayer class?
Can u consult the api owner about it?
i told the authors and they told me they'll change it later
Soon™️
yea
Cuz the api does literally not support ur needs as of now it sounds like
Bruh moment
This plugin, does it by any chance have an open source upstream u can link?
Well can u link? Maybe we can access internals to get it to work the way u want it
Since the api clearly doesn’t wanna be of any use
sure
Get the hammer
Coll what are you playing on MC btw?
changing skins yet im being removed from tablist and my outer skin layer is not showing.
im still on the tab and have my skin layer for others, but not for myself
please help
https://paste.md-5.net/irogomaxah.cs
Can I ask u something
sure
Is there any chance u would use another vehicle plugin? Or write ur own?
well i have a lot of custom plugins, for example robbery, bank, gangs, jobs and more
but i don't have any other time for something additional
I dont wanna be mean, but this plugin is kinda meh
well the owner is a nice guy, but because it is opensource he always says "its open source" on issues
Like the whole structure would need a change to allow offline players more or less if I read it correctly
I mean I doubt he would appreciate a pr restructuring his entire plugin
the plugin it self is not well coded enough, the api is worse
Yeah
kek
If u wanna be engineery, clone it and fix the offline player thingy
But it may give you a headache
or i can just don't use a player on that method ¯_(ツ)_/¯
Well doesnt it take a player precisely?
It seems to rely on a static Map<Player,Vehicle> or something similar
Like
:|
the onlyway i want to do this is to removing vehicles on my server which they don't have a driver
the players don't have the permission to pickup vehicles
i'm coding a garage system plugin with their api
More like coding a garage system plugin against their plugin rather than api
I dont see much of an api there tbh
lol
or i can create another method in the api which it just removes the vehicle and has nothing to do with a player
If I had my normal pc I would be recoding it for u at this point, but sadly im not at home
but one thing, due to some reasons i've a bery bad internet connection to clone this repository
do you have the freetime to create only one method for me?
ow
Hmm
I have a potato pc myself
Let me see
(More like a laptop)
Ill clone it and try to fix it now altho in going to bed in 40min
thanks a lot
don't try to fix anything btw
just try to clone that method
and do nothing with the player (don't use a player at all)
it seems they do something else with the player after
Yeah well I’ll what I can do
i get this error when trying to load my minecraft plugin
[18:02:20 WARN]: [NBTAPI] The NBT-API inside NewGods is located at 'de.tr7zw.nbtapi.utils'!
[18:02:20 WARN]: [NBTAPI] This package name is reserved for the official NBTAPI plugin, and not intended to be used for shading!
[18:02:20 WARN]: [NBTAPI] Please change the relocate to something else. For example: com.example.util.nbtapi
This package name is reserved for the official NBTAPI plugin, and not intended to be used for shading! Please change the relocate to something else. For example: com.example.util.nbtapi
You need to relocate it inside of your pom
The official page for the plug-in shows you how to, https://www.spigotmc.org/resources/nbt-api.7939/
so do i delete that file?
What?
so our dev made this plugin and hes offline rn
and all it said when installing it in my server was that
sooooooo
then your dev needs to fix it
it is something you change when compiling the plug-in
Hi there anyone knows what magic happens behind createWorld while a player is already in the server? Or did I get the Respawn packet wrong?
Dimension type is supposed to be an already defined on Login dimension, while the situation above still allows you to join the world (Respawn is also used to change dimensions).
There is no packet for adding dimensions is there any? Or does the client ignore completely if the dimension was defined?
I read through CraftServer and it all seems pretty normal to me
¯_(ツ)_/¯
if you don’t have the source code then you’re gonna have a hard time compiling it
i cant wait another day bc i go on vaca tomm
it will probably work, just might break things if you use that dep anywhere else
could u do it 4 me?
lol im helpless
^^^ read this
the pom.xml isn’t included inside of the packaged jar so i doubt relocation will be very straight forward
yeah it is
really?
ah it does
i cant paste images
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
regardless, it is up to your dev to fix it. You can send him this resource
anyone
just use the plugin as is for the moment, shouldn't break anything at all, not recommending but you have no other option
don't understand your goal from your message, but a problem I see is that you're comparing a ServerPlayer to a Player, and I believe that won't work as expected... Long time I haven't worked with NMS though.
sorry, i'm changing my skin, and other people can see the outer layer of my skin as well as me on the tablist, but i can't see myself on the tablist nor can i see my outer layer in third person. also, where am i comparing a serverplayer to a player?
misread the code my bad, I thought you were defining ServerPlayer player, and not ServerPlayer plyr, and then you have an if statement with player != otherPlayer, nvm
ah, it's fine lol
ugh I hate tablists so much... give me a sec Im reading my code from two years ago hahah
Not sure but probably all slots, i.e players, should have a random uuid instead of the real uuid
you mean when im sending packets to add the player with the changed skin?
You should send code in pastebin or similar, I don't understand what you're asking as well, but the problem is probably on line if (entity.getType() == EntityType.SHEEP) return, it should be != instead of ==
the name of your listener is different from where you defined it
you defined it as RNDm
but is trying to instantiate RndmListener
how do i generate a random uuid?
UUID.randomUUID()
ohh, where should that go? as i don't use uuids when adding players, only when removing them
remove Listener from that
what error are you getting?
your listener isn't in the listeners package then
change your import from net.bruh.rndm.rnDM.listeners.RNdm to net.bruh.rndm.rnDM.RNdm
Nvm my bad, that's for another thing (creating fake players, or empty slots)
oh
i don't really get why this is happening as the only two packets im not sending to the player wouldn't change it
then idk tbh, my code is way more complicated than yours... and can't remember what was the point of it, will try to search a resource for you
thanks, i was originally looking at posts using bytes with the setentitydata packet but i don't know how i would fix it if it's fine for other players
might be useful to understand something https://www.spigotmc.org/threads/custom-tab-list-icons.244687/
why it be doing this
blud uses the +25 zoom
blud talking about my zoom
no, I guess its laptop
its computer
wtf
idk how to zoom out
ctrl + scroll works for me
doesnt work for me
Unsure whether I enabled that or it's the default
then in settings
ah I had to ereplace spigot with spigot-api
sucks that I cant use nms now
uhh
run buildtools
hope you saved
after 3 minutes? That's crazy lol
yeah happens for me too
occasionally it just crashes
and comes back like 5 minutes later
Oh I usually just shut it down after 20 seconds. And then lose the last 15-20 minutes of progress
Maybe I should stop doing that
Good evening, I am creating a KO system under spigot 1.12.2 (when the player dies he is pinned to the ground) what happens is that when the player dies I create an invisible armorstand then I add the player as a passenger.
After 5 minutes, he's automatically revived.
I just have a problem when the 5 mins are up I despawn the armorstand until then no problem but if the player disconnects then reconnects after the 5 mins I do the same thing but this time I can't find the armorstand (the player is sitting on the armorstand in game and it's not just visual).
I've tried several things to test this, firstly I've retrieved all the armorstands around the player but he can't find anything.
I've also tried retrieving all the armorstands in the world to make them despawn, and the armorstand below the player can't be found.
I'm not sure whether I understand your problem.
You want to find the armorstand once the player logs back in? Couldn't you spawn a new one and delete the old one in the PlayerQuitEvent?
I apologize if my problem isn't clear 😅 .
Basically, here's the situation: the player sits on an armorstand, disconnects and, when he reconnects, the armorstand is still visible and the player remains seated on it. However, when I use my code to check if the player is on the armorstand, it returns "false" and when I try to retrieve the instance, I get a null value.
I'll try what you suggest, but I don't know if it will work.
Does that function already exist in 1.12? Is that the one that returns null?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#getVehicle()
And yes since you spawn a new armorstand you can store the instance - therefore what I suggested should solve the problem
declaration: package: org.bukkit.entity, interface: Entity
Yes, this method exists, but the concern I have is that it might not work. In theory, if the player reconnects before the 5 minutes have elapsed, everything runs smoothly and the armorstand is detected.
However, the difficulty lies in the fact that if I decide to reappear a new armorstand and link it to the player as a passenger, I may encounter the same problem when I reconnect.
If you always dismount and despawn the armorstand on disconnect and spawn a new one when connecting, then there is no way you lose track of that armorstand.
If getVehicle() leads to a reasonable result you should use that one though. If it does not, try to run it with a 1 tick delay
I'll see later, I've been working on it for a while but thanks, I'll give it a try.
https://paste.md-5.net/gesefifame.java
why is this slot not showing up?
here is the requestPlayerCouint code
public CompletableFuture<Integer> requestPlayerCount(Player player, String serverName) {
CompletableFuture<Integer> future = new CompletableFuture<>();
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("PlayerCount");
out.writeUTF(serverName);
player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
futuresMap.put(player, future);
return future;
}```
?paste
Why is it null at the end?
[04:50:02 INFO]: [DiscordUtils] DEB - OFF: CraftPlayer{name=SunwooHan}
[04:50:02 INFO]: [DiscordUtils] DEB - OFF1: CraftPlayer{name=SunwooHan}
[04:50:02 INFO]: [DiscordUtils] DEB - OFF UUID: bbd52114-084c-3233-b6b7-2b8bd636b063
[04:50:02 INFO]: [DiscordUtils] OFFLINE PLAYER: null; user.off: null
am i the only one who started to hate ORM's just recently
using hibernate with all of its lazy intializations seems useless and adds overhead to my opinion
Is there a similar feature in gradle?
should be, since i've used paperweight and it downloaded paper and spigot patch comments
for me
plugins {
id("idea")
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
build.gradle.kts
intellij idea
Thanks <3
My gradle is not kotlin, can I do it in non-kotlin version?
bump
plugins {
id 'idea'
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
build.gradle
probs this should work, i've migrated to kotlin recently just because its defacto and dejure default DSL for gradle
you shouldn't need that, intellij will automatically download sources when it's doing the refresh thing
if they're available ofc
☝️ probs he's right, i've never tried downloading it manually tbh
Sorry, I'm new as you can see.
you'll see a gradle tab somewhere on the side bars, in there there's a refresh button, that'll do it
I'd take a screenshot of where it is but computer is ded
Thanks
How can I fix that?
[05:11:42 INFO]: [DiscordUtils] discordutilsuser1: md.mirrerror.discordutils.discord.DiscordUtilsUser@7a850ed6
[05:11:42 INFO]: [DiscordUtils] discordutilsuser2: null
sending a playerinfopacket with ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED fixes the issue of not appearing on tablist. still unsure how to update the skin for the player. found this on the wiki but unsure which packet this is talking about that could change outer layer of skin
how would i update the player's skin layer using the ClientboundSetEntityDataPacket? it takes in a List<DataValue> and i can't find out how to change the skin layer through that.
i tried using a datawatcher but can't find out how to convert it to a List<DataValue>.
packValues on the data watcher
o, like .packDirty()?
packDirty packs all the values that have changed since the last packDirty call
ideally there should be a call to pack all values
but it's probably packNonDefaultValues
i only see packDirty()
it partially works. the first time i run it, the skin parts are shown, but anytime after it doesn't work
sounds like advertising to me
It's a spigot thing but if it's not allowed I can delete the messages
Which exception should I throw whenever a server admin is doing config.yml wrong?
ConfigurationException?
I am reading https://docs.oracle.com/javase%2F7%2Fdocs%2Fapi%2F%2F/javax/naming/NamingException.html but cannot really figure out which one to use
I have different cases of doing config.yml wrong. Like, writing something that's not in the ENUM so it's not valid (doesn't exist). Or if I am expecting them to add more values inside the ConfigurationSection
Go ham and make a custom one 😎
I just skip exceptions entirely and add a fancy log message
reduces the amount of support requests
Hello, I'm trying to override a command registered by a plugin that I depend on, how can I achieve that?
Inject into the command map or use command events
Oh, so by registering it directly to the command map it will override any commands?
Uhh ye
I don't think I will use PlayerCommandPreProcessEvent 💀
Alright thank you, will try it out.
@echo basalt this is my attempt https://paste.md-5.net/owihuvoban.java and it doesn't override /sell command from ShopGUIPlus and if i want to use my own command, i need to execute /sell:sellinstead.
Hm what if you removed shopguis command from the command map
How can I unregister it?
Alright, thanks anyway!
Hi, do you know if there's a proper way to check if a player is onGround? that is completely server side? player.onGround can easily be modified by the client
okay but the main reason for clients to fake this value is for cheats
so if you are just assuming people are cheating use an anticheat
im creating an anticheat xd
ah
check their coords and if the block below them is solid
and they are at the right coords to be directly on it
I mean you can check whether the coordinate is exactly x.0 or x.5 and then if there's a block below his feet.
Slabs make this a little more complex for the .5 part
also remember chains
and end rods
and cakes
and grindstones
yeah will probably do that, I was hoping for soemthing already existing hehe
and like a bazillion other things
Yup, makes me remember the least steep staircase
if want to copy ur checks just use a pre existing anticheat
nope
must be hand made like granny cookies
grims nofall check
no ctr c ctrl v
What you could also do is spawn an invisible entity at the players feet and check if it fell (y-decrease) a tick later
Wouldn't do that every tick but it can be used to check every once in a while
cool idea
sounds unnecessarily intense
Well performance-wise, yes. Time-wise (coding) it probably saves you like 98%
You might have to mess up with game profiles, however, ingame do you see the outer layer? I mean, is it only a tab thing or dont you see it on both game and tab
how to repair item in hand? since 'setDurability' is deprecated
declaration: package: org.bukkit.inventory.meta, interface: Damageable
and to get item in hand is it good to use 'getItemInUse'?
Do you know if there's a library or something I can use to determine if a material is solid based on the server version? like, snow in 1.8 is considered solid but it's not in 1.17
why not jut use Material#isSolid()
smort
because it does not consider the server version, if I build my plugin with the latest api and someone runs the plugin a older version, it may return a wrong value
You cant run a 1.20 plugin on 1.8
...false lol
wdym it does not consider the server version? o0
iirc youd have to add all of the versions you want to the depdencys on maven
The version you build with does not matter since the dependency is provided by the actually running server version
also no
that's definitely the wrong way lol
That's also why you can't run 1.20 functions on a 1.8 server if you compiled with spigot 1.20 as a dependency
But if you have the 1.20 spigot api, build it , then put it on a 1.8 server, if you use a func that 1.20 has its not oging to work
*excluding nms
yes
that is ofc true but Material#isSolid() existed for ages
Ye
then it should work
but if hes using other stuff, and wants to have it run on all ver
latest is greatest
you dont have to add every single version as a dependency though lmfao
"if i build my plugin with the latest api and someone runs the plugin in a older version"
Then add a req for a ver
in ur plugin.yml
you misunserstand
hes saying blatantly false info
Most likely
he thinks that we actually are shading in the entire spigot api every time
and therefore if he used the 1.20 dependency
it would have the 1.20 version of the enum
But he should still add a required version instead of allowing every version
depending on what features hes using
sure
Wait I try to explain my exact problem: I'm checking if the block under the player is solid with block.getType().isSolid();, im building the plugin with compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT' and testing the plugin on 1.8 server. When I walk on snow, (not the now block, just the small slab) it says im not on solid since in 1.20 it is not
1.20 has nothing to do with that?
1.8 claims its not solid
then write it for 1.8
Ye
mmh
the reason its saying what it is is because that info is correct
but you can stand on them D:
If you want the plugin to run, say from version 1.8 - 1.20
okay tho
youd have to check the version of the server
thats not what solid means in minecraft
and adjut the functions to the specific version
ye
oh... ok ty
Eg grass is not solid because you can replace it by placing a block inside
Yeah i use water to get rid of them
But i just wanna build my wall
and all of a suddon
Oh hey im a flower, also fck you
you no place
Strong flower 💪
it can crsuh you tho
shulkers too
Yeah video game logic lol
:-}
63936 anvils
- offhand
yeah i was already accounting for that
ok
72576
ez
also btw stats say abt 80% of servers are on latest 3 major versions
3 major versions of support is my rule of thumb
sometimes for things like nms i only have 1 or 2 just because the 3d version has minimal people left anyways, its just as a final grace period thing
out of that 80%:
1.18: ~5%
1.19: ~24%
1.20: ~51%
like for example rn i think i only have 1 publicly posted plugin with nms
and it does 1.18.2, all of 1.19 and all of 1.20
and i think that covers 79% of servers iirc
wait im looking through these stats
apparently 1.4% of servers are on bukkit???
I still have support for 1.16.1 🥲
i only dropped it since the plugin was getting big ngl
otherwise woulda kept 1.16.5
but either way its better to drop support for older versions imo
i'm using the same library for all my plugins so basically when a new version comes out I only have to update the library and not every single plugin
would be a pain to keep 20 plugins updated
fair
i just dont feel like bothering trying to support an old basically irrrlevant version
and why keep it around in an updated version of the plugin if you dont plan to update its functionality ig is my thought process
maybe im just lazy tho
i just know generally the 3 major version rule works for me
been tempted to make it 2 but i understand some servers are reluctant to change versions but 4 years old is when its just silly
why if I have such a jsion, after I remake it into a map, it becomes in a different order? I figured out the problem and removed autosorting in json, but for some reason it does not correctly add all this to the map
Gson gson = new Gson();
Type skillMapType = new TypeToken<Map<String, Map<String, Double>>>() {}.getType();
Map<String, Map<String, Double>> skills = gson.fromJson(json, skillMapType);
Map<SkillType, Double> resultMap = new HashMap<>();
for (String key : skills.keySet()) {
Map.Entry<String, Double> entry = skills.get(key).entrySet().iterator().next();
SkillType skillType = SkillType.valueOf(entry.getKey());
Double skillValue = entry.getValue();
resultMap.put(skillType, skillValue);
}
Bukkit.getLogger().info(resultMap + "");
return resultMap;
}```
hashmaps aren't ordered, if you want to preserve the insertion order then use a LinkedHashMap
HashMap have no order guarantee when iterating over it
also if your keys are just gonna be numbers, just use an array/list
how's gson able to convert the type from this line?
Type skillMapType = new TypeToken<Map<String, Map<String, Double>>>() {}.getType();
wdym
i've got a serializer myself and i provide the sample in the constructor
Magic
oh, but this means the type erasure is not really true
its not true for class definitions
oh i see
Hey! I'm using PDC on players to store their pets in my plugin, I have two questions:
- Users have been complaining about pets spontaniously disappearing after they logged out, what can cause this?
- Is it better to use PDC for this or, say, SQLIte?
the PDC definitely does not sponaniously get erased or sth
might be a bug in the code
PDC is fine as long as you don't store huge amounts of data, and as long as you don't need to access offline players' data
how do players know their pets are gone when they have logged out
how do you know how to get a pet back from unloaded chunks?
do you store pdc in the player?
The thing is, when I add the pet to PDC, later, when the player opens the menu, the pets are still in there, it just disappears after logging out, and I wasn't able to reproduce the issue locally.
Yes.
ofc they could
yes there could be a plugin wiping your player's pdc on logout xD
but I would fire that plugin
Okay, I'll ask them to test it without other plugins then.
yes and maybe try to find the plugin that causes it so you can reproduce it or report it to the author
Yeah, I will.
since you should only be taking care of your own added pdc, not everyone elses xD, unless the plugin is specifically made to do that like a PDCmanager or smth
it has been a wihle
is there a gui api that allows for shift clicking items into slots for a custom anvil gui?
i am using one atm and it only allows for drag and drop
because i do not wanna write my own atm
I have a question. Is the bungeecord chat API the recommended way to do chat components?
If I understand correctly it hasn't been updates in some time, misses a few features and it is still hidden away behind .spigot() calls.
I know there are other libraries like adventure, but their bukkit adapter is considered legacy (/unsupported?)
why if I subtract from 20 by 0.1 every 2 ticks - my number turns into this?
floating point precision
and the reason it remained behind spigot is due to clash with the non components counterparts
is it acceptable to use the library loader for this? conaidering it is technically a minecraft dependency
I dont know how I feel about shading a library of that size anyway
the library loader is a feature for loading libraries via maven central
i mean for adventure
nah, i assume paper hasn't removed bungee's
abnyone
they havent, but it is stil hidden behind .spigot() which makes me think it is not conaidered stable API yet
it is
it still feels very much like a workaround / experimental API
no lol
this sub class was first used to show the difference between bukkit and spigot
unlike paper who confuses the user
floating point precision
just format it with like 2 decimal spaces
I agree that paper's API is making things confusing. I try not to use it
should round up
thats why i also dont want to use their native adventure support
but then I dont know what the recommended solution is for spigot
legacy messages will stop working at some point according to mojang so that puts the bukkit API in a weird place
https://uploadi.ng/q5NHiYuB do you guys know why on some blocks block.getType() says I'm standing on LEGACY_AIR? the server and the plugin api are both 1.20
even so, i'm sure there'll be an alternative that works seemlessly
Show your plugin.yml
maybe old chunks have legacy air?
would make sense
You didn't set api version
yeah but that doesny really help with what to use in the mean time
?
I suppose the bungeecord chat solution works for now...
Add api-version: "1.20"
I try
if you dont mean to print it out just dont do anything with it
Or use Math.round(Double)
the computer will consider it as 1
That wouldn't work if you still want the decimals
or if you want 2 decimals Math.round(value * 100.0) / 100.0
That's the same as formatting it
EventHandler
public void ORC3(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(DiamondGun)) {
Player player = event.getPlayer();
++Ammo;
Arrow a = event.getPlayer().launchProjectile(Arrow.class);
a.getWorld().playEffect(event.getPlayer().getLocation(), Effect.SMOKE, 10);
if (Ammo % 6 == 0) {
player.sendMessage("§7Reloading");
event.getItem().addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 1);
Bukkit.getScheduler().runTaskLater(_plugin, () -> {
player.sendMessage("§7Reloaded");
event.getItem().removeEnchantment(Enchantment.LOOT_BONUS_BLOCKS);
}, 100);
}
}
}
}
}
help my code doesnt work
formatting turns it into a string though
I'd only use formatting if you actually want it as a string
theres no need to round it
Which is what they want also converting to a double again will just cause the decimals to come back
yeah thats what im saying
yeah but it will fix the precision issue in most cases
unless you have a really large number
Its possible to change title of opened inventory? Proabably I will need open new one, maybe?
yes you can, in current versions
There’s a method for that in modern spigoot
declaration: package: org.bukkit.inventory, class: InventoryView
Ou thats in InventoryView not Inventory... Perfect, thanks
People can't help you if you just say "help my code doesn't work". you need to actually explain your problem
oh well
?notworking
it doesnt apply the enchantment
"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.
i wanted it to apply enchantment if player shoot arrow 6 time
Use formatting for code snippets too. Like this:
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Add sysout messages to see where it stops
@EventHandler
public void ORC3(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().getDisplayName().equals("§9Diamond Gun")) {
Player player = event.getPlayer();
++Ammo;
Arrow a = event.getPlayer().launchProjectile(Arrow.class);
a.getWorld().playEffect(event.getPlayer().getLocation(), Effect.SMOKE, 10);
if (Ammo % 6 == 0) {
player.sendMessage("§7Reloading");
event.getItem().getItemMeta().setDisplayName("§9Diamond Gun §7(Reloading)");
Bukkit.getScheduler().runTaskLater(_plugin, () -> {
player.sendMessage("§7Reloaded");
event.getItem().getItemMeta().setDisplayName("§9Diamond Gun");
}, 100);
}
}
}
}
}
i want it to change item name after shooting arrow 6 time
and it does send the message "reloading" and "reloaded" but it wont set display name
good catch
that is a pretty annoying side effect though
because im pretty sure .getBlock() for instance does allow modification
i mean thats a gun tho
gun need to reload
Did someone say gun
I was refferring to the behavior of getItemMeta
Mojang has entered the chat
oh 😩
setItemMeta?
yes
what about quake? haha
I dont think they care
Is hypixel still running cops and crims?
oh that too yeah
Just retexture the guns to be water pistols
🔫 discord did that
i have no clue what to do with setitemmeta :/
🔫
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName("name"):
stack.setItemMeta(meta);
Yes?
Why would it be impossible
it’s impossible trust me
I mean the method exists for a reason
lets try
I know yall like to add pointless setters and getters all the time but this one actually serves a purpose too
just declare @getter and @setter on the whole project
create a new cve vulnerability
yeah fr fr
Hello, i want use redis for my proxy. So i need a redis server for the devloppement (for windows)
there is this method https://redis.io/docs/getting-started/installation/install-redis-on-windows/
but it requires wsl2 and my pc can only have 1 (I tried it and it seemed to work in 1 so I could do it in 1?). If not, I've also seen https://github.com/tporadowski/redis which might not be bad? thanks in advance.
you dont need wsl for redis
I just have a problem, with this code, double cannot reach zero. it gets stuck at 0.9999... when outputting a number it has 0.1
the github you linked will work exectly how you need and without wsl
you can also just use your server's redis?
yes, but it doesn't seem to be the first version of redis. And the server has been adapted for Windows, so there's no risk of unexpected behavior?
is it worth switching to BigDecimal to get rid of this problem?
what do you mean by that?
as long as it still functions as redis should its fine
i used it before, and it worked as i needed it to
think smart not hard
it uses virutalization?
why do you want to install redis locally if you already got it installed somewhere else
is it better than using wsl?
no
it's not installed anywhere else.
no
i thought you already installed it on the server or sth, nvm then
i only used it because i was lazy and didnt want to boot wsl
on the page https://redis.io/docs/getting-started/installation/install-redis-on-windows/ it only talks about wsl2 using wsl1 I might have problems? otherwise there's docker but I think you need wsl2 for docker :\
did you even attempt to google "How to upgrade to wsl2 from wsl1"
i can't
my processor processor does not have second level address translation and i need it to enable Hyper-v supervisor. Without it passing wsl to 2 generate an error
that's why I was wondering if it wouldn't be better to use redis on wsl1 (I've tried it and it seems to work, but I'm afraid of having problems). Because with the github I can't get redis 6 :\ sinbon I can always see about getting a server.
why do you need redis 6
I prefer to use the last version but yes I can keep the 5.
latest is 7
Hi im trying to put an ArraysList inside mongo but it gives me this error:
java.lang.IllegalArgumentException: Can not set java.util.List field nope.prisoncore.database.repository.User.vaults_items to org.bson.Document
code:
//class called User
public ArrayList<String> vaults_items = new ArrayList<>();
//Manager
user.vaults_items = new ArrayList<>();
Ps: for who is wondering i tried even List, hashmap and String[]
removing the line user.vaults_items from the manager solves the issue but i need a way to store the amount of item and items inside the vault
do you even realize what is happening there?
or
like have you actually read the error u sent?
yes i realized that it cannot cast the List into a Document
so why would that happen
i don't know, that's why im asking
....
probably because its empty (even if i tried using it with the String AIR inside but don't know)
learn to use mongo
i should use document probably?
oh god
please just
figure out the purpose of gson
and then figure out how to use it
and if you have trouble using it properly
then ask someone
they did ask, and all they got were your useless replies
just fixed by myself
Is it possible for a spigot plugin to add pushable tile entities with pistons?
Theoretically, ig yes
coll did
You could crash servers with that, probably
Wdym
Oh
public void hide(Player player) {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
PacketContainer destroyPacket = protocolManager.createPacket(PacketType.Play.Server.ENTITY_DESTROY);
destroyPacket.getIntegerArrays().write(0, new int[]{entityId});
try {
protocolManager.sendServerPacket(player, destroyPacket);
} catch (Exception e) {
e.printStackTrace();
}
}```
Made this code to destroy an entity in the client. But it throws an index error since apparently getIntegerArrays() is empty. Anyone got a clue?
I took a look at HolographicDisplay's packet for v1_19_R3 and it looks fairly similar:
EntityDestroyNMSPacket(EntityID entityID) {
PacketByteBuffer packetByteBuffer = PacketByteBuffer.get();
packetByteBuffer.writeVarIntArray(entityID.getNumericID());
this.rawPacket = new PacketPlayOutEntityDestroy(packetByteBuffer.getInternalSerializer());
}```
I don’t know a lot about spigot so this question may be dumb. Is there a way to inject or modify a game function to change how it works?
Bedrock has movable tile entities?
if (args.length == 1 && args[0].equalsIgnoreCase("kill")) {
for (int i = 0; i < armorStandUUID.size(); i++) {
ArmorStand armorStand = (ArmorStand) getEntityByUniqueID(UUID.fromString(armorStandUUID.get(i)));
armorStand.remove();
armorStandUUID.clear();
player.sendMessage("ArmorStand killed");
}
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("update")) {
for (int i = 0; i < armorStandUUID.size(); i++) {
RecklessGD.getInstance().getFileHandler().setMoneyValue();
ArmorStand armorStand = (ArmorStand) getEntityByUniqueID(UUID.fromString(armorStandUUID.get(i)));
if (armorStand == null) return true;
armorStand.setCustomName(strings.get(i));
}
}```
The UUID probably changed. How do I keep the UUIDs of the ArmorStands static?
@young knoll how did you move tile entities
ASM
oh i thought it was a plugin
It is
Im trying to setResourcePack to a player, but have msg: Server resource pack couldn`t be applied. Any functionality that requiers custom resources might not work as expected
here is code:```java
public static void sendRpToPlayer(Player p, Integer code){
String rpLink = RPDataHandler.asyncGetRpByCode(code);
try{
String sha1Hash = generateSHA1(rpLink);
System.out.println(sha1Hash);
p.setResourcePack(rpLink, sha1Hash);
}catch (Exception e){
e.printStackTrace();
}
}
public static String generateSHA1(String input) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
byte[] hashBytes = digest.digest(input.getBytes(StandardCharsets.UTF_8));
return bytesToHex(hashBytes);
}
public static String bytesToHex(byte[] bytes) {
StringBuilder result = new StringBuilder();
for (byte b : bytes) {
result.append(String.format("%02X", b));
}
return result.toString().toLowerCase();
}```
you didnt know?
I don’t play bedrock much
well I've read the doc https://redis.io/docs/getting-started/installation/install-redis-on-windows/ but I've done it on wsl1 and it seems to work so I think it's ok. (I might get some bugs?)
getIntegerList
I'd just use writeSafely on all 3
What plugin?
Nothing of that exists
Update protocollib then
Damn okay, hopefully it doesn't change much.
Updated it to 5.1.0, doesn't look like it exists still.
getIntLists
Is there a way to edit how the game works instead of adding stuff? Ik it’s a dumb question but I haven’t seen it done
Either make your own client or have a minecraft mod do that.
Well just editing something with the server
like what
Not possible?
be specific
Pistons
more specific
What they can move
I’m dumb what’s asm
he sent it right here
make server fork
plugin???
okay
people dont want to go install a new fork and have to debug any issues that may arise from it just to make chests move-able
Well what if I wanted to make other things not moveable
Got it, but it looks like it doesn't do anything. The armorstand still remains...
Does this mean that the entityId I assigned it is incorrect?
Same thing I’m guessing
add it to blacklisted materials probably
What is that
in colls plugin
when overriding the equals and hashCode methods, only the unique value of the class or all getters need to be compared
its however you should determin if a class is the same
if all values need to be the same you check all values, if only 1 unique value needs to be the same check that
you have to decide
why are u storing uuid as string and also name when u already know the uuid
it's just that the items themselves can be the same, the only thing that's unique is the end time
You should give each auction a unique id
i wouldn't call end time unique tbh
i yea my bad
unless your plugin limits one auction per time
bad
None of that is inheritly unique
endTime unique
No it's not
up to milliseconds haha
Stil possible to have the same end time
Sure
check the player uuid, item stack and price if you dont want to add new fields
That could still match up between auctions
can just give id by checking the size of the database?
what?
sure you could query your database to check 1 equals, but that would be way heavier and take longer than just asigning each auction a uuid
random uuid is not a real random domain right?
Technically you can give each auction a unique numeric id
Using an auto incrementing key in the database
it is highly unlikely to ever get the same random uu id twice
What
end Time is more likely to match?
checking size of db made no sense so i thought it was probably querying the db everytime they want to call equals on it
Just have a primary key that auto increments
And store it in the Auction object with the other data
Can i get and edit an inventory of a player which its not online?
Why do I get this exception?
java.lang.NoClassDefFoundError: club/minnced/discord/webhook/WebhookClientBuilder
at md.mirrerror.discordutils.events.ChatToDiscordListener.<init>(ChatToDiscordListener.java:15) ~[DiscordUtils.jar:?]
at md.mirrerror.discordutils.discord.DiscordUtilsBot.setupBot(DiscordUtilsBot.java:248) ~[DiscordUtils.jar:?]
at md.mirrerror.discordutils.Main.lambda$onEnable$0(Main.java:77) ~[DiscordUtils.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.18.2.jar:git-Purpur-1631]
at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.18.2.jar:git-Purpur-1631]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.18.2.jar:git-Purpur-1631]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: club.minnced.discord.webhook.WebhookClientBuilder
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:153) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:105) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
... 9 more
<dependency>
<groupId>club.minnced</groupId>
<artifactId>discord-webhooks</artifactId>
<version>0.8.4</version>
<scope>compile</scope>
</dependency>
you can. but thats certainly tricky
it involves editing the players data file
youre supposed to shade it into your jar
its also paper...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>true</shadedArtifactAttached>
<relocations>
<relocation>
<pattern>net.dv8tion</pattern>
<shadedPattern>shaded.net.dv8tion</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
nvm, fixed it by changing the building configuration
private void setInvisible(Player player) {
try {
PacketContainer metaDataPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
metaDataPacket.getIntegers().write(0, entityId);
WrappedDataWatcher dataWatcher = new WrappedDataWatcher(metaDataPacket.getWatchableCollectionModifier().read(0));
dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x20);
metaDataPacket.getWatchableCollectionModifier().writeSafely(0, dataWatcher.getWatchableObjects());
ProtocolLibrary.getProtocolManager().sendServerPacket(player, metaDataPacket);
} catch (Exception err) {
err.printStackTrace();
}
}```
oops
Anyways, I am confused on why this isn't working. Currently using 5.1.0 of protocollib.
java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$b (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$b are in unnamed module of loader java.net.URLClassLoader @5ce65a89)```
Seems to be throwing this error.
you probably relaoded the server
if that didnt happen on launch
How to make interactEntity event not work twice
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
oh thx
wrong channel oopsi
if anybody has gpg in their path (windows), can you send me everything that's related to gpg in your path? my path was cleared on accident recently and i'm trying to piece it back, for example I can't compile my api anymore because it uses gpg, which is no longer in my path (adding GnuPG\bin\gpg.exe was not enough)
do you use intelliuj
yeah
add the gpg back into their git thingy
how exactly?
why do you need that on your path? I don't have it on my path and it's working fine
well i assumed it is what caused the trouble because it was working fine before my path got wiped
Settings > version control > configure gpg key
then you're in the wrong place
i'm trying to figure out where my gpg key is now lol
are you using the maven-gpg-plugin ?
yes