#help-development
1 messages · Page 286 of 1
since when is the bot doing the penguin thing?
No clue good luck
If you add the exclamation point it does it lol
Thanks imajin
yes
not quite. I Previously was using newer versions for my server, however plugins did not replicate the old mechanics needed for our server accurate enough.
imajin is our bitch for custom commands
lmao
Where can I find a list of nms packets for different versions?
There is no nice mappings for legacy versions so it's good to be aids
This is for 1.8.8
thank you!
Look for packetplayoutanimation or something
yes thakn you very much! I think ive got it from here
😭I gotta go man good luck
hashmap.add(event.getPlayer().getUniqueId(), bukkitTask)
sorrry 😭
Learn Java clown
It's put L get destroyed
FREE JAVA LESSONS
jree fava lessons
v
lmao
so like this?
looks right
and what do i now put in the invcloseevent??
i would guess, create a method to check if the players uuid is in the haspmap if they are get the bukkit task and cancel it]
bruhhhh
but like i dont understand the concept
You need to just assign the whole thing to the variable
Gimme a minutw to get on my pc
Bare with me here
// in the open event
BukkitTask task = Bukkit.getScheduler().runTaskTimer(() -> System.out.println("Task"), 1, 1);
map.put(playerUuid, task);
// in close
BukkitTask task = map.remove(playerUuid);
if(task == null){
return;
}
task.cancel();
arent you missing a plugin instance
combine get and remove
damn
map.remove(key).cancel()
valid
isn't there a removeIfPresent
no its computeIfPresent
remove doesnt care whether its present or not
it will return the prev associated value or null
just doing a null check is prob more preformant than doing computeIfPresent huh
I guess I'd have to look at internals
what are you talking about now?
I was just saying this
BukkitTask task = map.remove(playerUuid);
if(task == null){
return;
}
task.cancel();
Is almost certainly better than this
map.computeIfPresent(playerUuid,
(UUID uuid, BukkitTask task) -> map.remove(uuid).cancel());
cuz I was thinking of doing this ^, but that is probably just a net negative compared to the former
why would you do a computeifpresent
no reason to in this situation since we can just do a null check and we are removing anyways
i was simply working out my stupid logic outloud lol I talk to myself when coding a lot lol
like this?
yea, though what are you doing with the task it might be better to do something else
wdym?
this will throws NPE right?
like what are you going to do with your repeating task
i mean there is a chance
still have to null check ye
it will, but my version won't its fine he was just giving examplar
How to change plugin version like
Plugin is 1.16 and I want to make it 1.18
it should just work, unless you have nms
gradle.whateverthefuck
I'm in mobile it works in mobile ? || Just asking xd||
👀 what the fuck
Java Edition isn't bedrock edition
i'm surprised you even have a plugin
uhhh if you have an android you can probably get something to compile it with?
Just askin
android has some compilation programs for java
ohh so basically i need to detect where u put a specific item
Nvm I'll wait 12 hours and get my pc after that
can't you just use inventory click event for that
thats too hard lol
hey all, id like a human to explain this to me since im terrible at understanding shit, what does it mean for me to run something asynchronously and whats the advantages/disadvantages for me to use it?
its teh easiest way
async means it won't interfere with teh main thread. e.g. database calls should all be run async because if they aren't your server will freeze until the query is done. Async prevents teh server from freezing since the task is nolonger on the main thread.
alright, thank you! So in the tasks stuff, i can run it asynchronously, why would I want to do that over just running it later?
running it later just delays the time its run at. Async runs it immediatly without pausing the server unless you do async run later ofc
asynchronous is more meant for very heavy tasks
ah okay
as I mentioned earlier database calls being an example
asynchronously though keep in mind you can't really write data to the server you'd have to run the task synchronously again to write data.
I'll show you a simple example with my api since its short
MegumiTask.async(() -> {
DataStuff stuff = heavyDatabase.call();
MegumiTask.sync(() -> stuff.setBlock(Material.DIRT));
});
very rough example, but it kinda shows
To change plugin version
Go to pom.xml and then remove old version and add new version
Am I right?
its gonna be a dependency
@tardy delta don't judge I didn't feel like writing out CompletableFutures lol
abstraction
how can i bring nms into my project?
?nms
i last saw that i can just delete the -api but that brings up errors
Y2K_ what if there is no pom.xml file in plugin ..
||Just askin||
if the plugin doesnt use nms theres no need to change it to a higher
you kinda need
nms?
materials and stuff
what plugin are you trying to update
nope don't need to raise version for that :P
Alice AntiCheat
reflection and enums have things to allow you to do this Runtime
oh, i didn't know that
I'm asking because my server is 1.18 and i need that plugin in 1.18 to work right?
egg Material#matchMaterial runs runtime and since you mark server as provided it'll use the server's version of Material#matchMaterial in which that enum contains all the new materials. for shaded APIs the same logic doesn't apply however
if it does it would need more work
Yes I'll try it tomorrow when I get on pc
where should i build the BuildTools jar? What folder?
right, thanks
wherever you want as long as its not in a onedrive folder
or other cloud storage
oh alr
does yaml also support delimiters like java?
e.g.
number-of-ticks: 6_000
one-million: 1_000_000
or as the indians do it:
hundred-thousand: 1_00_000
shame
yeah but isn't that a string?
yeah I wanted to just use it as getInt or sth
actually I don't care, I just wondered
SnekYaml
python
"Everything is an int"
at that point just write binary
I just started making my configs in assembly
You have to print everything you want in the config yo std and all you are given to do it is a loose description of what values should be present
is there any particular reason yaml is the standard
I like json more
I want to use it in my plugin but because it isn't the standard maybe I shouldn't
My library is included at my plugin but the server doesn't recognizes it and throws a NoSuchMethodException 🤔
Just use json tbh
Using 1.8.3
Though warning you might need to educate the people who use ur plugin
That's the only reason I use yaml I cbf to waste time doing that
is there like a gson equivalent for yaml?
Not that I know of
The main reason is that some people think that it's easier to read/write YAML because of the missing extra control characters like {} and [], while lists and objects are denoted in a more "human readable fashion". In reality, YAML is a clusterfuck which causes headaches daily, made everything worse and is the most stupid decision ever.
I personally think that we should slowly transition towards JSON, as it's not much harder to write (if at all), and causes way less issues.
i use json config files in some plugins...
you could use jackson
yaml is more "human readable" until it isn't
guys, im trying to make a game using config files as storage for player's statistics..
json ❤️
json ❤️
and this is the class i made for it https://pastebin.com/WGCs8kQ8
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.
but when i save the config
Please use a paste and edit your message, you're spamming the chat...
Im using 1.8.3. Anyone knows what is?
probably not already included
did you forget to add gson as a dependency
🤔
I'm working on my own mapper which actually has some features which could prove useful in the future, but I'd also just use jackson, for reliability sake.
its on the plugin
i think its a version issue, thats a very old version (Spigot)
What happens then? You didn't finish your sentence there, I think.
Show us the methods uses
savePlayerConfig(UUID uuid)
used only once
when this get performed?
on the createPlayerConfig()
after giving the player the default stats
public void join(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (!Major.stats.hasPlayerConfig(p.getUniqueId())) {
Major.stats.createPlayerConfig(p.getUniqueId());
}```
"...Saved a Statistics file..." is printed tho, right?
That means neither the config nor the file can be null, that's something at least.
why are you using a config file as a database?
So I did the whole BuildTools stuff, downloaded it but now when i remove the -api in my pom.xml, i still cant import stuff like CraftPlayer etc
that way are efficient, depending the use
show us your pom.xml
Wouldn't using PDC on players be more efficient?
did you follow the tutorial I sent
?nms
Yeah, but its available only in the newer versions
i recommend you to use SQLite
1.14+ right?
👍
Is the Statistics folder created? No file in it, or an empty file?
im not sure where to put the first bit
show us your pom.xml
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>```
this thing
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.
please
this isn't necessary
lol its nt
if you hate yourself its not
xD
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.
lol just use the remapped at the scope
i ran the buildtools command in my desktop, thats fine right?
show us your BuildTools log file
your local maven repository
probably it not builded successfulltr
DAMN
SUCCESSFULY
SCUESFUY
SUCCESSFULLY
Success! Everything completed successfully. Copying final .jar files now.
Copying spigot-1.19.3-R0.1-SNAPSHOT-bootstrap.jar to C:\Users\Acer\Desktop\.\spigot-1.19.3.jar
- Saved as .\spigot-1.19.3.jar
end of the file
clearly is was successful
dw its a hard word lmfao
show us your <dependency>
in my pom?
whats best way to create timer over hotbar?
not just Scheduling tasks
p.sendMessage(String.valueOf(new File(Major.getInstance().getDataFolder() + File.separator + "Statistics", p.getUniqueId() + ".yml").exists()));```
new Thread(() -> { // Code here }).start();
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>```
this thing?
yeah
isn't it heavy for server tho?
to iterate over 100 players every tick/sec?
It will run async
great
cannot put the spigot, right?
try to remove that <build>
nope, shows an error
?nms
try remove the whole <build>, let only the <dependencies>
yeah did, not sure where i went wrong
NOOO
worst advice ever
so what's the problem?
thats a lot of stuff to be removing seniore
well, i cant just remove the "-api" since that still throws an error
what is the error?
have you even ran buildtools?
Just use async timer task?
Did you know if 1.8.3 contains some bug in the libraries loading system? I've included a library into my plugin and at the 1.8.3 it gaves me a NoSuchMethodException at this library 🤔
yeah, ran the command and it finished successfully according to the log
no, I dont know anything about 1.8.3, its dead since 8 years
Why tf would you ever use 1.8.3
as I said, you havent run buildtools
it's literally the first sentence in my blog post
Apparently he ran build tools but it probably wasn't installed into his m2
i literally ran it
the log shows the buildtools has finished run
i have the log
here
and it says it finished just fine
then click on the maven reload button in intellij
alr
maybe invalidate the caches?
yep reloading it did it i think
This could be the most intellij moment of all time imagine not automatically updating the local repo
Vscode stays winning
YEP IT DID IT
i dont
sarcasm
maven ontopp
gradle is love
Someone can help me? 🤔
(1.8.3)
okay web dev
do you want a chicken nugget
my guy
1.8 was like 7 years ago
?1.8
Too old! (Click the link to get the exact time)
i have highly justifiable reasons
what are they
Bruh hypixel milked 1.8 alr 😩
i can’t see any reason for 1.8.3??
Enable support for all versions since v1_8_R1
hypixel runs a modified 1.7.10
-.-
and the 1.8.3 runs at v1_8_R2
i need to test all versions
highly justifiable reasons
there is such a thing as too much legacy support
might find help in the forum but idk who’s gonna help here
i will try to use the BuildTools .jras
what’s the issue?
NoSuchMethodException
?paste it
^
1.8.3 what in the world would motivate you to use this particular version
that ij build system breaks shaded dependencies
no clue
there are always idiots
how do i make a gun that functions like one from actual triple A games. The gun shoots as long as I hold the left click button down and when my finger goes off the left click button, it stops shooting. Im sure theres something in nms but im not sure
For some servers yes but not everything anymore
blitz and duel servers i know for sure not fully sure abt sky block tho
Irrefutably true
1.7 💀
Yeah and their new smp servers
yep
just a common no method exception
That’s from reflection
that weird, at the v1_8_R1 that reason doesn't happens
Oh
surely not
It was an error
i will just use the old gson version
or shade it yourself
🤔
what
what you mean with shade
left click and right click event both only fire once 😭
dont use the ij build system i said
why?
dont even know what im looking at
duh the ij build system is bad
i think its not the problem
others versions works good
like v1_8_R1
cuz other versions have another version of that dependency ;-;
i will check the maven build system then
do you even have a pom.xml?
Ant is pretty inflexible
While you can setup a powerful build pipe environment with Ant, Gradle and Maven can do it better
And since maven is centralized among spigot devs, it is therefore the preferred option, tho gradle is becoming quite popular also
sounds good
happy new year \😢
Unit tests?
nah made my own test system
few hundred of expressions to be parsed, with their result underneath
what are you writing s math parser ??
he has been doing it for like 3 months now
quit it for a while so definitly not 3 months
why
well not constantly
does Math() work?
but you have been putting some effort in for 3 months atleast
Math?
too slow
yes
yes
that’s like stupidly speedy
its like somewhat slower than fourteens
oh lmfao
depends on expression length
milliseconds i think
does the speed difference really matter in the grand scheme of things ?
wut
wow
yah
I wonder if it's possible to beat those speeds
yes
if you know all the answers to every expression ever
just get it from a hashmap 😉
enum set
hashmap size would be too small
make an enum of enums with a few enums of enums
enum inside of an enum inside of an enum inside of an enum inside of an enum inside of an enum inside of an enum inside of an enum inside of an enum
but it transforms itself when the size exceeds a certain threshold so dont really know
i see
Math.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A
boom
every math equasion
with answer
easy 1us parsing time
like i didnt even know the max length of a string is thr integer limit
is it!
whats the int limit
bc it’s a char
a 32bit int is 2.7b
what if youre trying to read a very big file with Files.readString()
shouldnt it be relative on storage and ram
no
ficking processors idk
fuck t hem
i want a 16gb int
lmfso
hmm is a char really 16 bit?
dumb man asking dumb question, how do i check whats in my main hand?
that i want to convert to binary, that to base64, that to spanish then to binary and base64 again
bc capital and symbols
get the inventory then get the item in the main hand
Player#getInventory()#getItemInMainHand
getInventory().getItemInMainHand()
ah yeah getinventory thats what im missing
you could use getItemInHand but its not recommended
deprecation
wait 16 bit, i thought i read 16 byte 💀
why is my if check for it being not null always true tf
its on a playerinteract event
so it’s not null..?
good point
max length string being 4GB?
max int value (2147483647) * 16,assuming string use a char array and not a byte one
right
I'm having a little issues with worlds right now in spigot. Say I create world 42 when the server is running and a player is in world 42
I then shut down the server and when I restart the server I (purposefully) don't have world 42 loaded anymore
I want to intercept players joining that were in world 42 and teleport them to a specific location in world
think you might have to do that before server shuts down
^^
That sucks, I was hoping I could catch the name of the world they were in when they join
The funny thing is, when the player joins again
player.getWorld doesn't return null
it returns world (default world)
so the server places the player in a world before the join event even fires
if the world was null it would still be fine with me I can still use that
that’s normal bukkit stuff
Ugh. Lol
The server does print a warning in the server log, I wonder if there is a way I can catch that

You need get world when player joins?
The player was in a world that was loaded when the server shut down, but is not loaded on server start. I want the plugin to detect players which join that were in worlds that are not loaded
You can check every .DAT files on players folder
I am trying to avoid reading .dat files because they are a royal pain
If I don't have a choice I guess I will though
okay so i managed to make a working gun, im using arrows as my projectile of choice, is there any way for me to set it to be invisible and instead have particles around it/following it?
yeah
see i have the arrow as a Arrow
take a look at a particle library for insipeiwtioj
arrow extends prokectile which is an entity
EntityArrow?
wait no
look at this
or this
or this
getting the idea that invisible arrows need nms
weird
how can I make ghost effect, without using additional teams?
couldnt i just set the arrow to have an invis potion ig?
you can try if that works
again, i cant get the addPotionEffect to show up on the arrow
seems like its only applicable to living entities
does version spigot api for 1.8.8 have persistent data containers
no it has nbt
how do I access the nbt
couldnt tell ya, i dont use 1.8.8
nope
is there a class I can use to add data to an item
NBT api might exist for 1.8
is anyone aware if its possible to revert upstreams patch?
i dont feel like uncommenting 1000 lines by hand
Or vscodes replace feature 
this doesn't help
¯_(ツ)_/¯ not much support for 1.8
how can I convert a string like "&ahello" to ChatColor.GREEN + "hello"
yeah
declaration: package: org.bukkit, enum: ChatColor
just make sure u use the bukkit ChatColor class and not the Bungee one @tranquil stump
bump
will this work?
final String json = "[{\"fileName\":\"cannon.schematic\",\"name\":\"&aCannon\",\"lore\":[\"&aA cannon\"]}]";
final SchemInfo[] schemInfosArray = gson.fromJson(json, SchemInfo[].class);
// convert color codes with & to ChatColor enums
for (SchemInfo schemInfo : schemInfosArray) {
schemInfo.name = ChatColor.translateAlternateColorCodes('&', schemInfo.name);
for (String line : schemInfo.lore) {
line = ChatColor.translateAlternateColorCodes('&', line);
}
}
There's no way to do so without teams, mojang did not implement another redundant way to accomplish the effect. That's why I think that it's very important to have full control over teams on your server and why I usually dislike bloatware like the popular TAB plugin.
How do you want to use this effect?
Define "work".
when I set line, will the effect still take place outside the scope? intellij says "The value 'ChatColor.translateAlternateColorCodes('&', line)' assigned to 'line' is never used" but it doesn't say the same for setting name
I need developer in my server but cant FIND one i working always alone
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
wrong place to ask
No, you iterate all lore lines and store each line in the variable String line. If you assign that local variable a new value, it will not be changing the actual array item of the lore. What's SchemInfo?
what i do in that link
ok so I have an array of objects (schemInfo) with a string (name) and an arraylist of strings (lore), I want to run the translate alt color code on all the strings. is there a method in java to do something like that?
Is SchemInfo your own class?
If so, provide a paste of it.
public class SchemInfo {
public String fileName;
public String name;
public ArrayList<String> lore;
@Override
public String toString() {
return "SchemInfo{" +
"fileName='" + fileName + '\'' +
", name='" + name + '\'' +
", lore=" + lore +
'}';
}
}
You either have to iterate with indices and thus be able to set items and "exchange" them for their translated version or use the replaceAll function.
Why does spigot pass the converted nms recipes into bukkit in PrepareItemCraftEvent instead of the instance that was originally registered?
I registered my own recipe CustomRecipe and when reading it from the event, I get a Recipe that's not equals to the one I registered
so im holding obsidian in my hand that I got from the creative inventory, but its display name is null. how do i get its name or just "obsidian" if it doesn't have a "display" name?
that is the translatable name of the material
what do you need it for
the actual thing will have a display name but i didn't want to write a command to give me a block with custom display name for testing
Can you show an excerpt of the code you run to register this recipe?
hmm, yea well falling back onto the en_us translation of the material minecraft:obsidian is pretty meh with spigot API
last I checked at least
Block at -386,67,174 is DROPPER but has net.minecraft.server.v1_8_R3.TileEntityDispenser@3992089f. Bukkit will attempt to fix this, but there may be additional damage that we cannot recover. what does this mean
How to build with maven guys? can someone give me a tutorial link or smth?
It's written in kotlin but all I do here is read through the items in my factory, check if they implement a desired interface and get the static createRecipe method. Then I just register the recipe using Bukkit.addRecipe
i wanna create the .jar
libraries included
oh thanks 🙂
You have to set up shading as well
use the maven shade plugin
yea
idk if you are talking about your plugin that you have to configure
I can show you an example of how I build my stuff, one second, you can maybe find some inspiration from that
or another plugin you are just trying to build
it sounds good
what does maven shade do?
https://paste.md-5.net/azimugejud.xml
Ignore what's not relevant to you, like shrinkifying or copying the jar. Look at the shading section. If you just want to include libraries, you don't need to relocate, so remove that tag and all of it's children if that's the case.
awesome, thanks 🙂
Maven really takes some time getting used to, but once you got it, it's really easy, believe me. Maven plugins are just a processor in the chain and transform your result. Btw, maven plugin order matters, they're executed in that order they're specified in (not going to matter for what you do, but it's good to know this).
i hate that it makes sense for maven to handle plugins that way
i got it
I just wanted to see what API you call to register a recipe, as I haven't worked with bukkit in ages. Looks like the recipe you pass is just a wrapper for them and they convert to the CraftRecipe anyways, thus not keeping a hold of the original. It's sad that they cannot even keep a ref to it... Well. I think you have to identify your recipe by providing a namespaced key (just something unique) in it's constructor and then map locally to resolve to your internal data type. Hope these infos help you.
Forgot to tag you in the message above, xD.
Huh? What do you hate about that? :D
?paste
because i dont pay attention to the order of how i have configuration for plugins
ive tried this
https://paste.md-5.net/irikuyizoq.xml
it apparently created me a shaded .jar, but the server doesn't recognizes the library
its usually just oh i need this plugin for maven let me add it and configure it
not thinking that if something to happen BEFORE another plugin executed that it would actually matter how i have them in plugins section
I think that a pipe model makes perfect sense, what pisses me off is that it's actually not a pipe, but you have to specify the input to most plugins separately and they don't care about the output from before. Something like pipe chaining in unix would be cool, but yeah, I guess that restricts the freedom of what a plugin can and cannot do too much.
Yeah I saw the impl of addRecipe as well and couldn't understand why they would make it behave like that. I guess it makes sense because they cannot pass my reference to NMS.
thank you
They're not using NMS to wrap tho, but craftbukkit. They could've easily held a reference to your original value. Btw, be careful to not cause any collisions with that namespaced key tho, maybe set your plugin name as the namespace and then the recipe name as the actual key.
Look into the shaded jar with jd-gui and check if the expected libraries are actually there as packages.
Wait, you didn't specify any includes in your pom
groupId:artifactId of the dependencies you want to shade
It will never just shade all your dependencies by default, except for when you instruct it to do so with a wildcard, which would be insanity, lol. Rather have inclusions than exclusions.
so im using the projectile launch event and looking to get the pdc of an arrow, but trying e.getPers... doesnt work
got it nvm
It will shade compile dependencies by default
https://paste.md-5.net/yaxagijipu.java
Trying to figure out how to get particles on the arrow, i got most of it done but have no idea how i can put particles on the arrow while it is flying
Oh yeah, forgot about that because I never used the compile scope. Thanks for pointing that out!
what do i need to put in my main class for a runTaskTimer?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
not exactly what i meant, i meant how do i get the task to start running
i know i need to put somehting in the main class, i dont remember what
@EventHandler
public void onShotFollowingTrail(ProjectileLaunchEvent e) {
if (e.getEntityType() == EntityType.ARROW) {
if(e.getEntity().getPersistentDataContainer().has(new NamespacedKey(Nebula.getPlugin(), "a8pistol"), PersistentDataType.STRING)) {
new BukkitRunnable() {
@Override
public void run() {
Location loc = e.getLocation();
World world = e.getEntity().getWorld();
world.spawnParticle(Particle.REDSTONE, loc, 50);
if (e.getEntity().isDead() || e.getEntity().isOnGround()) {
cancel();
}
}
}.runTaskTimer(Nebula.getPlugin(), 0L, 5L);
}
}```
this is where my task is, what should i change then? It should be running no?
so nothing needed in my main class yeah?
alr
since ur here
lemme ask u this
what should be the way i pass an instance of my plugin?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
whats the better method?
no i created it
its a getter
@EventHandler
public void onShotFollowingTrail(ProjectileLaunchEvent e) {
if (e.getEntityType() == EntityType.ARROW) {
if(e.getEntity().getPersistentDataContainer().has(new NamespacedKey(Nebula.getPlugin(), "a8pistol"), PersistentDataType.STRING)) {
Bukkit.getScheduler().runTaskTimer(Nebula.getPlugin(), task -> {
Location loc = e.getLocation();
World world = e.getEntity().getWorld();
world.spawnParticle(Particle.REDSTONE, loc, 50);
System.out.println("s");
if (e.getEntity().isDead() || e.getEntity().isOnGround()) {
task.cancel();
}
}, 0L, 5L);
}
}```
complete piece of code, no particles being spawned nor is "s" being printed so the task isnt running
sure
yep event is running
yeah me too
im gonna check that
yep the pdc is the issue
odd
@EventHandler
public void onShoot(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (p.getInventory().getItemInMainHand().getItemMeta() != null) {
if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
Arrow bullet = (Arrow)p.getWorld().spawn(p.getEyeLocation(), Arrow.class);
bullet.setShooter((ProjectileSource)p);
bullet.setVelocity(p.getLocation().getDirection().multiply(4.5D));
bullet.setDamage(5.0);
PersistentDataContainer bulletPDC = bullet.getPersistentDataContainer();
bulletPDC.set(new NamespacedKey(Nebula.getPlugin(), "a8pistol"), PersistentDataType.STRING, "shot");
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(bullet.getEntityId());
ReflectionUtils.sendPacket(p, packet);
}
}
}```
and im setting the pdc here, why wouldnt it work 🤔
[01:14:27 ERROR]: Could not pass event PlayerJoinEvent to FoudreLobby vv0.0.1
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
at java.util.regex.Matcher.getTextLength(Matcher.java:1769) ~[?:?]
at java.util.regex.Matcher.reset(Matcher.java:415) ~[?:?]
at java.util.regex.Matcher.<init>(Matcher.java:252) ~[?:?]
at java.util.regex.Pattern.matcher(Pattern.java:1134) ~[?:?]
at com.tr.denizusta.foudrelobby.Main.color(Main.java:41) ~[?:?]
at com.tr.denizusta.foudrelobby.events.OnJoin.onJoin(OnJoin.java:17) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-794]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerList.postChunkLoadJoin(PlayerList.java:356) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerList.lambda$a$1(PlayerList.java:303) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerConnection.tick(PlayerConnection.java:316) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.NetworkManager.a(NetworkManager.java:408) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.ServerConnection.c(ServerConnection.java:168) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1520) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
someone can help me?
public static void createBoard(final Player player) {
(new BukkitRunnable() {
public void run() {
if (Bukkit.getPlayer(player.getUniqueId()) == null) {
cancel();
} else {
ScoreboardManager manager = (ScoreboardManager) Bukkit.getServer();
Scoreboard board = (Scoreboard) manager.getNewScoreboard();
Objective obj = manager.getMainScoreboard().registerNewObjective("foudre", "studios", "foudre");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
obj.setDisplayName(color(Main.plugin.getConfig().getString("scoreboard.title")));
List<String> lines = Main.plugin.getConfig().getStringList("scoreboard.lines");
for (int i = 0; i < lines.size(); i++) {
Score score = obj.getScore(color(PlaceholderAPI.setPlaceholders(player, lines.get(i))));
score.setScore(-i + lines.size());
}
player.setScoreboard((org.bukkit.scoreboard.Scoreboard) board);
}
}
}).runTaskTimer(Main.plugin, 0L, Main.plugin.getConfig().getInt("scoreboard.update-ticks") * 20L);
}
```my code
im printing the keyds after i set the pdc and its def created, so the issue lies in when i check for the existance of the pdc
paper
i just using paper fork
what is on line 41 in Main class
Matcher matcher = pattern.matcher(message);
message is null
public static String color(String message) {
Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String hexCode = message.substring(matcher.start(), matcher.end());
String replaceSharp = hexCode.replace('#', 'x');
char[] ch = replaceSharp.toCharArray();
StringBuilder builder = new StringBuilder("");
for (char c : ch) {
builder.append("&" + c);
}
message = message.replace(hexCode, builder.toString());
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
let me try
i fixed it
but now
[01:56:36 WARN]: [FoudreLobby] Task #1429 for FoudreLobby v0.0.1 generated an exception
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_16_R3.CraftServer cannot be cast to class org.bukkit.scoreboard.ScoreboardManager (org.bukkit.craftbukkit.v1_16_R3.CraftServer and org.bukkit.scoreboard.ScoreboardManager are in unnamed module of loader 'app')
at com.tr.denizusta.foudrelobby.managers.Scoreboard$1.run(Scoreboard.java:24) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
(ScoreboardManager) Bukkit.getServer();
That's not valid and your IDE should be warning you about this
ScoreboardManager manager = Bukkit.getScoreboardManager()
I thought you were reccomending this cause you were still typing xD
lol no no
its the little features that count :) gonna try and extend this to all entities and make entity-specific particles happen on damage (ie. bone item crack for skeletons and skele horses)
theres probably a million other plugins that already do that but its more fun when u do it urself
[02:06:38 WARN]: [FoudreLobby] Task #1777 for FoudreLobby v0.0.1 generated an exception
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard cannot be cast to class com.tr.denizusta.foudrelobby.managers.Scoreboard (org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard is in unnamed module of loader 'app'; com.tr.denizusta.foudrelobby.managers.Scoreboard is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @751af8a4)
at com.tr.denizusta.foudrelobby.managers.Scoreboard$1.run(Scoreboard.java:25) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]

