#help-development
1 messages · Page 595 of 1
among other things, yes
Duplicate textures for different animation frames and different item name that is a head in armor stand and change it via plugin
the plugin I made already works, I just wanted to see if someone knew the inner workings of resource pack origin points
I restarted IJ because if this same shit just a minute ago and now again bruh
Item1, name:"frame1" - anim frame 1
Item1, name:"frame2" - anim frame 2
etc
Saw guy had the same problem
Didn't remember how to fix it
I don't even have the mc dev plugin
I don't even have 200mb while building
Restart the PC 😎
I don't have a PC 😎
this is annoying because if the origin is over 64 or something around there the model starts getting offset
Restart phone 😎
I don't use my phone for coding 😎
nah, my brain got no memory leaks
Pretty good work, why offset though, just put the model in an armor stand and move the armor stand 0.2 blocks up
if you don't know what you're talking about you don't have to say something
I do
no, you just don't know that you don't
Yes that could be the thing
I just worked with models and vanilla Minecraft command blocks for 2 years before I discovered that there's things called plugins
And now my brain's overloaded with things and mixes these things
i have one technical question for example if lets say we are making factions plugin and obviously people have claims how do we get information if person is in someones claim for example claims will most likely be stored in database and then we are most likely going to check if current coordinates are coordinates of someones claim ?
but isnt that overkill to do
you don't query the database every time, one of many ways of doing it is initializing the data of loaded chunks only and then querying that smaller set of data
lumbuck
I never really worked with chunk-based data but I'm sure people have also found ways to rig data directly into chunks to make them easier to query
how are chunks in minecraft identified ?
Is there a way to get the theoretical break speed of a block? Basically if I have a BlockData/BlockState with no location of something like, for example, oak planks can I find how long a specific player would take to mine it?
How do i set the durability of the players held item to max?
If i want to make a disposal sign
Should i just make a sign that opens a menu and that its?
Becuase when you close the menu everything inside will be cleared
There was a formula for this
It takes into account what tool you have, lot of stuff
So it's unbreakable?
No, just so if example a diamond sword has 10 durability and i click on that sign i will just get full durability
I think it will automatically clamp at full when you change it to 999999
So you dont know how to set it to full?
Becuase i think if i change it to 9999999 its going to bug
Try it
you want to repair the item?
Can you do Google search for "chart.js java api? "
Damageable damage = (Damageable) item.getItemMeta();
Take a look at that
Or try to set it to 0
Yes
obv do instanceof checks otherwise you'll just get a bunch of bugs as well
hey can somebody help me with this skript
"else" has to be placed just after another "if" or "else if" section
command /sdaily:
permission: daily.use
cooldown: 2 hours
cooldown message: §cYou can use this command again for %remaining time%.
description: Player get a random crate key.
trigger:
chance of 70%:
execute console command "/crates key give %player% keyall_klic 10"
send "§cYᴏᴜ ɢᴏᴛ ɴᴏᴛʜɪɴɢ ᴛʀʏ ɪᴛ ʟᴀᴛᴇʀ" to the player
else:
chance of 40%:
execute console command "/crates key give %player% keyall_klic 10"
send "§5Yᴏᴜ ɢᴏᴛ ᴀ Kᴇʏᴀʟʟ ᴄʀᴇᴀᴛᴇ ᴋᴇʏ!" to the player
else:
chance of 35%:
execute console command "/crates key give %player% nature_key 1"
send "§2Yᴏᴜ ɢᴏᴛ ᴀ Nᴀᴛᴜʀᴇ ᴄʀᴇᴀᴛᴇ ᴋᴇʏ!" to the player
else:
chance of 25%:
execute console command "/crates key give %player% water_klic 1"
send "§bYᴏᴜ ɢᴏᴛ ᴀ Wᴀᴛᴇʀ ᴄʀᴇᴀᴛᴇ ᴋᴇʏ!" to the player
Ask in #help-server and use a pastebin
?paste
man I'm just going to have to give up on fixing this for the first release
I dont really know what i should do
I got this
if (line0.equals("REPAIR")) {
if (line1.equalsIgnoreCase("Click here to")) {
if (line2.equalsIgnoreCase("Repair item")) {
if (line3.equalsIgnoreCase("")) {
if e.getPlayer().getItemInHand().getDurability(e.getPlayer().getItemInHand().getDurability() > 0){
e.getPlayer().sendMessage("Your item got repairred");
e.getPlayer().getItemInHand().setDurability((short), Idk what to type here );
}
} else {
e.getPlayer().sendMessage("This item cannot be repaired");
}
}
}
}
Did you just ignore what they were saying
yeah read through what I said again
Damageable damage = (Damageable) item.getItemMeta();
kk
But how did i repaire the item?
am i able to find an entity from a lead?
do damage. and look at the options you have available
I dony have any available
is Damageable damage = (Damageable) ... anywhere in your code?
Yes
if (line0.equals("REPAIR")) {
if (line1.equalsIgnoreCase("Click here to")) {
if (line2.equalsIgnoreCase("Repair item")) {
if (line3.equalsIgnoreCase("")) {
Damageable damage = (Damageable) e.getItem().getItemMeta();
e.getPlayer().sendMessage("Your item got repaiired");
}
} else {
e.getPlayer().sendMessage("This item cannot be repairred");
}
}
}
now when you type damage. options appear on what you can obtain/modify
Ahhh, i though i should write damageable
So this right?
Damageable damage = (Damageable) e.getItem().getItemMeta();
damage.setHealth(damage.getMaxHealth());
Wrong damagable
test it out, debug
Use the other one
Other one?
when you set damage to 10 it'll take 10 damage from the item
declaration: package: org.bukkit.inventory.meta, interface: Damageable
Instead of the entity Damageable
Also Minecraft calculates damage insted of durability remaining
So set damage to 0
How to rotate player head without stuttering
real
I dont got a getDamage(); or hasDamange();
So which import should i have
The one I linked
Theres no import here?
Are you making something like a cut scene?
import org.bukkit.inventory.meta.Damageable;
no
My old code doesn't work
private final Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> teleportFlags = new HashSet<>(Arrays.asList(PacketPlayOutPosition.EnumPlayerTeleportFlags.a, PacketPlayOutPosition.EnumPlayerTeleportFlags.b, PacketPlayOutPosition.EnumPlayerTeleportFlags.c, PacketPlayOutPosition.EnumPlayerTeleportFlags.d, PacketPlayOutPosition.EnumPlayerTeleportFlags.e));
PacketPlayOutPosition packet = new PacketPlayOutPosition(0.0, 0.0, 0.0, 0F, SpraySpeed.get(player), this.teleportFlags, 0, isFlying);((CraftPlayer) player).getHandle().b.a(packet);
its doesnt work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I am getting this error for the import
Cannot resolve symbole 'Damageable'
1.8?
Yes
What do you mean?
It doesn't exist in 1.8
So i cant do it on 1.8 or what?
1.8 is too old
You can you just have to use the set durability or whatever you were using before
That didnt work
Look for a thread online, I'm sure there'll be something- repair signs existed before 1.9
It will
I am getting a few errors with this
But isnt this right?
e.getPlayer().getItemInHand().setDurability(e.getItem().setDurability(e.getItem().getType().getMaxDurability());
Errors:
';' or ')' explected
Identifier expected
Expression expected
Look at the error, it's expecting a ; or ) somewhere in the code
How it says
'setDurability(short)' in 'org.bukkit.ItemStack' cnnot be applied to '(void)'
look at your code you are setting twice. setDurability is a Void type
Hey guys, isn't there some nms mappings or something to make it readable?
https://mappings.cephx.dev/
or do you mean automatically in your IDE?
Dunno, I need to be able to understand what am doing
are empty Inventorys filled with itemstack of type Minecraft.AIR or with null ?
null
oki thx
use mojang mappings
and then reobf the plugin when you build it
Not verified? Upload screenshots here: https://prnt.sc/
I dont know how to fix this
If I'm asking I probably don't know, right? So, I don't know how
Every method call has a return type. If it returns nothign it's a Void type.
run buildtools with the --remapped option
Okay its working now
But just in the wrong way
The durability is being setted to 0 and not full
e.getPlayer().getItemInHand().setDurability(e.getItem().getType().getMaxDurability());
i just woke up to seing all the classes, all the bukkit api thingies and all the java shit not be recognnized and now i have like 700 errors
how to fix it
and if you are using maven, set classifier to remapped-mojang
restart IDE?
tried that
Hmm, okay, I will try
send pom or build.gradle
Did you move any of your code to a different folder?
Yeah I told you set it to 0
Try set durability to 0. It was said earlier twice.
nope
<?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>com.amirparsa</groupId>
<artifactId>HypixelSkillCore</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>HypixelSkillCore</name>
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
...
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>jeff-media-public</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>MorePersistentDataTypes</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
i removed the build to get rid of discord imitations but its still there in the code
try invaliadate caches?
How?
If i just write 0 its says cannot be applited to 'int'
cast to short
What should I do if the animal sits down without being tamed?
Hey anyone can tell is it possible to get FIle name from FileConfiguration object
So to check from which file is FileConfiguration loaded ?
Thanks, its finnally working
No, FileConfiguration has no reference to any File object
dam it
Why dosent this work?
This is the title of the gui, and i want it so you can edit the menu name in a config file, but when i am using this (underneath) it isnt working but if im setting it to example .title(Component.text("test")) its working
.title(Component.text(Config.get().getString("Vagtshop")))
how to check if the player has an inventory open?
If it's teh players inventory you can;t
Could someone help me on a clear lag plugin? I have a problem
i send a code on dm please its to long
if getOpenInventory() returnss a non Player inventory then they have an inventory open
You can't tell if they have their inven open or not
?paste long code
How to update spigotmc
But when i am using the command ingame and its set to this .title(Component.text(Config.get().getString("Vagtshop"))) i am getting so many errors in the console and the menu is not opening
?paste
Send the errors
go post that in #help-server and ask an actual question
Thanks man
what are the reasons to learn nms(except for packets bcz protocollib exists)
like what are things that you cant do without nms
@chrome beacon
Don't go near nms until you find something you want to do which can't be done with the API
Looks like a null pointer
Now find what's null and fix it
have you invalidated caches?
do that if the problem is still there
Did you mean to ping me or Amirparsa ;)?
thats not a maven update error, thats a compile error
?
guys, because i send fake slot contents to players,
well in survival it works no problemo
but creative is a bit of a dumb fuck because most inventory operations are done clientside in creative mode, so it will actually believe in the fake bullshit i tell them and synchronise it with the server
Is there a way to prevent that ?
1 sec
no
what is CreativeInventoryEvent for then ?
to take the piss when people try to use creative in plugins 😉
but imagine i cancel every creativeinventoryevent (madness)
Would the server ever synchronise the mess that creative has done to player inventory ?
probably
https://paste.md-5.net/owucuzoxis.sql the full error
creative is client side and the server has to trust whatever it says
creative is just a fuckshitpiss
kinda just have to pray that the client side does what you want
and not what it wants
yeah but i must be able at some point to know, "hey this dumb fuck has changed inventory, i won't tell you what but you know that something might hav messed up at least", no ?
drop your java version to 10 (if you can)
11+ breaks reflection
i tried 8
See if there's an update to the staging plugin
Or just don't use it, deploy is enough
Hi
morning
Ye you just gotta then log into the web interface to release it
by web interface you mean sonatype nexus repo manager?
i'm not really sure how i would "release" it now
I guess so
Yes, yes, but I forgot to say good morning. xd
In the old version you close then release the staging repo
please guide me through, i've never used this web interface or whatever
where do i go and push buttons
Staging repositories
i decided to also take a look here
my question is why the initial release was successful but the updates are not going through
i'm not using the maven-javadoc-plugin because i'm using kotlin
if i REALLY have to i can use java ofc
Presumably kotlin can make javadocs too
i tried, but the javadoc plugin dropped errors
You need javadocs for central
but the initial release worked...
How are javadocs even created
actually maybe i'm wrong and blind
alright i'll try to do javadocs
how do i make a player head in the latest version using texture
actually this seems to have helped, as simple as just updating to 1.6.13
now it says that javadocs are required
but at least not the "module does not open" stuff
ah nvm, i need for 1.16.5
That guide has link for old version
the latest authlib version doesnt have that put method...
line 49 in your paste will error
you assume there is a clicked block
Also the error line numbers don't match up with your code
pretty sure the package was trimmed out
and imports
Ah ye
oh right
the package starts with 000 if the error is correct
why would you have numbers in the package
it's kinda weird
his nick
000.vagtshop.signs.VagtshopSign.onInteract(VagtshopSign.java:61)
yeah but the traditional way is to use the TLD in the beginning and stuff
he's very much a beginner
yay
actually not yay
what would i name the files
and where would i put them
gosh it's hard to do kotlin in maven central
use Java then 🙂
So should i just remove BlockState bs = e.getClickedBlock().getState(); or what?
i like kotlin haha
i can use java sure but i want to use kotlin
i wonder if this works
I like coke, but it's bad for me
it is bad for your rep 😉
mmnope
^?
do a null check for e.getClickedBlock
do not assume there is a clicked block, check first
Javadoc Warnings
javadoc: warning - The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
what the fuck is this supposed to mean
oh my god
So is this right?
if(e.getClickedBlock() != null) {
BlockState bs = e.getClickedBlock().getState();
if (bs instanceof Sign) {
Sign sign = (Sign) bs;
looks better
read this
worry about that later
the earlier you start to make clean code, the better you will be in the future
nah, learn how it works first. Then worry about what it looks like
here at the { end for the if(e.getClickedBlock() != null) { should i write return false; or just do nothing?
Idk what that means..
it's plain english
Can you show a example?
use early returns to exit the method. Prevent runnign any code you don;t need to run
That was an example
That dosent show me how i could use it..
This is an example
?learnjava perhaps
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.
we need a command for this
IMAAAAAJIN
maybe ?learnjava!!!
why is everyone here so fucking assholestic? just shut the fuck up and help the person
read up, We are helping and have been for hours
what the fuck is up with your aggression
"help the person" is not spoonfeed the person the code that they need
they will NOT benefit from us sending the exact code that they want if they don't understand what the code means
and if you read carefully
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
they don't
^^^^^
Did they just leave the discord 👀
lmao 😭
HigherLevel you mean
Killer wolf was their nick
ik making a joke
theyre still here
they just came back yeah
anybody here knows how i can generate javadocs for kotlin???
maven central won't get off my ass if i don't
So what should i do with these brackets?
}
}
}
}
}
}
}
}
}
take every if-else statement (or if-statement) one by one
starting with the most inner
Does switch work on java 8?
Someone helped me some days ago and it didnt work there
of course it does if you get the syntax correct
certain switches work
What is maven
Oh
maven is a build system
speaking of maven
can i ask you something 🥺
how do i generate javadocs for kotlin so that maven central will stop bitching
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!
nononono elgarl has my respect and he probably knows that i am dumb so im asking !
oh my fucking god]
how did you put pronouns ?
just ask 🙂
How to use it
depends on what you want
So how do i switch the world?
switch (world) dosent work
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
all IDEs have some kind of maven implementation
Intelij idea
switch (statement) {
case "something":
break;
}
switch (world.getName)
Thanks
why are there 3 duplicates of src/main/java
i only see 1?
well yeah inside src there are directories main/java, main/resources, test/java and test/resources
lets say you are making HCF core plugin something on your own etc etc and you will obviously have claims that will be saved in database and im curious how do you check if player is in someones claim you know when there is message in chat like that you entered someones claim like i know that it would be too overkill to check when player moves with current coordinates and if it is in someones claim right ?
hello, i have 2 questions,
to know if the players want to receive chat messages, I use a database
so I could do it this way:
when a message is sent, I loop you players and I see if they want to receive the messages thanks to the db, but I think the most optimized would be to make a table, when a player joins the server, I see if he wants receive the messages and if so I add it to the board, and when a messqge is sent, I send it to all the people in the board is it better?
another question, my plugin being linked by database, let's imagine that the database is no longer accessible, too bad I don't do anything or I make a system that checks the database every x times and if so stops it server ?
ignore src folder. others are for java and resources
well what are you doing ?
do not query the database every time a message is sent, cache the values on startup and upload them to db on shutdown (and periodically)
In intellij idea you have build artifact option, and I click it and it works
why is it even there
So mine is in a event so i should use e.getPayer.getWorld.getName right?
If the claims are variable areas you'd check when they move a full block. Other claims are by chunk so you'd check only when they move to a different chunk
?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 i know you will
i told him twice
But it dosent work for me
Cannot resolve method 'getWorld()'
what ide are you using
getLocation().getWorld()
Intelij idea
variable areas you mean like when they select one corner and another corner and then check if players coordinates are inside of that area of their selected positions
do you not have auto complete?
They do
yes
They just have no idea what they're doing
^
They don't know what they are doing
What the fuck is a java
steaf perhaps you have any idea how to generate javadocs for kotlin?
Language
you dont use build artifacts btw
Imagine speaking java
if you have maven you go to the maven tab and in the lifecycle you click package
but isnt that overkill to check like that on player move like especially if there is large number of players
i dont use kotlin sorry
it's ok
thats why you only check if they move a whole block not every move event
any system requiring you to have javadocs is shitty anyways..
maven central 🙂
how do i know if it is whole block ?
Check console errors
none
Check if getBlockX/Y/Z change
yeah im glad I dont interact with maven past simple dependency stuff
I think you need to have on command event
getBlockX in getfrom and getTo and compare
well i can also check if they are not in areas like spawn and part of map where there is no pvp or bases so that would also cut out some part of map
ill try thank you
Is it possible to use custom items in custom crafting recipes?
RecipeChoice.ExactChoice
Type in chat: /help Utilities
correct. If your areas are chunk based its even better you can bit shift to get the chunk x/z <<
Thank you
all of my commands just stopped working
It says Canot resolve symbole A, B and C and Cannot resolve method getWorld()
switch (getWorld()) {
case A:
new VagtshopA().open(player);
case B:
new VagtshopB().open(player);
case C:
new VagtshopC().open(player);
}
WHAT IS HE DOING 🔥🔥🔥
oh my god
i am going to commit blanket
Check plugin yml
this looks like some python level code
.
yes i mean if i would only allow chunk claims that would be much much better but ill just do it like this with them claiming claim as they want 🤷🏻♂️
Nah even python can’t pull worlds from midair
learn java right now
go find a video
Bro Code has a good 12 hour video
take it slowly
earn syntax and coding basics
you cannot code SHIT if you don't know the language
it's like you came to China and you only speak Kazakhstan language or something
but in your case it's more like an infant that cannot talk at all
so please
writing an essay before knowing the alphabet
The good news is once you learn one language all others will be much easier
for the sake of everybody's braincells here
EVEN SCRACH CANT
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
^
00000000
we are not going to spoonfeed you code
we can give you concepts and ideas
now proceed
Java tutorial for beginners full course
#Java #tutorial #beginners
⭐️Time Stamps⭐️
#1 (00:00:00) Java tutorial for beginners ☕
#2 (00:20:26) variables ❌
#3 (00:32:58) swap two variables 💱
#4 (00:36:42) user input ⌨️
#5 (00:44:40) expressions 🧮
#6 (00:49:13) GUI intro 🚩
#7 (00:55:01) Math class 📐
#8 (01:01:08) ra...
@quaint mantle
Best course ever
Bro code>>>
agree
Learnt c# with him
clearly they arent in the mood to learn so dont spend too much energy on it
generics does not always lead to good code
How i can connect database with my plugin and on command search the whole database to find the value given by player in args
that looks fancy
elaborate?
Doc worked on it for a while :)
On discord bot sends you a password also adding it to his database, and in Minecraft on command /verify (password) plugin searches for password in the database and if it found it, it connects the server account to discord server
Oh no passwords
somebody is going to be looking for a new faster god particle farm now
don't save the password to the database, instead save its hash
Not like passwords, like: sUA8492Yial9 or sum like that
Random
Why though
imagine if discord stored passwords in plain text
well they just need to get your db login
someone hacked the database
If you're building an app or product, you need to store your users' passwords securely. There's terrible ways to do it, like storing them in plaintext or encrypting them, slightly better ways like hashing or hashing and salting, and even better ways like bcrypt, scrypt, or argon.
Sources:
https://gist.github.com/epixoip/a83d38f412b4737e99bbef...
How hack
oo ty
everything is better with a pinch of salt
i am not a hacker i don't know how they do their shit
even passwords
You should always hash and salt your passwords
watermelon?
With a suitable modern hash algorithm
yes
😭
have you ever tried it?
Decode plugins/brute force/database exploits
no
exactly
Oh wait I just told this to myself
well now you know that your database can be hacked
Even if it’s just for minecraft people are dumb and will re-use their bank password
Okay nvm
so don't store plain text passwords and stuff
Why dumb, I do use it
your system needs to be made so that the stupidest users can use it
(it's "password")
Watch the video 
the smartest will figure it out eventually
Also, would I get sued if I could gain access to players passwords that they enter to register to server?
JavaPlugin#getDataFolder()
thats the plugins folder?
It’s probably illegal under some GDPR law
to get the plugins folder
oh
yeah perhaps
also, is there a way to get all plugins installed on the server?
but that counts for the enabled ones, right?
declaration: package: org.bukkit.plugin, interface: PluginManager
currently loaded plugisn
alright...
if you want ALL plugins, go to the plugins folder, go through each jar file, read its plugin.yml and find the "name" field
cuz my goal is to make a plugin that enables only one random plugin in the plugins folder
oh
i think you'll have to do something with https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/plugin/java/JavaPluginLoader.html
declaration: package: org.bukkit.plugin.java, class: JavaPluginLoader
cool
alright
so just select a random .jar file in the plugins folder and pass it
wait, could i theoretically have a seperate folder inside my plugins folder to house all the plugins, and then i choose one and enable it?
ofc
but the problem with your idea is that some plugins have dependencies
so if the dependencies in question are not enabled the plugin also won't be
if you want to go above and beyond, read the jarfile's plugin.yml, find the dependencies and launch every dependency before launching the plugin
shouldn't be extremely hard
(for each of those plugins you'll also have to check their dependencies lol)
Hi everyone, i have this class to create custom files. The thing is to load the files on enable. Also please suggest me any changes. https://paste.md-5.net/noxatoqogi.java
even EASIER, JavaPluginLoader#getPluginDescription takes a File
there you can find the dependencies
you don't even have to read the file's contents manually
or just put all the plugins you want to select in a folder in your plugin folder
then you have flexibility and you can enable the dependencies always
yeah isn't that what roxy wants to do
xd
so it was my idea
So when player join , i get his info(at the db) and i stock it in array
if you have a table with all the players' data you can just fetch the entire table on startup
to a hashmap for example
like <UUID, Parameters> where Parameters is your custom class with the table data
write all the modifications to the hashmap
periodically upload it to the database asynchronously (like every 120 secs)
and upload it on shutdown
all store in a hash map (for example if there are 1500 players registered in the db) its not much?
and do a query each time a player joins the server that could affect performance?
the time when performance arguably matters the least is the startup, thus you should query everything on startup
but indeed it would be optimal for the memory to query when a player joins
if you want that, you can do that
make sure to run the query asynchronously
are you creating a public plugin or a private plugin?
and even for example if I want to recover information in a table of 1500 lines is not much? knowing that between the start and the stop there will be a maximum of 50 different players
Private
you should try both querying everything at startup and querying data on player join
how is it?
track your memory usage and tps and see what works best for you
use futures
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
not the best guide but it works
what interest?
?
How to ban player from all servers with spigot plugin (bungeecord proxy ban)
so in my place you will load all at startup or only when a player joins?
try both
separately
make it so it saves everything at startup, run the plugin for a couple hours with some players and track its memory usage and tps
then make it so it saves data on join, run the plugin for a couple hours with some players and track its memory usage and tps
with whichever performance you are most satisfied, you should pick yourself
ah also, I have a gui system where the player chooses his options, so asking the db for his options every time the player makes the command is not a good idea?
players shoudl only have dirrect access to the lobby a ban there shoudlprevent them joining any server as there should not be any direct path to other servers
I not have players
Is there a way to ban player from proxy, not hub?
of course you shouldn't query the db on command
no
not unless you write your own bungee ban plugin
Well then how to ban player on other server?
you don;t
What?
when a player joins they should be sent to a specific server (lobby)
Yes so if I'm on other server like pvp and I want to ban a player on lobby how would I do that
you ban on lobby. how you do that is up to you. Console, bungee plugin whatever you want
Ah else, i create a "copy" of my table un array and and all queries are made to the board directly, then I save it from time to time
yes, query the table on startup into a hashmap (or load data from players that join into that hashmap), and apply all the changes to that hashmap
occasionally upload it to the database to not lose progress
you got it
That's what I'm asking, how to ban a player from other server
Like if I'm on game #1, then how to ban player from lobby
you would have to write a plugin to host on all servers to forward ban/kicks
or at minimum a bungee ban plugin
don't reinvent the wheel https://www.spigotmc.org/resources/advancedban.8695/
And what is the best storage méthode (like array) to get my table and can use query like sélect, insert etc....?
it should work with or without
without
hashmap
<UUID, YourDataClass>
why does saving a project as a template fuck up this stuff?
but with a hashmap I could srock only 1 value per column
Ah okay dataclass
Is optimised ?
hashmaps are fast yeah
everything in java is made to be as optimal as possible to the extent of the language and the java virtual machine
what makes certain things not as optimal is if the end developer, you or me use these tools wrongly
yes thats what i was asking
The restart command and that method will try to run a startup script specified in the spigot.yml
can you teach me how to enable restarting?
Set restart-script to the startup script
in the spigot.yml
Yes
which one?
.
Do you start the server with a script called start.sh
im my server host, there are buttons to restart or to starrt
Have anyone here used LibertyBans API before?
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!
is it acceptable to name a function in UPPER_CASE if the function acts like a getter for a constant value that needs a parameter, or should it be lowerCamelCase anyway?
fun DISABLED_KEY(plugin: JavaPlugin, enchantmentKey: NamespacedKey): NamespacedKey = NamespacedKey(plugin, "disabled_${enchantmentKey.key}")
lowerCamelCase
alrighty
only constants are upper case, and constants require no arguments
yeah good point
will the permissions be removed from the player after a restart?
a player object does not persist through restarts
so lp adds permissions to the players each restart?
upon joining
oh okay
permissions are in attachments which only live as long as the player object
so even if the player rejoins the permissions are gonna be removed?
is the max size of an inventory (9*6)?
Hello. I change the block type from diamondore to bedrock and then back to diamondore in the code. A player with a pickaxe with an efficiency of 10 after switching to diamondore blocks the second time he mines slower. From what I understand, this is a client side bug, is it possible to send a packet to the player to fix it?
your description is not clear
you are changing the block he's mining to bedrock to prevent/slow his mining?
would a Player#sendBlockChange achieve this?
so i dont have to use protocollib to slow down the block breaking progress???????
Sorry for bumping this, but I'm still unsure. I got a couple responses which I didn't quite understand but I think those responses were just for getting a list off such blocks, whereas I'm wanting to identify if a given block is one of these and then get the block it is attached onto
There seems to be a version for both Material and BlockData, but both are pseudo-deprecated
Yes, Attachable itself isn't deprecated, but all the implementing methods are, which is why I said pseudo-deprecated. Like, as far as I can tell, everything that uses it is deprecated, so it might as well be deprecated itself
No they aren't
Oh right, ye the BlockData version only includes HangingSign, Tripwire and TripwireHook, so it's missing a lot of things such as normal signs, torches, ladders and chrorus fruit
@eternal oxide https://www.youtube.com/shorts/PB1W_jb0CNk i upload a video
Well those aren't attachable
So that'd make sense
@icy beacon so i ended up doing this:
but it still somehow disables the plugins
can you help me?
How are they not Attachable? The Material version of Attachable includes all of those, and I understand Attachable to mean that the block breaks if the block it is placed on is broken. For example, if you break the block a torch is attached to, then the torch itself also breaks. And that's the specific thing I'm trying to identify
I guess you didn;t update teh blockData fully when you changed its type
Because things have changed material version is deprecated for a reason.
You'll need to make a set yourself
Hmm
i just make setType only
no clue then
Directional covers a lot of attachable blocks, but also some that aren't
Yup, and I believe it misses some too because I don't think torches (not wall torches) are directional, but they depend on the block below them
Actually nevermind that must be wrong, Attachable itself extends Directional and Torch implements Attachable
But still, as you say, I need some way to filter between Directional blocks which can stand on their own and those which can't
nevermind fiyxed it
what was the cause?
btw why are you throwing a new exception instead of doing e.printStackTrace()?
wasnt in plugin.yml probably
Is there any simple, already made way, to check if a player is standing within a certain block?
Specifically, I have something like a "wand" that places blocks on the block relative to the face of the block they clicked. But I don't want that block to be placed if the player hitbox is inside of that block
As if placing blocks normally, basically. The block gets placed where you want it to, but not if you're standing inside the block
My initial thought is just to write my own method to check it, but I was wondering if I could avoid that
wdym
if (block.getBoundingBox().overlaps(player.getBoundingBox())) {
// code
}```
Check if that intersects the players bounding box ^
or you want to check it before the block is placed?
Thank you, this is what I meant
don't you actually want to check it before placing the block?
like on the click
so block won't even be placed
not placed + checked + deleted
Yes, I will be doing that
I was looking for that overlaps function
hello, i have a little problem
I cant seem to get the real name of an item when its not renamed or something
this is because when there is no name it is set do "" by defailt (an empty string)
but i want to get the default name then (and i could do that by doing item.type.name to get the material name, but thatone is full caps with underscore, i would rather not)
(code is kotlin, but dont worry, non of it is important exept the underlined)
Kotlin💀
more like: Kotlin😌 😍
XD
but all things in java work for kotlin, so shoudnt be a problem, i dont mind getting java selutions
Maybe itemstack is null?
I made my own function for it cause I never found out. Give me a sec
oh yes plzz 💛
It can probably be better, but this is what I use
public static String displayNameFromMaterial(Material material) {
StringBuilder itemNameBuilder = new StringBuilder();
String[] splitString = material.name().toLowerCase().split("_");
for (String s : splitString) {
itemNameBuilder.append(Character.toUpperCase(s.charAt(0)))
.append(s.substring(1))
.append(" ");
}
return itemNameBuilder.toString();
}
yea, tried that but isnt its sadly just an empty string
declaration: package: org.bukkit.inventory, class: ItemStack
If string null or empty
pls help https://www.youtube.com/shorts/PB1W_jb0CNk 😭
yea but then i still need the name from somewhere
but yea i think will make a method with yours as reference (cus kotlin :P ) thnx
Would this work?
fun displayNameFromMaterial(material: Material): String {
val itemNameBuilder = StringBuilder()
val splitString = material.name.toLowerCase().split("_")
for (s in splitString) {
itemNameBuilder.append(s[0].toUpperCase())
.append(s.substring(1))
.append(" ")
}
return itemNameBuilder.toString()
}
i think so haha
amazing
btw, you forgot one thing :P
TNT
if word == tnt, all caps
💀
XD, stupid exeptions
I did use chatgpt for that rewrite just FYI
Now I gotta go over and figure out if there's any other names I need to account for lol
dont worry, thats the only one i think
because its the only name that isnt really a name but more a shortening or something
oh wait, but the of in potions >:)
they are not capital
That code is not correct
They will be 😠
It assumes string have only one underscore
Also String.join exists, that for loop is not needed
Ok I misread, nvm
fun formatMaterialName(material: Material): String {
val name = material.name.lowerCase()
val words = name.split("_")
val formattedWords = words.map { word ->
when (word) {
"of", "on", "a" -> word
"tnt" -> word.uppperCase()
else -> word.capitalize()
}
}
return formattedWords.joinToString(" ")
}```
this is the correct one
public static String formatMaterialName(Material material) {
String name = material.name().toLowerCase();
String[] words = name.split("_");
StringBuilder formattedName = new StringBuilder();
for (int i = 0; i < words.length; i++) {
String word = words[i];
if (word.equals("of") || word.equals("on") || word.equals("a")) {
formattedName.append(word);
} else if (word.equals("tnt")) {
formattedName.append(word.toUpperCase());
} else {
formattedName.append(Character.toUpperCase(word.charAt(0))).append(word.substring(1));
}
if (i < words.length - 1) {
formattedName.append(" ");
}
}
return formattedName.toString();
}``` and this might be it for java
Carrot on a Stick TNT Potion of Blabla
Why do I need StringUtils lib for capitalizing a word in java :(
You don't technically
lol, looping through the chars and map them to its capitalized counterpart XD
I know, I just did it on my own since I was tired of needing that lib just for one specific use
But if the word is TNT just return TNT right away?
If you want all caps you can just .toUpperCase
getMapList
Otherwise .substring(0,1).toUpperCase + .substring(1).toLowerCase
TNT_Minecart is one too, but I assume you accounted for that?
yup
because they will all be split
oh wait, is it TNT_MINECART
cus that will be TNT Minecart
Yeah yeah
Dawg I forgot to account for potions in my plugin.. 💀 That's a whole can of worms I don't feel like opening up right now tbh
potions? you mean with the text? because thats only adding the "of"
fun getRealName(material: Material): String {
val name = material.name.lowercase()
var words = name.split("_")
if (words.size == 2 && words[1] == "minecart") {
words = listOf(words[1], "with", words[0])
}
val formattedWords = words.map { word ->
when (word) {
"of", "on", "a", "with" -> word
"tnt" -> word.uppercase()
else -> word.capitalize()
}
}
return formattedWords.joinToString(" ")
}```
this is the newone btw
nono it's a different thing, the names are just for a display name
well mc decided to commit seppuku when trying to load it in 1.18 so I guess I'm only supporting 1.19+...
good luck translating it to java lol
at least 1.19+ adoption is high, for once
I kinda wanna swap to kt now ngl
Why does the menu only open if i am op?
1, 2, 3 and 4 is getting sended in the console
} else if (line0.equals("SHOP")) {
System.out.println("1");
if (line1.equalsIgnoreCase("-----")) {
System.out.println("2");
if (line2.equalsIgnoreCase("Click here to")) {
System.out.println("3");
if (line3.equalsIgnoreCase("Open the open")) {
System.out.println("4");
if(player.getWorld().getName().equalsIgnoreCase("A")){
new VagtshopA().open(e.getPlayer());
} else if(player.getWorld().getName().equalsIgnoreCase("B")){
new VagtshopB().open(e.getPlayer());
} else if(player.getWorld().getName().equalsIgnoreCase("C")){
new VagtshopC().open(e.getPlayer());
}
}
}
}
}
Hey guys is there a way to remove enchantment restrictions without doing it manually?
i mean, you do what you want to XD
But i love kotlin, its way cleaner, everything you can do in java you can also do in kotlin (because it has everything from java)
but not vice versa
also its just way more fun to write (first and last time i am making this joke)
anyway, if you want to make a plugin in kotlin, it requeres some setup work so if you want to do it just hit me up and i show you what things need for your gradle file (because i use gradle)
im finding where you live and coming to steal your doors and batteries
and window panes
😳
Anyone who knows whats wrong?
fun
💀
you too
does it send it to when you're not op?
Could you be more specific?
Probably something further up? I would also look into guard clauses instead of nesting super far in with if statements
?arrowcode
You want to allow things like Efficiency 6 etc?
get @young knoll to tell you how he rewrote the anvil code and enchanting table code
Yeah, basically remove every restriction that makes sense. I dont want armor to get sharpeness, but i want sharpeness to go above 5 levels
How would I get entity damage entity event when player is damaged by an arrow
I think do what EpicEbic suggested
@young knoll stop being canadian and get in here
essentially yes
use ur eyes coll
welp, thats not good
It means you get to control the entire flow yourself! :)
if you want higher protection levels you get to rewrite even more server code
haha thats actually a good thing tho
It wasn't too bad to rewrite
You just have to work your head around the Mojang spagehtti
but it kinda makes sense, cause the calculation for the enchantments isnt actually part of the event, it is probably made outside the event
you got into the actual vanilla code?
oh enjoy the math too
Cause the way i was doing rn is using the minecraft wiki
They kinda show the whole math
Yes
wrong link
lul
right link
a minecraft decompiler?
you get to see the mojank spaget
spaghetti or not spaghetti, if it is saving my time i take it
how do i load a world after creating it ? i searched up on spigotmc forum but none covered the case in which i want to create and load a world without restarting or reloading, kind of like how multiverse core does it
Yeah it does
but hey, is there any big game this days that doesnt have a spaghetti code?
?paste
the enchanting stuff is in the server side, right?
yeah
it gives me an option to decompile, but isnt he already decompiling?
no clue, used it like once a few weeks ago
wdym ?
@young knoll wheres ur anvil code gone
Idk
i choose decompile but i dont know what is the difference
pretty sure if you dont select decompile it will only remap
so check decompile if you want to see the actual code and not only get the obfuscated jarfiles
i suppose, since im not sure
oh that makes sense. for some reason i thought the program would just decompíle
but i dont know why someone would need only the remap
to download the jarfile and use it somewhere without it being decompiled, idk
Anyone knows why i only can open the menu if im op?
https://paste.md-5.net/gimucutexe.cs
where can i ask my spigot coding related doubtts
here
Idk if this is why but you check if the player is in a group called admin or h-admin
Its for when a player is writing the first line on the sign so everybody cant
alright i was thinking if i could check if player's helmet isnt air [ this part is done ] if isnt air then i want to add exact item to player's inventory and add something else to their helmet slot [ a itemstack ]
public static void spawnOresShopNpc(Location location){ Villager oresshopnpc = location.getWorld().spawn(location, Villager.class); oresshopnpc.getLocation().setYaw(90); oresshopnpc.getLocation().setPitch(0); oresshopnpc.setCustomName(ChatColor.GREEN + "Minerals Shop" ); oresshopnpc.setCustomNameVisible(true); oresshopnpc.setAdult(); oresshopnpc.setInvulnerable(true); oresshopnpc.setProfession(Villager.Profession.NONE); oresshopnpc.setAware(false); oresshopnpc.setRemoveWhenFarAway(false); oresshopnpc.setSilent(true); oresshopnpc.setAI(false); oresshopvillager = oresshopnpc; } }
So for some reason this doesn't make the villiger face forward at eye level
It faces the direction that im facing when I do the command
it takes my location as the parameter "location"
Anyone knows why i only can open the menu if im op?
https://paste.md-5.net/gimucutexe.cs
use permissions not groups
But i wont fix it
the correct implementation is permissions not groups
Okay so if im changing it to permissions your are saying that it would fix it?
so long as you give the correct permissions
or check player.isOp()
hey, i was searching the decompiled code and didnt find where is the enchantments conflict code. do you remember where you found it?
i didnt find it, coll did
Thats not the problem
The problem is its not working if im not open it works when i am op but its bugging when its open as op
@young knoll
not just anvils, when you're enchanting on the enchanting table
and when a villager offers you an enchanted book
That's handled by each enchantment
i searched like "sharpness" and found only registration and name stuff
can you send the open() method in your shopA class
on the Enchantment class?
Hello there! I need help with plugins.
1st. I am absolute beginner and I need complete guide of how to start.
2nd. I want to know exactly which one to choose between Spigot and Paper.
3rd. And also about Spigot/Paper documentaion with explanation of each component.
Could anybody help me, please?
Do you know java
As somebody who started with Spigot right away without having knowledge of Java, I recommend being familiarized with it first lol
If I make a data pack with a custom item, can my plugin add functionality to it?
Yes
but how to find normal guide for that also I have trouble with core cuz it is not free
?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.
Would I get the item with Material.matchMaterial("datapackname:custom_item")
Oh i found it. it seems mojang creates a enchant type and you cant two or more of the same type when enchanting. so i have to just copy everything but the type restriction and just edit the cap restriction, i guess
Does datapack register items in the registry?
No
There are plenty of free resources! @chrome beacon has provided some and recently a PDF of "Java in a Nutshell" has been published for free on Red Hat website. I'll link it ASAP
Datapacks can't even make new items
Oh, how do I make new items in game then?
You modify a vanilla item and act like its a new one
Pretty much
@vague violet here's the book, https://developers.redhat.com/e-books/java-nutshell-guide it's the latest edition and is an awesome resource for both beginners and experienced java devs
for people who struggle with java, is kotlin a good alternative?
no
what are the downsides, or it's just a preference thing
Could I technically use player heads for custom items or no
if it is in the game, i dont know why wouldnt be possible
Use a resource pack and customModelData
bukkit api has a feature called metadata, is very useful for this type of tasks
Would I be able to give this player's head one texture and another player's head a different model?
but if you want to change the texture a resource pack is required
idk if it's possible to change vanilla textures with vanilla textures without a mod or resource packs
you dont even need a texture pack to change a player head's look
depends
checkmybio
its good alternative, but not if you are struggling with java
i mean, with someone wants to code something in java
i'm not actually struggling, but its just so verbose, just to create a single class i get a bit tired
That's the point of java
It's so verbose that you never "not know" what you're doing
not really
Kotlin is just java with a different vision
i mean, ok, it "forces" you do better code
not better
Just that it forces you to always understand what's going on
if you see a public void whatever
You know it's a method of the return type void, with public visibility towards other classes
i know but if you're doing something small or simple, it just overcomplicates it
What event gets fired when stripping logs?
go google c++
Takes longer to write but you never end up confused
java already simplified much stuff
i think the rightClickEvent and check what block he is right clicking
java has better community support
i know a bit of c++
c++ is even more low-level
everybody know "a bit" of it
sure it's less verbose but harder to read
but imagine doubling amount of files in your project and doubling amount of code in first half of them
just write all impl in header smh
