#help-development
1 messages Ā· Page 1799 of 1
Did you import 1.18 correctly
thats not properly
read the news post on spigot front page of site
you can no longer just use the jar as a dependency
System path dependencies š
now this ?
what do you mean ?
i have now this
and this
but i still dont have the 1.18 import
Hey is it possible to get these spectator mode items? (the 2d head and the arrows )
That's what I thought but then again I'm pretty sure that server does something with it
even if its just packets
Because the player cannot teleport themselves?
Can someone help me? I cannot use the nms for 1.18. I already ran BuildTools and this is the build.gradle https://paste.md-5.net/xixamagoha.bash.
Add the API to your build.gradle
But I want to use the nms?
You already have NMS in your build.gradle
Yes, it should have everything that the spigot-api have right?
There is no EntityArmorStand too
The thing is already exist on the .m2 folder too
I'm trying to add a support for version 1.16, 1.17, and 1.18
You need to use java 17 if you want to use 1.18 NMS
It works on 1.17 for some reason
Although the classes should be exist, I will get compile error telling me If it required java version etc etc.
oh
i think i forgot to add mavenLocal() to the repo
No you don't. Only the server needs Java 17. Your plugins don't need to be.
Afaik you will get an error saying NMS has been compiled by a more recent version
Well I can't get a plugin to work only built with the 1.18 spigot version so I can't test that. But I have no issues with my minions plug in using NMS on 1.18
are you using the remapped?
You will get a compile error
you would need to use java 8 with reflection, or > java 17
which is super ass imo if u are going the reflection route
i'm fine using java 8 as the source and target
I've used all the jars. The spigot jar, spigot-api jar, etc... you can search for the convo.
Good thing I can't get my plugin to work with spigot shitty new jar system ;) other wise that would be the next wave of complaints
does someone know how to use the remapped-mojang on gradle?
Just cause mojang changed how their server software libs are used doesn't mean spigot can't make methods to convert it or make it usable like the old versions.
do you even know why Mojang did it...?
To set the libs aside... idk lol mojang Fucks up every update. This one is no different
Having a more independent library loading platform is arguably cleaner
Or they are attempting to get around certain licensing by loading a lib instead of compiling it ;)
Hi, for a while now i was using NMS to do a "raycast" to get what the player is targeting it may be a block or entities, is there a way to do that with the official API
ok thanks i'll see if it works like my old system
how can i change something in the class: net.minecraft.world.level.levelgen.GeneratorSettingBase
if it is not present in Spigot-Server ?
Excuse me, small problem, why does this give me an error?
String ssd1item = "STICK";
Material ssd1material = Material.matchMaterial(ssd1item);
Material.STICK is valid, but this doesn't?
can you try getMaterial ?
hmm, Ill try that
Does spigot 1.18 still use DataWatcher? I keep getting sudden errors with importing it
"The method getDataWatcher() is undefined for the type EntityPlayer"
yep, that worked, thanks!
hm
just wondering
only for you
do you mean on runtime?
oh no, its fine now, I used getMaterial instead
no for new settings while CraftServer.createWorld
hey guys, I'm having some trouble making my very first mc plugin...
im getting an error which is
package org.bukkit.plugin.java does not exist
and a few more similar ones
i followed a tutorial in a website, and did exactly what they said
i want to access the constructor of GeneratorSettingBase during runtime
do you know java
just wondering
for that i need to change the constructor from private to public
ok but did i say im helping you wtf
i was talking with the other guy
i do little bit
Use reflection
and i have the api/package
do you have maven
no
gradle ?
the tutorial didnt say anything about maven or gradle

