#help-development
1 messages · Page 767 of 1
crusty
Add that plugin as dependency
You should not worry about that for now
the rust foundation had/has some fun drama xD
but you told me about reusing code in different places
erm cuz C is lower level functional etc. Want to learn the basics, plus C++ is well C++
fn main() {
let name = "Rust";
match name {
_ if name == "Rust" => sue_owner(),
_ => println!("This is mine >:("),
}
}
Sure but you can reuse code in a single plugin
Writing libraries is way beyond your scope for the moment
why 😭
fn main() {
let name = "Rust";
match name {
"Rust" => sue_owner(),
_ => println!("This is mine >:("),
}
}
fixed it for ya
Hey, im a beginner, and im just learning the basics, in the picture u can see that i made an item and gave it a display name, and then i tried to get that name and print it, but when i do that i get an error in line 24 where i declared my ItemStack and now im confused, did i get that error cause im trying to acess the things in a wrong way or did make a mistake in the declaration
(Im so sorry for the pictures bad quality i cant send screenshots)
any good replacements for ChatColor.translateAlternateColorCodes('&', message)?
just make a utility method
how do I do that?
public String colorDuh(String str) {
return ChatColor.translateAlternateColorCodes('&', str)
}```
boom util method
Your entry point is your plugin class, not a public static void main(String[] args)
no I mean ChatColor.translateAlternateColorCodes is depricated so what can i use instead
spigot
?
So if i want to test things i just have to compile and test in minecraft ?
That will take a lot of time
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
Now idk if thats a tool or ur just saying it and i dont want to google cause if i didnt find it i will get depressed cause i dont understand fun messages
it's not deprecated in spigot
how do i import in spigot?
import what
mockbukkit is a platform that allows for unit tests in plugins
going to the paper server then
I'd just recommend making a "test" plugin and server and doing all your tests with it
Only for pointers
ahh okay
Its (kind of) short for (*list).tail
Is LegacyComponentSerializer.legacy('&').serialize(message) a good replacement for ChatColor.translateAlternateColorCodes('&', message)?
Does anyone know where i can download javax.vecmath? i need it for mcp
Hi, does someone know how to properly use %%USER%% placeholder into my premium resource?
private String user = "%%__USER__%%";
do not make it final
it does not get replaced if the field is static final
it also does not get replaced if you download your own plugin
Is this the correct place to download vecmath?
https://github.com/hharrison/vecmath
isn't working
should it work for added buyers? I'm trying that with a friend of mine, the placeholder isn't getting replaced
yes, it should work for added buyers. unless ofc you use an obfuscator that encrypts strings or anything
nop, that's not obfuscated
is it a direct .jar or a zip file or sth?
does the class name affect that somehow?
?
jar
no
any possibe fix then?
maybe I can try to put that into the main class?
yeah, not even in main class works: [HPET] [STDOUT] %%USER%%
Hi! How IsFlight method is load? https://github.com/GrimAnticheat/Grim/blob/2.0/src/main/java/ac/grim/grimac/checks/impl/flight/FlightA.java
Fully async, multithreaded, predictive, open source, 3.01 reach, 1.005 timer, 0.01% speed, 99.99% antikb, "bypassable" 1.8-1.19 anticheat. - GrimAnticheat/Grim
Can someone please help me with downloading javax.vecmath? i dont know where i can download it and i need it for my mcp
cosa?
sorry to bother you, from your experience how did you use that premium placeholder?
idk what you're asking but that's a meme class
??
I wanted to understand the workings of how to detect the fly
that check is a joke
il player.isFlight dove vede che sta volando
mi sa che come dicono gli altri è solo uno scherzo
anche perchè come giustamente tu pensi non avrebbe altrimenti senso
ah ma tutti italiani?
mio amico
allo mi sapete di come porcodio si usa l'USER placeholder nelle risorse premium?
in che senso risorse premium?
How can I use the %%USER%% placeholder into my premium resource?
i plugin a pagamento su spigot
e che vuoi?
lo vuoi mettere uno a pagamento?
già lo è
e me allora che ce?
ci sta scritto su sta wiki che posso usare %%USER%% dentro al plugin per avere il nome dell'utente che l'ha scaricato: https://www.spigotmc.org/wiki/premium-resource-placeholders-identifiers/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ma non funziona diocan
fake news non va bene
cmq non lo so
vabbò ok
Does someone know how to use the spigotmc premium placeholders into my premium plugin?
Do I just have to use %%USER%% in a variable and that's it? Because that is not working
if I want to access something from main class I shouldnt make an instance and just put it into constructor with this.thing = thing; ? do I get that right?
What do you mean by that?
if you're in main class you just set the instance in the onEnable into a static instance and make a getter
then you just use that to do things
could someone with more expertise confirm it?
....
making it static is one way
Passing instances around is called dependency injection
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
another is using dependency injection
so the constructor thing is called dependency injection?
Do you guys know by any chance how to properly use premium resources placeheolders? Those aren't working for me
guys where do i find the hikariCP.jar download?
?paste
I would highly suggest using some dependency manager like maven.
But look at how you can download maven dependencies as jars.
You need to shade the library into your plugin
How do I use the premium resources placeholders into my plugin?
Isnt it just a String that gets replaced?
wait how?
do I need to use dependency injection for classes other than Main or can I just do instances?
Depends if you want the same instance or create new instances every time
maven-shade-plugin
how do I tell apart
as always i forgot, was the LOWEST priority the first one to run in the events?
Yes
thanks
yes but that isn't working
Tell instancea apart?
How do you compile?
when I want to use same instance and when new instances every time
bungeecord alert command
maven / intellij
Tell me the steps
build artifacts, no obfuscation
If your class has data that is needed in different locations, then you want to use the same instance.
Because every time you create a new instance, it has its completely independent variables.
I have one more question about using database connections, when I want to assign let's say a value of 100 to player I should check on player join event if he joins for the first time, make connection, assign values and make disconnection? and if I wanted to add another 10 to that 100 via a command I would have to connect, add 10 and disconnect? would that be an efficient procedure to not clog channel?
You could just delete your pom and have the same result.
Meaning you dont use maven at all if you do this. You need to acutally
use maven lifecycles. Go to your right side and open the maven pannel in ij
wait, where's this window?
Please use files to save your data. It is fast and can be very clean.
I mean SpigotSandbox is the project itself?
Yes that will be your project name
and why is using database not?
so I double click on clean and then on package?
what if I'm using some jar dependencies?
It is very hard to make database usage clean. You need a lot of understanding of advanced programming concepts
or else it will be ensured to result in an unusable mess.
Also files can scale decently
I dont feel like saving stuff in files will be good if I want to dynamically edit it by hand and store a lot of different things
"dynamically edit it by hand" what do you mean by that?
You can store a lot of different things a huge amount of data in Files just fine
okay lets say Id like to make file that would keep custom enemies (type, name, custom attributes such as hp, armor, potion effects), so if I wanted to add a new enemy Id just make a new line in file, fill in what's needed and I could use it in for example spawn method that would take wanted parameters from said file
would that work?
I would use the name of the file for your custom entities.
Create a folder custom_mobs and then create a File for those mobs <UUID>.yml or <UUID>.json
Replace the <UUID> with their UUID of course. There are quite a few different approaches like having a folder structure
with your worldname and the coordinates of the chunks which contain the mob files. It all comes down to properly thinking
about a clean file structure.
Just dont put everything into one file. Use folders and file names for a cleaner experience.
uuid of what
but wouldnt that mean that
Oh i think i misread this
if I wanted to spawn 50 peons I'd have 50 unique files
even if they all share same attributes
like same custom name hp etc.
Ok what you are talking about are templates aka configuration files.
Yes
Because it is very user-unfriendly to edit a database compared to editing a file
okay
and I assume working with files, reading from files is a java thing, not really spigot thing?
there are power users tho
The vast majority of users have no idea how to even look into a database, let alone edit values in it
Spigot has the FileConfiguration api which makes working with files and Spigot objects easier.
I would use that for sure.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
okay
so lets say that I want to make custom mob conf file
it would look like that?:
mobs:
mob1:
type:
hp:
potion_effects:
and then let's say Id make custom summon command and if I just typed mob1 it would read parameters from conf file and fill spawn method with them (hp, type, potion effects)?
yes pretty much
okay that actually does sound easier
can I even use files to make a list of players' currency and dynamically change it via some actions on the server?
At some point you have to accept that it’s too much to configure via file
And then you make the in game config
wdym by in game config?
exactly
could you give me one example of what would require that much
I cant really visualize it
I wanna do a web editor for one of my plugins, but idk if its even safe to use a bunch of mc assets on my websites xD
the creator thingy is very vague imo
well, I have made a plugin for playing bingo, and I have in game way to create a card for bingo
with like chances per item or set of items etc
and its like 100x easier as a user to configure it in game compared to in a yaml file
for the same reason as for why you are probably not using just a console for your entire pc
Yeah I’ve got an in game item editor for my dungeon plugin
Gotta to an in game mob editor too
btw coll, do you have an example of plugins using web editors?
so I guess I should learn how to make in game editors fo what I want to do as well?
yes if you wanna make a good plugin, I would recommend doing it
Luckperms has a web editor
should I make separate management plugin for it?
I think AdvancedEnchantments also has one
nah, its just in the same plugin atleast in my case
can you make a plugin execute commands that you've made in it?
You could
there is no need
Yeah
So how do I have to compile to use premium resource placeholders?
there's nothing special
put the placeholder and that's it
spigot will replace it for all your buyers
not for you
is there some one that can help me in https://discord.com/channels/690411863766466590/1168659486446190612 ?
btw is it bad to have a lot of yml config files to store stuff like custom configurations for mini game settings, leaderboards, custom kits, etc?
Not really. If anything it makes it easier for you to organize your stuff. I think that's better than shoving everything into a single file.
Hello, in 1.20.1 you could get the network manager through the filed h, but now in 1.20.2, I don't see any possibilities around getting the network manager here: https://mappings.cephx.dev/1.20.2/net/minecraft/server/network/ServerGamePacketListenerImpl.html how can I get it now?
version: 1.20.2, hash: d908ed1f24
what do you need the Connection object for?
hey
the connection field has been moved to ServerCommonPacketListenerImpl, named "c" https://mappings.cephx.dev/1.20.2/net/minecraft/server/network/ServerCommonPacketListenerImpl.html
version: 1.20.2, hash: a274e85190
(which is the super class of ServerGamePacketListenerImpl)
how can I safely change name of my plugin?
What's owner for in Bukkit.createInventory() ? difference if i actually specify a player? or null
And what's the field I can get the ServerCommonPacketListenerImpl
nvm
as said, it's the super class
use null
inventoryholder is bad
you can get it using reflection
ServerGamePacketListenerImpl listenerImpl = ...;
Field connectionField = ServerCommonPacketListenerImpl.class.getDeclaredField("c"); // don't forget to set it accessible once
Connection connection = (Connection) connectionField.get(listenerImpl);
what's the difference though?
kinda hard to explain, but inventory holder is pretty much a backwards compatibility thing from what I know and shouldnt really be used to compare inventories
either that or its kinda unused
so there is no point in using it in the first place
https://www.spigotmc.org/threads/why-items-with-lots-of-metadata-actually-cause-lag-an-inventoryholder-psa.607711/ and there is also this article
and is the field of ServerGamePacketListenerImpl the same as in 1.20.1 like:
// Player Connection
PlayerConnection playerConnection1 = new EmptyPlayerConnection20(this);
try {
Field cField = FakeEntityPlayer20.class.getField("c");
cField.set(this, playerConnection1);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
you need to use getDeclaredField on the class where the field is declared
getField only gets public / accessible fields, while getDeclaredField gets you the field specifically declared in that class
e.g. FakeEntityPlayer20 could have a public field called "c", you wouldn't want to get that
so use getDeclaredField on ServerCommonPacketListenerImpl.class
Yea but FakeEntityPlayer20 extends the EntityPlayer, him himself doesn't have a field called "c" I was looking to get the connection from the entityplayer
is it really unnecessary?
it is if you dont have any code under
oh okay
yes
in some path I should place path from my PC or just from server folder?
its path in you config.yml
for example
this:
is:
path: value
path of "value" would be this.is.path
oh thats the path they are talking about
inside file okay
im trying to figure out how to make custom config files with specific names
not just config.yml
general advice, never use some path of your pc in code for a project that other people will be using xD
Hey, so i made a simple ItemStack in a class other han main "public class CustomItems" the item is public static, and im curious if i can /give it to myself from in game, is that possible ?
yes its possible
How ?
just make a /somegive command and then player.getinv .addItem(your stack)
So i have to add it like that ? Chatgpt said that i can just do like /give me myplugin:item
So it confused me
make sure to make the itemstack publicly available
don't use chatgpt
chatgtp is making up shit
you dont register items in minecraft, this is what mods do xD
Ok tysm!
chat gpt has limited information about how spigot works
don't trust it
Ig
if you look straight ahead one should be 0, that's pitch
yaw is looking left right
pitch is up down
and roll is well, rotating
we don't have that in mc
i think bukkit is from 0 to 360?
just do some tests, not sure
i think because it's easier to work with it remained like this
I tried making custom.yml file with that spigot tutorial but the plugin does not even load
Also there is an error in your console
Yeah vanilla is the weird one here
Customdamage
public final class Customdamage extends JavaPlugin implements Listener
Remove the constructor
^
Only your main plugin class should do that
^^
You're passing it via the constructor. You can use that instead
I think that's actually their main class
They just copy pasted the tutorial without knowing what theyre doing
Since they've refused to learn Java many times now
...not really, I thought its needed since when I try to do "plugin.getCustomConfig().getString("some-path");" there is an error
I'd appreciate it if you stopped assuming it 24/7
Oh, if that's your main class then yeah, remove the constructor
Your plugin instance, wherever you need it, will be this
I didn't see an onEnable() or onDisable() so I assumed it was just a listener or util class :p
Same until I read the stacktrace
Ah, constructor init of PluginClassLoader, yeah. Should have caught that
so constructor isnt needed in main class since its automatically initialized?
Correct
Anywhere you need a Plugin instance you can use this instead because this will refer to your class that extends JavaPlugin in that context
And in case I wasn't clear, your plugin variable can be removed too. Lines 1 - 4 in the snippet you sent can be removed
The plugin loader requires a no-args constructor
how can I set my server join to first time again?
?
I want to reset hasPlayedBefore for my uuid
I mean, is it just a simple File#exists clause to check?
I'd guess so
it doesnt create custom.yml, had to do it manually
when I do it manually there are no errors
but it does not add anything to it
sorry I don't know shit about configs lol, I only write private plugins for myself with everything hardcoded tbh lol
How about instead of checking if hasPlayedBefore() you check if the file exists?
good idea
there is check if config exists
in line 10
this method is used by onEnable
and I know it works because if I delete the file it throws exception
not your custom config
Is the custom.yml present in the jar file?
if (!customConfigFile.exists())
Also you gotta save after setting stiff for the config to reflect that
it is because I set it manually
Show us
yes but what they mean is not like this
?paste
YamlConfiguration.loadConfiguration(customConfigFile);``` wtf?
customconfig = YamlConfiguration.loadConfiguration(customConfigFile);
damn it works now
theres something wrong with this part
cuz it doesnt create file
Yeah remember to export it to your Jar
its exported like that
and the .yml file should be in customdamage folder
its not
Open the customdamage-1.0.jar
nothing happens
You can rename it to customdamage-1.0.zip if you don’t have anything else to open it with
why would it be here 😭
but entire tutorial has not said a single thing about it
What tutorial
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes
Maybe we should go change the size of that paragraph to 25 to make sure new guys read it
i think he just doesn't understand
well it works now
👌🏻
this is more reasonable 💀
https://paste.md-5.net/xevirihopi.java may I get opinions about how bad it looks?
I tested it and right now it works as intended
creates config if it's not there, assigns base attack value to player by UUID, reads this in custom damage formula and assigns health bars to living entities
Use the chatcolor constnats @storm crystal
Probably
nvm didn't reload the config...
What are those?
?rtf
Well they’re constants so u don’t yse the paragraph symbol
Also makes code much easier to read
?jd-s
Google your question before asking it:
https://www.google.com/
Look up chatcolor spigot on both
What packets do I need to send to display player heads in the tab?
Oh yeah how can I make this customDamage method accessible in other plugins? It was making it dependency?
how do database connections work? When using the getConnection built in method for jdbc, do we need to close it every time we call the function?
You connect on start, you disconnect on shutdown
Usually you use smth like hikari etc.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
need this for me sorry
good luck
thanks
Hello, I had a problem with a purchase of a plugin, I asked for a refund, the person took the plugin from me and did not return the money, I need to complain about this disastrous service and scam
is there a way to get ItemStack in hand as String? or check ItemStack as object to object?
Objects.equals(item), foodCrateMechanic.getRequiredItem1())) {
smth like this
I get :
Unhandled exception executing command 'my command'
at stuff.onCommand(CommandListener.java:49)
Its going like Error] null and then big java style errors
what in the hell am i looking at
Sigh
I saw voth questions and decided not today
Yes and yes
As a name? ItemStack equals Itemstack would work? 🤔
Or isSimilar if ur not checking amount too
unrealted to spigot. what java version should I make my program in?
im trying to make gui programs for windows through java but im wondering if i should use java 8, java 11, or 17
this one?
oh 21?
okay
isnt there more learning resources for older versions of java tho?
Java does not change that majorly
didnt they allow u to use a 1 liner print statement now?
I mean I get from config a string and ItemStack what player have in hand and I need to check if they are equal, I make a way liket that:
if (foodCrateMechanic.hasNextCrate3() && foodCrateMechanic.hasItemRequirement3()) {
String vi = foodCrateMechanic.getRequiredItem3();
if (StringUtils.isAllUpperCase(vi)) {
ItemStack vanilla_item = new ItemStack(Material.valueOf(vi));
if (Objects.equals(item, vanilla_item)) {
OraxenFurniture.remove(baseEntity, null);
OraxenFurniture.place(foodCrateMechanic.getNextCrate3(), baseEntity.getLocation(), yawToRotation(FurnitureMechanic.getFurnitureYaw(baseEntity)), baseEntity.getFacing());
}
} else
if (Objects.equals(OraxenItems.getIdByItem(item), foodCrateMechanic.getRequiredItem3())) {
OraxenFurniture.remove(baseEntity, null);
OraxenFurniture.place(foodCrateMechanic.getNextCrate3(), baseEntity.getLocation(), yawToRotation(FurnitureMechanic.getFurnitureYaw(baseEntity)), baseEntity.getFacing());
}
}
The problem I run is that when e.g GOLDEN_APPLE is all from uppercase but don't want to work because of "" I think and idk now how I can fix it so it will read it if they will be from upper case but also ignore ""
Who knows not paying attention @timid berry
would code from java 8 work most of the time in java 21?
this little thing discord editing :c
Use vanilla_item.isSimilar to item
Also tjat looks like hell
Yes
would old tutorials still work for new versions like 21?
https://www.youtube.com/watch?v=eIrMbAQSU34
Java tutorial for beginners - Learn Java, the language behind millions of apps and websites.
🔥 Want to master Java? Get my complete Java mastery bundle: http://bit.ly/2tKoy8C
👍 Subscribe for more Java tutorials like this: https://goo.gl/6PYaGF
📕 Get my FREE #Java cheat sheet: http://bit.ly/2JNlQnw
⭐️ Want to learn more from me? Check out thes...
Yes
Remember to use a proper build tool btw like gradle or maven
Good to drill into the bones
?
are there bad ones
i got this ide
Yes
Just use gradle or maven with that
They’re pretty much the standard nowadays
isn't isSimiliar work only for itemstacks or items but not for string to itemstack?
personally i would not take that if i were you @signal kettle
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
ye thanks
there's a problem that I don't if I will not forst convert string to itemstack🥲
foodcrate:
nextCrate1: food_crate_red_apple_default
requiredItem1: APPLE
nextCrate2: food_crate_green_apple_default
requiredItem2: green_apple
nextCrate3: food_crate_gold_apple_default
requiredItem3: GOLDEN_APPLE
here this is the config and I need to read from reguiredItem line of text and that's not an itemstack, and that's why I cant just use isSimilliar or normal equal item stack to itemstack, in screen its how it taking the string line from config to code
that's why I convert the string to ItemStack, and also I need to check if it's from UpperCase so that's how player speciefie Vanilla items and when they are from LowerCase that's when player mean OraxenItemStack
and the problem came when Material Name have special chars in the name so underlines because StringUtils do not recognize it as AllUpperCase
ahh
HashMaps yes?
I will learn then
did they get rid of packages in the newer versions?
^
yah but its not there by default anymore right
i dont think it ever was, you should be creating a package though
it didnt ask me to name a package on the latest version of java and intellaji
if anything thats probably an ij build system thing
it depends on the type of project you created, your settings and also whether or not its just purely visual or not
I am thinking its just more visual and that it really did make a package
ah i see
May i suggest https://github.com/MSPaintIDE/MSPaintIDE
Do you know how to use maven with NVIM?
I can't seem to find out
Whst did you try?
Plug 'mikelue/vim-maven-plugin' IDK where to put this
Maybe you should not use VIM if you do not know that
I'm learning the ropes cause why not
Better learn smth more modern
Isnt NVIM modern
VIM is for those that wanna feel special or old fogeys
VScode?
IntelliJ is a kinda of IDE i just want a light weight thing
Vscode is easy sure
Plugins installed with one click
Offers multiple language support
Etc etc
how would i get a cape from a player with api
or just get the official mojang cape urls
nononon
im trying to get all the urls for all the capes
like this one is the migrator
You will get base64 not an url
Og
I just checked javadocs
declaration: package: org.bukkit.profile, interface: PlayerTextures
Use the PlayerProfile Api
@quaint mantle
well
how would i get ALL of the mojang capes
all of the minecraft texture urls
not namemc
or any other third party
I mean this just gets their cape?
what/
There’s a list of capes here https://minecraft.fandom.com/wiki/Cape
Capes are commemorative items that can be worn in addition to the player's skin. However, unlike skins, players cannot create custom capes or transfer any owned capes to a different account. When equipped, they also change the appearance of worn elytra. Capes are purely decorational, and do not alter the wearers' capabilities in any way.
There a...
Also does namemc have access from mojang to add capes?
no
these use some nocookie.net website
im trying to get the textures,minecraft.net/texture webstie
Well dik then
bruh how cancel dragInventoryEvent why my items cloning
Does anyone has an idea how can I move a minecart on rails into the direction of a specific rail?
push it
😂
?paste
https://paste.md-5.net/elivufodax.cs - I'm completely confused, I have a bug when I take an item from creative mode, the event is not canceled and the item is clonedwhen I drag it across the player's inventory
how this work bruh...
I think the creative inventory was like fully client side or something
there was something different with it, but I dont remember
This
this code work but it cancels the event after an item is placed in the inventory and because of this the item remains in the player's inventory if he leaves it
when dragging from creative mode it works fine but when dragging from another inventory the item does not stay there
How can I disable the control of a minecart by the player?
My guess would be that playermoveevent triggers it
sadly not
Hmm im not sure then, perhaps try debugging all events
Like make some dummy handler for all events and print them
Maybe this event ?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleMoveEvent.html
declaration: package: org.bukkit.event.vehicle, class: VehicleMoveEvent
@full holly by Control you mean pushing the cart or being inside of it and doing something
being inside and doing something
Yeah no idea then
event.getVehicle().setVelocity(event.getVehicle().getVelocity().setX(0).setZ(0)); that's working, but unfortunately it still moves minimally
are you doing that in the move event?
yes
its likely just client side then
why not set getTo to the same as getFrom in the move event?
or just canceling the event should be fine
canceling isn't possible
event.getVehicle().setVelocity(new Vector(0,0, 0));
Minecart m = (Minecart) minecart;
m.setMaxSpeed(0.0);
Should I make separate plugin for config handling and just access its methods to other plugins or just make plugin handling formula in any plugin that would need it by hand?
nvm i fixed it 💀
A whole plugin would be overkill
A library is what you want
Making and using library is more of a java thing than spigot thing yeah?
Correct
Alright ill get on it then
What have you tried to debug it?
Are you sure the method is executing in the first place
Thats not what im saying
Is the method executing at all
Have you tried a println
Do that
See if it’s running at all
how can I disable achivment annouce for a certain world
What exactly is not working
Nothing is printing out?
Where did you put those println
It means either your if is failing or event isn't even running
Altrough you did a lot of wrong things in this code
First, don't differate your inventory with inventory holder
Second, all of those other if statements just seem redudant
Because if item have your holder, it's already canceled
instanceof does null check
Put println on top of method, check if method is even running
oh nvm

