#help-development
1 messages · Page 2041 of 1
Nah xD
idk if this works but there's Entity#remove()
that skips the death animation tho
you can't
we literally just talked about this
i dont get that
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent
that just sets x amount of damage.
yea so?
there is no guaranteed way to kill a mob
set it to the mobs health
you CANT
there is no way to GET or SET the health of the entity being damaged.
because if you could get it, chances are you could set it.
declaration: package: org.bukkit.event.entity, class: EntityEvent
thats ur victim
u can get its health
set the damage in the event to that
boom!
Is it possible to compare integer and int types of variables?
for example:
Integer num1 = 0;
int num2 = 1;
if(num1!=num2)
System.out.println("not equal")
yes thats possible
no, it will automatically unwrap the object
just 2 Integer objects would be obv. unequal
I'm doing it because I need one of them to be null at the start, I guess I can just put both of them as Integer types to save some trouble
or just use a boolean
That is also possible true
and better
you won't have a redundant object for a boolean value
You’re saying you can’t set the health of an entity?
On an entity event?
also its IMO bad practice to use null for that
when appropriate, fine. but explicit a bad practice
nah you have to use the wrapper
Wrapper means integer?
yes
I see, thanks! :D
Are you making sure you’re casting the entity you’re getting from the event to LivingEntity so you can access health methods?
I did not do that
guys
im spawning an arrow and setting its velocity to my getLocation().getDirection().multiply(10)
but when the arrow hits a player
i dont wanna say i told you so but....
How can I check if a damage cause is an arrow inside EntityDamageEvent
spawning the arrow```java
Arrow bullet = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection().multiply(0.1)), Arrow.class);
bullet.setShooter(player);
bullet.setVelocity(player.getEyeLocation().getDirection().multiply(10));
bullet.setBounce(false);
bullet.setGravity(false);
bullet.setMetadata("bullet", new FixedMetadataValue(plugin, gun));
https://paste.md-5.net/xuxukesiza.cs the blood effect
yo?
?paste
NOTE: IM USING JDA, CONNECTS TO DISCORD
Any reason why this isnt working?
Code: https://paste.md-5.net/ovonuyibub.cs
Error: https://paste.md-5.net/lofitubelu.apache
Link to what im using: https://github.com/DV8FromTheWorld/JDA#download
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
Main error: java.lang.ClassNotFoundException: net.dv8tion.jda.api.hooks.ListenerAdapter
...?
Is anybody available to help me w/ my issue?
Are you not allowed to depend outside stuff?
AKA it muts be spigot or bungee cord?
*must
idk im just saying
did you import JDA
Did you shade it into your plugin?
Yes
repositories {
mavenCentral()
}
dependencies {
implementation 'net.dv8tion:JDA:5.0.0-alpha.9'
}
Unsure what this means.
There's your problem lol
It told me to simply insert that to impliment it.
?
When you run your plugin, it does not include JDA's classes.
So..?
How can I check if a damage cause is an arrow using EntityDamageEvent
You need to include JDA's classes inside your plugin via shadow.
How do I fix it then lol
I still dont understand what you mean.
You guys keep saying shadow and I dont understand what its for nor what it does
:/
He literally sent a link to it 
Do I just depend it as well
or
It's a Gradle plugin
https://google.com
"How to use shadow"
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
I don't see a way to get any more specific than that it's a PROJECTILE
?jd-s
If I use PROJECTILE by it self, then it will just check if it's any projectile
I need an arrow lol
@vocal cloud Am I dumb or smth
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
}
It isnt working
and I read the instructions
I don't use gradle so
but it should create a shadow jar
hold on there is a section on gradle
help pls
you need to apply plugin: 'my cool plugin here'
outside that
outside the plugins section
That's if you're using multiple subprojects
okay, then how do i install it correctly
cause i NEED this to work
badly
I'll find an old one
idk maybe im an idiot or smth
i use something like that
gradle build and then gradle shadowJar
also yes
Actually it's uhh
gradle shadowJar
wack
by itself
it works without it for me
since build calls jar
you need to show me how LOL
okay im completely confused
its why i need description here
or else i cant do it
...
press enter after typing that
then wait
then type
then wait
then you have the file.
Welcome to:
"I don't understand how to use Gradle properly because I use MinecraftDev's default configurations."
im actually going to shit my pants
What the fuck does that have to do with anything
well thats clearly a command bar
good job
Oh
based on the arrow
you have eyes
INTELLIJ
okay
^^^
and look around the IDE
Say IDEA, not Intel
INTELLIJ OR IDEA
Intel is a fucking CPU architecture lol
im going to actually shit my pants
At the bottom there's a tab called Terminal
bro
OHHHH
true enough
gradle : The term 'gradle' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
- gradle build
-
+ CategoryInfo : ObjectNotFound: (gradle:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Clearly
i wear glasses
./gradlew.bat
./gradlew, not just gradle
Well yeah, that's the PowerShell error
PS C:\Users\pixel\IdeaProjects\EmeraldsPlugin> ./gradle build
./gradle : The term './gradle' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
- ./gradle build
-
+ CategoryInfo : ObjectNotFound: (./gradle:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
oh
Actually no it means Wrapper
The gradlew files come from gradle wrapper
all
k
christ
anyone here familiar with bedrock edition?
someone in #help-server ?
If no one is there then no one is here lol
lol
any ideas on why the arrows is backing?
It's probably Sabaton scaring them off. Especially The Red Baron.
😩
but even without the red baron that happens
Arrow bullet = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection().multiply(10));
bullet.setShooter(player);
bullet.setBounce(true);
bullet.setGravity(false);
bullet.setMetadata("bullet", new FixedMetadataValue(plugin, gun));```
me spawning the arrow
If you don't spam the errors does it bounce? I imagine this might be related to the invincibility frames
tried to set bounce and gravity to false, true etc
nop
if i shoot slowly
it works fine
Yeah because the invulnerability frames. The arrow just bounces off the mob because it can't take the damage yet. Or at least that's what it looks like. You also have bounce = true
tha happens even with bounce to false
Like I said it's probably the invulnerability stuff
declaration: package: org.bukkit.entity, interface: LivingEntity
pls help me in #help-server
no
nop :C
moved that to the runTask
now it is working
:D
now
how can i prevent the arrows that are shoot from the water to stop?
I don’t think you can
So confused on why this doesnt work
nice token
you can simply regenerate it
oh
true
anyways
public class DiscordBot{
private DiscordBot() throws LoginException {
JDA jda = JDABuilder.createDefault(nice token)
.addEventListeners(new BotListener())
.setActivity(Activity.playing("Watching over the minecraft server!"))
.build();
}
public static void main(String[] args) throws LoginException{
new DiscordBot();
}
}
Any reason why my bot isnt loading?
It SHOULD load
or do I need to run main by myself or smth
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
heres the github
obviously
look how discord srv does it
so i need just general guidance this is the first plugin i'm making but: I want to prompt the player after death to allow them to decide where to spawn, how should I go about prompting them?
it's not like you can type in the death screen
so should i make a separate dimension and spawn them inside of it each time?
idrk
also um
the only option i have for creating a project is 1.18.1 and sooner
have the libraries just not updated yet or did i install old versions of them?
if you're using maven switch the version in the pom to 1.18.2
oh ffs
now my bot stops working
nice!
public class DiscordBot extends ListenerAdapter {
public static void main(String[] args) throws LoginException {
JDABuilder.createLight(lol no token, GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
.addEventListeners(new DiscordBot())
.setActivity(Activity.playing("Type !ping"))
.build();
}
@Override
public void onMessageReceived(MessageReceivedEvent event) {
Message msg = event.getMessage();
if (msg.getContentRaw().equals("!ping")) {
MessageChannel channel = event.getChannel();
channel.sendMessage("Pong!");
}
}
}
anybody see an issue here
or no
Is it for a survival server or a minigame or what?
🤣
System.out.println("test:" + args[1] + "player" + args[2]);
}else {
player.sendMessage(ChatColor.RED + "specify an user and motivazion");
player.sendMessage(ChatColor.LIGHT_PURPLE + "/test motive user");
}``` i failed lol i want to make a /report command someone help me? (sorry for me english im italian)
is anything calling main
survival server, writing a plugin that allows for multiple respawn points
you’d just select which one to respawn at
.-.
all
?
help me with this
yes.. but I cant help without more info
the error is the args
Stack trace?
what error
i want to make a /report command, example: /report [player] [motivation]
ok.. but what is wrong with the args
cant help if you cant tell me whats wrong
ALL THE ARGS ARE WRONG
idk the args
idk how do i make a report command
@Override
public void onDisable(){
DiscordBot.stopBot();
}
public static void stopBot(){
if(bot != null){
bot.shutdownNow();
}
}
Why isnt this running?
on "/reload"
or restart
and etc
you should learn how to make a plugin first
nope lol
learn how to do java first
research on that
and then research on plugins
before attempting a plugin
im assuming they already know java
add logs to see where it doesnt run
Well it 100% should be lol
thats the thing
you think it should doesnt mean it does
you can't do args[2] if the args are smaller than 2
a list starts at 0
so the first variable is args[0]
One example pls?
ok
you really should learn java before doing bukkit
how do i copy my built jar directly into my plugin directory?
using gradle with the .kts extension :D
you can make another Main and name it whatever you want, like CustomDeployment or something
don't add it to git
don't put it in a package with anything
and remove the public access modifier from the class so you don't see it anywhere
add a Main method
and create a run configuration for it
in that run configuration, add a run before task and select the maven clean and package configuration
now you can do whatever you want immediately after building, including using the File class and copying it over which only takes 2 seconds to write, Files.copy()
and you're only limited by Java still
or you can use any of the other configurations like shell script
are you using shadow plugin
Read my status
No
should i ask java questions here
Sure
this is an old question and it's prob the only one that I still haven't solved
so i started ffmpeg (for audio encoding) as subprocess using vanilla java process api
and I decided to make ffmpeg output to stdout by setting output to pipe (on ffmpeg)
so the problem is: after 7 ~ 9 minutes, it hangs
my first thought was the stream was not being read (https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4763397) and the buffer was filled, so I made it also read stderr (in this case, it will be the ffmpeg debug/information output). it doesn't help
after few months, around 4 months ago, I made a minecraft launcher, also using subprocess. and the same problem comes.
now it turns out it can last for around 30 ~ 50 minutes, after that, it hangs
I decided to use other solutions in the end, but I still haven't figure out why this happens
(For example, the ffmpeg one, I decided to use native encoder instead, and the launcher one, i decided to not use vanilla java process api)
I searched on stackoverflow, which doesn't help
I even created a post on stackoverflow, and also doesn't help
OS: Linux / Windows, doesn't matter
Java Version: JDK 8 302
I lost the code, sorry
Is there a way to get a full spigot jar from maven?
no, use buildtool
@sonic forge can't u just restart it every 5 minutes or so?
well, i can't restart minecraft process every 5 minutes, and I know some ways to go around this, but I want to know why this happens so if I'm in a situation that I really want to do subprocess, I can fix it
Ok thanks
the issue may be because ffmpeg uses native processes to do its thing, instead of trying to invoke ffmpeg in this way, you should instead have your java application invoke it via commands from a shell and grab the output/input stuff that way.
how about the minecraft one, is there a fix
I didn't know mc uses ffmpeg o.O
i made a minecraft launcher after that, and same problem comes
probably because you are using process api
as I said, ffmpeg uses native code to do its thing
it makes use of hardware/OS specific stuff as opposed to just done in software
yes ik but
isn't process supposed to be like
you spawn a process, and it runs
with other languages it went fine
yes but that doesn't mean Java can just simply inject itself either
uhm are we taking about the same thing lol
Yes we are, you are wanting to use a high level language to interact with what is essentially a native binary which doesn't usually go well, at least not without JNI but even then that isn't Java attempting to wrap itself around something
Just because you are able to do it, doesn't mean the native binary will allow it, other languages work probably because they have native code for it
unlike Java which does not
are you talking about this
if yes then im pretty sure that the opearting system/proceess doesn't work like that
interesting username you got on that one
you wanted an answer, unfortunately it isn't one you liked. Doesn't mean it is any less untrue in regards to working with native binaries and not using JNI or some other way of invoking it instead of trying to create a wrapper around it. You can wrap java around a process, doesn't mean java can inject itself to obtain input or output from it.
I offered an alternative solution to your problem, in fact two of them
leeme do some research about it
You can use JNI or invoke it from the shell using java
would recommend just invoking from the shell and for the launcher JNI which should do just fine
isn't JNI for native libraries
ffmpeg is a native binary
isn't it different thing
different in what way?
binaries are executable
libraries are not executable
im not C expert or smt, but that's what I thought
and if im not wrong, binary will search for native library from path or smt
not path but like env var
binaries can both be an executable and library/api
no different then how a java jar can be an application and provide an API IE spigot
uhm can you give an example
p sure it's different
never said it was
just said native binaries can both be executable and be an API in one binary
so like
blablabla.so = library
blablabal = binary
(on linux)
and:
blablabla.lib / blablabla.dll = library
blablabla.exe = binary
(on windows)
however, when dealing with native binaries, JNI is what comes in handy sometimes as it is designed for interacting with native binaries
and i don't think
blablabla.exe can aslo be treated as library
unless you are injecting into them or smt
a .dll on windows is strictly a library only
however there is no rules that say an executable can't both execute and provide an API
if im not wrong, sub process is still gonna fetch libraries from /usr/lib
instead of using the one provided by java
and the subprocess will be running directly under jvm, not java
is that
what you're saying?
cuz i feel like we are talking about different thing
ig you were talking about native libraries?
and also, im starting a process, not using any library or library it provided
I said native binaries. They can be libs or any executable that is native to the OS. And unfortunately trying to answer this question of yours in a way you understand is not easy especially if you don't understand that binaries can be dual purpose and not understanding my analogy in how it is the same in java in regards to jar's. Not much else I can really say. I gave you two alternative ways to invoke ffmpeg from java that would most likely fix your problems. Whether you believe me or not or accept the answers is on you. I do recommend doing more research before you decide with your limited expertise to tell people they are wrong in what they are trying to tell you.
last question, are you sure what you are talking about
im pretty sure subprocess is using system call
It does, however it is still a wrapper functionality. Either the way you are using it there is something wrong or the way the process api is interacting with the binary doesn't allow for what you are trying to do. In either case I gave alternative solutions that would most likely work. When dealing with native binaries and java when you are having issues, there can be multiple things preventing it working the way you are expecting. I can't tell you which of those things may be the cause, it could be that what the program is outputing doesn't allow java to redirect the output in an ideal way thus causing the java wrapper thread to freeze up. It could be because of thread starvation in trying to handle the data maybe IE too much data for the thread to handle with the resources it is allowed to use. I can keep coming up with more things but that isn't going to help all that much. So instead of trying to debug all the possible ways with using this particular api, you could easily do what you are wanting also from JNI or command invoktion from the shell using java to run the commands.
hey Ive been trying to make a race plugin using scoreboard teams and I set a gui that if u click certain items it adds you to a team, and then I made a runnable and within it a foreach player in the server statement, within the foreach statement i put an if statement to check if the player is on a certain team and if so it gives him effects. the problem is that if somebody else picks a race it gives them the effects but for the first player it doesn't give the effect anymore (basically only one player can be in a race and have powers)
Can anyone help me? ty for ur time
?paste
going to be an issue with your code
the entire code?
we don't need the whole project code, just the relevant class or classes involved with the loop you are trying to implement
since that is going to be the most likely area where the problem is at
alright, so every time the task repeats
all the objects reset
so the way you have it implemented it isn't going to remember who did what unless you create classes/objects to hold that information
Yeah that would most likely be the cause of it. I would recommend though researching in implementing this a bit better
current way you are going about it, it isn't going to scale very well
I used to try it with arrays instead of teams
and I thought that was why it didn't work
Well using teams is fine, it is your task and loops that are the issue 🙂
the task, repeats which is fine, but because the objects essentially get reset every time the task repeats you don't have any code or classes to facilitate in distinguishing who is doing what
So if i set the team within the reapeating task to be equal to the public team and all of that is in the repeating task could that fix the problem?
bc its the same thing so im not quite sure what to do
alright lets see, what is the purpose of the task
to repeat its self?
Alright so lets just say somebody drinks a bucket of milk, thats why im using the repeating task so it can counter it and add the effects and everything every tick or 5 ticks
there is events for such things
that is right but i donno its the first thing that came in mind to me
to use a repeating task for it
Well, best to make use of the events where you can, and then if there is something an event won't facilitate then make use of a task 🙂
odds are you probably don't need this task
if that is true and since it is giving you problems, then it could just be removed completely lol
?jd
hmmm
if you need to apply an effect every so many ticks, since an event won't cover that portion
you could make use of the event on the bucket part, and then from that event add a player to a map
then from your task, you could check the map however often you need it to be for who is in it
apply whatever to whoever players in said map until you deem not necessary and when that condition is met where they don't need an effect applied, have said task remove them from the map
and clear their effects at same time
The reason I thought of this first is to counter every option to get rid of the effects
well, you could just listen for events on potion splash I think and as well drinking potions
and just cancel them
that wouldn't require a task
Alright i'll try
and if I ever use this task again
I need to save whatever Ichange in the task
right?
yes if you want the task on the next cycle to remember what it did previously
otherwise it just simply forgets and grabs objects in their current state regardless of what the task did prior cycle
Wait but the team.addplayer is not in a repeating task
how is that it only remembers one player
its within OnInventoryClick
then why can only one player get the effects?
if (Endkin.hasPlayer(p))
{
p.setMaxHealth(24);
p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(100, 1));
obviously whatever Endkin matches is the condition that gets matched one time
so it is however that object/class gets updated
if it doesn't update except only having the last player that did something
then it would only ever get the last player involved
so Saving it within the gui can also be a possible way to fix it
like
in the click event
it is possible, I don't know what the rest of your code looks like, so that is something for you to determine 🙂
but now you know you also don't need that task either
or most likely
hey guys, please, i was told that i need to switch to headless jdk to run a few plugins correctly. Is there a chance someone can help me to do it?
running linux?
nope, windows
just trying to set my server, but plugins such as worldedit and worldguard are not running properly
well i am running with mormal jdk
and they are working fine
so something different is wrong
any logs with errors?
spigot: 1.16.4
we: 6.1.9
wg: 6.2.2
i tried almost every spigot version with every compatible version of those plugins
i'll try. gimme a second
The server should/does bundle the SQLite jdbc
your worldguard and worldedit versions are outdated
use version 7.0.4 for worldguard and 7.2.0 for worldedit
but those versions are also for newer minecraft versions
it's with these versions
did you use buildtools to obtain spigot?
i downloaded spigot jar server from the spigot website
I have doubts the spigot website illegally distributes the server jar
so, how do you recommend me to obtain it?
?bt
You use the spigot build tools to build the jar yourself
oh okay, i'm going to try it right now
when you get buildtools
run java -jar BuildTools.jar --rev 1.16.4
to get the version you are wanting to use
always use buildtools to obtain spigot
it is the official way and you know for certain it hasn't been tampered with
which is most likely your problem from where ever you got your jar from
i see, do you think it will fix those errors?
most likely because spigot has sqlite shaded in
so the error you are getting isn't something you should be getting at all
unless of course someone removed said libs from the jar
Caused by: java.lang.ClassNotFoundException: org.sqlite.core.NativeDB
that looks to be it
You likely forgot to load teh class Class.forName("org.sqlite.JDBC");
they're asking a server question
what other plugins do you have?
they should be in #help-server
^
well, not like anyone was in need of development help
there are just those two plugins. Since I recieve this message I tried to create the folder with all those files again and again
so there was no need to put any other plugins
just we and wg
yes it does
7.2.0+ has 1.16 support according to bukkit site
that is for worldedit
lol
they confuse me all the time
go ask enginehub tbh
chances are someone had the same problem as you and they'll know the issue
the issue doesn't make sense
because worldedit and worldguard don't package their own sqlite drivers
only other thing is they are running in a directory like onedrive
But is there specific reason to use 7.0.4 version when it's outdated ?
they are using 1.16.4 spigot version
7.0.5 is for 1.16.5
it is possibly 7.0.5 could work for their verison
but since they are having issues, best to stick with versions specified for the version of mc they are running
i can also switch to other spigot version, i just need it to run normally🤣
So u just need server on specific version or just server ?
well if you are able to run updated spigot, recommend running the latest
no reason to run an outdated version if you don't have a reason for it
when i tried to run the 1.18 spigot, i got the message that i do not have a java 16. After I tried to install the java update, it still ended up installing java 15
@balmy panther did you actually use buildtools
they did
but odd on the java installing thing they said
I really don't know what system or setup they are running where they could get confused like that lmao
but the error at hand though really doesn't make sense and odds are updating isn't going to fix it. If anything it is a permission problem, and if they are on windows which I think they are, its probably going to be they are runng out of a onedrive directory
however, they should update regardless and test it out still
if they are only running those 2 plugins then it can't be a plugin loading its own sqlite driver since worldedit and worldguard as far as I am aware don't package their own.
public static IBorder select() {
switch (Version.getCurrent()) {
case v1_18_R1:
return new Border_v1_18_R1();
case v1_17_R1:
return new Border_v1_17_R1();
case v1_16_R3:
return new Border_v1_16_R3();
case v1_16_R2:
return new Border_v1_16_R2();
case v1_16_R1:
return new Border_v1_16_R1();
case v1_15_R1:
return new Border_v1_15_R1();
case v1_14_R1:
return new Border_v1_14_R1();
case v1_13_R2:
return new Border_v1_13_R2();
case v1_13_R1:
return new Border_v1_13_R1();
case v1_12_R1:
return new Border_v1_12_R1();
case v1_11_R1:
return new Border_v1_11_R1();
case v1_10_R1:
return new Border_v1_10_R1();
case v1_9_R2:
return new Border_v1_9_R2();
case v1_9_R1:
return new Border_v1_9_R1();
case v1_8_R3:
return new Border_v1_8_R3();
case v1_8_R2:
return new Border_v1_8_R2();
default:
return new Border_Unknown();
}
}```
How I can do this so one border for every version?
is it different in every version?
or you just needing to dynamically import?
I am going to assume you just want to condense that down
to where it is like one method
Class.forName(String classname)
grab the version from the server, pluck it in
you can have a method to convert the version appropriately
and then you can create an object in that manner without strictly having a specific import
this works if the code/object you are wanting is not different between the versions or whatever you are doing doesn't matter between the versions
From 1.8 to 1.16 the same on 1.17 it have packet
Just thinking if this is posibble to have that condesed or if I want have viaversion on server I need to have it like that ?
Hello, it's been a while since I made a server plugin.
I am trying to make a plugin for 1.18.2 but I can't find the JavaPlugin class.
I consulted google without success. What changed?
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
aha! Thank you
hey guys is possible to send a message to a discord webhook in spigot plugin?
yes
how
very carefully
what
Yeah if you're not careful your computer will explode
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
?
Yes it's possible
if you want a recommendation on a library to help you then I recommend looking at DiscordSRV
JDA
but if you were hoping that someone would just give you some kind of magical code, well I doubt you will find that here lol
URL u = new URL(url);
JSONObject payload = new JSONObject();
payload.put("username", "Pancake");
payload.put("content", message);
Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
String json = gson.toJson(payload);
HttpsURLConnection connection = (HttpsURLConnection) u.openConnection();
connection.addRequestProperty("Content-Type", "application/json");
connection.addRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36");
connection.setDoOutput(true);
connection.setRequestMethod("POST");
OutputStream stream = connection.getOutputStream();
stream.write(json.toString().getBytes());
stream.flush();
stream.close();
}```
it's correct?
it is one way of doing it, but recommend you get a discord api token to use and make sure you use the bot endpoints
otherwise might see some unwanted attention in regards to your bot 🙂
why you recommend to make the bot?
if i don't make a bot i get banned?
you could yes
because discord says so? go ask them its in their ToS
oh
what you decide to do is up to you
v1_8_R2 which version I should write in dependecy in version
I can just only give you a warning lmao
and if i make a bot i don't get banned???????????????????????????????????????????????????????
the odds of getting banned for misuse of the api and endpoints is far less likely yes
why is it improper use of api?
I don't make the rules in using discord api stuff. Discord team makes the rules. Whether you get banned or not is not up to me, it is their decision and if they do ban you it is generally permanent.
All I can do is just give you warning ahead of time, and what you should do to better avoid such things
1.8.3
BUT WHY DISCORD BAN ME FOR MAE A PRIVATE BOT TO SEND LOGS? sad story
I don't think you are understanding me
why don't you just create a bot ffs
Like that ?
yes
well if you need NMS, use spigot instead of spigot-api
what is ffs
just go and create a bot: https://discord.com/developers/applications
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
@tender shard good luck with them, obviously they don't understand me 🙂
I don't even know what you're tlaking about 😄 do they want to create a bot using anormal discord account?
YES BUT @wet breach SAY DISCORD BAN ME
stop screaming
I recommended that they get an api token because while you can use normal discord account, it is super easy to get banned for using it in such ways
My BuTton broken
however with a bot api token, odds of getting in trouble is less likely
Just get him banned and he will see why u said that
is there another way to get minecraft server logs (no console) without getting banned?
You'll only get banned if you make a user account a bot
there is like a thousand other ways....but obviously for whatever reason you are either not reading anything I have said
can I use java 9 modules and still be java 8 comatible? 😄 I wanna hide my imlementation classes
or there is some kind of other issue like you being a troll or something
He got kicked yesterday or something for it
..
I wish there would be something like "package-parent-protected" so something in com.mypackage.whatever can still be accessed from com.mypackage, without being public
that doesn't surprise me in the least then
since that is the case, then I will just move along and ignore them
you can use reflection for this
with reflection you can access private classes from another package
Reflection is the cure to all of life's problems
yeah but that's too hacky
https://hub.spigotmc.org/nexus/content/repositories/snapshots/ from this repo I should take spigot ?
I'll rather live with the class being public then
if people try to instantiate it, it's their own proble mlol
well without introducing more unnecessary classes, I don't know of another way then lol
no, spigot contains copyrighted code. you must build it yourself:
`bt
?bt
I hate this
When I want to add depedency for v1_8_R2 I need to java -jar BuildTools.jar --rev 1.8.3 ?
yeah that was actually the problem lmao
yes
That wasn't the joke but sure
How I can use Java 7,8 when I have java 17 ?
do you even have java 8 installed?
if not, first install it
then instead of just entering java you enter the full path to your java 8 executable, e.g. C:\Java\jdk-8\bin\java.exe
how the heck can KEY_KEYS be null? It's declared directly above
Intellij shows you why in the show more tab
does not matter
it is what it is
no, it doesn't give any explanation
Quick question before talking about my actual problem, i'm on Spigot 1.18.1 and i'm trying to make custom pathfinding goals for entities. There is no api in spigot to achieve that right?
Custom pathfinding is usually done through nms
yeah and that's the thing
i'm on gradle using spigot:1.18.1-R0.1-SNAPSHOT:remapped-mojang with the io.typecraft.gradlesource.spigot plugin, everything works fine until i use methods from the this keyword, they are not remapped
what? that makes no sense, the remapping is already included in the .jar itself
note : i'm using remapped-mojang source
well if you're on remapped, then everything should be remapped. do you maybe accidently also have the non-remapped .jar as dependency?
maybe you once added it directly to intellij, without gradle, or sth?
nope
only have this dependency : implementation "org.spigotmc:spigot:${project.mc_version}-R0.1-SNAPSHOT:remapped-mojang"
this keyword shouldn't make a difference on anything since that is a keyword that is part of java itself and not related to any dependencies
yeah i mean when i use functions from super class
lemme show the problem
here is my class:
when i build the plugin and use SpecialSource (through io.typecraft.gradlesource.spigot gradle plugin), it remaps almost everything correctly except these:
oh you mean in your REMAPPED jar, it breaks "this.methodCalls"
now it makes sense lol
hm maybe it's a bug in that plugin. have you tried to use the maven remapping plugin instead? you can download it here https://repo.maven.apache.org/maven2/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar and run it from command line
if that works, it's a bug in the gradle remapping plugin
yeah i've tried but for some reason java tells me it can't find the main class but it's probably because i'm using SpecialSource-1.11.0 ?
lemme re-check
(also because i'm not using the shaded one too, cuse i'm using it directly from the maven local repo directory)
nope still Error: Could not find or load main class net.md_5.specialsource.SpecialSource, am i missing something?
what did you enter to run it?
This is the command as md_5 mentioned in the announcements:
java -cp $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT-remapped-mojang.jar net.md_5.specialsource.SpecialSource --live -i $PLUGIN.jar -o $PLUGIN-obf.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-mojang.txt --reverse
java -cp $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT-remapped-obf.jar net.md_5.specialsource.SpecialSource --live -i $PLUGIN-obf.jar -o $PLUGIN.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-spigot.csrg
note : cd is my output dir, and SpecialSource is also in this folder, i'm on Windows and i also tried replacing $HOME with %USERPROFILE% and / with \ to be sure
java -cp SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.18.1-R0.1-SNAPSHOT/spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang.jar net.md_5.specialsource.SpecialSource --live -i TestPlug-1.0.0-all.jar -o TestPlug-1.0.0-obf.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.18.1-R0.1-SNAPSHOT/minecraft-server-1.18.1-R0.1-SNAPSHOT-maps-mojang.txt --reverse
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Player player = (Player) event.getPlayer();
if(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if(player.getItemInHand().getItemMeta().getDisplayName().equals("MODALITA")) {
Inventory inv = Bukkit.createInventory(null, 27, "MODALITA");
}
}
}``` how can i make to open the gui with right click?
player.openInventory(inv);
Ok tank you
hey so i wanna make a world gen plugin where you can customize everything with a gui, except that i dont know anything about world gen... does anyone know where i could start?
interesting you would want to do it from a gui
do you have a better idea?
probably not from a GUI, since in order to have a GUI you would need a world to begin with
and then would have to have the GUI generate a second world to apply its effects or whatever chosen
where as with just a config file and plugin, it could generate the worlds on first load up potentially
anyways
some of it might be outdated but should for the most part be relevant
its all decpreated
declaration: package: org.bukkit.generator, class: ChunkGenerator
that isn't deprecated
someone knows again how to link to foreign javadocs using maven-javadoc plugin?
my bad guess i was wrong
depends
so basically about what u said about the repeating tasks
its not only for repeating task
if a player joins even the events doesn't work
its like whenever a new player joins the team it removes the previous player
and to add a item :(?
the events should work, not sure what the player would be doing when they are joining. that is, I don't think it is possible while they are joining for them to be doing things with potions lol
second, if a player is being removed from the team when another joins, then there is something wrong with your code involving teams
I have a feeling you are not keeping a reference to the scoreboard
inv.setItem(index, stack);
OHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH TANK YOU ❤️
anyways, there is other people here that can help out in regards to scoreboards and teams
I am going to bed 🙂
yes, me, here : #help-development message
ItemStack sword = new ItemStack(Material.STONE_SWORD);
inv.setItem(index, food, sword);``` cannot resolve symbol index :/
:/
index is the slot index you want the item to go to in the inventory, if you just want to add the item to the inventory, you can also use inv.addItem(...stacks)
oh okay
if(player.getItemInHand().getItemMeta().getDisplayName().equals("MODALITA")) {
Inventory inv = Bukkit.createInventory(null, 27, "MODALITA DI GIOCO");
player.openInventory(inv);
ItemStack food = new ItemStack(Material.STONE_AXE);
ItemStack sword = new ItemStack(Material.STONE_SWORD);
inv.setItem(food, sword);
}
}```
don't work
:(((((((((((((((((((((((((((((((((((((((
Thats because you don't know java
i don't want to make a compless plugin i want to make this inventory plugin and i use public plugins
Yeah but at this point we're writing the plugin for you
no i maked other in my plugin
If you really don't know java i can suggest you take a look at the plugin Skript if you want to do quick little things in a natural language
I'm having a hard time with this inventory thing
😦
YES yes
o
on compass pressed plugin open gui
i think he wants to make a compass that when right-clicked opens a minigame/server/hub selector gui
oh
yes
sorry for my english im italian
to add items
to the gui?
yes
if you look carefully you'll see that i already told you what you want to do, but you wrote the wrong thing
Can anyone help me, When I use teams and I add a player it takes the previous player and sortof removes it from the team
here is the team code
but the code you're giving us is not adding any players to a team
but why do you overwrite the team field again?
where?
literally everywhere
wdym?>
like in this : Human.addPlayer(p);
Team human = Human;
Human = human;
break;
just use addPlayer, there is no need to get the team and override it back
It was a try to fix the problem
didn't work
Team human = Human;
Human = human;
this part
this does nothing
yea I understood it once i tried xD
The thing is once I add a player to a team it removes a player that was already in the team
so 2 people cant have powers
only one
in the server
Anyone have any suggestions?
this should not happen, i think you have something else doing something wrong, according to the api (at least in 1.18) you should use addEntry(String entry) instead
have you tried using vanilla command to see if the players actually are in the team?
Any idea as to why does this return null?
Player p = (Player) sender;
Inventory inv = Bukkit.createInventory(p,4,"Custom Menu");```
what returns null?
The inv variable gets a null object
uhh it shouldn't
Look at your console
probably cuse you're only using 4 slots
doesnt createInventory require the int passed to be %9=0
exactly
if you want 4 rows, use 4 * 9
that's why I told them to look at the console because it's explained there
Ahh I see, I thought it was the number of the rows
if you want a inventory with five slots you can use a renamed hopper inventory tho
Caused by: java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 4)
You were right
its the only non multiple nine item inventory tho
well granted
there's the crafting blocks
but those dont count
Ah no I wanted 4 rows, thank you! :D
anyways, came here to get help and yet i'm helping people lol, anyone has ideas? (#help-development message) (should i create a thread?)
Good morning,
do you have a librairy to advise me to call a rest api?
I am currently using 'okhttp3' but I have an error connecting to my RESTAPI.
(NodeJS with expo hosted on my server)
error: javax.net.ssl.SSLHandshakeException
||Full Error: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target||
If it's a local server (not exposed) i don't see the need to use https or did you misstyped?
The restAPI is hosted on an external server.
It is accessible via the web and via the spigot servers that have my plugin
Well then do you have a valid certificate if yes i can't help anymore
/**
* Creates a DataType for a given {@link Enum} class.
* @param enumClazz enum class to get a DataType for
* @param <E> ???
* @return DataType for the given enum class
*/
static <E extends Enum<E>> PersistentDataType<String, E> asEnum(final @NotNull Class<E> enumClazz) {
return new GenericDataType<>(String.class, enumClazz, s -> Enum.valueOf(enumClazz, s), Enum::name);
}
what the heck am I supposed to write as description for <E>
in any case my certificate is recognised by the browsers
Is it somehow possible to let custom enchantments appear in an enchanting table?
I don't think so
IIRC the reason is that the client doesn't have any translations for your custom enchantments
Okay, thanks
The Enum type that the returning PersistentDataType instance manages or sth perhaps
correction: My pom.xml does this.
<repository>
<id>jeff-media-gbr</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
</repository>
...
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>CustomBlockData</artifactId>
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
so why does it throw a java.lang.ClassNotFoundException: com.jeff_media.customblockdata.CustomBlockData
Did you shade it in?
I think so?
<relocation>
<pattern>com.jeff_media.morepersistentdatatypes</pattern>
<shadedPattern>io.github.moterius.morepersistentdatatypes</shadedPattern>
</relocation>```
Are you using the maven plugin for it?
yes
it happens no matter if this is here or not
of course i can copy in the class but I'd rather have it pulled when compiling instead of it being part of the project code
hey guys i maked my gui how can i make the items on the gui not draggable
What is your full pom?
what will be there?
?paste
?
one example?
static abuse lol
@EventHandler
void onDrag(InventoryDragEvent event) {
event.setCancelled(true);
}```
tank you
tanks are in ukraine rn
Are you Sure that the shade Task is Run?
I think it is futile to have such a Method If you do Not know what belongs in there
You need to be more concrete
no, I've been following dubious instructions that are probably buried somewhere in the history of this channel
😄
Not work.................
Like, is there any mention of a shaded jar in the logs?
did you register the listener?
?paste
i put it on the main
https://paste.md-5.net/akimikagin.cs
cant find one
public void?
sure
I'll probably have to look at your issue in full when I am at home
thats the full error
not work
I've done join messages in the past and I could have sworn this used to work.
@EventHandler
public void onLogin(PlayerLoginEvent e) {
System.out.println("JOINED");
e.getPlayer().sendMessage("test");
}
I can see the "JOINED" message in the server log but the player doesn't see the "test" message.
Am I doing something wrong?
huh whut?
The connection is pretty Bad here
send the message a bit delayed
or just on join?
yeah, PlayerJoinEvent makes more sense
I did exactly what you told me to do - add the build args and import your lib via maven dependencies & repos. Results in a java.lang.ClassNotFoundException: com.jeff_media.customblockdata.CustomBlockData when i try to use it
and what does not working means? nothing being cancelled?
i can drag items to gui ti te inventory i want items not drag
I had this issue, turns out I wasn't compiling with maven at all, even though I thought I was. I just built with maven and the jar output worked perfectly
Ah, that's it. Thanks
???
explain
gimme a sec
i might have found it
i dont even know what dragging means
nevermind
Could not find artifact org.spigotmc:spigot-api:pom:1.18.2-R0.1-SNAP SHOT in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Items to the inventory
I had a build configuration in intelliJ that I was assuming used maven, but it didnt, I would get that ClassException, what IDE are you using?
intellij
I want to make sure that an object cannot be put in the inventory
changing [clean, verify] to [clean, verify, compile] throws this error
does that happen when you hold your midde mouse button to spread the items?
yes
and are you sure that you're testing it correctly?
yes
then you did something wrong. how did you compile the stuff?
yeehaaw finally everyone can use arrays, collections and maps with all PDC types!
https://github.com/JEFF-Media-GbR/MorePersistentDataTypes
[clean, verify] usually and someone told me to try [clean, package].
I tried with [clean, verify, package, compile] but that too did not help the error
?paste your pom.xml
verify won't do anything. You must use package in 99% of cases
your maven shade definition is wrong
you didn't add any goal
wdym?
1 sec
?paste
put this above <configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
cuz you said this
https://paste.md-5.net/jurixarodi.xml this is what mine is if it helps, using morepersistentdatatypes
yeah I must have forgotten, since normally everyone already has a maven-shade defionition 😄
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>com.jeff_media.morepersistentdatatypes</pattern>
<shadedPattern>io.github.moterius.morepersistentdatatypes</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>```like this?
you're using my old version of MorePersistentDataTypes. If you update to 2.0.0, you can also use COllections, Maps, Arrays, etc etc etc
yes, that's correct
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>MorePersistentDataTypes</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
(it's com and not de.jeff_media now)
ah okay cool, I am mainly using it for Item Stacks and boolean atm but I shall keep that in mind if I need the in the future 🙂
the fuck?
Unsupported class file major version 61
I got this too 😄
are you using java 17?
afaik yes
then change maven-shade-plugin to version 3.3.0-SNAPSHOT
you'll also need this somewhere in your pom:
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
then watch you'll have an issue with digital signatures next, it will be a dejavu for me
under what tag do i put pluginRepositories? <build>?
no, in the root
<project>?
So I'm modifying player's equipment specifically on HEAD slot with packet PacketPlayOutEntityEquipment but everytime I modified it, it plays a sound, is there in any way to modify it silently?
cos it has lots of stuff in it
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<finalName>${project.name}-${project.version}</finalName>
</configuration>
</plugin>
because you shaded bukkit or spigot inside
set spigot or spigot-api to <scope>provided</scope>
so it did include the spigot api ?
InventoryClickEvent