sounds like a trash tutorial then
do you have IntelliJ
until you learn maven and how to use it, use IntelliJ's Minecraft Development Plugin
Guys what do we use for NBT packet injection in 1.18?
alr
are you sure this is a good idea when i try to implement it for the API ?
the api? What api are we talking about
And no Iām not sure since I havenāt read the entire convo š
is there anywhere explaining PacketPlayOutWorldParticles ?
i try to add stuff to the WorldCreator- Spigot-API, for that i need to change some stuff in Spigot-Server: CraftServer.createWorld
What stuff are you trying to add?
found it
im using eclipse
should i download intelliJ instead?
I mean if youāre trying to pr something maybe just make the constructor public?
Then let md review
yeah exactly there is the think i dont know.... there is no GeneratorSettingBase in Spigot-API to change .... do i have to add it myself ?
Probably
That might not even be a class in the api as of now?
Why is --remapped only giving me a bootstrap jar?
might actually belong to the implementation
its is an nms class found in "net.minecraft.world.level.levelgen"
Ah yeah makes sense
and, is there a solution for missing nms-classes in Spigot-Server ?
Does any1 have a link where I can read about the public and private void thingys In Java. Itās something I rly donāt understand
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.
private means only the class itsself can access it. Public means any instance of the class can access it.
uh ok.
hello guys, i just wanted to ask how do i use the inventory.meta.Damageable, since this doesnt seem to decrease the item's durability
Check for ItemMeta:
if(itemmeta instanceof Damageable)
Cast:
Damageable damageable = (Damageable)itemmeta;
-> Change dmg to what you want
Apply ItemMeta:
itemstack.setItemMeta(damageable)
something like this should work
i cast the damageable back to meta? since its the setItemMeta is only defined for ItemMeta
yes
okay thx
its not necesary cast again to meta for the set.
however eclipse errors me
unless you are using a very old version... because since a specific build you can do this with the Damageable
what error?
method .setItemMeta is undefined for type (Damageable) use (ItemMeta)
1.16.5
anyways it working like this so im glad
then you need cast again.. this was fixed in 1.17 where you can set the Damageable in itemmeta
is the build for 1.18 out?
yeah using buildtools #announcements message
wrong url.. https://www.spigotmc.org/threads/534760/
oh yeah cool :d
@late sonnet is there a solution for missing nms-classes in Spigot-Server to create an PR which needs a class to have a public constructor from nms?
you mean the class are not in Spigot-Server (Spigot Repo)?
for craftbukkit you can search in the work directory if the file exists and copy to the project for make changes and generate patchs. you can read the README from craftbukkit or spigot for more info.
yes, net.minecraft.world.level.levelgen.GeneratorSettingBase is not in the Spigot-Server-Repo located
yeah but you wanna make a PR for spigot or craftbukkit?
you can search the class in work/decompile-xxxxx/net/minecraft/world/level/levelgen/GeneratorSettingBase.java and move where you need in spigot-server or src for CB.
i want to create a PR for spigot
then use this and copy to src in Spigot-Server and you can work with this.
ok good thank you
Search for the minecraft development in intellij plugins search bar
It will pretty much do everything for u
?learnjava when btw?
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.
ok
its the packages
anyone have an idea how to get a server's remote IP if it is not specified in server properties.yml
Wrong channel
dont think so
And it mostly localhost:25565
This is dev channel
yes... and i am developing a plugin.
Bukkit.getServer().getIp()
just gives you whatever is in server properties
is there a way other than fetching data from like a whatsmyip url to get remote IP built into spigot/bukkit api?
Then it might just default to localhost:25565?
Nah im not replying to the bottom part i dont even understand it š
it seems like you didnt/dont understand any of my question...
use REST api
rest?
A RESTful API is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. That data can be used to GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources.
basically fetch data from the web
i mean this is kind of the thing i was trying to avoid
is spigot not self-aware of its own external IP?
well you can do it via java
Why do you need the server ip
I'm using it as a way to create a list of servers actively using the plugin i'm creating
just add bstats
^
it tells you anythign you want it to track
Microsoft adds Buy Now, Pay Later tool to make purchases and pay later. Users arenāt happy with it because itās unnecessary and enables people to spend money they donāt have.
wtf Microsoft
you're going to make people go into debt
it tells you number of servers running yrou plugin, no users, OS, server adn all sorts of other things as default
but in order for it to give you a list of servers running it you have to add functionality to it
you won't get a list of servers, that would probably be illegal unless you have a licensing agreement with the users
and the server has to be self aware of it's own public ip in order to list that information regardless of if you are using bstats or making something from scratch, as i am, all im trying to figure out is 1) is spigot self aware of it's own public address and 2) what is the method built into the api to print that info to a string
mcstats used to have this feature built in.
public address is nto easy to get in java, you have to check the gateway. Its easier to query a whatsmyip site
before it well, died, you used to be able to even search on a master website i believe for all servers running a particular plugin so if you only wanted to play on servers w/ specific functionality you could
used to have, is probably the key sentence there
If I remember correctly mcstats required teh server owners to register their server on teh site before it displayed them
i'm not sure about that
it would be quite illegal (in all of europe) to do it without asking.
GDPR and all that
but you definitely do not need exclusive permission or a license agreement from a user to log their IP, if that were the case then every single minecraft server in existence is already breaking said rules
as your IP is logged on join, same with most every website you have ever visited, most websites log user IP for analytical reasons
Well I can;t comment on that, however I do remember we are not allowed to discuss legalities in here.
md spanked my ass a while back for doing so š
well as i said before thats not what i was interested in discussing anyways just wondering if anyone can shed some light on if there is a way to do it without scraping data from an external URL
if not then no biggy, i will just do it that way, i would just prefer not to use an external source if i dont have to
guys what is the ParticleEnum for the cool blood particle that plugins use
is this related to something with nms ?
yes
what is the context ? you wanne spawn particles with nms ?
no i can spawn particles
but there is a problem
i have the BLOCK_CRACK particle
but how can i modify the particle data
when i send the packet, it has no param
what version ?
1.12.2
in 1.18 you change a lot ... dont know about 1.12
why are you using packets to display block damage?
cause i want them to be displayed to only players in a range
what
i want the BLOCK_CRACK particle, type REDSTONE_BLOCK to be sent with packet
dude, use teh API if teh functionality is there
REDSTONE packet
the dust color
stuff like it
and i want it to be configurable
so i do EnumParticle.valueOf(string)
there is also a full particle API
with nms ?
API!!!
the api is made with nms ?
im developing a plugin for a server and they asked me to to do it with packets
NOT BUKKIT
Everything should be API first, NMS/Packets if there is absolutely no way to do it with the API.
optimized ?
public class FileTesting {
private static FileTesting instance;
public static void main(String args[]) {
instance = new FileTesting();
File f = new File("."+File.separator+"file.yml");
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
try(InputStream inp = instance.getClass().getClassLoader().getResourceAsStream("file.yml")) {
Files.copy(inp, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
inp.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
```Anyone know why this errors with `java.nio.file.FileSystemException: .\file.yml: The process cannot access the file because it is being used by another process.` I've asked a few times now but never got a solution.
at which location does the exception throw ?
Files.copy
is this for a plugin or just java?
just java
I have a few programs that use this and they have no issues but all my new projects have issues with this.
have you tried it without calling createNewFile()?
Files.copy requires an already created file
Even without it, it errors.
are you sure its not yoru location thats bad?
well, does the file get created but empty?
yeap
I don't see how it could be
Even in a folder on my desktop I have this issue.
all I can suggest without opening an ide is get the classloader from your current instance not the object you create as instance
Tried that but this can't be used in a static method lol
Tried with FileTesting.class same output
You shoudl be able to static access teh ClassLoader directly
But I see no reason for teh file to be in use
Me either. Even added System.exit(0);
example? I might be thinking of something else
no clue and no ide open sorry
Can anyone help?
I have a problem because I have npc that worked on 1.17, but when I rewrote it to 1.18, the swimming position I set for him does not work. Has anything changed since 1.18 with item setting for entityplayer?
BlockBreakEvent?
BlockBreakEvent?

also capes arent serverside pretty sure
does that detect the player that broke the block
I just want to find some plugin for my server donator but not p2w cuz i hate p2w
do other cosmetics like hats
ig it would be possible to make a banner on an entity follow the player, but stuff like minecon capes or migrator capes are client side
Hmm that sounds good i gonna try some
which is why only optifine users can see other's optifine capes
The plain block break event represents players breaking blocks
how do i get the current date? like "2021/12/01"
and then i can send it to a player
or something
idk
Idk but i use place holder time for my scoreboard
e
how can i set the durability of an item?
Cast ItemMeta to Damageable
Set damage
Set item meta
Is it possible to construct an InventoryView?
so can someone explain in clearer terms how to register events im unsure what to put here
uh
the tuturial just said to....
how do you do that
bruuuu
To do what
Yeah don't use that if you don't know what it means @karmic grove. To register events you just provide your plugin instance and then the class instance that implements Listener.
so i do "mainpackagename.eventspackagename.eventsclassname"?
I wouldn't say that using reflection is a simple concept beginners should know how to use 
like this?
what's your event class called
Registering events manually doesn't require NMS though
and it's simpler to normally register events than reflection
events
I don't see how that has anything to do with what we're talking about but ok
It's 1 line...
yeah but when you get to the stage where that is messy you might as well turn to lombok to have everything done by gradle so it's slightly more readable
so is it right xd
How is it messy?
Itās as explicit as it can be, if you understand the spigot api.
Everything but messy.
Thatās not messy, that just long.
What
You probably shouldn't have 30 different listener classes anyways unless your plugin is just massive
Lol it takes like 10 seconds
Thatās a you-problem
If you hate that so much, create an abstraction of it
Exactly
But donāt come here and complain over proper api
because if you use reflections or something then youāve coupled the shit out of your code
Your code becomes messy if you use something like completely automated registration where you use reflections and not talking about reflection, as I hope you understand theyāre different.
reflections is british 
And a library
isnt reflections just lib to make reflection easier
It is a runtime library
Though it doesnāt exactly replace the functionality of Javaās reflection, moreover just adds a bit to it I think
Havenāt ever had a need to use it
hey guys i have a little bit of a problem in my plugin custom config playerdata.yml file so 1.I have made a custom config yml file especially just to store data for players. 2.So i have a command called /arms which first check if the player UUID is not already in the config file so if it's not the player UUID goes in the config.yml file with also some text i also have another command called /nv which also first check if the player UUID is not already in the config file so if it's not it sets the UUID + different text but it removes the other UUID line which makes data loss so it replaces actually the line which i don't want. and there is the problem if there is something which i can make so everytime it will be placed on another line not on the same
if you want i can also provide a some code
Code thanks
use a map under each UUID not a single entry
@ivory sleet no problem i will provide some code right now
But yeah what Elgar said is something very reasonable as it allows you to dynamically keep track of more players or less for that part.
hey my spark report shows method for 20%, but when i open it I see only for 4%, how to analyze it properly?
how do I make a entity invisible to a player
@ivory sleet so here is it my code: https://www.toptal.com/developers/hastebin/ebugajebal.java
Send the sample
how do you want to check it?
Yeah
also this is enable and disable command that's why i use to check if the player is already in the data file cause if it's not it's gonna enable the command and gonna save the UUID in the data file. and then for disable i check if the UUID exists and if it is i just do config.set(UUID + "special text for the command")
no i mean how do you want to check this, my profiler contains some mysterious things
Who can help? How to add buildtools to maven. buildtools created on another disc than default maven local repos folder. I am integested in nms 1.18
Donāt you have a link?
i have, but i dont want to share it, you think splitting it to different methods will help in analyzing?
Hmm yeah maybe, might wanna talk to the spark devs
they werent so active last time, but thanks ā¤ļø
Oh you already tried?
so yeah i will try Map but what is the way where i can save the uuids then remove them
so im saying one player have enabled the commands his uuid is saved in the file other one disabled the command how i would remove the other player uuid
Kinder do you load the configuration often?
how do i make fake players in the server list?
if the player enables a command it shoudl be something like
32231-2131-2131-123
enabled: true```
There are Events for this i think
anyone has experience with android apps? just wondering
so uuid and then key with enabled and boolean
Oh kotlin then
no, java
Yeah
i dont know kotlin
Yeah but the approach is similar in many cases
why is kt better than java
can you link me to a tutorial?
Depends on the definition of better
take a look at ServerListPingEvent i think it possible there
ok
But it supports first class function objects, is null safe and has a lot of other cool features
i have to learn a new language now, ffs

Btw 2hex
I believe flutter is still an option
Although then youād have to learn Dart which in some sense is similar to Java also
@eternal oxide thanks that's very good example right now i understand at some point how i would do it i just need some research how to make a string list in config file i'm bad at config files xd
wa
uh
wtf is flutter
oh
that thing
another god damn language
yeah im bad at configurations but thanks again
Flutter is an open source framework by Google for building beautiful, natively compiled, multi-platform applications from a single codebase.
Lol
cant i just use java
so i know what i need to research
Hmm maybe if you could find a transpiler 2hex
Altho that has its disadvantages as well
but like
i wont have anyone to get support from cuz every1 uses kotlin
its like using mac
everyone uses windows so u barely can get help
its learning a new language
and the syntax makes no sense to me
like literally 0 sense
learning a new programming language is still better then a national language ^^
guess ill look for a java -> kotlin tutorial
lets hope to find some1 who wont teach me how to install an ide
wait wtf
its so similar
oh wtf this is cool
sry for spam btw
but whats that
The ** ?**
the whole thing
Null safety
thats in java too
1.8
Allow me to demonstrate
abc: String? = null
defc: String = null
The second variable cannot be declared to null as its type is null safe so a compiler error would yield
Because vanillia whitelisting is weird - is it a terrible idea to implement a custom whitelist that kicks a player on join from the 'playeronjoin' event, if they're not whitelisted
I'm more asking about opinion as I can get it to work fine with normal whitelisting
however it'd be much neater / easier to do it the former method
oooo
Double health = ...
does anyone knows what PublicBukkitValues refers to?
nbt.PublicBukkitValues.*=alien_chestplate
inside a optifine properties file
i can only use 1,8 because this is a 1.8 server
for pvp? If not update it xD
pvp
im helping a friend code
aka im coding and he is running the server
but there are methods to disable newer-version-pvp ?
wait how?
attackspeed, attackcooldown ... dont know exactly but its possible
if im not wrong this is for the persistentDataContainer
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/persistence/PersistentDataContainer.html
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
oh yea that could be
Hi, can someone reccomend me a good MurderMystery-Infection plugin?
but i saw nbt.worldcraft=blue boots and i'm wondering where optifine is getting those values from
is it possible to link Methods in the doc of constructors and other Methods ?
you mean ({@link #someMethod})?
#help-server or #general :)
okay but this is for development
Hey, I want to add all portal blocks
next to eachother to an arraylist (arraylist already contains a few definite portal blocks) without any other obstruction from other blocks of different type however I get a recurring loop
https://pastebin.com/1ZN555R6
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
You could use a master/slave system, have the first block placed be designated a master block, and subsequent blocks that are placed next to it will check adjacent blocks for a master block. If it exists, then it adds itself to the master's data. Then all you need to do is query the master
Personally what I do for multiblock structures
hello
bit more complicated than what I typed there but you get the idea
hi
can someone help me with this
This can often occur if you are running a 32-bit system, or one with low RAM.
Please re-run BuildTools with manually specified memory, e.g: java -Xmx1024M -jar BuildTools.jar --rev 1.17.1
Make sure your java installation is 64 bit and not 32 bit
I'm messing with nms stuff for the first time. This code works but intellij is complaining about raw use parameterised class.
How can I get intellij to shutup without suppressing the warning?
private @NotNull SynchedEntityData cloneEntityData(@NotNull final SynchedEntityData other, final Entity nmsEntity) {
final SynchedEntityData entityData = new SynchedEntityData(nmsEntity);
if (other.getAll() == null) return entityData;
for (SynchedEntityData.DataItem dataItem : other.getAll())
entityData.define(dataItem.getAccessor(), dataItem.getValue());
return entityData;
}```
Maybe just pass a wildcard
Yes
ok
it is
This can often occur if you are running a 32-bit system, or one with low RAM.
Please re-run BuildTools with manually specified memory, e.g: java -Xmx1024M -jar BuildTools.jar --rev 1.17.1```
help please
if you mean changing for (SynchedEntityData.DataItem dataItem : other.getAll()) to for (SynchedEntityData.DataItem<?> dataItem : other.getAll())
that adds a new error
Which is?
when using ?
guys I'm still thinking what im doing wrong i understand that i need to create config section i already created one and here are the things i just wanted to make the command to be enabled and disabled when typed two times here is the code: https://www.toptal.com/developers/hastebin/xoyezaqibu.swift
Might wanna make the define method taking any super type
Or if you can pass the type T instead of the wildcard
I can't, that is internal bukkit code
net.minecraft.network.syncher.SynchedEntityData public <T> void define(net.minecraft.network.syncher.EntityDataAccessor<T> datawatcherobject,
T t0```
naa
Hey, I want to add all portal blocks
next to eachother to an arraylist (arraylist already contains a few definite portal blocks) without any other obstruction from other blocks of different type however I get a recurring loop
https://pastebin.com/1ZN555R6
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Yes lol
@ivory sleet
Sure its useful for inheritance but it can be really annoying n disastrous as well when working with nested types
it says you to use -Xmx1024M
So youāre basically just trying to get all adjacent blocks with said materials?
Is there any Difference between calling URLClassLoader.getResourceAsStream(#String) and JarFile.getInputStream(JarFile.getEntry(#JarEntry))
yes
but for some reason it recurs
and crashes the server
the arraylist just keeps increasing in size
and I don't know why
@ivory sleet can you help with that: https://www.toptal.com/developers/hastebin/xoyezaqibu.swift ?
Why do you need a packet
any other solutions? he doesnt want to do anything other the 1.8
cause
if i change a block and server crashes, the block will be there
Player.sendBlockChange
depracated
What
what i do is static helper methods:
@SuppressWarnings("unchecked")
public static <T> void define(SynchedEntityData data, EntityDataAccessor<T> accessor, Object value) {
data.define(accessor, (T) value);
}
those one requires Unsafe cast but i think its better than using rawtypes
Dont work with him
yeah I gave up with trying to get it to work and just suppressed the warning
Any caffeine nerds here? It is possible to remove a value from async loading cache?
Can anyone see why it does not register the cmd?
I think so yeah
Though personally I just use a normal loading cache
(Yes implementations of loading cache are actually expected to be thread safe)
Ah? Fr?
I think ill use regular loading cache then
Since Async one does not have some methods
trying to do smort odvonced code and my project slowly becomes a mess...
Relatable š„²
Why do they have an async one if they are all supposed to be thread safe
Itās if you want to choose the executor for certain things
In which it might be able to negligibly optimize some stuff
I want to add all portal blocks
adjacent to eachother to an arraylist (arraylist already contains a few definite portal blocks) without any other obstruction from other blocks of different type however I get a recurring loop. How do I fix?
https://pastebin.com/1ZN555R6
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
?paste
does anyone have any idea what does this piece of code do in PluginDescriptionFile?
it seems deprecated in a way
From my understanding it creates ThreadLocal object which holds YamlObject with custom parsing constructor added on top?
stop bombing minecraft development servers with your question
It seems it uses Flags enum which is deprecated. It was used for encoding checks if i understand correctly
You already got answered
how could I make a sword that causes weakness on hit?
I already made a custom weakness effect, but idk where I must add it
no I havent
new PluginAwareness(node) {
{
this.this$2 = this$2;
this.val$node = node;
}
}
ah yes
decompilation quirks
it instanciates the interface
this must be how values are being passed to anonymous classes
can anyone confirm that this is deprecated and is a leftover for backwards compatibility for plugins which utilise different encoding on plugin.yml?
What are you trying to do
How do I get nether portal size (min and max) from 1 portal block?
anyone know how a CreatureSpawner's utilizes the delay setting (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/CreatureSpawner.html#getDelay())
because there is also getMinSpawnDelay() and getMaxSpawnDelay()
well basically I'm replicating spawner behavior from scratch and wondering how that delay comes into play
Take a look at spawner upgrade plugins i guess
this.name = this.rawName = map.get("name").toString();
hey
i didnt knew you can do that
2 vars initialized to the same function return value
Yuh
it should return init value in boolean clauses too
right?
you can do something like if (this.name = map.get("name") == null) {}
right?
might have to emphasize on the boolean expression
this.name = (map.get("name") == null)
Ticks until next spawn. If 0, it will spawn immediately when a player enters its range. If set to -1 (this state never occurs in a natural spawner; it seems to be a feature accessed only via NBT editing), the spawner will reset its Delay, and (if SpawnPotentials exist) EntityID and SpawnData as though it had just completed a successful spawn cycle, immediately when a player enters its range. Note that setting Delay to -1 can be useful if you want the game to properly randomize the spawner's Delay, EntityID, and SpawnData, rather than starting with pre-defined values.
but yeah
actually I found the bukkit code which references it so was just reading thru that
does anyone knows if custommodeldata has to be unique for the server or if it's per material?
second one seems more logically
Per material
just to avoid making mistakes š
@grave mason heh minetopia
didn't ask for that
Hm?
which version?
1.18
its per material
its stored inside NBT tags
@ivory sleet do you have any ideas what could be the problem here?
The fact that it returns null implies it isn't actually in your plugin.yml
Are you sure the exported jar has the right plugin.yml
Or that the plugin.yml is in the correct location
I'm currently making a GUI and now i want to implement Hover-Functions for my elements. So for example you could specify, that on hover, the background-color and text of the object changes.
I thought of making it with a JavaScript kind of approach, where you just pass whatever should be done using an anonymous function. like
rectangleObject.addEventListener("hover", r => {
r.setText(10);
r.setBackgroundColor("red");
});
How would i do this "anonymous function passing" in Java?
See functional interfaces
Yeah JavaScript has first class function support which can be "equivalent" to Javaās functional interfaces jep
@ivory sleet is there a way to edit a patch
reason for this is that i made full documentation of my changes but already made the patch :?
Sure but why not overwrite the patch with another one?
Or like override instead of emend
hmmm how ?
Creating a new one which overrides what the previous patch did
What are we patchin
hey how do i send a message to a player whitch is on an other bungee server
so i got into Spigot-API
run: git add *
run: git commit -m "SAME NAME AS BEFORE"
and thats it ?
WorldCreator
i hope he is on another mc-server and on the same bungee server ?
Ooh what are we adding to world creator
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
public void onPluginMessageReceived i do not understand this
wrong link ^^
Oh very nice
i nerver worked with this
Always good to get more worldgen API stuff
yeah but was very hard to write ...
:p
i wrote ~40K chars today
How can I get the texture from the player's head? i used reflection to get GameProfile, i have field profile but i don't know how to get to texture now
SkullMeta headMeta = (SkullMeta) item.getItemMeta();
Field profileField;
try {
profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
} catch (NoSuchFieldException | IllegalArgumentException exception) {
exception.printStackTrace();
}```
@ivory sleet is this right ?
--amend should do it
at commit ?
yes, git commit --amend
but I left some comments on your PR
they do need to be moved to Bukkit/CraftBukkit, so you may as well do that
it should be less complicated for you anyway
"some" š
MD has passed judgement
no, or yes ?
its better feedback then teachers at school can give you
This is true
Probablt
profileField.get(headMeta);
its good enought for most things
Okay thank u
Looks alright
I mean it says simple and it is simple
Although should be said builder for ItemStack isnāt really necessary
As its in fact mutable and all
Yes but one line
I mean
itemStack.setX(); itemStack.setY();
lol
š
ItemstackFactory
ā¹ļø
Hmm forgot the AbstractAbstract š¤Ŗ
lol
BootstrapImpl
Pull yourself up by the bootstrapimpl
doesnt it need 2 forks now to add API stuff and then another for SERVER if i use Bukkit + Craftbukkit ? @ivory sleet
Hey! I need with bit of reflection. I need these two methods in reflection. I think I got the first one but idk about the second one.
Thanks in advance!
You will need two PRs, yes
One for Bukkit and one for cb
there's an attribute API!!!!!!!!!!
Inb4 1.8
no, it's people using reflection for API things that are crawling out of the 1.18 woodwork
Oh? Whyās that
because the methods are obfuscated when not using mojang maps
definitely an advantage š
Wasnāt that the case in 1.17
what is an advantage ? using mojang maps or using API ?
fields 1.17, methods 1.18
Ah
You must learn to dive through the soup of Aās bās and cās if you donāt want to use mappings
You must learn to use/make API
Iāve found itās easy for simple things
But some things are going to require a lot of work to APIify
Can you send me link for that attribute api please?
Item or entity
it's a mob so entity
tyty
hmmmm, and what with that?
is it normal that a fork of craftbukkit has missing fields in other classes provided ? @ivory sleet
wdym
i made a craftbukkit fork and used git clone;
then i opend the project in intellij and now in CraftServer i have many errors about missing fields/methods
Hey guys got a quick queston:
So I am trying to do a little "inventory animation" basically just adding some items and removing others in a loop. To make it look smoother I am delaying this process with Thread.sleep but it seems like the run() method ignores every Thread.sleep and restarts some seconds before the sleep is done.
Does anyone know how to actually tell the run method to wait?
My code:
use ./applyPatches.sh
but easiest to let buildtools set it up for you
then just change the url to your fork
Please donāt sleep the thread
?scheduling
@Override
public void run() {
for (int i = 0; i < 5; i++) {
ItemStack glass = new ItemStack(Material.GREEN_STAINED_GLASS);
ItemStack empty = new ItemStack(Material.AIR);
if (i == 0) {
inv.setItem(24, empty);
}
inv.setItem(20 + i, glass);
inv.setItem(20 + i - 1, empty);
long sleepDuration = 500;
try {
if (i == 4) {
Thread.sleep(sleepDuration);// msThread.sleep(sleepDuration);// ms
inv.setItem(20 + i, empty);
sleepDuration = 1500;
}
Thread.sleep(sleepDuration);// ms
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
you can only schedule 1/20s within minecraft server plugin coding
so do I have to put another delayed task in my Runnable?
Use a repeating one to have an animation
BukkitTask task = runnable.runTaskTimerAsynchronously(AdvancedTrading.getPluginInstance(), 20 * 3, 20 * 2);
That's how I start the runnable
So I basically do the same, but put the logic for the index and counting outside of it?
and just set items inside the runnable
if that's correct
Pretty much
okay, thank you!
final question, is it the correct way to have another runnable inside a top one?
Like one for repeating the whole process all over again and the inner one for waiting to place the new item?
You should be able to get away with just 1
I imagine it to work like this:
rootRunnable {
clearItems();
innerRunnable {
setItem();
} (shorter delay)
}(some longer delay)
That's why it's a bit confusing for me rn to get it to work with one
that would kill your server
every time the outer loop ran it would spawn a new runnable
if repeating
yes, but is it still a problem when I kill the inner one when it's done?
your inner task will not run before your outer
I would kill the inner one after everyone, basically just a delayed action, the outer one would also be killed after the inv was closed
yes I know
I mean the outerRunnable is basically just a while(true) loop in my case with a delay
yea
if your inner is a straight task it could work.
just delayed it would fire once and end
If you want it to get shorter each time just have an external integer that you change
Alright thank you, cause I really have no idea rn how to go about it, not that much experience with it by now as you can see
And you task will just count down said integer until it hits 0, then itāll do the thing, and then itāll set the integer again
but I can't change that from inside right? I mean the variable should be final in there
ah okay
I put it outside of the runnable, that's why it didn't worked
sorry my fault
I will try a few things out, thanks for your help both of u
I need some help. I cannot for the life of me get the remapped jar to work with 1.18 is there something special you have to do when building Spigot? I run buildtools and then put the stuff md says to in my pom and it can't seem to resolve the remapped jar
āremapped
--remapped to buildtools
Heyoo, I'm trying to store/retrieve item data from a SQL database. I managed to get the item's data to be serialized with enchantment data through the ItemStack#serialize() but how am I able to fetch that data back and restore it/create a new item out of it?
Is there not a deserialize
Oh there is, I didn't know it branched directly off the class
I'll give that a whirl
use something like gson to convert the .serialize to json
and the json to map
to be used in the .deserialize
or you can use base64 for serialization and deserialization
Same way you work with 1.17?
Only NMS
k
how do i teleport a armorstand with a 0 tick delay?
Just teleport it?
well
I get this weird delay
it is either slow packets
or a delay in the teleport
and I heard from another source that it is the delay, and I can just teleport it without that delay
the armorstand is always a block or two behind the player when the player moves and the armor stand gets teleported to the player
Yeah thatās probably just delay
so could I make the armorstand a passenger of the player?
You could
through Player.setPassenger(armorStand);?
but I dont think I can change the height in which the armor stand sits on the player
Correct
You can sync it's position using packets
Not sure if that's any more accurate
OnInventoryClick doesnt trigger
to check the value of whitelist=true/false in server.properties should you use Bukkit.getServer().hasWhitelist or Bukkit.getServer().isWhitelistEnforced
or is there a third completely different one
How do I make it that blocks drop regardless of the item you're using?
Or something like, you need to use a shovel opposed to pickaxes to mine and receive ore drops
Haswhitelist
thanks homie
Hey, Iām looking for a paid, working MobCoins plug-in 1.17. One searched but I canāt seem to find any, all other ones are outdated / broken
What are mappings and patches of minecraft? Or is that a java related thing that I should go learn more java for?
Mappings translate the obfuscated methods and fields back into a readable format
Patches, you're gonna have to be more specific
patches are edits of minecraft code
oh
Ah the NMS patches
I am trying to find where the usage of EntityPlayer got moved, before I just used import net.minecraft.server.level.EntityPlayer; to import it in. Perhaps I am not looking in the right place but if anyone knows what I should be using instead I would greatly appreciate the help.
idk really, i was just going through the build tools files and saw patches
there's a few in NMS and then
Yeah they are changes that are applied over minecraft code
oh
import net.minecraft.server.level.EntityPlayer; is correct
I am guessing you depend on the jar directly
what is reading
Yeah I using the work around since I can't figure out the proper way
Edit: 1.18 release is now available.
Dear All
As we mark the 9-year anniversary of SpigotMC.org, it is my pleasure to announce that...
like does anyone read this
what's reading
Yeah, I am using the correct bootstrap
1.18 has really brought shoddy development practices to the fore
TL;DR use gradle or maven
you cant depend on the bootstrap jar
alright, I will figure out how to use maven
'The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. '
I know, I am not using that
"You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar"
well then idk what your issue is
why do you need NMS
what are you doing with EntityPlayer
I am using that instead of using maven
I am messing around with npc's and the method I found required usage of Entityplayer
I just wanna tell that md_5 is real magician. Never before I was able to update the server in just 1 day, it was the fastest update in the history of my server.
Oops, wrong channel, sorry
lmfao
no cause 1.8.8 š
How do I build my own server jar .-.
i remember discussing this but them /shrug
Use buildtools
?buildtools
Ah
--compile craftbukkit?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Just follow the instructions, step by step
?bt
same
oh
how do I make my own edit to the files then compile it-
Why would you want to edit files?
no reason, i just want to know how to (if it's possible)
Make the edit in an IDE and then run maven install on the project
You really shouldn't, that's what plug-ins are for
I hate when the placeholders I use for my plugin doesnāt support the offlineplayer type.
;(
oh okay, thanks!
yea.. i'd end up breaking something important kekw
What looks/feels better? Closing and reopening a new GUI or clear all existing content and replace it with new one? (Trying to create a Pagination component for the GUI system so I can't really test it out and see how it feels personally yet but it'd be nice to get some insight while im working on it)
why not just open a new inventory without closing the previous š¤
Yeah that's what I mean with the first part. (iirc) it has that little screen flicker of the gui closing then opening
Unless you mean I can open a new GUI and that'll just change the content smoothly?
is it an expensive operation at all to call Bukkit.getOnlinePlayers().size() to determine if anyone is on the server in a task that repeats often?
or would it be better to keep a variable that uses the PlayerJoinEvent to determine if anyone is on?
im storing player data in individual files, and for some reason setting things isnt seeming to work
after setting im calling .save(the file they have), then .load(the file they have)
what dont work?
setting the values
.set(path, value);
then saving it/reloading the file
idk what u talking so i'll gonna jump out the window
ok thanks for trying atleast
How can one spawn in a new entity with a specified SpawnReason? Do I have to use nms?
doesnt seem like i need to send code for a simple method error lol...
then idk why is it isnt working
š
the file dont have the new value?
or what kind of error
no error, the file has no new values
if i do /sethome, i get my home update message - but the file does not update
was previously this location, and still displays as this one
specifically, here's the code for setHome
Lang.prettyLoc works as expected
your get loads a new fileconfig every time
š
how should i correct this
im not sure if FileConfiguration f; at the top, then specifying it would be any better?
Depends how you want to handle it
if you want to just instant save it's likely fine to save the get result in setHome and pass it into save
might be worth just caching the config in some class that you do uuid lookup for via some hashmap
pardon my comprehension skills, handle as in use it?
HashMap<FileConfiguration, UUID> might be a good option? irdk
im a FileConfiguration noob honestly
I'd do uuid > PlayerData or something if you plan to do more than just a home location
dont worry
im a skript user
then store the file in playerdata š¤·
š¤”
or at least handle saving in that class
i store more than just the home in the player's file
the weird thing is that the file that I have in the /Users/ is fine? like it takes the information from there.. oddly enough
Consider cache the player's information and load/save from the file on startup and on disable.
I'm having a bit of trouble with creating NPCs in 1.18 with the EntityPlayer. The original method is:
EntityPlayer npc = new EntityPlayer(server, server.getWorldServer(), profile);
But the getWorldServer() methd is now obsolete, what do I use in replacement? I searched the EntityPlayer and MinecraftServer classes and others with a decompiler for Ecllipse, with only server.overworld() being another alternative but it doesn't work and the console just throws a MethodNotFound exception
Hey folks, any tips on how to make dataclasses serializable for saving and loading from the config?
22537b13-6de5-4b56-8ef0-4428d4de86f5: !!me.wastashel.player.PlayerData
level: 0
race: Human
skills:
MechInvention: !!me.wastashel.player.skills.MechanicalInvention
exp: 0
level: 1
maxLevel: 100
name: MechInvention```
I have a config library you could use
Otherwise you can use standard serialization
Where you implement ConfigurationSerializable
Or is it ConfigSerializable?
Send me a link, I'll check out both and see what fits best for me :)
This one
Taking a look at that one now, just searching for some code examples
any way to add new things to server owner's existing configurations or do they have to delete their configuration in order to see new things you add? for example i have plugin version 1.0.1 which has 1 option in the config file, i push an update that adds 1 new option to the config for plugin version 1.0.2 for a total of 2 options. Is there a way that i can code new config lines in on startup and add them to version 1.0.1's config or do i need to delete me 1.0.1 config and let the updated plugin generate a fresh 1.0.2 config
if you have no comments its easy
you load the resource (config) from your jar as defaults, then load their config and save
You can just read the new config and add any missing entries to the old one
But yeah rip comments
when you say rip comments do you mean comments that the plugin creator has added into their default config file or do you mean any comments the server owner has put in themselves
eg, This is how Bukkit does it java configuration = YamlConfiguration.loadConfiguration(getConfigFile()); configuration.options().copyDefaults(true); configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), Charsets.UTF_8))); saveConfig();
so like if i used comments in my config file when i made my plugin to tell someone how to use the file, those comments will be lost on implementing this method?
Defaults are weird
Weāll get the new version soonā¢ļø
I have a PlayerCloseInventory event class like this:
public PlayerInventoryCloseListener(Main plugin) {
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public void onPlayerInventoryClose(InventoryCloseEvent e) {
e.getPlayer().sendMessage("Yes");
}
and i initiated it in the Main class like this:
new PlayerInventoryCloseListener(this);
but it just does not work. Like, it just doesn't send me any message when I close my inventory, or any gui
You need @fresh templetHandler
needs @fresh templethandler
Don't forget @fresh templethandler
RIP even
oh my god, I am so dumb
Why does my code execute twice?
https://pastebin.com/DE6vhXeh
https://pastebin.com/i9WNPsTx
[08:58:45] [Server thread/INFO]: [null, null, null, null]
[08:58:45] [Server thread/INFO]: [null, ItemStack{DIAMOND_LEGGINGS x 1}, null, null]
[08:58:45] [Server thread/INFO]: PlayerArmorChangeEvent: player: EstrangedFury; armorType: LEGGINGS; armor: DIAMOND_LEGGINGS; armorAction: TAKE_OFF
[08:58:45] [Server thread/INFO]: PlayerArmorChangeEvent: player: EstrangedFury; armorType: LEGGINGS; armor: DIAMOND_LEGGINGS; armorAction: TAKE_OFF
Is this a custom event
yes
Most likely the event is being fired twice
yeah
Okay so address it where you're firing the event
does spigot support Brigadier instead of CommandExecutor
or would that need NMS
actually i wonder
?brigadier
no ok
its safer to use CommandExecutor
CE is the API bridge. Using brigadier you are exposing yourself to breaking changes they make
Also brigadier is pretty average
this kinda sounds like ur saying CE is old and wont be changed, but i understand for backwards compat and Brigadier being new which could mean breaking changes
understandable, its structure also doesnt always result in the most readable of code...
ex: Origins mod commands, wtf.
but thats a result of method chaining like that ig
Hey so I am busy making a plugin, I copied my listener class to a new plugin same mc version and spigot, But import com.mojang.authlib.GameProfile; gives me this problem Cannot resolve symbol 'mojang'
Both Pom.xml's are the same because I copied the working one to the new one. Here are both
Working
-https://pastebin.com/vbwAVRZS
Broken
-https://pastebin.com/YTf3mnk3
com.mojang is in spigot not spigot-api
yoru other plugin must also have a manual jar import
ty <3
but
oh
nvm
got it
Hello! I want my plugin to display ASCII art in chat, but I faced a problem
How do I learn how wide players chat is?
I mean, what is the safe width I can go for?
there is no way to know the clients chat width
How can i make a dispencer that will drop selected item for selected players ?
make plugin**
that drops **