Is Objects.requireNonNull(null) a crime
requireNonNull does not stop it being null
Can I somehow make my ide not warn me about a variable being null even if it's = null, but only for this variable?
yes, don;t use InteliJ 🙂
But it's a good ide
there is probably some suppression annotation
I hope so
anyone know what type of event is fired when a villager throws an item as a result of a gift from the hero of the village effect?
i see it as pointless
you're just sending another exception
it's always something small
how can I disable achivment annouce for a certain world
?jd-s
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 usernames, global display names, and server...
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.
I think there is really no way to cancel it. You have to handle it by yourself by setting the gamerule announceAdvancements or something like that to false and listen to PlayerAdvancementDoneEvent, from there you want to check for getPlayer() -> getLocation() -> getWorld()
and filter the output from there
How to listen to the player opening the backpack by pressing “E”
and of course handle the advancement announcement by yourself..
InventoryOpenEvent
this is not OK
let me see this
no event is fired when the player opens his own inventory
set up a scheduler that checks for player open inventories and from there I think you should be able to do player.getInventory() and do null checks and type checks
not possible
as checking the players open inventory will always return their own inventory even if it's closed
it returns their inventory or another if they have one open
Yeah it's kinda f I tested it now
oh....
how can i use MockBukkit
It doesn't look like a simple thing
You could try this instead https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/HumanEntity.html#getOpenInventory()
declaration: package: org.bukkit.entity, interface: HumanEntity
on a scheduler
but idk how it'll work
no
it won't
I already told you getOPenInventory will always return teh players inventory even if it's not open
So there's no solution? Is mojang that stupid? no event for this
players inventory or another inventory if one is open
player inventory opening is client side
teh server has no need to know when it opens
only when changes are made
Interesting
i added the things to my pom.xml
but idk how to make the actual class what should it import, what should it implement if it had to
Interesting

