#help-development
1 messages · Page 271 of 1
In 1973, Billy Joel released his legendary Piano Man album. Watch the official HD music video for the title track "Piano Man."
Listen to Billy Joel: https://billyjoel.lnk.to/listenYD
Subscribe to the Billy Joel YouTube Channel: https://billyjoel.lnk.to/subscribe
Watch more Billy Joel videos: https://billyjoel.lnk.to/listenYC/youtube
Follow Bi...
?billyjoel
Official Music Video for "We Didn't Start the Fire" by Billy Joel
In 1989, Billy Joel released his album Storm Front, a successful album that hit #1 on the Billboard 200 charts and went quadruple platinum.
Listen to Billy Joel: https://billyjoel.lnk.to/listenYD
Watch more Billy Joel videos: https://billyjoel.lnk.to/listenYC/youtube
Subscribe t...
?billyjoel
In honor of the 50th Anniversary of Billy Joel’s career, check out the original promo video for “Everybody Loves You Now” from Cold Spring Harbor, released this week in 1971!
Listen to Billy Joel: https://billyjoel.lnk.to/listenYD
Subscribe to the Billy Joel YouTube Channel: https://billyjoel.lnk.to/subscribe
Watch more Billy Joel videos: https...
sth like this
we dont need it
?1.8
Too old! (Click the link to get the exact time)
we do
we dont
everyone likes billy joel
we do?
if you don't like him, your music taste is shit
ah
basically modifies it in runtime using ByteBuddy
//MyClass
public static boolean interact(BlockFlowerPot var0, World var1, BlockPosition var2, IBlockData var3, EntityHuman var4, EnumHand var5, EnumDirection var6, float var7, float var8, float var9) {
System.out.println("A");
((EntityPlayer) var4).getBukkitEntity().updateInventory();
return false;
}``` but I want something like this
```java
//NMS
public boolean interact(World var1, BlockPosition var2, IBlockData var3, EntityHuman var4, EnumHand var5, EnumDirection var6, float var7, float var8, float var9) {
return MyClass.interact(this, var1, var2, var3, var4, var5, var6, var7, var8, var9)
}```
String theTruth = "You still haven't found what you're looking for"; //U2
here's proof that billy joel is nice
I am just using a weird theme
no you arent
no idea why everyone thinks that dark mode is awesome
if I could vote for one thing...
I would not choose world peace
I would choose a world where light mode and dark mode users can live together without dark mode users hating on white mode users
I mean
it's kinda racist
"dark" people hating on "white" people
that's racist
also I am supposed to use "light" mode, I only wheigh 60kg
that's only 130 pounds
next time someone calls me out for using light mode, I'll call them out for being fat
how does that sound
40gb, that's half of GTA 5, damn
you don't wheigh 40kg
if you'd wheigh 40kg you'd be either disabled or dead
would i?
well unless your size is only 1.2 meters
im like 5'4
holy shit that's only 162cm
are you really that small?
are you female or sth
you must be very cute
just short
im not
do i have to find some scales
40kg is 88 lbs
i used to weight around 40 kg when i was 15 and was almost 6 feet
lol
what's your fist name?
if you call me by my first name, I am entitled to know your first name too
ok I'll just call you Heinrich then
everyone's so afraid of getting doxxed
meanwhile I'm like "My full name is ALexander Christian Majka, here's my full address and phone number: https://www.jeff-media.com/site-notice/"
exactly
I just wouldn't open the door
they would barge it open
then they must pay for a new door since they broke it. § 303 StGB
but the SWAT isn't even allowed to do anything outside of the US
okay lemme rephrase
everythin the SWAT would do in germany would be forbidden
maybe they are allowed to do stuff in panama, idk
but not in germany
a judge would not approve the swat to smash my door though
and even if he would, then it'd be the city who'd have to buy me a new door
so whatever, I'd definitely get my door replaced
but the chances that this would ever happen are very very low
federal police knocked at my door 2 years ago because I got accused of selling organs
and they searched my fridge for kidneys
(yes, that really happened)
and they just knocked at the door
didn't smash any doors
I also once got sued by Horst Seehofer
kidneys are worth about 100k €
no
how much do you think they are worth?
and also nobody's gonna storm your apartment just because someone claimed "yo zacken02 has TNT in his apartment"
the police would probably just hang up
maybe, if it's a proper kidney
we are talking about black market kidneys
they first of all will ask you "where did you get this information from"
what would you reply?
?paste
anyone know why this is not compiling? (error in paste)
https://paste.md-5.net/idutevujed.xml
yes
3.3.0
oh okay what version should I use?
https://www.youtube.com/watch?v=dIjH6-8AR6g anyway my "Seriöse Alternative" website did some "news" videos back in the days, and we always made fun of Horst Seehofer. Then he sued me and he got granted to be "partly right", so I had to clarify that he does NOT look like an old garbage can, and I had to clarify that.
Seriöse Alternative Nachrichten seit 2017
I believe
thanks
so in the end of this video I had to clarify that he only looks like a garbage can, but that he actually is not one
still erroring???
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.4.1:shade (default) on project miner: Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.4.1:shade for parameter relocation: Cannot find 'relocation' in class org.apache.maven.plugins.shade.mojo.PackageRelocation -> [Help 1]```
?paste pom
was about to say
🤦🏽♂️
basically just remove the whole <relocate> thing
it's supposed to be like this:
<relocations>
<relocation>
...
?paste
rayTraceEntities doesnt target items on the floor?
Location pLoc = p.getEyeLocation();
Vector v = pLoc.getDirection();
Predicate<Entity> filter = entity -> (entity != p);
RayTraceResult r = p.getWorld().rayTraceEntities(pLoc, v, 50, 2, filter);
Entity entity = r.getHitEntity();
what exactly do you mean it doesn't target items on the floor
@dim sandal ```java
final RayTraceResult result = player.getWorld().rayTraceEntities(
player.getEyeLocation(),
player.getEyeLocation().getDirection(),
50d,
2d,
entity -> !entity.equals(player)
);
if (result != null && result.getHitEntity() != null) {
final Entity hitEntity = result.getHitEntity();
if (hitEntity instanceof Item hitItem) {
player.sendMessage(String.format("Player is looking at an item on the ground. Item is: %s", hitItem.getItemStack().getType()));
} else {
player.sendMessage(String.format("Player is looking at an entity. Entity is: %s", hitEntity.getType()));
}
}
Not sure what you mean, but it works for me.
i just installed mc to test that
2x is the only reasonable
🤷 prob agreed, i just dont play mc anymore really. very rarely boot it up. had to install it just to test this and now its closed again for months probably
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html
Has getters for Sound related activities.
declaration: package: org.bukkit.entity, interface: LivingEntity
Would it be possible to have setter methods as well in the API?
Unlikely
Why that?
The sound is part of the client itself, the server can't change that
That's mod territory
You'd want to make a client mod w/ something like Fabric rather than a server plugin
I mean you can just play any sound at any time you want
The server just sends a packet saying "hey client play dis sound"
I think there is a general sound playing function in the World class? Or Player
Not sure, let me see
declaration: package: org.bukkit, interface: World
So just call that with any sound enum entry
Hopefully that's what you wanted
If you wanted to change an entity's sounds to some other enum entries and such, it's a little bit involved. But you'll call setSilent on the entity so it doesn't make its own noises, then you'd use listeners to react to events like the entity getting hit/killed/moving whatever and just playing your own sounds instead.
Would be easier with a mod maybe? but it's doable on the server i guess
You can also debug, using Mock bukkit
Its an amazing library for those situations, when you need to test something
cool
Its allows you to reproduce a fully server and client for making unit testing
But specific for mc related stuff
but isnt that something you would need to control on the client
Good idea, im not sure never have to try it like that
You know make me ask it myself
just quicker for me to spin something up and see it myself than figure out a new framework to mock it
but thats cool
Jitpack is down
Anybody knows an alternative?
I just want to be able to use my github repos as maven repositories.
You don't need jitpack for that.
How to use a Github repository as a Maven repository - how-to-use-a-github-reposiroty-as-maven-repository.md
Repositlite? If you have vps, its a free alternativa, fully written in Kt
if you just want to use a github repo as a maven repo you dont need anything special
ik, but as jitpack is down you cannot use github self hosted artifact, cuz they are host there
You don’t need jitpack ….
Fucks sake
Yes you can
Read the gist before talking out of your ass
respect bruh, dont shitty me
I’ll respect you when you can learn to fucking read
Open the gist. It works. You don’t need anything like jitpack.
Yeah. That’s hard to understand.
Dont do they host on their own infra structure?? which is down
jitpack was down, simple said to use github packages instead
Not even gh packages it’s just using a regular repo and their raw file cdn
didnt know you could do that
Maven is stupid. If the proper file structure exists it doesn’t care
It will use it
ive seen the packages but thats cool
You can even put a basic web server up that has the correct file structure
It will still work
damn
yeah, java and derivated (Kotlin, Groovy, Scala) artifacts are simple static files served in a url
So jitpack/nexus/whatever else are software packages on top of that basic idea that provide security and other features
But none of it is strictly needed
Yeah indeed
How do they do the auth via settings,xml file
I never could make then use the credentials from there on my custom repository app
A GitHub repo acting as a maven repo is implied 100% public. Deployments can only be done via the basic deployment system on a local machine and then you commit it
that gist just seems weird, i get the concept would probably have to find something else online to use it
yeah
Their wikis are really high level to read
doesnt have the best of instructions
What’s so weird about it? You just deploy to a local folder and then add, commit, push just like you do code
I’ll have to write an easier to understand tutorial I guess
It’s not difficult
well yeah but how do i setup the github part of it
Just make a repo
is it just creating the repo?
Yes
Hey stop shtting me
Im being respectful man
I wasnt unpolite with you
Grow up
No wonder you were banned
But whatever I don’t care. If you think you’re the smartest person here then you go do that. Waste your time and resources. Tell people whatever you want. I have no time for this anymore.
Nice bro, you look like you came from paper comm, where they all toxic and when ever you say smth wrong without realize they shitty you. Talks amazing from you
Got to love finally building up the motivation to finally start working on an update for your plugins, an you open the ide up and it's like heres 100 errors, 50+ needs an update
we love that
also where arent you mod
i saw you as mod in help chat the other day
He's mod on luck perms
then i joined lucko's discord to check something and boom
I'm Mod in a few different discords.
That’s me with the thing I’m trying to work on rn omega
Opened ide and I have 70 todos from months ago
Closed ide
Discord mod
Even complained about jitpack cos it's down.. an it's just ugh I just want to update the plugin
Guess lots of people use jitpack
I had to add it, Apparently one of the libraries I added required it
I checked their status page and they’ve been having trouble staying up seemingly. Many red days, some even in a row
I use reposolite
Lets, see how much breaks If i remove it :3
Good luck soldier
thats are skill problems, that type of things must be owned by the comm and not by rich people who dont care about anyone
Ugh... It was Vault api... So Vault api needs it...
That sucks
very
i just thought
why use jitpack when most of this is os
just build to maven local
boom
yeah that would be my temporary solution personally
Apparently even pAPI is complaining about it
I wonder why they went down. I mean check their historical status page. It’s so red. Not sure why everyone is using a service that can’t seem to stay up
Cause its free
I’m gonna post a tutorial on how to host your own repo with GH. I didn’t think that gist was so hard to understand
It's annoying. I don't really want to not use the apis, but then again, it's stopping me from updating lol
Yea, that’s annoying for sure
Ehh, i'm just going to switch to game development for a while then. Can't be bothered haha
if anyone here fucks with github packages would they by chance know the following
name: Publish package to GitHub Packages
on:
push
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'adopt'
- uses: SpraxDev/Action-SpigotMC@v4
with:
versions: 1.18.2, 1.17.1
- name: Publish package
run: gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
``` with the correct stuff in my build.gradle would this just work or would i need more on my end
ok after a tad more researching the GIT_TOKEN wouldnt work so i need to figure out what that is
just tested again... without changing my code... and it works now. I swear ive gone crazy, i was testing it for like half an hour, thanks for opening up that dusty launcher just to test it
np
i mustve had some dubious if statements somewhere that i removed without knowing
HI
I have been debugging a lot and i cannot cancel the second hand / off hand usage
Because i have debug and the messages are double all time, its making my head explode
Add the getHand() to your debug message and see what it says
okay
Im really stressed with this stupid thing, more than 3h 30m trying to solve this
3.5 hours is nothing... Wait till you reach the x amount of days
You never setCancelled.
^ that as well, you commented it out
yeah just for test reason, because my logic is next:
When you have the build on you shouldnt:
- Use off hand (being user and having mode active, if you have the permission you bypass it)
- Not able to interact
uncomment the setCancelled.
ok i will try the code cancelling it*
Also im stupid as fuck, because not canceling the event makes the next code of block being executed 🤡
In my case the else-if being executed, but why does it join into it, if im not using off hand?
That why i really mixed with that
Its two separate events
How md5, i cannot use the same event?
yeah that why. its pretty weird that brokened my self
Now everything makes senses
It was being called both for block and off hand interaction , as far i didnt cancell it the next block of code was being executed
Thanks md5
Okay i realize something, when i right click it detect it as off hand too 🤡
That is causing all the problems
Because as right click is detected ass Off hand, then i cannot place nor breaks blocks inside the area
its finally brokened by brains idk how to do it
how do i get the item which is being cooked in a FurnaceBurnEvent?
apparently Furnace used to have .getInventory but doesnt now, and i am lost
you use getBlock
That will be the block that is being ‘cooked’ in the furnace
Oh wait a minute
Nope ignore that.
getBlock will return the block that is the furnace itself. Then you should be able to cast it to a furnace block and get the inventory itself from that. FurnaceBurnEvent is usually used for detecting the fuel being burnt
I think you want FurnaceSmeltEvent instead.
np
Does anyone know how Lombok works under the hood? How In this example the Getters method are both included in class and I invisible in IDE? As far as I've read about annotation processor it's only triggered on Java code compilation
Yep
Correct
But Lombok generates code dynamicaly or does IDE compile code every time I make change in code?
The latter usually
I want to get the title of my inventory but it says that i dont have the method ??
Title is in view not inventory
and how it is possible that getters are invisible
They're in the compiled code not the source
what do you mean
Well, IDEs make it possible in the way that you get up code suggestions for getters, setters and other stuff that is gonna be generated by lombok
?jd-s
declaration: package: org.bukkit.inventory, class: InventoryView
declaration: package: org.bukkit.event.inventory, class: InventoryEvent
right then
is there any issues id run into with adding lores to almost every item
like would world folders be significantly bigger
No
why error
What event is InventoryView
You can't listen to something that isn't an event
im new to spigot
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
@quaint mantle https://www.spigotmc.org/wiki/using-the-event-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Small bug on my plugin which utilises MySQL database connection
I assume it's because the connection needs to be closed?
yeah better off closing the connection then opening back up when needed
Right, cheers
I think it's because the connection has closed due to inactivity
Nope, The issue was that I don't close my connections after executing queries
Every time a player joins; The plugin checks on the database if the player has a referral
I mean, is there an issue connecting every time?
Yes with higher player count
You'll have more joins
So more connections being opened constantly
Orr
right
Use 1 connection, don't close it
And check isConnected before using
If it's not, you need to reconnect
hm
Or use autoReconnect = true
I disagree, having a single connection leads to queries waiting on each other
So you don't have to do that
Because the connection can only use one thread
Bare in mind the plugin is meant for hubs
It's something I custom coded, a referral system
if a gamemode is shutting down
suddenly like 50 players will be sent to the hub
Lol
Then hikari should be used
Do not hold a connection open by querying on interval for the love of god
Use a pool or close your connection and reopen it as needed
is there priority higher than MONITOR 😂 ?
a plugin decided to use monitor and i need to be higher than that
Try to get your listener executed after it
ye how tho
runTask so your code runs 1 tick later
declaration: package: org.bukkit.event, class: HandlerList
aha whats that for?
It contains all the listeners
You could lower the priority of their listener if you don't mind being hacky
so what you mean is that i can change their priority?
Yep.. I think
The order that the bake() method puts them into a list ig
mhm so i can put myself later or earlier in order then right
is there a tutorial to nms packets?
How can I force YamlConfiguration to save my IP String like '1.111.111.111' instead of 1.111.111.111?
nvm It is unnecessary to use ' ' for strings in yaml
yeah
You'd have to save "'1.111.111.111'" or smth
I would use Persistent annotation over classes then single fields, that would be more flexible
right
rn I'm running test() on start
but I don't get any souts in console
for some reason I only get STARTASDASD in the Console
any clues why?
maybe due to saving process being inside interface
You are running it with Spigot or Unit tests?
try use getDeclaredFields instead of getFields
getFields only returns public fields
but why doesn't it even print out this line?
spigot dont really like System.out.printLine, try Bukkit.getConsoleSender().sendMessage()
ye forgot to accesible it
thx
right now I have struggle getting that Object
its poiting towards screenshot 2
I would guess I have to change f.get(f) to f.get(f.getName())?
what is f
field.get(object)
the object should be in your case instance of LanguageGeek
LanguageGeek geek... -> Object value = field.get(geek)
thx
works fine now
btw should I try using reflections to scan thru all classes in project and save them, if they contain @Persistent?
Im doing that in my project to handle Yaml mapping to objects
I tried doing so via org.reflections.reflections
but it didn't work for me
loading of all plugin classes is a littlebit tricky
for sec I give you code example
why do people do ifAnnotationPresent -> getDeclaredAnnotation
same thing like checking map#contains and then map#get
and reflections is already slow asf
so what the files loading/saving take place only few times in plugin lifetime
you can always say such things
json doesnt use reflections
ty man
*gson, so how it map file to object
\💀
catch
could use an IdentityHashMap for classes as key
good to know, I will read about it
it considers two keys as equals if k1 == k2
Does anyone know how to fix this error? java.lang.IllegalStateException: zip file closed
What are you doing
To get that error
good question... Idk
funny, I found the error now xD
Bukkit.getPluginManager().disablePlugin(this); caused it whyever
anyone know how to remove the ai of an entity?
of which entity?
declaration: package: org.bukkit.entity, interface: LivingEntity
xD
Never knew this existed haha, the more you know
an endermite
thats working with KavinDaGame ' s solution
Endermite endermite = .......;
endermite.setAI(false);
LivingEntity entity = .......;
entity.setAI(false);
how tf do I get interface from class?
reflection
oh thanks
is the keyword instanceof what you're looking for?
I tried 🙂
you can not cast Class<?> object to interface
how do you spawn the endermite exactly with the Endermite class? I usually did this: Entity entity = e.getPlayer().getWorld().spawnEntity(loc, EntityType.ENDERMITE);
If you change Entity to LivingEntity you can call the AI method, alternatively you can change it to EnderMite
yes, this should work:
Entity entity = e.getPlayer().getWorld().spawnEntity(loc, EntityType.ENDERMITE); LivingEntity endermite = (LivingEntity)entity; endermite.setAI(false);
section.getDouble() always return 0.0
was just about to try that, thank you
eeeh im new to reflections; therefore Im sorry for not being able to do such things alone 😄
But what should I pass there? I got rid of that Interface, therefore there isn't anything I can pass there
so basically you gives as parameter Class<?> class metadata, but to make it working there should be provided List<Object> list of objects that need to be saved
then from each object you can get Class, object.getClass()
and use object inside that loop to get field value, f.get(object)
ooooh riight
tysm
the object from which you want to get the field, or null if it's a static field
Person mfnalex;
String nameOfMfnalex = (String) Person.class.getDeclaredField("name").get(mfnalex);
like this
ooh right
wondering how to get that Object tho
as JW said; im trying to loop thru all Objects in Class, but then I dont have Fields
and 🔄
yes that would be much easier 😆
Can be done like that private void save(List<Object> objects) throws IllegalAccessException { for(var object : objects) { var clazz = object.getClass(); var annotation = clazz.getDeclaredAnnotation(YamlFile.class); if(annotation == null) { continue; } for(var field : clazz.getDeclaredFields()) { var value = field.get(object); } } }
right
but I don't have slightest clue how to get those Objects
objectsToSave.add(new ExampleData());```
maybe explain your whole issue again, so I can understand it lol
I mean, you do have a class. And you need to get all the fields from a certain object of that class, right?
public class MyPlugin extends JavaPlugin {
public class Person {
String name = "name";
int age = -1;
}
@Override
public void onEnable() {
Person mfnalex = new Person();
for(Field field : mfnalex.getClass().getDeclaredFields()) {
String fieldName = field.getName();
Object value = field.get(mfnalex);
System.out.println(fieldName + ": " + value);
}
}
}
I have custom annotation Persistent
and Im trying to save every Field inside classes with that annotations.
So thanks to JW's Utility classes, I can get All classes with that Annotation, but I still have no clue, how to get value from those fields
In some place of you plugin, propably OnEnable, you want to create instances of objects that has Persistent annotation
and store then inside of List. So instance can be created manually var geek = new LanguageGeek or with reflections var geek= LanguageGeek.getClass().newInstance()
public static boolean isAnnotatedWithmyAnnotation(Field field) {
return field.isAnnotationPresent(Persistent.class);
}
@Override
public void onEnable() {
Object yourObject;
for(Field field : yourObject.getClass().getDeclaredFields()) {
if(isAnnotatedWithmyAnnotation(field)) {
String fieldName = field.getName();
Object value = field.get(yourObject);
System.out.println("I found a field called " + fieldName + ". It's annotated with my custom annotation. And here's its value: " + + value);
}
}
}
if you do this often though, you should rather cache the fields. reflection is kinda slow
couldn't I just use those classes I get from your AssemblyScanner?
you can make this trick ``` var plugin = JavaPlugin;
var plugin = JavaPlugin;
var scanner = new AssemblyScanner(plugin);
var classes = scanner.findByAnnotation(YamlFile.class);
var instances = new ArrayList<Object>(); //here are objects
for(var clazz : classes)
{
var constructors = clazz.getConstructors();
if(constructors.length == 0)
{
continue;
}
var instance = constructors[0].newInstance();
instances.add(instance);
}```
IK newInstance() for demonstration purpose only
fair enoght, fixed
imma try it right after I get back home
also why do you use var for everything
I use to this code style from job
code is in one line, and you type less
mainly it is beneficial when a class is called like VeryVeryVeryImportantUserService
yo, can i interrupt this real quick to ask a question about blockdata
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Lmao alright
I'm trying to set the state of a block but it won't change no matter what I do. I'm trying to set the growth value of some crops if a certain event is happening on my server
@EventHandler
public void crop(BlockGrowEvent event) {
if(NightCycleWatcher.CURRENT_EVENT.equalsIgnoreCase(NightCycleWatcher.BOUNTIFUL_DAY)) {
//The crop growing event is happening. Crops grow faster in this event
Block block = event.getBlock();
Material type=block.getType();
switch(type) {
case BEETROOTS,WHEAT,POTATOES,CARROTS,NETHER_WART,MELON_STEM,PUMPKIN_STEM,COCOA:
int growthChance=ThreadLocalRandom.current().nextInt(0,3);
if(growthChance==1) {
Ageable ageable=(Ageable)block.getBlockData().clone();
ageable.setAge(ageable.getMaximumAge());
Bukkit.broadcastMessage("Bonus growth! (" +ageable.getMaximumAge()+")");
block.setBlockData(ageable);
}
break;
default:
break;
}
}
}
Oh god the formatting
This is my code. Bukkit.broadcastMessage fires just fine and retrieves the correct maximum age of the block (7 for wheat) but .setBlockData seems to do nothing
Essentially it should set the crops to max growth
what the heck is that
var plugin = JavaPlugin;
what's that o0
you have to call .update() on the blockstate after that
oh wait
you are using blockdata, not blockstate
sorry mb
Lol np, I searched the forums and came to the same result
well actually not my bad, you said "state of a block" yourself 😛
Heh
does it print the "Bonus growth" message at all?
I believe everyone understand what that line should mean
I doubt it
I mean that's like saying
String name = String;
what the heck is that supposed to mean
imma try it like so
If I make an ArmorStand ride a player, it will dismount if the player goes under water, right?
I don't think so
ermmm what the heck is that
this is not gonna work
yep found same answer 😄
for(var clazz : classes)
{
var constructors = clazz.getConstructors();
if(constructors.length == 0)
{
continue;
}
var instance = constructors[0].newInstance();
save(instance)
}```
try this
tried but sadly no result
and that save method is looking alright?
Hi, i have a question. (Serialization via GSON)
I have a Map<Enchantment, Integer> and i want to serialize it so, that keys of the resulting objects are like minecraft:something, but when i actually do it, it is of form Enchantment[...], which i don't like. How can i fix this?
propably will fail for some fields that has more complex types
register a typeadapter for a Enchantment
i did
@JsonAdapterFor(Enchantment.class)
public class EnchantmentAdapter implements JsonDeserializer<Enchantment>, JsonSerializer<Enchantment> {
@Override
public Enchantment deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
return Enchantment.getByKey(context.deserialize(json, NamespacedKey.class));
}
@Override
public JsonElement serialize(Enchantment src, Type typeOfSrc, JsonSerializationContext context) {
return context.serialize(src.getKey());
}
}
looks to be working fine
I just get little spam in console
wheres the annotation for
maybe do @Ignore annotation to get rig of unwanted fields
JsonAdapterFor is a custom annotation i made, but i am sure it works cuz it deserializes correctly
right right
tysm
or use transient keyword like Fourteen said
people be using stupid annotations
right right
but idk why it warns about ConfigurationKey, while the class doesn't have any
Maybe something during saving ?
Is it possible to somehow lower the nametag of an ArmorStand?
I made a small ArmorStand ride a player to preview text above the player, but it's a little high 😅
I could make it a Marker, but that would make it too low...
Using an Arrow + Marker Tag would be the perfect height, but always seeing an Arrow sounds annoying
Hi, how to send a packet to client that CHANGES the state / content / properties of an entity?
I have a bukkit Entity, an ItemFrame to be precise.
This ItemFrame has a content.
I want to make the client think that this ItemFrame holds another item (without changing it server side), so essentially I'd like to send a packet that makes the client update its content (purely visual) even though it doesn't happen for real
Hey do you know why I have this error ?
@tender shard any clue?
Also could you link me again the website that gives all mojmaps and their associated CraftBukkit namespace and their obfuscated namespace?
what error?
ah thx
how can a 👡 scream
how can tokyo get destroyed
nuke
Where can I post my error ?
?paste
fuck
fuck
not helpful
send the whole class
please just click control + a
i need the line numbers to line up
How to setup NMS usage in intellij ? (the unobfuscated way)
That's better?
yes
if(e.getClickedInventory().getName().startsWith("Report")){
by bet is on they didn't click on an inventory hence the inventory is null
no you need to do a null check on thge inventory
but this is a horrible way of doing it
what meme is that class
^
380 lines of horror
How can I fix it?
idk use inventory holders or a proper inventory GUI lib
and dont hardcode slot numbers
bruh moment but how can i simplify this without breaking the logic
packet to change content of ItemFrame clientside
can someone tell me why my blockbreakevent doesnt work. it has an eventhandler and is registered but the plugin dont call it
((Directional) data).setFacing(BlockFace.valueOf(section.getString("face")));
block.setBlockData(data);``` ``` java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.Directional (org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData and org.bukkit.block.data.Directional are in unnamed module of loader java.net.URLClassLoader @5c29bfd)``` im trying to set the direction a block faces
i am trying to place powered rails with a specific direction , or at least get a BlockData object that represents a powered rail with a certain direction , through the power of google and chatgpt i have no clue what to do, everything google says is a decapratied thingy and some of the few things that chatgpt says should work cause errors in console so i need some help
here are some examples of my code
BlockData data = mat.createBlockData();
Directional face = (Directional) data;
face.setFacing(BlockFace.EAST);
data = face;
return data;```
```@EventHandler
public void onHangPlace(HangingPlaceEvent event){
if(event.getItemStack().isSimilar(ItemManager.getBob())){
event.getBlock().setBlockData(BlockDataManager.east(Material.POWERED_RAIL));
broadcastMessage(event.getBlock().getLocation().toString());
}
}```
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
its a question you just need to read it
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
World playerWorld = player.getWorld();
Bukkit.getConsoleSender().sendMessage("BLOCK BREAK by " + player.getName() + " in " + playerWorld.getName());
ConfigManager worldConfig = new ConfigManager(instance, "worlds/" + playerWorld.getName() + ".yml");
player.sendMessage("Debug 1");
if(event.isCancelled()) return;
player.sendMessage("Debug 2");
if(!worldConfig.getFile().exists()) return;
player.sendMessage("Debug 3");
if(!instance.buildModeIds.contains(player.getUniqueId())) return;
player.sendMessage("Debug 4");
if(worldConfig.getConfig().getBoolean("world.archived")) return;
player.sendMessage("Debug 5");
event.setCancelled(true);
}
Its a normal breakEvent
?paste errors
that too
How do you register it?
yeah its only the blockbreak event
its the marked line
can i have help with this
[Penumbra] Enabling Penumbra v1.0-SNAPSHOT
[08:36:06 ERROR]: Error occurred while enabling Penumbra v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Plugin cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:462) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:196) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:187) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.scheduleSyncRepeatingTask(CraftScheduler.java:182) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at penumbra.penumbra.Penumbra.onEnable(Penumbra.java:22) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[bukkit-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:334) ~[bukkit-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[bukkit-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:511) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:437) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:576) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:395) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:242) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:947) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:285) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3566-Bukkit-c379a6b]
at java.lang.Thread.run(Thread.java:833) [?:?]```
?paste your errors please
Then send the link lol. Pastebin is so that you don't clog up the channel with extra long messages
bump
What is on line 22 penumbra.penumbra.Penumbra.onEnable(Penumbra.java:22)
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> {```
it is
Send the whole class in a pastebin
wait so where do I do it sorry I just woke up
ooooooo lol
its loaded, i cant break blocks when plugin is loaded but i dont become a response
yeah but there is no plugin with a break event
I would like to set an NBT tag on an item, but is is not working.
can someone please enlighten me?
?pdc use pdc instead
Thank you so much
it helped me a lot :)
bump
Directional directional = (Directional) block.getBlockData();
directional.setFacing(BlockFace.EAST);
block.setBlockData(directional);```
What's the smallest Entity that can be made invisible? 🤔
i think its a pufferfish
i didnt do any kb modifications, ans even so i take that much kb that i cant touch ground, it hapend randomly
did anyone know such bugs?
on 1.8.8 server
Too old! (Click the link to get the exact time)
Is there a way to have an invisible AreaEffectCloud?
same error java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.Directional (org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData and org.bukkit.block.data.Directional are in unnamed module of loader java.net.URLClassLoader @5c29bfd)
Expected it to throw an exception, but seems to work, thanks
Plugin NametagEdit v4.5.11 generated an exception while executing task 23259
The errror i am getting
Directional directional = (Directional) block.getBlockData();
directional.setFacing(BlockFace.valueOf(section.getString("face")));
block.setBlockData(directional);
block.setType(Material.valueOf(section.getString("material")));```
ignore the random indents idk what happened
They dont have discord
the block can be anything
then id need to do that for every material
the material can be anything
im getting the direction a block is facing and then setting it the same way it was facing
it can be any block not just a chest
java.lang.Throwable: Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.
WHY ?
but im testing with a chest which ofc can be rotatable and im getting that error
so i dont understand
this is the only part that has to do with this nothing else would be useful
is there anyway to access the /plugins/update folder?
how?
checked almost all spigot post
I mean is there any method like "getDataFolder()"
to access the update folder
so anyway to access the server root folder?
how? (by spigot)
Hello fellas
Updating the API used in my plugin from 1.16.2 to 1.19.2, successful buildtools build but when I switch the library in eclipse, nothing is recognized and none of the imports work, what may I be doing wrong?
getDataFolder().getParent().getParent or smth
Bukkit.getWorldContainer()?
Are you using nms?
Is there a way to somehow reset the last time a player slept to prevent phantoms from spawning even without the player going to sleep?
I know the NMS entity player class has some sleepTicks field but idk if thats what im looking for
(Just jokes though, but I didnt acc know people called it that)
I am not
How did you import Spigot to your project?
Are you using the jar directly or something like maven/gradle
I imported the jar directly as an external library
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
.
Basically what i want to do is to stop phantoms from spawning even when players havent slept for longer than 3 days
(i know theres some shitty gamerule for that but thats not a solution for me)
Doesn't look like there's a good way to set that value
As I said i know theres this sleepTicks field in entity player but idk if that the thing that the game uses to determine whether phantoms will spawn or not
or actually i dont know what the value of this field means in general
if it is like time in ticks since the last time the player went to sleep then it's fine i can work with that
but as i said im not sure what that sleepTicks thing represents?
hm interessting I was looking at the NMS code and it appears to be using the time since rest statistic for phantoms
You can access it with https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Statistic.html#TIME_SINCE_REST
declaration: package: org.bukkit, enum: Statistic
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
How do I return a BaseComponent and not a BaseComponent[]
ohh is it like that?
That wouldve been great
so i can just do like player.setStatistic(time since rest, 0) and thats it?
is there a way to know the name of my plugin file?
like if server owner changed it from original
name of plugin is inside of plugin.yml, its not relevant to jar file
I'm currently playing around with ArmorStands as Nametags to display prefix and name with hex colors.
For some reason, as soon as the second player joins, the first player just sees a gigantic AreaAffectCloud and the ArmorStand doesn't seem to spawn.
It looks just fine for the second player itself though.
The first player is always fine, does anyone have an idea why this is happening?
Here's my current code:
https://paste.ofcode.org/hqJqqHgUyjBmTT8Q8bKgyk
not the plugin name.
I am trying to know the file name of my plugin
oh, smh me not reading
there is getCodeSource iirc
let me find real quick
String jarPath = ClassName.class
.getProtectionDomain()
.getCodeSource()
.getLocation()
.toURI()
.getPath();
It will return full path, just extract jar name after last /
thanks
What would I need to add in my if statement so that my custom item can generate a random item?
public class ItemHandler implements Listener {
public void PlayerInteractEvent{
Player player = event.getPlayer();
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
}
}
}
Im not sure what exactly you want to do?
How do I get item's material data correctly? I'm trying to use this below, but it pop-ups an error:
Material.REDSTONE_BLOCK.getData()
error:
java.lang.IllegalArgumentException: data should be class org.bukkit.material.MaterialData got class java.lang.Class
I am trying to generate a random item by just right clicking with a custom item
outdated AI
get random value of Material enum and make new itemstack out of it ig
Yeah must be the ai
so ig just use the item value of another item and make a new item of out that?
time to learn java
ong
i mean java 14 isnt that old @ivory sleet
what
Its old enough kacper
i'm trying to understand what you are saying
I am new to using java
kinda
Im saying to get random value from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html enum and make new itemstack out of it, I cant really think of better approach
declaration: package: org.bukkit, enum: Material
oh thanks for the clarification
i'd first go about making a list of Materials which are items
you can use Material#isItem to check if a material is obtainable
you could get all elements of the enum using Class#getEnumConstants by doing Material.getDeclaringClass().getEnumConstants() then loop through those, check if it's an item using #isItem(), add it to a list, and use that list to create a random itemstack
i'd do this in a static block
it might not be the best way to do it but it's a simple solution
Please? :3
okay so basically I might be stupid but I can't figure this out lol
@Override
public void onEnable() {
HashMap<Integer, Integer> goldenAppleMap = new HashMap<>();
AtomicInteger totalAppleCount = new AtomicInteger();
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
Bukkit.getServer().getOnlinePlayers().forEach(p -> {
Inventory inv = p.getInventory();
if(inv.contains(Material.GOLDEN_APPLE, 24)) {
for (int i = 0; i < inv.getSize() - 1; i++) {
ItemStack item = inv.getItem(i);
if (item != null && item.getType() == Material.GOLDEN_APPLE) {
if(item.getAmount() > 24) {
item.setAmount(item.getAmount() - 24);
} else {
goldenAppleMap.put(i, item.getAmount());
}
goldenAppleMap.forEach((slot, amount) -> {
totalAppleCount.addAndGet(amount);
});
if(totalAppleCount.get() > 24) {
goldenAppleMap.forEach((slot, amount) -> {
while (totalAppleCount.get() > 24 && inv.getItem(slot) != null) {
item.setAmount(item.getAmount() - 1);
}
});
}
}
}
}
});
}, 0L, 5L);
}```
tf
?
youre clearly really creative
ooooo
i don't think you need to make it an atomic integer if it's a synced task but i'm unsure
what are you even doin
it must be effective final if its inside of lambda
I'm trying to make a plug-in where you can have a certain amount of one item in your inventory at once and if you have more than that set amount it will you cannot pick it up
iirc there is api methode for it ?
ooooo
i think there is an item pickup event
something like Inventory#containsAtLeast ?
just listen for the item pickup event lol
lol
i'll check docs for the exact name
you don't have to use the scheduler
PlayerPickupItemEvent
ops
you should also probably listen to when they grab stuff from a chest too
i dont know why i cant click my messages?, does anyone know whats wrong?
mmm yes
or any other container but chests came to mind first
Fixed it, the problem apparently was that I created them as soon as the players joined.
I'm now waiting 10 Ticks, that seems to work just fine
Bukkit#getWorld loads if the world isn't loaded?
Why the getHand() is Equipment.OFF_HAND, when you do right click and also when you interact with the slot itself? Doesnt make snse the first thing tho, im using PlayerInteractEvent and im just trying to block off hand usage, without cancelling placing nor breaking blocks
Really i have been such a long time debugging and i never could block the second hand usage tho
public static CompletableFuture<Integer> getDeathbanAmount(OfflinePlayer target) {
return CompletableFuture.supplyAsync(() -> {
try {
PreparedStatement statement = plugin.getConnection()
.prepareStatement("SELECT COUNT(*) FROM deathban_history WHERE UUID = ?");
statement.setString(1, target.getUniqueId().toString());
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
return resultSet.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}
return 0;
});
}
(used for PAPI placeholder) screenshot is what the placeholder returns
Oh, well how was a world loaded again?
Worlds are generally cached, so when they are not find in cache, they start looking on disk
Mainly how processors cores works
oh, world creator
World creator, loads the world so its cached
okay, yes you need to use WorldCreator for loading words
Did you call toString() on it?
String#valueOf() yes
case "deathbans":
return String.valueOf(DeathbanHelper.getDeathbanAmount(player));
nice placeholder lol
Conclure i was going to suggest something like a callback
so like, how exactly
@FunctionalInterface
public interface callback {
callback(ResultSet results, boolean done);
}```
is the callback way even supported for papi? doesnt it just require a value immediately so you must join the future?
oh yes, right you must need the result at the moment with papi
like in the onPlaceholderRequest method or whatever
when I return Integer in the method instead of CompletableFuture and join the future it crashes the server (time out)
Yes, because you are joining on main thread!
how does that crash your server
As the sever use 1 thread, the server is closed
\🤔
CompletableFuture joins method, joins/stop the proccess from the current thread talking about if you havent pass an executor to CompletableFuture
That is what im making reference
why not just cache those bans for each player? i hope a player isnt making a streak of it
That why i never like working directly over database, i try to catch them so then you dont have that type of issues
yeah, catching the user for example, so i dont need to call db all time for getting his data
idk people have all kinds of playstyles
hello, i have a weird question that i dont understand
i am trying to make my messages run commands
but for some reason the closest thing i can do is make it suggest commands
whats wrong and how would i fix it, i cant find anythong online
i always use the componentbuilder and it always worked
yeah
what yeah
I think you must use the component builder but im not sure
would surprise me but whatever
I dont wanna said wrong things because a guy shitty me yesterday bruh
for just saying smth wrong which i didnt realize
so um, how do I do my placeholder thing again?
I would suggest not working over db, isntead works over cache
...
Make a cache design, where you have your user data cached and you dont need to query at the time, so that will fix the issue
So it was what i have said?
.
so I put all their deathban amounts in some sort of list when they join and keep that list up-to-date (cuz the placeholders are really only for online players anyways)
I would make something like:
OnJoin -> Look for user cache, if doesnt exists load user data from db
OnQuit/OnKick -> Save user cache to db, if db doesnt contain it create it, if not just update their values
Also you have to save your data periodically, in case servers goes down that can be done by a runnable every x amount of time
When doing important changes must be directed updated to db
hmm, component builders look nice, they are indeed way better, but it still doesnt work though
For some reason only the RUN_COMMAND doesnt work, the hover and suggest all do
bruh sorry man, now no one can said something wrong they all get mad 🤦♂️
Yeah yesterday a guy shitty me because i said smth wrong without realizing and now you being like that
What is happening to spigot comm it didnt use to be like that, i thought that was 10x better than paper comm
okay
So i want to improve my cache skills
So i just need to load from db into cache when i need right?
okay thanks man and sorry for what ive said i was mad with shity off hand issue
Elaborate a bit more
that cache may be unsynched
When i need to use it sync in others server i prefer redis cache
Yeah thats what i done all time
fuck is unsynced with a h
For single server db, plugin cache
For multi servers db, redis cache
Because you cannot always depends on an external database for just a single unsync plugin cache
I got this error
This is my code:
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
what error
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Itemstack
what itemstack
bruh where is line 83
are you kiddin me
no?
first guess is that your e.getInv().equals() throws that npe
i just used this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Which actual line is 83?
line 83 ofc \🤡
Could someone explain me, why the getHand() of the PlayerInteractEvent event is equal to Equipment.OFF_HAND, when you interact with the secondary hand or when you make right click. The second one is causing me problems, because when acting that way it cancels the events of placing and/or removing blocks
?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
}
its called once per hand
so will be called for main hand and off hand pretty much
Wait i wiill place my code? Because i need to cancel the second hand usage but also cancels placing/removing blocks
Its making me stress a lot because i cannot figure how to fix it
just cancel off hand events?
average programmer with a bunch of stress
Im doing that, but as far a placing blocks is taken a second hand action, so if i cancel second hand, then i cannot place blocks too
That is what im making reference and making my brain to burn
?paste your code
How to update an entity on someone's client, without updating it on the server? (Essentially, I just want to update 1 field / 1 setting of the entity and keep the rest intact)
Here is my progress so far:
- I realise I have to use nms for such trickery.
- I found that sending a
ClientboundMapItemDataPacketto the client might do the trick. (previously called PacketPlayOutEntityMetadata) - But in order to construct such packet, a
SynchedEntityData(previously called DataWatcher) is required (as 2nd argument).
For those who don't know what it is, basically it holds the data of an entity AND ensures that its state is synchronized between client and server. But here is my whole issue. I do NOT want the server to be updated, i only want the client to be updated. Which means that if such object contains the data i wanna update on client's entity, necessarily, the entity toward which this object points to also has the update data (for real/on the server)
Please try to read me; i'm desperate. And since no one does NMS i find no help online
I am using my code for a mini game, where I need that in a certain region they
can place blocks/break,not use the secondary hand and at the same time they cannot interact with anything that have an inventory either blocks and/or entities.
event.getClickedBlock().isAir() \😉
But can you explain me, why the heck is preventing for placing/removing blocks tho?
cuz clicked block != null?
But i need it for my main thing?
uhh what were you trying to do again?
here bro
I put on black what i need
id just uncancel the blockbreak and place event
Yes i listen to them too
But interaction is blocking them for some reason
because they cannot use their off hand but they may place and break blocks?
cuz that hand is involved in both those events?
So?
What i would have to do tho
Im already with 0.000001 brain working caused of that messing issue
😮💨
id just uncancel block break and block place
cant really assume that it was your plugin that cancelled it but whatever
Bruh
I dothat
But PlayerInteractEent is acting as super class, because it fck cancelling those events
Sorry fourten, i raged my bad man im really weird with this problem
void onInteract(PlayerinteractEvent event) {
// blablabla
if (event instanceof BlockBreakEvent blockBreak) {
blockBreak.setCancelled(false);
}
}```smth like this?
my head is alraedy full of other crap so cant help that much
Hmn wait is burning brains, because PlayerInteractEvent and BlockPlaceEvent/Break are none related
No they are BlockEvent
That why i came here, because of this
So why the heck, cancelling interact event will not allow the second events (breaking and placing) !!
That the main reason of comming here
what can be wrong here
cuz a blockbreak event fires an interact event too?
i keep on getting an error in console whenever i load my plugin, no clue why since it shows no errors in my IDE and it compiles fine, also i don't think i changed anything but it was working fine earlier
https://pastebin.com/ENVp6jKM
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
okay that makes sense know and its okay, but why before adding the off hand checks everything was okay?
russian segfault ig?
Why in russians?
JVM doesnt have permission to read that resource
it's c++
jvm lol
bruh
c++ != Java?
good somehow becoming a nullptr?
it's not even a resource
it is not*
So let came back to my problem tho
wouldnt make sense but c++ is tricky
NukerFall, you remember you recommend me to use PlayerInteractEvent for cancelling the off hand usage?
to find the childest child(chaddest chad)
idk
what is the best way to convert a uuid in a string into a player. I have an uuid and i need to make in into player so i can use player.sendMessage("message");?
u can do offlinePlayer(uuid) afair
what is the best way to make sure that the player is online?
.isOnline() ?
Validate.isTrue(player.isOnline())
Bukkit.getPlayer() != null
enough for me
Lmao know no one know what happening i love this type of situations
if (player.isOnline()) {} Will work fine for you @west linden
Could someone explain me, why the getHand() of the PlayerInteractEvent event is equal to Equipment.OFF_HAND, when you interact with the secondary hand as such or when you make right click. The second one is causing me problems, because when acting that way it cancels the events to place and/or remove blocks.
I ask because I need to do it in a mini game, where in a certain area you can only place/remove blocks (working), not interact with blocks and/or entities that have where to store things (worked perfectly, until I added the last condition) and not use the secondary hand (causing problems, with the first condition).
Lmao im being like a parrot tho, because no one understand my points
C stuff
casting from string to int
Why wouldn't it equal to OFF_HAND if you interacted with your offhand?
atoi(myString.c_str());```
is c_str needed for that
yeah
what does it return?
it's atoi
c stuff too ig
i guess char array or something
?pate send your code mi hijo
yeah
?paste
Does checking if the player is using their offhand do anything?
char*
Oh dad thanks for comming !!!
goes to c level from c++
whers the c++ equivalent
let me send my code
Yes yes do that
i guess i have some shitty build
going out to get milk again 👋🏽