#help-development
1 messages · Page 154 of 1
prebot or preboot?
It’s his custom bot
BRO
not sure how any of that is advertising lol
it isn't, but some people assume mentioning of purpose is advertising
so i don't like it
one of my plugins 🙂
pretty cool actually
but point is, that isn't advertising
but i wouldn't risk sending anything i work on, i got banned before for that
use antipopup to fix your server
lol
but since I posted that, at least you can point out that if your statement is advertising, then I am obviously blatantly advertising XD
creeperz, what is a static method?
In Java, a static method is a method that belongs to a class rather than an instance of a class. The method is accessible to every instance of a class, but methods defined in an instance are only able to be accessed by that object of a class.Jan 15, 2021
› static-...
What is a Static Method? - Definition from Techopedia
using google is not allowed
Cry
explain with your own words lol
I sent the whole page bc it’s funny
this is actually not worded right
bro you can't do correct syntax and ur trying to work with classloaders
r u kidding me
this is the best description so far
kacper
Idiot it’s a copy paste
multiple times ive tried to explain it but my tiny brain can't explain it the right way lmfao
yeah, while yours is tinier
I’ll google my problems
a static method, is a method that is a member of an object that is accessible directly from the objects constructor, rather then from an object instance created via the constructor
We are not the same
you can't rlly google syntax problems, when u mess up ur {}
I fucking know how to use }
Because it wasn’t meant for your IDE
you can setup formatting in your IDE so you never have to worry about fixing it later 🙂
See
nobody, i was talking to creeperz he is trying to deal with classloaders and he hasn't learned enough java
Also it was in beta dumbass
I have the full repo on my pc
Don’t feel like committing
what
github on pc
I mean repo
how is that even surprising, you obviously have version of it on your pc
"uploaded"
what
Shut up mr I got banned for 2 years on notcordsrv
notcordsrv? you know this is temporary
guys this is not general
yeah lol
another dumb thing from you
i can but i wont
there are infinite methods
exactly
object react sucks
idk c+ (assuming u mean c++), also this makes no sense
a string is a collection of bits (and bytes), it's almost infinite
just go work on your classloader
you can't program without knowing the syntax
As I have been looking into the spigot
Is not possible to get the boostrap netty instance
😬
I would have to do even more hacky things
how can i know the eye angles of a player?
i mean, the direction they are looking at
yaw and pitch
you can always clone it
Does 1.17 support java 17?
It keeps saying unsupported class
Then why does it keep saying unsupported class everytime i change the maven version to 17 and the project version to 17
Compile
Of
My question is why does it go e1 e2 instead of e...
Or e[]
I mean I highly doubt it's there for no reason but could be wrong
???
need to set the version using the compiler plugin config area instead of using the properties tag
Wdym by thatm
I did dat
Still doesn't work
?paste
^
?
Ohhhh the rapper?
No clue then
Hmmm no my clothing style is tight sweat pants and a jacket or sweatshirt
I wasn't even Alive in 2000 no clue what the style was
Oh perfect
Could it be that I'm just young ??? Yes it is
Can you explain me please. Because i know that is posible vía reflections but im not sure tho
How old are u?
Oh lord no
Perfect
Maybe
Let me look our dls
Maybe
I have memory prohlens
Idk told me his age 2d ago
And i dont remember
Cpp
C
Cpp doesnt c++
The same
Bruh is what I said
🤔 🤔
I was asking you
If cpp equals c++
🤣
Na do T worry
Im bad today
Idk
Verano is going insane
Hi pvble
Zacken I need your help because you have experiencia with reflections
Oh really
I also have experience with reflection
So do I
But I gtg lol
I need to clone the netty instance from the server
Car pfp does
I mean I need to get the current server netty instance and make some things
I have been looking on the shity spigot and doesnt have a getter for the boostrap netty
😡
Cars reflect
Not all
Pvble can we dm
Tesla?
Because here are talking about Manú things
I have been looking into the spigot source code
But i cannot find Where is stored the boostrap netty instance
Is there a field or not?
Oh that why
I was looking into the spigot api
its in the main mincraft class file
Function getFormattedDate
getFormattedDate = Year(Date) & fixNum (Month(Date)) & fixNum (Day(Date))
End Function
Function getFormattedDate()
getFormattedDate = Year(Date) & fixNum (Month(Date)) & fixNum (Day(Date))
End Function
Trying to get a regex for both of these.
( +.*?)\\( works... but only for the first one 😐
Trying to get the getFormattedDate part of the function, since that's the name but pain
These need to pass as well. Not sure if a single regex would work for all of them or if it would be better to handle them separately 🤔
Function ShowOutput()
WScript.Echo strOutput
End Function
Function Lpad(strInput, length, character)
Dim strOutput
If Len(strInput) >= length Then
strOutput = strInput
Else
Do While Len(strOutput) <= length - Len(strInput)-1
strOutput = character & strOutput
Loop
strOutput = strOutput & strInput
End if
Lpad = strOutput
End Function
https://github.com/OpticFusion1/Kitsune/blob/master/src/main/java/optic_fusion1/kitsune/parser/vbs/StatementFactory.java#L37 and this is the relevant code
if spigot sends a plugin message via a player, wouldn't that make it really unsecure?
or is that not how it works
unsecure in what way?
wouldn't players be able to send any plugin message then?
yes, but something has to be listening for it
but you would have to be extremely lucky
Can't they be stripped from the packet during the bungee layer?
yes
its part of the protocol and not something that is necessary
so yeah you could strip plugin messages
Gotta love crashing burning lmao
[Kitsune] [18:58:58] [INFO]: Line: Function getFormattedDate
Exception in thread "Thread-0" java.lang.IllegalStateException: No match found
at java.base/java.util.regex.Matcher.group(Matcher.java:644)
at optic_fusion1.kitsune.parser.vbs.StatementFactory.buildFunctionStatements(StatementFactory.java:44)
at optic_fusion1.kitsune.parser.vbs.VBSParser.identifyAndConvert(VBSParser.java:64)
at optic_fusion1.kitsune.parser.vbs.VBSParser.parse(VBSParser.java:57)
is there an event that is triggered with smaller mouse movements?
bc you have to move the mouse quite a few degrees for the PlayerMoveEvent to be triggered
No
What are the current ways to disable chat reporting with your own code?
Strip the message signature with a packet listener
public void destroy() {
sendPacket(((CraftPlayer) owner).getHandle(), new ClientboundRemoveEntitiesPacket(npc.getId()));
}
how come this doesn't delete the npc?
it's still visible
how would I cancel a potionevent for only one player
Hey so I've been working on my server setting up the bungeecord but for some reason I can't get the bungeecord to communicate with the host world. I've changed all the spigot.yml files, server.properties, and bukkit.yml info along with updating the config.yml inside of waterfall. Whenever I try to connect it just says "disconnected" and in my console says it started a query at : 0.0.0.0:25565. Any ideas?
is there a way to get a player version?
if you have via version they might have an api for it
Update waterfall to latest, it may help.
Waterfall was just installed to the server, it’s up to date
idk then
Right? That’s how I feel. I’ve looked over it all 100 times and I have it set up like everyone else, just doesn’t work 🤷♂️
is your host world at 25565
or is it querying the wrong address
So in the config the host world is at 0.0.0.0:25565 but the actual server IP which I set up on the server section is 108.62.106.69:46717
Bruh
is it on a hosting provider
"check console for details" checks console nothing there
All of the servers have different ports, the host server port is 52712 would I replace that there and enable a query port?
Yes it is
because then you might have to use the public ip
yeah try setting the public ip there
I tried but when I put the IP in it says it can’t connect to the world
I did, had to turn it back on so people could join
you need to have your spigot server on offline mode, while your proxy can be either but online is recommended
?paste
Correct, which my Hub server was in offline mode, the link server just won’t connect to the hub server no matter what I try.
no errors in the proxy or server?
When I try to connect it just says “disconnected” and then it says it can’t verify host of pvp and a bunch of other generating stuff
Got a minute to hop in a call? I can screen share the config and server setup for you so you can get a better understanding
can anyone help me?
That’s alright, my server just isn’t set up for waterfall right now because people are on
anyone?
anyone?
We'll need the error in the logs
We'll need more details please
That's the problem. I can't see any errors in console.
hm?
"see logs"
is that your plugin ?
yes
can you test it not on multicraft ?
im already doing it on multicraft
Yeah but NOT on multicraft ^^
wdym
there is nothing
this is bungee....
im doing bungee plugin...
omg
WHAT
can you give me an example
- Why the hell are you reading YML files with File streams ?
Because I can't read it's all answers with YML
answers, i meann
hm
instead of
if (c1) {
if (c2) {
do
if (!c1)
return;
if (!c2)
return;
what
I don't get it + why
What do you mean ? How is your yml file ?
i want to read 4 digit numbers only
?javadoc
i dont think there is a method for that
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
-_-
wdym
what to do instead?
Use the configuration api to read the correct value in like few lines
and safely
And you are using try catch inside try catch and even without a catch
You have to add returns in your conditions, otherwise the whole code would be executed. but much better
remove that first try catch block it's useless
its not
So use Configuration api
how
https://www.spigotmc.org/wiki/using-the-bungee-configuration-system/ I don't want to spoonfeed you. All the answers are here
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
'-'
u mean to do this instead?
But why do you need to go through all paths ?
to get all answers in config?
Can you explain and vulgarize what you wanna do ?
reader looks easier
ArrayList#contains
This really does not make sense since you still didn't explain me what is the purpose of the feature
all this 4 digit numbers does not belongs to same thing
So why do you need to read them all ?
Its a verify discord bot
im storing discordmemberid: verifycode
so im reading first verifycode
and then discordmemberid
So
and then doing some things with it
like how
fourndigit code (or more to make it unique) : discord id
so you only have to getString(code) and check if there is a discord member
no need to read all lines
(this is bad to do it)
i also need to getString(memberid) sometimes. so i would need use file reader on that too
then just save uuid : discordId
Bruh
and when the user linked its discord, remove the fourdigits:discordid
let me give you a recap
i already created like 3 config for verifys now
lol
i have to go
Have a verify.yml file where you put "verificationCode:discordId"
When the player verify, use configuration APi to get the string at "verificationCode"
if it doesnt exist it means it's wrong, otherwise
remove line from verify.yml ( using the configuration api)
and add in discord.yml "uuid:discordId"
heya. i want to check to see if 2 players share the same permission group (luckperms). what might be the best way of doing this?
Only through NMS afaik
Wrong Channel, head to #help-server
if any1 here is using Lettuce, is there a way to check if you are already listening to X channel ?
do you happen to know if you can listen to your own published messages in lettuce?
since if you cannot that explain alot
sounds like i did not get the joke lmao
i name my software after whatever i have in the hand when i make it if i dont have an idea
or i name it literally
one of the two
https://paste.md-5.net/xojajaruto.cs how can i fix this
paste ur pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.limpeex</groupId>
<artifactId>java-discord-bot</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.20</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>C:\Users\tekin\Desktop\Yeni klasör\plugins</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
</project>```
what
too lazy to scroll up
then delete discord
yes latest
good
try adding <type>jar</type> to ur api dependency
You are not running this as a Plugin on Spigot so of course you can;t use Bukkit methods
What do i need to do
W8 are you running that app as a plugin?
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Or standalone bot
I am making both in same executor
What
you know you need to run it as a plugin
on your server
and connect to discord in onEnable() or smth
yea smth like this
And prevent zipclosing errors
don't remember but definitely need smth in onDisable
Well if i do run it on onEnable it throws same thing
for JDA this time
wdym by plugin
Like put it in plugins folder and start mc server
let me
If yes, you didn't shade ir right
change the dependency lol
of JDA
if i find i'm gonna send how it should look like
Jda dep is alright?
no
It is?
There are 2 things you can do
Download JDA jar
as a plugin
Which is somewhere on spigotmc
You can just shade it in jar lol
or shade entire thing into your plugin
yeah and here is no shade as you can see
this one is a plugin
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - GitHub - DV8FromTheWorld/JDA: Java wrapper for the popular chat & VOIP service: Discord https://discord.com
here is the repo
It will shade by default...
Also version of discord api this ver is using will be deprecated soon
i'm 100% sure i added stuff to pom to make it run as it should
Can you tell me what is shade
i went to JDA discord and they helped me
here it is
Idk if you noticed this generates manifest
Which is not needed for spigot pl
And his error is that class Bukkit can't be found
Nothing related to jda
It's when he runs standalone
when he runs as a plugin he can not find JDA class
cuz it's not provided
cuz plugins depend on another plugins which are in depend: section iirc and on spigot api
i did shade but still same
same thing suggested here
did you maven update your project after changing pom xml
on eclipse i just right click on project, go to maven section and click Update
yes
there should be a button right on IJ
well then idk
what error is it
go to jdas discord and ask urself xD
throw your jar in here
send code
[1.19.2]
ThrownPotion thrownPotion = (ThrownPotion) player.getWorld().spawnEntity(Utils.getTricker().getLocation(), EntityType.SPLASH_POTION , false);
thrownPotion.getEffects().add(new PotionEffect(PotionEffectType.BLINDNESS, 20, 2, false, true)); << ERROR
Vector v = player.getLocation().add(0, 3, 0).getDirection();
v.multiply(1.01);
thrownPotion.setVelocity(v);
``` There was an error setting the effect of the thrown potion.
I also googled it, but it was either an old NMS or a solution that didn't work for me.
**Is there a way to set the effect of potions thrown?**
?paste
Tryna make a system where glass appears around spawn if someone is in combat, how would I spawn red glass around a cuboid for one player?
Player.sendBlockChange
was about to type that
Aight I'll try it out
?paste
how do i check if a player is within render distance of a block, assuming their RD is the same as the servers? Compute the distance from the player to the closest edge of the chunk and check if the distance divided by 16 is less than the RD?
or do i just call sendBlockChange and let the server handle it
Quick question:
I get a list of Role via #getRoles. I want to check if this list contains a role with the name "logged in". For this I am currently using the following code:
event.getMember().getRoles().stream().filter(role -> role.getName().equals("logged in")).findAny().isEmpty() Please tell me there is a better way...
what's the data type getRoles returns
List<Role>
List#contains should work then
ive got code for cheacking that im pretty sure
But I don't have the Roleobj, I just have the string
so isnt it a List<String> then?
i dont remember if jda lets you create a role from name
nope, it's List<Role>
ill check it
ye, but how do I neatly get that?
That's why I'm using a stream with filter.
just pulling the code up
ah yeah, I was looking for something like that, thx <3
yup, did that
for some reason I wanted to use #findAny and thaught that'd take a predicate, overlooked #anyMatch
is it possible for you to get the role from id? or only name
I saw no id field in the Role class
an id would be preferable
nvm, I'm stupid ._.
Role staff = event.getJDA().getGuildById(guildid).getRoleById(roleidL);
if (event.getMember().getRoles().contains(staff)) {
would work
yeah
Hello , iam trying to make a check if the day of the daily quest that i started is the same as today , and the weekly quest is withing the current week then continue
if its not today , and the weekly quest is not within this week then return
this is my current code
yes i already set that
startedDate is the the long where i start the quest
when i click on gui , i set it there
^
i have been trying to fix this for the last 2 day's , i never worked with TimeUtils before
before day
and after day?
right?
this one , i set the started quest date in this one
uh question
why dont u just save timeMilis and stuff it into a calender once u want to diplay it
i do save it in sql once player start a quest
ah
yes
what's happenin
the current check iam doing is not working ..
I am not sure if I am to ask this here, but I have recently turned my plugin into a multi module maven project (pom project). One of the dependencies I use requires relocation, but when relocating the dependency in my parent pom, my code breaks.
The code in my modules expect dev.group.dependency.YamlDocument instead of dev.bloedarend.plugin.YamlDocument.
just store milliseconds of end date
and check on onEnable
no need for calendars
other way create a task which executes after 86400000 ms
store + run
onEnable() check
i personally made timers
yeb
which just execute each minute
does spigot save runnables
and if curren time hit the date then omagad
no
from what you can see
yea sure yall think im dumb enough i need to hear it twice lolbruh
we just typed the same time
no worries
iam setting the started date , and currentValue , and set completed
electrons inside wifi router started a strike
electrons are slow asf
if anything it was the currents
^ this guy wrote physics gcsc
gcsc?
exam you take at 16 in england
oof
end of secondary school
i just had a physX exam in 9th grade so basically at 15 i guess
not sure what you mean, what i mean is that electrons are like water
and currents like waves
waves move a lot faster than the water that make them up
someting something quantum weirdness iirc
something something goes brr
does cafebabe list all the commands we get to shame people with anywhere
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
¯_(ツ)_/¯
wonder why that doesnt embed anymore
Syntax: ?cleanup
im out of ideas
im not gonna risk it
exactly
bet someone will come in and ping him
just make a throwaway account and ping him on that lol
takes too long
ur perspective on time is really messed up then
@worldly ingot help EpicEbic please
true
done
would be funny if choco watched me and @smoky oak not wanting to ping him
Mods keeping the fun commands to themselves ):
poor us
How do I clear potion effects?
Hey mates. Would anyone know if there is a way to call an event both from a synchronous and asynchronous context?
You can create a sync runnable and run it in that
player.smthPotionEffect
removePortionEffect probably
actually, genius tbh and easiest way now that I think of it
#bot-commands @worldly ingot
Oh there you go
welp i unleashed hell
you pinged choco, how could you
theres a difference between pinging someone cuz you want an answer from them and pinging them to prove your superiority cuz you know more
are you marking your territory
Atleast you’re honest
well im aware of my flaws
yea thats what im not gonna do
i accept it if other people correct me
that has to be enough
Material.values() return all materials?
Whats the best way to do this
//code
wait a couple of seconds
//code```
2nd one / the one with the lamba is better
Does anyone think that using native serialization is ok given that if someone can manipulate the content of a plugin folder the server is already compromised?
If someone has access to the plugins folder it's not your concern. Your job isn't file security
Hey, how can I code it that a player gets moved to another bungeecord server. For example from Lobby to Bedwars Server or something like that?
okay, thank you
?scheduling
No.
when JIT inlines lambdas
the worst case scenario is that its as fast as an anonymous inner class
meaning, in most cases you should use lambdas, for the tiny performance difference, if you care
its slower to warm up though -
l.forEach(Utils::coloured);
return l;
l being a List<String> will this modify the list?
If you care for (cold) performance then you should create a concrete class implementation.
But this performance gain is void as soon as the jit optimizes it as it creates a "class" for lambdas
anyways.
Utils::coloured is return ChatColor.translateAlternateColorCodes('&', s);
No this wont modify the list
so
l.replaceAll(Utils::coloured);
Creating a new list:
List<String> newList = oldList.stream().map(this::modification).toList();
Modifying the old list:
oldList.replaceAll(this::modification);
?paste
https://paste.md-5.net/migemegire.cs
I'm not that good at Mockito, it's my first time. Could you help me fix this problem?
[16:33:48 WARN]: org.mockito.exceptions.misusing.MissingMethodInvocationException:
[16:33:48 WARN]: when() requires an argument which has to be 'a method call on a mock'.
[16:33:48 WARN]: For example:
[16:33:48 WARN]: when(mock.getArticles()).thenReturn(articles);
[16:33:48 WARN]:
[16:33:48 WARN]: Also, this error might show up because:
[16:33:48 WARN]: 1. you stub either of: final/private/equals()/hashCode() methods.
[16:33:48 WARN]: Those methods *cannot* be stubbed/verified.
[16:33:48 WARN]: Mocking methods declared on non-public parent classes is not supported.
[16:33:48 WARN]: 2. inside when() you don't call method on mock but on some other object.
[16:33:48 WARN]:
[16:33:48 WARN]: at HQueue-Bridge-1.0-SNAPSHOT-shaded.jar//it.myke.util.TestingUnit.testLoginEvent(TestingUnit.java:37)
[16:33:48 WARN]: at HQueue-Bridge-1.0-SNAPSHOT-shaded.jar//it.myke.util.TestingUnit.lambda$new$0(TestingUnit.java:21)
[16:33:48 WARN]: at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101)
[16:33:48 WARN]: at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483)
[16:33:48 WARN]: at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1140)
[16:33:48 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305)
[16:33:48 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
(In my mind, a bot should enter the server and, once inside, run a cmd)
Credits: https://www.spigotmc.org/threads/using-junit-to-test-plugins.71420/
Hmm okay I think I'll go with the non destructive one eventho I'm never planning to use the list I think it's nice to have as little side effects as possible
this isn't always true for lambdas
it really depends on the lambda as they tend to hide away a lot of implementation details
or another way of saying it, hides what it is really doing
for (ProtectedRegion region : main.getWorldGuard().getRegionManager(p.getWorld()).getRegions().values()) {```
How can i get the protectedregion of all the worlds in the server, and not of p.getworld? with worldguard
Mockito is meant to mainly provide mock implementations of interfaces so that you can test a unit
in a clearly defined environment without having to worry about faulty implementations which have nothing
to do with your currently tested unit. Its not suitable for spigot testing unless you provide an entire
mock implementation of Spigot. This has been attempted and is called MockBukkit:
https://github.com/MockBukkit/MockBukkit
Iterate over all the worlds and get the regions of each...
Yeah since you usually wanna mock a server runtime
Thanks i will try that
Starting one piece in 2022
Quite hard to understand
how much XP a bottle contains?
Could you help me, please? I don't know how to spawn bots who are able to do /queue...
bruhh
int i = 3 + this.level.random.nextInt(5) + this.level.random.nextInt(5);
Why is it two randoms added together
to make the end result less extreme
just like how you more often throw multiple smaller dice compared to 1 big die in DnD
Haha that's funny
What kind of DnD do you play?
Or was that sarcasm
idk, what dnd do you play where every damage roll is a single die
fireball is like 6d8 or some shit
Pretty much all rolls besides damage rolls are done with d20s
okay so to clarfiy I was talking about damage rolls
as the application here is similar
you want the potion exp to be random, but not too random
7smile7 you're disappointing me by knowing dnd
Adding two randoms isn't going to produce anything special is it? I can't imagine that does anything than just one
Hm?
How to check if player respawn on spawn after dying? PlayerRespawnEvent perform also after moving to the end world.
well its like you know atleast is cant ever be 1 so the minimum out of 2 rolls js 2
meaning you already have less end results
and you would basically need less rolls to get your average
kinda hard to explain
but it has to do with probability stuff
so they used 2 random numbers because of balancing reasons likely
or they are just stupid
mojang is special and that's all we know
Check if the player is dead
well if thats the case using more random calls would make even less sense
it's like when I try to be fancy and start pulling numbers out of my ass
that's pretty much all development nowadays
On a bigger scale it doesnt matter if you roll twice with smaller numbers or once with a larger.
Rolling [0, 4] twice has the same average as rolling [0, 8] once.
omg dnd enjoyers?
why did I pick 9's? it's pretty random
is it possibul to make plugins in groovy, just wondering
im talking possible without pain in ass
Plugin for Gradle or
This is a mathematical notation: inclusive -> [0, 4] <- inclusive
If i would have wanted to exclude the upper bound then i would have said
rolling [0, 5[ twice is the same as rolling [0, 9[ once.
okay well in that case if this code wasnt made by human hands its probably just a deobfuscation bug
ItemStack[] menu = {item}
Adds the item to the GUI, but I am wondering if I can make this an arraylist? I would prefer if it is an arraylist because eventually I want to make the plugin be able to add more options to the GUI through a command.
Like /gui add string adds an option to the GUI opened with /gui. So it would be possible to do if it was an array list right ?
Yes I do remember 7th grade math
cant relate
you can just keep an arraylist of items and add those to the menu you are gonna show when you create it
Immutable:
List<ItemStack> menu = List.of(item);
Mutable:
List<ItemStack> menu = new ArrayList<>(List.of(item));
PS: This is a horrible approach to guis
is there a better approach in spigot?
save stuff to configs or databases
what do configs have to do with guis
save the items you want to add to a config, read from config when you need to use it
how is that less horrible compared to changing a list at runtime
There is one approach which is currently agreed upon to be the best. There are some variations but generally
you want to use a class which creates a "button" by combining the ItemStack and a Consumer<InventoryClickEvent>.
All of this is then mapped int to button
wtf all i posted was the xp bottle code and somehow we got to DnD and magical numbers lmao
spigot moment
well i want it to add items to the gui through a command would this be possible with doing it through config ?
imo @rugged kettle 's name is pretty shady
You should write the system agnostic of your input methodology.
Then you can add configs and commands and everything else.
oof, I just have an abstract gui inventory class with clickevent where I just check for the slot clicked to see if matches the slot the items supposed to be in
This is what most advanced gui systems use
I am sorry, i have no idea what this means lol I am very beginner and trying to practice to supplement what I learn in school (my teacher is not very good)
maybe I should try this system
Hello, I'm facing a problem right here, I'm trying to spawn an NPC with NMS and Packets but It's not working even though it should:
Player p = (Player) sender;
Location location = p.getLocation();
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
WorldServer world = ((CraftWorld) location.getWorld()).getHandle();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Cat");
PlayerInteractManager playerInteractManager = new PlayerInteractManager(world);
EntityPlayer npc = new EntityPlayer(server, world, gameProfile, playerInteractManager);
npc.setLocation(location.getX(), location.getY(), location.getX(), location.getYaw(), location.getPitch());
PlayerConnection connection = ((CraftPlayer) p).getHandle().playerConnection;
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
connection.sendPacket(new PacketPlayOutEntityHeadRotation(npc, (byte) (npc.yaw * 256 / 360)));
p.sendMessage("Spawned");```
This is the code, and my dependency:
```java
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
@EventHandler
public void Cacto(BlockGrowEvent e) {
if(e.getBlock() == null || e.getBlock().getType() == Material.AIR) {
return;
}
e.setCancelled(true);
if(e.getBlock().getType().equals(Material.CACTUS)) {
Bukkit.getConsoleSender().sendMessage("§aCactus");
return;
}
Bukkit.getConsoleSender().sendMessage("§cNOT CACTUS");
}
Because it does not work? It doesn't run anything, it looks like it's all AIR?
?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.
Oh oops. When I execute the command it seems to work half, in tab it shows that there is a NPC but I can't see it, it just is like it spawned but the packets that let me see it infront of me are not working
send errors
BlockGrowEvent happens before the block is actually grown. So its still air. You need to check the BlockState which is about to grow by calling
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockGrowEvent.html#getNewState()
declaration: package: org.bukkit.event.block, class: BlockGrowEvent
13/Nan
john's code be like
Blew some air out my nose
e x h a l e
can confirm, i am in your closet
You wanna come out... of the closet? You want to tell us something?
ill stay in here for now, quite warm
My room is probably the only warm one in the house rn. Gotta save that gaz so we dont need to import it...
I use this simple technique called invading the middle east
I mean apparently there was oil leaks in some northern pipes
my room is normally the warmest
I don't like making noise so I make sure to close all my windows and doors before hopping on calls
Germany should declare that there are some weapons of mass destruction in a nearby gas-rich country too.
then put my beast 24kg pc on full throttle
3 old monitors that warm up tons
and nanoleaf lights on full brightness
because ive got leds and the windows right next to my pc i have my curtains closed and a like black cover over my window to stop all light getting in
maybe send a teleportation packet
There are not many people with a 1.16 setup around anymore so it will be a bit hard to get an answer.
Uh like this:
PlayerConnection connection = ((CraftPlayer) p).getHandle().playerConnection;
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
connection.sendPacket(new PacketPlayOutEntityTeleport(npc));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));```?
try it and see
Still not working
I also tried:
PlayerConnection connection = ((CraftPlayer) p).getHandle().playerConnection;
Bukkit.getServer().getScheduler().runTaskLater(plugin, task -> {
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc));
connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc));
connection.sendPacket(new PacketPlayOutEntityTeleport(npc));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, npc));
}, 20L);``` but same result, didn't work
IT WORKEED FINALLY
I went to spigotmc.org and copy pasted the first resource that showed up to see if the problem is code or smth else and it worked
How do i run a task every 3 days, and if i restart server taht the timer doesnt start over again?
save end time millis to config and run a task timer in onenable which checks if time is met every minute
why is minecraft's color pallette so bad
save the timer to a file if you are stopping the server
can u show the code that spawns in the color
no
I mean
it's a ton of code and I got 9% battery on my laptop
basically it just spawns itemframes with the colored sub-maps
just look at cerus/canvas on github
?
similar enough
maps have more colors than that
no they don't
I mean
they have enough colors
they have like 80 colors with 4 variants each
one of the variants being the color itself
if I put the image on a black background instead of transparent you'll see a lot more
ah that'd do it
i was confused cuz particles have full rgb colors
those u can color at any rate
maps dont
you pass a byte[] where each byte is a pixel, and it indicates the index in the color array
yea no idea how to go around that. maybe possible with resource packs but im not sure
hardcoded on client
each color also represents a block category
the 4 variants are actually used for height
mf hypixel
But how will i run it then?
like nuker said, when you enable the plugin
I meant save teh time left on the timer
not the actual timer object
Thanks i will try that
okay I was going to fix this later on but this is annoying me so much
When the player is mining I do player#sendBlockDamage cuz I have a custom mining system right
But since its the block the player is mining at the current time minecraft just kind of overrides it.
I tried mining fatigue -1, and -128 but none of them work, I honestly dunno what to do at this point
I checked the implementation and it just sends the damage packet so it shouldnt have anything quirky about it
because its ANSI colors
I checked the implementation and it just sends the damage packet so it shouldnt have anything quirky about it
ANSI
Hello , why iam having a problem with System.currentTimeMillis()
it give me a big number , but i only started the server 3 seconds ago
on Inventory click :
cuz its not based on the server
System time
its systemtime
Since January 1st, 1970
not server time
if you want a really big number call nanos
ok so , how would i get the server time running?
uh
like if i restart server it restart
world or server?
ok thanks
Uh
where can i enable the java annotation processor for lombok?
I think theres something like Bukkit.ticksSinceStart()
but thats not really precise
what you can do is save the system.currenttime into a varialbe at the start
and when you want to get the time
just substract the current one with the variable
what iam trying to do is :
when i click on item it start timings from 0 [its In milis]
yeah so save the system.currenttime into a variable
and then subtract that from the current one when you need it
eee
anyone have experince with Calendar?
just use Instants?
its better?
Java's time API is way more modern
as i said before iam making a quest system , i finished everything i only have some problems with checking for the time if player finish a quest today , and he join tmorrow , the quest should be reset , checks if the started week of the quest is the same as the current week
and if day, if the day the quest has started at is the same as the current day
if there's no match, it'll say false
hold the time they started?
so you wanna check if day and week is the same or smth?
isnt there a seperate java method to get the date directly
so the daily one , if i finish a quest today , and i join tomrrow , its reseted so i can do it again
just save when it was finished then check if it passed the 'reset time' which usually would be midnight, or for weekly, midnight from sunday to monday
i have a started date in my code , when i click on the quest in the gui , it set it
damn i havent come to the point i started dating my code
i have been trying for 3 day's do you really think i didn't google about it xd?
i checked every page for the last 3 day's and i didnt get it working
this is my code for now :
ideas? it keep reseting it the same minute , if i log out , login again its reseted
and that's wrong , it should be 1 day , till i can do the quest again
and the weekly too ..
just have an Instant for each user who started the quest or smth
compare the type and check if the day of the instant is before the instant.plus(Duration.ofDays(1)) or smth
I have a weird problem, in ExpBottleEvent i set XP to 10, but on PlayerExpChangeEvent it shows as 11 for some reason
any ides why that mighr happen?
Can anyone tell me why the lore isn't working? It's setting the name, but lore it is not
@EventHandler
public void onExp(ExpBottleEvent event) {
if (event.getEntity().getPersistentDataContainer()
.has(getBottleKey(), PersistentDataType.INTEGER)) {
System.out.println("ExpBottleEvent1 " + event.getExperience());
event.setExperience(event.getEntity().getPersistentDataContainer().getOrDefault(
getBottleKey(), PersistentDataType.INTEGER, 0));
System.out.println("ExpBottleEvent2 " + event.getExperience());
}
}
@EventHandler
public void onGain(PlayerExpChangeEvent event) {
System.out.println(event.getAmount() + " xp");
System.out.println(event.getPlayer().getExp() + " i " + ExpUtils.getExp(event.getPlayer()));
}
ExpBottleEvent1 7
ExpBottleEvent2 10
11 xp
^ this is what prints
why setting meta twice
?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.
its not paranoia if theyre really out to get you
i see alot of meta there lol
wha
ur better off not asking i think
Old MacDonald had a farm
Ee i ee i o
clean u p that code mye
🙏
i mean sure i can subtract just one and call it a day
but i will not be able to sleep well
i absolutely would be able to sleep well
getting pdc key twice 🥺
i dont have time to write it as it should be for 10 times
well then theres a new problem
if its 1 for some reason it gives 0
if i subtract 1
so something math related goin on
oh yea definetly
setLore requires a list
math is hell
howd u know
I have a list, all the other lores are working just this one setting it to player skull isn't
honestly im just hoping for someone that might know the solution to it to be randomly active and click on the mention here
what can ya do i can only hope
And on his farm he had some cows
Ee i ee i oh
withdraw math is correct btw
?paste send the code on there so its easier to read
weird shit
also @echo basalt this is your fault too since its powered by your code
if slightly frankensteined to create circle segments if asked for
👍
tbh all good codebases can summon a frankenstein monster so its probably fine
whats your issue
its when bottle splashes
basically
depending on number, it gives wrong amount of xp
on PlayerExpChangeEvent
possible impostor might be orb spawning with additional 1 XP or something
well yes
whats the issue?
bottle should give 10 xp and it gives 11
and that problem scales
with 200xp it gives 202
isnt ref like $.03? a banana is like $.006
realtalk i should run it on clean server
i just saw ecoskills in it
bruh i don have any
money or skills?
servers
localhost
OOM
i always test localhost unless i need more people
bruh it was ecoskills looks like
i use them to confuse my brother
dude how is your pc alive w runnign 3 INSTANCES OF MINECRAFT
and A MINEDCRAFT SERVER
and probably intellij
and probably 20+ tabs
send me some ram
i was about to say 2.4 with 4 mc instances and ij
Ah I seeeeeee
I might be getting a 4080 soon™️ so thats nice
the actual limitation is my RAM
isnt a 4090 more worth it
maybe idk I will look at it once I decide that im gonna buy it and not wait for the 50 series
its not even a thing
could be an old event
could be a paper event
yeah
theres 1 search result on google exactly
so yes
custom
and something internal nobody ever touched
tf are handlers
its so sad lmgtfy isnt working
@EventHandler
is just java speak for 'if this happens, call this method before you do'
i think
i always forget which @ annotation is the correct one
i dont think so
eventhandler is just telling spigot that well
this is an event method
this be event
call it if said event occurs
2012