I did something like this a long time ago. I cant remember exactly but the client sends a packet (i think chat command) every time a player opens his inventory so liten to that using protocol libs
@wet breach !!! remember me??!!
I did it! Floor is Lava is now out >:) u said i couldnt
You butchered my workloads a little bit :(
But in the general idea is there.
how did I butcher it?
okay..
Its alright.
You are double wrapping your run method.
This code could just be
public void startWLR() {
Bukkit.getScheduler().runTaskTimer(FloorIsLava.getInstance(), this, 0L, 1L);
}
While you are at it
yeah this part has been done by my codev.. he stopped working with me so I just took what worked and went on from there
Been a while since i saw that
im planning to revise it ofc
When the lom is bok
lol...
overall tbh, i feel fkn great about my plugin
That’s nice
this is the largest project i worked on so far
Thats nice
Now add some RCE and upload it to the spigot resource section
working with packets and trying to send item frame entity + entity data with setting the item of the item frame but get some weird error
https://gist.github.com/SquidXTV/7855e178ec0b7b01cdd4b7f8954627d2
[13:02:15] [Netty Server IO #1/ERROR]: Error receiving packet 82
java.lang.ClassCastException: class org.bukkit.inventory.ItemStack cannot be cast to class net.minecraft.world.item.ItemStack (org.bukkit.inventory.ItemStack and net.minecraft.world.item.ItemStack are in unnamed module of loader java.net.URLClassLoader @46ee7fe8)
prob caused by this:
public void setMap(@NotNull ItemStack map) {
if (map.getType() != Material.FILLED_MAP) {
throw new IllegalArgumentException("ItemStack must be of type FILLED_MAP.");
}
List<WrappedDataValue> values = List.of(
new WrappedDataValue(8, WrappedDataWatcher.Registry.getItemStackSerializer(false), map)
);
getDataValueCollectionModifier().writeSafely(0, values);
}
the full stacktrace isnt really showing the cause
next big step is ingame settings and GUI
Guess u gotta do the good ol’ sysout debugging
bruh
Never used the proper debugger?
setMap(@NotNull ItemStack
is that a bukkit itemstack or a nms itemstack?
what's wrong with sys debug?
The proper debugger is just much better
who's that?
Which ProtocolLib version?
I legit only use p.sendMsg() for debugging
5.1.0
bukkit
that's probably your issue
my code worked before with WrappedDataWatcher
but someone told me that nowadays it changed to those List<WrappedDataValue>
I have a question. am I allowed to sell plugins that have dependency on WorldEdit/Multiverse?
where do i see those? <.<
Google spigot premium guidelines
also could the first possible change the second one?
public void setInvisible(boolean invisible) {
List<WrappedDataValue> values = List.of(
new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), invisible ? (byte) 0x20 : (byte) 0)
);
getDataValueCollectionModifier().writeSafely(0, values);
}
public void setMap(@NotNull ItemStack map) {
if (map.getType() != Material.FILLED_MAP) {
throw new IllegalArgumentException("ItemStack must be of type FILLED_MAP.");
}
List<WrappedDataValue> values = List.of(
new WrappedDataValue(8, WrappedDataWatcher.Registry.getItemStackSerializer(false), map)
);
getDataValueCollectionModifier().writeSafely(0, values);
}
does writeSafely delete the previous values?
Is this a packet wrapper?
public static class ItemFrameDataPacket extends PacketContainer {
public ItemFrameDataPacket(int entityId) {
super(PacketType.Play.Server.ENTITY_METADATA);
getModifier().writeDefaults();
getIntegers().write(0, entityId);
}
public void setInvisible(boolean invisible) {
List<WrappedDataValue> values = List.of(
new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), invisible ? (byte) 0x20 : (byte) 0)
);
getDataValueCollectionModifier().writeSafely(0, values);
}
public void setMap(@NotNull ItemStack map) {
if (map.getType() != Material.FILLED_MAP) {
throw new IllegalArgumentException("ItemStack must be of type FILLED_MAP.");
}
List<WrappedDataValue> values = List.of(
new WrappedDataValue(8, WrappedDataWatcher.Registry.getItemStackSerializer(false), map)
);
getDataValueCollectionModifier().writeSafely(0, values);
}
}
basically created my own class for this
?premium
Doh
Hm, there might be some nms converter you need to use for the ItemStack.
Are you sure that this class throws the exception?
Good ol’ craftitemstack
no I am not sure, but its the only packet stuff using ItemStack
I mean one without needing nms on the classpath
and the stacktrace isnt really helpful
☝️
"receiving packet 82"
receiving packet?
let me try removing the setMap call and check if the error persists
yeah idk
im never receiving packets, thats weird, you can see yourself
https://github.com/SquidXTV/FrameUI/blob/feature/click-scroll-listener/src/main/java/me/squidxtv/frameui/core/map/VirtualMap.java#L59
oh and I got this:
[13:02:15] [Server thread/INFO]: SquidXTV lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.ClassCastException: class org.bukkit.inventory.ItemStack cannot be cast to class net.minecraft.world.item.ItemStack (org.bukkit.inventory.ItemStack and net.minecraft.world.item.ItemStack are in unnamed module of loader java.net.URLClassLoader @46ee7fe8)
Hm
wrong ItemStack
yeah lol I can read
ElgarL coming through with the wisdom 🙂
😄
I got another idea but im gonna go eat now 😛
Look for an adapter in the meantime
I don't recall saying such things o.O
well I used it as a motivator anyways. so thanks
:p
lmao
well, if it helped you then, you are welcome I suppose and awesome 
lol
No, I can't until I bother to sign the CLA (Spoiler: I won't - too lazy)
wasnt needed before
this update broke all my packet stuff lol
how i can get The IP of a player?
?jd
Player#getAddress()
k
How can I use the 1.20.2 super for EntityPlayer? I also am concurrently using 1.19.4 and 1.18.2 .jar files for them and it only allows me 3 parameters instead of 4. Is there any workaround it so I can use 4?
super(MinecraftServer.getServer(), MinecraftServer.getServer().a(resourceKey), gameProfile, null);
I can't use the 4th parameter "null"
before signed chat it only took 3 params
what
i dont get the ip
it isnt my ip
It's the loopback address because you are on localhost
bruh
and what should I do?
Only use 3
1.20.2 must be offered 4
.
If you are trying to do multiple versions you need to handle that properly
Either reflection or modules
Alright, but how then can I compile all those modules into a singular .jar file?
using the shade plugin
and scope compile in the main module
tho i think scope compile is by default
if that's the case scope provided for libs you don't wanna shade in
how would you detect the difference between
- opening a crafting inventory manually via player.openWorkbench() that triggers via /craft command
and - interacting with a crafting table
is it possible to do it without player UUID lists to store players who executed the /craft command? How do you detect this on InventoryOpenEvent and InventoryCloseEvent? player.openWorkbench() fires when players interacts with a crafting table or is it done differently?
Hey,
I want make a flying arrow create a trail of blocks. What is the best way to do this?
A List of arrows and a global Runnable that places blocks for each arrow in the list or is there a better option?
Yea but how can I use functions from the main module?
pretty impossible
i believe at least?
you just do, i don't know how to explain it more, you can import any class from the other modules
How can i make a new bar, similar to health and hunger ?
Yeah.. I want to do it the "clean" way. I could save player uuids to the temp config and read from it and determine who used /craft but... that is a mess
StackWalker :trollface:
No, I need to make sure it won't break during reloads
Heck you could probably use a cache that exipires a few ticks after write
People use /reload all the time
the issue is that some plugin could always go and just do it w/o api (sending a craft inv menu) and then intercept those packets as well, and then u'd have no idea, (or mayhaps just nms)
but assuming all plugins are gracious, there is no real api to track whether it was naturally opened or by api, I believe at least (new api feature request?
)
hmm
it would be cool to have this.. some way to easily determine if an inventory was opened manually or by interaction
i'll think of something
i mean if people ignore the big red warning that shows up when you run the command that's not your fault
what about inventoryHolder? is it null all the time? even on interaction?
id assume its just the player
ok so that's where I can do it then xD
it's null if I open the inventory by code, it's a player if it's opened by interaction
no i think its the player regardless lol (not sure tho)
then I guess location? xD
weird stuff
I might just ditch the opening and closing messages but that would suck, i want it to be fancy
the location isnt saved anywhere sadly
or maybe it would be saved, but then if its null it prob gets converted to like the players location or sth odd
yea
regardless of what I put as location it gets changed to player location or workbench location
lol
Would't that be bit too maybe Runnables as the Minigames is only shooting arrows?
write some code and try it out
ok, thanks
Afaik runnable is just a wrapper around a
well, runnable
That just gets shoved in a list
good to know
SpigotRunnable when?
.runTaskEveryOtherHalfSecondIfBaracObamaIsPresident()
u can prob have some thing like a Predicates.<BukkitTask,Void>compose(task -> checkSomeCriteria(), task -> { doStuff(); return null}) and pass that (i think thats a thing in guava)
I figured if you interact with a crafting table, the location becomes a crafting table. If you open a crafting table manually and specify null player.openWorkbench(null, ...) then the location is a player location. That's how I guess I can determine things..
Nice.. I almost lost hope lol
fs it can be done, but I want obama in the api x)
lol, ig feature request?
you might as well not add that because obama will never be president again. See you have to check if trump is president because that you never know
the task may execute
watch me
he opened the crafting gui!! big win
I'm assuming it is considering they were using HumanEntity#openWorkbench
have I ever told oyu how I hate that method
yes I have, speaking of inventories
how's it going coll
Yeah but if you only want the message with the command
Just... send it in the command
No.. unprofessional 🤓
I guess that would only be for opening tho
understandable
i hope u have a good time :)
openBlock (not biased) >>>> openWorkbench
now that you hate it im going to use it forever many more times until i die
XD
not if we just... delete it out of existence in the api
deprecated soon
maybe in 1 or 2 major updates?
anyone know how to modify the biomes sent in the chunk biomes packet with protocollib?
I didn't know that openBlock existed, I'll take a look at it
it doesn't exist yet
I'm just being annoying about my PR as always
smh
Coll is gonna ban me :( its okay I'll email him instead
@umbral ridge just a heads up thouhg openEnchanting doesn't work if you're going to do that one
oK thanks for the heads up
I wasn't planning to do that one though
only the classic essentials commands
I might do /enchant
Wait it doesn't work?
nope
see my PR 😈 you need to wrap it in a TileInventory aka SimpleMenuProvider
:>
Wonder when it did work
Speaking of PR no love for my sign ticking PR
soon ™️ :]
I think its cuz paper did that sign one already and our code was similar to something
iirc choco commented about that on one of my prs
eh doubt it
the sign ticking shit can really only be implemented one way
I think
I mean you could just comment out the whole tick method, it'd still run the tick method but ig that wouldn't prevent them from ticking
Yea
I quit on working with signs I was crying too much working on my last sign PR
the SignChangeEvent or whatever its called I tried to add blockstate to that
yeah nah fuck that that's not working properly
that and even if you did update the block state within the method it'd just be overriden immediately
because of where SignChangeEvent is, I might do that PR again juts take a different approach seeing as you can't edit the block state directly I have to add methods for each operation instead
@eternal night working on new spigot PR, Prevent ticking (performance)
Implement /tick freeze on spigot globally
That's not until next version!
spigot-preview
spigot-snapshots when?
I wouldn't mind adding some form of snapshot support the main issue is I wouldn't know where tf to start with updating an entire server codebase
Yea, problem is always when you finalise API
and people not understanding that snapshot API is not final
which I presume is why spigot isn'T updated publically on stash
@ApiStatus.EXPERIMENETAL FTW
people dont give a shit 😂 method exists, method will be used
forRemoval=true
¯_(ツ)_/¯
I would love to play around with internals while updates occur
oh maybe spigot super-duper-experimental branch
I don't think we've had anyone come here complaining that the experimental branch broke their shit
So we good so far
Well
Experimental branch has like 0 usage for people right now
Like, sure, API is awesome
but if you tell people, heyyy, you can now technically run snapshot
speaking of awesome API 😈
didnt know that existed until now 👀
Wonder if fabric has many issues with it
I mean
fabirc doesn't have much of an api
Probably not as fabric based servers are still pretty rare
you know you're learning low level when someone calls the memory slow
i mean we get some incompatibilities here and there
but like we just fkn drive over it with mixins
since some mods rly just update instantly and others take forever (still quite nice to run new stuff)
how do you get a server tps? I've read about this MinecraftServer.getServer().recentTps but apparently it's deprecated? Do I have to use reflection? If so, how do I add the jar in maven project? or how does this go
found a possible solution https://gist.github.com/Techcable/6b870420de7b746b0ae8#file-tps-java-L34
You didn't build 1.17 with sources i think
oh i need to build with sources?
Just rebuild
Don't worry about it
You can delete folders from your buildtools folder for a clean rebuild
The files in .m2 will be replaced
ah ok ill do that then
The field is probably fine to use
java -jar BuildTools.jar --rev 1.17.1 --generate-source --generate-docs
like this?
Yeah but I still need to use reflection I guess.. Its unrecognized I can't import things such as Reflection..
Do I need a special jar?
add maven dependency
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
Is it possible to create a Minecraft plugin in Python?
Probably not
Just use java
Why go through that pain
technically yes but that would be the worst idea ever
here?
yea add it
its not reflection
its just nms
I knew you couldn't use Python.
Ok