#help-development
1 messages Β· Page 201 of 1
For the same reason you should use getters and setters. It keeps things clean, structured, protects the internals of the code and helps with future compatibility
Also having a static plugin instance isn't ideal either
use di
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
You write code defensively to protect you from yourself
why is you write code defensively to protect you from yourself
Wat
if i do the thing
.
Utility classes are special
so not in utility classes
They do not preserve or encourage abstraction
what is your called ab straction
@ivory sleet be safe. @mighty pier made this code to:
They're very harmfull
Well certainly not the best choice of design
Anyway
Utility classes are always stateless and (hopefully pure) thus no instances should be derived from those classes
Embed fail x)
Xd
Fail x2
epic embed fail e
Another and deleted xD
dude forgot how to paste
nah that's not it
#general
when i build my projekt with gradle, where does the .jar come out?
build/libs
but there is no build directory
Sounds like you didn't build it?
i did
i wanted to decompile plotsquared 6.3.0
You mean compile
yes sry
If you aren't a developer you should buy the plugin
Do I need to do anything special to make EssentialsX economy work with Vault
No
for the life of me, it will not link to my plugin
Make sure you're soft depending or depending on Vault
all of it?
The more the better
how should i put this into code? My knowledge of java's math stuff isn't great
i can't find most stuff in java's Math package
well
what is this even for xD
don't ask lmfao
too late, i did
oh my god
Math.cos Math.tan Math.sqrt etc
yeah
Math#sqrt() <--- Square Root
Math#tan() <--- Tangent
Math#cos() <--- Cosine
Math#pow() <--- Used for exponents
but is there a certain way i should parenthesis it
well do it part by part
you'll just place parentheses while doing it
i mean you should know order of operations for this
and like secant is just 1/cos
bidmas moment
iirc
yeah the trigonometric functions can be expressed with sin and cos i reckon
yeah it's just i'm wondering what java interprets this kind of order as
2 * 3 / 4
simplified obviously
left to right is standard
Order of operation takes priority though.
Is this for the Russian army?
Hello I want to remove 3 line from a lore, but it doesn't work I can add line but I can't remove line, I have 0 error and when i broadcast my lore the lore is removed but the item keep the line.
can't answer that π
what
java coding for military
do you hear yourself
xD
should soon have the basic projectile motion class done
time for angular momentum and collisions π«
:p
Operator precedence is here. If in doubt, use parentheses.
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
This beginner Java tutorial describes fundamentals of programming in the Java programming language
Uhh, the ItemMeta lore is a List<String> not a List<Component>. Are you using the right import?
pretty sure he's using paper
so it should be component then
because paper loves components
Adventure API with Paper
Yep I using paper
β€οΈ
Paper uses Components because Vanilla does
and it makes sense
Idk why it works with adding and it doesn't work with remove
olivio did you have any ideas for my issue
It looks fine
It's possible that the lore doesn't have that many elements.
I worked for a military contractor, and we had jobs that used Java.
oracle on their way to fine the company 9,999,999,999,99.99$ after seeing this message
my compsci teacher used to work with the MOD and she had to code in COBOL
try {
Field offersField = ev.getClass().getDeclaredField("offers");
offersField.setAccessible(true);
offersField.set(ev, offers);
} catch (Exception e) {
e.printStackTrace();
}
``` im so happy
I was not on those jobs, so I can't speak for their choice of programming language.
i mean
very confused in this case, I followed the example by Vault but for some reason, it can't hook
How do I create an itemstack collection?
Collection<ItemStack>
Collection<ItemStack> items = ;
List<ItemStack> items = new ArrayList<>();
COBOL was created by the US Department of Defense.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
What to write after =
@jolly gust
I need to compare this collection with another
You can't help me with that
well that makes sense, no wonder the ministry of defence here were using it... very of its time though
what do you mean i can't help you with that
if you don't know how to create a collection you should not be coding plugins just yet
I don't know if I know Java
I know C# and it's been like nearly 100% the same so far
but yeah you should probably look into it
i've tried C# and their naming conventions pissed me the fuck off and i quit
Didn't know this existed. Bookmarked π
i made a simple unity game and stopped there
π
C# naming conventions are pain
Collection<ItemStack> items;
items.add(new ItemStack(Material.WOOD));
items.add(new ItemStack(Material.DIAMOND_ORE));
Variable 'items' might not have been initialized
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
because it's not initialized
Please
how initialize it ?
the naming conventions are very elegant once you make peace with them
i bet he's gonna say that we are useless
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
PLEASE
no more
Here are some links for you:
?main
?conventions
?di Also something you might need to learn if you've only worked with Unity before
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
No no I've never really used Unity
I've played with it but I'm mainly from a backend server background
like ASP.NET Core and all that
I know Main is bad it's just a test plugin
Most people that I've seen here that have used C# only have Unity experience... which for obvious reasons is quite lacking
hey guys how do I check like the others PersistentDataContainer?
Unity does a lot for you
what do you mean?
nah nah I wish I had some time with Unity
but no I'm used to pure C#
along with ASP.NET
I mean like instead of the player's PersistentDataContainer it would get it from the player from the arg command
Some more complex stuff is different
so far it's been nearly exactly the same
the setup was the most different
eclipse was so annoying so I'm using IntelliJ now
great decision
I am very much used to Visual Studio and VS Code
I know you can use VS Code for plugins, but the setup seemed even more awkward
Visual Studio is very bulky
Visual Studio Code is meant to be more lightweight but it runs behind Electron
so it's actually a webapp in disguise, not native
Yeah and I believe they're 2000 commits out of date
Which is why you can find some fun bugs in discord
I see electron as something necessary
but it is a compromise
it's never as fast as metal code
plus chromium is so bloated
anyway
the problem is
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
returns null
Yeah that's a bit odd
Do you have an economy plugin installed on your server?
I do
That being?
I've got EssentialsX installed
not sure if I need to enable anything in the config for essentials
but I couldn't find anything
It's automatic
Ok, then verify your Vault version. I don't know why, but some Vault.jar instances out there don't work properly. Maybe they are outdated, maybe they are something else entirely, just make sure that you have the latest one from the spigot website.
good idea
It's up to date already
vault is very much running
and it's installed
and is it a dependency?
yeah vault is the latest version
do i maybe enable something in vault?
here is the pom.xml sorry i forgot to include it
Let me setup a test project
Thank you for all this by the way
It always uses too much memory for me for some reason
it's good to have though
does a good enough job
I just copy pasted your code
It loads fine
hm the only difference is your dependency being an array instead of a list
but it should be fine
Does spigotmc have an API for when publishing and updating a resource?
Okay hold on
Anyone can answer?
Pls.
No difference I'm afraid
Could you DM me your jar
sure thing
How do I mark a certain position as ender-eye findable?
setTargetLocation
That is not what I mean
I need to mark a position as a POI for the vanilla entity to lock on to
Not make it move towards a specific point
So that when thrown, it will automaticially move towards it
What? "Not make it move towards a point, automatically move towards it"? What is "it" if it's not a location?
The minecraft world literally has collection of map features for things to query
Like the eye of ender
This ties into the NMS generator
Are you telling me bukkit has no way to add POIs to that collection?
Yeah no
Of course it doesn't
Bukkit is just an abstraction of NMS
yeahhhh
It wasn't designed to let you do whatever the fuck you want
It abstracts the interactable parts, make your own worldgenerator with dynamic structures if you want
or... just do what nms does
and listen to the throw event
and set a target location
it will... move to the target location
Or do one better, get the nearest structure, get the nearest location
and approach the closest one
There is no ender eye throw event, and the vanilla item will refuse to even spawn the entity when no stronghold feature is present
PlayerInteractEvent, ProjectileThrowEvent
And you can spawn the entity yourself ^
Ah yes, let me just replace the entire logic of the ender eye, so much easier than to just allow the user to add a POI to a collection in the world
You're not remaking the logic... if they right click with an ender eye... spawn the eye... settargetlocation... done.
Gluing that on top of vanilla behaviour will cause two eyes to spawn
Thank you, that is all I wanted
Somewhere around 1.12, someone wrote a plugin where you could list the targets of ender eyes.
And the eyes would go to the nearest one
Adding some is easy enough in reflection though
maybe because you're lowering the loop condition inside the loop?
you could
no need to check if the iterables size > 0 before looping
how do i catch out of bounds error for like args[2] do i just check args.length?
i keep getting Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2
if(args.length >= 3) {
if(args[2].equals("-silent")) sound = false;
}
ye, ig
even with that if i only give 2 args in command i get out of bounds error
eventhough i check length
send all of the cmd code please
if (sender instanceof Player player) {
int delay;
int blocksPer;
boolean sound = true;
System.out.println(args);
System.out.println(args[2]);
try {
delay = Integer.parseInt(args[0]);
blocksPer = Integer.parseInt(args[1]);
if(args.length >= 3) {
if(args[2].equals("-silent")) sound = false;
}
} catch (NumberFormatException e) {
player.sendMessage("Looks like one of your arguments is not a number!");
return false;
}
player.sendMessage(Chat.colorMessage("&bPasting..."));
if (CopyBuild.clipBoard.get(player.getUniqueId()) == null) {
player.sendMessage(Chat.colorMessage("&cYou need to copy something first!"));
return true;
}
CopyBuild.clipBoard.get(player.getUniqueId()).buildSlowly(delay, blocksPer, player.getLocation(), player,sound);
return true;
}
System.out.println(args[2]); that's why
ha what an idiot i am
cause you are asking for index 2 before you did your check
also System.out.println(args); won't work as you intend. Use Arrays.toString
getType
hellloooo, i recently created a custom worldgen plugin using chunkGenerator (very simple) and all it does is generate a chunk as full grass blocks on the negative x side of the world, and sandstone on the positive x (as well as making every biome type forest).
i was doing this in hopes of moving the server world over to my single player saves file but i unfortunately realized the generation is handled real-time and doesnβt get saved locally within the world file
i was wondering if i could get help in figuring out how to get a similar world generator to work on a single player world. i think itβs possible with a datapack so i want to keep it vanilla
Does event.blockList() in EntityExplodeEvent contains block not actually exploded
https://imgur.com/MBstcaW for an example of what iβm trying to accomplish
I mean if an explosion hits a TNT, the TNT block doesn't get removed, it becomes a TNTPrimed
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityExplodeEvent.html#blockList()
would have been removed or were removed
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
In that specific case not sure, probably is in the list. Would just try it out and see
for (Block block : event.blockList()) { Location location = block.getLocation(); System.out.println("ExplodeBlock: " + block.getType()); }
I mean debbuging, I saw that if you prime a TNT, an other TNT hitted by the explosion doesn't get counted in the list of this blocks
@zealous osprey
Ok ig
How would you get close TNT blocks that are going to explode?
I need to get the blocks of the TNT since I need their locations
the tnt blocks are not in the list
Heh
^
^
I suppose you could Check in a 5x5 Radius or so around the TNT Block
And Check from there
That wouldn't be accured tho
remove client boss bar
Its a solution atleast
So you would need to iterate over 25 blocks, or at least the radius of the explosion?
is the event called before or after exploding?
An alternative would just be to check the EntityBlockFormEvent, gets called when the tnt block turns into an entity, but not exclusively.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/EntityBlockFormEvent.html#EntityBlockFormEvent(org.bukkit.entity.Entity, org.bukkit.block.Block, org.bukkit.block.BlockState)
declaration: package: org.bukkit.event.block, class: EntityBlockFormEvent
Actually this problem could be get solved by using ExplosionPrimedEvent since I need to get the location of the src block of the location
Thats also a way to do it
The problem while doing this is I need to get the location of the source TNT block
Ok, for what exactly then?
I need to get an accurate location, but even flooring the location I get the location of the entity, so the TNTPrimed wich is not equal to the src TNT block location
With the EntityBlockFormEvent you can get the block from which the entity formed, I believe. Therefore you'd get the precise location.
You'd also get the entity if you'd want to remove it. Or you could just cancel the event
Okay thanks I'll give a try
hello again
I should check the event.getNewState(), but it returns a BlockState, wich can be only a block, not an entity
Don't you want the block?
Since TNTPrimed is an entity, I should check if the material of the orginal block is TNT, and then if the new material is air, isn't it?
why not just take the block and then check its type?
I mean yeah, but in that way you don't get the Entity, TNTPrimed is an Entity
declaration: package: org.bukkit.event.block, class: EntityBlockFormEvent
Uh, it doesn't appear on IntelliJ (I'm his friend)
Ahhhh shiiit
Uh ahah dw I'll try that thanks
Is that a localhost?
That error occurs usually when the IP is not correct
i'm doing some quadratic stuff, is there an easy way to create a method that will calculate and output as many results as there are?
A simple example would be a parabola where there would be multiple answers for e.g.
x when y = -2 in the equation y=-x^2
Im gonna say its because the port is in use, just a guess tho
Or maybe you are already hosting something on that IP
Probably you're right
i might just try use some modified formulae nvm
If x^2 is the most complicated then you can add it in, since roots return both positive and negative numbers.
And if you have smth like x^2+4 you'd calc the quadratic seperately from the rest and return both the positive and negative number
nah i think imma just run it twice negative and positive
doesn't really matter idc about performance
can anyone help me with a world generation problem
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
, i recently created a custom worldgen plugin using chunkGenerator (very simple) and all it does is generate a chunk as full grass blocks on the negative x side of the world, and sandstone on the positive x (as well as making every biome type forest).
i was doing this in hopes of moving the server world over to my single player saves file but i unfortunately realized the generation is handled real-time and doesnβt get saved locally within the world file
i was wondering if i could get help in figuring out how to get a similar world generator to work on a single player world. i think itβs possible with a datapack so i want to keep it vanilla
https://imgur.com/MBstcaW for an example of what iβm trying to accomplish
Heya guys, any method to go from InventoryOpenEvent, all the way back to the Chest object of the MineCartWithChest?
isn't that the inventoryholder?
that returns a entity, not a chest object.
Found the StorageMinecart class, which i can cast it to,
how do u check if the player has something in their 2x2 crafting grid?
can u check it just with a Player
I tried to set up my plugin at remapped mojang mapping but I get this
@pastel juniper I get that until rebuild/restart
but only when i added the right repo
Send your entire pom
I meet the requirements of premium resources but I'm unable to post them. Anyone have any idea why that may be?
8 week old account β
80 messages (forum posts) + 20 positive ratings β
3 free resources β
do you have 2FA on?
yeah
I have already restarted my pc
Looks fine have you reloaded the project have editing the pom
Oh it worked
thanks
?
Listen to inventory click event and log the slot number as i dont remember the slot numbers for it and the numbers on the spigot site lie
From there you can just Inventory#getItem(thatSlotNumberYouLogged)
And make sure that player inventory clicked is player ivnentory type ofc
and is there a way to not do it with inv click?
well your only doing inv click to find out what the 4 slot numbers are
you can remove it after
i just dont remember those 4 slots slot #'s
someone else here might; or else i would of said the numbers instead of that π
Are you trying to make a crafting recipe? Only time you rly wanna do this is if ur making a recipe where items in slots need some type of NBT data (Or some type of custom inventory?)
well the thing is and i just found this out, that the playerinv and the crafting slot are 2 separate invs
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
the crafting slot is .InventoryType.CRAFTING
theyre the same
thats the player inventory; sometimes it shows up as CRAFTING
cause theyre crafting; but if you use player.getInventory() and use the specific slot youll get the crafting inventory slot from theyre invent
alr so its 1-4?
well thats what i was saying earlier
is that the numbers there tend to lie
so you might wanna use inv click event to double check the item ids
the IDs there havent been updated in a while
last time i used them they were ohhh so wrong
but in theory if those numbers were right; yes you would just use the numbers listed there
last time i used it tho 0-3 was the armor slots iirc
and 4 was offhand or 4 was slot #1 it was super fuckin weird
thats why i jut use inv click event to get the slots i need for the inventory; i just remove the event when im done or comment it out
no
inv slots 1-4 dont execute
lol actually inv slot 1 is the place the dragon egg is rn
yeah makes sense since 1 = 0 in java lists
1.19?
They miiight of changed it in that version; but in the past i know those slots are accesible via player.getInventory()
?bing
Bing your question before asking it:
https://www.bing.com/
lol not true
I think those slots are pre 1.13
i tried getItem(1) and it was hotbar
crafting is not playerinventory
^
Just use the inventoryclickevent and print out the clicked slot index..
good idea
crafting is totally playerinventory
π
then help me burchard
more of a fun question but i think the pathfinder is confused
yeah working on a fallback
the spiders 2.0 mod pathfinding?
looks like wall climbing lol
thats what it looks like to me xD
if you are doing that it just l know the issue
okay, i think my brain is rip... i did InventoryClickEvent and tested what slot got pressed and it did register the crafting slot.. but in my code it doesnt detect it. why?
blocks that underneath it that arent air/were part of the path are geting marked as invalid
i mean yeah, the point is to fallback to the already found path when the target cant be found anymore
or is at least not accessable
what is getItem(1) when you log its type?
Ah is that when it starts going left then?
or right
depends on perspective ig xD
yeah thats the part that doesnt makes sense yet
he probably looks further for the point and then fails
and it looks for it to the right but then realises that its not reachable
my guess is that it forms a bubble around the target and then fails at the max iterations
oh yeah thats it
you cant just use the list of previous nodes to backtrack? Or are they not accesible once pathfinding at this point
thanks
i do, but i cant know at what node exactly it failed
or can i
hm
you could make a error listener of some sort
bro wtf!!?!?!?
@FunctionalInterface
public interface ErrorListener {
void run(Level errorLevel, String... additionalInfo);
}
in what way
in that way
basically each iteration that fails run() is called
its janky but its simple what im doing
you can transform it to be more advanced and logical
that wont work
tf
I mean, you were looping over all players, so maybe someone had a recovery compass in their inventory.
it fails at solid blocks. i would have to check if it passes the target location. but even if, i cant handle that since it could be some sort of labyrinth
yes, i have my alt on the server but it had a recovery compass in the 2nd hotbar slot
That adds up.
which is the 1. index
not in the crafting slot
i dont fucking know
sometimes its 1 and sometimes its sth else
did you log the rawSlot on inv click?
to see what those 4 slots are? If so what were they
YES; AND IT SAID 1 WHEN I PRESSED ON THE FIRST CRAFTING SLOT
IM LOOSING MY MIND
lol
so use rawSlot on the if statement?
again a good point
Inventory slot numbers are 1-54. Arrays are 0-based. (Meaning they start at 0)
So if you want slot 1 of the inventory, you need to get inventoryContents[0].
@noble lantern we should discuss more often
i just havent been around much lately for dev stuff so i havent been in here as much
but starting on a new plugin so im here again xD
i know that
same, minecraft dev got boring
ive decided to make an actually good CE plugin
CE?
custom enchants
well, if u click outside the inv it is -999
oh ew another of these
Yea, that's just incase the user clicks outside of the inventory.
im gonna tie support in for every plugin i can imagine
pathetic 
working on MMOItems rn (One the almost every CE plugin rarely ever supports properly)
make an enchantment on boots which can pathfind
hmm
make me a class that make it easy to move armor stands
and i will make it as a troll function
walkTo(location)
wait
can boots be right clicked onto entities?
imagine some boots you right click on a zombie and it make it locate the nearest stronghold or some shit lmao
btw as that pathfinding class i made ever helpful?
well i never actually used it and was more for a private project
maybe for entities we can make a pathfinder which only leads into the right direction instead of finding the whole path
and bind it to a PatheticEntityWrapper
i mean you can do that by default
just use the vanilla /locate code, then offset that location by a random of 250 block on x/y then use getHighestYAt(x, z) and pathfind to that location
for strongholds at least
and boom general area pathfinding
only issue is youll need to make the NPC chunkload if it isnt already ofc, like a player does
yeah but i mean for general pathfinding for entities
ah so just for any location i see
exactly
eg instead of going to that cactus go 5 blocks left of it
yeah that would be more tricky
yeah like "go forward, go forward, go forward AHH STOP WALL GO LEFT"
someone should make a pathfinding written in loliasm
I mean you can always vary it a bit
or whatever tf that lang is
most of my code nowadays is just pure enterprise communication stuff
and a tiny gui to render the data
right now i only code for minecraft to test stuff that came randomly into my head
f.e. a 50x100 armorstand knight
yeah i mean you would have to pay attention to many scenarios. f.e. what happens if he falls into a hole, cliff, whatever.
i never really finished it
I think I use my IDE more to help people in this channel than I do for actual work
truue
like I just push some commits that just have a dangling StandingAndWallItem tossed in
because I just type the class name, middle click and solve issues
@noble lantern https://github.com/olijeffers0n/PatheticAPI/commit/d9406d58bc5101cf8c069b487de0d2a6b35d8731 btw.
what was the thread called we had in here for your npc plugin @noble lantern
oh got it
i think it was leeroy jenkins iirc
actually just "Pathfinder" but its empty for me
do you still have the old timings you reported? could be useful for the spigot page
timings get deleted after 30 days sadly
i do
have a video now that i remember
Credit for the actual A* algorithm goes to: https://github.com/olijeffers0n/PatheticAPI
that can help, thanks :)
wait, but I am op with /op
also, I am in creative mode but it is saying survival
nvm
Step 2. Add the token to $HOME/.m2/settings.xml as the username
im confused
jitpack
but where would that be
C:\Users\user
C:\Users\Users
I have been watching a neither List<T> nor ArrayList<T> have a toString() method
Its really amazing because that fucks me a lot because i cannot save those things directly thru ConfigurationSerializable
π‘
you don't need toString() to implement ConfigurationSerializable
Hmn
Some told me that seriable bases on the toString() method from the external objects you are using
And its seems true, because im trying to save a List<UUID> and its not being saved
because UUID does not implement ConfigurationSerializable
Ok
So the best solution is?
Bukkit serialization will fall back to toString() if it fails all other attempts to serialize
That what is happening
Its not being saved
I dont know why
why do you need a generic implementation?
What?
List<T>
I just to need to serialize/deserialize a list of uuid
But for some reason the list not getting serialized
then don;t use List<T> use List<UUID>
I have tried serializing a List<UUID> and its not getting serialzied
That is what i was trying to said
then serialize/deserialize the List in the deserialize method
Are u trolling?
Im being serious
So am I
I dont understand what you mean
Clearly
any object which implemetns ConfigurationsSerializable must implement a deserialize and constructor method
Yeah its already done
so make your Region a class which implements Configurationserializable
Yes its already implementing it
you can;t just cast a List to List<UUID>
I know how to use configuration serializable but im forgetting smth or smth is not coded correcly
That what what what i was was was asking asking asking
π
and I said you manually serialize/deserialize in the constructor/serialze method
Which is not casting to List<UUID>
i dont understand }
As far as i know they are auto deserialized
And same with serialize
any object which can not auto serialize/deserialize you have to do manually
this is why I'd rather just use json
I dont have time to deal with json
I need to finish this as fast as i can
new Gson(region, new JsonWriter(new FileWriter(file));
for storage
type deal
much simpler
Region object = new Gson().fromJson(new JsonReader(new FileReader(file)), Region.class);
not that hard
More respect please
with typetokens
more research instead asking me to crunch down a tutorial
there are tons of tutorials out there
I mean my intetion was to use ConfiguratioNSerializable no smth else
*serialize and (deserialize method/constructor)
You should implement one of a deserialize method or constructor, and you need a serialize method (which is provided by the interface)
Oh choco i have realized, that is not the problem
Yeah I was just correcting either a misunderstanding of what's required, or a typo
I just used the command to see the region info right
And its not adding me
π€‘ π€‘ π€‘ π€‘ π€‘
Choco
@cho co
@Cho co
@ Choco
intellij > any other java ide
what about notepad
what about google docs
what about books and quills in game
Thats Superior
Notedpad != IDE
could still code in it
If I want to get the distance from two different locations using location.distance, is the value in block length?
Can you use mixins with plugins or is that a Sponge only mechanic?
Its a sponge only mechanic
Okay, thanks!
Np
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "mission.boxpvpcore.Boxpvpcore.getCommand(String)" is null``` where did i go wrong ???
did i wrongly register my commands or some crap
check if the command is in your plugin.yml
it is?
/gmc:
aliases: /gamemodecreative
permission: boxpvp.gmc.staff
/gms:
aliases: /gamemodesurvival
permission: boxpvp.gms.staff
should i add more
ohh
remove the /
pretty sure everything is optional
ah ok
Everything is optional for commands, yeah
Still advised you give it a description and permission though
Useful for /help and tab completion respectively
i removed the /
java.lang.NullPointerException: Cannot invoke ```
i mean its probably
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (label.equalsIgnoreCase("gmc")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (args.length == 0) {
player.setGameMode(GameMode.CREATIVE);
player.sendMessage(ChatColor.BLUE + "(BOX CORE)" + ChatColor.RED + "Your Gamemode has been set to Creative");
return true;
}
} else {
sender.sendMessage("Failed to execute command please try again");
return false;
}
}
if (label.equalsIgnoreCase("gms")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (args.length == 0) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage(ChatColor.BLUE + "(BOX CORE)" + ChatColor.RED + "Your Gamemode has been set to Creative");
return true;
}
} else {
sender.sendMessage("Failed to execute command please try again");
return false;
}
}
return false;
}```
this cuasing the issue
because ive never used
if (label.equalsIgnoreCase before
so i might have messed something up there
How can I, in an InventoryClickEvent, check if the player clicked the 8th slot in their inventory not like a chest opened or smthin
Anyone know how to add gradients to scoreboard?
hellloooo, i recently created a custom worldgen plugin using chunkGenerator (very simple) and all it does is generate a chunk as full grass blocks on the negative x side of the world, and sandstone on the positive x (as well as making every biome type forest).
i was doing this in hopes of moving the server world over to my single player saves file but i unfortunately realized the generation is handled real-time and doesnβt get saved locally within the world file
i was wondering if i could get help in figuring out how to get a similar world generator to work on a single player world. i think itβs possible with a datapack so i want to keep it vanilla
https://imgur.com/MBstcaW for an example of what iβm trying to accomplish
How can I set prefix in TabList and above the head?
For above the head, I used
p.setDisplayName(ChatColor.RED + "[ADMIN] " + p.getName());
p.setCustomName(ChatColor.RED + "[ADMIN] " + p.getName());```
But it did not work
Gotta use nms for it im pretty sure
wtf
using craftbukkit is already bad. using 1.5.2 is even worse.
that's even worse than my game's weird lua code
still newer than LeGuernic who used 1.4.6
@glad prawn hey
you did π on code ive never even did beforee
can you tell me where i went wrong plz
Man I miss Lua 
I only learnt it today and I already love it
I hated it the first 2 hours, now I love it lol
oldPrint = print
print = function(text)
oldPrint("Printing: " .. text)
end
The roblox version of lua is weird
what error? sorry I only just joined this conversation lol
imgur doesnt work for me
idk why it always throws this error lol
you need to add the maven shade plugin
1 sec
check the second part ("how to shade dependencies")
alr
it should look like this (roughly):
https://paste.md-5.net/emarasubod.xml
and then you just do mvn package and then it should work
(usually you should also relocate the lettuce-core thing, but that's not important)
do i replace βpackageβ with anything?
you mean in the "mvn package" command?
No, i mean in the shade plugin thing
no, it has to be "package"
ok
do not replace it with anything else
the <phase>package part means that the shade plugin will run everytime you run "mvn package", so it will add the needed classes everytime you "package" your .jar file (which is e.g. after "compile" and before "deploy")
it worked tysm
np
is there any way to set defalut permission and give it to user when player join?
Use a permissions plugin like Luckperms and then just set permissions to the default group
Or if you meant With code, you could use the Luckperms API. Otherwise #help-server For any more help with default permissions if it's not coding related
Okay Thanks! π
How does one translate color codes to a ChatColor variable type and not a string? It is just color codes and not other text.
You don't need to translate color codes when using the ChatColor enum
It's only for replacing & with Β§ in legacy color codes
π€¦ββοΈ
https://pastebin.com/WPYQRG1U is there a reason that the onJoin and onLeave event get triggered?
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.
It's very weird
How am I listening to it twice?
The onLeave method is listening to the PlayerJoinEvent
Do I just need a new class?
^ That should be onLeave(PlayerQuitEvent event)
^^
?paste
Sure!
Use that
Code: https://paste.md-5.net/ofogesofec.js
Error in console: https://paste.md-5.net/zifubimeyo.sql
Show the full class
} catch (Exception exception) {
e.sendMessage(ChatColor.translateAlternateColorCodes('&', chat_message.replaceAll("<player>", player.getName()).replaceAll("<prefix>", lowestPrefix).replaceAll("<message>", PlainTextComponentSerializer.plainText().serialize(message))));
}
That's the bit the error is referencing
It doesn't like your replaceAll
Interesting
I'll see why the catch is even happening, one second
Same error with the catch removed.
Post the error again
Yeah, it doesn't like the replaceAll.
Hm, is there an alternative I can use?
Not the prettiest or probs the best way, but I used:
configFormat = configFormat.replace("%", "%%");
configFormat = configFormat.replace("%%prefix%%", playerUtil.getPrefix());
configFormat = configFormat.replace("%%suffix%%", playerUtil.getSuffix());
configFormat = configFormat.replace("%%displayname%%", playerUtil.getNameColour() + "%1$s");
configFormat = configFormat.replace("%%message%%", "%2$s");
The last configFormat from my example would be the message. Obviously adjust it to your code.
basically do something like chat_message = chat_message.replace(<player>, player.getName()) etc..
Then do chat_message = chat_message.replace()... etc..
iirc you can stack .replace's
You can, I just did it that way as I was debugging stuff and didn't change it back
It works π€·
Eitherway, it should like replace better than replaceall
It worked, thank you!!!
Hey GUYS how can I detect event when player break block by jump?
u mean farmland?
EntityChangeBlockEvent or PlayerInteractEvent/entityinteractevent
second one probably
Thank you!
I developed MailAPI plugin used in dialog and quests plugin.
But, I don't know how to use MailAPI's method in dialog quest system.
I tried to use project structure libraries to load plugin. But I still can't use method. π¦
Is there any way to load and use other plugin's method?
Just use maven and mark it as provided
Oh god
I'm so noob ..:(
I'd help explain dependency managers but I'm in bed sorry
You should learn about maven though
Do your plugins use maven like they have a pom.xml
add it as a dependency is the best guess
So I should make my dependency?
Whatever the artifact Id and version is
Do you have a build.gradle or a pom.xml file in your plugin
Make sure you do mvn install in the other project though otherwise it won't be in your m2
Basically mvn install allows you to use that code elsewhere and depend on it through a maven dependency
So you'd go in your MailAPI project and build it with mvn install
..?
you add it as a dependency in the place you want to use it
Now you can go into your depending project and add the dependency
Like you would spigot but with the MailAPI artifacrId version etc instead
it wont need a repository just the dependency
I wanna send image but I cant π¦
?img
Not verified? Upload screenshots here: https://prnt.sc/
?paste if its code or pom
ahha zzzz
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.rukon0621.mailapi</groupId>
<artifactId>MailAPI</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>C:\Users\admin\Desktop\Servers\PluginPaperServer\plugins</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
So in dependencies
I have to add my MailAPI dependency
that's right?
yep
okay okay i got it
but...
There is some serious problem
I dont know how to add custom dependecy... sry.. π
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>your.group.id</groupId>
<artifactId>artifact-id</artifactId>
<version>version</version>
</dependency>
</dependencies>
This looks cursed on mobile
most things are
I'm so plugin noob
and not good at english... sry π
What English isn't your first language
I'm korean...haha
Wouldn't have guessed be more confident
anyway thanks! π
Any bungee devs available? Iβm looking to develop a bungee server for oculus/vrchat
?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/
is there a way to get and set persistentdata to an inventory (Bukkit.createInventory())?
Other API made by other developer is work well. but I loaded My API plugin, It doesn't work.
is making API not same as making plugin..?
This is my API main class.
public class main extends JavaPlugin {
public static final String pfix = "&7[ &9Mail&3BOX &7] &e";
public static final String mailBoxGuiName = "&7[ &cμ°νΈν¨ &7]";
@Override
public void onEnable() {
//Generate Basic data file.
getDataFolder().mkdir();
File file = new File(getDataFolder(), "data");
file.mkdir();
//Commands
new mailBoxCommand(this);
new mailBoxOperatorCommand(this);
//Events
new onJoin(this);
new inventoryEvent(this);
}
@Override
public void onDisable() {
}
}
commands are registered getServer().getPluginCommand("mycommand").setExecutor(new ClassName(this));
constructor of command class is that
They technically aren't the same. API relies on a plugin. The API is something another plugin uses to interact with that plugin
ah
Sort of like how your plugin uses the SpigotAPI
umm..
ahha
I made MailAPI plugin
and I wanna use method and object in API plugin in other plugin
is there any fancy way to do that?
how do i get the player from the AsyncPlayerPreLoginEvent?
I loaded my plugin to libraries. but I can't use the method of that.
is there any solution for that?
Are you using Maven?
yes i'm using maven now
I asked this several times but I couldn't get obvious solution
You have to declare it in the xml file
all ur imports should go through maven
umm..
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.rukon0621.mailapi</groupId>
<artifactId>MailAPI</artifactId>
<version>1.0.0</version>
</dependency>
I did like this but It doesn't work π¦
It said Cannot resolve me.rukon0621.mailapi:MailAPI:1.0.0
How can I solve it
Connection c = DriverManager.getConnection("jdbc:sqlite:" + dataFolder); it sets the connection to null
its built to maven local so that should work
Oh thanks I gonna read that
Yeah idk i remember having this issue a while back but cant remember how i fixed it
if you have a module file u might need to add it to there too
but I can't do that
dm to me ill repost it
ok
β€οΈ
how do i do it
make it not null
Its prob null because the connection failed
yes
i dont know how to do the string
getConenction(String)
i found the issue
so
You need the SQLite JBDC library. Google it. Put it in /lib folder.
i have never heard of the /lib folder
i have to put the library in it
I usually just shadow it into my jar instead of using the lib folder lol


