#help-development
1 messages Β· Page 1833 of 1
Nah itβs probably before his time
im 80% sure thats due to encapsulation of the object (for example, Conversation object includes this method)
Maybe back in the dinnerbone era, no idea how old the convo API is
API wouldnt really like this
I like the fact that spigot has a rule that premium plugins must not be drug plugins lmao
it could create recursion bombs
All drugs must be free
Makes you wonder how many drug plugins were released as premium before that got added
quick question - someone here running macos?
yeah or at least attempt to get released π
probably most people doing drug plugins were on some drugzz
how old is conversation api
pretty old I guess
tbh
gradle is bad for me
yes
just to do some coding
don't you have coding in school?
oh
π€‘
yeah my first programming in school was
"Hamser Simulator"
you controlled a hamser using java
my spigot fork is gonna be named Faucet
Whatβs a hamser
why don't you call it Sink
erm
no
yeah sorry I fucked up my keyboard and now some keys don't work all the time
how do you code???
it works 99.5% of the time
but yeah sometimes it doesn't, then I slam the key hard enough and it works again
I should give my keyboard a bath and then stop smoking at the pc
it's the ashes that fall into it while typing what's fucking up the keys lol
you know what's funny?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
there's no link at all in there to go to the spigot code
why do spigot need my address to let me contribute?
for the CLA
WHY
whats wrong with giving your address
All information is kept strictly confidential, and is required in case we need to contact you about your contribution(s).
for example
they will come and visit me? lol
:))))))
imagine you contribute code and then somehow it turns out you stole that code
spigot must give your name then so they aren't in trouble
and address
there must be someone to sue π
how would someone prove i stole their code?
that's up the judge
its pretty obvious just by looking
yup I used int i = 0 in a for loop
isn't that possible that i make the same functionality with similar code/
if someone can prove they had identical code before you contributed to spigot, the judge might say "well I believe them" and you're rekd
sure
I believe a single class is hard to claim that someone has stolen
as said, it's up the judge whom they believe
STEALER!!!!!!!!!!
But the bigger the amount of stolen code is, the more obvious will it be
I helped someone with making something work then they used my code in a developer application
in most countries, the judge will judge you by what they believe and not what was 100% proven right
I'd have been fine if they kept the comments that I put saying I made it to help them make their code work, and kept the comments explaining what it did, but na they passed it off as their own so I got in contact with the admin abt it keksad
e.g. if someone gets shot, and the bullet gets somehow connected to your gun by investigations, and you don't have an alibi for that day, and you actually knew the dead person, and you also have burn marks on your hand, and you can't explain where they come from - that's not a 100% proof that you shot the person, but you'll get arrested for murder anyway because the judge thinks it's like 99% likely that you did it
at least that's how it works in germany
TL;DR and spigot doesn't want to be responsible if you shoot someone so they want your address lol
LOGIC
ikr?
i HATE chrome
why can't I keep Ctr+W held down to close many tabs
I have to repeatedly press it
no π¦
okay I'm in a bad situation
I want to add a method to org.bukkit.entity.Player to get the total experience
but
getExp() and getTotalExperience() already exist
so.... how would I even call that method
getTotalExp
yeah but kinda clashes with getTotalExperience
to confuse everyone
maybe getExpIncludingLevels()? idk lmao
to disable people from chatting would I need to use the AsyncPlayerChatEvent?
yes
in php it would be
get_exp()
getTotalExperience()
get_real_totalExperience()
probably
which file am i supposed to add to my server's plugins dir??
i have question
WHY WON'T SOMEONE ADD API FOR NPCS IN SPIGOT???????????
depends. probably the second one
SpawnerTag-1.0-SNAPSHOT
well, do it
You cant use lambda with object#getClass() right?
One its the shaded jar, and the other its compiled without shading
wdym shaded?
shaded its a maven plugin that put maven dependencies/libraries inside the jar
the external dependencies are relocated into your jar
so what file do i add
You should use the shaded one
the one WITHOUT "original"
Yeah
ok
Who uses intellij idea?
thats the one i add, its recognized but doesnt work π¦
me
Do you know about maven repositories?
https://www.spigotmc.org/threads/api-player-getrealtotalexperience.538652/ please reply, I want to get started π
nope
I do
Oh ok
what's your question
nah im just sad because my plugin doesnt work :((((
I want to ask which maven dependencies i should need to create simple repo accessible from outside
all you need is a webserver
i think you are getting confused here
however there are better ways, e.g. installing Nexus
do you mean deploying your artifacts?
Yeah
I want to code a simply backend
other stuff like jitpack exists but it sucks
yeah they are too complex and have problems and many things
it gets the job done tho
so either
- Use an already existing repository
- Host your own. You only need a webserver, but better solutions like Nexus exist
I could also give you write access to my nexus thirdparty-repository
Really thanks, but i wanna to experiment more with NodeJS, Express (and his dependencies)
if you got a VPS somewhere, just install nexus via docker and host your own stuff
it requires about 2GB of RAM though IIRC
docker sucks
I know, I don't like it too
you can of course install it without docker too
but for stuff like nexus that come with a TON of dependencies, it's just way more comfortable
is there someone here that can help me with code? it isnt long (about 50 lines)
?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 only use docker with my pc servers. I have 2 servers with 64gb of ram and 16 threads so its fuck me
can you catch any/all console errors within a plugin?
then get some nexus installed and you're done
And i use docker for sync the machines
yes but it's stupid
so ill just send the code and say waht i expect ot happen?
yes
?paste it here
how could you do it?
I wont install it via docker because every i install something the fucked servers get disconfigured from the cluster its a yeat man
well surround everything in try/catch. But that won't fix anything
no i am talking EVERY exception
even other plugin's
Nexus is complicated. I would really use docker for it, but do what you want to do π
you can't
and also
why would you want to do that
to get rid of error messages?
I don't mean like stop from throwing, just getting th ename of exception
My face its like are u trolling us :funny:
you already have the name of the exceptions - it's in the logs π
I'm not trolling anyone lol
at least not here :>
yeah tho not from the logs, talking about the plugin just being able to read the exception that are thrown
it doesnt let me send the .java file
I use quora to troll people lmao
?paste
why do you want that??
What reason.
Lol
Console its enoguht
what you want to do makes no sense and you should just forget that idea
exceptions are thrown for a reason
how?
you should get rid of the reason instead of just catching the exception
didnt understand
^^^
just a blue screen with some commands
yes, paste your code there
sorry didnt know you never used any pasting websites before
I just want to collect the exceptions (not stopping from throwing), and just send it to my own server where i can try to figure out if there are incompatibilities
paste code and press ctrl + s
paste your code then click the "save" button and send the link
But why lol??
Not sense
and then
copy the link (the url) and sent it here
copy/paste the address from your browser's URL bar
wow you are so faster bruh
okay, so what isn't working?
expected: it places a block when the world generates, every time that block is mined - it reapears with a chance to be a spawners
first of all
present: only spawns once at world gen and doesnt respawn
No why you dont use the {} its break my eyes
you never register your events
yeah btw
you must register your events in onEnable
i explain him
second of all - your class does not implement listener
I think i found a way
no you didn't
yes i did
because there is none
let me test it
im sorry if im bothering yall, im just trying to make a plugin for me and my friends and its my first time
show me please, maybe I understood you wrong
in your onEnable method do:
getServer#getPluginManager()#registerEvents(listener, plugin instance)
can you send a tutorial or tell how?
yes so please listen π
- Make your class implement Listener
- Register your events in onEnable using Bukkit.getPluginManager().registerEvents(this,this);
and what listener to implement
Your listener class should implement Listener
org.bukkit.event.Listener or sth like that
I found a thread (albetit pretty old), about reading the console, and something caught my eyes (https://www.spigotmc.org/threads/how-to-read-console-real-time.282460/#post-2736475)
what?
@cinder tusk Read this please: https://www.spigotmc.org/wiki/using-the-event-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i confuse with people sorry
alr
so class SpawnerTag extends JavaPlugin implements Listener?
and then, register your event listener in your onEnable() method, I sent you some code here
now your event listener methods should get called
i recommend you creating a class for that listener, so you dont have a mess on the main plugin class
you will probably get a message from them π
oki
y'all are doin' a mighty fine job in here yeehaw
@tender shard I got it
i added a filter to the main log4j logger
everything logs to that
i can intercept messages
yes but I thought you wanted to CATCH those exceptions
of course you can get what gets logged
thats really bad
I thought you wanted to CATCH the exceptions
like
try/catch
that's why I kept saying that's not possible and a bad idea π
yeah i am aware, and its really a bad idea xD
yeah sorry, misunderstanding π
no problem, its alr
still doesnt work π¦
switch (this) {
case ADMIN:
return ChatColor.WHITE + "[" + ChatColor.DARK_RED + ChatColor.BOLD + "Prince" + ChatColor.WHITE + "] " + ChatColor.LIGHT_PURPLE;
case JRADMIN:
return ChatColor.WHITE + "[" + ChatColor.GOLD + ChatColor.BOLD + "Count" + ChatColor.WHITE + "] " + ChatColor.LIGHT_PURPLE;
case SRMOD:
return ChatColor.WHITE + "[" + ChatColor.YELLOW + ChatColor.BOLD + "Viscount" + ChatColor.WHITE + "] " + ChatColor.LIGHT_PURPLE;
case MOD:
return ChatColor.WHITE + "[" + ChatColor.DARK_AQUA + ChatColor.BOLD + "Seigneur" + ChatColor.WHITE + "] " + ChatColor.LIGHT_PURPLE;
case JRMOD:
return ChatColor.WHITE + "[" + ChatColor.DARK_GREEN + ChatColor.BOLD + "Baron" + ChatColor.WHITE + "] " + ChatColor.LIGHT_PURPLE;
case ETERNAL:
return ChatColor.WHITE + "[" + ChatColor.LIGHT_PURPLE + ChatColor.BOLD + "Eternal" + ChatColor.WHITE + "] ";
case SAVAGE:
return ChatColor.WHITE + "[" + ChatColor.RED + ChatColor.BOLD + "Savage" + ChatColor.WHITE + "] ";
case LEGEND:
return ChatColor.WHITE + "[" + ChatColor.AQUA + ChatColor.BOLD + "Legend" + ChatColor.WHITE + "] ";
case ULTRA:
return ChatColor.WHITE + "[" + ChatColor.GREEN + ChatColor.BOLD + "Ultra" + ChatColor.WHITE + "] ";
case DEFAULT:
return "";
}
return null;
}
}``` how would i make this return the rank? cause currently rank is null
let check again
thats the updated code - now another problem. for ome reason it doesnt generate the block at the expected location
What is this
its supposed to generate at -627, 93, -1431
So you have something wrong on the events or on the method
wdym rank?
it generates in -626, 95, -1430
?paste
proably both but i dont know why
this hurts my eye. please at least use syntax highlithing next time π
its for displaying the rank of the user
getServer().getWorld("world").getBlockAt(-625, 94, -1430).setType(getTypeByChance());
Shouldn't that be 93 not 94?
well first of all you are returning null
getting the prefix rather
so thats not good
ik thats the problem. idk how to fix it
wouldn't it be better to pass the prefix through the enum constructor and make your getPrefix() method return it instead of using a switch statement?
now i dont recommend saving the prefix in the code
oops it generates at -625, 94, -1420
save it in the config file
30*
I recommend u talking your time and read and read again your code
and load it in the memory
Yeah because that's what block you're getting.
yes, definitely
but im not sure how to return the rnak
You typed 94 instead of 93 lol
switch(this) is always a very bad idea
wheree is that line?
In the break event
how would i do that?
Same thing you did with the level
missed that line thanks
Yep, you should use braces there instead of one lining it.
So that doesn't happen π
still the same position hmmm
Shahar i recommend you reading more about basic Java and the SpigotAPi
It ill be easier for you
It's setting the block one above instead of the one you break I assume?
If so, you didn't upload the new plugin and restart
enum Ranks {
ADMIN("<prefix>"),
JRADMIN("<prefix>");
private final String PREFIX;
private Ranks(String prefix){
PREFIX = prefix;
}
public String getPrefix(){
return PREFIX;
}
}
i did
code example
A question why using enums? and not a config.yml file?
junior admin 
this is probably a noob question but why isnt the second if statement in this working https://paste.md-5.net/ewinivipax.cs
the code is in a BukkitRunnable, the first if statement works just fine
taken from their example
its the same wrong pos
ugh those uppercase field annoys me lol
and why a variable in cappital letter that against some "developing rules"
yeah UPPERCASE is for final static fields
"naming convention"
-625, 94, -1430
i fixed everything
Yeah you didn't update it then
Like local variables should start with _ and not uppercase letter, etc
I love hardcoding locations

ill try again
yes I do it all the time
its giveme visual things that
I dont like harcoding code. But for testings its essentially
you make one typo and the whole thing is wrong
only hardcode locations.
You better not be naming things with _ in Java sir
it's fine for STATIC_FINAL_FIELDS
Lol, a Senior Developer told me that
if someone could help me i would rly appreciate it, i cant seem to figure it out and im kind of in a time crunch
He said starting with
ah okay
yeah _stuff is used internally in some things
don't use it
Isn't that a C# thing?
cuz he is a .Net developer
it's a thing in many langs
Yeah that's why, doesn't apply to Java
but in java, please dont
Ok thanks
it wont break anything though
^
It breaks our hearts 
just use the coding conventions you like when you're writing code for you, and use the coding conventions your employer likes when writing code for them
I think I will use uPSIDEdOWNcAMELcASE from now on for all my stuff

How would I go about removing hearts from a player? I dont mean like dealing damage but removing an actual heart?
isnt that the same?
removing hearts = damaging the player
and i hate doing loop without lambda expression
I think they mean like, lowering the max health
ah yes
so 20hp then 19hp
Is lombok included with spigot? If I want it I would have to embed its jar as a dependency right, which would be inefficient if other plugins are also bundling it.
it's not but you dont need to shade it
it does stuff at compile time
Ohhhh is that so, hell yeah π
yea thats what I mean, how would to do that?
so I don't need to include it as a dependency eh
I'm pretty sure there's a max health attribute for that
Just lower it
well yes, in your pom or whatever, you need it as dependency
but you can set the scope to provided so it doesnt get shaded into it
okay thanks :D
bawlin π
anyone? π₯²
probably the player isnt sneaking lol
Object#getParameters() in java return all what inside method () right?
it should return all the classes of the parameters
it was tho
does no one really know?
its driving me nuts
i swear i tested it so many times
If the first if statement is executing & the second one isn't, then they aren't sneaking.
There isn't another option
Oh
the first one should not have to execute for the second one to
Put it outside the first one then
it is
oh the formatting just sucks
why? there's no else or return
yes, they are separate right now
i cant find why this isnt working
show the full code of that class pls
ok
i deleted the traget dir to regenerate it and it didnt generate a JAR... what should i do?
https://paste.md-5.net/izeweqaran.cs plz dont judge btw
im not the best java programmer
You are not using a build maven plugin
thas a lot of ifs
it worked last time
ik
ill restart intelliJ
Paste pom.xml on ?paste
im willing to do it that way. i just dont know how to
Like this i will send u a link
?paste
oof everyone vanished right when i sent the code
How do you know it's not running
add some debug output inside the if(player.isSneaking())
e.g.
i did, i tried player.sendMessage() too including the leggings
if(player.isSneaking()) {
System.out.println("SNEAKING");
player.getInventory().setLeggings(null);
}
ya do that
and it doesn't get sent at all?
add a debug statement at the top where you check whether origin equals "Elytrian"
I just went to the toilet π I won't piss in a bucket π
lmao
like i debugged it a lot but for some reason any second if statement after the PlayerInventory inv = player.getInventory(); wont work
Use this one, the other was wrong: https://paste.md-5.net/arapezipak.xml
hang on im trying some stuff
ok so i tested it and for some reason
if i put this in the conditional armors.contains(player.getInventory().getHelmet().getType())
it doesnt run any if statements after it
other stuff works like if i test if the player is sneaeking
is the artifact the artifactid?
@sterile token
Yeah?
the link
So I'm trying to set my project up with maven now, but it doesn't appear to be detecting the plugin.yml anymore. Here is what I have in my pom
<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>org.mries</groupId>
<artifactId>EnderBag</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<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.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
i pasted it
I have a tiny tutorial about how to get started with maven
ohhh I could use that π
I use vscode =]
eclipse somehow always gets confused when converting an existing project to maven
oh okay. should work, I hope π
What erorr happening?
IDEA #1 β
vscode power!
am I stupid or should it be "player's" instead of "players" everywhere in the javadocs???
Ahh ok, let me check
anywho how do i build a config.yml storing ranks/access them? or is there a resource where i could figure it out
nah u right
you can get your config using getConfig() and save it using saveConfig() π
how do i store the info in the config tho for the ranks?
I can send you a custom class and then you use it to manage files
getConfig().set("path.to.your.whatever",someValue);
Do you think this is a good explanation for my bukkit PR?
/**
* Gets the player's total amount of experience points, including those of previous levels.
* <p>
* This refers to the total amount of experience required to restore the player's current level
* plus their progress in their current level.
*
* @return Current total experience points
*/
public long getPureExp();
You write it manually? lamo
Use an intellij plugin
there is a plugin for that what you are doin
what am I writing manually?
for WHAT?
yeah
i think they mean javadocs
Yes
how would IntelliJ know what I want to write into the docs?
why would u use a plugin
It can't read my mind duh
yeah
There is a maven plugin that already write everything forthe method
can people stop answering with "yes" or "yeah" to questions that are not yes/no questions?
That why i dont like english
so please enlighten me and tell me how that plugin will figure out what I want to write into the description
wdym
how will it know what to write lol
oh sorry @glossy venture I thought with "yeah" you wanted to answer my question on how the plugin should know what I want to describe ol
I just added a method to Bukkit's Player interface and obviously I also added JavaDocs. @sterile token please explain on what you are talking about lol
ah
the interface of course is just the interface π
so you also have to edit craftbukkit
yeah
yes, Bukkit and CraftBukkit
it's just three lines needed though
just some ugly math
they do accept suggestions but creating a PR myself is probably 2 years faster XD
how can i check if a player is in the respawn screen? will i add them to a list when they die and remove them from it when they respawn?
Try yourself with the plugin JavaDocs
can't you just check Player#isDead() ?
ok ill see
bro sorry to say but
you have no idea what you're talking about
what should that plugin do?
what's wrong with the javadocs I've written?
How would any plugin improve that?
and params
yeah but it takes no params π
but the thing is that intellij does that for you
Btw
ikr? just enter /** and hit return
when you type /** <Enter>
bro troll somewhere else
I have what there?
nmms of course
yes
net.minecraft.meh.server
Hey can you tell me why I'm stupid
you DO realize, then even when generating a javadoc template, you still have to write the explanation yourself, right?
This is done with your snippet @tender shard
what's the problem with it?
oh wait
what are you doing
Its not calculating down to the Exp point value
package name for nmms: n.e.t.m.i.n.e.c.r.a.f.t.s.e.r.v.e.r
sure
public static int getTotalXP(final int currentLevel, final Player p){
return getTotalXPRequiredForLevel(currentLevel) + (getTotalXPRequiredForLevel(currentLevel) - p.getExpToLevel());
}
no that doesnt work
how are you checking it
if(!p.isDead())
Really?
this cant be real
I think the javadoc was only that in the picture
I have never realized that need a description
can you try this please?
public static int getTotalXP(final @NotNull Player p){
return getTotalXPRequiredForLevel(p.getExpToLevel()) + getTotalXPRequiredForNextLevel(p.getExpToLevel()+1) * p.getExp();
}
they don't "need" a description, but docs aren't very useful without manual edits
if you pull request to bukkit, of course it needs a description^^
DONT USE NotNull
I will make your tps go down
was talking about docs in general
what is this bullshit
yeah go home please, you'Re just annoying with all your bullshit
its a compile time annotation
ah oki
basically EVERYTHING in bukkit is annotated with NotNull or Nullable. And that makes total sense for an API. and anyone claiming it creates performance problems should stop smoking so much crack
yeah
Did you mean getTotalXPRequiredforLevel ?
sorry I meant this:
public static int getXPRequiredForNextLevel(final int currentLevel) {
if (currentLevel <= 15) return (2 * currentLevel) + 7;
if (currentLevel <= 30) return (5 * currentLevel) - 38;
return (9 * currentLevel) - 158;
}
How would i set up permissions on my plugin to allow plugin.amount.5 allowing the player to have 5 of some thing?
iterate through all the permissions
bruh
maybe you have to remove the +1 from my original code lol sorry
it can be any number tho?
like
i know about plr.hasPermission
but how do i check the number that they have
in short: get the XP required for the current level, and add the XP required to get to the NEXT level * player.getExp()
well you basically really need to iterate:
int max = 0;
for(int i = 10000; i > 0; i--) {
if(player.hasPermission("your-permission." + i) {
max = i;
break;
}
}
you want to start with the highest possible number
but to be honest
doing that is a bad idea imho
please no
cant u like implement a PermissionAttachment which will store all permissions?
I use a groups.yml file for that, e.g. sth like this:
# You can define a custom AngelChest duration for certain groups.
# Players will need the angelchest.group.[groupname] permission.
# If a player is in no group, or the value has not been set for
# any of the player's groups, the default value will be used.
# If a player is in multiple groups, the "best" value is used,
# e.g. the highest duration, highest amount of chests and
# lowest prices.
#
# NOTE: SOME OF THOSE OPTIONS ARE ONLY AVAILABLE IN THE PREMIUM VERSION (AngelChestPlus)
# Every option here has an identical option in the config.yml. You can find information
# there whether one of the options is premium only or also available in the free version.
#
# Available options:
# angelchest-duration: <duration in seconds> (e.g. 600, 0 = infinite chest)
# unlock-duration: <duration in seconds> (e.g. 300, 0 = never unlock automatically)
# max-allowed-angelchests: <number of chests> (e.g. 10)
# price: <price for spawning the chest> (e.g. 5000 or 0.1p = 10% of player's balance)
# price-open: <price for opening the chest> (e.g. 5000 or 0.1p = 10% of player's balance)
# price-teleport: <price for teleporting to the chest> (e.g. 5000 or 0.1p = 10% of player's balance)
# price-fetch: <price for fetching the chest> (e.g. 5000 or 0.1p = 10% of player's balance)
# xp-percentage: <percentage of how much XP to keep> (e.g. 1 = 100%, 0.5 = 50%, -1 = vanilla behaviour)
# spawn-chance: <spawn chance of an angelchest> (e.g 1.0 = 100%, 0.5 = 50%, 0.01 = 1%)
# random-item-loss: <number of item stacks randomly lost> (e.g. 2 = 2 item stacks or 0.5p = 50% of player's item stacks)
# invulnerability-after-tp: <amount of seconds> (e.g. 60 = one minute invulnerability after TPing to your chest, 0 = no invulnerability)
# allow-tp-across-worlds: true|false
# allow-fetch-across-worlds: true|false
# max-tp-distance: <blocks> (e.g. 0 = unlimited, 200 = player can only teleport if they are within 200 blocks of the chest)
# max-fetch-distance: <blocks> (same as max-tp-distance)
#
# Note: You MUST rename this file to groups.yml if you wish to use it.
admin:
angelchest-duration: 1500
unlock-duration: 0
max-allowed-angelchests: 999
price: 0
price-open: 0
price-teleport: 0
price-fetch: 0
xp-percentage: 1.0
spawn-chance: 1.0
random-item-loss: 0
invulnerability-after-tp: 5
allow-tp-across-worlds: true
allow-fetch-across-worlds: true
max-tp-distance: 0
max-fetch-distance: 0
mod:
angelchest-duration: 1200
unlock-duration: 0
max-allowed-angelchests: 10
xp-percentage: 0.8
spawn-chance: 1.0
donor:
angelchest-duration: 900
unlock-duration: 450
max-allowed-angelchests: 7
spawn-chance: 1.0
noob:
angelchest-duration: 300
unlock-duration: 150
spawn-chance: 1.0
random-item-loss: 1
idiot:
angelchest-duration: 150
spawn-chance: 1.0
random-item-loss: 0.5p
so I just have to loop over angelchest.group.<groupname> which is basically only a few permissions instead of possible 10000
awesome, thank you
Heyo! I register my fully custom entity and it has no asstributes, it's attributes are null. I want to set default attributes for my custom entity, but idk how currently, because my currently soultion sometimes does not working. No attributes error
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.attributes.AttributeProvider.a(java.util.function.Consumer, net.minecraft.world.entity.ai.attributes.AttributeBase)" because "this.d" is null
at net.minecraft.world.entity.ai.attributes.AttributeMapBase.e(SourceFile:48) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
at net.minecraft.world.entity.ai.attributes.AttributeMapBase.a(SourceFile:48) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityLiving.getAttributeInstance(EntityLiving.java:2333) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityLiving.<init>(EntityLiving.java:292) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityInsentient.<init>(EntityInsentient.java:132) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityCreature.<init>(EntityCreature.java:17) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:70) ~[?:?]
at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:26) ~[?:?]
at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:25) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
... 19 more```
bro thats going to be quite slow
if you do this like every tick dont
yeah do not use it @somber hull
better create some kind of group system
like what I sent above
iterating over all possible permissions is a shitty way, but the only one possible if you really have to rely on your.permission.<number>
but as said you should not do that in the first place
it's fine if your max number is 50 or something, but not if it can also be 10 thousand
Player player = ... // get player
// get permission attachments
Set<PermissionAttachment> attachments = player.getEffectivePermissions();
// iterate over all attachments
for (PermissionAttachment pa : attachments) {
// get all permissions
Map<String, Boolean> perms = permissions.get(0).getAttachment().getPermissions();
/* do stuff (idk what next) */
}
maybe something like that
idfk
Changed some args and cast the output. Returns correctly now
public static int getTotalXP(final @NotNull Player p){
return (int) (getTotalXPRequiredForLevel(p.getLevel()) + getXPRequiredForNextLevel(p.getLevel()) * p.getExp());
}
@EventHandler
public void onPlayerLogin(AsyncPlayerPreLoginEvent event) {
String uuid = event.getUniqueId().toString();
logger.info(uuid);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.tooty.xyz/new/" + uuid))
.header("Authorization", auth)
.GET()
.build();
this.client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(body -> {
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER,
String.format(NOTE, ChatColor.of(Color.decode("#9966cc")),
ChatColor.RESET, ChatColor.BLUE, body));
});
}```
it doesnt seem to kick, (i get a request incoming btw)
perfect :3
HI! is the same using:
Socket socket = new Socket("127.0.0.1", 81);
DataInputStream input = new DataInputStream(socket.getInputStream());
new TestClass(input);
and
Socket socket = new Socket("127.0.0.1", 81);
new TestClass(socket.getInputStream());
i mean you arent making a DataInputStream on the 2nd one
why do you even care? If it works, it works
I care because i having thread locks
And im checking every line code of the library to get why the thread get locked
Hey, maybe someone can help me out with vector rotations. Basically, I'm trying to create a helix which is placed horizontally as opposed to vertically, with the starting point being the player head
Helix creation isn't a problem, but I can't figure out how to "flip" it 90 degrees forward (or am I going about that wrong)
oh shit, not math again lmao
I think of the discord helpers were quite good in doing math things
just try to ping Conclure, he has "ping for help" in their name anyway π
Game dev usually means math at some point :)
but we are no game devs, we only code stuff for an already existing game π
Still developing for a game
yeah
But yeah I avoid vectors like the plague
@ivory sleet sorry for the ping, but I'd appreciate the help
Might go ahead and learn how to do them soon
show your current code pls
Oh there's a lot of it, I tried a lot of things, give me a second
I made many games, but most are adventure games :3 not requiring "complicated" math
Niiice
the best thing about adventure games - you don't need any drawing skills. Just pretend that it's supposed to look bad
Precisely
lol my latest game
Dear god lmao
Paint!
It has a certain charm to it
how can i break out of 2 for loops?
outerloop:
for(whatever) {
innerloop:
for(anotherWhatever) {
// ...
break outerloop;
a boolean that tells the outer loop to break at the end of the iteration
:)
bad way. use labels instead
for (int l = 0; l < checkPoints; l++) {
for (double y = 0; y < maxHeight; y += heightIncrement ) {
double radius = y * radiusIncrement;
double x = Math.cos(Math.toRadians(360/checkPoints*l + y*25 - angle)) * radius;
double z = Math.sin(Math.toRadians(360/checkPoints*l + y*25 - angle)) * radius;
Location cloned = location.clone().add(x, y, z);
Vector rotX = rotateAroundAxisX(cloned.getDirection().normalize(), x);
Vector rotZ = rotateAroundAxisZ(cloned.getDirection().normalize(), z);
Vector rotY = rotateAroundAxisY(cloned.getDirection().normalize(), y);
cloned.add(rotY).add(rotX).add(rotZ);
effects.particle(cloned, Particle.PORTAL, 150);
}
}
angle++;```
the math part
some people really hate labels so im providing an alternative
couldn't you basically just swap z or x with y and hope for the best? π
hm yeah okay but how are labels bad? that's what they were made for
idk, i like labels
I mean... some people also hate static but that's not a reason not to use it
oh thanks so much @tender shard never had to use this before but it seems rlly useful thanks!
np ^^
oh believe me, I tried, and it does what I want it to, but the problem is it doesn't always display the effect in the direction the player is looking at (only at x or z respectively)
yeah that I can understand, it totally violates OOP stuff etc π
hm alright sorry then π go open a thread in the spigot forums. There's many people good in math things
not everything in c++ needs to be oop
oop- dropped my pen
imo it's good for certain things, def don't use it all the time, but sometimes it can reduce the complexity if you are doing a very specific thing
delete ram;
I'm trying to use a method like this but it doesn't show up in the spigot dependency I am using. Is there a reason why this would occur? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#isResourcePackRequired()
Are you using a build tool or just throwing in the jar as a library?
I'm using the maven repo
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
you're using 1.18, the method is 1.18.1
how to take inventory from the player and remove all items that type is "diamond"?
Player variable:
Player p = (Player) sender
i am an idiot lmfao, thanks
suggest you look at getInventory and associated methods
I'm seeing and I can't find
md_5 do you have any suggestion for my tiny PR idea? https://www.spigotmc.org/threads/api-player-getrealtotalexperience.538652
I like Player#getFullExperience
Yeah one of the issues I've run into is Spigot doesn't track actual exp values
You can do a close fix for it by converting levels into their exp values but you can lose some exp in that transfer
that's no problem, I can get the "true" total XP amount with some math
it's just three or four lines
Yup!
I just think it might be a useful API addition
sometimes you just need the full XP, e.g. to let players keep only X% of their TOTAL XP on death
Definitely useful, I recently coded an "exp storage" book for my players so had to go about that issue
i've also found a need for doing this sort of experience stuffs, one of my plugins uses xp for teleports and has it's own version of bottles o enchanting
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
String uuid = player.getUniqueId().toString();
logger.info(uuid);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.tooty.xyz/new/" + uuid))
.header("Authorization", auth)
.GET()
.build();
this.client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(body -> {
logger.info("kicking");
player.kickPlayer(String.format(NOTE, ChatColor.of(Color.decode("#9966cc")),
ChatColor.RESET, ChatColor.BLUE, body));
});
}```
```java
[13:40:47 INFO]: [TootyAUTH] kicking
[13:40:47 FATAL]: Thread Thread-11 failed main thread check: player kick
java.lang.Throwable: null
at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:15) ~[patched_1.17.1.jar:git-Paper-401]
at org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer.kickPlayer(CraftPlayer.java:499) ~[patched_1.17.1.jar:git-Paper-401]
at xyz.tooty.JoinListener.lambda$1(JoinListener.java:57) ~[tooty-0.1.0-a.jar:?]
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) ~[?:?]
at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610) ~[?:?]
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:840) ~[?:?]
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) ~[?:?]
at java.lang.Thread.run(Thread.java:831) ~[?:?]```
I currently have this in my lib for Xp stuff https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/de/jeff_media/jefflib/ExpUtils.java but yeah I'd love to see it being added to the api :3
what's JoinListener line 57?
The easiest way is really just to use player.giveExp() with a negative value to remove exp for me
your sqrt() method is a bit misleading in its name imo, but otherwise nice
(private so doesn't really matter)
yeah I dont know why I made it
in fact you're right
sqrt should be square ROOT
I probably was drunk when I made it
lol
I could also say "ugh sqrt is the german word for squared"
but that would not be true
But yeah gave it a +1, it's a qol change but one that would be welcome
:3
thx
does kickPlayer need to have my plugin trusted or something odd
trusted?
wtf is a trusted plugin?
idk what you're talking about
declaration: package: org.bukkit.entity, interface: Player
Player#kickPlayer only requires a string
There's only a string there too
if that does not work - you have another plugin cancelling the PlayerKickEvent
try without other plugins
btw you should ALWAYS test your plugins without having other plugins running
not always possible ^
well... only with plugins needed for your plugin to work
ooliver are you using Paper? I see some refs in that debug you posted
IK that Paper often has differences from the normal spigot
it has, but it should be 100% compatible anyway
only things that might occur is the IDE saying sth's deprecated while it isn't in spigot
i've had paper do very odd unexplainable things that spigot doesn't do so i stick to spigot.
any examples?
oh boiii my first attempt to add a PR, I'm a bit anxious lmao
someone please calm me down
tell me sth about fluffy animals
i've had it give me incorrect blockdata during redstone events and such, just tiny little oddities that i never looked into too much
whuuuut
that's strange
could be because it was a dev build but idk, going to try it out again in a month or so to see if the same strange stuff happens.
yeah sometimes paper has strange bugs
whenever I get bug reports and really have NO CLUE at all why it happens
I tell my users to update paper
somehow it always works lmao
but when it happenned it broke one of my minigame maps because it told me solid blocks were supposed to be piston heads, and then when my method to revert the map ran it ended up replacing the solid blocks with piston heads, which in turn borked up the redstone
(and spigot has never done such things)
Vault enabled and my plugin don't find it
are you loading your plugin before vault is loaded?
did you make sure you specified it as a load after vault
depend: [Vault]
softdepend: [Vault]
loadbefore:
- Vault
'-
Can someone help me solve this? Please!
you cant have loadbefore and depend
How should I leave?
also don;t depend AND softdepend, both will break shit
loadbefore means your plugins gets loaded before vault
depend means vault gets loaded before your plugin
just depend: [Vault]
trying
cut the softdepend and loadbefore
Server starting...
not working
wait
how to send a message in action bar? 1.8.8
.spigot().sendMessage(...)
is there a way to create a custom MerchantInventory, or at least open a villagers trading menu to a player? i see the getInventory() method for villagers but that just returns the items theyve picked up
public void sendActionText(Player player, String message){
player.spigot().sendMessage(TextComponent.fromLegacyText(message));
}```
?
look at what other arguments are available
Maybe ChatMessageType π€«
thanks
np
I know
For better searching trough the documentation go in google and type: site:jd.bukkit.org [your search]
No other plugins installed
?jd
will do thanks
look at the links above too @upper niche
help
kickPlayer works fine though
so I donβt know the issue, that's why I came here to ask
Help
Vault enabled and my pl don't find it.
code: https://www.toptal.com/developers/hastebin/apeyivefum.java
plugin.yml: https://www.toptal.com/developers/hastebin/edegurawez.less
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
String uuid = player.getUniqueId().toString();
logger.info(uuid);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.tooty.xyz/new/" + uuid))
.header("Authorization", auth)
.GET()
.build();
this.client.sendAsync(request, BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(body -> {
logger.info("kicking");
player.kickPlayer(String.format(NOTE, ChatColor.of(Color.decode("#9966cc")),
ChatColor.RESET, ChatColor.BLUE, body));
});
}```
I'm not sure if you can kick players in the join event
just a small suggestion, maybe it'll help: kick the player 1 tick later
how could I do that
help
declaration: package: org.bukkit.event.player, class: PlayerLoginEvent
use AsyncPlayerPreLoginEvent#disallow
Yeah I tried using disallow there but it gave no error somehow
That's why I changed it to join
you can do PlayerLoginEvent#disallow(...)
wdym no error?
the non async?
the one I sent
declaration: package: org.bukkit.event.player, class: PlayerLoginEvent
here's the method you're looking for: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerLoginEvent.html#disallow(org.bukkit.event.player.PlayerLoginEvent.Result,java.lang.String)
declaration: package: org.bukkit.event.player, class: PlayerLoginEvent
it will definitely work
I would recommend using the async one
Although it probably doesnβt matter that much
yeah probably that's better
It says depreciated
WHAT is deprecated?
Importing the sync version
are you on paper?
help?
in spigot it's not deprecated
?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!
my dependency is spigot
hugh strange
Help
try it anyway please
if it works, try to switch to the async event
show the error message
no errors
so what exactly doesn't work?
You donβt even use vault in the code youβve shown
[22:17:22 INFO]: [KVender] Loading KVender v1.0-SNAPSHOT
[22:17:22 INFO]: [Vault] Enabling Vault v1.7.3-b131
[22:17:22 INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
[22:17:22 INFO]: [Vault] Enabled Version 1.7.3-b131
[22:17:22 INFO]: [KVender] Enabling KVender v1.0-SNAPSHOT
[22:17:22 INFO]: Vault nΓ£o encontrado.
[22:17:22 INFO]: [KVender] Disabling KVender v1.0-SNAPSHOT
[22:17:22 INFO]: Server permissions file permissions.yml is empty, ignoring it
[22:17:22 INFO]: CONSOLE: Reload complete.
[22:17:22 INFO]: [Vault] Checking for Updates ...
[22:17:22 INFO]: [Vault] No new version available
Vault nΓ£o encontrado. => Vault not finded
the class you sent does not have anything about vault in its code
did you sent the wrong class?
So show the code that causes that message
wait i sended other code π€£
link edited
tbh that looks fine to me
what is tbh
to be honest
but wait
do you actually have any economy plugin?
it seems like you check for an economy plugin and not just for vault
of economy
no idea what you're trying to tell me with those emojis, but
your check whether an ECONOMY plugin is installed
and you probably don't have any
I didn't put the economy plugin, I just put the vault
then you say "Vault is not installed" in your language
although vault is installed
you just don't have any economy plugin
Very confusing
yeah
yeah, print a proper message when vault is installed but economy isnt
ok cool, the sync player login event raises no errors and does nothing
private boolean setupEconomy() {
if (!getServer().getPluginManager().getPlugin("Vault").isEnabled()) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false; // <------------ This is where your code returns false
}
econ = rsp.getProvider();
return econ != null;
}
I'll send 2 sec
send your whole listener please, I'll test it myself @little trail
Did you forget to register your events or didnt add @EventHandler annotation?
check both
It says "kicking"
working :)
I'll test it in 2 minutes
i uploaded the economy plugin
yes it's sending
Also the api has auth so I donβt know if you could get it working
everything's working now? nice π
I'll try without the api first actually
thx
How can I send a message in action bar api in spigot 1.8.8? I need a simple code with the message "abc", whoever can send it, thanks.
If it works with this, I'll try with async and just normal http send I think?
As the async event but sync http
As it may be inside that completable future it somehow canβt access it to disallow
in 1.8.8 you need packets IIRC
md_5 already told you, like this
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("abc"));
no you dont
they are using 1.8
this will work?
no
I donβt think that was in 1.8
ah
then you indeed need a packet
what is IIRC
1.8 is so old, ancient and outdated, that it doesn't have that method
yess it works without the api
"if I recall correctly"
@little trail I just tested it
kicking players / disallowing them works totally fine
which ?
anyway what are you http things for? @little trail
which what?
wait, google translate crazy
Yeah I got it rn
what packets?
oh okay
for what?
You cannot send Action bar text using the API in 1.8
ah okay you edited the message again π
Sorry I don't know the packets for 1.8
Maybe someone else here knows stuff about that 8 year old MC version you are still using
Ok '-'
I just want to add: using 1.8 is stupid and you should not use 1.8 π
it's like still being on Windows XP
Is it for pvp or something
try this
public static void sendActionbar(Player player, String message) {
}
if (player == null || message == null) return;
String nmsVersion = Bukkit.getServer().getClass().getPackage().getName();
nmsVersion = nmsVersion.substring(nmsVersion.lastIndexOf(".") + 1);
try {
Class<?> craftPlayerClass = Class.forName("org.bukkit.craftbukkit." + nmsVersion + ".entity.CraftPlayer");
Object craftPlayer = craftPlayerClass.cast(player);
Class<?> ppoc = Class.forName("net.minecraft.server." + nmsVersion + ".PacketPlayOutChat");
Class<?> packet = Class.forName("net.minecraft.server." + nmsVersion + ".Packet");
Object packetPlayOutChat;
Class<?> chat = Class.forName("net.minecraft.server." + nmsVersion + (nmsVersion.equalsIgnoreCase("v1_8_R1") ? ".ChatSerializer" : ".ChatComponentText"));
Class<?> chatBaseComponent = Class.forName("net.minecraft.server." + nmsVersion + ".IChatBaseComponent");
Method method = null;
if (nmsVersion.equalsIgnoreCase("v1_8_R1")) method = chat.getDeclaredMethod("a", String.class);
String colorMsg = ChatColor.translateAlternateColorCodes('&', message);
Object object = nmsVersion.equalsIgnoreCase("v1_8_R1") ? chatBaseComponent.cast(method.invoke(chat, "{'text': '" + colorMsg + "'}")) : chat.getConstructor(new Class[]{String.class}).newInstance(colorMsg);
packetPlayOutChat = ppoc.getConstructor(new Class[]{chatBaseComponent, Byte.TYPE}).newInstance(object, (byte) 2);
Method handle = craftPlayerClass.getDeclaredMethod("getHandle");
Object iCraftPlayer = handle.invoke(craftPlayer);
Field playerConnectionField = iCraftPlayer.getClass().getDeclaredField("playerConnection");
Object playerConnection = playerConnectionField.get(iCraftPlayer);
Method sendPacket = playerConnection.getClass().getDeclaredMethod("sendPacket", packet);
sendPacket.invoke(playerConnection, packetPlayOutChat);
} catch (Exception ex) {
ex.printStackTrace();
}
oh wow you should cache all those methods and classes
As you have an economy thing, I don't think it's centred around pvp so you should probably update
it's because most Brazilian servers use 1.8-1.8.9 because it's a lightweight version, there aren't many fps drops for old computers
yeah okay that's a reason I can somehow accept π
Yeah it's very lightweight
good luck then π But if you're only supporting 1.8 I would NOT use reflection
yo so i want to store some ItemStacks on a player's PersistentDataContainer, but i dont think u can do that, idk if anyone here has any idea how to work around that
?paste
Anyone here work with maven multi modules? I'm having some issues getting it to work properly for me.
More specifically, I have this as my dependencies
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.nothixal.hugs</groupId>
<artifactId>core</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
Yet, in my class, all references to net.minecraft or org.bukkit.craftbukkit are not found.
Also, for clarification, I have already run BuildTools for 1.17.
i have much better ways now, but im going to send half my reflection api if he wants to use that
you can easily do. I made a library for PDC to support ItemStacks
oh fr
just wanted to mention it π
yeah one sec
yea thats fair
@tender shard thanks G
np
https://paste.md-5.net/yaqoresimi.cs
Why doesn't the last if statement trigger when I use the item with the exact PDC? I must be doing something wrong here.
you never told the itemstack to use the updated meta
add item.setItemMeta(meta) AT THE END. you are doing it before your last line
basically move line 40 to the bottom
np π
Howe exactly?
Like can you elaborate
yes
create a groups.yml file. Like what I already sent. Then, loop over all the keys of that config file and check whether the player has permission for "your.plugin.group.<groupname>"
if yes, get the value from that config
if you need further help open a thread pls and ping me there