#help-development
1 messages Β· Page 336 of 1
But I need that method to never go out of scope
Like I need the stuff inside that method to be constantly running during the game
Yes, but that's handled by whatever runnable you have inside of #activateDungeon().
And that's not gonna call generateDungeon() anyways?
I'm assuming that #activateDungeon() calls #generateDungeon()?
public void activateDungeon() {
//Generate switch logic with no code inside of them
switch (state) {
case IN_PROGRESS -> {
generateLevel();
setWorldBorder();
}
}
Indeed
I can see how this is starting to be fucked :/
Ok then yea. Let that be handled by its runnable. You can just call #activateDungeon() as is and NOT inside of a timer runnable.
So only run activate dungeon once?
Yes
But then the rest of the gamelogic
public void activateDungeon() {
//Generate switch logic with no code inside of them
switch (state) {
case WAITING -> {
}
case PAUSE -> {
}
case IN_PROGRESS -> {
generateLevel();
setWorldBorder();
}
case BOSS_FIGHT -> {
}
case ENDING -> {
}
case RESETTING -> {
}
}
}
Like there's more stuff in there I'm just deleting it
Pretty much like when something has to change any method in the game just changes the state and that changes what's happening
But seeing how this is going Im gonna need to rewrite the whole thing
Shouldn't the method be named accordingly then? Because, to me at least, activateDungeon() sounds like it should just switch the gamestate to IN_PROGRESS instead of what its doing now.
Fair
Yeah so best thing I can do is rewrite that logic correct?
I have no idea how to but I'll figure it out
It would help. I'd set this up so that I have a DungeonManager class that handles Dungeon instances. I'd put a runnable on the Dungeon class so that it can do gamestate stuff. That way it's tied to that instance and not the manager.
Ok ok I think I understand that part
As for how many runnables you would need, I'm not too sure.
I haven't exactly done this myself before.
I understand, I appreciate the help
hmm
Well, hold on. Maybe this isn't too hard to figure out.
at org.sqlite.core.DB.newSQLException(DB.java:1030) ~[sqlite-jdbc-3.36.0.3.jar:?]
at org.sqlite.core.DB.newSQLException(DB.java:1042) ~[sqlite-jdbc-3.36.0.3.jar:?]
at org.sqlite.core.DB.execute(DB.java:881) ~[sqlite-jdbc-3.36.0.3.jar:?]
at org.sqlite.core.DB.executeUpdate(DB.java:922) ~[sqlite-jdbc-3.36.0.3.jar:?]
at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:98) ~[sqlite-jdbc-3.36.0.3.jar:?]
at me.outspending.embarkkmines.API.Database.Database.addPlayer(Database.java:63) ~[EmbarkkMines-0.0.1.jar:?]
... 27 more```?
this is my first time using sqlite
so
?paste database class
ebic so you're willingly staying out of this conversation I see
everything works except for getPlayerData()
oh im watching wandavision
my brain hasnt turned on yet
lol what time is it for you
7:30am
Try to crack this infinite loop with tasks and terrible code with shadow and you'll literally be flying afterwards
We know where it's comin from
In another task lol
We
We're looking for solutions now
You'd have your gamestate runnable inside the Dungeon class. Then you could either create separate runnables for each state OR you could make criteria with events that can change the gamestate once the critieria has been met.
Take the exploration phase of a dungeon. If that's called IN_PROGRESS, then just make a listener class that checks when they enter the boss room and then change the gamestate to BOSS_FIGHT. The gamestate runnable will take over and then move on to the next phase.
Any additional runnables could be for special boss moves or particle animations. Then you'd cancel them when the phase ends.
oh
oh
I really like the criteria with events and listeners
There's no need for any runnables except spawning mobs
Non-stop
And I guess I could do that in a while loop
I've never done that about making my own listeners and such but I'm down to try
You'd have to check a bunch of stuff to make sure they only fire in the right phase, but it shouldn't be hard.
Hmmm alright. seeing a example plugin with that would be useful cause there's a lot of things I don't get just yet
your create statement is incorrect
one sec
I'd remove the newline characters first.
intellij did that for me
i thought i needed that
since intellij usually knows whats going on
String sql = "CREATE TABLE IF NOT EXISTS tablename (uuid TEXT PRIMARY KEY, name TEXT NOT NULL, /* this cant be location */ NOT NULL"
The other thing that looks wrong is the type of data stored. SQL doesn't know what a Location is. So I'd store it as text.
At least to get started.
ohh
i see
thanks
CREATE TABLE IF NOT EXISTS `players` (
`uuid` TEXT PRIMARY KEY,
`name` TEXT NOT NULL,
`location` TEXT NOT NULL
);
java.lang.RuntimeException: java.sql.SQLException: no such column: 'uuid'?
i have uuid in there
What line does the stacktrace tell you is causing the error?
String u = set.getString("uuid"); 41
Shadow is that a good example?
It's a good starting point.
Well I was just reading through it
This is hard
Well I have another idea now. What if I remove the runnable from activateDungeon() and make methods call it
There's only a few triggers that happen that are not player commands
@kind hatch Does cancel() inside a runnable start the run() method from the start?
And return gets it out of scope completely, right?
How can I like cancel execution but then continue from the start
cancel() will stop the runnable entirely. You can use the continue keyword like you would in a for loop to go back to the start of the runnable.
Hi. How we can cancel set spawn event with bed? I don't want the cancel PlayerInteractEvent. Any idea?
Ummmmm continue isn't allowed inside void run()
if ij is saying "YOU DONT NEED THAT" just ignore it
dafuq
lmao
new BukkitRunnable() {
@Override
public void run() {
continue;
}
}.runTaskTimer(plugin, 0, 10);
No bueno
Yes, since it's a timer method, you are telling it to stop code execution there. Then on the next cycle, it will continue like normal.
Sick. thanks
if it was a for loop continue would move to the next possible value to iterate over
Is there a way to store any type data then get it back later without parsing it
Gson maybe? Idk
Gson can do that for basic types but not any type
So what could?
Nothing. You will have to write serializers for complex types
I wanna add a safety check to my task
How can I check if the task is already running, if so, don't rerun it
I fixed it btw @kind hatch thought you wanna know hehe
new BukkitRunnable() {
@Override
public void run() {
}.runTaskTimer(plugin, 0, 20);
I think I can't if I do it this way
create a boolean outside of the method and set it if its false
private boolean methodRunning = false;
public void myVeryCoolMethod() {
new BukkitRunnable() {
@Override
public void run() {
if (!methodRunning)
}
}
}
yeah
alr ty
if it is running cancel the task
But then
Where would I set it, and where would I set it back to false
I guess before any cancel
Ok yeah I rsorted it
cool
if it is false set it
yup yup done it
event.getEntity().getKiller() doesn't work in playerdeathevent
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
i expected it to tell about the killer entity
is the killer a player
theres your answer, some reason getKiller is only an entity if its a player
slain by a mob doesn't count?
for all entitys you would need to listen to https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageByEntityEvent.html
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
for some unknown reason no
hmm alright
and just check what their health is
alr thanks
Hey I see more and more on Minecraft servers really cool custom texture packs where the scoreboard is added with new icons that don't exist in the game and so on. Therefore I have a question. How can something like this be implemented?
Hello, I have a quick question: how can I convert a string to a class. For exemple, I have the following string: "Arrow" and I want to covert it to Arrow.class, how can I do this please ? thanks in advance !
Caused by: java.lang.ClassNotFoundException: me.outspending.variableapi.testing.test@46854d26
heh?
oo nvm
i see the problem now
Custom unicode characters
Um, question. How do y'all keep track of all the classes? Because im cramming like 6 different ones and it gets so confusing since im trying to make it work. Any suggestions?
but how?
As long as you use proper naming conventions and proper OOP it should be easy
How are you structuring your project
Search resourcepack default.json unicode on google
Or something to that effect
This is a tiny bit i don't have much cause its 4:44AM and i should be going to be
Bed*, but its hard like fixing things because most of those go in different directions so
Doesnt look that complicated yet
Ok thanks I think I got it
Well full name is single responsibility principle
Itβs a good guide to have clean, readable code
Well uh, my thing is split up into like 6 classes as you can see
I could probably remake it and make it 1
π³
What does the sterilizer do
Sometimes multiple little classes is better than one big
Im making my own storage system so you can register whatever you want
And then retrieve the same thing
Register to what?
Whenever the variable is the class Location it will convert it above but this is very early and like i wanna change alot of stuff
Gotcha
Fun system to make
Its super fun so far I've gotten decently far in like 1 hour
I feel like ima run into alot of problems but π€·ββοΈ
Not doing it right if you dont have issues lol
True true!
But its pretty fun so far
Haven't really coded it the best, i like to make a template then make it good afterwards, not sure if that's a good thing or not
Yeah exactly
And most likely you'll change it so why make it optimized if you're just going to remake it
Afterwards ima optimize alot of it. It definitely needs some optimizations π
onSteroids?
anyone know why player.sendMessage doesnt work?
ur pfp man
i am using bungee
they have a scheduler too
^
String "Arrow" to Arrow.class ?
the problem was, that i havent registered the event, hahahaha, i literally forgot it xD i searched the problem 3 hours fr
Thread sleep is still an problem
How would I get an item/itemstack from another class? I tried doing ClassName.ItemName/ItemStackName but that didn't work
?learnjava ig
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.
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Guys im new to java. Where can i find help in this area and what are the best documentations for minecraft java plugin development
?jd
how i always learn is through trial & error
the documentation for spigot is available at https://hub.spigotmc.org/javadocs/spigot/
you could watch an introductory video on youtube or elsewhere that might help you, videos such as:
intro to OOP - https://youtu.be/SiBw7os-_zI
java crash course - https://youtu.be/drQK8ciCAjY
this tutorial on making plugins - https://youtu.be/_HZVWuRYzjY
etc
Also what do i do if i have made my InteliJ project kotlin and i want to go back to just java. i see that kotlin almost has no info on minecraft development and it would be better to do it in java.
I do know the basics of veriables, and the general of how it works. I also know python to a prety good level i would say which gives me the understanding of coding in general. Ive been doing it in Skript this whole time
?paste
python and java have different structures and concepts, while it certainly does help that you already know another language it might still take a while to get used to java
since you are new to java, i'd recommend looking at github projects that use java and try to understand what everything does
observing code and trial & error are the best ways to learn imo, at least they work for me
if you ever feel stuck though feel free to dm me, i'm always free to help
What about if i have my inteliJ plugin made into kotlin. How do i make it Java again without needing to make a new plugin?
It's probably better to start with java
if you don't wanna rewrite it, you could compile it and use something like JD-GUI to decompile it into java
yes, thats why im asking
Java and kotlin are different languages, compiling and decompiling will not guarantee that code will do what its supposed to
I havent writen much anyways. Just dont want to make a whole nother plugin just to go back to java
There are kotlin stuffs which you can't do in java
The code can break
kotlin and java both compile to java bytecode, don't they?
yes
Dont rly need it it was just me messing around
They do, but kotlin have some implementations java doesn't
As I remember in intelij you can right click at project and there is option "cover to kotlin" so I guess it works in other way as well
it still compiles to java bytecode and can be ran on a JRE, i reckon it could be decompiled into java code with only a few issues
The class code: https://paste.md-5.net/otuvosotam.cs
the 1st event (PlayerInteractEvent) is working fine, but the block event isn't(is not getting called at all), anyone knows why?
(ignore rest of code cause i copied from old plugin and I want to improve now but first wanted to see this work)
it wouldn't be the same, of course
but it would work
it's not guarantee to work
Theres only one way around. I dont see a way to go back
Plus with kotlin, you will use kotlin stdlib which is not available in java
decompilation is always tricky, i say try it first and see if it works
oh, that's a fair point
although you could use the kotlin standard library as an external library, could you not?
You can, but at that point just use kotlin
Under Tools>Kotlin>(the "decompile to java" option is gray and unclickable)
my advice is to start over but on java
there are multiple reasons why this is a good idea but I think one if the important one is that you learn more
Yes im trying
if you are going to convert your old code you might end up with stuff that leaves you even more confused
well then whats the issue xD
Decompiling kotlin does indeed produce javacode, but like it won't be as pretty as normal java code.
just make a new project
oh, create a new project
Dam, so a new plugin it is?
No one said it doesn't produce java code
ok
Just new project
Looking nice. https://puu.sh/JxOvU/dde9461931.png
you can use the same plugin details and whatnot
yeah it will be a new plugin, whats the problem with that?
You can just continue in kotlion
that is also an option
have fun dismantling the bytecode
Is const decompiled to metadata?
Ok where can i see all the inteliJ projects so i can delete them?
wherever yo usaved them
Is there a way to entity face specific entity?
according to google, a folder called IdeaProjects is where intellij stores projects
on windows: C:\Users\<Your User Here>\IdeaProjects
Might be stupid question but how do I spawn a block at a certain location?
thanks, ill see.
yes, you can calculate the pitch and yaw needed to do that using fancy math
i've seen a forum post about this, i'll find it one sec
location.getBlock().setType() @timid jetty
thx π
no problem
Gracias
it seems to not be using the math i remember it using, i must have misremembered and thought of the forge way to do it
I got this. is it still working? or anyone has a better anti-piracy system?
https://www.spigotmc.org/threads/tutorial-anti-piracy.149265/
that's great to hear
if you have any further problems, feel free to ask
Hi with bukkit task i tried to remove sponge block but my server litteraly dies, what can i try to fix and not giving player sponge
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?nocode
i mean my server crash for it
Send code
One thing i noticed with kotlin was that it allowed me to update my plugin without needing to delete and replace the old jar file. Is that possible here?
Don't do that haha.
i'm not really experienced with it, but there should probably be a way to do that with debug mode. i know it exists in eclipse, but i have no idea what the intellij equivalent is and if there's a way to use it for spigot development
i can't be of much help
sorry
you can use the debug tools in intellij to run a server but running one outside of ij is better
Quick question, sorry it's been a while since I've done any development stuff. On player death, when the player drops their items, is each stack considered a separate event for PlayerDropItemEvent
i dont think that will get called on aplayer death
been as drops are access drops from player death event
Hmm okay
So each time you add something we take the .jar file and replace the current ,jar with the new one and then restart?
Feels like a lot of time
yes, you could reload instead of restarting although that could cause issues - especially if your plugin has static fields anywhere
hmm okay so if i wanna keep track of an item on death how would I best go about doing that
the reason i got bored of spigot development is exactly that, having to restart with every change
i rarely have to restart, usually /reload is enough
You can quite automate it with maven
kk
automate it how
/reload is fine imo as long as there are no static fields or you reset them on disable
To automatically delete old jar and compile it inside of plugins dir
yeah ig, all of my static fields are final anyways haha
is there like a tutorial for it?
can I use this code to protect my plugin??
https://www.spigotmc.org/threads/tutorial-anti-piracy.149265/
confuse for premium resource rules
If you compile with -p export-local it will go into plugins
Without it, it will be normal
quick question again sorry, if im running an event on the death event, is the players inventory already empty at this point or can I check if players inventory contains something before checking all the drops
kk
not sure if this works - although there could be ways of bypassing this
such as decompiling the plugin and removing the auth() call
public void onBlockBreak(BlockBreakEvent event){
if event.getblock() == "Grass_Block" {
event.setCancelled(true);
}
}```
Prob dum question, but i'm new. I tried to make it so when a grass block is broken it cancels the event.
Would this work? Also getBlock() shows as red/error.
or the auth() method altogether, or its contents
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.
it was a wild guess
use .equals() on strings
I googled but only found this.
can you suggest me a way?
and probably want block.getType() == Material.GRASS_BLOCK
ah yes
if (event.getBlock().geType() == Material.GRASS_BLOCK) {
event.setCancelled(true);
}
lmao
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
apologies, i don't work with premium plugins
i don't know any ways to prevent piracy
ah ok so i specify the type
getType will give you something you can check against things
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskTimer(this, () -> {
if(Bukkit.getOnlinePlayers().isEmpty()) {
return;
}
for(Player player : Bukkit.getOnlinePlayers()) {
for(ItemStack i : player.getInventory().getContents()){
if(i.getType() == Material.SPONGE) {
player.getInventory().remove(i);
}
}
}
}, 20L * 10L /*<-- the initial delay */, 20L * 5L /*<-- the interval */);
This is inside the main class, my server crash
what's the crash log?
listen to inventory click, drag, item pickup ect and check if it contains sponge not forever loop over players and their inventory
Bomb function
Isn't there just contains method in inventory?
how can i improve it
Or smth like that
yeah
i was curious how to add fake players to tab but only found (outdated?) packet workarounds like this (https://www.spigotmc.org/threads/help-adding-fake-players-to-the-tab-list.405095/, https://www.spigotmc.org/threads/add-fake-players-to-tablist.111142) so I was wondering if anything better is currently possible with 1.19.3 (like using PlayerProfile or something?), or maybe there's a library?
You can do it by just using the event when the player clicks, picks up, drags
@weak kayak Where do i get the .jar after?
That's an easy and nicer method to do that
what listener because it gets added directly to the player inventory, the plugin its not mine
Instead a loop that kills your server
The plugin is not yours?
Don't try to prevent piracy all that does is make you look stupid when it gets cracked
no
So why are u asking for help
sorry, i don't have time to help right now
although it should be in your project folder after you build it with maven/gradle
because the dev can't help me and i was trying getting another way
THE DEV?
i can't provide much help, apologies
awesome thanks π
A dev did that?
not a dev
He lied my friend
i did that function for testing
Hum?
Oh ok
I don't have the listeners in my brain
Use the autocompletion
It's something like Playersomething
Just search in the completion list
It is quite obvious once you find
listen to inv click, inv drag, item pickup and listen to inventory open
bruh what
Two different types of String or smth?
hope not
It's probably IJ being drunk though
Can I somehow send a BungeePluginMessage without any players online?
yeah intellij is terrible with groovy
No. You will need to setup your own connections
you can emulate a player on both the sending and receiving server
but its sort of a pain and bug prone
NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA D:
Probably easier to just use Redis
indeed
or rabbitmq
I mean... The command is literally ran when the server goes online ;-;
redis only supports string values in messages
#getInventory().remove removes even stuff inside the main hand and second hand?
ij did a verano move
na
you can send bytes if u want to
o
oh
already implemented rabbitmq shit now
probably better anyways as its optimized for messaging
rabbit is better
yes
cuz redis uses its in memory db at the end to become a message broker
I've seen more plugins use Redis than rabbitmq
oh
meanwhile rabbit does it properly in and out
but now i do have to host redis, rabbitmq and mongodb
and then it also supports larger messages iirc
I guess this is the only thing that is siutable for me
except
I don't know how to do that lol
id set up redis
How do i get the .jar file from InteliJ project. I tried using the CTRL + ALT + SHIFT + S to auto upload the .jar file to the correct folder, but it dosnt seem to have worked.
And how i can do that? @chrome beacon
You could write your own simple socket system else wise
I never worked with Redis
and thus I don't get how it works as well
Take the opportunity to learn it maybe then (:
I probably will
Redis is quite widely used and popular
but not at this time
was going to do that but then i needed to broadcast to all servers or directly contact one from another and that would be inefficient
so using rmq now
only thing I could really do with Redis I think
is to use multiple proxies
but all I want to send the bungee message
is to just notify me that server X is online again xd
Wait wat
Where do i get the .jar file from in intelJ
Oh that was to neon
But orby, you know rabbitmq isnt too different from just a raw socket impl
I can't just write an event to a Bungee plugin that checks whenever a server goes online lol
Hi, the events don't work they don't remove in the player inventory or inventories in general and even in the main hand
well rmq is centralized
sockets are p2p
i could write my own rmq server
did you register the class?
yes
but i need to comminucate between any node, cluster or proxy and another one on any machine through the network
so i dont think p2p sockets would work
or would be very nice
P2p?
This is an example of the message sent AFTER I joined the server. Before I wasn't online on it I could not send it because player was null. This translates into "The builder server is online again.".
bump
yes
idk what the technical term is
but rmq is centralized and nodes dont need to confirm to something other than rmq that they are online
No a socket consists of a client and a server where the communication is bidirectional
yeah
Every publisher/subscriber is a client
Yes, well you could just run it on the proxy, or a seperate jvm
The serverware that is
Mye
after all all communication is abstracted anyways
True
so i can just swap impl
Abstraction π
very nice
i was curious how to add fake players to tab but only found (outdated?) packet workarounds like this (https://www.spigotmc.org/threads/help-adding-fake-players-to-the-tab-list.405095/, https://www.spigotmc.org/threads/add-fake-players-to-tablist.111142) so I was wondering if anything better is currently possible with 1.19.3 (like using PlayerProfile or something?), or maybe there's a library?
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class EcoCave extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("[EcoCave] We are online!");
}
@Override
public void onDisable() {
System.out.println("[EcoCave] We are signing out!");
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
if (event.getBlock().getType() == Material.GRASS_BLOCK) {
event.setCancelled(true);
}
}
}```
After added the .jar and loaded in game the onBlockBreak event was supposed to cancel the block break event, but i was still able to break the blocks. Its under the regular class that gets auto created when making a project.
you appear to be missing an S
Ok, Thanks!
yeah, all my homies love jvm
not a homie, but i do love me some jvm
Im learning π
this.getServer().getPluginManager().registerEvents(this, this);
I had an error for this line:
Illigal start of type
invalid method declaration; return type required
Expected ";"
Code:
this.getServer().getPluginManager().registerEvents(this, this);
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (event.getBlock().getType() == Material.GRASS_BLOCK) {
event.setCancelled(true);
}
}
}```
oh
there's nothing wrong with learning by trial and error, in fact i believe it's a great way to learn
Worked i fixed it. Thanks
So i basicly just put each class in its own file right? and then anything that is in it must be under an event or some sort of execution.
wdym by that last part xD
I mean if you never call a method it wont get executed yes
if thats what you mean
each class should be its own file and stuff should be in their method, constructor or be setting a private/public/protected variable
like you can't put lets say math stuff right after class line. It must be in an event such as onEnable
those are called methods
of course, knowing java first is good and the best case scenario, but everyone learns differently
learning through doing something you find interesting is more fun than just watching videos on java topics and reading documentation
an event is a method that the game will call when the event happens
I understand your point, but knowing your basics might result in saving you plenty of time
fair point
I can't speak out on this too much, I started with not learning Java either but at one point or another I had to review my basics
though I did know a bit of python
and well, the basics of programming
i do know basics of programing its not like im 100% blindly going into this
that surely makes everything better, so you kinda just need to get familiar with the syntax of Java really
it helps if you know a language like C# beforehand, or any c-like language for that matter
wanna know something cool
no way!
syntax may sometimes be included in spigot/bungee api help
uh no
it's just programming help related to spigot
uh yeah
How so?
Ask development-related questions here
this so
it's referring to the api of course
it is not
after all read the first sentence
if it did it'd say so
pretty good π
notice the | between them
yeah, they are two. different. sentences.
no, and "Spigot and BungeeCord programming/development" does not specifically mean API help
why the hell would they say "this is a channel for spigot dev help | this is a channel for spigot dev help"?????????????
it means anything related to spigot
anyway, what does helping people with syntax do here
java is related to spigot
and bungeecord
helping people understand java is by extension helping them program spigot/bungee plugins
paper is included under spigot right?
paper is a fork of spigot
well, i personally think that syntax should be a given before learning parts of the language
lol jinx
kk
?paperdev
Make sure to ask in the appropriate server concerning development towards different JAR types such as PaperMC. (Tip: Google them!)
xD
insert "sir this is spigot" here
normally from md
yeah
?whereami
most of us just ?whereami
they might have a paper server
They do
there is a paper discord
i mean 99% of spigot plugins should work under paper
yeah
mhm
yeah and kinda unreasonable
not really
im pretty sure paper are making breaking changes to their api soon
yeah you dont need paper especially when you are starting out
they at least staying backwards compatible
are they*
paper start crying at 1 patch version out
they aren't really rude tbh, that's something that all people experience when joining some mc discord lmao
we dont like supporting 1.8
after all spigotmc is pretty rude for someone new tbh
i found the invite link to the server, do you want me to send it in DMs?
yeah
were rude?
paper is a good thing in terms of being a server core, but it might be a bit sad to develop for lol
^^
have you seen stackoverflow
stackoverflow is newbie hell
yeah
also this topic might need to move to #general
we still talking about development haha
The only reason why people think paper is rude is because they don't talk there lol
this is "help-development" after all
that's true
"i need help with 1.19.2", paper:"no."
well yeah you dont go to Stack overflow to ask questions since all questions have already been asked
you could get a brand new error that no one has ever gotten before, clarify all the details, and somehow it's a duplicate of a closed Haskell question 81 years ago
lol reminds me of one forge developer who keeps telling anyone who asks a question to "read the docs" and shiz
oh and it's also off-topic
exactly
if people couldnt talk in here unless it was for help i doubt any help would actually get given
so yeah just assume if you cant find the answer on stack, it doesnt exist
i've once read that "stackoverflow should be a last resort after you've done plenty of research", but i thought SO was a QnA site...
there's a good video on stackoverflow problems somewhere
i'll go look for it
i don't like stackoverflow, i personally hack something together whenever i don't know what to do
that totally turns out great
just don't look at my github
most of the time something doesnt work for me
i just try and jank something together
if that doesnt work i go to the spigot forums or something
https://www.youtube.com/watch?v=IbDAmvUwo5c&t=3s it was this video
Stack Overflow has been steadily declining over the past decade. It serves as one of the greatest resources for programmers all over the world. However fails to accomplish the one purpose it was created for, Q&A. People are becoming more and more hesitant to ask questions on Stack Overflow because of the hostile moderators, and this will eventua...
then stackoverflow
i've made like two posts on spigot forums and both of them were newbie level questions
a lot of people dont realize that you are going to face toxic people no matter what developing skill you are
nowadays i don't even really make spigot plugins that often so i don't have to ask anything
i was flamed years ago when i made my first mod and they were like shitting on me so much...
haha that works too
there are toxic people in everything, not just dev
Yeah
Though i think the toxicity purpose on SO is so people ask meaningful questions that can add to their database
rather than some duplicate whatever.
i once made a simple line drawer app just to test out my new line-slope knowledge
a friend of mine told me it was inefficient af
database of answers
it was made in java, efficiency is not my priority
and it wasn't made to be used in anything
it was just an exercise lel
To which discord?
paper's discord
.gg/papermc
i guess, but...
i didn't want to send it in here directly
it still stays q&a
i dont think you can
nah it gets automod
cafebabe just yeets it normally
and i've not yet seen a qna site that explicitly hates duplicates and bad questions with this power
i just used the term "database" to represent their collection of answers
im not using it for any "computer science" way
i see
I mean, that is definition of good moderated forum
true, just want to make a point that you shouldn't be discouraged from asking questions if you don't have the answer
No duplicate answers and nicely asked questions
... i never said that
never said you did
ok.. lol
Everything or some aspects?
quite a lot
it's a fork of spigot, you can use any spigot knowledge on paper afaik although they might have different conventions
paper change a lot
they also have more api stuff
they deprecate all string methods
They wonβt abandon spigot tho, so you can just code for spigot.
precisely
you can also use any spigot knowledge
even if it is deprecated on paper
they won't remove it, that would be stupid
For some reason one class of BlockBreakEvent being cancelled is blocking all others to not happen? Is there a way to make all work no matter what?
Event priority or better logic on your behalf
I want like players to not build in that world but be allowed to break certain blocks and I'm doing this in different classes
event priority
I kinda don't want to put all in the same class
Seems like the latter is better for you
high for the thing to run last, no priority for the other stuff
Low happens first right?
He hates you
lowest happens first, but highest has final control
does anyone know if i should put a space between the ) and the { ?:
if(blockface.equals(BlockFace.UP) || blockface.equals(BlockFace.DOWN)){
if(blockface.equals(BlockFace.UP) || blockface.equals(BlockFace.DOWN)) {
How can I prevent my jar from growing to 44mb when I have a bunch of dependencies?
minimize thejar
Any other information on this?
maven or gradle
Gradle
do you have shadow plugin
Yep
add minimizeJar() to your shadowJar section
Alright il give it a shot
you can probably just ignore that
Is it just minimize?
out of curiosity, what dependencies do you use? xD
be careful when you use minimize if you use any classes with reflection
All of them
it doesnt account for if you define a class with reflection and simply removes it
oh firebase
is firebase just big?
maybe try using the plugin.yml library thing
seems like it
whats that?
it only works from maven central
should be in maven central
odd thing, on the mvnrepository page it says the firebase admin jar is just 980 KB
^^
jinxed
it seems to have hella dependencies though
if you add it to plugin.yml change implementation to compileOnly
and then you could set it to compileonly in gradle i assume
it would mean you dont shade it in
don't really know how gradle works
^
set it to either compileOnly or compileApiOnly
interesting
depending on your needs
another way is to use a runtime dependency loader
i made my own library but there are tons of other libraries that can download jars at runtime and load them
haha
how fucking big is firebase
i think it will download it to /libraries/ on your server
I don't know if kotlin sdk is in maven central
and then use it from there
but include that too
seems to be 40mb π
oh god
seems to be working
Yeah its downloading all the deps for it
that should only happen once
i see a true programmer
everything is working
many letter = workinhg
i don't know, but i can definitely say it's not bigger than ur mo-
i will excuse myself now
that's true
whats 40mb in kg
well im saying that it is in fact downloading
there are issues with the libraries feature tho but i dont think you should worry about them because they are rare
not a lot of kg
it was not sarcasm xd
my mom is bigger
when i see a lot of words it's probably working
unless java stack trace
xd
40000 kilograms :OO
yeah i've been thinking 0.0001kg or so
my mom is deffo heavier
π real dev
that's 0.1 grams
yeah
i am math
yall are smart
try {
unga bunga
} catch(Throwable $ignored_because_im_too_cool_for_errors$) {}```
also anyone know the potion length I should use if I want it infinite
Integer limit
use max value for int ig
Integer.MAX_VALUE or something
not working for me, it just goes on for a tick and then goes away
thats what I tried
MIN
xD
lmfao
MAX
im dumb
lmfao
the moment of realization
don't worry, so am i
rubber duck effect
dumbengers, assemble!
wait so why dont I have all my dependencies as libraries and have a 44kb jar
instructions unclear, drowning in my sink
sound fun
not all of them are on maven central
spigot api is
it is?
rookie, i don't drown in my sink. my sink drowns in me
oh it alr is doing that one innit
and you dont shade spigotapi anyway
yea just realized
well looks like I can do it with org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21 too
but i do appreciate you for using kotlin
java 1.8 is my comfort zone
this should be 17 too or
yes
yes
fuck java 8
xd
Java 17 is the real comfort zone
if a version doesnt use java 16 or higher i couldnt give a shit about supporting it
kotlin best
java 8 is gr8
well fk
you are missing out on so many features
check if there is kt stdlib for java 17
lol
probably different version
there are 2
yes, but i never use those features anyway
first one probably
you sure?
if (!(sender instanceof Player player)) return;
player.sendMessage("AMOGUS");
never use those
too many features to name
you would use this
so you're telling me you do new ArrayList<>() whatever
wait this is confusing becayse the version of kotlin is 1.8 but idk what java version
π€’
precisely
^
If you are going to use java 8, using smthing like vavr cause it provides some features from java 17 at least
That's fine.
simple fix, Collections.unmodifiableList(/*list goes here*/)
makes me feel smarter than i am
hmm, fair point
didnt it used to show ** ** lol
It doesn't anymore.
i said it makes me feel smarter, not that it made me smarter
yeah
sadge
changed it in 1.19.3
why though
mojang do be making questionable choices
its not like its counting down but
It was technically a bug
it was?
Yes
:(
why did it show * if it was a bug
yes
Yeah, 1.19.3
THAT WAS 4 MONTHS AGO?
Not quite. It was fixed for a snapshot release
why tf is this happening java.lang.NoSuchFieldException: numPlayers at final Field players = ev.getClass().getField("numPlayers"); (screenshot of the class attached)
the client will not notice when the duration becomes lower than 1639.
why didn't they just fix that instead of removing the ** thing entirely
that is odd
I wish they'd added potion durations of -1 to allow for infinite potion effects to resolve that, but meh
uhh changing to kotlin 17 removed all my kotlin shorthand
changing to getDeclaredField also didn't help :c
did you set it accessible first?
show full code
Where is numPlayers? Is this a server internal field? If so, they're reobfuscated at runtime
^
@EventHandler
public void onPing(final ServerListPingEvent ev) {
try {
final Field players = ev.getClass().getField("numPlayers");
players.setAccessible(true);
players.set(ev, 32958); // test value
} catch (final Exception e) {
e.printStackTrace();
}
}
uhh shouldn't be
definitely try again
yeah i'll do that
I don't think what you're trying to do is going to work though
afaik SLPE doesn't use that to adjust player count
there was a "ProxyPingEvent" at some point in time apparently
that had a #setNumPlayers
isn't this a replacement
what packet is used to send entities to player?
There's an add entities packet iirc
what i wanna achieve is to change the range entities are seen per player
i guess i can check the distance and cancel the packet?
unless theres non packet way
i recommend using PAPI for this if you can't figure anything out
ServerListPingEvent is one of those specially handled events, ZBLL. Internally, that event is extended before it gets called. So when you call ev.getClass() you're getting the internal child class that inherits that numPlayers field but doesn't actually contain it. You can get around this by doing ServerListPingEvent.class.getDeclaredField()
yeah it didn't seem to help, here's the full stack but it's mostly bs https://pastebin.com/t4EvHmC3
or was it PAPI, i keep forgetting my apis
the one that allowed you to intercept packets
i don't think it was lol
ohh
interesting, i'll try this now, thanks
but again, I don't think this change to that field is going to do what you think it will
massive brainfart lol
SLPE doesn't use it internally
i'll try and see, i also had my doubts but i'd rather be reassured by doing it
getField will not return private fields.
getDeclaredField will only return private fields if you are doing it on the class that actually declares it.
See this, Jan ^
yeah I was aware, i only did getField because i first got the error with getDeclaredField, so it was my first suspicion
I didn't read anything.
haha
i definitely recommend protocollib for what you're trying to do
btw who maintains https://wiki.vg/Protocol ?
It's community maintained but a good chunk of it is Pokechu
good to know, thx
A large contributor is Pokechu*, rather. I should clarify. He frequents protocol discussions
oh i see that spigot has entity-tracking-range so that would interest me, however i would want that to be per player
without nms ideally
Hi, i don't know why but if i open my inventory and put something inside and close it and open it again doesn't remove on hotbar and other place
@icy beacon
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin, new PacketType[] { PacketType.Status.Server.SERVER_INFO }) {
public void onPacketSending(PacketEvent event) {
WrappedServerPing ping = event.getPacket().getServerPings().read(0);
ping.setPlayersOnline(69420); // example amount
event.getPacket().getServerPings().write(0, ping);
}
});``` this might help
It's using protocollib
no problem
What is the "main class directory" in this context?
To avoid conflicts with other plugins with the same Main class directory, the general guideline is:
is it just src?
name it what your plugin is
but is the "main class directory" src?
maybe a bit more context?
it's not exactly clear
the correct location for the class is src/main/java/your/package/plugin
eg if i had a plugin i would use src/main/java/me/epic/mycoolplugin
oh then it's probably just a guide to package naming conventions
yes but what is a "Main class directory"?
this
perhaps the very top level folder where the main class resides
