#help-development
1 messages · Page 223 of 1
well not alwyas
Did you reload the server perhaps?
Did you reload or restart your server after adding the plugin?
keep in mind that deadlines and hourly rates matter
I dont think so?
if you're getting paid 5 bucks an hour, quality isn't your concern
No, i have restarted every time
because the people paying you clearly don't value it
Why didnt already start coding minecraft over the Unity engine? I think its more efficient and more sophisticated game engine
@stone dust can you stop your server and run the current code you have as well as.
I prefer to code my plugins into NES cartridges
?paste
just increases the time spent writing getters and setters instead of programming. doesnt really improve safety or performance here
lombok and Alt + Insert are your best friends
true
generate is nice
just type @Getter or alt+insert -> down -> enter
and spam enter 15 times
constructors have never been so easy
alt+insert enter enter
should start using alt+insert more
yessir
i usually manually write them lmao
Just use kotlin smh
I got tired after a couple years
why do people buy programming books
I'm lazy myself and use lombok
info is free
it worky
regardless a collection shouldnt really have a getter
the way it is presented to you is not
Yeah if you dont wanna to less time coding getters just use Lombok
Restarted and tried again, still same problem. The code: https://paste.md-5.net/uboqimuyir.java
reading well-structured info takes less than reading info and sorting it yourself
have methods to interact with it, dont expose the collection itself
valid
specially if you're a beginner
way to get the immutable copy maybe but usually you would write operations instead of a getter
you can't guarantee the info you just looked up is still valid
Can u put the stacktrace in a pastebin too @stone dust
but books can get outdated pretty fast tho no?
?paste
this.plugin.selectedPlayers is still null
Specified on chapter 1, article 10 of my book tho
And i totally agrree with it
Watch your words please, this is spigot comm not paper 🧐
Shit is not a bad word. Also i am banned from paper.
No S*** Sherlock
Me too tho, they comm comptly sucks
major beef happening today
Can u print out plugin.selectedplayers before the if statement @stone dust
I don't need some ill-bred to tell me what to say or what not to say - With that being said i will stop answering beef
Can u guys take it to #general please.
@stone dust Is that all of your code?
I dont understand the reasons of his list still being null
Can u reseend the url
He posted it above
ok
I have another class too, but i dont get why that would interfere. Can post it though: https://paste.md-5.net/beqedusaxa.cs
PS: Dont roast it
Like this? p.sendMessage(plugin.selectedPlayers.get(1).toString());
Are these async events? @stone dust
I would suggest either using Di or Singleton, there is no need to ue both of them
Just plugin.selectedplayers @stone dust
what book is this, i tried to lookup but theres a bunch
its not on intenet i have search for it
I have it on paper format, literally the sense of books
It has like around 3-4k of pages
😂
bruh
@stone dust ?
Wait, im trying to get it over
Yeah i read books-books, e-books have make us losting the esense of reading
What essence?
yoo, it worked
not sure, pretty sure its just preference
It printed it out?
Still the error?
Nope, not what i can see atleast
In your this class ^
You’re looping over that list async
Whilst manipulating it sync in the main thread.
Put the loop in a bukkitscheduler and schedule it sync.
Oh yeah
When you are using async, everything must be manipulated async
Same with sync
Not really.
Ty for all the help, it has been really helpful :)
❤️
And sorry for indirectly starting a beef hehe
No problem, they’re just being weird.
Chapter 6, article 7 "Async and Sync"
damn he hit you with the chapter AND article
Yeah i know it from memm the book but still cant understand how to do correct async stuff on java
💀
What you said was wrong. The chapter is probably correct.
wowww he said you need to reread the chapter
Because java async has many shits to do it, not like javascript nor ts where you just have a keyword for it
rereading is never a bad idea to refresh knowlgedes
How many times i had to read about di to understanding correctly
very real
Because DI sounds really simple but then you realize is not like you thought
what is it to you
For me its like a plug and play, where you have 2 classes and were you pass instances thru constructors
That is how i understand it
Yeah i totally agree
im taking my ap cs class for my senior year currently and its a java course. so we start at the very beginning
its fun to be able to help the kids in there learn
Nice talk bro you look really interesting and understand my humor or bad jokes
look???
I mean in enjoy tlkg with oyu
whats that supposed to mean
lmfaoooo
yeah my bad, english barriers
It’s probably just his way of saying you’re interesting.
yikes
i gotta change my pfp
My friend has that hair too, it’s really fluffy.
I’m going to bed. Tag me and i’ll react tomorrow.
alr bet
Cya, takes care
I mean i was saying that you are cute nor i like you, just saying that you look like a cool prson
yeah i gotchu
Where is the difference between ChatColor.translateAlternateColorCodes('&', msg) and just .replace("&", "§")
you might wanna check the impl but i believed it was pretty much the same
assuming you mean replace('§', '&')
The translate method won't replace things that aren't colour codes
&y as a random example
makes sense
I don't think there's a y colour code
Pretty happy to see md5 not like paper comm which the CEO´s doesnt ever give the face
Hmm I wonder if that could be optimised by skipping the next char once a replacement is made
Not that it really matters lol
md_5 what inspired you to do spigot and bungeecord
what a god question
I have doughts like that too
Why did he even start working in project related to mc and not another type
Idk fun, need
verano when is your region thing on gh
Once i can find why i can do actions if i claim a something
He prob was like "Bro I have to much free time let me just programm a plugin support for minecraft"
spigot is a bukkit fork*
yes but yk what I mean
Which was first started my mojang with the minecraft-server - just to finish the setence
who made craftbukkit?
Warren Loo was in charge of the Bukkit project
Mojang acquired the Bukkit project in 2012.
Over a decade later, and we're still waiting for the "official Minecraft API".
Not happening lol
probably whatever shit with the datapacks or whatever is their "official API"
And here's where Warren Loo chose the wrong license for Bukkit/Craftbukkit, resulting in the chaos of 2014.
i have like around 10 different worlds in my spigot server how can i load /deload them when someone teleports so that i dont have to run all worlds at the same time and they dont all get created when I run the server
Are you using Multiverse?
yes i have the core
and inventories
but i have my own warp commands
and own locations for world spawns and stuff
cus idk best way to configre everything
So just tell Multiverse to keep the world spawns unloaded, and a world without players won't use much memory at all.
https://github.com/Multiverse/Multiverse-Core/wiki/World-properties#memory
See "Keep Spawn in Memory"
Set it to false for each world
Maybe leave it true for your main world's spawn
I don't know. Maybe someone else can help.
neither me
does anyone know why Spigot 1.19.2 isnt working with Maeve refrenced librarys but 1.17.2 does?
What is maeve
prob maven
yeah
what are maven referenced libraries ?
is it isgetOfflinePlayerIfCached a paper method?
yep
was going to ask how their cache works, but I decided to wing it and hope that method suffices
wings --debug
Anyone?
The refrenced library in Eclipse wont pull up anything 1.19.2 related but it will pull up stuff 1.17.2
how do I get the amount of a certain itemstack in someone's inventory
Uhm maven plugin dev with additional libraries works perfect for me
1.19.2, eclipse
Yeah. It doesn’t work for me which is weird
This, but isSimilar() instead of .equals() because equals() checks for quantity
And += slot.getAmount() probably
I want to cancel ender pearl damage, but the damage cause is FALL. How can I know the difference between actual fall damage and the damage which is inflicted when a player teleports using an ender pearl?
well you can put player to the map/list or smth
and just cancel damage if player is on the list + remove player after
what could be causing my player teleports to never work
Good idea might be to learn queue systems, threading and javas atomic api
Oh and how to use delta values
Looks fine. Would look even prettier in kotlin.
HADHAUSUDHH
had a playerteleportevent e for block drop event function
ffs
ur up already?
Yes school soon.
if (plugin.getConfig().getString("spawn.World").)
How do I tell if this exists?
check if its null
Condition 'plugin.getConfig().getString("spawn.World").equals(null)' is always 'false'
isEmpty() maybe
try printing it
you're probably looking for https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/configuration/ConfigurationSection.html#isSet(java.lang.String)
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
Condition 'Objects.requireNonNull(plugin.getConfig().getString("spawn.World")) == null' is always 'false'
nope
Are you trying to check if a value exists in the config?
just do get()
yea
yep
Can you show the code?
how you used it*
I remember using that method before and it worked iirc
You are doing a double check here
wdym
ohh thanks
Remove the requirenonnull if you are going to check for null. Also remove for debug purposes as all its going to do is hide the problem
Requirenonnull and the likes are for api purposes and not really for implementation purposes
Basically when user input is expected via api to ensure they are not passing in a null value
Is there an elegant way to get what the nearest solid block that is directly above a location?
Say I have a block's location, I want to get the location of the highest non-air block that is directly above it
declaration: package: org.bukkit, interface: World
If you want only the nearest just do your own loop
Is there a way to convert org.bukkit.Material to nms Material?
Yes
for (int i) ```
test ```
thanks
let savedNumber = []
const count = {
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0
}
for (let i=0;i<5;i++) {
const randomNumber = (Math.floor(Math.random()*2))+1;
savedNumber.push(randomNumber)
count[randomNumber]++
for (const key in count) {
if (count[key] > 2) {
console.log(posible[8].innerHTML = 25);
}
} ```
this works
let savedNumber = []
const count = {
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0
}
for (let i=0;i<5;i++) {
const randomNumber = (Math.floor(Math.random()*2))+1;
savedNumber.push(randomNumber)
count[randomNumber]++
for (const key in count) {
if (count[key] > 2 && count[key] == 2) { <---- the only thing I changed
console.log(posible[8].innerHTML = 25);
}
} ```
this doesnt work
could someone explain to me what I am doing wrong?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
uhm thats javascript
Even more applicable
gotta learn js in 2nd semester 🥺
thats what we gonna learn it for
what fucker wrote this
dang i just got to college
4 hours lessons now
gotta learn about powershell commands and networking stuff
imagine going to lessons instead of grabbing your laptop and doing unrelated work
this post was written on my laptop during class
these mfs barely know what an object is
Networking stuff should be handy. Not so much with powershell except learning hidden things you can tweak windows with lol
so I make sure to code in java, using more objects than braincells
Arrays.copyOf
kek
hello how to schedule a restart event on a specific real life time via the plugin?
?scheduling
or even run a timertask
isnt it called like that
use an Executor if you want real world times
Yea
i should probably be looking at lesson
TimerTask just uses the old date api iirc which is the only meh thing
Chapter 7, Article 2 "Executors"
any examples? or something for that i new to java and spigot
google it
there would be like half as little messages in here if people googled something themselves
Hi if I use zstd to make a yaml file or a sqlite file for making it lighter can that be a good idea?
yes
then no, don;t compress either when using
what can be a light way to storage information? without using mysql or mariadb
you seem to be all over the place.
decide what you are doing and then ask for advice on storage
moderation
God forbid some use it as backend
allow me to introduce myself
wtf
also your code doesnt even work for me lol
anyways whats not working
anyways this works for me ```js
let savedNumber = []
const count = {
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
6: 0
};
for (let i = 0; i < 5; i++) {
const randomNumber = (Math.floor(Math.random() * 2)) + 1;
savedNumber.push(randomNumber);
count[randomNumber]++;
for(const key in Object.keys(count)) {
if (count[key] > 2 && count[key] == 2) {
console.log(posible[8].innerHTML = 25);
}
}
}``` but yours should anyway but node is being fucky
if you mean why doesnt it print anything its because count[key] wasnt 2 when you tested it
also you typod possible lol
also console.log(posible[8].innerHTML = 25); is not a valid statement
all players are kicked because this why ?
[15:34:41 ERROR]: Packet encoding of packet ID 85 threw (skippable? false)
um is thewre a reason I shouldnt use InventoryClickEvent#setCursor()
its depraceted
but how would i replicate smth like that
Im creating automated box
but I need to get Width of a letter and adjust numbers of = adequately, any clues how to get that width?
ArrayList<String> list = new ArrayList<>();
StringBuilder start = new StringBuilder();
StringBuilder end = new StringBuilder();
String repeat = "═".repeat((int) Math.max(0, longestEntry*0.8));
start.append("╔");
start.append(repeat);
start.append("╗");
end.append("╚");
end.append(repeat);
end.append("╝");
list.add(start.toString());
for (int i = 0; i < entries; i++) {
list.add("║ " + entry + " ║");
}
list.add(end.toString());
return list;
You gotta get the width from the fontfile, problem is, that if the player uses a texturepack, their font might be different and with that all the spacing.
welp thats their problem 😄 thx
wait is mc font monospace
yesn't
While all the fonts are in a 8x8, they get interpreted differently by the shader I think
exactly, "I" and something like "ö" are vastly different
Hey im getting this error: Cannot invoke "org.bukkit.World.spawnEntity(org.bukkit.Location, org.bukkit.entity.EntityType)" because the return value of "org.bukkit.Bukkit.getWorld(String)" is null
for this Method:
public static void firework(int power, Location location, boolean flicker, FireworkEffect.Type type, Vector direction, int seconds, Color color, Color[] fade, boolean trail) {
Firework fw1 = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
fw1.setVelocity(direction);
FireworkMeta fireworkMeta = fw1.getFireworkMeta();
fireworkMeta.setPower(power);
fireworkMeta.addEffect(FireworkEffect.builder().withColor(color).flicker(flicker).withFade(fade).with(type).trail(trail).build());
fw1.setFireworkMeta(fireworkMeta);
new BukkitRunnable() {
@Override
public void run() {
fw1.detonate();
}
}.runTaskLater(Main.getInstance(), seconds * 20L);
}
}```
Can smbdy gelp me?
I had a file once that actually saved all of them, but I think I deleted it ._. sry
Hey
Just an update about a problem I had
Some days ago I came here talking about lag when generating rewards for a crates plugin
and I just realised that the lag wasn't about the random generator but about the Minecraft stuff like messages and inventory
see here:
where amount = 2000000
Just wanted to say it
bye
soo thefore by how much shall i multiply the length, so its perfect?
No, you gotta make a list of all the lengths of each character. I recommend having something like a json file and then loading it into memory once
currently checking where you could get that list from
I somehow nailed it
but ig it won't be the same for every string
If you want it perfect you'll need a texturepack from someone called "AmberWat" which allows you to add "invisible" pixels. That'll make your text perfectly aligned.
Here's the lengths of each character @twilit roost
omfg tysm
it might still not help though aligning it perfectly
what is the best library to make gui in your opinion?
Spigot
Also it's missing those weird corner characters, you gotta add those manually
bruh
i mean
its not technically wrong
and i cant say much else than that since i dont use gui libraries
nanana, it's technically correct, the best kind of correct
all gui libraries have kinda been confusin for me
spigot wont do that
u will just hate it
its not bad tho
i like it
its simple
you handle everything yourself
no funny business
Fun lies in the eye of the beholder.
if anyone ever wants to parse this into a list of Map.entry heres the code:
public static void main(String[] args) throws IOException {
File file = new File("D:\\","fontWidths.txt"); //change the directory
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = reader.readLine();
while(line != null){
System.out.println(translate(line));
line = reader.readLine();
}
reader.close();
}
public static String translate(String line){
String[] args = line.split("=");
return "Map.entry(┆" + args[0] + "┆," + args[1] + "),";
}
then just copy output u've got in Terminal, paste it into some IDE and replace all ┆ with "
that's not how you parse it into a map but ok
also try with resources is a thing
Here's a better way
is it worth making my plugin java 19 only? i mean, do many people use it rn or not?
public static Map<Character, Integer> parseWidths(File file) {
Map<Character, Integer> map = new HashMap<>();
try(FileReader fileReader = new FileReader(file); BufferedReader reader = new BufferedReader(fileReader)) {
String line;
while((line = reader.readLine()) != null) {
String[] split = line.split("=");
char key = split[0].charAt(0);
int value = Integer.parseInt(split[1]);
map.put(key, value);
}
} catch (IOException exception) {
exception.printStackTrace();
}
return map;
}
type deal
Depends on what versions you want to support. If your java version is too high, then for example mc 1.16 won't work
1.8 likes to trip above java 16
looks better 😄
I made that thing up in 5 minutes
well my plugin is currently 1.17+, but I can afford to drop some
so did I
...
Not sure what max for 1.17 is, I would say don't unless you need one of the new Java features. There's only a minor performance boost if any
yeah I do want the new features, I can live without them but it'd be convenient
the problem is that I have to make people update to 19
particularly i want to use jep 420
it's java 18 actually, even better
so is it worth it?
I have this issue with importing local jars from maven, but I work on two different machines, mac and windows. In which I use <systemPath>${project.basedir}\NRCore.jar</systemPath> to import the jar but the slash changes per os. Is there anything I can do?
\ /
Put the jar in your local repo on both PCs and add it using maven
i think it's the .m2 folder?
Yep ^
That right
Honestly if you don't care about supporting more MC versions and think switch pattern matching is more important, upgrade.
I only develop for the latest version and I know a lot of other people here do too. So might as well upgrade to whatever Java version latest is on.
can't tell if this is sarcasm 😄 again, i am fine with not using jep 420, and i am fine with not supporting older versions, so i'm kinda in two minds
Can you not use ${file.separator}?
😩
maybe I can 
It's not sarcasm, it's really up to you to decide which is more important for your project
alright then, i'll take a look at bstats, for some reason just now did i figure that would help lol. thanks!
Would I use Nexus to host my jars online?
I mean you can but if it's a local jar you don't have to do that
It's a core I want everyone to have access to
stoopid question but how can I get files stored in resources in IDE to be in a plugin folder when running the plugin?
If you want everyone to have access to use it as a dependency then Nexus is one way
Alright thank you
I think there's saveResource, let me look that up
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
Yea, just use JavaPlugin#saveResource() to write the files to the plugin folder.
ty
this is a very detailed compile error
also i got this:
null in switch cases is a preview feature and is disabled by default.
how do enable it, anyway? i've put on jdk 19, put on the latest sdk in project settings, etc, it still will not compile
what exactly is the line of code with the error?
java 20 should be a thing already
Ah lol, confused J20 and J19
it's the most random line possible, I commented it out, it still bitched on it
anyway I'll invalidate my caches too
with most random line, what do you mean?
nothing peculiar at all
no ide errors
so like there are 7 list modifications
list.add(..)
list.add(..)
and on one of them, there's an error
and even when I comment the line out, it still bitches at that exact line
I'll try to see why
hello can someone help me? I wannt that the plugin restarts the server every day at 19:00 german time how to do that?
you can use LocalTime, initialize it with your preferred timezone, then check every 20 ticks (look up Bukkit Scheduler Programming) if hour is 19 and minute is 0
can probably be done in a better way, that's just my first thought
can i create a schedule Eventhandler?
okay thank you
I have to put it in a method or?
could you give me an example?
would be great
?scheduling
ik how to use the scheduler but which method do i need?
Using the scheduler is not going to work if you want real world time
I linked you an example earlier
the scheduler runs on game ticks, which are NOT exactly 20 per second. Over a day it will be out by quite a lot
do i need to add it into a method when yes in which one?
^^ told that too or it was another person
You need to read that until you understand it
Fuck wifi in station is bad
The answer to this post tells you in simple terms how to do it https://stackoverflow.com/questions/20387881/how-to-run-certain-task-every-day-at-a-particular-time-using-scheduledexecutorse
Is there a way to check if a pressure plate is pressed outside of the PlayerInteractEvent (so just checking the current state)
How to set a 2 values in a yml config for the same name for example: items.cobweb -> COBWEB, 16
items:
cobweb:
material: COBWEB
amount: 16```
thanks
basically settings items.cobweb.material and items.cobweb.amount
I don't think it's possible with that method, but it might be possible with Player#hideEntity(). Don't quote me on it.
That's cause it's a draft api.
It's means its a wip api and it might change in the future.
declaration: package: org.bukkit.scoreboard, interface: Criteria
It has always wanted a Criteria afaik it just accepted a String instead of the enum
So you were always giving it an invalid criteria because I don't think main is one
It wanted a string, yeah?
Pretty sure the string was the criteria
Yeah that's what I said lol
Yeah because "main" isn't a valid criteria
That's what I'm saying, you have been passing an invalid criteria lol
Dummy probably
Did you try it
Did you try with a lowercase d?
I know it has to be lowercase in the command
oh I was looking at the screenshot whoops
Send the error
can't think of a reason why Criteria.DUMMY would be incorrect
but watch now I'll eat my words
Yeah it should definitely be right
Very weird that it errors when you pass dummy, which is completely valid, and didn't say anything when you were passing "main" in older versions.

