#help-development
1 messages Β· Page 2119 of 1
It is
I mean you could code them in C
well if you have the right compiler
Not without an interpreter
or something that transpired python to C or Java
there is no python documentation
With C he can have native binds
?
Maow isnt the type to leave cuz he's been called dumb
don't just learn java at that point
I love python bro its amazing just don't use it for spigot development :/
lol you gotta know when to use a language
ive never seen anyone that learns python except since it sounds easy
python does not suck its just not the right place to use it i guess
py def has its places
well not in servers
I dont see a use for py except ML
If you're knowledgeable in Java, you can write a Python plugin loader implementation
bots>
Bukkit is designed to have plugins be loaded in any language
?
WHY
Discord bots work pretty well with python too tbh
u can make bots in any language that you can send requests with@dark arrow
Though it's very, very old and doubt it works anymore
You can do it with any language
yah but python is easy
so i guess i have to learn java π¦
That plugin doesn't even use the plugin loader like it should lol
EDIT: Oh it does! I lied
if you learn a langauge because it's "easy" you're either a 12 years old or on drugs
or
java isn't too bad if your familiar with the concepts already
you're not serious with learning it
yeah, I mean learning java wont directly harm you, quite the opposite if anything
>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<+
+.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-
]<+.
``` cough cough
throw new InvalidPluginException(new Exception("This shouldn't be happening; go tell whoever altered the plugin loading api in bukkit that they're whores."));
LMAO
if you want to do android development too I might reccomend kotlin over java but if your just doing minecraft plugins stick with java
Python has no use at all except for very specific things that most people dont even use, with no use I mean that there are way too many alternatives that may or may not be better
lol wtf
i mean tot say that mincraft was my favourite game so i wanted to learn plugin coding and learning java will take time thatts why i was said
brain**** ?
I love my python ML libraries leave me alone
hi
I mean py is good for more than just ML lol
very specific things I meant ML and a few others ig
Example?
i have a little question
?ask
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!
like first of all isnt quite verbose, and yes whilst it certainly isnt the most performant lang out there it can scale quite well in backend
It's messy as fuck.
python is a very good language for machine learnig and backend of websites
messy as?
As I said, there are many alternatives
if someone is spectating an entity, is it possible to detect the mouse scrolling and the mouse motion x and y ???
the type hinting in py is dogshit fs
but py is definitely not messy
perhaps the oo part a bit
Well that might be opinions
but oo kinda sucks
but it's syntax disgusts me
you can code messy python, but you can code messy any language
PlayerMoveEvent or smth
wait
I picked up java because it's easy
altho idk if thats a valid reason to dissuade yourself from it
its not my firend programming language
hm
and i am 14 yers xD
does it detect the player movement or the mouse motion ? sorry if my english is bad :/
Whats a firend
I learned Java and nodejs cause they were easy
*first
isnt it kotlin a language based on JVM?
yes
my bad
thats you then
thats why you can make spigot plugins fairly easily with it
I mean you can say that to any foreign programming language, altho its not a valid argument, just an opinion
print("hello world");
```vs
```java
class HelloWorld{
public static void main(String[] args){
System.out.println("hello world");
}
}
'''easy'''
easy is quite subjective
So in others words Kotlin, Groove and Java are the same shit with diff color.
The whole concept of just writing a line of code and it works makes me cringe
thought u liked abstraction
java forces you into oop
Conclure fully java apis only contains interfaces and abstract right?
it abstracted my whole project
no not really
boiler plate doesn't add difficulty imo
that's not what I like lol
because if someone is spectating an entity he cant move
a java api mustnt have only java interfaces and abstract classes
I need a good tutorial about java apis
imo it's quite unorganized that you just write a line of code and it works
It's always been easier for me to read java than something like python, and debugging java is much easier than debugging python imo
and writing it in a function will also work
Same
Java makes sense to me
idk I dont see why it would be unorganized
Non hightly typed languages == shit
Python is so unorganized and empty of rules it hurts my eyes
like you can write one line in java and make it work as well
empty of rules such as?
Sure but there are some concepts like
yea java doesnt care about line breaks
unless your writing macros or scripts lmao then have fun
My api just has normal classes in it along with heavy interfaces and abstract classes sprinkled in
they're there for us to read it easier
Just code dive projects
Burch do oyu have a github tutorial for apis?
the compiler just deletes all spaces and line breaks outside of strings
you can in py enforce an entrypoint also
and code is divided into classes that you have to declare
and you have to write the type of the variable
No its an api you kinda just make it
But not enforced
The big nope for python for me is debugging and lack of curly braces lol
which is good
If it doesnt enforce at least 2 of what I mentioned, it's unorganized imo
There are exceptions surely though
I know just a tutorial with recommendations, good practices, etc
quite weird definition of unorganized
my favorite part of python is no semi colons lol
I always want to add a picture to a python exe but never find ho
but Ig
I mean py still has types
thats one more thing
I never once looked at a tutorial for it
I just shoved a bunch of shit together, it looked nice and runs smooth so its good for me
lol 9/10 modern languages make semi colons optional
guess you're stuck with java, C# and older langs
according to me, python is a language which is easy for beginners but its hard to master as it divided into multiple categories and there are lots of libraries to know about
that shity because you dont know when another line of code end
π€
bruh
If you learn it since its easy for beginners
quit
just look at the end of the line?
Well yes, but what if i wanna do a lot of shit in one line
:O
like Cipher project
well then cry
i learned it for ML and pyautogui(for bots)
some languages still have them
^
Compressed javascriot web code: end of the line?
I learned python and java because its easy for beginners and I had some applicable uses I might find with the languages.
theyβre just not required
is there any hotspot intrinsic method in java to copy collection in range to another collection or an array?
its just that they're optional like kotlin for instance, as semi colons for line termination has been proven rather boilerplaty
You definitely wont take it as a career though, will you?
System::copyarray
or well
and you couldve had so much potential if you started with something low end like C
Python? Not unless I do data science then i might look into alternatives though. I'm more into software development, but I haven't touched anything outside of Java.
but even if you had, you mightve ruined it with learning python as your first since it'll take you a while to get used to C or Java syntax and principles
oh
i think there's none
toArray?
And I doubt anyone will care about python in ur portfolio
if it's me, I would ignore it
if primitive destination array overfills
that heavily depends on which company
I would care more if you had Rust, or some low end languages
List.of(...) or ArrayList#addAll
.toArray()
Sure ig
py isnt amongst top 5 for some random reason 2hex
there are quite justifiable and good reasons
hello all. if i were to want to change the max stack size of an itemstack, would reflection be the approach. or is there even a feasable approach
ah
but from what ive seen, i havent seen anyone hired merely for python
i need an array not a list or collection
Arrays should have a similar method to those
mye its probably hard to get in anywhere by just knowing a language, like you pretty much need to know other technologies as a minimum such as kubernates, docker and redis
there's a maxStack int
on the Material enum
eh fuck it, im just gonna do my own iteration
π₯²
lol
System.arrayCopy
hi guys
hello eytan
hello
Stack overflow may have some answers
i really need help
bruh
I need to copy Collection to array. If it overfills, skip overfilling parts of array, just copy how much it'll fit inside array
in next april fools i want this channel to be renamed to SO-ripoff
it would be funny
prob never happening tho
then just loop
yea, i was hoping to find something like Arrays.copyOfRange hotspot intrinsic method but for collections but oh well,
i would've used Arrays.AsList() if there was Collections.copyOfRange()
i need to detect the mouse motion of a player spectating an entity (he cant move because he is spectating an entity)
and the mouse scrolling
Collection<Object> collection = ...;
Object[] array = new Object[whateverMySize];
// Collection might not be ordered
int index = 0;
for(Object object : collection) {
if(index >= whateverMySize)
continue;
array[index++] = object;
}
problem is
collections do not have any notion of index based order
thats an impl detail for List and its derivative
Ok then, Lists?
ye
i would have used og for loop here, instead of enhanced for but ok
dovidas, iirc ArrayList even overrides toArray methods from AbstractCollection
naive me thinking that hashmaps were looped by order of insertion 4 years ago
so might be worth looking into
There's no Collection#get(index)
with iterator
I asked this question million times but...
org.bukkit.plugin.java.JavaPlugin cannot be resolved
i tried it with maven but still
i cant code plugins until somebody answers π¦
is there any difference in sending a mob effect packet to add glowing to an entity vs a entity metadata packet?
Hi Guys Someone Can Tell me how can I add extraordinary enchants to ItemStack
enchantd.addEnchantment(Enchantment.DAMAGE_ALL, 2);
for Example I wanna Make 50 Level Sharpness Enchant...
itemMeta.addEnchant(enchant, level, ignoreLevelRestriction)
i need to detect the mouse motion of a player spectating an entity (he cant move because he is spectating an entity)
and the mouse scrolling
Thank You @eternal night and @river oracle Guys :))
Entity metadata is preferable
the potion effect is only used for spectral arrows
please dont ignore me
ok thanks
what build tool are you using ? share your pom.xml/build.gradle.kts ? what ide are you using ?
eclipse
and you are using maven ?
yes
Oh I couldnt add enchant after that
@eternal night Can You Look That Please
I mean
that is just invalid java
the pom.xml looks good so far
I am unsure how eclipse handles maven
maybe you have to import the project as a maven project ?
Well the pom.xml looks good. Sorry I am not too used to eclipse and cannot really help you passed that
somebody here using it?
ok thanks
Someone Can Help Me On This
Hey guys. I saw a guy doing a weird thing and I was thinking about remaking it. He made a plugin that adds clothes to a player skin but doesn't remove parts like the player head skin. Have you any idea?
Pass the itemMeta variable into that method
add the enchantment to the itemMeta, then pass it into the method to set it ^
O
Pls help me
I mean it's basic java u should know that
No idea
Cool
isn't that skin thing just toggleable layers? that's vanilla
Yea ^^
Yep, It adds layers I think
vanilla skins have layers you can toggle in your client settings
that's not a plugin
you will have to have a list of skins with these clothes and do something with their profile
Hey
"and do something with their profile" that's the question
Like That?
take the addEnchant thing out and put it onto its own line
then do setItemMeta(itemMeta)
just make sure you add the enchantment first before setting the itemMeta
you can use NMS to change player skin
enchanted.setItemMeta(itemMeta)
oh wait I think I se
that itemMeta call is useless
Mojang provide an object called GameProfile to store player informations
including name UUID skin and other stuff
you can use NMS to get access to GameProfile and use reflection to edit it's fields
actually no
GG GUYS ! Thank You So Much
it can take texture as string
MineSkin.org allows you to generate skin texture data for Minecraft which is signed by Mojang.
can you also help me
you can get those string value by this website
i asked milion times
this
are you trying to code with NMS?
what is NMS
just normal API, get it
i already shown and he said its ok
why is the event not called even if i held an item when i right click in the air?
see
https://paste.md-5.net/urebobubiw.xml was their pom
ok thx
change your java version to 17 and try again
maybe java.version murders them here π€ is spigot-api java 17 these days ?
yes
oh really ?
java 17 and above is required
well the server needs it
I am talking about the api
bukkit still compiles to java 8
i changed but still
rebuild your project or reboot your IDEA
sometimes it just break for no reason
ok
sometimes maven has strong requirement on java version(I actually don't know if that is true, but I used met this kind of problem which solved by change java version)
OMG
How Can I check my args[0] if Its "zombie"? The code works no matter what I type.
.equals
oh wait
preferably .equalsIgnoreCase
it isnt
the red underline just didnt load so i thought it worked
Hopefully you are checking the args length
Are you sure that IJ is using maven?
<repository>
<id>spigot-repo</id> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/
<url>
</repository>
try to use this replace your spigot-snapshots
If so, are there any errors in the resolver? If so, you might need to reinstall you IDE if the error indicates that the certstore has blown up
still
i have a hashmap here thats storing the ItemStack and a Particle but im getting a error on line 62 saying that its null
Guys Im making boss plugin now What Do you think of Boss's Health. What Should It Be
Try to install maven I guess and compile it via maven directly. If it works you IDE is messed up and you might need to either reimport the project or reinstall the IDE
Boss bar
i think thats good
?paste it is easier for us to analyze text really
don't ask for suggestions ask questions with your code
Oh Okay
have you checked your initialisation of the Hashmap object
Its also about my commands π
But Okay
Hi, how can i listen for every single event in minecraft? like is there like a onEvent(Event e)?
Also I might need the full NPE @sage merlin
NPE?
null pointer exception
NullPointerException
oh
Not directly
There are a few libraries that facilitate this however
the only. problem here is that the HashMap gets initialized when the inventory is opened
How I can check if the enable bungee option on the spigot server is on ?
and when they shoot its not gonna allow them unless they have opened their inventory
but im still getting a NPE
or nms Particle type null
can you show us your log
Just use java 15+ and stop wasting our time
And no, the "but minecraft version X does not support Java 15" argument does NOT hold up
What is better redis client for java? I am considering jedis and redisson.
?stash
How I can check if the enable bungee option on the spigot server is on ?
One option is to read the yaml
It's seems very confusing without full code
Probably means that the particle is null
Agree for sending errors/code its better to use ?paste
?paste
You see, but people are afraid of text, so they need to waste our bandwidth and send text as images
and we can't get settings ?
Yes you can
?jd-s
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Server.Spigot.html#getConfig() is the best you can do I guess
declaration: package: org.bukkit, interface: Server, class: Spigot
Oh i forget that
geol
Do you have experience with multi platform plugins (Bungee and Spigot) ?
and all time the name of the spigot.yml is spigot.yml on paper, on mohist ?
No
how ?
just use the method I linked to
It is going to remove the need to locating the config file
That being said it might not be present on pureblooded bukkit implementations
Because im trying to design a Boostrap class which allow me to use some commons method (getPlugin(), getManager(), etc) and no matter if im using bungeecord or spigot. What do you recommend?
For some things you can use wrapper objects that delegate the calls
how I get the spigot object ?
Only can be done if you are using Spigot jars of course
Bukkit.getServer().spigot()
Geol
Otherwise going fully procedural (i.e. abusing the special status of Object) will work but you know the cost of doing that
Wow its powered I search that since 20 min thx (I just put all time Spigot XD)
Because for example if i add Boostrap to a constructor as an argument and do: boostrap.getPlugin() then i cannot access to all the methods it has
Do i explain?
That my issue
I think I understand you but I think it is better if you were more specific there
Ideally it'd be best if you share what you have tried (or what you already have)
Yhes that what i will do
Boostrap class:
public interface Boostrap<T> {
void onEnable();
void onDisable();
T getBoostrap();
}
Different boostraps (An example of one):
public interface BungeeBoostrap {
Plugin getPlugin();
PluginManager getManager();
}
And im stuck there
ideally you'd not want to expose the bungee or bukkit side of things at all
So wrap every single method call
My idea is to be able only to register commands, listeners from bungee and spigot
But them im stuck how to do the implementation
I will be really thankfull if you help me
One way would be to have something like
public interface Environment<P, M> {
public P getPlugin();
public M getPluginManager();
}
public interface BukkitEnv extends Environment<Plugin, PluginManager> {
}
public interface Bootstrap<E extends Environment<?, ?>> {
public E getEnvironment();
}
public abstract class BukkitPlugin implements Bootstrap<BukkitEnv> extends JavaPlugin {
// Some shit
}
And so on
When I'm using my plugin main class instance and fields / methods in it, should I do e.g. Main.getInstance().methodHere() or should I make that method public static too and use it like Main.methodHere()?
but really exposing the bukkit/bungee datatypes outside of explicit casts is pretty much the opposite of multiplattform
Only the getInstance should be static
ok! thank you!
JavaPlugin.getPlugin(Main.class)
So that code would be the correct or not?
Why? Just on main class set main instance = this;
No static fields :)
?paste
It really depends on what you are aiming for
why should I use that instead of static instance?
My idea is to do a unified library for doing plugins no matter if bungee or spigot
https://paste.md-5.net/ekuseludab.java
can someone help me please with changing the lore
Well it basically does the same thing and is more convenient while you can still say that you did not perform static abuse
You see the notion of library is already vague enough to allow too much wiggle room there
You can do:
declare: MainClassName instance;
onEnable: instance = this
getter: getInstance() return instance
Is it just some utility methods? A while bukkit api rewrite (more or less) or something else
Because the way one should behave changes drastically depending on the type
Now that I think about it the whole "Bootstrap" system you want to have is a bit counterintuitive considering JavaPlugin.getPlugin exists and bungee probably has something similar
?jd-b
?jd
And nope, bungee does not expose the "owner" of classes in an easy to use way
I still have a trick up my sleeve: https://github.com/SpigotMC/BungeeCord/blob/master/api/src/main/java/net/md_5/bungee/api/plugin/PluginClassloader.java#L33
how would I get a Player object that has been defined in a different public class into my event listener?
i basically define a player in a class, then I need to check if the attacker from an EntityDamageByEntityEvent is the player that was defined in the other class?
The players name is also in a hashmap in the same class the player got defined in
val proxyServer: ProxyServer = ProxyServer.getInstance()
error:
getInstance() must not be null
context?
trying to get player from other server with bungeecord
can i set the blockType to an itemstack?
or map the optional type
like: ```java
location.getBlock().setType(asdasd);
and asdasd is an itemstack
and asdasd is an itemstack with a playerhead with textures
what you mean about that?
Not that way at least
Geo another question related to what we where talking why when i extend the abstract class BungeePlatform, doesnt ask me to implements the methods onEnable() and onDisable() from Boostrap class?
https://kotlinlang.org/docs/null-safety.html look at this
Did anybody use redis client (jedis) with gradle kts?
as in use it within the buildscript or what?
Yes, I mean i added to dependencies that line compileOnly("redis.clients:jedis:4.2.2"), but I have classnotfoundexception
I don't know the gradle very well, so I don't know if I typed it correctly too
You need to add it in the plugin dependency block
But why the hell do you need a database for building a java project?
my man needs redis, a common dependency
Why geol?
But not for building java packages!
you're getting NoClassDefFoundException because you added redis as a dependency, but redis' implementation isn't present on the server
Sir, he wants to use it to build it, not to run the server with
Otherwise they would use implementation instead of compileOnly
As well as using the gradle shadow plugin
yeah he wants to shade redis because spigot doesn't include it
what's the problem with that
Well I just want to be pedantric, okay
Hello. Im trying to write a plugin that avoids using an exploit. Every broken sugar cane that is gown naturally not placed shoud have message. But that doesnt woek. Why?
@EventHandler
public void onNiszczenie(BlockBreakEvent e){
if(e.getBlock().getType().equals(Material.SUGAR_CANE)){
List<Block> exploit = new ArrayList<Block>();
if(exploit.contains(e.getBlock())){
exploit.remove(e.getBlock());
return;
}
e.getPlayer().sendMessage("GITTTT");
}
}
@EventHandler
public void onPostawienie(BlockPlaceEvent e){
if(e.getBlock().getType().equals(Material.SUGAR_CANE)){
List<Block> exploit = new ArrayList<Block>();
exploit.add(e.getBlock());
}
}
You're creating different lists
Your list is discarded after the invocation of the method
Make a field
?learnjava moemnt?
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.
Lmao the bot works when his as sings
can you paste an example of field. never used that. So basicy I can use field outside of EventHandler?
π
Did you learn java before plugins?
Once anobject is unreachable it is garbage collected. In this case it is unreachable pretty quick considering that it isn't stored to a field or something like that
Most od not
Yeah i know i ask just for curiosity
nvm i figured it out
public class class10001 {
private final Object var10001 = new Object();
}
This is an example of field
I hate publishing updates
If everyone knew how to compile from source everything would be much easier. Sigh
instead of uploading a plugin, upload an updater that pulls source from github and compiles it π
Hey, I just recently picked up plugins and am trying to create a button that will teleport players upwards or downwards. It's basically an elevator button and I wanted to add a custom data or some form of identification for the button, like "elev_button". I don't know how to do that however, since if you name a block something and then place it down, the edited data is lost. Anyone got tips?
Oh I tried using datapacks but I ran into multiple problems when trying to code this lol
perhaps you can also make a CD workflow that automatically publishes releases to bukkitdev and spigot
so then you just write a commit message which automatically pushes to your resource distributor
I probably could
thats actually something I'd be interested in looking into
@worldly ingot you're very amazing would you tell me if it's against Spigot TOS to use their endpoint to publish an update with CD
can I give a block data via PDCs, that will stay after placing and picking the block up again
I don't think we have an endpoint for uploads on Spigot
At least not to my knowledge
ok, so probably i have problem with it, I've never used shadow plugin with gradle
I mean there has to be something that allows users to upload, or else how does the frontend do it
Yeah i think the same as you
Maybe they use websocket for uploading files
so it seems it does
POST https://www.spigotmc.org/resources/RESOURCE/save-version
{
"resource_file_type": "file",
"file_hash": HASH,
"version_string": VER,
"title": "New Update Yo",
"message_html": "<p>My Greatest Update</p>",
"attachment_hash": HASH
... [xf? json parameters]
}
POST https://www.spigotmc.org/attachments/do-upload.json?hash=HASH&content_type=resource_version&key=resource
FORM DATA containing the binary file upload, content_data[resource_id], content_data[resource_category_id], and a bunch of other file properties, along with xf? properties
though I don't really know what xf is, if it's cloudflare tokens idrk that a machine would be able to automatically upload a resource for CD
does any of you know what kind of inventories are nameable serverside?
I know few, like chest or furnace
but is there any list i can view instead of painfully testing it myself
im lazy
i found those containers which are renameable:
Enchantment Table,
Furnace,
Brewing Stand,
Dropper,
Hopper, and
Dispenser.
Chest,
Trapped Chest,
Smoker
anything to add?
why tf Loom is not renameable while Smoker is
Mojang pls fix
Why does a log filter out everything for the console, it logs out everything once its passed through a filter, i know im returning it as Filter.Result.NEUTRAL, but once this is inside the server it stops every log entirely
why does BlockBreakEvent executes twice?
@EventHandler
public void onPlayerBlockBreak(BlockBreakEvent e) {
if(e.getPlayer() == null) {
return;
}
Player player = e.getPlayer();
System.out.println(e.getBlock().getType());
if(e.getBlock().getType() == bed) {
if(!this.players.contains(player)) {
Bukkit.broadcastMessage(ChatColor.BOLD + ChatColor.WHITE.toString() + "BED DESTRUCTION > " + ChatColor.RESET + ChatColor.RED + "bed was destroyed by: " + e.getPlayer().getName());
} else {
e.setCancelled(true);
player.sendMessage(ChatColor.DARK_RED + "[SYSTEM] " + ChatColor.RED + "You cannot destroy your own bed!");
}
}
not finished but that's not the point
Bed has two parts
ohhhh
lol
nope
still
everything I break executes the event twice
maybe is it registered twice????
what do the CachedPlayer and GameState classes do/what are they?
why is this not correct?
Hello, I'm trying to make a random teleport plugin but when the range is big and the selected random chunk is not generated yet it creates huge amount of lag for everyone on the server, how can I prevent that ?
Because I'm trying to check if the location is safe so I need to generate the chunk and it freezes the server for several seconds each time someone rtps
Yes but how do I do that?
I didn't think generating a chunk and check if it's safe would take that long
bump
generating a single chunk should not generate much lag to be honest, but when the player is teleported all chunks in his view distance will also need generating. so, you could make the player wait like 5 seconds and use those 5 seconds to generate the needed chunks. but not all at once obviously. spread it out over those 5 seconds.
i would for example generate only the selected chunk. check if its safe, the continue to generate X amount of chunks in X radius around the chosen chunk.
I already do that, I chose a random location, check if the location is lava and if it's not lava the player is teleported 5 seconds later
But the thing is when I do the command the server lags a lot when trying to check if the location is saty
The lag is not when the player is teleported it's when trying to check safety
someone mentioned changing the max itemstack size via the material, but int maxStack is immutable. I've tried using reflection (which may or may not be the right approach), and got java.lang.NoSuchFieldException: modifiers. any tips?
ok can we see your code for this?
unsafe
altho
idk maybe its inferred
in which it wont be easy even w/ unsafe
im trying to reduce the stack limit, so im not sure. though it should be similar
yeah, make it to where only one of my item can reside in a slot
that can be made through other means
ive seen the approach of giving each item unique nbt but im not sure
technically just use sth like pdc for that
im pretty sure you can apply unique nbt
oh, I see
i were thinking code a stacking plugin?
so by trying to change the max stacksize, i would screw over a bunch of other things?
if slot 1 is at certain amount
if(System.currentTimeMillis()<lastRtpCommand+5*1000) {
getBukkitPlayer().sendMessage("Β§cDo not spam this command.");
return;
}
lastRtpCommand = System.currentTimeMillis();
if(!canRtp()) {
getBukkitPlayer().sendMessage("Β§cYou have to wait "+Main.getTimeLeft(lastRtp+Main.rtpDelay-System.currentTimeMillis())+" before being able to rtp again.");
return;
}
Location loc;
do {
loc = new Location(Bukkit.getWorld("world"), Main.random.nextInt(Main.rtpMaxDistance*2)-Main.rtpMaxDistance+0.5, 100, Main.random.nextInt(Main.rtpMaxDistance*2)-Main.rtpMaxDistance+0.5);
loc.setY(loc.getWorld().getHighestBlockYAt(loc));
}
while(!Main.isSafe(loc));
new TeleportRequest(this, loc, TeleportType.RTP);
}
public static boolean isSafe(Location loc) {
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
return !(badBlocks.contains(loc.getBlock().getType()) || badBlocks.contains(loc.getWorld().getBlockAt(x,y+1,z).getType()));
}
I was trying to change it for the Material.book instance, but still. i guess that would cause issues
ill just apply a random integer to them via nbt and hope that i get unique numbers each time
you are locking the main thread with that while loop
that'll cause major issues. lol.
it would be weird because like 99.99% of the time the location is safe and the while loop just executes once
not so sure 'bout that
could be a problem with isSafe then?
i dont think using Main thread is a good idea
its inevitable
you need it for generating chunks
but you probably ought to determine a threshold
I'm not sure I understand what should I change ?
tldr, but from what I understand that code snippet causes some lag right?
yes
well idk what happens in canRtp(), but you probably want to make sure that while look can iterate a maximum of x iterations
Conclure did you ever figure out that projectile thing from the other day?
as there's no upperbound as of now
thus causing the plausibility of a million iterations if you're unlucky
a bit, but like minecrafts speed and gravity is a bit random
Hide players from user count?
or well, extremely random and arbitrary
Was it somewhat accurate because that's all I need
Not looking for perfection
@dapper harness if you develop for paper. you could generate a chunk async
but idk if thats the case
nope
canRtp just checks a variable it's a cooldown and no the while only executes once
i didnt get that far as to being able to call it close
Oh alright. Thanks either way
I do but I don't know how, what I would like to do is just select random location, generate / load the selected chunk and once it is generated check if it's safe but idk how to wait for the chunk to load without locking the entire main thread
using a future
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(loc);
chunk.thenAccept(result -> {
}
for example
oh that too
and then in case you wanna go over to the server thread again, Server/Bukkit::getScheduler would be the only option
Heya guys, I was just wondering if something official has been released to solve this old issue https://www.spigotmc.org/threads/spigot-resources-api.68705/. Does anyone happen to know?
wasnt it not allowed?
i may be wrong as usual but as far as I remember there was a reason for it not to really exist connecting to the spigot and downloading the file, only allowing an update notifier
https://spiget.org/ is as far as you get in principle
what spiget?
yey TY
i only know spigot
nice!
ye

Legends never die
indeed
i need some tip!
i'm working with TLS
anyways to be better at making sense of source?
sense of source?
okay yeah there's no way we'd know about that from "TLS", TLS is a HTTPS standard lmao
@mellow edge BlocksBreakEvent its executed everytime a block/door, etc its breaked
Oh ok
Does anyone has a good idea which Websocket Server Library is good for Spigot Plugins?
nv websocket client
and okhttp
but if you're creating a web server system perhaps spring?
Question about my approach, the best way to make a mob that can build and destroy blocks to get to the desired target is to use the internal mob goal system correct?
Yeah, for custom mob AI you always want to avoid the overhead and just use pathfinders
Its for a Audio Server connected to Minecraft
The only way to detect a player and their alts is through ip right?
yes
Hey, someone know how to fix this?
that just means the method getNavigation doesn't exist for the Type EntityCreature I don't get whats wrong here
on old versions it's working but on 1.18 it's not..
I can't even find EntityCreature on 1.18 docs
maybe I'm stupid but I'm not even seeing the class
It's on nms
It's okay.
if it works on previous versions try to find a method with similar return type and brute force it
I'm pretty sure thats the best you can do with NMS
hey anyone have any ideas trying to depend off of local jar, but I keep getting artifact not found error
https://paste.md-5.net/uyexovezos.xml
it probably has something to do with my repo but I have no clue
fixed
ive been monitoring /tps for the entire development of my plugin, and it finally has dropped below 20.
i say that as if its a good thing... i have no idea why
^optimization time
How do I update a lodestone compass' location to a player's location constantly
Even player.updateInventory() doesn't update the compass to the new location after setting its metadata
@EventHandler
fun onPlayerMove(event: PlayerMoveEvent) {
if (event.player == runner) {
for (entry in playerTrackers) {
val meta = entry.value.itemMeta as CompassMeta
meta.lodestone = runner.location
entry.value.itemMeta = meta
entry.key.updateInventory()
}
}
}```
this is the code im using to do this
kotlin π€’
hi babe
What's wrong with it?
ugly
Would you prefer I write this?```java
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
if (event.player.equals(runner)) {
for (Player player : playerTrackers.values()) {
ItemStack stack = playerTrackers.get(player);
CompassMeta meta = (CompassMeta) stack.getItemMeta();
meta.setLodestone(runner.getLocation());
stack.setItemMeta(meta);
player.updateInventory();
}
}
}
How exactly is this less ugly
It's overly verbose
Anyway, I'd appreciate an actual answer to the question if you're here to judge, otherwise don't waste my time
use maven dependency and use system as the scope.
no thats a really bad practice I solved it already by installing the dependency into my m2 which is a better practice
i would use a foreach loop assuming playerTrackers is a Map
That's not the issue
The problem is that they don't update except for the first time when adding it to the inventory
don't you have to set the item in the players inventory?
or am I thinking of something else?
oh, i thought you was asking something like that
Ah, I figured that could be the case. The thing I'm trying to avoid is edge cases failing (two compasses for example)
yes i know, i use the local repository too
ah
Every example I see replaces every compass with the retargeted compass or changes the global compass target
Which is pretty bad imo
Not having ItemStack UUIDs kind of hurts
Good at Java/Kotlin, not good at Spigot, so I may be missing something simple here
guess you could try and track where the compass is in the inventory
And update it when they move it?
InventoryClickEvent
pdc
Is there a way to replace the item in the inventory without triggering an animation
inventory.setItem?
no
oh does it do that in later versions?
i have this issue before
Maybe I need to use NMS
well you can try to use packet interceptor
yeah client side
ugh
maybe I should just make it update when you right click it or something
lol
the main constraint I have here is vanilla compasses need to retain functionality, so I think that's a good compromise
it's for a custom manhunt plugin I'm writing
Just noticed wrong chat lol sorry
Ok let me just spit it out, been typing this for about 3 different versions, ok so i want to create a custom configuration, like message.yml but i know the usual way to set it up wont let you add comments like you can with the default config.yml, any way to set up custom configurations that way by creating the file and commenting it that way, i search in stackoverflow, all over YouTube, all over github like bro why isnβt there any files bout this at this point ive literally been thinking of decompiling a plugin and just checking out the code cause if others can do it why canβt i find out a way to do it
In reguards to your question
idk what you were googling
but there is a guide on spigot for custom configs
Yes yes yes
pretty basic
I want it also the spigot docs
Saving using default yaml lib also saves comments
but gets the kob done
idk why it would do that for you, never had issues with it
?paste
sounds like a stupid question, but does ANYONE know a way to serialize an itemstack to json using gson? i've tried everything i could find/think (directly serializing the itemstack, using the itemstack#serialize method, bukkitobjectoutputstreams, nms #createItemStack from nbttagcompound method) and all of them had flaws that made them not usable
i think you might be able to pass it to Gson directly, but deserializing may be an issue
actually
not really
you cant, itll cause a lot of issues when trying to serialize it
https://paste.md-5.net/makedanabi.java
// create config utils instance
ConfigUtils configUtils = new ConfigUtils(plugin);
configUtils.createConfigFile("config.yml");
configUtils.createConfigFile("messages.yml");
// get config
FileConfiguration messages = configUtils.getConfigFile("message.yml");
since gson can serialize too
U a god for this thank u so much Iβve been struggling with this for a while
this should work fine and you can just pass around the util or add a getter in your main class
itemstack doesnt have any transient fields so it keeps trying to serialize things it shouldnt
I hate the default spigot getConfig() crap
Same
have never used it
So do i
something about an itemframe and im sure theres a lot more
ahhh i see
hmm
i know somewhere in spigot source code theyres serialization for ItemStack -> FileConfiguration or YamlConfiguration
might be of help somehow
using the #serialize method kind of worked, but the problem it cant deserialize meta due to it not actually being an instance of ItemMeta
for ItemStacks I just translate in a readable format too and from an item stack
that way an owner could edit item stacks in the config too
i prefer to just use the commands I have setup in my lib though /retrieve and /send to send and retrieve items from the configuration file
yeah you would just have to basically format the json file yourself which in all honestly isnt that hard
I use yaml for this as imo its more readable and i'm tryna give an option for if you want to do it ingame or in the configs
i think hes saving it to save it through a restart or if it ever dissappears
cant use yaml as its getting stored in a database as part of a players inventory
Ahhh
what kind of database
mysql
Oof
Donβt know if this is the right place to ask for help on plugins I apologize if itβs not but anyone familiar with how to set an area for players to use shopkeeper plug-in
the one thing that actually did work reliably was the bukkitobjectoutput method
Serialize itemstack to yaml configuration -> translate it to raw yaml -> save as string in mysql
Would be stupid as shit though, better off more or less looking into something better
but then the problem was that in my api server it cant deserialize it because spigot acts weird when theres no minecraft serfver
same problem as before, cant deserialize it in api server
you can just like new YamlConfiguration().setItemStack() or something i dont remember the exact method one moment
ik that but itemstacks dont work at all when theres no minecraft server running
ie getting from a MemorySection or declaring them at all?
it would also be very strange to have all the api in json except for the inventory being in yaml
indeed it would be, more or less a last resort suggestion
what i have right now
basically a json field that stores the yaml config, its hacky but it would work nonetheless
You probably better off looking at the code behind something like this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/configuration/ConfigurationSection.html#getItemStack(java.lang.String,org.bukkit.inventory.ItemStack)
I beileve to set an ItemStack to config you just use set(string object) and theyres likely code on how they serialize it there, unless they just call ItemStack.serialize() then were in the same boat as before
Your likely better off writing your own quick serializer, wouldnt take that long either, just store name, material, amount, loop through PDT & NBT and store them under seperate values
its so close to working except for the fact it doesnt directly add the itemmeta to the itemstack
yeah, im probably going to end up just making my own
only problem is probably going to be nbt
you could use something like NBTApi if you dont wanna deal with it directly
handles all major versions down to 1.8.9
seems like all spigot does is run through and store the item meta directly but now you have to look for ItemMeta's serialize() method
the serialization part works fine
i have all of the info i need by the time its there for deserialization
the only problem is that in the ItemStack.deserialize() function assumes it was serialized in yaml, and thus the meta part wont actually be an instance of ItemMeta
wild question
have you tried serializing ItemMeta to gson instead of the ItemStack
i was thinking that
but then i either have to store both the itemstack and meta which is really inefficient
or make my own item system which wouldnt be that bad
i would have to check though if serializing meta even works though
well you would store a ItemStack object that has field type amount meta_data other_things
it might since its an interface and not an actual object like ItemStack
thats probably what ill end up doing
will have to make own methods of storing the stuff though
for type and amount ... or whatever
yeah but would be stupidly simple, just 2 lines of code for it
well technically 4 for both methods
yea lol
its what spigot does
2 lines?
just run through each item and manually setting them
wouldnt you have to create a JsonObject directly
and then set the fields of material and such
You could create your own SerializableItemStack class for gson parsing
i suppose
definatly do check if ItemMeta is able to be parsed through gson first before going through all that ofc
yea
if its not youll have to loop through everything in item meta which would be big sad
also what is the implementation of itemmeta?
i couldnt find it but i was trying to to see how it did custom nbt tags
Material class handles actually creating ItemMeta so i assume NBT is done somewhere in that
seems like its doing things with reflection though when looked, so that part might be more complex
wait no
im wrong sorry i was thinking of MaterialData
Bukkits ItemFactory handles that
is sneakythrows just runtime exceptions for normal exceptions?
checked exceptions
sneakythrows
sneaky
π³
indeed it is
oh my
okay nevermind you dont need to worry about pdt
PDT stores plugin instances, cant remember if they store as strings in NameSpaced values though but i think they do
So I'm not entirely sure how serializing PDT values to Gson would work, but if you're on an older version prolly don't gotta worry about it
yea pdt doesnt exist here
bada bing bada boom
actually glad i figured this out too cause now i can use it >: )
gg
dear me
really need to find what the itemmeta implementation is
found it but its not a public class π
Look into Bukkit's ItemFactory class
Nah its kind of just existed for a while with no codebase
theres a thing in it called serializablemeta that seems useful
little known fact spigot doesnt actually have code, neither does craftbukkit
yep
Im cooking atm so cant check that sry, can probably just ctrl + click methods till you find something useful from it
when i compile my spigot plugin using maven to a jar, my server cant find the plugin.yml even though it is in the .jar. how do i change how it packages it? using vscode btw
is there any difference in terms of resource packs between smoker, furnace and a blast furnace
do they all have separate textures for eac
or they all use generic furnace ones
Seperate
Just set it up, this is literally exactly what Iβve wanted and been looking for months, u are the best dude
what about chests, shulker boxes and barrels?
well shulker boxes have separate inventory type id, regarding the serverside view
but i can't see barrel there
Barrel is just a more thicc chest
but still it should be separate due to resource packs.
since its a different block which can hold items
Why are those related
anyone know what i should put in the commented section? ive tried to remove the item is a bunch of different ways but its none have worked so far
are you wanting to remove all tridents
itll only end up being 1 but it can be all
maybe search for the slot its in, then set that slot to Air?
03:50:35 [INFO] Loaded plugin reconnect_yaml version git:reconnect_yaml:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
03:50:35 [INFO] Loaded plugin EasyProxySystem version 1.1 by LionGaming1995
03:50:35 [INFO] Loaded plugin cmd_find version git:cmd_find:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
03:50:35 [INFO] Loaded plugin BungeeYAML version ${pom.version}-${build.number} by roblabla
03:50:35 [INFO] Loaded plugin cmd_server version git:cmd_server:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
03:50:35 [INFO] Loaded plugin cmd_alert version git:cmd_alert:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
03:50:35 [INFO] Loaded plugin cmd_send version git:cmd_send:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
03:50:35 [INFO] Loaded plugin Yamler version 2.4.0-SNAPSHOTb-16 by geNAZt
03:50:35 [INFO] Loaded plugin cmd_list version git:cmd_list:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
03:50:35 [WARNING] Forced host server pvp is not defined
03:50:35 [INFO] Enabled plugin reconnect_yaml version git:reconnect_yaml:1.18-R0.1-SNAPSHOT:eae9d45:1631 by SpigotMC
Can someone help me? The server always hangs for me. As soon as I pack my own plugin in
check your if/while loops for infinite
ProxyServer.getInstance().getScheduler().schedule(this, new Runnable() {
@Override
public void run() {
if (intege == 0) {
for (ProxiedPlayer all : ProxyServer.getInstance().getPlayers()) {
all.sendMessage(" ");
all.sendMessage(" Β§7Unsere Β§aTeamSpeakΒ§7 IP:");
all.sendMessage(" Β§aPixelerlebnis.net.de");
all.sendMessage(" ");
}
}
}
}, 0L, 5L, TimeUnit.MINUTES);
My Plugin send Automatically this message in 5 Minutes
hello I just started a project and I'm getting this weird error
Cannot resolve method 'setInvisible' in 'EntityArmorStand'
Are you sure the TimeUnit thing is actually functional
it could be running that every 5 ticks, instead of minutes
EntityArmorStand stand = new EntityArmorStand(((CraftWorld)p.getWorld()).getHandle().getMinecraftWorld(), pos.getX(), pos.getY() + offset, pos.getZ());
stand.setInvisible(true);
stand.setCustomName(pl.getName());
stand.setCustomNameVisible(true);
stand.setMarker(true);
thats a odd way for a runnable to be initialized though, never seen someone use schedule before
sec
EntityArmorStand might not have that method?
I'm pretty sure it does
well not mine apparently
but should have
import net.minecraft.world.entity.decoration.EntityArmorStand;
uhm is that a nms thing?
I dont see EntityArmorStand as a class in javadocs
normally its just ArmorStand
spent forever making this https://paste.md-5.net/famikeroxi.java but i give up now
runs into the same problem as before where it serializes fine but doesnt have proper typing for deserialization
tomorrow ill just bite the bullet and make my own item serialization system
The NMS methods may not inherit that trait, however why use NMS for this? As these are vanilla methods you can use, unless your on an ancient version
Also that import from NMS isnt a real type of LivingEntity, try looking into CraftArmorStand if you really wanna use NMS
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/ArmorStand.html
i may look into it here soon
and see what i can manage to slam together
gl
I'm 1.18.2
I would say just use the ArmorStand class then, as it provides anything you need, to making it mini to moving arms and legs, pretty much anything as well as everything from LivingEntity
my plugin still wont load. spigot says that it is missing plugin.yml but it is in the jar in the rources as specified on the spigot documentation. any advice?
have you unzipped your jar
and check if its in there
are you using maven?
where was it inside the jar?
Let me try
send pom
plugin.resouces.plugin.yml
~<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.cibmc.spigot.pluginbaby</groupId>
<artifactId>pluginbaby</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
</resources>
</build>
</project>~
oops
Yeah it needs to be in the root of your jar
?paste
bookmarked
how can i change the behavior of the maven package?
but don't use it for automated anticheat logs cough
Can you send the pom.xml in that paste link
hard to read in just discord text