#help-development
1 messages · Page 91 of 1
Lmao i dont know why im so dumb that i cannot sort a List via Priority int
no
how do I know where the location returned from getLocation() is coming from
so I can modify it directly somehow
getLocation is implemented in CraftEntity
NMS
oh nms
And CraftEntity will pull data from EntityPlayer
CraftEntity implements entity
implements?
Yes
ah
oh
I thought CraftEntity also extended Entity
MB
ignore me
😄
it just has a reference to the entity inside it instead
I've been doing some localhost testing directly on my ide
and I'm testing vector math in particular
async raytracing n all
I bricked my computer countless times already
so you're lucky you're not suffering
but we're getting somewhere
L and F
aka line feed
I might hit up AMD to make a custom SoC to do raytracing a lil better
get a 300w threadripper
lmao
public Location getLocation() {
return new Location(this.getWorld(), this.entity.df(), this.entity.dh(), this.entity.dl(), this.entity.getBukkitYaw(), this.entity.ds());
}
hmm
Was the ability to show players the demo menu removed in the latest versions?
why is that even a thing lmao
Isn’t showing up though in my IDE, only showPlayer.
works for me?
trolling
What version you on?
1.19.2
I built it today with buildtools so it should be up to date
I’m on 1.17.1. .-.
"Was the ability to show players the demo menu removed in the latest versions"
Is it a different in older versions then cause I knew a plugin that had it way before Caves and Cliffs.
it either dealt with packets or used third party server software (aka not spigot)
it's likely just some packet the server can send
and it was just added to the api after 1.17.1
in case you want to remain on the older version but still send the demo screen
Don’t understand packets very well xd.
Since there is player#updateCommands, it there a way to get the commands a player’s client knows that exists?
any idea why this code won't work?
CraftEntity craftEntity = ((CraftEntity) player);
Field entityField = craftEntity.getClass().getDeclaredField("entity");
entityField.setAccessible(true);
Entity entity = (Entity) entityField.get(craftEntity);
Class<?> entityClass = entityField.getType();
Field vec3dField = entityClass.getDeclaredField("aw");
vec3dField.setAccessible(true);
Vec3D vec3d = (Vec3D) vec3dField.get(entity);
Class<?> vec3dClass = vec3dField.getType();
Field xField = vec3dClass.getDeclaredField("c");
xField.setAccessible(true);
xField.set(vec3d, x);
Field yField = vec3dClass.getDeclaredField("d");
yField.setAccessible(true);
yField.set(vec3d, y);
Field zField = vec3dClass.getDeclaredField("e");
zField.setAccessible(true);
zField.set(vec3d, z);
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I thought you could get what is wrong in my code
yeah it's just generally "not working"
Well the answer is that there is no declared field entity
java 17?
Java 17 has reduced a lot of what reflection can do
aaaa
what is that code even meant to do
modify player's location directly
You don't want to know ngl
why?
want to teleport a player without sending a packet
?
also I can't use Player.teleport asynchronously
they will just glitch out and/or resync with a packet immediately
that's what I'm trying to do
and what makes you think you can use reflection to randomly poke fields asynchronously in a safe way
They want to have the player appear in one location to all other players while the player is actually in another
well your code wont achieve that
even to the server
anyway is there any other way to change the player's location without teleporting them
You can always fork spigot and make your own stuff that will cause a tonne of issues 
I want it to be a plugin
so everyone (that has a questionable mind like me) can use it
it is hilarious they keep disregarding those who are more versed
It's also a lack of understanding how client->server relationships work it seems
exactly what I said way in the beginning XD
no I know how it works
I want it to desync purposefully
between client and server
what you are wanting to achieve can be achieved in more simpler ways
Yet you still haven't explained why
and this ^
modifying server side player movement logic
lol
seeing if I can do it another way
just remember, seeing as you don't have control over the implementation unless this is something for your server, just because you want to do something a certain way doesn't mean it will work
anyways back to some pew pew pew
the alternate method (as expected) does not work
you still haven't told us what exactly needs to be accomplished
Day 2 of asking what this is for
if you tell us we would be able to help you go about it most likely in a better more simpler way
so I came up with what might be a nice plugin idea
Does it desync me so I can enjoy rubber banding?
purpose is opposite
actually
AI entity pets/companions. They are entities that follow you and you can teach it over time to do things
Animal tamers
Wait this whole fucking time
kind of, but like actual AI though, where it isn't pre-programmed
you wanted to fix rubber banding
I am not sure what makes it questionable
like you can command it or the player programs it or learning?
the player can command it, but you have to teach it
so it has to learn
but it only learns from the player it is assigned to
It has a skill tree?
whats the size of a minecraft inventory (texture wise)
not really, just AI stuff where you can teach it go mine or do things for you
this way, no two companions will ever be the same and if you lose that companion it is more meaningfull 😄
Ah I see
be interesting to create such a plugin
not sure if a server will be willing to use it though
will need some DB space for sure
like you want the dimensions in pixels or something?
yep
Steal the texture from the game itself?
boinkkk ok
I have a player world changed event. How do I get the location of the player in the world they left?
player.getLocation() returns the location of the player in the world they travelled to
ahhh got it working!
player.teleport then cancel packet
oof
it doesn't actually work
other then going through a portal, they would need to run a command
do it from the command
in getting their location
not my plugin causing the world change
you can still listen for commands even if they are not from your plugin
true, but it is not command caused
not entirely sure but one of the plugins keeps sending the players to world spawn
when they connect?
or when they do /spawn?
or is it upon death this happens
Does anyone know if hotswapagent works with spigot
Hotswapagent + JetbrainsRuntime
I was testing it earlier and getting a bunch of issues
I’ll send the errors in the morning but just wanna know if it’s possible
I cant get "getCustomConfig" to work on my other Classes
@EventHandler
public void onInventoryJoin(PlayerJoinEvent event){
plugin.getCustomConfig().getString("some-path");
}
"Cannot resolve method 'getCustomConfig' in 'JavaPlugin'"
public FileConfiguration getCustomConfig() {
return this.customConfig;
}
Can I have a template of a gradle file for 1.19 spigot + nms? (kotlin, not groovy)
is the "plugin" variable an instance of "JavaPlugin" or your main plugin class?
private final JavaPlugin plugin;
public Sneak(JavaPlugin plugin) {
this.plugin = plugin;
}
plugin = this;
getServer().getPluginManager().registerEvents(new Sneak(plugin),this);
Ye, it needs to be your main plugin class. Cause JavaPlugin doesnt contain the "getCustomConfig" method
I think it is?
what is the class called that extends "JavaPlugin"
(If I know what main means) its my main thats extends it
public final class OreIginPlugin extends JavaPlugin implements Listener, TabCompleter
the main is also passing the plugin var to the listener class
Instead of having private final JavaPlugin plugin; do private final OreIginPlugin plugin;
since JavaPlugin does not contain "getCustomConfig()", it has the "getConfig()" method, but it will not contain any method that you add in your main plugin class (aka the "OreIginPlugin" class)
righty, thats confusingly understandable
Polymorphism moment
List<String> list = plugin.getConfig().getStringList("blacklisted-world");
for (String worldB : list) {
if(player.getWorld().getName() == worldB) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Language.FeatureDisabled")));
}
}
Config:
blacklisted-world:
- world
doesn't work any clue?
Can I have a template of a gradle file for 1.19 spigot + nms?
any error msg?
none
did you save the config before trying plugin.getConfig()? As in having saveDefaultConfig(); in you onEnable method?
yes
everything else work i have a config gui inside in game and work but not this section
How can i reload just my plugin? (i would like to render code changes without restarting the server) (/reload corrupts my worlds)
plugman works for it but for newer version make lag a bit the server
on reloading plugin
Please do not do that
shouldn't it be:
blacklisted-world:
- "world"
```?
Is it this one? https://www.spigotmc.org/resources/plugmanx.88135/
Im stupid thanks
Are there better alternatives?
in YAML hello and "hello" are the same
yes it can
now works lol i just didn't remeber to do /main reload
oh, that's nifty
yep
This can also be blacklisted-world: [world]
i mean i did /plugin reload
hotswapping works with any jar
its not application dependent, however though that doesn't mean you won't encounter problems in an application because it matters how the application is designed
for instance in minecraft it isn't really built in to just arbitrarily expect the player object to just be null if the player hasn't left
exception being when the reload command is used
Set location of player without sending teleport packet
Is it a good idea to store Config values in memory or just get them when you need from the file?
Memoization is a good practixe since RAM is cheap
Always create classes and fields that hold your config values. Dont use FileConfigurations on runtime because they are way more error prone.
And certainly dont load files during runtime because this will cause lag.
Is that why same keys are not editable for me sometimes?
I dont even know what you mean by that. But probably no.
No context
I have make a command thats allow ops to change config values, but one of them will not saved to the file no idea why
On the same command other values will successfully saved only one of them not updated when i open the file or restart server
settings:
global:
spawner:
spawnrate-percentage: 80
spawnrate-delay: 5
spawn-max-entities: 4
stack-size: 64
spawn-distance: 64
distance: 64
skyblock:
save-interval: 300
Only settings.global.spawner.distance can't be writen
Makes no sense. Show some code pls
That sounds like a skill issue combined with a low resource issue.
elaborate
Wrong past
Also make sure to use something that supports code highlights
?paste
like this one
what event is ran when the player gets into a minecart?
declaration: package: org.bukkit.event.vehicle, class: VehicleEnterEvent
does that apply to other mountable entities too?
"Raised when an entity enters a vehicle."
It shouldn't be more prone to error if you are doing it properly; i.e: clearing when you should, synced loading and safety checks for edge cases.
Loading files from the disk should not cause lag; do it in a separate thread and unless you are loading 10,000 100 linefiles it shoukdn't even noticibly impact server performance.
seems fine to me
Also don't use .json
First of all using Strings as keys is always more error prone than having concrete variable implementations.
FileConfigurations are just glorified Map<String, Object> objects. So it is quite important to not use them as
a data structure but merely as a tool for serialisation.
And my statement regarding IO was simplified because shared doesnt have much experience and coming at him
with threads would just confuse him. Also the biggest concern here is not the size of the files but the frequency
at which filehandles are opened/closed.
At whom is this aimed? I think json is great because this format is universally transpilable.
why are they error prone though?
why is it important to not use them as a data structure?
You should be serializing stored data anyway but yeah this is true. Other then strings as keys but I see where you're coming from
.ini > .json IMO
Smaller, more robust and more compatible overall
Imagine if you want to access your FileConfiguration at 3 different places. Then you would have to make sure that you dont
have any typing errors in the path. And you wont have any compile time exceptions (like you would have with variables) that would tell you where the problem is.
Yes but those would be glaring bugs that are easy to fix
Also String[] or LinkedList<String>
If you have a fixed size you can use an Array or an ArrayList.
That's true, and you will for keys
If you think that those are glaring bugs then you havent worked on truly big projects.
You want to prevent runtime bugs at all costs as they can be very deceiving. And why
even take the risk of possibly implementing bugs into your code if they can be easily avioded
by writing a more robust application?
Using FileConfigurations on runtime is objectively worse.
Technically the arraylist doesn't need a fixed size but I listed it because lists are just more comfy to use than arrays imo
And this solves nothing. You want to access your keys using
config.getString(paths[17]);
?
I worked on a 760,000 line codebase written in C/++ and Pawn for 6 years 😐
Also performance > certainty. You can then have both when it's fixed.
Makes sense
"performance > certainty" lol
Or config.getString(17); and have getString lookup the key from a getter method
no thats pretty ugly if u ask me
i would have an enum with the paths
if i really wanted to do it
You are trolling me now for sure...
mars climate orbiter cough cough
"Write it buggy now, take the same time to fix it later."
If i would propose this to QA then they would literally laugh and think that im joking.
I didn't say write it buggy, I said you should be confident enough in your abilities to do the job right.
Have you ever heard of SA-MP?
"performance > certainty. You can then have both when it's fixed."
San Andreas Multiplayer
Nobody writes code like this
Actually everyone in the industry I've seen does. Microsoft does.
anyways may i ask a minecraft question
The Linux Kernel and C standard library are both written like that.
I mean eLg apparently thinks this is a good idea.
No they are fking not.
They have 99.9% test coverage and are written test-driven.
i dont think that's a scalable way of writing code
They are actually xD
this is cringe ngl
making errors purposefully just to fix them later
Yes tests catch the bugs
How can I play sounds when a player respawns? Using PlayerRespawnEvent and delaying the playSound by 10 ticks still doesn't produce a sound.
That's not what I said is it?
it is
It's not.
.
No they dont catch the bugs. They lay the constraints. You obviously dont work in software engineering.
"you can have both when its fixed"
test-driven development Read that up
You dont write tests to catch bugs. You write them to enforce software constraints.
The fact of the matter is noone in the industry is going to avoid using standard goid practice because they might make a spelling error in the key-string
Anyways this is taking too much of my time... Read "Clean Code" by Robert C. Martin.
Will convert you.
smh
thats way too long
Object literals are very useful and they often make your code easier to read and understand. String literals are a bit different, though. It is true that a string literal is the easiest solution to create a String object. It is straightforward and everyone understands what is going on. But there is a price you pay every time you use a string l...
i wanted to do that earlier but its too boring tbh
Was that not written in the 90s?
2008
Its the industry gold standard
90s not 1900 and IDK what book I'm thinking of then
mb
So you are agreeing with me now?
Wat
If you think memoization is an argument contradicting my point then you didnt understand it.
Okay but memoization is what I've been talking about this entire time. How would YOU suggest for example loading a dynamic player property from a file?
You need a simple x, y, z.
I would first of all avoid having one file with all player data in it.
05408439-23db-48a6-be80-34298e1f0b89.json
Then it has a weak correlation
You have to find the line containing key 'x' without a string literal to test against.
How are you doing it
so it is checking if the item in someone's hand is air, if it isnt, the code works, if it is, it shows "An internal error occurred while attempting to perform this command", any idea why?
Write data classes. I would not tinker with configuration files at all.
They are slow and error prone.
Like... did i talk spanish?
Anyways i got to go now
do getItemInHand.getMaterail==Material.AIR
that aside no idea
the error should show you a lot more if you bother to look into the console
it just says its null
so like the code works
but the else doesnt work
because it checks if it is air
but it just cant rename it
if the result it gives you is 'internal error' there IS, with guarantee, an error
yea it says right there
or maybe i should just check if its null instead of air
since the item wasnt modified
it doesnt have meta yet
you need to create a new meta and assign that to the item
i have, basically it works if i am holding an item
but if i hold nothing then this appears
ill just check if its null
you really should just check the material if its air
or if the hand is empty i think theres a method for that too
that should work
well... it didnt
did you get a different error?
same thing but im checking something that worked from the spigot forums
so uhh it kind of works
but now when im actually holding something
it doesnt do anything
nevermind
i did something very wrong
So you're going to survey all of your players for the location of their property and hard-code it or what?
You might as well be talking spanish the way you dance around giving direct answers. 🙃
i think the way hes talking is really straight forward
Okay so i got something from the spigot forums and it works, thank you for the help though!
sure
time to ask a REALLY nice question for me now though
so im working on biome stuff
and apparantly i cant get the temperature adjustment value from a biome
does anyone know why? does it just default to zero?
what i understand is that you should use the FileConfiguration only for serialization and data persistence, and use your own data classes to cache the actual data and use it
To answer this you need to give more context
Be more concrete then i can give a straight answer
I have a command and when someone uses it, I want every argument (which is seperated by a comma ,) to be in a list
so like if I do -
/mycommand Oh hi how, are you doing, today sir?
then the args would go in an array like this
{"Oh hi how", "are you doing", "today sir?"}
how can I do this
you know you can split strings right?
I am using stringbuilder to put all the args into one stringbuilder
cant use .split() in a stringbuilder
and cant cast it as string
sb.toString().split(",')
wait you can do that?
yea
what do you think a string builder is for lol
you have to make it a string eventually
making string into more string
cant u just look up the javadoc
ah
iirc that method raytraces along the sightline for a maximum of <arg> blocks and returns null or the block it hits first
i remember doing some item tomfoolery with mining modifiers
if im right, gettargetblockexact returns the block a player is looking at, and maxdistance is the maximum distance because it doesnt have to be within a player's reach or cursor
either that or air
as far as i understand, yes
you mean in hand?
whats your goal exactly
set distance to 5
thats default targed distance iirc
not minecraft reach if thats what he wants though
also make sure not to delete blocks at the bottom of the world
nether
you need to check dimension too
its overworld -64, and nether 0 and 127 iirc
also dont allow players to delete bedrock near end spawn or the ender dragon gets bugged
gateways
but yea
best dont allow block des in end
so the if(args[1]!=null) is supposed to check if an argument with an item name was given so it doesnt return null, but it still does, any idea why?
you should really just allow them to craft end portal frames and break non naturally generated. they're finite and a griefer could just demolish all access to the end
How may I check if a potion effect is positive/negative? (ex: regen = positive, poison = negative)
i think there is a method for that but it might be nms
to be fair thats an issue if someone gets built into bedrock and doesnt have 3 diamond blocks on hand too
Sounds like bad design
😍
bump
First one
want to suggest a good design?
do you need the code?
or do you just want to call it bad design and not suggest anything?
still, someone can change the name of his world
oh
i thoought its a public plugin
Did you forget to check the length of args
oh right cause i can do that lmao, thanks
dumb me
does anyone know the maven dependency for spigot javadoc?
It will throw an error if you don't
yea
clearly the latter
yep its private, whats your username so I can give you access
Check my profile 🙂
lol thats the nerdiest shit ever
seriously though saying the username would take less time than telling someone to check the profile
It saved the time searching for it
Hey is there a way to get the ID of the current item? For example, that a string with DIAMOND_AXE is output?
k
material, to string
so uhh https://pastebin.com/Q1JtTbe7 now it says "Success!" when i do /im name but when i provide any other arguments after name it says i need to provide a name, whyyy???
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.
?
and the args.length is 2 in the command
so whats the problem
wait actually im stupid and i still need to think how this works rn
okay
now that makes sense
thanks lmao
yea
shouldnt it be >=2 ?
zero-based indexing 
not here though
laughs in ACF
Is it normal that you can put an item into offhand out of an inventory even if you deny the action on spigot 1.18.2?
no, are you sure it's calling?
yes
isnt the bedrocck in the overworld at y-64
i can spam everything inside that inventory and it will always deny, except if I press F to put the item into offhand
what method are you using
Hello !
I have a little question.
Essentials gives Invisibility 2 when vanished...
But is it a spigot system ?
I mean, do vanished players are invisible thx to spigot who hide in tab etc players with invisibility 2 ?
Or maybe essentials gives Invisibility 2 and hide himself players with this potion effect ?
InventoryClickEvent
yeah because thats not a click event
but its still an inventory action isnt it
PlayerSwapHandItemsEvent
what
not every inventory action calls InventoryClickEvent
you arent even clicking the inventory when you swap hands
invisibility doesnt keep you from appearing in tab, thats separate
That's not my question 😅
And this event sounds more like swapping between main and offhand to me
so you're saying make the event less precise to make it easier for you
sides thenumber cant tell anything wrong. I'd do it a bit differently, but thats about it
I mean why is putting an item into hotbar with 0-9 keys a click then?
because it's the same as dragging it, inside of your inventory
swapping with f isnt dragging it
Just noticed that only works in creative mode
So the click event still cancels it
so its a click lol
even protocol treats it as a click
True cause you can easily clone everything
inside
ah
how do you get past circular dependencies?
initialize objects lazily
do I need the flux capacitor for that or the spinyadoodoo with elevated dark matter levels?
what
so umm same problem as earlier (im doing a different command now) and im proabbly stupid again but basically i have this and returns null and internal error (same as earlier) when im not holding anything even though its supposed to send a message to me
if im actually holding something then it works correctly
Then your condition is not right
You can check what #getItemInHands equals if you are not holding anything
the same condition works with a different command though
Then getType would cause npe?
If first one is false, java will check second operator
as i said, it works with a different command properly
And if first one is false, that means it's null
otherwise if the first one is false, the second one is executed
And second operator will call npe
could i just remove the second condition?
just use && lol
shouldnt matter tho
weird
still
what line is it?
wdym
63
whats line 63?
its probably because you are checking for the itemInHand, but you never specified which one. therfor i asked on what version you are
1.8
oh ew
Anybody knows why inventory close event is called after disconnect? There isn't even an inventory open...
Are you sure you recompiled a pl and putted new version
yes
facts
Because in this case, only inventory can be null for it to throw npe
Which I doubt is the case
it doesnt throw npe if i am right
You said it does?
Can you show error
^
Error is pretty clear
it has no item meta
Look at Caused by
check what inventory is getting closed
And erro say about line 65,not 63
most likely the players one
Anyway meta is null, that is why it's calling npe
anyone know how to do this and avoid circular dependencies? The red are classes in my main/api module
but the meta-changing thing only happens if im holding something
and the error happens if im not holding anything
As I said check what getItemInHand is equal if you are not holding anything
And nothing has no item meta
And make condition based on that
but the code with changing the meta doesnt ever get executed because i was earlier checking if i was holding air
you said you removed that
i removed one condition because i had 2
Just check what is it or use debugger...
what is checking "what it is equal to" supposed to mean
i already made an if to check if its air
Creative inventory even tho nothing is open
By printing it to console...
Iirc the players inventory is always technically open
Because its obv isn't null
If nothing else is
If code gets executed
lol
how are we supposed to help u with that pic
send github
its private...
then send enough pictures
okay i think i got the issue
mhm, well you can just send me pictures of the constructors
so umm it is LEGACY_AIR however i cant do Material.LEGACY_AIR cause that doesnt exist
Maybe you are using newer api on older mc server?
yea the plugin is 1.8 and im on 1.19
That may be the cause
wait what about this?
there isnt even a constructor here, this aint circular dependencies
Nah, don't think it would work
LEGACY materials are deprecated afaik
this is how circular dependencies look like:
public A(B b)
public B(A a)
version manager implementation
so what should i do
nice theme 👀
if i still want the plugin to work 1.8-1.19
do what I'm doing lol
i have no idea what youre doing
version support
i think youre getting your terms wrong, since from these pictures i dont see any circular dependencies
wait
and its correct
if I try to add the dependency for this interface I get this
because that means they rely on each other
okay lets just say rip legacy version players ill do 1.16.5, i give up lmao
the only dependency in that interface is <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
uwu
thats circular dependencies between modules
at which point, make them a single module
or do a proper adapter layout if you wanna stick to modules
so middle finger to the abstraction module and stick it in my api module?
no ?
then wdym?
why would your api ever depend on anything
yea but it should not depend on your implmenetation
it does tho
but it shouldn't
^
that makes no sense
Well, that's not how API's should work
dependency inversion principle
remove it and I get this
why the fuck is your API registering legacy wrappers
you should probably check out SOLID before making APIs
its all I need
DIP says that high level modules should not depend on low level modules, but on abstractions
APIs don't contain logic
they abstract the concrete logic of an impl away
that is the point of an API
API's should only really be full of abstract classes or interfaces honestly
^
Hm I have a few final event classes (in my api) that's fine right?
not sure how that serves me any justice to anything
wat
Then them abstract classes should be implemented inside of the implementation module
if that makes sense
idk how this servers me any justice, yes I have a circular because I don't know how to structure my project but I don't think properly moving logic into impl will help me
the API does not depend on the impl period
because the impl has to depend on the API
as it provides concrete implementations to the APIs interfaces
I've been getting inspiration from this github, https://github.com/WesJD/AnvilGUI/blob/master/api/pom.xml
which, that would be a circular
they seem to depend on the abstraction module
however its more NMS so they don't need to depend on the api module
its different for me
they just have names mixed up
Is there any reason for it? I see every api entity is interface and it made no sense to me. Like why would you make interface if it would implement just one class
Just curious
they don't have a concrete API and implementation
You basically provide a lot of interfaces and abstract classes. Then you can provide implementations for them. That way it's easy to use parts of the apis implementations and swap out other ones when needed
they have the "abstraction" which serves them as an intermodule API
and then API is more like their base plugin implementation/library implementation
This is because API's are there only to access the class and methods, you don't really need access to the logic of the plugin if you're just wanting to use their API
basically
And people can also implement their own versions of stuff
example:
abstract class Game {
// Logic
}
public class TestGame extends Game {
}
bet
So what should I do to fix it?
Make your API not have any logic inside of it
do you actually want a pure API ?
or do you just want an implementation that loads a bunch of NMS legacy wrappers
how do I check the new player location in VehicleExit event
I just want it to work and make run the code thats inside of it
I just want it to work
doesn't help
do you want other plugins to interface with your plugin
do you need a proper plugin api
I use this API for my plugins, to run code, loggers, gui builders, nothing fancy
This is an example of how it should be laid out. So, for example you are depending on the class "HeartBeatWrapper". Why don't you make that a class inside of the api and for example make it an abstract class or an interface. By doing this, you shouldn't need to depend on any implementation of your api inside of the api module. You would only need to import the abstracted class in your api, and then to use that just take the HeartBeatWrapper inside of the implementation and do this:
public class HeartBeatWrapper extends/implements IHeartBeat {
// Logic
}```
@shadow zinc
You understand?
how many threads do async bukkit tasks use
like if i run 2 tasks async would both be on the same thread
hey guys anybody know why this isn't working and when leaving the minecart it doesn't tp me?
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
if(event.getExited().getType() == EntityType.PLAYER) {
// if((int)event.getVehicle().getLocation().getZ() != plugin.config.getInt("mainZ")) {
Location loc = new Location(event.getExited().getWorld(), event.getExited().getLocation().getX(), event.getExited().getLocation().getY(), plugin.config.getInt("mainZ"));
event.getExited().teleport(loc);
// }
}
}```
max int 🙏
thats make sense, sorry for being an idiot but this is new to me and I've had very little exposure, could you suggest some things I should research to further understand the structure of an API and best practice, thank you.
Hey guys if i have a code structure like this:
private final Gui navigatorGui = Gui.gui()
.title(Component.text("Game Menu"))
.type(GuiType.DISPENSER)
.create();```
Whenever i autoformat my class, it gets collapsed down to a single line, is there a way to stop that in intellij?
Yeah
I'm unpatient help pls
There is a setting under the wrapping and folding section
It's fine, no need to apologize. This link should help you - https://www.baeldung.com/maven-multi-module-project-java-jpms
It's kind-of an example of how an API and multi-modular java project should be laid out
Oh hmm which tab is this under? There's "Wrapping and braces" with options "Hard Wrap" "Visual Guides" and "Keep when formatting with Line Breaks"
?paste
Any idea why this
VoidGenerator voidGen = new VoidGenerator();
new WorldCreator("event").generator(voidGen).createWorld().setKeepSpawnInMemory(false);
new WorldCreator("community_event").generator(voidGen).createWorld().setKeepSpawnInMemory(false);
stalls the server on generation??
This is the VoidGenerator class
public class VoidGenerator extends ChunkGenerator {
@Override
public void generateNoise(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, ChunkData chunkData) {
}
@Override
public boolean shouldGenerateNoise() {
return false;
}
@Override
public boolean shouldGenerateBedrock() {
return false;
}
@Override
public boolean shouldGenerateSurface() {
return false;
}
@Override
public boolean shouldGenerateDecorations() {
return false;
}
@Override
public boolean shouldGenerateCaves() {
return false;
}
@Override
public boolean shouldGenerateMobs() {
return false;
}
@Override
public boolean shouldGenerateStructures() {
return false;
}
}
Something seems wrong with my comparing/sorting logic. Does anybody see any logical mistakes?
https://paste.md-5.net/igokihenic.cs
how do i create a yaml file (output in jar directory) from the resources folder?
using snakeyaml (maven)
how do I call something after an event ran?
just do it in the event handler method or not?
not when an event ran but after
scheduler
Use a delayed task
can you, in case of Mojang mappings, use that naming for reflection?
No
epic >-<
someone knows an Api or some sort that you can Convert OBJ to Schematics
Or just an API?
that you can implement
i mean directly inside Java or some sort of request
is SOLID the convention that all apis follow?
directly for example an OBJ file to a schematic file that i can use inside my plugin code
no
its pretty much just principles you should follow when coding in oop languages in general
Do you want all code to be a schematic? Or do you just wanna save the state of a class?
any particular set of principles for api development?
i mean the OBJ to be a schematics in this way to use it on worldedit
yeah
ohh
haha
https://github.com/Eisenwave/torrens in some way i found this
but nothing like maintained or something else
ones that i know of are:
KISS (Keep it simple, stupid)
DIP (Dependency Inversion Principle)
Tell me what it does (Use READMEs and make wikis)
Dont tell me how it works (Abstract implementation details)
Tell me what this thing is (documentate your code, and comment it)
though most of them are common sense
but u should focus on that when making APIs
how do i break a block and get the item entity that spawned after the fact?
https://github.com/Eisenwave/voxelvert i found out this dude made a plugin
to do that thanks btw for the help
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
not just api's
and its not a convention
its a principle
a import net.minecraft.world.level.biome.Biome; onto the server level
or more like a bound of principles
5 principles right?
yes
each letter for one
https://www.baeldung.com/solid-principles good explanations and examples
Why does it say it's unable to resolve the gamerule in my (if i ctrl click it, it works properly)?
Invalidate caches and restart
alrighty
poke
Still seem to be an issue after restart
Hm are you depending on multiple spigot versions?
Not explicitly nop, I only have this in my pom <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.19-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
Hm does it build when you package the jar?
Yep
all good
looks like this in hover docs
Hm did you invalidate caches or just restart?
I did both
Odd
It does take me there when i ctrl click soo o.O
poke
The entire world or just a section of it?
section
i tried looking at both craftworld and serverlevel but couldnt find where to do it
im using remapped
declaration: package: org.bukkit.block, interface: Block
Well biomes are stored that way
how i make plugin like essential? java not know, how do wth skript
and i also want make geyser plugin but skript
Oh no
Skript is slow
And it cannot do what geyser does
Okay skript essentials is one thing
If you know it, do it
.......how do i get a craftblock
craftworld.getblock returns bukkit.block for some reason
bro i was joking but fair enough
is there a general rule for casting between nms and bukkit?
Doesn't Block extend CraftBlock?
You can just cast to craftblock
CraftBlock is the craftbukkit impl of Block
all org.bukkit.blocks are going to be CraftBlocks
So since the server is craftbukkit, just cast your block instance to craftblock
Why do you need it
Hard to tell when there are people who are seriously thinking they can do that
The #1 question that should always be asked when someone's using internals
xD cause you never know what the spigot newbies are at.
because biome can only be created using nms for some stupid reason
or modified
PR time
this is annoying
the craftblock takes the enum biome not the biome class as argument for setbiome
It still calls an nms method somewhere
They are stored in 3d somehow
Gonna need a bit more context
Holder<net.minecraft.world.level.biome.Biome> bb
okay new question
how do i make/use one
it fills my ide with override methods
its a method in the class that returns an object?
wildcards are weird
wait a second
DAMMIT
i needed it as a 1X1 biome
urgh i hate my life
what are you trying to achieve ? x)
well the color of cauldron water changes with biome color
water can change color in java
easily
the issue is
i dont want to change color in the surrounding swamp if i change the cauldron contents of say a witch hut
but biomes are 4³ urgh
You can change biomes in a specific block, no?
how would i
Nope
That's how I do it in my corruption plugin
Well maybe
?jd-s
Hello i have a question how can i put items in a chest by code
I know they are saved to the world files in a 4x4x4 area
declaration: package: org.bukkit.block, interface: Block
This is how my corruption plugin changes single blocks
Imagine not using packets
To get the misty effect and ambience from the nether
isnt that immutable
See how CraftBlock does it
public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) {
BlockPos pos = new BlockPos(x, 0, z);
if (this.world.hasChunkAt(pos)) {
LevelChunk chunk = this.world.getChunkAt(pos);
if (chunk != null) {
chunk.setBiome(x >> 2, y >> 2, z >> 2, bb);
chunk.setUnsaved(true);
}
}
}
the issue still is that i cannot set a CUSTOM biome to a 1³ area
I think world guard or world edit has that feature
How to put a item in a chest by java code?
im about 99% sure thats the same issue as before that its only possible with Biome Enum elements
No need to continue spamming, everyone see your thread on the list 🙂
WELL THEN
SCREW MOJANG
Preconditions.checkArgument(biome != Biome.CUSTOM, "Cannot set the biome to %s", biome);
that 's not mojang lol
hello, what is the "?" parameters in player.playSound(player.getLocation(), Sound, ?, ?) pls ?
volume and pitch
When the food level is less than 6, the sprint turns off and slows down.
Can't i cancel this?
what did they do ?
Control the volume and pitch of the sound?
implementing a* pathfinding to a plugin, now this is what I call game dev
float
numbers that have numbers after the comma
where i can found the spigot 1.12.2 src?
decompile it
aaah i dont want do it
okok
I thought there was already some repository
?stash
I think that only has latest tho
Yeah you can't change the biome of a single block, I just checked.
I would spawn an armorstand with a coloured helmet inside the cauldron instead, not perfect but it's the best you got
If you are using a resource pack you can make it even more convincing
@ancient plank hows that repo named on ur github
Wyn
I changed a single block with worldedit and it's affected at least a few blocks around it
Wym
you said something about a corruption plugin
There is a 3 blocks fade
I assume the fade is based on your blend distance
I guess so
This is one block changed, with a blend distance of 5x5
This is a blend distance of 0
that aint a cube
It is not
worldedit?
block.getLocation().getWorld().setBiome(block.getX(), block.getY(), block.getZ(), Biome.CRIMSON_FOREST);
Wait until she realizes you can just do block.setBiome
oh ffs
no such method: W
Block has a world
Wait until you realize I wrote most of the code in the project over a year ago
craftblock or bukkit block
player extends inventory
That's bukkit
how do I cancel anvil enchant event
InventoryHolder != inventory
PrepareAnvilEvent
@EventHandler
public void CancelAnvilEvent(PrepareAnvilEvent event) {
if (event.getItem() = ItemManager.TNTSword) {
event.setCancelled(true);
}else if (event.getItem() = ItemManager.SpeedBoots) {
event.setCancelled(true);
this doesn't work
What does getItem return in that event anyway
I know getResult is the output
Also use isSimilar
Yes
In fact
= is assignment
equals isnt always
So that won't even compile
=: Assignment
==: compares memory location
.equals: same as == by default, can be overriden
.isSimilar: .equals but it ignores stack size
10 reasons to compare with pdc:
Sure
