#help-development
1 messages · Page 1109 of 1
You can make something like this.
1, Register KitApi as a service
public class KitPlugin extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
Server server = getServer();
KitApi api = new KitApiImpl(this);
ServicesManager services = server.getServicesManager();
services.register(KitApi.class, api , this, ServicePriority.Normal);
}
}
- Get the instance via service provider
public interface KitApi {
/**
* Checks if the KitApi API library has been initialized.
*
* @return true if the library has been initialized, false otherwise.
*/
static boolean isInitialized() {
return getServices().isProvidedFor(KitApi.class);
}
static KitApi api() {
if (!isInitialized()) {
throw new Exception("Api has not been initialized yet!");
}
return getServices().load(KitApi.class);
}
private static ServicesManager getServices() {
return Bukkit.getServer().getServicesManager();
}
@Override
public final void execute(ParsedElement parsedElement, Event event, ISyntaxParser syntaxParser) {
counter = 0;
do {
executeIteration(parsedElement, event, syntaxParser);
counter++;
} while (shouldContinueIterating(parsedElement));
counter = 0;
}```
for some reason, if i try broadcasting the counter in ``executeIteration``, it's always 0
even if it does like 10 iterations
sometimes it updates
fixed it, just had to use recursion instead of while
nvm it worked for a second and now it's not consistant at all
what this condition does shouldContinueIterating ?
?paste code
Sounds smart. Thank you!
oh wait, i'm making an infinite loop
how do i call super.execute of TurboSection in WhileSection
what is your input syntax, for this parser
?
I presume you are parsing some string value into objects
nice, making own programing language is fun project
yeah, it's prob one of the most fun projects i've worked on (not sarcasm)
what do javadocs mean by "naturally" in PlayerExpChangeEvent javadocs?
i kinda need to modify exp even if its given using /xp for example
or by giving it directly to Player
Don't think it's called for the xp command
what about giving it to the player object
No. It uses the same method that the /xp command does
(which doesn't call an event)
naturally, as the same suggests, counts only natural picked up xp
for example from a furnace, or a mob kill
advancements may not count, not sure
Yeah. It's called in each individual place that experience is earned, not in the Player's give experience method call
e.g. in EntityExperienceOrb#playerTouch() instead of EntityHuman#giveExperiencePoints()
Hello, I am creating my network on my pc and when I turn on one of the servers the auth server I get an error and the server closes immediately, if you want I can pass the error that I get. Thank you.
#help-server and tell what error 🗿
Ok
It's very big, it doesn't let me climb it.
whats big
idk some authme thing
imagine using offline mode 🗿
What?
Can someone help me with my problem??? Thank you. https://pastebin.com/ycbG0LKb
@everyone
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.
iam back to programming and thinking about finshing an old project .. but i think iam stuck xD
what is the best way to save cosmetic data for users?
uuid , cosmetic id , cosmetic type ,cosmetic enabled?
have a uuid(PK) and a cosmetic id(FK). the cosmetic is then saved in another table with cosmetic id(PK), cosmetic type (id) and enabled or not, even tho you could put the enabled into the first table as well
yes no. send code
PRIMARY_KEY uuid , cosmeti id , cosmetic type?
no
you will have 2 tables
one to map the cosmetic to a player (they got it) and one for the cosmetic itself
table 1: UUID, Cosmetic ID
table 2: CosmeticID, Cosmeticdata....
this would make sense if there is other things that you want to map to the player
i like to have my db in the 2 nf
but yeah you could throw it all in one that would be fine as well
otherwise 1 table is fine for this. Type can be an integer, not sure how you do types, but you can have an enum in your code that has the types mapped. And then I would probably also do cosmetic data as an integer as well, as you can just use that to extract binary values.
doing it this way, your db for this would actually be relatively small
i personally would have the type in a seperate table as well
but if he got static cosmetics that are same for each player why would he store the data of them seperate for each one and not just in 1 sperate table so he just has to know the cosmetic id
and then use the id as a fk in the cosmetic table
that is just too much data for something small
this
wouldn't reallly see the advantage of it
thats what a database is for
you will have less data the more you work with ids crossover tables
if this were the case you wouldn't need to store this in the DB to begin with
you can keep static stuff in code and out of the DB
the same as a constant in java. rather use a constant then to write „BIRD_WINGS“ everywhere
its a good practice in terms of database refactoring
right, but still wasting resources on something that doesn't need to be in the DB is my point
no
yes
I would like to see your tests then
Well thanks for the info ..
iam using integer for COSMETIC_ID , so in database it will be like this :
- uuid , 2 , kill_effect, 1
for example
that proves this true
2 is the cosmetic id or example
just google lol
and 1 is enabled , disabled
alright guess you don't want to show anything so I choose to believe you are not correct
dont have to redo tests which have already been made hundreds of times
this no longer about you bud... the war has bewtwen them two has begun
you do you
yep
anyways, static stuff should stay out of DB's when possible
useless to store such things when it can just stay in code where its already available
tests show not having such in DB's is more efficient, since you are not having to wait on a query to tell you something about a thing that never changes
lets say you can add new cosmetics using db then you still gonna say dont use 2 tables
you build your code on the data you have
neither one is easier or more difficult
yeah but if he publishes it he aint gonna add new one
not the other way around lol
thats what the user would do
bc prety sure the cassual guy that dont knows shit not gonna go through that hustle of compiling it again for new cosmetics
static data is just that, static it don't change. If multiple players can have the same cosmetic data, then this means the data is predefined already.
thats right, but dont state your personal preference as the way to go
its not a personal prefefence
just facts
if its not in the DB its faster
plain and simple
mysql is efficient, but its not more efficient then something not in the DB
sorry but we disagree here
but problem is, people love the lazy options so its fine 😉
and i doubt we will find a common denominator
I am pretty sure I can pull data out of an enum faster then any query you can run
so im out of this convo
Stinky coders 💨 👨💻
static data shouldn't be stored in a DB unless there is a good reason for it.
that isn't static data
or the static data I am referring to
Now that I think of it, Hypixel's ban reasons are probably static
They're always in the same format
thats the same it is 2 tables 1 saying uuid ban start and the reason wich links to the 2nd where time text etc is saved
thats basicly the same thing
I wonder how much storage they have saved doing that
stinky hardcoders*
oh no its hardcoded, like many things that still are today
its hardcoded because its not going to change or if it does its some years later but because its already defined its optimal and efficient then some dynamic set object
not everything needs to be dynamic you know otherwise we wouldn't have statics in java
or in many other languages for that matter
they wont store them in code
probably in a db or properties file or smth similar, but never ever in code
hard to say without knowing exact setup, but it would make sense to have ban reasons static if you just only have generic ones that can be used. But its not a matter of storage being saved rather you are not needing to query for it and no reason to dynamically set such things when it isn't needed.
I don't even get what the benfit of storing the types in a seperate table is, if they are configured locally. It only turns maintenance and migration into a headache
called normalization
With mssql you used to do that for enums because there didn't use to have an enum type
good for an efficient and consistent db
^^ search it up, i spent hours in db trainings
the only benefit I see is if you wanted to update the types without updating all the columns. As I said, no reason to store static data however there is times where you might need to. But in this scenario types would be better off being enums.
or rows I mean
Normalization isn't about storing ids or enums within seperate tables, less if they are connected with a seperate system
is there a way to have a method with the same name and params, just a different return type? or is this feature only in other languages?
That really is so easy to test
yeah im getting errors, but i was wondering if i did something wrong or if my cache is corrupted
i had some issues with the cache earlier
I don’t really get the benefits of using two tables nor of using a db for that specific case.
I would just store it in an yaml no?
what specific case?
The cosmetics issue
um seems you can have teh same method with a different return if you use generics
From this comment
okay
alright, thanks
@inner mulch look into overloading maybe ?
Im pretty sure it does hahah
But yes maybe it’s not what he wants sorry I didn’t really understand it well
oh i thought overloading was that param thing from c++
overloading is simply same name more params
yep
Im pretty sure it works for return types as well
using generics you can have multiple methods of the same name and args with different returns though.
alirght
Yeah I just googled and you’re right
My bad
The compiler doesn’t look at return types 😦
If it applies to your case maybe you can use a bogus argument just to differentiate from the two
And then not doing anything with it
or be a real man and do myMethod and myMethod0 and make myMethod0 private
you really shouldn't ever need to methods with the same name to have different return types
Why the players hp bar doesnt appear?
You have to set the DisplaySlot on the Objective
how does spigot work with modularity?
is there any difference between normal maven projects and spigot when it comes to that?
the most you’d get is in the spigot.yml afaik
otherwise YMMV when it comes to actual plugins
What should I call my class that loads, removes and creates entries in a database?
it never modifies
basically i need the class to create these entries because i need to get the autoincrement id from the db
is this a bad way of doing creating/getting even if the file exists?
FILE = new File(Core.getInstance().getDataFolder() + File.separator + getDir(), getName());```
doing what?
sorry i rephrased it lol
public class FileHandler {
private final String DIR, NAME;
private final File FILE;
private final FileConfiguration CONFIG;
public FileHandler(String dir, String name) {
this.DIR = dir;
this.NAME = name;
FILE = new File(Core.getInstance().getDataFolder() + File.separator + getDir(), getName());
CONFIG = YamlConfiguration.loadConfiguration(FILE);
}
public void saveFile() throws IOException {
getConfig().save(FILE);
}
public File getFile() {
return FILE;
}
public FileConfiguration getConfig() {
return CONFIG;
}
public String getDir() {
return DIR;
}
public @NotNull String getName() {
return NAME;
}
}
sqlite db, do i close connection and reopen each time or no?
Where do you get this error? Can we see the code?
it's quite a ton of code but
here you got
can someone help me how to fake green ping bar on Tab?
I need some hints on the code
Where do you get the error?
Hi rolyn
PlayerInfoUpdate packet, VarInt 0x10, measured in millisecond
https://wiki.vg/Protocol#Player_Info_Update
You can use a packet wrapper to edit the VarInt ping when the packet is sent
Hey! long time no see
I'm in Korea these days so yeah i guess so lmao
good and u? got any progress on your self formation?
Shit is it the 23rd or 24th there?
That one project has been done for a while haha
Oh wat I thought Korea would be like 20 some hours ahead of us
where are you?
Wow you're getting in really big projects 😮
not much, you know I'm doing research so I'm just trying to figure out how to have some new ideas ahah
Always the hardest part isn’t it lol
problem is the domain I work on is on trend so any idea I have got released within a week or two by big companies.. just so hard to keep up with this
Yeah technically my first large project, I made an attempt at a seasons project a while back but eh that got scrapped and then I passed the idea on to purple which he actually brought to life haha
And how is it going so far? Did you create the architecture of the thing?
I think purple really only used my ideas for the season mechanics and some visual effect stuff, otherwise I got to the mechanic implementation stage
It was semi functional at the time with the effects (visual and mechanical) but then idk I got bored and moved on
But yeah now the hybrid core is where most of my time is going other than a couple smaller projects for work stuff
that's great. hardest thing is to keep doing what you plan to do ahah
Hello everyone, good day! I just want to ask how to fix the effects in my sword? It only shows paper instead of the effects of the texture pack but the only thing that is showing is the particles, I suspect its the texture pack issue, so I need help 🥲
Well purple also helped with the architecture of the hybrid core, well he gave me a simplified thing for the dependency tree since this is quite a large project (multi module stuff ya know)
Still in the process of refactoring all the stuff / abstractions / interfacing etc
I think I’m about 4k lines deep now? Messed up a bit, ironically I write down plans for impl on work projects but not for the free time ones, so ended up implementing like skyblock mechanics first
Also a big fat thing I’m not looking forward to is implementing event driven stuff, similar to how towny handles their stuff
We'll need more details here
Wow that sounds really nice. Indeed it's quite a lot and maybe you'll remake multiple times this if at some point you are not satisfied with the architecture itself
But keep it going it's really nice!
can I dm you? I cant seem to send screenshots here and im new to making server, ill provide screenshots
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
I verified, thanks
The biggest goal of this plugin is to stay original (mainly just trying to not copy hypixel) and also stray away from the most common feature of skyblock: afk economy, I really hate how every sb core is strictly afk eco and I want to see it changed so hopefully I can achieve this whilst still making it fun to play
I cant make this to work, it only shows the paper instead of the effects when I swing my sword
Well in the sense of afk eco, the playability is actually what I’m going for, rather than a contest of who can go longer without touching grass lol
(Sorry to cut you off bolja)
but it did show some particles, I do suspect its the texture pack issue, but I cant seem to solve it on my own
its okay bro
do you know how to fix this by any chance?
game design X game development. Brilliant for your creativity
Unfortunately not, texture packs and modeling are subjects I still have to learn
Well I sure hope so haha, will have to see later on when there’s actually things in a playable state
We usually don't help with this here and I'm not familiar with it neither...
but don't you need to give the paper some model data?
I mean how do you spawn the paper ?
Anyways I’ve had a long ass day today nearly 27 hours now kek so I’m gonna go sleep, good catching up and we’ll probably see each other later
Cya rolyn!
when I do left clicks and triggering some skills
cya next time !
Show the code you are using! We can help with that!
Do you want me to screen record?
I can screenshare
?paste
Just paste your code here
MMmh
This is not related to this channel
You might ask another discord server, or maybe in #help-server if you get lucky
Hey, I was wondering if anyone used multiversecore api for their plugins and if so how did you do the world generation. I cant figure out how get the world type class, because importing org.bukkit.WorldType isnt found. For reference I am using spigot 1.21 via maven. I can send over my pom if its helps
Nvm it’s an editor issue
I have a List<Warp>.
If a warp exists (has same property values) I want to replace its values instead of adding a new one to the list. (or remove the old and add a new ig. i just wanna replace it bc there are not supposed to be multiple warps in said list)
How would I do that?
oh wait i should use a map, huh?
fck
You should definitely use a map
alright, tbh not that much to change so it's fine
oh right put also just replaces, well, that makes sense. (cries in too stupid to know basic java apparently)
Woah Nature, in a dev channel? woah
yeah it's his wallpaper i think
his ide is transparent
rad is really everywhere
i used to have my terminal transparent but then people could see the stuff underneath
😳
Speaking of nature went kayaking today
woah
Crazy I know
I usually don’t leave my house
canoeing >>> kayaking
ngl
kayaking kinda sucks
It’s literally the same activity with the exception of different boat/paddle
You’re both goofy
nerds, its just a silly boat
why not with your gf
Well it’s a bit harder to white water a canoe too
it's a bit harder to what
White water / rapids / fast moving water / fast current water / uh
Another description
then go to a calm river
That’s no fun
It’s more fun when my ass is clenched the whole time because I’m scared to flip myself trying to get through some rapids
eh
i used to canoe in some polish river for like two weeks and do camping
when i was young
Well it depends on the vibe you’re going for
I grew up at a lake in Colorado literally right next to a part of the Colorado river, which we’d go down every once in a while
Rafting, canoes, kayaks, etc all the time were going by
that sounds nice
Well the lake also flooded every year after winter
if i define a permission in the plugin.yml the server will automatically check for this permission regardless of my own checks, correct?
😳
Excessive rains have caused the Cache La Poudre river to flood into the Laku Landing ski lakes.
Every year
ohh damn
Oh bruh this is help dev
i'm glad there's barely any floodings here
Well it was literally because of how close the Colorado river is
No joke you could walk to it in 3 minutes from either dock
i live next to a lake but it's not as cool
Is it man made?
no
Ah laku was
oh well two lakes actually, one of them is
Technically two lakes at laku as well both are
I remember helping with buoy replacements, used to be able to hold my breath for like 1 1/2 - 2 minutes (keep in mind that’s like with moving around too)
Now my lungs probably suck because of all the nicotine and weed
Fun fact when I was 11 I was sponsored by syndicate skis
set("LVL1",plyBottomBlock.getLocation());
System.out.println(config.getLocation("LVL1"));
System.out.println(plyBottomBlock.getLocation());
System.out.println((config.getLocation("LVL1") == plyBottomBlock.getLocation()));
break;``` Output: ```[17:30:52 INFO]: Location{world=CraftWorld{name=world},x=39.0,y=71.0,z=48.0,pitch=0.0,yaw=0.0}
[17:30:52 INFO]: Location{world=CraftWorld{name=world},x=39.0,y=71.0,z=48.0,pitch=0.0,yaw=0.0}
[17:30:52 INFO]: false
``` Does anyone have idea why one exact thing doesn't match another exact value? Is it a data type issue or somthing?
any help with this would be really appreciated ^^^^
== compares references
equals() compares values
use equals()
@slate rose
*ALWAYS use equals when comparing objects.
Only use == when comparing to null or when comparing primitives
I'd explain what == means compared to .equals but its bed time and I am lazy
i'm on it rn
❤️
but tbh i'm not sure if i get it right exactly lol but i'll try to explain it with an example
❤️ 💚 💙
Just think of it like == is a memory comparison whereas .equals is more so a contents comparison
@hybrid turret Thanks heaps, that's makes alot of sense
So == is used to compare whether two objects are the same in memory where .equals means you're comparing the literal value I'd say is a solid way to think about it
Object object1 = new Object("I am a value", 1, 0.0, true);
Object object2 = new Object("I am a value", 1, 0.0, true);
Object object3 = object1;
log(object1 == object2); // this will return false
log(object1 == object3); // this will return true
log(object1.equals(object2); // this will return true
log(object2.equasl(object3); // this will return true
phew look at that, not too lazy after all
iirc
when trying to join my own test server im given the error There is no profile service available and immediately disconnected from the server. help please
object1 and object3 have the same reference so it == will return true (iirc)
otherwise the comparisions will return false if equals is not used since equals compares the values inside the objects
this sounds like #help-server ? never seen that
i mean since it's your "test server" i suppose you developed some sort of plugin?
@hybrid turret don't feel like you need to break it down the objects to String.valueof and compared them even then the values wouldn't == each other but aren't they references at that point?
i don't think i understand what you want to say, sorry
For example String.valueOf(playerLocation) == String.valueOf(new Location(world,0,0,0))
shouldn't this technically work
you do join with a bought minecraft account, no? not an offline account
no. since String is also an Object in java and not a primitive this will have different references
lmfao why would I use a cracked account 😂
Alright that make sense. I'm coming to java from other lanagues and trying to orient myself
first thing that popped up in the spigot forum
what does valueOf even return
oh
yeah ofc
it returns a string
every string is created on the heap so they wont be equal in reference
(or atleast you should not rely on that)
so always use .equals
yeah lol first time i've seen no one else experience this error
Example:
String#valueOf(int)
public static String valueOf(int i) {
return Integer.toString(i);
}
Integer#toString(int)
public static String toString(int i) {
int size = stringSize(i);
byte[] buf;
if (String.COMPACT_STRINGS) {
buf = new byte[size];
getChars(i, size, buf);
return new String(buf, (byte)0);
} else {
buf = new byte[size * 2];
StringUTF16.getChars(i, size, buf);
return new String(buf, (byte)1);
}
}
which launcher are you using?
yeah weirdly enough i cant find anything that exactly matches your description. do you have a screenshot?
minecraft launcher, badlion, feather, lunar
huh
wdym
what server version
did you try the latest with build tools?
yes lol
yeah i would say setup the server again from scratch
did that multiple times
at this point im going to use aternos or something
did you try relogging into the launcher?
yes
can you log on to different servers?
yes
it could be possible that the auth servers are down for their region
this is some real weird shit what the heck
But the error doesn't really suggest this is the issue
It's still possible
some bs bruh
fr
ig you tried, rebooting your pc, reinstalling the server from scratch, relogging into the account and you do not have the server in a onedrive or similar cloud folder (because this is funky)
I don't really think the issue is the auth servers, it would have given you that error instead so uh
yup
ive tried everything i can think of
spigot
damn i'm actually out at this point, tf
ig ask in the #help-server channel again, maybe you find better luck there :/
oof
Is it possible that this is a firewall thing
already checked that
I mean there could still be some funky thing prohibiting server's access to something
file permissions? maybe
Eh the error doesn't support that
But then again
that error isn't really helpful anyway
what does that mean?
is the regular server in the same parent folder as the spigot server?
As in the error indicates that it just doesn't exist (.) so
i mean
I don't think it'd be file perms
yes
im running paper instead of spigot rn
sometimes ppl use the same message for not having access and not existing
see if it works
mojank kekw
well great
Sorta kinda
with modules n shit
Still refactoring shit
i dont think im going to use spigot
aight u gotta explain shit to me now
how do modules work with spigot
is it the same as usual maven multi module projects?
Yeah
nope
where are the dependencies defined?
paper server doesnt work either
Well usually you'll have your dependency tree and just design it depending
i just have 2 modules, core and api
I've got base api which has no depends right
Then we go to common and the apis for skyblock / rpg which are relying on base api
thanks for trying lol, ill go cry in a corner while i learn SAT collision
Then down to actual implementation modules which rely on the skyblock / rpg apis
So then api should just hold all your abstractions / interfaces, core should have your actual implementations
so I'd set it up the same as any maven project right
I'd say so yeah depends a bit on the use case
well per module but seeing as most multi modules are built for each other obv it's pretty similar
As in you just build off one another
alr ty ill see
Yeah sure!
Purple is very knowledgeable on this if he's ever around
He's actually the one who gave me this kek
how would i implement continuation here?
this is my current attempt: https://paste.md-5.net/iqurewoqig.java
it works but sometimes afew code elements pass through and execute (that are after a continue element)
Helllo , sorry yestday i was sleppy so couldn't provide a code example of wwhat iam trying to do ..
this is for saving
Sorry :p
omg wait
this is mysql, right?
does something like "ON DUPLICATE KEY" exist for sqlite?
idk try ..
oh apparently there is ON CONFLICT, interesting
this might make requests a lot faster bc i don't have to check then first seperately damn
This can be made by interpreting While loop inner block of code every iteration. Then you can check the output result of the block (EmptyStatement, ReturnStatement, ContinueStatement)
For more content This is how I've implemented While
https://github.com/jwdeveloper/SimpleLanguage/blob/master/SL.Interpreter%2FInterpreters%2FStatements%2FBlocks%2FWhileBlockInterpeter.cs
wait you can detect infinite loops?
for simple stuff sure
Don't think you can "detect" them
That would require solving the halting problem which is impossible
maximum iteration of 1000 would also solve the halting problem
you can approximate by just stopping after some number of iterations
also are you just making the while block an interpreter itself
Yes since it is
in my case, sections aren't that powerful
i'm just gonna make sections interpret their own code with a helper method
The While condition and body can dynamically change during program rub
just like you're doing, not sure if u have a helper method tho
In my case Helper method is InterpreterFactory
ah
Like here I parsing while node body, and checking what is the result of the parsing
is there any occation where a HumanEntity cannot be safely casted to Player?
Not yet
okay so i should still do an instanceof check?
Yeah, that wouldn't hurt
both fair enough tbh
can't imagine that it could be anything else...
At least regarding InventoryClickEvent#getWhoClicked, lol
Wait till they add Herobrine
monkaW
I want to convert the size of a List to a paginable inventory.
my problem is: how do i set the inventory size by the amount of elements in the list?
my general idea is to shorten down the list so i have 36 elements so i can add an empty line and the pagination buttons but how would i set the correct point from where i want to start reading the list again for the next pagination and stiff?
(example for a list would be Bukkit#getOnlinePlayers)
it's kinda hard to explain i hope yall get what i mean, lol
How do you handle your menus ? Do you use a lib?
you have q certain amount of items per page
and then each first item on each page has a certain index
?gui
interfaces(-kotlin) 
first off: how would i get from let's say 683 players to a number that's < 36?
Just divide with a for loop and then add 1 to a counter each loop so i know how many pages are left or something?
rad no. nobody actually likes kotlin >:(
then why did the noxcrew make it for kotlin specifically 
kotlin can suck my pp
😳

meow

me no nitro :(
L
ay dont L me. I'm 20 in training and moved out. so essentially... i'm poor now
first determine the amount of pages. then u can loop through the pages and for each page easily determine where to start reading e.g |
int lowerBound = pageSize * i;
int upperBound = lowerBound + pageSize;
for (int index = lowerBound; index < upperBound; index++) {
// populate page list.
}
is i the current page?
yes
My handler menu is inspired by this, but I've added a "pagnited menu" I calculate the maximum number of items per page and I have a variable that serves as an index to know my page, for example if Im in page 3 and slot 4 I know that my item correspond to the 3xmaxitem + 4 ellement in the list
okay i see. i guess i have something somewhat similar but yeah that makes a lot more sense.
So I just have another List which is filled with the conditions you stated, Shuriken?
https://pastes.dev/IzaV3OXnd9 not sure if this legacy class of mine could help you, but this is for paginated 7x3 guis
oh that's an interesting approach. I also added PaginatedGUI to this as abstract class so yeah i guess something like that is my plan
not entirely sure what u mean by that
but i write the results to a Map<Integer, List<T>>
and render the gui with that
My pagnitedgui extend gui and its abstract yes I don't have access to my code now, but I could send it to you tomorrow
pretty much. but u might wanna go for a LinkedList then
that would be very delightful tbh
i'm ngl i never really thought about the other implementations/options of lists/maps apart from HashMap and ArrayList lol
i never really understood what each of those did
LinkedList just makes sure your entries stay in a logical order
yeah that's what I always thought
The author of java's LinkedList questions its own existence as well
Does anyone actually use LinkedList? I wrote it, and I never use it.
Does client know tick concept ? Or it just execute packets when received?
huh. i guess you're right. ive always thought LinkedList was used for ordering
but thats not right at all
what is not ordered is a Set for example
I'm sure it does, why do you ask ?
its got to do with Execution speed tradeoffs
the client has its own tick loop yes
I know that spigot or nms "throttles" move packets in particular, can you tell me more? The most logical thing would be for move packets to be stored and every 50 ms (1 tick) reduced in a single movement?
so I have a core and api module, I implement a singleton in the core, but I want the api user to have access to the implemented singleton by an interface, how would I do that without having both modules depend on each other?
so basically I have a HomeManager interface in my api module, and a BasicHomeManager as an implementation in my core module
how would I pass the BasicHomeManager as a HomeManager to the api's user
you can create a default or static method in the Interface
yes but what would the contents be?
yes
and that's alright?
well it doesn't sound right. Seems you'd have a circular dependency
so how do people usually connect their implementations with their interfaces?
between modules
a module is the implementation which exposes an API
it should not depend on a higher level
so then how do you pass instances?
you pass an instance to the module in the method
the module shoudl not be passing an instance betweel clients
If your Manager is to be accessed behind the API then it should be behind the API not above it
but then how do i give the api user access to data
Whatever your API is covering has to be behind it, so all depencies behind it
you can;t have an API depending on a dependency which depends on the API
then how do people usually give the api's user access to certain data
e.g how does spigot allow us control over things
when we can't access nms
it all goes behind the API
how?
Am I not explaining it well?
the api gives you methods to retrieve data etc, you can do something with it, the api interacts with the program whcih you access through the api, allowing you to do stuff even tho you don't have access to the program itself. The API basically acts as a middleman between the user and the program
I don't understand how I'd do what you're saying in practice
yes but since you can't depend on the core
then how'd you do anything
you redesign your project so your core is behind your API
how would I do that? is there some sort of example I can look at?
many ressources i found when searching on google
I searched as well, just couldn't find any
can I see what you found?
i found something a while ago, ill check but i dont know if i can find it
nope sorry, couldnt find it
There is one good usecase. You can remove items from LinkedList while iterating over it
you can also do that on an arraylist
if you do it properly, but also, linkedlist doesn't support that if you don't do it properly either
You are right
And how can i make the life to go only until 10 and not 20
is Metadata resets after restart?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
i replace the fish caught with fishing event however the velocity doesnt apply as with the old item (how vanilla) does it
what do i do to reproduce vanilla velocity for this?
only Blocks with a TileEntity can have a PDC
I have an API you can look at, but its not at all generic andd its tailored specifically to my use case, but feel free to use it
https://github.com/PineappleDevelopmentGroup/Pineapple/tree/restructure/pineapple-tiles
BlockPDC is your best bet tbhh
as I understand it, blockPDC data is stored in chunks? isn't this a crutch?
yes because Blocks have no PDC
the only way to store data in blocks that are unable to store data is to not store the data in blocks that are unable to store data, but store the data in something that is able to store data
good explanation. 😄
is there a regex to match arithmetic operations without explicity matching numbers
this should match: lol + idk + (lmao * (lmao ^ 2))
nvm
Yeah I mean any way you do it is a "crutch"
I mean if you for some reason hate storing it in chunk PDC you'll need to either
A) Make your own region files and read and write to NBT files like minecraft does
B) Use a Database and implement a smart loading and saving system for blocks that doesn't slow chunk loading by an extreme amount
So basically, you mean the paramount methodology for data retention within non-retentive cuboids is to eschew the futile endeavor of imbuing said cuboids with informational content, and instead, pivot towards the utilization of an amorphous, data-absorbent medium that possesses an intrinsic proclivity for informational osmosis. This paradigm shift necessitates a cognitive recalibration vis-à-vis our conception of data storage, transcending the rigid confines of block-centric thinking and embracing a more fluid, quantum-superposition-esque approach where data simultaneously exists and doesn't exist until observed by a compatible storage entity. It's akin to Schrödinger's data, if you will, existing in a probabilistic limbo until it collapses into a deterministic state within a receptive vessel, thus resolving the paradox of storing the un-storable through a metaphysical sleight of hand.
EXACTLY
this guy gets it
Or like you mean when you're tryna shove data into blocks that are straight up not having it, you gotta pivot and find something that's actually down to clown with your bits and bytes. It's all about matching your info with a storage solution that's on the same wavelength, you know? No point in trying to teach a rock to swim when you've got perfectly good boats available. Just use your noggin, pick a data home that's actually built for the job, and boom - problem solved without breaking a sweat or bending the laws of physics.
what
from just skipping over that text isnt english but when you read it is pls help my brain

Or you could say it's like trying to cram your entire Minecraft inventory into a chest that doesn't exist. Instead of banging your head against an invisible wall, just craft a real chest and toss your stuff in there. It's about finding the right data structure that can actually handle your information. No point in trying to store player stats in thin air when you've got perfectly good databases and config files at your disposal. It's just about using the tools the game (or in this case, the server) actually gives you, rather than trying to invent some wild new storage method out of thin air.
Hello, I am new to programming plugin and I want to know how to retrieve the update verification link for my plugin?
what do you mean by update verification link
when using the 7's data handling guide with PlayerData, loaded on Join and unloaded onQuit, i suppose /reload should not be used anymore because the PlayerData will not be loaded anymore, right?
(or kick everyone onDisable i guess)
why
im not familiar with that method
but if its just listening to player join and leave events
reloading wouldnt make a difference?
reload 💀
basically all important - neededtobecached - data is stored in PlayerData which can be retrieved using the player's uuid
this is loaded with the AsyncPlayerPreLoginEvent
and unloaded with the PlayerQuitEvent
and since reload does not kick players (and therefore won't load the data again when they join) playerDataManager.get(player.getUniqueId()) will be null
or you can just load the data for all online players in onEnable, but also just don't reload, it's hideous and dreadful
kicking all onDisable does work
except for this, i never had problems with reload tbh.
and no, loading all data onEnable defeats the purpose
i don't need the data of a player loaded who is offline
I have my ServerData for that
oh right
Online prayers
i can't read lol
My cat cant read too
you need to load all online players on startup, as you dont want to desync them anyways
not reloading, huh?
it's so annoying tho to restart the server every time xd
I mean this would probably only be an issue with reloading
i mean that would never happen as long there are no players online while the plugin is being reloaded/reenabled
yes
and well
kicking everyone onDisable
fixes that
lol
Lol
thats 1 second away from restarting the server
and breaks other plugins' expectations that players are online during disabling
n o
restarting takes so much longer
in which case would that matter?
i kick players on my stop command since the PlayerQuitEvent is not called when the server is stopped
in cases where plugins expect online players to be online during onDisable
why would plugins do that?
to save their player data maybe?
because that has been the behaviour for over a decade
i'm an a lot plugin lol
biggest thing is that it handles all data with DB and the ...Data thing... so, caching
no i mean a concrete example, lol
¯_(ツ)_/¯
i know people here and in other discord servers have asked about that and for whatever they do, they end up relying on that
but unfortunately i don't know every plugin to have ever existed that does that
uhm
i just thought about something
which would be
very
uhm
wonky
what if i call the PlayerQuitEvent onDisable? lmao
saving player data in onDisable for online players as well?
just call the same method, creating and calling server events is not supported api
oh
kicking players would call quitevent though right
or was that the goal with kicking the players
yes
okay
because the data is loaded with prejoin and unloaded with quit
then why not act like you kicked all players in your ondisable
so essentially
Bukkit.getOnlinePlayers().forEach(player -> this.plugin.getPlayerDataManager().unloadData(player.getUniqueId()));
i guess
Yies
epic
frfr
Anyone know why when I try to package my Project I throws
cannot access com.sk89q.worldedit.bukkit.BukkitAdapter
pom: https://paste.md-5.net/vuserocalu.xml
idk why I made this but it looks fancy (it creates a text representation of any class)
Hello I am working on updating a plugin for 1.21.1 rather than 1.20
I have found why it breaks, this should have the following
Bukkit.getServer().getClass().getPackage().getName() -> org.bukkit.craftbukkit.v1_17_R1
Although it seems the newer versions dont give the v<version> part.
Anyone got any ideas what this has been replaced with? I might be completely wrong
https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/
relevant part is roughly at the middle
Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...
Thank you 🙂
Hello! I am looking to create a method on a listener for the PlayerMoveEvent that checks if the player hit the "W,A,S, or D" keys by comparing the direction the player moves to the direction the player is looking. I found this code but I don't know what "friction" or "MathPlus" are. Does anyone have any ideas?
//"e" is an instance of some move event.
double dX = e.getTo().getX() - e.getFrom().getX();
double dZ = e.getTo().getZ() - e.getFrom().getZ();
dX /= friction; //get block 1 below the player. friction = (onGround ? nmsblock.frictionFactor * 0.98 : 1 * 0.98)
dZ /= friction;
dX -= p.getVelocity().getX(); //Player#getVelocity() is broken. Make your own Player class.
dZ -= p.getVelocity().getZ();
Vector accelDir = new Vector(dX, 0, dZ); //horizontal acceleration direction
Vector yaw = MathPlus.getDirection(e.getTo().getYaw(), 0);
boolean vectorDir = accelDir.clone().crossProduct(yaw).dot(new Vector(0, 1, 0)) >= 0;
//This dot step is necessary since Bukkit's angle implementation is broken. Sometimes it will
//return NaN due to floating point precision error.
double dot = Math.min(Math.max(accelDir.dot(yaw) / (accelDir.length() * yaw.length()), -1), 1);
double angle = (vectorDir ? 1 : -1) * Math.acos(dot);
//Now you want to check if angle is a multiple of (Math.PI / 4)
//0.0 = W
//pi/4 = WD
//pi/2 = D
//3pi/4 = SD
//pi = S
//-pi = S
//-pi/4 = WA
//-pi/2 = A
//-3pi/4 = SA
It will lock the player in place and use their movements for direct control with movecraft
Is there a better way to do it?
Making the player ride something would probably work better
not sure what movecraft is though
you can still capture the inputs that way ^^
I did see that but it is not ideal
how so?
Ideally the player could just do it from anywhere with a command
and how is it more ideal to not have the player ride anything
You can just spawn something for the client to ride
Is it only boats, minecarts, horses, and pigs, or would an armor stand work?
I believe armor stands work
Long shot, but doesnt anybody understand what on earth this is
V1_20(20, null, "b", "e", "c", "d", 89, 38, null, null, "B", "a", "g") {
@Override
public String getWatcherFlags() {
return versionMinor < 2 ? "an" : "ao";
}
@Override
public String getGuardianTypeName() {
return versionMinor < 3 ? "V" : "W";
}
@Override
public String getSquidTypeName() {
return versionMinor < 3 ? V" : "W";
}
What do these random valyes like "an" : "ao", V" : "W", V" : "W" correspond to? I am brand new to this and it just looks like jibberish
I haven't done it myself before
Compare different mappings with this website: https://mappings.cephx.dev
Do I have to mess around with packets or NMS to do this?
jesus
another cute one
I basically just want a lazer beam on 1.21.1 and GuardianBeam seemed good.
I fixed the versioning issue but now stuck on that lovely bit 😂
Spot on, thank you.
yes
PacketEvents or ProtocolLib would probably be the easiest way to
laser beams go brr
prety sure that you send that before
I only remember the weird ass slide one
Huh what are those lasers, display entities?
yes
Why is maven such a bitch
https://paste.md-5.net/isarebevam.xml why is it saying cannot access com.sk89q.worldedit.bukkit.BukkitAdapter
now calculate intersections and make them deal damage
lags go brrr
not that hard
idk never used display entities, probably a simple aabb operation
looks like the last api version i used was 1.16
Hello , how i can get Morphia to work on 1.8 java?
I cant seem to match up the obsfication with the code
https://mappings.dev/1.20.1/net/minecraft/world/entity/animal/Squid.html
@Override
public String getSquidTypeName() {
return versionMinor < 3 ? "aT" : "aU";
}
Am I being silly?
Ignore me, found it here https://mappings.dev/1.20.1/net/minecraft/world/entity/EntityType.html
this stupid fucking skin changer thing
it just won't work ffs
public static void applySkin(ServerCore plugin, Player player, String skinURL) {
ServerPlayer nmsPlayer = getNmsPlayer(player);
broadcastPacket(new ClientboundPlayerInfoRemovePacket(List.of(nmsPlayer.getUUID())));
PlayerProfile playerProfile = player.getPlayerProfile();
PlayerTextures textures = playerProfile.getTextures();
try {
textures.setSkin(new URL("https://textures.minecraft.net/texture/" + skinURL));
// (playerProfile.setTextures(textures);) doesn't work with and without
} catch (MalformedURLException e) {
plugin.getLogger().log(Level.SEVERE, "Could not set skin", e);
}
broadcastPacket(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, nmsPlayer));
ServerLevel nmsWorld = nmsPlayer.getLevel();
ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(
nmsWorld.dimensionTypeId(),
nmsWorld.dimension(),
BiomeManager.obfuscateSeed(nmsWorld.getSeed()),
nmsPlayer.gameMode.getGameModeForPlayer(),
nmsPlayer.gameMode.getPreviousGameModeForPlayer(),
nmsWorld.isDebug(),
nmsWorld.isFlat(),
ClientboundRespawnPacket.KEEP_ALL_DATA,
Optional.empty()
);
sendPacket(player, respawnPacket);
player.updateInventory(); // Update the player's inventory because it will be empty after the respawn
Bukkit
.getOnlinePlayers()
.forEach(onlinePlayer -> {
onlinePlayer.hidePlayer(plugin, player);
onlinePlayer.showPlayer(plugin, player);
});
}
that's my current code and i don't fucking get it anymore ._.
Can I get a SkinURL by player name?
after the 1.20.6 api changes are 1.20.6 plugins compatible with previous versions or it breaks it straight up?
check the release, MD-5 usually says if it does
plugins are generally not backwards compatible
yeah you can play with older plugins on newer servers usually
but it also depends on the plugin
I fix one problem and then get to another roadblock!
Any ideas anyone
[19:38:24 WARN]: java.lang.NoSuchMethodException: net.minecraft.network.syncher.SynchedEntityData.<init>(net.minecraft.world.entity.Entity)
looks like you didn't reobfuscate
^^
?nms
Use the remapping plugin or use paperweight
for (int i = 0; i < 3; i++) {
c1.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
c2.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
c3.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
c4.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
}
``` why tf does that code result in this
like with that 1 block gap
check the floating point precision
// Define the corners of the region (16 blocks in each direction)
BlockVector3 min = BlockVector3.at(loc.getBlockX() - size, -64, loc.getBlockZ() - size);
BlockVector3 max = BlockVector3.at(loc.getBlockX() + size, 320, loc.getBlockZ() + size);
Location c1 = player.getWorld().getHighestBlockAt(min.getX(), min.getZ()).getLocation().add(0, 1,0);
Location c2 = player.getWorld().getHighestBlockAt(min.getX(), max.getZ()).getLocation().add(0, 1,0);
Location c3 = player.getWorld().getHighestBlockAt(max.getX(), min.getZ()).getLocation().add(0, 1,0);
Location c4 = player.getWorld().getHighestBlockAt(max.getX(), max.getZ()).getLocation().add(0, 1,0);
if(!c1.getChunk().isLoaded())
c1.getChunk().load();
if(!c2.getChunk().isLoaded())
c2.getChunk().load();
if(!c3.getChunk().isLoaded())
c3.getChunk().load();
if(!c4.getChunk().isLoaded())
c4.getChunk().load();
for (int i = 0; i < 3; i++) {
c1.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
c2.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
c3.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
c4.add(0, i, 0).getBlock().setType(Material.GLOWSTONE);
}
``` thats my code and min.getX() is an int so there should be none shoud it?
the location is mutable
Is there a way to use System.setIn() but for the console?
Could be fun to rewrite the console :)
I added Paperweight and still have the exact same error, is it related to "1.20.5 and beyond" https://docs.papermc.io/paper/dev/userdev
We don't really have enough information to help you. Judging by the obfuscated code above it appears to be doing some reflection
If you wanted to add support for a new version you need to ensure that you gave it the obfuscated values and not the mojang mapped ones
Reflection requires a reflection-remapper fir 1.20.5 onward.
This is fun 😶 I shall wait for developers to update themseleves in future, out of my depth. Thanks for the help anyway.
hello, can anyone help me with this issue? java.lang.NoClassDefFoundError: net/dv8tion/jda/api/hooks/ListenerAdapter
You have to shade jda
how
Or use library feature
^^
Lol
?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/
^^ you can hire someone to fix the plugin for you
depends on the developer
but it is hard to do my issue?
afaik no
I have a free tool that can technically probably fix it for u
That error no
winrar is a thing
but if that error is happening something else is most likely also wrong
um
you paying for it?
no
gotta be asked
i took the source from github and put it in eclipse ide
such as you trying to run on an older version than supported
or that...
the server load the plugin but it says that error
you compiled it wrong
i know someone that pays for sublime but not for winrar
can you help me?
mans not shadowJaring it
What plugin are you compiling
what's the github repo
Download jda. Jar from github
The git name :kekw:
creditos para todos
lemme guess
jda 4.3 my love
And open a zip editor
Oof
What a readme
Lmao
and what does your target folder look like
discord jda?
from eclipse?
sure
They're most likely using artifacts/eclipse equivalent
and not maven
to compile it
I see a pom.xml
Yeah user error
But they're not using it
it doesn't let me to send photos
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
commit kill bot 
Usage: !verify <forums username>
!verify Dakarem
A private message has been sent to your SpigotMC.org account for verification!
I like the last commiter name
If it works it works 
What even is a map
this show eclipse ide
How are you building?
Idk even how they come up with those specific magic values lol
import projects from git with smart import
Right
i clone url
But how do you build the jar file
export jar file
Nope
thats what my grandpa said when he used ducktape to hold his gun together, right before he shot himself in the foot
You need to build with maven
but how i build it
good
i can download it
first one to find it gets a cookie
yes
around here maybe
Click the dropdown
which
Run
as maven build?
Where are eclipse boomers rn
Yes
me when I can run mvn clean install on the console and fuck off
i can download intellij if its easier for you
Then run
where is goals
oh i see
you did it?
yeah I just cloned and mvn clean package
if you were to hire someone, hire them to properly build the plugin instead of inserting jda somewhere
Isn't jda 4.0 outdated tho?
so is 1.17
updating jda and making sure all of the legacy API is properly ported over takes more effort than just running a command and waiting 17 seconds
i would but i cant pay money or smth like that
i can pay a minecraft premium account lol
don't have like 5$ on paypal or something?
i dont
blame the dev
oh
i think it is because i dont have world edit
ERROR: java.lang.NoClassDefFoundError: com/sk89q/worldedit/WorldEditException
this dev really did a great job, but itsnt that supposed to be provided as plugin?
it was a plugin of a hardcore server
and the owner make the source public


