#help-development
1 messages ยท Page 1855 of 1
thing or is it to remove minecraft recipe
dude, I'm trying to create field in config.yml using /register command. Player comes runs command, a field will be created with his UUID, for e.g UUID: Password
plugins that add recipe shouldnt use "mineraft" as ns ... they should use plugin name or smth else to identify ... thats the reason for having a key
I just need to know how to create custom field from command
plugin.getConfig().set(player.getUniqueId(), 0);
am trying
Config.set?
plugin.getConfig().set(player.getUniqueId()+".Password", 0);
=?
Where Can I see an example where I add an input value to a BukkitRunnable and recurse to keep the input value?
I sucks at google so I always get new BukkitRunnable() code That I didn't want bruh
Looks good to me
okay think i got it now
thanks
hello! I'm pretty new at spigot dev, and i was trying to make a plugin. This simple plugin checks if a player wrote in chat a message example: "hello" and it would cancel it, and finally send a message to the player with some informations.
i was wondering how to do it
i tried making a AsyncPlayerChatEvent but it didnt actually work
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
But i think the concept is pretty easy you dont need to learn entire java to know how to make it lul
did you know someone can know java wihtout knowing everything in java
i know
incredible
can anyone help me?
did you register the event~?
yup
can you send your code?
yup
may you?
no problem!
Hello! I just started developing plugins for spigot, and I ran into a problem. When I am creating my first class extend JavaPlugin it says that it doesn't exist, I added the jar file to the libaries and still it didn't work, What should i do?
I think you need some imports
which jarfile is the question... if you use 1.18 you probably imported the boot-jar
It does almost everything
I created the project with maven....
oh
How do i use it?
import org.bukkit.plugin.java.JavaPlugin; < do you have this import
but if you used maven correctly it shouldnt be the wrong jar
learn gradle :smug:
did u add the repository and dependency
Yeah I don't think that I got the right jar
I explored the folders in the jar file and I don't even see the plugin directory
can you send links for youtube videos?
sure lemme find some
yeah
plugin.getConfig().set("Accounts."+ player.getUniqueId()+".Password", 0);
done
saveConfig()
is what im goi ng to guess
How do I check on what Spigot API version getBlockData() has been added? So I don't need to test this on all mc server versions.
create a new project and there will be Minecraft Developer in the projectcreation menu
If player types /register will it be saved as UUID : Password?
plugin.getConfig().set("Accounts."+ player.getUniqueId()+".Password", 0);
oh I see it
paper is based on spigot right?
Is there a way to write a method that works on a Player object?
player.callCustomMethod("test");```
if you put saveConfig()
shut up kid
yeah but it has some differences
not if you dont change the server-jar
holy shit they were trying to help bud
k relax lmao
That's what I was afraid of, thanks!
@spiral light
if you put saveConfig() it will save it
I did but doesnt work
oh and I am emberrased to ask but what is it a groupId and artifactId?
uh artifactid is your plugins name
groupId is like org.spigotmc
artifactId should b spigot-api
group id can be "usually" like your website name in reverse for example net.pyrobyte, and artifact id your plugin name/project name
oh thanks
Are you sure your code gets up to that stage? & is your config file generated
I dont want you to take effort to help me ๐
k
yo! i have another question lol. How do you change weather from rain to sun? (i promise its the last one lol)
didnt readed all the msg ... why is Frolic so mad ?
no clue
i tried with p.getWorld().setStorm(false) but i dont think its the right way to do it
idk he giving me annoying vibes, starting from his username lol
lol
also that . after the lol
its just a name O.o
jus take the dam help smh
so my help is automatically useless
if it fixes it it fixes it they could be like 8 years old or 35 years old code is code
he was asking how to register events some time ago ;>
so?
it explains all
and you ask how to save a config or how to set a config path ? and ??
both of which are on spigots plugin tutorial pages iirc
I didnt ask that, you thought I was asking that
But
my question was
How to make a field using command in config.yml
for my /register command
which will save like UUID : Password
- I asked how to remove all vanilla recipes 2) I told someone to check if they registered the event they made
- ok
https://bukkit.fandom.com/wiki/Configuration_API_Reference looks like bukkit wiki has what u need
alternatively, u could just build the plugin jar and run a server with it, then u can https://tryitands.ee/
public void setNightVisionEnabled(boolean nightVisionEnabled)
{
System.out.println("[DEBUG] [SpectatorSettings] Path: " + "storage.spectator-settings." + uuid + ".night-vision");
plugin.getConfig().set("storage.spectator-settings." + uuid + ".night-vision", nightVisionEnabled);
plugin.saveConfig();
System.out.println("[DEBUG] [SpectatorSettings] NightVision Should Be: " + nightVisionEnabled);
System.out.println("[DEBUG] [SpectatorSettings] NightVision: " + plugin.getConfig().getBoolean("storage.spectator-settings." + uuid + ".night-vision"));
}
[15:51:32 INFO]: [DEBUG] [SpectatorSettings] Path: storage.spectator-settings.88a9152e-d81a-3141-ad43-4fcfada8a470.night-vision
[15:51:32 INFO]: [DEBUG] [SpectatorSettings] NightVision Should Be: true
[15:51:32 INFO]: [DEBUG] [SpectatorSettings] NightVision: false
Ehm?
what api version should i use to develop 1.17 plugins?
1.17
so for 1.18 i should 1.18 right?
yeah
ok thnx
@ivory sleet
how can i make an extending class change a super class variable?
how does it look in the file?
super.
Syntax error on token(s), misplaced construct(s)
?
super()
This @ivory sleet
super().?
Hi! I'm really new to plugin development, but I need to make an npc that always looks at player's eyes, I was told that there's a way to send an specific packet to make the game just always follow client player eyes, but I didn't find information about it online, is that even possible? Or do I need to calculate the direction the player is and send the rotation packet?
Last one is my best guess
Okay, thank you!
I think citizens isnt client side
theres no public Ability() constructor
Then you can't extend the class
It's part of a bigger implementation hehe not about npcs alone
It is impossible
i made the class
tvhee idk I mean maybe try to print out if the value was set in the first place before writing to a file
Make a constructor then
n o
what
because abilites have to be hardcoded
whatdya mean no
Nothing is sent to the config, the config is just what it was before
well that code is too small to tell what you might have done
You can make a protected constructor
im stupid
like for instance if you're doing stuff multithreaded it can mess you up big time
I call this method via a menu. Everything works fine in the menu, but saving the values on the config doesn't do anything. All sync, nothing weird done
send the code
Ok
Would it be a good practice to do the calculation on every tick? Taking into account I would do this for every npc in the world, for every player in the server?
how do i remove a value from a yaml config?
set null
Maybe every 5 ticks
how can i add a function parameter to a constructor?
alternating the npcs so they dont all refresh in one tick
tvhee why do u use allman =c
?
allman style
What style is that? Never heard of
when
{
you
{
do
{
this
}
}
}
Huh where did I do that?
Try to see what looks smooth(ish) 4 updates per sec seems fine to me but depends on you
code you just sent
maybe add a config feature so people can decide based on their server
I know, but some are impossible to make in 1 line
Under which license is the spigo-api?
Ohh right, well... I'll test if it looks smooth, and will try to optimize filtering by distance
Ohh I have learnt this from the start since 1.5 years and now I can't change it anymore, my head explodes otherwise
No worries I just purely hate that style but nothing wrong with that
Wym?
anyone? (i'm using protocollib btw)
?
?dmca
An unofficial explanation of the DMCA can be found here: https://www.spigotmc.org/wiki/unofficial-explanation-about-the-dmca/
Believe the license is there
I couldn't find any license there
oh yeah, well iirc its GNU General Public License 3
Has someone an idea how i can make my own plot plugin?
?paste
Hm?
while (recipeIterator.hasNext()) {
Recipe recipe = (Recipe) recipeIterator.next();
if (!(recipe instanceof Keyed))
continue;
Keyed keyedRecipe = (Keyed) recipe;
if ("minecraft".equals(keyedRecipe.getKey().getNamespace()))
Bukkit.removeRecipe((NamespacedKey) keyedRecipe.getKey());
}
```https://paste.md-5.net/dujinavaha.cs
@spiral light (sorry for ping) thought you could help
less complicated i think ๐
also "string".equals(...) is very confusing
I guess I usually use that so it will never be null
but in this situation its just habit
so?
testing...
That must go against Java conventions
what?
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
i mean it is more useful
Eh not really
dont need a null check
As you said it's to make sure it isn't null, might aswell just use an actual equals null as it is way more readable
meh
im not sure if it makes it hard to read
more like not used to
but then again it doesnt really matter since its a private plugin
You can tell if it's hard to read if it's difficult to understand or you need to be use to something to understand
anyone know how to disable noteblocks' blockstate updates with packets?
But yeah not the biggest thing, just common practices
also wow using if statements without brackets is against the conventions?
it works till the remove i think
hm?
maybe i should add the values to a list or smth
and loop over that after the while loop
wait
"net.minecraft.world.item.crafting.IRecipe.toBukkitRecipe()" because the return value of "java.util.Iterator.next()" is null
??
if you remove in the iterate the intern list is smaller
so hasNext tests for like the size ...
creating a list and add values from the iterate and after that remove them works fine
sucks for me because now i cant craft anything anymore xD
any way to detect whether a hit is a critical hit, without manually calculating all of that myself?
oof
well who needs crafting anyways
just yeet one part of the game who cares
The base attack must not be reduced to 84.8% damage or lower due to cooldown.
weirdly detailed minecraft... weirdly detailed
well its 10/118 of the cooldown ... see no problem with this
oh/
well... 10/118 of the cooldown would be 84.7%
smh get your math right minecraft
Hi everyone, does anybody know why this doesn't work anymore in 1.18 ?
click implement methods....
what is x()
it shouldnt be possible to have 2 methods with exact the same name and return types and arguments O.o
yeah but entitysheep is part of the api
do you have the x() method in your class ?
try removing all the methods and implement methods al over again
which version ?
1.18
you could try using remapped-mojang version ... there is no x() method xD
Hello! Can anyone help me? How do I make use of the Bungeecord Chat API when coding a plugin? I already imported the spigot api into my project. I've been trying to figure this out for over an hour
woohoo i could try it and it works thank yew!
The implement methods create just "a" and "d_"
well it should work easy
you have to
okay weird question while adding a custom craft do I need to add the plugin name to the id or jsut referencing my plugin will automatically add it
Yes! I read this whole thing, but when I use certain methods the text turn red
Is there a certain library I need to import?
?paste code ?
no
just the right imports
it works!!!
Thanks you very much @quaint mantle ๐
I have removed fire damage from mobs, but how can I do so they arent on fire?
fire tick i think
ah yes thanks
i think HoverEvent is red ?
TextComponent has red twirlies under it, setClickEvent and setHoverEvent are red
Yes!
did you try to import it ? XD
Oh and import net.md_5.bungee.api.chat.ClickEvent; doesn't work
do you use maven ? looks like you only have the Spigot-API
No, I don't use Maven and yes I only have the Spigot-API!
i think you need to add the spigot-server-jar too
should be in the bunder/versions dic
hey everyone this isn't a self promo thing but I'm a mc youtuber and I'm looking for someone who know how to code mc plugins for papermc/spigot rn there isnt any payment but if ur interseted pls dm me ๐
@spiral light could you possibly add me
You mean the one from buildtools right? I can find server-1.18.1.jar in buildtools/work
And minecraft_server.1.18.1.jar in the same directory
Hey! i have a plugin that reduces damage an entity has done to a player, but if i get a mob from a custom mobs plugin, that damage isn't being reduced, how can i solve that? (I have tried with the priority at lowest)
with EntityDamageByEntityEvent
and event.setDamage(The damage reduced)
how can i solve that?
Where can I find this?
yup, run the buildtoos like so: java -jar BuildTools.jar --rev 1.18 --remapped, change the 1.18 to the version you are using
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.18-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.18-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
``` add this to <plugins><plugins>, version here is 1.18, change it to whichever you need
And also add in <dependencies><dependencies> `<classifier>remapped-mojang<classifier>`
that's basically what I am doing already, but that's from 2016 and I also thought that a crit chance has a specific luck chance, doesn't it?
in your server dic if you had run the server once with it
i am sure you can find the position of the EntityDamageByEntityEvent and see where this is catched and then make a PR ^^
looks wrong
ik
I just tried this but it didn't seem to work for me
i was basically just looping through the data.getGuilds to see if answ matched any of them, regardless of capitals
to add this or to create the dic ?
What do you mean? ๐ฎ
streams ๐คฌ
what does not work ?
I tried a bunch of things and to add a bunch of libraries as dependencies; BungeeCord.jar, paper-1.18.1.jar, spigot-1.18.jar and spigot-api-1.18.1-R0.1-SNAPSHOT
None of these got the code to work
did you run the server-boot-jar ?
I'm developing seperatly from my server. What is the server-boot-jar?
if you run buildtools you get a server jar that is only the bootstrap-jar
if you run this jar (starting the mc-server with it) it creates all libraries, api such as the spigot-server-jars which you will probably need
How can I put cooldowns on items like enderpeals have?
Okay, then I'll try to run a local server to get the files!
I'm using the Maven Shade plugin. In goals, maven doesn't know what shade is and neither do I
also, how do I actually add a shaded jar
player.setCooldown
Thanks
is there a way to make the server shutdown immediately when exceptions happens during loading my plugin?
Bukkit.shutdown() seems still loading other plugins even I call shutdown
how to summon an entity as the exact location given?
System.exit
oh thanks
brackets around answ + ".yml" should fix it
also set in any integer dfferent from 0
just did the same thing an hour ago lol
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onThrowEnderPearl(ProjectileLaunchEvent event) {
if(event.getEntity().getType() != EntityType.ENDER_PEARL) return;
ProjectileSource source = event.getEntity().getShooter();
if(!(source instanceof Player)) return;
Player player = (Player) source;
int cooldown = main.getConfig().getInt("ender-pearl-cooldown",20);
Bukkit.getScheduler().runTaskLater(main,
() -> player.setCooldown(Material.ENDER_PEARL, cooldown),
1L);
main.debug(String.format("Setting Ender Pearl cooldown for %s to %f seconds", player.getName(), ((double) cooldown) / 20));
}
got it
How can I compile my 1.17 plugin that doesn't use 1.17 specifics to work with backwards compatibility, currently I get "warn: myplugin does not specify an api version".(removed 1.17 from it as an attempt) and "has been compiled by a more recent version of the java runtime (version 60), this version supports up to 55"
I'm using the Maven Shade plugin. In goals, maven doesn't know what shade is and neither do I
also, how do I actually add a shaded jar
please
anyone. i need help
yes you need help .... do you wanne show your pom too ?
I'll try setting compiler source and target to 8
use api-version 1.13
then it works with ALL versions in theory
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
<version>3.8.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName> <!-- Any name that makes sense -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
it doesnt know what shade is
What jre version should I pick
what versions do you want to support?
?paste your full pom pls
As far back as I can really
java 8 then
probably because this is wrong
So I assume with the 1.13 api version the lowest it'll support is 1.13
wdym
no
it will work with ANY version as I already said
"api-version" doesn't exist in pre 1.13
oh I see
your use compiler plugin and what it to shade ... you would need the shade plugin to use shade ... all in all this makes no sense there ^^
I'm back for help, @quaint mantle if you could help me again i'll be gratefull ๐ฆ
When I build it says "java: x() in org.worsewarn.testplugin.CustomSheep cannot override x() in net.minecraft.world.entity.EntityLiving
return type boolean is not compatible with void"
you must use mojang mappings
im kinda stupid, what does that mean
?paste your full pom
okay so
remove those shading stuff from the compiler plugin and add the shade plugin as separate plugin, sth like this:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<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>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
not even after a player discovered the recipe by using it once?
ya
its more like that i can see the recipe
does your recipe use MaterialChoices or ExactChoices?
but it sees it as i dont havethe items
I just did this, added the jar from the bundler/versions folder as a dependency and it didn't work :/
exact
do those ExactChoice items have any NBT tags?
OH. i get it. I put them in the same plugin
you will need to import all jars in bundler/
yes from a config value
and i got the items from that config value
ExactChoice + RecipeBook doesn't work for NBT values
so it is exactly the same
it will work when you use PDC tags instead
There is only one jar, which is the jar that I already took
yes you can: using PDC
wait what ? RecipeBook will only work with PDC tags and not custom nbt stuff ?
how tf am I suppose to do that?
?pdc
from my knowledge, yes. everyone who reported it to be not working were using NBT tags. I am using PDC tags and I never had problems
yeah. but metadata contains lore and all that stuff
that will work of course
just custom NBT tags won't work
Ok, yea i just fomatted it wrong
the itemstack text?
here's my class to parse custom recipes from a config and it works fine for items including lore, name, PDC tags, ...: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/de/jeff_media/jefflib/RecipeUtils.java
1.18
weird. then I have no idea too
you can't use remapped for the API artifact
you have to use the full server artifact, the one only called spigot, not spigot-api
i tried also that but it's the same error
i use both and it works O.o
?log4j
Find information about the log4j2 security patches here: https://www.spigotmc.org/threads/spigot-security-releases-โ-1-8-8โ1-18.537204/
pls check if your pom really includes all of the stuff mentioned here: https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
yeah you can do that, but spigot-api is not required
if you have spigot, you also have spigot-api
can you send the error message again? I believe it came from the compiler, yes?
what? ๐
๐
it's explained in the link I sent
java: x() in org.worsewarn.testplugin.CustomSheep cannot override x() in net.minecraft.world.entity.EntityLiving
return type boolean is not compatible with void
yeah, basically yes
omg
and yeah i have all this stuff in my pom.xml
and that comes from the compiler right?
ye
do you have a method called x() in your CUstomSheep?
yeah
mojang mappings are the unobfuscated names of methods fields classes etc provided by Mojang themselves @tacit drift
then you are not using mojang mappings... are you actually using maven?
or do you just use your IDE to build / compile?
in mojang mappings, there are no methods called "x()"
they have proper names like "getLocation()"
I'm using my ide to build
that's your problem
๐ค
arhg
right click your pom, then choose "Add as Maven Project" or sth like that
should be at the bottom
is there a gradle task equivalent of specialsource
or Right hand window labeled Maven, use lifecycle package
or would it just work
that won't be there if intellij didn't load it as maven project
true, but usually its people using artifacts and not the maven window
if he had the rest of spigot it probably loaded as maven
but then IntelliJ wouldnt even let them override a method called x()
can you show a full screenshot of your x() method including all the pom.xml stuff in your sidebar, etc? like a full intellij screenshot
you have to build with it
probably you simply didn't reload your pom changes after editing your pom
that's why intelliJ doesn't underline @Override x() in red
If he is gettign an error about overriding x() then InteliJ is seeing his project. He's building with Artifiacts not Maven
but then the code would already be marked in red before compiling
from what I understood, intellij thinks everything is fine until they start building the jar
that's why I asked for a screenshot, then we'll know for sure ๐
Yes, because he's loaded with Maven, btu not compiling with it
Oh Elgar your the guy with the CustomSheep right ?
InteliJ is trying to build using Artifacts and not Maven, so it doesn;t do any mappings
I literally said "full screenshot" including your FULL intelliJ window
including the sidebars etc
Custom sheep? Not me
but if i romove x() method i get
noone can help you until you show a proper screenshot of your setup
^
^^
^^^
oh sry
just hit prntscr button and paste ezpz
easy peasy lemon squeezy
difficult difficult lemon difficult
did you by any chance also add the unremapped spigot .jar manually as dependency to intellij?
you should never add ANY dependencies using IntelliJ. You should let maven handly everything from dependencies to building, otherwise you're fuuuucked
and not in the good way
the fuk da point of maven at that point
possibly
remove that again
see the "External Libraries" part on the left?
EVERY dependency except your JDK should start with "Maven: "
fuck thats a lot of deps
yeah lol
man really said Depend: *
pls look through the list and check if any single one doesnt start with Maven
most of those are transitive dependencies from spigot etc I think ๐
all start with Maven:
my list aint that long xd
you using spigot or spigot-api ?
must be spigot, they override EntitySheep
(which btw is also not a mojang mapped name)
mfnalex what kind of plugin are you making that uses like 80 deps
so there MUST be the "un"remapped spigot dependency somewhere
https://github.com/JEFF-Media-GbR/JeffLib a library for all my other plugins ๐
?paste
How are Bukkit/Spigot/Paper made?
I guess you just modify the vanilla jar, but is there something to deobfuscate the variable names and stuff? some kinda map?
https://paste.md-5.net/ilosuwerof.java anyone know why the ``` for (Player player : Bukkit.getOnlinePlayers()) {
player.sendMessage("test");
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_DEATH, 3.0f, 3.0f); ``` doesnt work?
time to shade all of papi, vault, and essentials into my project hehe ๐คช
lets just shade the JDK ๐
im gonna make like the most bloated library ever
ofc why not
making a permissions plugin would take 20 lines of code
if it should only assign some perms without groups and commands, then yeah sure
what was this cli app called again that counts lines of code?
what doesn't work? it doesnt play a sound?
Yeah
mojang released the map themselves
I tried testing with send message in case my music doesnt work but its not the case.
Just doesnt do it.
.
I don't understand what that sentence means
you mean the message also doesnt get sent?
then obviously your loop never runs because you didnt show enough code
?paste
this definitely, 100% works, your problem is somewhere else, e.g. you put this into a method that you never call
totally didn't steal that from you
oh huehue
what was your problem again? overriding x() ?
mine?
There is nothing.
oh I've seen that but someone else asked it
okay, so everything works, good
ah ok^^
show your other code. if you don't and think everything else is fine, then I have bad news: you DID mess up somewhere but noone can tell you when you don't show more code
yeah that would be helpful ๐
otherwise it's like showing your cat key and say "why does my engine not start" ^^
lol, yeah sorry.
the listener in line 117 it is right?
the entity that died doesn't have the metadata "Rav" as it seems. ADd an else to the if to see whether this is true
rav.setMetadata("Rav",new FixedMetadataValue(plugin,"rav")); i set the rav to have that meta in the line above no?
Yes
your SecondForm event probably runs after your LastDeathForm method
why don't you just do it in one listener method?
what ways you guys recommend for avoiding static abuse?
I sometimes use Constructor if i could
but also sometimes i use static too much
I did but tho that didnt work either so i tried that
only use static if it described stuff about the class itself, not its instance
and I think a static getter for the main instance is fine too
hmmm ok thanks
e.g. it's totally fine to have static fields such as
private static final Pattern pattern = Pattern.compile("%randomint_([\\d]{1,3})_([\\d]{1,3})%");
because that one will never change dependending on any instance
I will try now
if however you make something static just because you want to access it from somewhere else, there is definitely a better way instead
could anyone tell me why am i getting this error? also i can't use goalSelector method in 1.17
no, because you didn't show any error messages
my guess is you use mojang mappings but your source is still in obfuscated / spigot mappings
it says that it cant be aplied to world, but in the guide i was following it did this
erm did you by any chance import BOTH obfuscated and remapped spigot .jar?
because it looks like that
oh wait I'm stupid
ignore what I said
you followed a tutorial for custom entities for older versions
oh lol, 1.7
meanwhile you also have to provide an entitytype in the constructor
but you should really use mojang mappings instead ๐
ok. i'll try that, thanks!
I just did that and it still doesnt make a difference.
do you maybe know a 1.17 guide of custommobs?
tbh your whole code is a mess and it's very hard to read or understand what you actually try to do
Ty
or 1.16 guides will work as well?
does anyone know the plugin authme?
why?
well no, they use goalSelector as well
sorry no idea, I never did custom entities
np thanks
bc i can login however when other ppl join an error message appears
authme is bad
or go to their discord
this channel is for help in coding your own plugins
use nlogin is better
and also, #help-server
If is posible, anyone could pass me a 1.17 custom mobs guide? i haven't find nothing in google
only 1.16 and before
1.16 one should work fine
but the method goalSelector doesn't work in the 1.17.1 api
Probably i'm not importing nms well
does anyone know if its possible to make custom player animations with a resource pack and a plugin? like lets say one where you put your hand forward to point, or a handwave animtion like the trident animation
how can i change player skin? i edited textures property in gameprofile, but idk how can i refresh player skin.
private Group getCurrentGroup(Collection<Group> playerGroups, Track track) {
track.getGroups().forEach(groupName -> {
playerGroups.forEach(group -> {
if(group.getName().equalsIgnoreCase(groupName)) {
return group;
}
});
});
return null;
}
Does someone see what i'm doing wrong here?
On group i'm getting the error "Unexpected return value"
[19:27:54 WARN]: [WallyHub] Loaded class net.milkbowl.vault.economy.Economy from Vault v1.7.3-b131 which is not a depend, softdepend or loadbefore of this plugin.``` what am i doing wrong?
this.bP.a(0, new PathfinderGoalFloat(this));
i dont think? u can return in a foreach like that
i think u need to de-lambda it
goalSelector is now named bP
or assign it to an outcome variable
Oooh
alternatively: streams and optionals, but streams? well....
Ok, thank!
๐
Thx! I'll just use for (group : groups)
do you have any other plugins that depend on your plugin?
no
then I have no idea
im starting to think my plugin isn't updating properly on the server
gg mfnalex best helping duuude
that might ofc be true, just add some text to the onenable
are you using maven modules by any chance in your plugin?
because that one drove me insane, it never updated the classes in the dist jar when I changed only a dependant module without also adjusting its version
just open your jar in a zip program and see whether the plugin.yml is correct
Isn't it softdepends, plural?
not according to papi's github
no
softdepend is correct
unless the tab completion in intellij is broken too
How can i refresh player skin, i want to change skin, so i edit textures property
profile.getProperties().removeAll("textures");
profile.getProperties().put("textures", new Property("textures", VALUE));```
do you also have a matching signature for the texture?
without a valid signature, this will never work iirc
Yo. So the thing is. I need to create a loop that replaces a certain item with another. All of that is fine. The real question is what impact will the server have? (80+ players)
next to none probably
If i make the loop run every 30 seconds
then it does not matter at all
I thought you wanted to do it once per tick or once per second
Nah im not that mad
how can i get signature?
from the forums:
Not possible. The signature is obtained from the mojang servers. You got to upload it to a user, than over the user fetch the skins signature and save it. Now you can change your skin back. Save the signature into a config/storage file.
https://www.spigotmc.org/threads/get-value-signature-of-skin-from-file.390567/
Yeah but if its IF A PLAYER has an item. So i need to make an if statement. Is usage still next to none?
yes
just imagine
you just check all 30 seconds whether some player has an item
the server itself checks on every tick whether every entity steps into a lava, has a block below them, should start to feel hungry now, ...
we are not running on 20MHz CPUs anymore ๐
True lol
the funny thing is
even my raspberry pi can somewhat run minecraft
of course it's a special version, but it works lol
Yeah. I also had one. I threw it somewhere and idk where it is
how do i get an nms block from a bukkit block?
Prolly in my dadโs junk place
what do you mean?
you mean like the material
or a block in the world
Asking about your attempted solution rather than your actual problem
org.bukkit.Block to net.minecraft.server.<version>.Block
for playing chest open animation
Why do you need nms for that
that would be for all players tho
i believe those are completely different things
org.bukkit.Block is a block in the world and net.minecraft.server.Block is a block type
I think you can cast to CraftBlock and then getHandle
doesnt have handle ๐
I feel like if you want it per player you need to use packets and nms block isn't going to help....
Then use the state, CraftBlockState, and getHandle
block action packet needs an nms block
weird
no wait do you mean net.minecraft.server.Block?
or something like thta
thats what i said at the beginning
because thats the same as an org.bukkit.Material
wait what
or well the block type
https://paste.md-5.net/cupohuvama.java do you know why my metadata isnt working for the "R"
Woops
i didnt mean to reply for that
is there a Block.chest?
or something
or maybe Blocks.chest
Yes
Is there a limit to amount of metadatas?
its grass instead of grass in world "world" at 0 0 0 with [snowy=false]
wait does a block need a tile entity to store nbt?
or is it in the block state
Tile entity
ah
else track the block and store data in the chunk pdc
https://paste.md-5.net/cupohuvama.java does anyone know why my metadata isnt working for the "R"
i think its caus
?
Can you guys think of a way to draw/control pixels on the players screen? maybe using a resourcepack?
Maps are great and all, but very limited in color, 128x128 isnt much either, and they arent fullscreen. any idea for a better alternative?
the thing with resourcepacks is, you cant change its textures without reloading it. so i am wondering if theres a way around that. to draw individual pixels
i think you can do some hacky stuff with symbols
Since minecraft supports rgb text
anywhere u can put text
action bar ๐
Thsts where the fun starts. You can use negative space font to have mutliple lines in actionbar
thats nice, didnt know that :D
is there a specific event for placing head on a wall?
blockplace doesnt seem to trigger it i think
Is there a way to change an item's mining level?
ex: make a wooden pick break diamond ore effectively?
I know I can do it by listening to events, but I think this would be cleaner
probably in nms
but its not cleaner O.o
you can check the Tags and compare it with your handmaterial ... but also not easier
Okay, thanks
why not
player head is a block
anyone have experience with proguard?
Gives an error without the error
whats that
Itโs for obfuscation
That's the problem it doesn't give any
I can't find any errors
Maybe in information?
Interesting
have you tried that?
Should I? xD
May as well lol
well try and see if works
https://prnt.sc/25b8kpu This is an error: Non-static method getPlugin() cannot be referenced from a static context. How is this a static context?
Main. Is static
anything that is not in a non-static method is a static context
do this instead
public class DeathListener implements Listener {
private final Main main;
public DeathListener(Main main) {
this.main = main;
}
}
This actually worked successfully .... ty XD
then when you create DeathListener
new DeathListener(this)
this is the main class
do what i said above
Ok
also dont name it main, name it the plugin name
^
Ok
like SuperPermissions for example
random.nextDouble() < 0.25 would be true 25% of time time right
Just about, yeah
Itโs not guaranteed to be exactly 25% of the time but with a large enough sample size thatโs what youโd expect to see
oke ty
Is there a way to load/ unload a world thats not in the main server folder? Like for a skyblock plugin, everyone has their world but its located in a different directory. I can only get it to work with worlds located in the main directory
Copy the file and load it
alright
how can i check if entity is moving?
Wdym
Whether the entity is in motion or standing still does not change its position
it's kind of an armorstand, and i'd love to move it when it moves,
entitycreature that has an armorstand model
Youโd probably have to make a custom NMS class that overrides the movement behavior for whatever entity it is
Thereโs no event called when an entity moves because it would get fired all the time
How can I store the instance of a ResultSet iteration into a HashMap?
I noticed there's a resultSet.getStatement() method. I assumed that would store the instance of the iteration, doesn't seem to work.
ResultSet stats = SQL.getConnection().prepareStatement("select * from player_data").executeQuery();
HashMap<String, Statement> playerDataResults = new HashMap<>();
while (stats.next()) {
playerDataResults.put(stats.getString("uuid"), stats.getStatement());
}```
Why do you need to store the result set
could someone explain me the cause by? i don't understand it at all
Caused by: java.lang.IllegalArgumentException: Can't find attribute minecraft:generic.follow_range
It canโt find that attribute
hmm
i don't know what's wrong here
i mean, the follow_range i guess is the third parameter of PathfinderGoalLookAtPlayer
but what's wrong there=
You must register the attribute to your entity I believe
it's registered
Attribute, not goal
How can i set armorstand/entity to certain direction (the same like player)?
i don't have any attribute
I am trying to write an addon to a plugin that needs to track when something first occurred in order to trigger a threshold if it occurs x times within x time. How would I go about storing the initial time value? I was hoping I could store the server tick time, would I instead just store system time as miliseconds and use that instead? Really just not sure what methods are available/best practice for this.
I do not want to create a task for each event to increase a counter as that could get out of hand quickly
Use the system time
Ok, was a little hesitant as that isn't resistant to slower tick speeds but it shouldn't matter in the end
it actually hates gradle
i added it as a remote repo too
Hey
@EventHandler
public void onXPBottleBreak(ExpBottleEvent event) {
Block block = event.getHitBlock();
System.out.println(block.getLocation());
}```
I get null from the hit block
does someone know what's wrong?
Did you hit an entity
can you help me with this?
a block
this happens all the time
also, am i maybe spawning it bad?
Why would the players type be a pig
Does someone know why it returns the block null if I hit a block?
the entity type is a pig
to get the players location
Player player = (Player) sender;
You then cast player to CraftEntity, get its handle, get the type, and cast that type to pig
im confused
ALSO SOMEONE PLEASE help me with my maven issues
becuse, that's the person who sent the command
and i'm getting his location
to spawn him there
but i'm just getting the person who sent the command
i don't get what's wrong there
how can i make to be the pig?
oh
For future reference, casting an object in java means you are SAYING that that object is that type. Player is not of type pig, so you can't just say that player is pig and call it a day.
Are you talking about making a player riding a pig?
i mean
Or maybe teleporting a pig to a player and constantly making it invisible
spawn a pig?
Also use bukkit stuff, not NMS stuff
World#spawnEntity(Pig.class, Location)
Not completely sure tho
I mean
Nvm it's World#spawnEntity(Location, Pig.class)
Hmm
can you make ender dragon death explosion spigot
doesn't work
sorry.. i haven't worked with nms and its confusing
updating an old project and I get
The method setData(byte) is undefined for the type Block
I assume setData has been deprecated but I don't know what to change it to
I also have
The method cancelAllTasks() is undefined for the type BukkitScheduler
and
The method setTypeId(int) is undefined for the type Block
in the same area that are confusing me
setBlockData
No idea for cancelAllTasks
setType(Material)
Probably a stupid question but is it at all possible for my code using Maven and java.net.http.WebSocket (java 11 iirc) to work with java 8
ty
no
is it possible to lower some entity on the y axis? I mean actually lower it, but that it behaves as if it was not lowered. For example a pig that walks normally on the ground / blocks, but its texture and hitbox is slightly underground. I don't want to use packet teleporting here as the server still thinks entity is above and it doesn't allow me to build there.
is it possible to sort a treemap of a String Boolean by the first Strings are the ones with true and then with false (in alphabetical order too)
im forced into learning gradle lol
just like hypixel friends system for example but there's a boolean that gives the a higher priory
damn
shouldent have said anything
gradle isnt the hard part tho lol, wish it was... Have to deal with making insanely precise turns using a gyroscope with no way to test it lol
No, you canโt sort it by values
not natively
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(Map<K, V> map) {
List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());
list.sort(Map.Entry.comparingByValue());
Map<K, V> result = new LinkedHashMap<>();
for (Map.Entry<K, V> entry : list) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
one of my utils I have, might be stolen from stackoverflow, cant remember
after a quick google def stole from stackoverflow
?paste
but yeah very generic
what does sortbyvalue do
well it takes a map, and outputs a map
so, sorts said map, by its value, as long as the value extends a Comparable
https://paste.md-5.net/nomupahani.cs
Whenever I run the Task, I get a NullPointerException at line 68.
But config.yml is not Null and the name of the snowman were loaded in the same way before the code change nah
What did i wrong?
What exactly is line 68? @rough basin
Try debugging and print out config and sentry before this line to check which one is null
wait a sec
does anyone know why I may be getting this error? I am trying to add protocollib to my pom but only the repository link works, not the dependency
https://gyazo.com/8c9925854a1e5be0e2f4713cc05a21b9 copied it right from their github
Show your whole pom
Does anyone know how to add players onto a current scoreboard?
and display their name in scoreboard
how could i make a jar that patches itself?
like, i create a plugin and it detects a new version available
then it will replace its own contents to make the installed version updated to the latest
please dont
just add a warning message when they need to update
dont do autopatching, thats a fuckmess when your own plugin is loaded
if autopatching was possible, then spigot/paper could just auto patch their own server jars for a new version
but they dont do it
just used a plugin as an example
actually it is, just stop the current jvm and start a new ๐คก
ok so lets move to what i really want
what about my java program patch another jar
like, spigot patching a plugin that have something
how would i get the name of an item without the color codes?
Strip the color codes
ChatColor.stripColor(str)
bruh
Yes that
bozo ๐ธ
i would say to do it with replaceAll
nope
that has to be the stupidest way
???
to strip color codes
- provided method exists
- who the hell wants to chain like 11 replaceAll calls
- even a proper regex can do better
- slow
- stupid
string.replaceAll("ยง[a-fk-o0-9]", "")
what happends when you use a different char