public static void createBoard(final Player player) {
(new BukkitRunnable() {
public void run() {
if (Bukkit.getPlayer(player.getUniqueId()) == null) {
cancel();
} else {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = (Scoreboard) manager.getNewScoreboard();
Objective obj = manager.getMainScoreboard().registerNewObjective("foudre", "studios", "foudre");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Main.plugin.getConfig().getString("scoreboard.title")));
List<String> lines = Main.plugin.getConfig().getStringList("scoreboard.lines");
for (int i = 0; i < lines.size(); i++) {
Score score = obj.getScore(ChatColor.translateAlternateColorCodes('&', PlaceholderAPI.setPlaceholders(player, lines.get(i))));
score.setScore(-i + lines.size());
}
player.setScoreboard((org.bukkit.scoreboard.Scoreboard) board);
}
}
}).runTaskTimer(Main.plugin, 0L, Main.plugin.getConfig().getInt("scoreboard.update-ticks") * 20L);
}
what i did wrong idk
Yeah you don't need to be casting anything there
getNewScoreboard() should return you a Bukkit Scoreboard
Fix your imports and you won't need to cast anything
org.bukkit.scoreboard.Scoreboard
import org.bukkit.scoreboard.*;
[02:09:30 WARN]: [FoudreLobby] Task #1252 for FoudreLobby v0.0.1 generated an exception
java.lang.NoClassDefFoundError: me/clip/placeholderapi/PlaceholderAPI
at com.tr.denizusta.foudrelobby.managers.Scoreboard$1.run(Scoreboard.java:29) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.ClassNotFoundException: me.clip.placeholderapi.PlaceholderAPI
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:155) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:114) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
... 9 more
You haven't got placeholderapi installed.
how
i installed
1 min
would have deactivated the plugin if I hadn't downloaded it
The first part of that error says placeholderapi not found.
What's line 29 of the Scoreboard class
i fixed it
[02:14:57 WARN]: [FoudreLobby] Task #1787 for FoudreLobby v0.0.1 generated an exception
java.lang.IllegalArgumentException: An objective of name 'foudre' already exists
at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:47) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:84) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:62) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:20) ~[patched_1.16.5.jar:git-Paper-794]
at com.tr.denizusta.foudrelobby.managers.Scoreboard$1.run(Scoreboard.java:24) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
i want kms
so
registerNewObjective("foudre", "studios", "foudre");
i changing to this
registerNewObjective("foudre", "studios", "foudre2");
?
Yeah, you can only have 1 of each
[02:19:49 WARN]: [FoudreLobby] Task #1783 for FoudreLobby v0.0.1 generated an exception
java.lang.IllegalArgumentException: An objective of name 'foudre' already exists
at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:47) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:84) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:62) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:20) ~[patched_1.16.5.jar:git-Paper-794]
at com.tr.denizusta.foudrelobby.managers.Scoreboard$1.run(Scoreboard.java:24) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
:ı
Objective obj = manager.getMainScoreboard().registerNewObjective("foudre", "studios", "foudrestudios");
Delete all objectives from the scoreboard then register the new ones it still has a trace of them old one
its not gived a error but the scoreboard its not showing
i added placeholderapi and citizens to depend but
its still giving this error
[02:25:25 WARN]: [FoudreLobby] Task #1790 for FoudreLobby v0.0.1 generated an exception
java.lang.IllegalArgumentException: An objective of name 'dummy' already exists
at org.apache.commons.lang.Validate.isTrue(Validate.java:136) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:47) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:84) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:62) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scoreboard.CraftScoreboard.registerNewObjective(CraftScoreboard.java:20) ~[patched_1.16.5.jar:git-Paper-794]
at com.tr.denizusta.foudrelobby.managers.Scoreboard$1.run(Scoreboard.java:24) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1432) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1347) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:833) [?:?]
but the scoreboard come
Yeah you can't create a new objective if it already exists
how i update scoreboard?
now its gone
can chunk.load load chunks which have not been rendered yet?
How do you check whether a player is looking at an entity
Probably something to do with raytracing
^ rayTraceEntities
Yes
Okay, because my program is supposed to be doing chunk.load and spawn entities in that chunk
and unloads the chunk, but it seems there is an issue with that
program can't find the entities that are supposed to be spawning
What version are you making the plugin for?
spawning did actually change between 1.19.2 to 1.19.3 didnt it
something with light levels
- how to get the default world/main world?
- When i do Bukkit.createMap(world), is this map available from any world? Or does its ID increment differently from world to world? Like does each world have their own ID counter?
Default world name is Bukkit.getWorld("world");
Alright so entities are loaded separately from the rest of the chunk information to speed up chunk loading. Use the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/world/EntitiesLoadEvent.html event to read the entities when they're available
declaration: package: org.bukkit.event.world, class: EntitiesLoadEvent
I wouldn't need players on the server to get the entities in this way right?
what if my server.properties mention the different world as "skyblock"
No, entities will still be present even if there are no players
Be aware of mobs that despawn and such however
I would recommend using Bukkit.getLogger().info((something in the world).getWorld().toString()) to find the world name
alternatively, going in-game and going into f3 will have a name for the world minecraft:world_name, but this is not foolproof
Bukkit#getWorlds
then get the first entry
thanks for your tips
thanks, any clue for 2)
i'm mostly concerned about 2)
where i create this map is absolutely no contextual (no context)
so i don't really know what to put there
Though looking at the api methods I might be wrong
You can always check the implementation just to be sure
@Override
public CraftMapView createMap(World world) {
Validate.notNull(world, "World cannot be null");
net.minecraft.world.level.World minecraftWorld = ((CraftWorld) world).getHandle();
// creates a new map at world spawn with the scale of 3, with out tracking position and unlimited tracking
int newId = ItemWorldMap.createNewSavedData(minecraftWorld, minecraftWorld.getLevelData().getXSpawn(), minecraftWorld.getLevelData().getZSpawn(), 3, false, false, minecraftWorld.dimension());
return minecraftWorld.getMapData(ItemWorldMap.makeKey(newId)).mapView;
}
@chrome beacon the impl^
doesn't help much does it
esp since ItemWorldMap is an NMS class
now good luck understanding nms
xd
It's not that hard when you have a good understanding of Java
i don't even know where to find the impl of NMS
Though something I wouldn't touch is the DFU
I'll stay as far away from that as I can
fair enough
it's not my problem; im more concerned about not having a good understanding of minecraft, ofc i could spend countless hours to decrypt all and get all mechanics in my head
but reading code is easy when you know what it's dealing with, the least info u have, and the more decrypting u need to do 😛
The Minecraft wiki usually has all the information you need
Plus, NMS is obfuscated lol (i don't think i can find any versions with mojmaps directly applied to the source)
Any good environment will provide you with a mapped source you can use
Spigot, Paper, Forge, Fabric, Quilt all of them have tools to map sources so you can view them
already read minecraft wiki, esp. the map page, but due to minecraft being mostly used like 1 world per server / solo, the question of whether each world has their id system doesn't really happen
tf is a DFU
DataFixerUpper
It's generic hell
and probably the most over engineered part of the mc source
👀 What's it used for
A serializer on crack
Used mostly to convert shit to network ready bytes
It's horror
the codec shit is in like every nms class
Time to take a look
I assume it's another codec since that one is part of the DFU
hm the only codec I can find is part of the DFU. Do you happen to have the exact name for it?
Nah
I found decoders for byte messages but they don't look that bad
I'm just going to assume the codec you're talking about is part of the DFU
Lemme look it up
Because that's the only codec I've seen in the code
Yeah that's part of the DFU
I know I've worked with it 💀

I used it when modding
protobuf where are you
Thankfully I could just copy paste and slightly modify Mojangs code to suit my needs
I believe I scrapped that in the end though
protobuf is my bae
Guys , how i can give a custom item in determinated slot?
p.getInventory().addItem(instance**.getTotem**());
i use this but give item where the slot is empty
declaration: package: org.bukkit.inventory, interface: PlayerInventory
Try using the Javadocs next time
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
thanks
You can use Inventory#setItem(int slot, ItemStack item)
oops i just saw thats answered
idk but show errors
need some help
Because you need to create the itemstack first. and pass it into setItem
i'' try
He also needs an inventory instance
Yep, and you need the actual slot number.
?learnjava You really should follow some Java tutorials
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.
I recommend trying some different courses
oh ok , thanks
Try and find what works best
I've heard that https://java-programming.mooc.fi/ should be quite good too
Helsingin yliopiston kaikille avoin ja ilmainen ohjelmoinnin perusteet opettava verkkokurssi. Kurssilla perehdytään nykyaikaisen ohjelmoinnin perusideoihin sekä ohjelmoinnissa käytettävien työvälineiden lisäksi algoritmien laatimiseen. Kurssille osallistuminen ei vaadi ennakkotietoja ohjelmoinnista.
thanks :))
I've used courses from Udemy which aren't bad.
https://cdn.discordapp.com/attachments/637778190118551554/1058920422139232296/image.png does anyone know if there is any error here?
wait
package events;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import pack1.PluginMain;
public class OnPlayerMovingListener implements Listener{
private Plugin plugin = PluginMain.getPlugin(PluginMain.class);
@EventHandler
public void onMovingPlayer(PlayerMoveEvent playerCoinvolto) {
Player player = playerCoinvolto.getPlayer(); //In questo modo ogni volta che scriveremo player, ci riferiamo al player coinvolto (All'interno di questo metodo)
if(!player.hasPermission("testplugin.move")){
playerCoinvolto.setCancelled(true);
}
Block bloccoSottostante = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
ItemStack diamondPick = new ItemStack(Material.DIAMOND_PICKAXE, 1);
if(bloccoSottostante.getType() == Material.COBBLESTONE) {
player.getInventory().addItem(diamondPick);
}
}
}
should i use pastebin?
hey im wondering if anyone can test my plugin rq?
you imported the wrong Plugin class
?paste
wdym sorry
you have org.apache.logging.log4j.core.config.plugins.Plugin imported
oh that
Or 16
i mean... if u can send the packets 
but yeah its spigot p sure
dont think it has much beyond chat but
?jd
hm
You guys have any ideas on how to stop items going through portals?
Would that work you think?
The event is not cancellable
Lol if only
Unfortunately I need to go for style points
Maybe just teleport it somewhere else?
I'm missing the spigot() method from my Player class in 1.8.8
I've compiled using spigot and not craftbukkit
Does anyone know the issue?
Don't use 1.8.8
Well the spigot() method does apply to player is 1.8.8 so you must be doing something wrong
Yea that's what I'm trying to figure out
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>```
```<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>``` I'm using the right spigot repository
hape niu yer
Most sober Russian
rtue...
IntelliJ reports the spigot API to contain a few vulnerabilities, is there anything I can do about this as a plugin developer?
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Provides transitive vulnerable dependency com.google.protobuf:protobuf-java:3.19.4
CVE-2022-3171 7.5 Uncontrolled Resource Consumption vulnerability with medium severity found
CVE-2022-3509 7.5 Uncontrolled Resource Consumption vulnerability with medium severity found
It will be fine
So a big problem I am having is players time out of the server when spigot is loading a new world (from a world file not creating a new one). It takes too long for it load the spawn region of the world and everyone times out
Does anyone know why when I try to import this into eclipse it just dosnt work even I put the spigot.jar into the pathspublic class Main extends JavaPlugin{
like spigot-1.19.3.jar?
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
1.19.2
ye, better to use maven or gradle than to try and directly depend on the jars
Ill do that now, sad tho
?main
Was using eclipse but it seems to not be the program anymore
@EventHandler
public void onClick(NPCClickEvent event) {
String npc = event.getNPC().getName();
final ConfigurationSection section = Main.plugin.getConfig().getConfigurationSection("bungeecord-npc");
for (String npcname : section.getKeys(false) ) {
for (String servername : section.getKeys(false) ) {
final String data = Main.plugin.getConfig().getString("bungeecord-npc." + npcname + "." + servername);
if (npc.equalsIgnoreCase(npcname)) {
Main.sendPlayerToServer(event.getClicker().getPlayer(), servername);
event.getClicker().getPlayer().sendMessage("Başarıyla" +npcname+" adlı npc ile "+servername+ " sunucusuna gidiyorsun.");
}
}
}
}
```i have code like and have config like this:
bungeecord-npc:
skyblock:
server: skyblock
towny:
server: towny
when player click a npc its check npc name if the npc name added to bungeecord-npc section plugin get the server and send player to server
?paste
So, I'm trying to get a consistent method to check if a string is encoded with Base64 and my current methods are https://paste.md-5.net/zezuwodebo.java
The issue however is that I cannot get a method that works consistently for the test strings.
Using the following strings:
SGVsbG8sIFdvcmxkIQ==
Hello, World!
HidePlreload
I get the following results: https://paste.md-5.net/omehorubow.bash
For whatever reason the first one fails 1 test, the middle passes all of them, and then the last string fails all but 1 😐
Looking through logs /plugins, /ver, /version, /ifo, /lag, and /mem are also treated as base64 encoded strings
well, cant any string /be/ base64 technically
quick question, for PlayerRespawnEvent, does anyone know if event.getPlayer().getWorld() gets the world where the player died in or the world the player is attempting to spawn in?
Of course, which means that the currently provided methods are shit and need re-written to follow the format exactly or something kek
judging from the stash code id say that Player#getWorld will return the world they died in
could always just test it out to check
was lazy to check due to testing it on a modded server, so the answer is appreciated
I can test real quick if u want
go ahead if you want to
your best bet looks like isBase642
but something must be wrong with how youre checking the chars
oh wait isBase642 fails all
hmm
isBase641/3/4 might be right then
Yea, but those exact ones also say HidePlreload is base64 lmao
Ig if anything I just log & check extra stuff 🤷♂️
https://www.base64decode.org/ While it's not considered invalid does however decode to '^>Zޖ
idk maybe that specific one doesnt have ascii chars
hmmm
The world you die in
perfect! thanks for the confirm
It's also possible something else is fucky, but I'm not too sure on that one
alright now im trying to do something real weird
how should I record the output of a command
What's annoying is that out of every single in the log those are the only ones being detected as Base64 @buoyant viper
hmm
Minecraft for example, not considered Base64
v not considered Base64
\plugins also not considered Base64 but /plugins is
/pl on the other hand is also not considered Base64
Shit's fucked
If a BukkitRunnable calls a method in a different class and that class has a while loop will that freeze the main thread?
hi
i am writing a small minigame and i wanted to write the while loop for the game.
should i use multi-threading for it?
just a while loop
that does things every certain interval.
is there a way to make it so while my player is in a conversation using the convo api they are not able to move, place blocks, etc. they are ONLY allowed to type in chat
i am trying to run an asynchronously task in the background without freezing the main game thread. How would i do it?
i need help
i am using old plugin in new server version but i am getting kicked for timed out how to change plugin version?
you don't need to unless it uses NMS
if you aren't the author contact them
if they don't respond
find an alternative or get rid of it
there is no cut paste solution
use schedulers
heyo. what'd be the best way to insert a key & a value into a nested hashmap?
.get(...).put(k,v)
why is your first key the same as your second?
you are trying to insert a UUID, integer
as you call get on teh main map
your map shoudl be Map<UUID, Map<String, integer>>
what are you doing here? looks like your storing player name and some number, honestly think a custom Data class would bess fit your scenario more as then it'd also be more expanadable. e.g. you want to add a third value.
then it's testing.put(p.getUniqueId(), testing.get(p.getUniqueId()).put(p.getName(), value)