If it returns spigot entity
declaration: package: org.bukkit.entity, interface: Entity
It's castable to all subinterfaces, depends on situation
but will it work for something like getHealth() or getSaturation()?
or getInventory()
im basically making an entity that uses a Player because i dont want to do it the nms way
Here's a highly specific question: if I get a configuration section and I modify it, am I modifying the file configuration or is the configuration section a deep copy of the file configuration?
what do you mean by "configuration section"
ConfigurationSection, the java class
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
literally most devs here are on intellij
misclicked enter
you're fine, lol
okay I know it will sound little stupid but still. Is it possible to make it so the Auto-Completion will still appear even after the full word is typed?
because I have a habit from Eclipse to type the whole word
and I make everytime a new line
You would be modifying the object itself. (Not a copy)
the FileConfiguration object?
Yes
awesome, thanks
uh. maybe it'd be possible with a plugin; i dunno anything about developing intellij plugins though, and it sounds fairly niche, so i doubt it exists..
Just sounds like a force of habit to get over, lol
yeah I know
I tried to search but didn't found anything
I plan to make some plugins for IntelliJ IDEA but I'll do it when I have more free time
maybe on the Holiday break
other thing I really want in IntelliJ IDEA is when you autocomplete it auto completes with variables
just don't type the full word
if you are wanting auto-completion why make unnecessary actions that will be done for you
idk I love typing the full word
well unfortunately that makes you part of the minority
BlockDamageEvent
think there is something in there close to that
well I mean what other way does a player have to damage blocks
if you want to say explosions, we already have events to cover that
Hi how I build spigot I can decompile all classes? Exists switch to do this?
?bt ?
download build tools and git then run java -jar BuildTools.jar --rev your.version.number
so java -jar BuildTools.jar --rev 1.19.2for 1.19.2
This is a very dumb question but how can i make a method return a string or a component, without needing it to have both
Generics 👐
Or you could just make 2 methods
:P
Tbh I think the latter is a lot more sensible than the former
but that means i have to remember which to use
how am i meant to have good memory smh
Literally part of ur job
^
who says
😢 I give up
Devs need to have good memory
i remember some stuff
I was gonna ask If you remember getting some bitches, but then I remembered you were a dev
lmfaooo
elaborate
I am assuming the string is also part of the component ?
They want one or the other depending on the situation
You'll need two method names
Or you could do some scuff generic bull shit 😂
It would be infinitely worse than 2 separate methods but
:) you could
I'm not sure you really can do it with generics as String and components don't have a common parent type
eh I mean I guess you can
Yeah, just make two methods lol
You can make a common type yourself
The amount of self hate required to produce this though would be quite unimaginable
If I'm using Maven in eclipse do I want the source file to be "src/main/java" rather than just "src?"
yes
wym
I copied a tutorial for a very simple plugin exactly except they were on an older version and just used the spigot jar and I needed Maven to get the Spigot libraries and I even found the plugin online and it works but my version doesn't work. It extracts fine and even shows up green when executing "/plugins" but nothing happens when the command is run.
I thought maybe it was in the wrong src
But now I have no idea why it won't work
Did you register your command as well as put it in your plugin.yml?
Yes I think so
I decompiled the same plugin that works and it is the exact same code everywhere
send a screenshot of your project files
?img
Not verified? Upload screenshots here: https://prnt.sc/
or verify
im guessing the * means they arent saved, might be wrong
your plugin.yml needs to be in src/main/resources
that too
You were correct
Isn't it?
It is in the package that is in src
oooooh
also
try and keep your "main" plugin class name as your plugin
so instead of Main.java do CreeperSpawn.java
?main
when renaming the file change it in plugin.yml too
Doesn't java require that at least one class be named "main?"
for applications yes
on spigot no
but not when you are making a plugin in spigot
Ah I see
same reason you dont need to have a public static void main(String[] args) {}
Is this something that will break it or just good practice?
just good practice for spigot plugins
^^
tbh if you arent gonna like make an api with your plugin it doesnt REALLY matter
What might one need an api for?
if you ever wanted to make a library that does cool stuff that no one has made youd want to avoid Main
really just to avoid ambiguity
Can the main class be renamed? I don't see the option?
refactor is what you are looking for
mhm lmao
i mean my intellij doesnt do that so
Where exactly?
doesnt really matter if ij does or doesnt been as you should really be needing to change the class name
main: my.package.name.mainclassname
me.jason.CreeperSpawn.CreeperSpawn
Right yeah
was just about to type that lol
That's what I meant
yeah thats correct
^^
what about seperating words in a phrase?
Isn't the first letter of the second word usually capitalized?
method names are usually camel case
that is camelCasing for variables and methods
packages are all lower
classes are UpperCamelCase
Ah okay that is good to know
Could not load 'plugins\CreeperSpawn.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
Got this error in the console
Should the .yml be listed in the resources to export when I go to export? If so how do I get it to show up?
yes
did it not create in your server?
oh wait
no
lol
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
add this to your pom.xml
also what spigot version are you on cause your plugin.yml says 1.13
To the bottom of it?
put it within the <project>In here</project> tag
Oh I did that because it kept saying legacy plugin in the console and I saw somewhere to add an api-version to fix it
hmm
I don't think it is needed
Just before the "/"?
It causes a bunch of errors
what errors
- The content of elements must consist of well-formed character data or markup.
- Non-parseable POM C:\Users\jason\Desktop\MyPlugins\CreeperSpawn\pom.xml: unexpected character in markup (position: END_TAG seen ...</dependencies>\r\n< ... @23:3)
Anyone know how I can get substring of global env in github workflow ? In local i can do bash way, but for some reason it doesn't work for global
send pom
use this ?paste
?paste
?img
Not verified? Upload screenshots here: https://prnt.sc/
no just copy paste
before the entire </project> tag
Between the tags, not right before the /
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>CreeperSpawn</groupId>
<artifactId>CreeperSpawn</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
Lemme try
should just include your src/main/resources folder into the build
Does the yml not work if it is not in resources?
no it wont work
If im hosting a jar in nexus, what do I actually put to add it to my pom.xml?
idk, just saying so you dont think im ignoring you, im bad with maven tbh
Dang same error message in the console
before the plugin seemed to be working but the command did nothing
Now it doesn't even get enabled
yeah that is weird cause it wasnt in the resources folder before no?
Right
so it shouldnt have even loaded
I was following someone who wasn't using Maven so it was way less folders
https://paste.md-5.net/ozekibixah.xml paste this directly under <version></version>
it is straight from my pom
ok
lmao i just realized that the paste was from epicebic not you
Is that extra "<properties> at the top supposed to be there?
you can delete
did you try and copy paste this?
This really shouldn't be of concern as this is how coding projects stay organized
Yeah
and it didnt work?
Nope
how are you building the project
It is just a main class and a class for the command
The working version I found is nearly identical but didn't use maven
no like are you just clicking a "build" button or
I'm not sure what that means exactly
https://paste.md-5.net/iqocotaqay.xml take this and add it under version
then right click your pom.xml and click "run as" then "maven build"
and in the "Goals" type "package"
I have the repositories for spigot already
ok just add the maven plugin
Still same thing
[20:41:46 ERROR]: Could not load 'plugins\CreeperSpawn.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:178) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:423) ~[paper-1.19.2.jar:git-Paper-261]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:278) ~[paper-1.19.2.jar:git-Paper-261]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-261]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-261]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more
it is not being shaded in
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>18</source>
<target>18</target>
</configuration>
</plugin>```
add this plugin
Anywhere in POM?
underneath the last plugin you have
Multiple markers at this line
- Malformed POM C:\Users\jason\Desktop\MyPlugins\CreeperSpawn\pom.xml: Unrecognised tag: 'plugin' (position: START_TAG seen ...</plugins>\r\n\r\n <plugin>... @43:21)
- Invalid element name:
- plugin
One of the following is expected:
- sourceDirectory
- scriptSourceDirectory
- testSourceDirectory
- outputDirectory
- testOutputDirectory
- extensions
- defaultGoal
- resources
- testResources
- directory
- finalName
- filters
- pluginManagement
Error indicated by:
{http://maven.apache.org/POM/4.0.0}
with code:
?paste
Yeah I just saw that
Still the same error, plugin won't load
Should I delete the yml and write it again or something?
are you packaging with maven?
I am using maven
I am using packages
Not sure what packaging entails
It seems like the yml is not getting bundled into the jar when I export but I don't know why not
that is the problem
send screenshot when you right click pom and click run as maven build
Not verified? Upload screenshots here: https://prnt.sc/
goals: clean package iirc
When building without maven you have to tell the ide to include it
If building with maven you should only need to put it in the resources directory assuming you didn't mess with structure maven requires
how do I detect if a player left / right clicks an entity? like PlayerInteractEvent
I know PlayerInteractEntityEvent exists but I can't find a way to detect both left and right clicks
I mean a left click is just EntityDamageByEntityEvent
alright thanks :D, not that worried about right clicks anyway
get the Y component of their velocity
Check your project SDK and language level
maybe just check null before?
oh apparently after reloading maven it throws me back at java 17, but i don't see why it is so
And don't use Java 18
i did
i am using 19 lol
did you look at my screenshots
isthe right version set in the maven file?
that's not the only j19 feature i want to use
<properties>
<java.version>19</java.version>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
what more?
jep 405, 427
out of curiosity
what could be wrong with this??
oh it could be because my compiler plugin is 3.8.1
but
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
``` should just take the 19?
prob
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\plugins\maven\lib\maven3
Java version: 19.0.1, vendor: Oracle Corporation, runtime: C:\JDK (real 1.19 the other one is 1.18)
Default locale: ru_RU, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"```
the output of mvn --version
yep
update, invalidating caches did nothing
ok, riddle me this, how did it happen that the latest java is java 19 and intellij only has 17 preview???
Probably because your SDK was set to 17
and the previous sdk i used in this project was 16
i am updating from 16 to 19 for some new features
and this looks like a fuckup
So long as you set your IDE to the proper sdk and set the language level accordingly, it all comes down to your pom.
<properties>
<java.version>19</java.version>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>19</source>
<target>19</target>
</configuration>
</plugin>
global project search, no matches for 16 or 17
that's why i am here, i can't see the problem at all
Try removing the <java.version> tag and the compiler plugin. Refresh your pom, then clean package.
alrighty
nope, still thinks it's 17
also for some reason it gives me an empty error at this absolutely not peculiar error
any ideas shadowmaster?
Maybe you need to restart your IDE. I'm gonna download java 19 and see if I have that issue as well.
So yea, as expected, I don't have an issue. 😛
so basically it tells me this (attachment 1) when i modify the sdk level (attachment 2); after i do change it to latest, it says this (attachment 3). maybe i shall send my whole pom?
?jd-s
?paste
how can i downgrade the javadocs
declaration: package: org.bukkit.entity, interface: Entity
this works for 1.12.2
yep
or you can generate them yourself with BuildTools
see, the problem is, I don't have the 19 lang level 😄
i don't know why it limits me to 17 preview, i really don't
but i did use some of the things from your pom like compilerArgs
It might be at the bottom of the list. It was for me at least.
It was trying to limit me to level 18
nope:(
That's a little odd. I have an experimental section.
its an experimental I think he needs to download that
what's your intellij version? perhaps that's the key?
oh, right, i've got just this lol
and it doesn't even suggest any updates to me, huh
i have just manually asked to check for updates and it found 2022.2.3
wow
Do you have an icon here?
yeah, and i'm downloading the latest intellij rn 🙂
i just kinda assumed that it should present me some updates on boot
it didn't
It used to, but I guess they changed their mindset. Which I honestly don't mind that it doesn't tell me.
oh well
shouldn't they only suggest stable updates?
Even now I'm still behind by like 2 minor versions.
how do i code brakets?
???
ye
The backtick
no not in java
in discord
like how do i send the code
i pasted it
but i want to put it in brakets here
like this
Yea, you use the backticks like in the image. You put your code between them.
package me.lotusishere.lotuscore;
import org.bukkit.plugin.java.JavaPlugin;
public final class LotusCore extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("LotusCore Is On");
}
@Override
public void onDisable() {
// Plugin shutdown logic
System.out.println("LotusCore Going Off");
}
}
did i do right?
like the send input and output command to consoel
console*
this is just a blank plugin pretty much
ye thats a blank plugin
?
this is a plugin that does nothing but tell people that it has started/stopped
You've just got the boilerplate.
yes i just wanted to tell you if its right or wrong
also you should use Bukkit.getLogger().info() over System.out.println() in Bukkit plugins
yeah pretty much
in spigot plugins too
spigot is a fork of craftbukkit
or bukkit, not sure about the correct name
yes it will print it in console
oh k
Spigot is a fork of bukkit. Craftbukkit is the just the implementation.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
i can't figure if you know java or not Lotus
if you do not please learn it prior to coding plugins
i dont
I'm a little confused why he was asking if it was correct. I know that's the autogenerated classes from the Minecraft Development Plugin, so there's almost no way that it could be screwed up in the first place.
good to know, thx!
bestvadvice
i dont know java
in that case use one of the links above to learn it
learn it
and it is gonna take you more than a couple hours
how many days?
cause i have school
a lot
depends on your dedication
^
do it in your free time
all of us have school
also in case you disagree, read this thread
What make ppl thinks they can code without learning the laguage were they code?
Its started to happen this since years ago and i dont know why
well, when I started, I honestly thought that the actual Java knowledge had nothing to do with coding plugins
because plain java is less interesting than making plugins
i started really learning java after a LOT of problems along my way
so we wanna make sure other people don't make that mistake
exactly
Honestly, I wonder what the psychology behind it is. It's common enough, but I think it's people biting off more than they can chew. At least at first.
Sorry if I sounded rude
honesty best
But i always asked my self that question when someone ask for help and they dont know itself the bases
I tried coding plugins when I was sick without knowing shit about Java I just followed some tutorials covering the basics after that read code and the rest comes allong but now I would say first learn java then plugins
In my case im taking a bootcamp for improving my code skills and the first lesson was about the logic behind programming
^
minehut players moved on from skript to plugins because minehut started allowing to add custom plugins
don't hesitate to ask for help, just make sure to really learn java 😛
what build do i use?
what do you mean
Intellij is not a build
of java?
intellij is an IDE, the program where you write code
Intellij is an IDE
the build system sorry
Maven and Gradle are dependency managers, for example for libraries
graven
Maven or Gradle are build system
Hold up, are we just going to gloss over graven?
I found Maven to be the most convenient one for me
lmao
Graven is it a new build?
its just prefrence
i wish graven was a thing
Hi does anyone know someone who makes custom plugins?
old people use gradle
we all do
really
so what do i use?
like
?services

