#help-development
1 messages · Page 1841 of 1
ItemStack spawner = new ItemStack(Material.ENDER_PORTAL_FRAME, 1);
If I use any other item, then It runs
Remove 1 and the comma
tried doing, still same
Also import the Material class
Material.ENDER_PORTAL_FRAME should work
ENDER_PORTAL_FRAME doesn't seem to exist in the material enum
nop
it's probably END_PORTAL_FRAME
doesnt work
END_PORTAL_FRAME should work ENDER_PORTAL_FRAME is legacy now
If it doesn't work please try the forums so see if they can help
both doesnt work
Make sure your API version is set
ItemStack spawner = new ItemStack(Material.STONE, 1);
ItemMeta spawner_Meta = spawner.getItemMeta();
spawner_Meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e&lDragon Spawner"));
ArrayList<String> spawner_Lore = new ArrayList<>();
spawner_Lore.add(ChatColor.translateAlternateColorCodes('&', "&a&L| &7Test"));
spawner_Lore.add(ChatColor.translateAlternateColorCodes('&', "&a&L| &7Test2"));
spawner_Meta.setLore(spawner_Lore);
spawner.setItemMeta(spawner_Meta);
Bukkit.getPlayer(args[0]).getInventory().addItem(spawner);
}```
@EventHandler
public void onPlace(BlockPlaceEvent event){
if(event.getBlock().hasMetadata("spawner_Meta")){
Location loc = event.getBlock().getLocation().add(0, 50, 0);
Entity dragon = event.getBlock().getLocation().getWorld().spawnEntity(loc, EntityType.ENDER_DRAGON);
}```
Idk why Dragon doesn't spawn
probably cause it's not running
i'd make sure the if statement is true
I tried to print message, so its not printing
which means that event is not working
ig its cause of Meta Data
idk what to do
well a newly placed block won't have any metadata afaik
so how do I add meta data to my itemstack block
Is there a way to reduce the duration of a particle effect when spawned? I'm working on a rotating cube effect, and the math's fine, but the particles last longer than the time it takes to spawn the next particle effect in each loop, resulting in the particles overlapping and distorting the cube
Unlikely
I've managed to find a workaround by using the electric spark particle
cool math
I've also tried lowering the speed at which the particles spawn, but that results in a really slow rotating cube
Me who dies with simple math 😳
Take a look at Arrays.asList that makes life much easier
guys, how can i check if the player right clicked in an PlayerInteractEvent
if( event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR ) {
}
love ya
A quick google search can never hurt
ye, i googled and it dint worked sooo ye
or check if the name of the action starts with RIGHT
true
nope
Ya right but i would never check an enum constant on name
i used at first if( event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getAction() != Action.RIGHT_CLICK_AIR) return; but this dint worked well
idk why
because you are checking if its NOT a right click
why not?
ye then it return;
Idk that's just me
oh didnt saw the return, yeah it would have to be the && operator
otherwise it will always be true since it can just be one action
Hello, please help me #general
?paste
Tried to find solution in forums too, but didnt find
if ENDER_PORTAL_FRAME isn't working, then what to use
What version are you developing in?
doesnt work
or you have bad pom.xml
Screenshot?
cant send here
it is in red
you have to reload maven first
there should be an icon if you are using intellij on the medium right
ye done
now it should work
It should be fine then. As long as you installed from Buildtools
Ok
If I install now frob build tools the same version
I don't lose config of plugins no?
No you don't
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The one you showed above is right
showed*
But there is not for install
Read the entire damn thing
https://hub.spigotmc.org/jenkins/job/BuildTools/ You download it from here
then you follow the instructions
denizen?
to spigot?
what do you mean?
you can just rewrite everything to java by using the concept
Ah thought
it would be possible to just use the code
Denzin is a spigot plugin
so for it to execute the code it has to convert it
What do you mean? If Denzin is already a spigot plugin, what are you asking?
are you talking about converting code from deni to java?
just to make sure i understand you
also are you talking about Denizen or Denzin?
no idea, thats what he wrote
ah, so he's talking about converting those skripts into a plugin
Your first reply is accurate then.
Guys, I've a problem. I was looking into the sources of spigot and I've seen that the CommandListenerWrapper has been moved into the net.minecraft.commands package. I've a lib that access a method of that class via reflection. My question is: I want to get rid of the reflection and call the method normally (Importing the package) the problem is that gradle tells me that I can't build my project because the class that I've imported (CommandListenerWrapper) is from a new version of java so I should use another JDK to compile the project. I can't use another JDK because that would break the lib that is used on pre 1.17 plugin
(P.S. I've a factory pattern that doesn't load the class where I've imported CommandListenerWrapper if the version isn't 1.17 or up)
net.minecraft.commands is not Spigot
Spigot is the Spigot/Bukkit API on top of nms. net.minecraft.commands is nms.
I was looking into craftBukkit pardon
CB is teh Bukkit implementation, its still not net.minecraft
Everything you are refering to is NMS, not a part of spigot.
However, Minecraft now requires Java 17. So any plugin you write for 1.17+ will require an up to date Java
or use 1.16.5
I was looking at this article, what do you think? https://stackoverflow.com/questions/30527193/how-build-multiple-projects-with-gradle-with-multiple-jdk-versions
Spigot 1.17+ also no longer includes any Mappings.
and use the shadow plugin
Really?
I don;t use Gradle, but it would be fine, so long as you have somethign to remap to Mojang NMS mappings
What would be the best design for a custom item that holds multiple information such as upgrades, levelling system, etc and the data must persist.
I have 2 idea that I would consider use
- Throw everything into a NBT data and access the data directly there.
- Put an unique identifier such as UUID to the item and then create an object that hold all of data on the fishing rod and have the same unique identifier as the fishing rod and then to save/load the data on a flatfile
Thanks for the infos
Okay, let's make an example, I want to store level, xp, and max xp, does that mean I need 3 NamespacedKey?
That or create yoru own storage object to put in the PDC
Oh, you can put object there?
the PDC javadoc has an example of storing a UUID object
Do you know why Microsoft released some mappings and now no more?
Ah, I could also put a Gson as a String on the PDC too.
if you run BuildTools with the switch --remapped
it will include Mojang mappings
Read the post in #announcements about 1.17, 1.18 and nms mappings
Do you think It's okay to use Gson for storing the objects instead creating a Custom PersistentDataType?
no point in using Gson if you are storing in the PDC
hmm
I mean by storing it on the PDC, I don't need to handle saving/loading
And it's easier to handle, no?
Oh, I see. Thanks
is it possible to attach a particle effect to an entity?
i.e. spawn a zombie with constant red particles
like how potion effects work, but without any effects
from what I can see there's a deprecated method about color in the potioneffect class
yes
is there any way to remove chunk?
Deleting the chunk file from the world?
all of that just saying regenerating chunk
Pretty sure they're talking about deleting it then regenerating it
meaning you can just keep it deleted or generate an empty one after that
no they are saying that just setting blocks to air and regen it when loaded
well idk
this doesnt makes sense
[14:24:09] [Server thread/WARN]: [MagmaBuildNetwork] Loaded class com.zaxxer.hikari.HikariDataSource from GemsEconomy v4.9.2 which is not a depend, softdepend or loadbefore of this plugin.
i'm not even using that dependency
and since when am i using hikaricp from that plugin??
If you are, make sure to relocate
wdym relocate?
When not setting "shadedPattern" inside a relocation section of maven, it relocates it to "hidden.<original.package.name>". I only found out about this from maven's source code. It's NOWHERE in the docs. Am I stupid, or is maven stupid? Shouldn't it print a warning instead?
Or at least it should be in the documentation
i'm not shading anything or what are you talking about
I am not talking about your problem, this is my own question
hm you must somehow access it somewhere
or maybe you access another plugins class which in turn imports that class?
what happens when you uninstall GemsEconomy and see where the error is thrown? 😛
did you import spigot as dependency?
ok easy 🙂
I need bukkit
you are NOT adding spigot as dependency
Wait
you only added spigot-api
spigot-api = only the API
spigot = API + also all the NMS & craftbukkit classes
I got it. Thank you
np
commissioning developers, dm me
java.lang.NoClassDefFoundError: com/zaxxer/hikari/HikariDataSource :/
i added it to my pom
what did you add?
ALWAYS full stacktrace pls
there's a reason why it's mostly 20 lines long 😛
please show the full strace
and you check the JAR with the hikari added?
they claim to not even use Hikari
where?
here
oooh
XD
then you didnt shade hikari
i didnt shade anything
i just added it to my pom as in the github page
strange need relocate hikary
yeah but you must also shade and relocate it
well
you MUST not relocate it but then you get weird problems when two plugins use it without relocating
AT LEAST you have to shade it
<scope>compile</scope>
ok i'll try that
it doesn't show you how to on the github page, but you must shade it
well actually "compile" is the default scope
don't you have any maven-shade-plugin declared in your pom?
maybe just show your full pom
https://paste.md-5.net/ehakufimaz.xml
i just added compile to it
what does shading even do?
Add the dependencies classes to your jar
it adds hikari to your .jar
Post and share your source code or server logs here.
(ignore all the <relocations>)
and whats the difference with a normal dependency then?
A normal dependency has to be present at runtime
and this one?
so the classes will present on your compiled jar
nowhere
On maven
so it didnt download to my jar when i added the dependency?
no
obviously you also didn't "download" spigot "to your jar"
because it's expected to be there at runtime
Your pom should look like this:
Yeah ik the intendetaion is messed up, just copy paste it, reformat it and adjust the YOUR.PACKAGE part
cringe
no I mean it wasn't put into the .jar
If someone else ran your plugin where would you expect the dependency to come from for them
Adding dependency to maven = you can compile it but it will fail if it's not there at runtime
Spigot is there at runtime, so you must not shade that
Hikari isn't, so you must shade that
also why isnt it there at runtime? 👀
let's say that spigot api exist on runtime because you're using spigot server software, so you don't need to shade it
ah
I added a java api to my plugin and when I use it ingame it just says it cannot find the classes
show the errors
probably you also did not shade that dependency, just like @tardy delta
also the relocation part?
you do not HAVE to relocate but it would be stupid not to do it
you only have to replace YOUR.PACKAGE with your package name
relocate is to put where should the classes that you're shading in located
yeah imagine three plugins use hikari without relocating. they would all get messages "WARN: You loaded a class from another plugin". And you get problems if two plugins actually expect different versions of the library
so ALWAYS relocate
yup, only things that you don't want to happen if you do not relocate it
?paste
,,
have you shade the libs? i'm assuming you use this https://github.com/amaembo/streamex
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project MagmaBuildNetwork: Error creating shaded jar: null
Yes
Idk what shading the libs mean
show your pom
you need to relocate it
how?
your pom should look like this, take a look on the maven-shade plugin https://paste.md-5.net/ejumejuxux.xml
this looks weird
<shadedPattern>io.github.FourteenBrush.MagmaBuildNetwork.com.zaxxer.hikari</shadedPattern>
maybe
package name should all be in lowercase tho
i mean it's not gonna help your problem there but yeah
does it work tho?
no
I tried your pom but it didn't work still
decompile your jar, let's see if the streamex exist
there are uppercase characters in my package name and refactoring doesnt work
Not in the jar no
yes
well it says this
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project MagmaBuildNetwork: Error creating shaded jar: null
show your full maven log pls
and where can i find that?
bottom left, click the uppermost part
the one I selected
then copy paste the full log from the bottom window
?paste
hm tbh no idea
might have sth to do with this:
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
sorry gotta go in a few minutes
yeah you can just ignore relocating for now but you should get it fixed sometime
as said relocating is not required, but don't doing it might result in strange stuff later on 😄
just remove the 4 lines of <relocation>
no, that's sqlite
smh i used sqlite before
so for mysql i need a connection string like jdbc:mysql://localhost:3306/databasename
in general, yes
i'm trying to find out where i can get the db from :/
well idk where i can find that database
did you actually create any database yet?
like normally in sqlite you connecto to the db file in the plugins folder
run mysql and enter SHOW DATABASES
it gives a list of all existing DBs on your mysql server
it gives me a list of databases used for school
Jeff
yes
so i cant start a database from the plugin but the user needs to run that database or something?
EventPriority.LOWEST means that the even will be called in the end, right?
Jeff Media GbR :3
Or is it opposite
I forgot
LOWEST = first
HIGHEST = second last, MONITOR = last
HIGHEST will decide the final outcome so its ran last
monitor shouldnt cancel anything too
true but it runs last anyway
yea
Okay, thank you
so it runs LAST, so it can override other stuff
it's information about who refunded my plugins, whose spigotmc id's are banned and whose IPs are banned from using my plugins
🤡
smh
but I replaced it with Stepsister lol
if Stepsister.allow() oh god
the one verifying the verification codes for my discord / plugin verification is called Discord-DaddyStepSister-Verifier lmao
one of my websites: https://www.raucher-werden.de
lol
it's about why you should smoke
I hate that.
Lol
why
yes 😄
Like a lot
yeah as said meanwhile it's called Stepsister 😄
because
there was a bug in Daddy that make it go into an endless loop
so daddy?
so it was stuck
and we all know who tends to get stuck in weird situations
the stepsis
Stepbro im stuck
yeah haha
use xampp, much more easier
so if the user hasnt created a db the plugin cant make one itself?
HAHAHA
"Schwangere Raucher unterstützen örtliche Kioske und fördern den Ausbau von Sonderschulen"
that is-
i mean yes but
have a config like this
mysql:
host: localhost
port: 3306
db: databasename
user: username
password: password
yes i have that
XD recently the police was at my door because I also have a nother website and it's number on google when you google "Niere verkaufen seriös" ("sell kidneys serious")
actually?
lmao
yes, so of course the admin has to create a db "databasename" where "username" has write access to
yeah, Kripo Münster knocked on my door. About 1.5 years ago I think
they asked whether I'm doing organ trafficking
😐
you need the database to be pre-created
yes
unless your users are so stupid to use the mysql root account
yeah MySQL is a server, imagine it like your local PC
database is the file
You have an admin, only that one can create new users and databases
so the admin creates a new db "minecraft" with a user "minecraft" and now "minecraft" can access the "minecraft" db 😄
but does the user have to enable the database or something or can it be done by code when its already created?
the admin HAS to create the database manually
the admin also HAS to create a user and give it permissions to the database
e.g. here's my tiny script to create a DB plus user:
however, i saw it where you can automatically create the database
#!/bin/bash
read -p "Name: " NAME
read -p "User: " USER
read -p "PW: " PASSWORD
mysql <<EOF
CREATE DATABASE $NAME;
CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASSWORD';
GRANT ALL PRIVILEGES ON ${NAME}. * TO '$USER'@'localhost';
EOF
i think i already have an user
and use that database that just created
you should definitely create a separate user for your MC server
just imagine some plugins does bad things, it could then corrupt all other DBs
you don't want that
you want to have one (or many) DBs for your MC server, and one separate user for those DBs
I just sent you a tiny script to create a DB + a user with write access to it
should work on ALL newer MySQL and MariaDB versions
basically everything above MySQL 5.6 IIRC
yeah you can also just run only the mysql commands directly inside of mysql
oh right
CREATE DATABASE $NAME;
CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASSWORD';
GRANT ALL PRIVILEGES ON ${NAME}. * TO '$USER'@'localhost';
of course yo uhave to replace $USER, $PASSWORD and ${NAME}
looking for plugin developers PAID dm me
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
oh thx
how should i call my user? 🤡
I currently get a ```txt
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
How do I fix that
Are you sure it is in src/main/resources?
And are you sure that there are no spelling mistakes (perhaps you called it plugins.yml or something like that instead)
Looks correct to me
That makes it more complicated. Could you show me the lines around the stacktrace (including the full stacktrace)?
[16:19:23 ERROR]: Could not load 'plugins/hubcore-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:154) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.java:291) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:152) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:505) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at java.base/java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 6 more```
Thats the full Error
Better yet, how are you compiling? Ideally with Maven, yeah?
Some just use the artifacts feature in IntelliJ and circumvent Maven entirely
I'm doing a clean package
Ehm, in which case... refresh your Maven project? I'm all out of ideas heh
👀
bruh why did you filter out the plugin.yml
Also, the system scope might be dangerous
I only have that because I have a modified Version of the artifact that I haven't pushed to a repo yet
Then you might want to use mavenLocal instead
so <scope>mavenLocal</scope>?
No, just publish your artifact to maven local (by default this is done via mvn install or ./gradlew publishToMavenLocal) and you have it availiable like a regular dependency
true
something like this?
CREATE DATABASE IF NOT EXISTS minecraft;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'paswword';
GRANT ALL PRIVILEGES ON minecraft. * TO 'user'@'localhost';
it says operation CREATE USER failed for 'user'@'localhost'
enderman.setTarget(player);
Shouldn't that make an enderman attack a player?
isnt that just the entity the enderman is looking at?
private fun minerHelmetRecipe(): ShapedRecipe {
val item = ItemStack(Material.IRON_HELMET)
// itemmeta is only null when it is air
item.itemMeta!!.setDisplayName("${ChatColor.DARK_AQUA}Miner's Helmet")
val key = NamespacedKey(Main.instance, "miner_helmet")
val recipe = ShapedRecipe(key, item)
recipe.shape("DID", "D D")
recipe.setIngredient('D', Material.COBBLED_DEEPSLATE)
recipe.setIngredient('I', Material.IRON_BLOCK)
return recipe
}
i have this recipe that results in a custom helmet (i havnt added much cusotm stuff yet but thats not important), but when i craft it, it results in a regular iron helmet, anyone know why?
Well, I have to use nms then, I guess...
There does not seem to be any different method
That should set their attack target
Maybe it doesn’t work because they aren’t angry, idk
I didn’t see a method to make them angry
i should probably try that
in most cases (i think) you can just use property access but maybe its different for itemMeta
Not even setAngryTarget and angry from nms works 🤔
how can i add a dig (mining) speed attribute to an armor piece
i dont see it in the Attribute enum
There isn’t one
player.addPotionEffect
alright ty setItemMeta works
but intelllij is yelling at me to use the property access lmao
Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Creating directories for C:\Program Files\BuildTools\Bukkit\.git failed
Anyone had this issue with BuildTools?
Starting clone of https://hub.spigotmc.org/stash/scm/spigot/bukkit.git to Bukkit
Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Creating directories for C:\Program Files\BuildTools\Bukkit\.git failed
at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:106)
at org.eclipse.jgit.api.CloneCommand.init(CloneCommand.java:275)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:173)
at org.spigotmc.builder.Builder.clone(Builder.java:1042)
at org.spigotmc.builder.Builder.main(Builder.java:266)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: java.io.IOException: Creating directories for C:\Program Files\BuildTools\Bukkit\.git failed
at org.eclipse.jgit.util.FileUtils.mkdirs(FileUtils.java:412)
at org.eclipse.jgit.internal.storage.file.FileRepository.create(FileRepository.java:230)
at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:103)
... 5 more
Full Error
Enderman enderman = (Enderman) e.getEntity();
if (e.getDamager() instanceof LivingEntity) {
System.out.println("Living");
enderman.setTarget((LivingEntity) e.getDamager());
System.out.println(enderman.getTarget());
List<Enderman> endermen = enderman.getNearbyEntities(32, 32, 32).stream().filter(entity -> entity instanceof Enderman).map(entity -> (Enderman) enderman).collect(Collectors.toList());
for (Enderman men : endermen) {
men.setTarget((LivingEntity) e.getDamager());
System.out.println(men.getTarget());
}
}
getTarget does return the correct player and stuff, but the endermen don't attack...
setTarget(null) also does not prevent the enderman from attacking
Does the ItemFrame call the EntityDeathEvent on destruction?
why am i getting it twice?
@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
Player player = e.getPlayer();
for(String message : WordFilter.getWords()) {
if(e.getMessage().toLowerCase().contains(message.toLowerCase())) {
e.getRecipients().clear();
for(Player plr : WordFilter.getInstance().curseList) {
e.getRecipients().add(plr);
}
e.setMessage(e.getMessage().toLowerCase().replace(message.toLowerCase(), getReplacedWord()));
}
}
}
``` I made this and this makes it work that it changes the word and sends to everyone in the curseList but I want it to not change anything to everyone outside the list
Any ideas how I would do it
[WARNING] HCurrencyAPI-1.0-SNAPSHOT.jar, hubcore-1.0-SNAPSHOT.jar define 1 overlapping resource:
[WARNING] - plugin.yml
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
``` How can I fix this. I have access to both artifacts
how can i check if an item is one of my custom items?
what defines a custom item in your case?
how to run a async task in bungeecord?
Fixed it... I accidentally replaced every enderman found with the enderman which is being hit 😅
its an item with a custom title and some attributes
title as in displayname
you can't do Bukkit#dispatchCommand() from async?
what a weird issue, this shouldn't be async
just do it sync then
bump, maybe bcs i'm shading
I say it shouldn't be as in I can't see why it would think it's async
especially since it's getting run from a sync repeating task
wild guess but invisible character?
also i'm getting this error when trying to get a connection
https://paste.md-5.net/usaroninet.md
wait the constructor wasnt on it
Yo gamers, I have been working on the PlayerInteractEvent and it has been working just fine. But I notice with vanilla items, if you are hovering over a chest, even if its a "usable" item, opening the chest will take priority when you right click. My custom event handler which operates on PlayerInteractEvent does not seem to follow this logic, and the item handler is fired, rather than the chest being opened. Is this something I need to account for manually? E.g. "If player is currently looking at chest, don't do this logic"?
what are you trying, doing custom item stuff when rightclicking?
Sorry was afk for a sec. Yup thats exactly right.
check for the item in the player's hand and cancel the event depending on if the item is a custom item or not
So thats the interesting thing, I am already doing that o.o cancelling the event if it is a custom item
perhaps I made a logic mistake
?paste your code
oof, expected cord would handle that better
will use paste site
Ahhh you know what, looking at it I think I see what I can do
If action is RIGHT_CLICK_BLOCK, I can operate on that event logic based on what block was clicked
why are you playing an enderchest sound if the player is opening one?
to play the ender chest sound, it doesn't play if you open it via command
If you are referring to the isEnderChest check, that is my function
checking the persistent data on the custom item
Hey everyone, I would love to learn to make plugins on spigot but I don't have the faintest clue to what any of the bukkit libraries are or where I can effectively learn them anyone know a good way to learn? or good places to learn?
I already have a decent understanding of java I have been learning that for a few months now already
Getting a project started - https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-intellij-idea/ (For intellij but apply same steps to whatever ide)
Some common scenarios - https://www.spigotmc.org/wiki/plugin-snippets/
I strongly recommend learning basic stuff first
I believe my first plugin ever was related to a jump pad plugin
Stuff like that, jump pads, double jumps, kill streaks, etc.
bro what the fucking shit
so some guy ddosed a server
and the ddoser or whatever
got the IPs
of every single player
in that server
is this possible
yes
yes
and simple to do
Im not
do you know how
aha nice
How can you stop a DDOS attacks on your Minecraft server? Well, in this video, we show you how to do exactly that. Going over every single step of adding DDOS protection to your Minecraft server using TCPShield. From setting up a TCPShield account to putting your Minecraft server behind a domain name to then stopping all DDOS attacks from hittin...
if I get someone's IP it won't benefit me anyways? if i do anything with it that's a crime
You dont get it
im telling u how did the players get their ip known
The server knows the players‘ IPs
So you have access to the server, you have access to the IPs
Yes but normal players dont have that
?
Juicy thats not a question about servers
its related to development eitherway
You don't get it, it's better if no one tells you.
Sigh
regardless of what you do with it
do you think those "small" servers are gonna sue you?
What is happening.....
its how the internet works
no shit?
either help or please dont reply
but people aren't the nicest
My brain hurts watching this
don't say dumb stuff then please
I asked a question
if u dont wanna answer it then dont
why do u care that much if someone sends a message in the wrong channel
jeez lmao
There is this thing called youtube
I know that
Sooo use it
Personally If I were @grim ice I wouldn't feel a need to pry so much to get an answer if I only needed to prevent it but if I really wanted to know I'd do my own research and learn how it all works
No need to be rude
people think that i want to commit a crime that will get me to jail for 10 years since i asked a question
lmao
2hex open a thread
Anyone knows how a server players got their IP stolen when the server has not been hacked directly?
wait frick
Quick question tho, since when did I need a license for IntelliJ?
IntelliJ ultimate
thats for ultimate
ultimate you need one
Is it worth it?
Nope
depends
👍
It’s worth it for me
same here ^^
If you in school you get free
xDparsi basically jetbrains has a better deal and you’ll get all of their premium softwares iirc
Use setPassenger
Or if you’re a student, claim GitHub student pack
vscode baby >:D
Why doesn’t it work?
Hello. Who has an idea of how after many seconds an Enderman usually takes a block? (This information is needed to configure my plugin).
Cast entity?
terrible, slow, Microsoft product
0 or more
iirc
CraftEntity also has setPassenger
I believe it just triggers the cooldown once it have taken a block
still a million times faster than ides 😉
IDEA does inspections faster than VSCode on my computers :p
the primary difference is startup time but I can wait 5 mins for IDEA to load if I just like it more
I mean thing is IntelliJ has so many good features it’s not even a match for something like vsc
theming, extensions, language server support, able to disable features, compile it yourself, strip micrsoft telemetry
open source
thats just why I like vscode =] just saying calling it terrible is disingenuous
Think about that last positive tho lmao
there are two versions, one which is shipped by microsoft, and one which is never touched by the telemetry
both are on github as open source products
Check getBukkitEntity()
VSCodium isn't legally allowed to interface with Microsoft's marketplace though, therefore you get less options unless you mod VSCodium.
that is definitely true, there are workarounds of course 😉
Problems with Microsoft: #general message
but you are right (although I just use microsoft vscode as it doesn't bother me)
They're notoriously anti-competitive.
I don't want to support them in any way but unfortunately I still use a lot of their tools.
Hey everyone , i have been trying to duplicate mobs when they die ...I can do this generally but i want to do this only when they are killed by the player , can anyone help me with this
Yes, ArmorStand is a LivingEntity
Anyone ??
Which JDK should I use?
Okk lemme try that
Any significant differences that may affect my choice?
I'm not sure, haven't looked at the other distros
OpenJDK it is
yes
:O
id go with oracle openjdk
What event should I use then
but ur jdk rly up doesn't matter, i think, java is java
Show your current code
intellij's boss
I know I'm supposed to check the killer but I'm not able to figure out how ,
tf is coffeescript
js language iirc
hastebin doesnt have the greatest code recognition
not for snippets at least
oh coffeescript is just like a preprocessor
Well it usually suffices tho
usually
Already did that doesn't work
but sometimes itll really drop the ball
@fervent robin Why are you even using NMS?
You'd need to mess with packets, sending if the player has the perm and not sending if not. I can't give you any pointers there, I have not learned any of that quite yet

i wish it could tell c# apart from java better tho
so many times itll mark my java code as .cs so some coloring is wrong
what's the difference between spigot api .jar and the .jar with javadoc in it ? Does it only add the javadoc ?
Just a second
but u can change the extension hastebin will color code from so it evens out
Spawn it using API, then destroy it for specific players with packets
@fervent robin PacketPlayOutEntityDestroy
getId()
Worked?
how do i check when a player's inventory changes
Show your code
It's the same lol
np
That's why you should avoid it whenever you can
Do you guys have ever used resource bundles for your i18n api ?
Do we need to load multiple resource bundles when starting the server and use one according to the player's language ?
why do I always get random pings here lol
i said something
aren't armor stands uncollidable by default? o0
I mean they are used for holograms all the time
that doesn't have anything to do with collisions though
hey guys, any idea what would be the best solution to: so i created this chestplate, which when equipped gives you extra maxhealth, but if you equip it and unequip it in quick succession, you can end up having extra hearts even tho the chestplate is no longer equiped
I don't think you can avoid it tbh
show your code pls
how do you know they used armorstands?
this is the class with the event listeners, there is bunch more methods in there, but they are only calculations, or asignEnchant just gives you the extra hearts
halp
honestly i dont think there is a problem with my plugin, since it all happens at once, its more like spigot not being able to keep up
how exactly do you mean this?
like when an item gets into the players invetory?
well im trying to make an armor set give haste whenever the full set is equipped
ohh
thats a bit more complex
you wouldve have to listen for PlayerIntercat, InvetoryClickEvent and PlayerItemBreakEvent
why do i need that
bc you can equip armor by right clicking when out of invetory
or i mean if you dont wanna do events you can just create cycles that listen to it instead lol, but thats quite ineffective
i mean runnables
Hello, so I have this \/\*(.*?)\*\/ regex, and it selects string parts that are between /* and */. But there is a problem and I don't know how to make it work, right now regex selects like this:
text /comment/ blah blah /another comment/ blah /*unfinished comment
I want to make make regex also select that last /* with all text after that, I don't know how to ask this in goggle lmao
collisions are about what you "cannot walk through" and not what you will hit when left-/right-clicking though
e.g. you can hit flowers but you cannot collide with them
but what are you using the sheep / armor stand for?
other servers probably just use packets to make other players think you have something mounted on your head instead of using real entities
so actually you don't have anything mounted on the servers you mentioned
Is it possible to read json files in a specific folder in the plugins folder
and access their contents?
sure why not
How would I go about doing that?
Never heard of that
or JsonSimple (or SimpleJson? I dont remember how its called)
Gson = Google's JSON library
Which one would you recommend?
gson
First of all - for what do you need json? 😛
Most of the time I recommend to not use json at all unless you have a good reason to do so 😛
this sounds stupid honestly lol
google is so creative
what sounds stupid? That I say that Gson is what google calls their json lib?
Any better names?
yeah but that's how they call it 😄
its funny tho
I mean why not?
maybe my humour just sux tho
creating a template plugin that uses json to easily create new monsters, ...
Would that be a good use for JSON files or is there a better way to tackle that?
I'd rather use yaml for that, way easier to edit for admins
imho json is just complicated yaml
is yaml easier to work with?
definitely
for sure
spigot has yaml support built in and it's way easier for humans to read/edit
i mean decompilers exist for both so both are easy to read :)
That's great, because I will probably need non-coders to create these files
YAML:
monster1:
name: jesus
age: 7
description:
- This is my first monster
- and it's called Jesus.
JSON:
{
"monster1": {
"name": "jesus",
"age": 7,
"description": [
"This is my first monster",
"and it's called Jesus."
]
}
}
perfect
honestly both are tedious to edit without proper tools, since sometimes youll miss that an extra " " and the whole file wouldnt like it
@sullen marlin sorry for the ping, but I resolved that mapping issue from yesterday. You were right about me just missing the jar from the class path (I just used the wrong directory by accident).
With that being said though, I think the separator for the -cp argument is actually a semicolon and not a colon, as you have in the forum post. When using a colon it always gives me Could not find or load main class net.md_5.specialsource.SpecialSource. Using a semicolon it works, so the forum post for the manual commands might be wrong.
Appreciate the help also ^^
yes but that's true for basically every markup language. imho YAML is way easier to read & write, json is more complicated in every aspect
thats for sure
only advantage of json is that it doesn't break when messing up the intendation or however it's called 😄
they have different use cases
but on the other side people have to care about all the { and [ and } and ] and " and '
yaml is for anything a human might want to edit and json is for everything else
YAML can easily store data too the same way JSON can
and vice versa
JSON is a tiny bit more efficient but who cares about that. I'd rather have readable configs than a config that loads 0.01 ms faster
JSON is also much more globally standardized
🤔
much more globally standardized? both have their own RFCs so they both are "standardized"
you’re right I was talking out of my ass for the last point
JSON is much more straightforward to understand
I mean, yaml is more readable though
actually I think json is much more complicated to understand but that's of course just my opinion 😛
YML has config sections and lists and custom objects and arrays and multiple ways of showing the same thing
YAML is great I 100% agree
So it's got that going for it lol
But they’re meant for different use cases is my point
yeah of course technically, yaml is more complicated. but noone would write a yaml parser today because we already got SnakeYaml which does it perfectly
I have considered writing a yaml parser
EVERY json document is valid yaml anyway soooo. if someone supports yaml, they also automatically support json
TL;DR: YAML = Json + easy for humans 😄
Yeah that's reasonable
writing a yaml parser for sure is an interesting idea for learning stuff
toml tho
I wouldn't bother myself to do it though
I might get around to it if I make RedLex able to parse it lol
But currently it can't handle context sensitive languages
And yaml is one sadly
isn't that this kind of thing?
[Something]
value1 = bla
value2 = anotherBla
[AnotherThing]
value1 = whatever
?
¯\_(ツ)_/¯
[parent.subsection]
doesn'T systemd use toml?
Writing my own yaml parser would be pretty great though
Yes it does
If I had my own yaml parser I could add support for comments
is generally more effective checking for an attribute each time as a listener executes or having a temporary value to which you assign the necessary data
That's a pretty vague question
I wouldn't care about it at all
Could you get a bit more specific
I'd just call "premature optimization" and only "cache" the values if you really run into any performance problems
like storing player uuids which have done smth
Yeah not worth
I'd say: don't worry unless you experience lags
for example there are people who cache every config value, like
int value = getConfig().getInteger("value");
instead of just using
getConfig().getInteger("value")
everytime
of course it might me a microsecond faster, but...
I think that's more for simplicity
whats not worth im missing the context there:)
Storing the values in variables
oh ok
It makes the code more readable
The uuids
Just get them every time
okay that sounds fair
btw since we talked about toml: here's the only toml I ever wrote lol
[Unit]
Description=Minecraft %i
After=network.target
[Service]
WorkingDirectory=/home/minecraft/servers/%i
EnvironmentFile=/home/minecraft/servers/%i/env.conf
User=minecraft
Group=minecraft
Restart=always
ExecStart=/home/minecraft/bin/mcstart %i
ExecStartPost=/usr/bin/echo %i started.
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X stuff "say Stopping Server^M"
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X stuff "save-all^M"
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X stuff "stop^M"
ExecStopPost=/usr/bin/echo %i stopped.
[Install]
WantedBy=multi-user.target
Though in reality people should be using config libraries to avoid that boilerplate on the first place
You have a systemd service for a Minecraft server?
Interesting
yes I think it's the cleanest way
I just do systemctl start minecraft@lobby to start the lobby, etc
I just put it in crontab
yeah but what if you wanna restart that server?
@reboot command here
or if you want to automatically restart it when it died
Then I attach to the tmux window and restart it
take a look at byobu if you like tmux 🙂 it's a tmux wrapper
yeah it's just e.g. to automatically open a tmux session everytime you login etc
Oh that's not hard anyways
Damn after this conversation I want to write a yaml parser
Somebody stop me before I waste my time
Sounds pointless
Recreating the wheel yet again
Write your own data structure be praised ☜(゚ヮ゚☜)
But comment support
It's the one thing my config library is lacking
And snakeyaml can't do it
Maybe for a reason 👀
Lol
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i have done it thousands of times
Code?
main and event ye
Main class?
And can you send the whole event class
i put this in onEnable
onEnable of Main
Is debug not printed?
nope
I’d make sure your onEnable is being run
it is being run
public static void b() {
System.out.println("b() was used");
}
public static void a() {
return b();
}
Why does this not work in java?
It works in JS, Python, and even in C (!)
Is the Java Compiler dumb and thinks void is a value, or am I missing something?
you can’t return a function
you’re returning a function when it’s expecting nothing
Java compiler is not being dumb
also doesnt this question belong to a general java community? not just spigot?
void b() {
printf("b() was used");
return ;
}
void a() {
return b();
}
thats the code in c
Trying to return anything in a void function, even a void value, is an error
works without a problem
Hehe python print(print())
Ok what is your point lmao
?paste
im just wondering if the java compiler is dumb
Saying it works in other languages doesn't prove anything
it works in C
https://paste.md-5.net/xonosiqoha.java does anyone know how to turn this into a cmd
Okay and??
instead of breaking block
It’s good as it follows the command and query principle
It doesn't prove anything
and makes side effect functions more obvious
It's how the language is designed
@candid galleon could it be because i didnt set a join message?
You can't return a value from a void function
i am not returning a value tho
And even if a() was not a void function, b() is
b() isnt a value