#help-development
1 messages · Page 1878 of 1
if you use getProtocolThing in your onEnable, then Protocollib was LOADED but not ENABLED
even copy-pasting I get confused and mess it up and take a while xd
I already tried to move the code in the onEnable the result is the sale
autism
ohhh
really ?!
show your pom.xml please, I want to check the getProcolManager source
maybe you've a fork (?)
thats weird stuff
yes, as I explained here 🙂
What's 3378
Your mom is a fork.
@admin are mom jokes allowed?
no instant ban
part of the version i guess
There isn't number 3378
Maybe the 3378 is in chinese in the website xd
i'll eat u
Your admin is a mom joke.
your mom is a joke
HAHAHA
your joke is a mom
damn
oh lol
Good for her then
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>```
```xml
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.7.0</version>
</dependency>```
Well if she's a mom
That means she's a female
Otherwise she'd be a dad (male: him) or parent (gender-neutral: them)
Well then your mom is a dad
How do you change a Glass_PANE ItemStack color
?
with material or short byte if you are using old versions
I'm using 1.18.1
so use material
it indeed gets initialized in onLoad
did you check your log files whether it actually supports your MC version and enabled correctly? 😛
it's called BLACK_STAINED_GLASS_PANE, soooo... quite obvious
well it support 1.17 and 1.18 so I guess is supports 1.17.1
check your log file anyway. See if it says "Loaded ProtocolLib" before it says "Loaded yourPlugin"
when you have cyclic dependencies, it loads plugins in random order
no...
really ?
not if you have cyclic dependencies
e.g. if A depends on B, and B depends on C, and C depends on A or A is a loadbefore C (which rarely happens, but sometimes is DOES happen), it gets loaded in a random order
or sometimes two plugins softdepend on each other, which is totally stupid. it messes up the entire plugin loading order. at least it used to do so
so what can I do to get my instance correctly ?
I'd ask on ProtocolLib's discord or github or sth
tbh I don't like ProtocolLib and avoided it everytime I could
it's like 12 times more complicated than just using NMS packets
hi there,
trying to use the libsguise API and i want to be disguised as the block the player is currently clicking on, so i wrote this :
@EventHandler
public void onInteract(PlayerInteractEvent e){
Player player = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK){
Block b = e.getClickedBlock();
try{
Material material = (b.getType());
MiscDisguise md = new MiscDisguise(DisguiseType.FALLING_BLOCK, material, 0);
DisguiseAPI.disguiseToAll(player, md);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
but when i click the console is sending a error ( java.lang.NullPointerException: Cannot invoke "me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher.setBlock(org.bukkit.inventory.ItemStack)" because the return value of "me.libraryaddict.disguise.disguisetypes.MiscDisguise.getWatcher()" is null)
can someone please help me with this ?
gotta agree with this
are you running a supported version of that plugin?
I mean one that supports your current MC version?
getWatcher looks like pre 1.18 code
is the latest LD version for 1.18 ?
you might ask on their discord / github / etc
ok, thank you !
Does anyone have an article or a video on how to do 1.8 custom enchants?
searched all over yt, google and haven't found an answer
- 1.8 is unsupported
- Custom enchants are unsupported
Hi!
How do I import the Chat Component API into my project? (using maven in IntelliJ)
I want to use clickable Text messages etc. :)
Is this a plugin API? you're talking about this? https://www.spigotmc.org/wiki/the-chat-component-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Yes :)
its already in spigot ?
That's an API for Bungee. It's built into the dependency net.md-5:bungeecord-api
if i don't mention any memory args for a jar, the jvm will use memory on demand?
How do I add this dependency? I'm quite new to spigot :I
It will default to 1GB.
oh not good
Well the API you mentioned is for Bungee and afaik will not work with spigot.
So theres no way for me to have clickable text in my spigot plugin?
the bungee components are built into spigot
You can use them just like you’d use the rest of spigot
Oh no, now I see it.. sorry for bothering xD Now I got it
So it is. It's not importing properly in my project for some reason.
How would I send a HTTP POST request from a minecraft plugin in java?
The same way you'd do it in base java. Depends what it does and if you need it to be synchronous or not.
Where is the updated DeluxMenus plugin?
haven't done alot of base java, so not 100% how id do that. ive tried a couple of ways but doesnt work.
long story short. this is the curl command i want to do. but from a minecraft plugin.
curl "http://192.168.10.189/api/application/servers" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer myapikey' \
-X POST \
-d '{
"name": "[ongoing event] - Testing",
"user": 1,
"egg": 18,
"docker_image": "ghcr.io/pterodactyl/yolks:java_17",
"startup": "java -Xms128M -Xmx10240M -jar paper-1.18.1-140.jar",
"environment": {
"": ""
},
"limits": {
"memory": 10240,
"swap": 0,
"disk": 20480,
"io": 500,
"cpu": 0
},
"feature_limits": {
"databases": 5,
"backups": 1
},
"allocation": {
"default": 4
}
}'
Can always use postman it'll do a lot of the work for you.
ive tried using that with no results
it worked when using a public website. but not when using localhost/lan
ill look at this
This guy uses Java 11
https://github.com/JEFF-Media-GbR/Spigot-UpdateCheckerhm you can check my update checker for how to do basic HTTP stuff. then you basically just need to add the post information
Java 9 added it and 11 improved it afaik
So if you can, go with it
that's probably the better way if you do not have to support java 8 (which I have to 😦 )
however it's also quite easy with the legacy HttpUrlConnection: https://www.baeldung.com/httpurlconnection-post
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"[ongoing event] - Testing\",\n \"user\": 1,\n \"egg\": 18,\n \"docker_image\": \"ghcr.io/pterodactyl/yolks:java_17\",\n \"startup\": \"java -Xms128M -Xmx10240M -jar paper-1.18.1-140.jar\",\n \"environment\": {\n \"\": \"\"\n },\n \"limits\": {\n \"memory\": 10240,\n \"swap\": 0,\n \"disk\": 20480,\n \"io\": 500,\n \"cpu\": 0\n },\n \"feature_limits\": {\n \"databases\": 5,\n \"backups\": 1\n },\n \"allocation\": {\n \"default\": 4\n }\n}");
Request request = new Request.Builder()
.url("http://192.168.10.189/api/application/servers")
.method("POST", body)
.addHeader("Accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer myapikey")
.build();
Response response = client.newCall(request).execute();
Or you can add more bloat with OkHttp
this says 404 not found
alright thanks
Postman does the work for me so I can drink more coffee.
sorry one sec
IIRC postman doesn't work offline anymore, does it?
Uh idk. I always have an internet connection so I wouldn't know. I only use it on my desktop where my primary dev work happens.
Try it sometime and let me know. There was some reason we didn't use it at my office and opted for Insomnia instead, but the reason is escaping me lol
probably a super noob misstake but i cant find the dependencies/repository to import in pom.xml
Maybe I'll figure it out some day but for day-to-day queries it's a lifesaver
https://i.imgur.com/eo6QVig.png this is what i found but i doesnt seem to work
https://mvnrepository.com/artifact/com.squareup.okhttp3/ This is what I use
thankss
I use the alpha build but there are more stable releases
I wish I'd had a use for Postman because it looks awesome
I used to hate converting api requests to code then someone just @'d me with a link to postman. Like an angel from the heavens delivering me from death my life was saved that day and I spread the joy of Postman whenever I can
today i learned that you can use
Collection<? extends Foo> to make collections immutable
Well I don’t know if remove would accept a capture of ? extends Foo
Well removeIf would work
i dont understand why Map<K, V> takes Object as a parameter to get instead of K
Hmm yeah maybe if that predicate has the type ? super Foo maybe?
am i being like really stupid, why is it still showing up in red lmao https://i.imgur.com/xLDoD7e.png
Legacy reasons probably
Generics in java are strange
but at runtime everything is an object
but there's no point of having K generic
generics dont exist
Untrue
there are refiable generics or whatever you call it
For instance a derived class which passes the type to the super type constructor
It uses only methods ob Object? So you'll have at least less problems if you dont about map generic types
Refreshed maven as well? Does it throw an error?
imagine if you get confused and you accidentally pass a field/variable with an incorrect type as a key, would be nice for debugging if the compiler wouldnt allow it in the first place
Oh, perhaps if you have a subclass that says K extends Subobject javac would compile the method down to put(Subobject, V) if not handled properly
true
Maps without generics are.. Eh
So in order to not mess with this strange behaviour they opted to just apply this to the key? Idk
Intellij already warns about this iirc
wait oh well i works now lmao
i dont even know what i did
thanks!
Maven found it probably.
yea yeaaa
Well okay
At least users of my api are not going to add elements or put anything in unmodifiable maps
I assume you will annotate your collection return methods with @Immutable/@ImmutableView or sth if you simply expose the abstract collection type
ok new issues. i get a connect timed out for some reason
https://pastebin.com/CR1jCXgV
yeh already do this
Very pog
This is where postman helps. You can use it to test the API before adding it to java.
for some reason why I went to make my account and activate it, it would not allow me to activate.
could someone help me with that if possible?
What is good way to modularize stuff so it is nicely separated and without cyclic dependencies?
My idea is to have one IntelliJ IDEA project with all Maven artifacts from all my plugins - and each JAR file would consist of two artifacts - one API module and one IMPL module... so basically 2x pom.xml for one plugin... and plugins would rely only on API modules and nothing would rely on IMPL modules. But I'm not sure if this is the correct approach.
Yep, thats how you do it
ok so, it works in postman. but not in the plugin
hm
Does it need to be run synchronously? Try running it async or something.
im running it async already
EntityDamageByBlockEvent doesn't return the block when being damaged by a respawn anchor.
Is there a solution for this?
i have a suspicion it has to do with that im running the server in a docker container and it cant access localhost on the host
its more like an explosion isnt it ?
Can try to just ping it to see if you can see the IP by itself
InetAddress address = InetAddress.getByName("192.168.0.1");
boolean reachable = address.isReachable(10000);
System.out.println("Is host reachable? " + reachable);
https://stackoverflow.com/questions/11506321/how-to-ping-an-ip-address
@royal vale its 99% the BlockExplodeEvent
isnt localhost 127.0.0.1
Problem is that you cant get the affected entities in this event
Yeah but I'm using it to ping my router as an example.
ohk
messy but with both events together it could work
you must ping the docker network interface ip
How would I get all damaged entities
Okay so I've made this class on another project that built the project with gradle, then imported it with gradle on my main project, but I cannot seem to use
CommandHandler example = new CommandHandler();
run ip a and check for the docker network
mostly it's 172.17.0.1
oh
I marked the wrong line
it's of course the device one above
the one with "docker0"
Also event fires on explosion, just the damager (block) is null
catch all block explosions, since both events will happen in the same 1 or mabye 2 ticks you can assert that the entitys will get damaged right after the blockexplosion, remove the cached blockexplosion after 3 ticks to be sure
and between within those 3 ticks all entitys that get dmged by respawn anchors got their dmg from that block (of course check same world, distance and closest respawn anchor)
Cannot use Classes from my Library. Im new in making libraries
new libraries addition to plugin.yml seems to be working odd for me...
I defined my dependency in there, and server downloads it... However, when the plugin is trying to load, it complains about a missing class, even though it says a few lines before that it loads the library containing said class...
any ideas why this could be?
Checklist real quick.
- Your plugin is non-shaded.
- You have it as a dependency (not soft dep) in the plugin.yml
- You have the jar for the dependency in the plugins folder.
- The other plugin does not error out when loading
- check
- neither, it's a library under the
libraries-option defined likegroup:library:version - nope, this jar is in
<SPIGOT_ROOT>/libraries/<PATH_TO_DEPENDENCY> - it's not another plugin, it's a development dependency library
is it possible to get all of the luckperms groups in a list?
with a loop or something
Hello i have a problem with the spigot 1.12.2 API, my code line thats the error caused is if (player.getInventory().getChestplate() != null && player.getInventory().getChestplate().getType().equals(Material.ELYTRA)) {
look in the ScreenShot, i have a nullPointer when the player run the code line with right click on block or air. Please Help?
I had the same problem yesterday with event.getItem().getType() which I then solved with event.getMaterial()
I cant add a picture wait
says false [20:44:55 INFO]: Is host reachable? false
You switched the IP for the one where the IP is?
Is that the whole error? I think theres more no?
No its all
i switched the ip to 192.168.10.189
not sure if thats correct
I think its a weird error. i cant see a classname of my plugin its all from spigot api
Yeah so it can't see the IP. Hmmm idk enough about docker it's on my to-learn list I think what @tender shard said above might be of use they seem to know docker
Do you have an idea whats in the code line wrong?
what actually is the problem? you want to ping / access the host system from within a docker container?
if so you will have to use the IP of the docker0 interface that's shown on the Host system
It must come from this line because it only happens when this query is made.
Throw the log file in pastebin and send it over.
i want to send a http web request to the ip of the host
and it says "connect timed out"
which im assuming is due to something with docker
show ip a from inside the container pls
it must be attached at least to the bridge interface
otherwise it cannot see anything outside of the container
if you do docker network ls it shows a list of all networks
you can also do docker inspect <containerid>, then check the attached networks. if it is not connected to the brdige, it can't access the host
alright ill try that
e.g. this container has IP 172.17.0.2 and can access the host at 172.17.0.1 (gateway)
you can connect a container to the bridge using docker network connect bridge <containerid>
or any other network but you probably want to use "bridge"
im pretty new to docker and i havent really gotten to learning the networking things
docker is a pain to setup imho
ive realised that a bit lmao
https://i.imgur.com/rIAHBiA.png here is the docker inspect of the container
not really sure what to do with this information lol
its a wrong code in the spigot api right?
how im understanding it is that i need to use http://172.18.0.1/api/application/servers . instead of http://192.168.10.189/api/application/servers
Send the whole listener that's throwing the error
i have try very much methods, all methods nullPointer
I mean I used to use player.getInventory().getChestplate().getType() in 1.8.8 and it never caused a nullPointer either.
That won't cause a NPE unless the chestpiece is null. Out of curiosity can I see your pom?
i know this is the Point why i dont understand this error. I send you my pom.xml
yep
but normally it's 172.17 and not 172.18
unless you changed it
@eternal oxide im trying to use groupmanager but when i add it to my build.gradle, it says that it cannot find the bstats
So do any events work? Is it just this event? Try logging each step and seeing where it goes wrong.
?paste
No reason for that. It doesn;t depend on bstats
I have Try logging step by step and its this line.
oh it does
Its Only on this event
and i wont need to add anything else to the docker run command or anything
I don;t use gradle so can;t really help there
you could say the repository of the bstats
https://repo.codemc.org/repository/maven-public
got from your pom.xml
did you check whether your container is already connected to the bridge with docker inspect?
as said you'll have to check whether it shows NetworkSettings -> Networks -> bridge
if not, you have to connect it first
yep, I still see no reason for your error
So it's the line
if (player.getInventory().getChestplate() != null && player.getInventory().getChestplate().getType().equals(Material.ELYTRA)) {
player.sendMessage(config.getString("paraglider.messages.alreadyUse").replace("%prefix%", LobbySystem.getPrefix()));
}
i added that and everything worked
odd but ok
All of the code works for me. Check if the config is null. Cause I can't test that part.
Finally managed to properly handle my modules... it was a pain
the only thing under "Networks": in docker inspect if "pterodactyl_nw" (not sure if thats just the name of the bridge or something comple tely different). nothing that says bridge
this is sort of peripheral to making plugins but does anyone have a better markdown editor for github wikis than the default github editor, because it suck ass
Hello, how can I fix player spawn location I mean I get spawned in the block or something ```public class RTPCommand implements CommandExecutor {
final Random random = new Random();
@Override
public boolean onCommand(@NotNull final CommandSender sender, @NotNull final Command command, @NotNull final String label, @NotNull final String[] args) {
if (sender instanceof Player) {
final Player p = (Player) sender;
final Location rtp = new Location(p.getWorld(), random.nextInt(10000), 100, random.nextInt(10000));
if (getSafeLocation(rtp) == null) {
p.teleport(rtp);
}
}
return false;
}
public Location getSafeLocation(final Location location) {
final Block blockNotEmpty = location.getWorld().getHighestBlockAt(location);
if (blockNotEmpty.getType().isSolid() && blockNotEmpty.getRelative(BlockFace.UP).isSolid()) {
return blockNotEmpty.getLocation().add(random.nextInt(1000), 100, random.nextInt(10000));
}
return null;
}
}```
How can I create Maven Sources
Maven source plugin I'd assume
then connect the bridge with
docker network connect bridge <containerId or containerName>
idk if restarting the container is required, but after that you should be able to ping the IP that's shown in ip a under docker0 on the host from inside the container
oh wait @cosmic dagger
connect it to "host", not "bridge"
ugh
you'll have to stop and remove the container, then run it again with the --network host option
strange, I didnt know that is necessary
I hate docker so much lol
it makes EVERYTHING 12 times more complicated lol
but maybe just try it with the bridge first
you can always connect it to the bridge and that might work too
iirc I got it to work with bridge
if that still doesn't work I have no idea. maybe this helps https://stackoverflow.com/questions/31324981/how-to-access-host-port-from-docker-container
public void OnBowFire(EntityShootBowEvent e){
Projectile projectile = e.getProjectile();
}
}```
why can't i do this?
incompatible types: org.bukkit.entity.Entity cannot be converted to org.bukkit.entity.Projectile
getProjectile returns an Entity, not a Projectile.
Why? No idea.
But you'll just need to check & cast
Thank you
https://i.imgur.com/99XBp2m.png what does this mean
How would one go about getting the distance the projectile travels I assume I use two .getlocations ??
hm never saw that message before
Sorry I am very new to Java and plugin coding
public void ProjectileHit(EntityDamageByEntityEvent e){
Entity player = e.getDamager();
Location shoterlocation = player.getLocation();
Entity shot = e.getEntity();
Location shotlocation = shot.getLocation();
distance(shotlocation, shoterlocation);
}```
but can someone please help me with how to do the distance part of this
Location1.distance(Location2)
that won't work
Also
Realize that if the shooter moves then when the arrow hits you'll have screwed data.
Your "player" is the arrow
?learnjava before plugins
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.
yikes seems like i have alot more googling todo on how to code anything like this at all
I'll show you an example in 2 mins
okay thank you
@EventHandler
public void ProjectileHit(EntityDamageByEntityEvent event){
Entity victim = event.getEntity(); // The entity who was hurt
Entity damager = event.getDamager(); // The entity that dealt damage
if(!(damager instanceof Projectile)) {
// This is not a projectile. Do nothing
return;
}
Projectile projectile = (Projectile) damager; // Now we know it's a projectile, we can cast it
ProjectileSource source = projectile.getShooter(); // The source, i.e. whoever shot this projectile. Can be a dispenser, player, skeleton, ...
if(!(source instanceof Player)) {
// The shooter is not a player. Do nothing
return;
}
Player player = (Player) source; // Now we know it's a player, we can cast it. ALthough we don't need to
double distanceBetweenShooterAndVictim = player.getLocation().distance(victim.getLocation());
}
I assume this is what you want to do
Yes excatly
Thank you i will try and extend on this an hopefully i'll learn a bit more about java and plugin development
Ive used maven
With gradle
WHats the package command?
Ive been using shadow cause i needed to shadow on another plugin, but idk how to package normally
Build?
The only issue with this is it assume the shooter hasn't moved though. I imagine the calculation involved the distance between from initial point of firing the arrow and impact.
@somber hull build or jar
Whats the difference?
that depends on your build.gradle. some people make "build" depend on shadowJar, etc
typically "gradle assemble" builds the .jar
No idea I never used jar
so assemble is the package thing
if you also want to run unit tests, it would be build instead of assemble
Well i dont need to shadowjar on this project
On my other project someone helped me set up shading, but i didnt know how to build normally
Alright
I am calling an custom event ( Bukkit.getPluginManager().callEvent) but when I am trying to listen for it using event handler it never triggers how can this happen?
No console logs either
@quaint bough Show your event class
do you listen from another plugin?
if so did you shade the event into the other plugin as well?
because you must not do that
within the same plugin
nothing fancy but the debugger shows it is getting to that line but nothing is happening
yeah ive been figuring out how to make good custom events but its kinda weird
i tried extending the InventoryClickEvent but that creates a loop I believe
why don't you just make your event extend InventoryClickEvent
well
in your own listener check if event is instanceof your event
if yes, return
ahh
that will make it much cleaner ye
but that doesnt explain this behaviour though
well you overwrite your handler list
that breaks everything related to the listeners of your plugin
you replace your handlerlist with the one of the normal inventoryclickevent
and you listen to your custom event, so your listener is not included in your custom event's handler list anymore
so if i dont assign that value it will still work
you should never touch the handler list
but why does that break it does it magically get a value once called?
it will probably work the first time you call it, then never again
ill refactor all my events and see where that brings me, thanks though
np
do I still need the getHandlerList method? Cause ive had errors of that before
yes, you always need that
Represents an event. All events require a static method named getHandlerList() which returns the same HandlerList as getHandlers().
but in this case it needs to be static method
still need the second viarable HANDLER_LIST?
this is how a minimal cancellable event should look like:
public class ChestSortEvent extends Event implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
boolean cancelled = false;
public static HandlerList getHandlerList() {
return HANDLERS;
}
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
}
since InventoryClickEvent is already cancellable you can make it even shorter if you extend it, but of course have a matching constructor:
public class ChestSortEvent extends InventoryClickEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
public ChestSortEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action) {
super(view, type, slot, click, action);
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
I wonder... when kotlin only has "static" methods inside the Companion object, how can I do stuff like having a static deserialize method for ConfigurationSerializable?
Believe just a function inside the companion object + @JvmStatic annotation
Pog
okay I need help
Error shows when I damage an entity
what's supposed to happen is that ALL entities in that world get the same damage as the one I actually hit
I have no idea what that error is supposed to tell me
since when does java use :
it's kotlin, I'm just learning that
oh never heard of that before
it gets compiled to something that's compatible with the java runtime
and why would you use that over java?
looks like python
Alex do u use gradle or maven
and that is ?
It’s a wrapper essentially, very pervasive in functional programming
for instance it’s a good way to abstract away side effects
wait does kotlin have stuff like extension methods that java doesnt support? or is it not like that
Even in Java they can be found if you consider functional interfaces as first class functions
wait - do I really have to shade the kotlin std lib?
well if you compile kotlin to jvm bytecode it’ll make it compatible somehow
yes
it’s huge kinda
ugh I thought it gets compiled to java bytecode
Hmm yeah but like w/o std lib, you won’t get far
I think extension functions might just become static functions
unsure but yeah
they do that anyway
I read that today at least
sounds interesting but making abstract plugins is easier with kotlin?
wtf it added 1.6mb to my plugin
Lol yeah
that means I can't even use it for spigot plugins because all my plugins would exceed the upload limit
cleaner I find it really hard to make something abstract and scalable with spigot feels like its hard to pull off idk
You could technically download at runtime mfnalex
alright fuck kotlin lol. I never liked it but now it literally became useless for me 😄
might also be that im not that up to date with the api
that just sucks, they always claim to be able to run on the jvm but apperently no, it requires a huge library to actualy make it work
Isn’t that just an issue caused by spigot and not Java?
probably XD
Essentially yeah
A bit dumb but everything comes at a price
but everyone uses spigot so cant do much about that huh
and somehow my main class works
Lol
it's just the event listener that needs this lib
Well
What type of scalability are you seeking?
And what type of abstraction?
its w/e
Alr
Because the complaints are a bit ambiguous and arbitrary unless you concretize, not because I believe every design choice in spigot is perfect but yeah
yeah I cant explain idk how to but sometimes it feels like im typing everywhere just to pull small things off
@tender shard
is that the way to prevent that loop?
Does that even work
I dont know XD
Cuz it’d only invoke that method when an InventoryClickEvent instance gets passed to the plugin manager
yeah thats fine but does my custom event trigger InventroyClickEvent if it is extended by that class?
That’s exactly what I was trying to explain
the Bukkit event api does not support inheritance event reactivity
Why use kotlin for plugins? Its like creating the wheel when its already invented
No it’s not
but you can achieve that with kotlin?
You could say that about most stuff, but kotlin has sort of become another purpose that just a reinvention of the wheel
No not really
They’re not that fundamentally different, and at the end this event api is a Bukkit implementation
Why people use kotlin for Scoreboard?
at the very top, do this:
if(event instanceof MyEventClass) return;
Idk why scoreboard specifically
I just want to learn it
thats what its doing
But kotlin has null safety, it has coroutines, in fact it has a lot of qol features
Like they use scoreboard made on Kotlin because they support more lines
that doesn't like it's "at the very top"
That makes no sense
^
I mean kotlin spigot plugins are just kotlin compiled to jvm bytecode
with the need for a 1.5 mb lib
So I don’t see how that’d somehow produce some advantageous extra lines lol
Myeah
I dislike kotlin for other reasons than the lib, since it isn’t really that big of a deal
I'll try to see if it works using plugin.yml libraries
Use maven Kotlin btwwss
o
what?
You can use maven if you have size problems
erm
are you drunk?
- I am always using maven
- how would that in any way reduce the .jar size?
Maybe I drunk a voodka but nothing else
thats a funny heehee line when usay it in ar ussian accent
Because with maven your jars dont get overload with the libraries
??
?
That why I dont use normal java project
Maven does not inherently reduce jar size
I use maven instead
lol
.jar too big? just shade in some dependencies to reduce its size lol
makes toootal sense

jar not working? shade the JRE into it
Oh god
.jar size will become negative, you will even have more space on your hard drive now!
I once saw a plugin on spigot
it had about 50mb
that dude actually shaded the whole NMS stuff, bukkit, craftbukkit etc into it
it just has freetts in it its fine
it was literally a standalone server with a plugin included
Difference btween maven repo 2 and 3?
1
jesse what the fuck r u talking about
The libraries are not compatible?
a maven repo is a maven repo
|2-3|=1 (:
oh yeah forgot i uninstalled a shit ton of jdks
Im having problems with libraries because they look compile in different maven versiones
Its fucked amazing this
Init
am i fucking drunk or
they look compile?
zero coherency
nah verano is always incomprehensible
i wonder if a markov chain with input data supplied by everything hes ever said in here would produce something accidently correct
Like I cannot implemente a library on my maven Project because the library was deployed on a different versión
You understand
yay my first kotlin plugin. will release this for 23.99€ on spigot
Gradle
no sorry I don't understand
Incredible
gonna go on an adventure today to try and get scala+java working on gradle
why not just use SBT u ask?
im lazy
but not in the right way
making a ping plugin in haskell
Can Haskell compile to jvm bytecode 🌝
i think theyre compatible?
Why no one had the intellence for creating a maven plugin for deploys via http
Hmm it’s not a jvm lang, maybe a transpiler exists
Believe there are some
eta and frege might be the closest
is it
it's builtin
or is that gradle propaganda fed to u by the team
There is not a single advantage I can come up with when I think of maven
me neither
Well only thing might be that maven en fucking forces declarative
But that’s mostly irrelevant
Gradle looks like the zzz of js type script really low le el sintaxis
<distributionManagement>
<repository>
<id>jeff-media-public</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
</repository>
</distributionManagement>
works fine without any additional plugins
Are you using which plugin?
works fine without any additional plugins
And what configuration?
this one
🌚
nothing else is needed to deploy but here you go https://paste.jeff-media.com/?895f12fe6ca11c3a#HBfS8LRPPsshdeS47Em7nVyUvHpLwr61bGjgLfxpLfNE
Post and share your source code or server logs here.
the settings, you mean the credentials?
Yeah
So without any plugins its possible to deploy to a normal webserver right?
I will kept it
<distributionManagement>
<repository>
<id>jeff-media-public</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
</repository>
</distributionManagement>
works fine without any additional plugins
😄
I can be drunk but no idiot
I have tríed your code without the Username and password part on credentials file. And using http instead of http. And im getting a 403 error (Method not alllow)
403 = not authorized
of course you need credentials
also why would you upload to http instead of https
only valid reason I can see is some internal network, otherwise http should never ever be used anywhere
You also need a snapshot repository for snapshots
The build file does not look like voodoo shit and it doesn't break by simply looking at it wrong
Doesn’t sound the slightest like gradle
how could this happen again?
Tfw you can't test your project because you're having to debug a build system
Had way more of that with gradle than maven, probably because I am too impatient to learn
Hmm I do agree gradle is damn radical and exposes so much shitty configurability sometimes which gets sloppy and inconsistent
I recently looked at a buildsystem called Bazel
It's like CMake for people who dev Java
Yeah consider how pervasive it still is in enterprise apparently
I hate enterprise >:(
FactoryFactory at your services
now that i fixed my events another issue popped up they are not getting canceled anymore
Im deployimg to local webserver
nothing wrong with this right?
set Cancelled should still work but it doesnt
@ivory sleet
obviously you have to setup your webserver to accept PUT requests
@ivory sleet can you help me with my uni assignment? Thanks
Nick him then
can't change my niiiick
We can't nick ourselve
😳
s
Yeah normally people don’t get cool nicks
you already have one
True lol
I want a cool human named Nick
Maowcraft -> Maow
send him to me
you have a cat/dictator nick @lavish hemlock
any ideas?
Oh which parameter should have that put?
what webserver are you running
Express
Are you trying to write your own maven repository
how would you make one of those crafting recipes where it can use like any color of wool and stuff
seems so
wtf is that
A library for node js
Yeah but like, why
hm sth with ChoiceLists but I have no idea how it works
The backend no matter
ah easy @arctic moth
use a MaterialChoice and add more than one material
or just add a Tag<Material>
Mfnalex I can create a catch for the put request and then see what paramos are sent?
why doesnt custom event that extends for instance InventoryClickEvent not get canceled by using the method that is implemented by InventoryClickEvent
@arctic moth
ShapelessRecipe recipe = new ShapelessRecipe(new NamespacedKey("some","key"),new ItemStack(Material.DIRT));
recipe.addIngredient(new RecipeChoice.MaterialChoice(Tag.WOOL));
I feel like this message explains a lot
why don't you just run a proper webserver for this? in apache you'd basically have to add two lines to allow put from all
it gets cancelled fine
is canceled is running but nothing happens to the item that is being moved
I don't understand. You call a custom event right?
yeah
After you called it, just check if it was cancelled with yourEvent.isCancelled()
then do whatever you like with that result
nah after I call it i check if the item that is being moved or interacted with is a custom item of mine then I cancel the event
but nothing seems to happen when i cancel it
what do you expect to happen?
I have the same problemen I cancell the event so people cannot take out the items buy they can
Its something big
I think
that the item that is being interacted with or is being moved gets put back into the original position
so you cant take or move it
My problems is that I dont want people be a le to take out the items
what event are you listening to? what event are you extending? and what event are you calling? maybe show your full event and listener code pls
put a sign there "don't take out the items"
Oh are you trolling me?
sorry for spam
Alex trolling alex huh
well you didnt give any information, noone can help you. you just say "I dont want people be able to take out the items" - what items? where from?
the items
any idea why this isnt triggering
@EventHandler
public void onTNTExplode(ExplosionPrimeEvent event) {
if (event.getEntity().getPersistentDataContainer().has(new NamespacedKey(Main.plugin, "smalltnt"), PersistentDataType.INTEGER)) {
if (event.getEntity().getPersistentDataContainer().get(new NamespacedKey(Main.plugin, "smalltnt"), PersistentDataType.INTEGER) == 1) {
event.setRadius(2f);
Main.plugin.getLogger().log(Level.INFO, "e");
}
}
}
so, you only listen to your custom event. that means you also have to handle what happens when it's cancelled.
after the line where you called your event, cancel the InventoryClickEvent if your custom event was cancelled
basically
onInventoryClickEvent(InventoryClickEvent event) {
// Call your custom Event
MyEvent myEvent = new MyEvent(...);
Bukkit.getpluginManager().callEvent(myEvent);
if(myEvent.isCancelled()) {
event.setCancelled(true);
}
}
Then ya don’t
then you can't cancel it
it would be helpful if you could explain what you are actually trying to do
debug it. print out whether the entity actually has those PDC tags
why is making a gif so hard
it's one line with ffmpeg 🙂
i just want to make a screenshot
but then a gif
you know
like lightshot
but then gif
just a way to record my screen and share it to gyphy or w/e
so i can show
like the classic screenshot share software but then it will make a gif of what i select
make sense?
there
you cant actually see that im moving it but i am
that is what should happen
but I thought it was good to make my own event whenever bag is being interacted with
listen to that event and check if the item is a bag and then cancel it
but that does not seem to work
custom events seem like too much work and they are barely working lol
or i am doing something wrong
you can't really prevent people doing stuff in the creative inventory
creative inventory is client sided
Because Mojang is smart
Yeah
That's the reason
...Totally
of cooourse
nah itsn ot because of creative mode
I don't really get what you want to prevent though
moving the custom item into ANY other slot?
so doing this with standard InventoryClickEvent would work
you just check if item is my custem item
cancel event
seems easy right
but what i do is listen to InventoryClickEvent check if inventory is bag holder then call BagInventoryClickEvent
then listen to BagInventoryClickEvent
and then cancel that one
but that does nothing
...
I already explained to you how to do it
of course cancelling YOUR event doesn't do shit
you call that event, so YOU have to respond to it being cancelled or not
^
im retarded
didn't you read that message? 😄
lol np
if it works now
ill go to sleep
3 am kek
but this custom event stuff seems really wacky
custom events are awesome, you just have to understand that your custom event is totally independent from the inventoryclickevent if you call it yourself
other plugins will cancel it thinking its a normal clickevent
but it doesn't cancel anything if you, as the caller of the event, actually respond to that cancelling
Yes
what is it called?
Cancellable
your event extends InventoryClickEvent so it already is Cancellable
yeah i was trying to do something but that aint possible cuz its stupid
but time to go to bed
thanks for the helps
np
just canceling a certain item from moving is kinda wacky
cuz there are so many ways to move an item
I'd just cancel all inventoryclickevents on that item
That's all ya need
Okay so, I followed the "Creating a custom library" guide on spigot, and I get this error.
java.lang.NoClassDefFoundError: net/cryptolib/CryptoLib```
Anyone knows how to fix it ?
https://www.spigotmc.org/wiki/creating-external-libraries/#wikiPage
This is the guide that I'm talking about.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
a library plugin or a library "library"?
like is the library a standalone plugin?
library plugin
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Well, making shorter code?
what?
If thats what you mean by library library
library plugin = it shows up in /plugins and actually has its own plugin.yml
library library = you have to shade it with maven
the article is shit, it doesn't explain shading
you basically also must add the maven-shade-plugin to your plugin's pom
And would you help me to do that, if you don't mind ofc.
one sec
so you will need to add sth like this to your plugin pom (ignore the relocations):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<relocations>
<relocation>
<pattern>de.jeff_media.updatechecker</pattern>
<shadedPattern>de.jeff_media.replant.updatechecker</shadedPattern>
</relocation>
<relocation>
<pattern>de.jeff_media.daddy</pattern>
<shadedPattern>de.jeff_media.replant.daddy</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>de.jeff_media.replant.acf.commands</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>de.jeff_media.replant.acf.locales</shadedPattern>
</relocation>
<relocation>
<pattern>de.jeff_media.jefflib</pattern>
<shadedPattern>de.jeff_media.replant.jefflib</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
Alright, thank you for taking your time, sir?? dont mean to be disrespectful
you can ignore everythinf inside <configuration>
Oh thanks!
then, compile your plugin using mvn package. unzip it with winrar or anything and see if your library classes are actually inside your .jar
I have to make a mvn project now.
One more question, "Shading" are used for libraries, right?
shading means "include all the stuff I need into my .jar", so yes
be sure to set the <scope> of spigot to "provided" and of your library to "compile"
is this all I need to have in my pom.xml ?
oh lol no
Why is maven so hard..
you need to setup the pom as usual
because you're new to it
fair enough
look at this, I wrote a blog post
after you have set that up, you can add the maven-shade-plugin
me who use scope compile (default)
decompile? whut? 😄
oh no
@vagrant stratus
yall should ping this
goes from having minecraft to decent knowladge of maven
How to check if BlockBreakEvent is cancel
god gradle really is painful
I want to know block whether be broken
listen to BlockBreakEvent on Monitor priority and then check if the event #isCancelled()
Thanks
how do you set the results of piglin barter?
declaration: package: org.bukkit.event.entity, class: PiglinBarterEvent
getOutcome returns a List<ItemStack>
you can remove items and/or add items there
oh I assumed that the Piglin Barter would run after the entities already spawned
the event gets called the moment the piglin picks up your item
This event can be triggered by a piglin picking up an item that's on its bartering list.
gotcha
Most events in spigot run before the actual action
at least every cancellable 🙂
Is it possible to stop horses from rearing (standing on back legs) when players are riding them with the spigot api?
hmm probably if not, through nms
Leme see if i can find smthng
I think he means kicking the player off no?
@runic hull
oh they edited the message
I thought it was about the sound they make when I read it 20 minutes ago
I actually now think they are just talking about this animation a horse does
Really?
the horse doesn't actually throw them off, it just goes on two legs and makes a noise
We need your input, you cant just be a chat stalker and watch us be confused
declaration: package: org.bukkit.event.vehicle, class: VehicleExitEvent
found it
When they are tamed they don’t throw you off, but it does interrupt movement
Ohhhh
yes, I think that's what they mean
When they aren’t tamed the rearing throws you off
I am using a horse as a vehicle but don't like it when the horse stop (rearing) for a moment.
You could see if theres some weird NMS thing for it (i dont work with nms idk how it works)
Got it
Yeah I want to avoid doing nms
oop- i gtg
Maybe there is no solution for it with using the spigot api
Hey, so getOfflinePlayer is deprecated, what do I use instead?
OfflinePlayer player = Bukkit.getOfflinePlayer(vote.getUsername());
String uuid = Bukkit.getOfflinePlayer(vote.getUsername()).getUniqueId().toString();```
havent done any 1.18 plugin yet and its building but it takes like 7 minutes
anyone know how i could fix it?
pom.xml
getOfflinePlayer(string) is deprecated
You use their UUID method instead
From Spigot Javadocs:
If you still choose to use it for some reason make sure to do it async
because getOfflinePlayer is slow
Unless it takes it from local storage? Or does it do that?
If it’s not cached it will make a web request
doesnt paper have ai goals
you cant take it out?
do you have any other plugins or code cancelling taking it out
hm
oh
wtf
you cant cancel an anvil prepare event tho
right?
are you using an old version
because the current version has PrepareAnvilEvent
oh
can you send me some code from the event handler
maybe its something before or after that influences it
so it sets it in every condition
oh
maybe you can use the anvil inventory to directly modify the item in the slot?
using like
event.getInventory().setItem(2, ...);
Hey I know this isnt a spigot thing but do yall know how to link 1 file on your computer (windows) to another? so say I add something into a file, it will then get added to both file 1 and file 2
using network sharing or ftp
if you use ftp you need to set up an ftp server and download something like filezilla client
still cant take it out?
oh
i dont know srry
make sure theres nothing preventing you
like no InventoryClickEvent listeners
otherwise try commenting them out and testing it again
i created a new project and it still does it
is it open source?
nvm
are you testing with other plugins? if so, you can try setting result one tick later
using #setResult(ItemStack)
lol
or set the event handler to be of highest priority
Have you tried?
So I have a bit of a pickle, I wanna make a GUI that refreshes for everyone on the server at the same time, but I dont wanna make it laggy. However I also wanna make it so that said GUI contains the stats of the player. The issue that I run into is that when updating the GUI it will show the most recent player to enter the GUI's stats to everyone, is there any good way to prevent this? or would creating a GUI for each person be the best thing?
Per player might be necessary
dam alright, what would be the best way to make them? just when they join and delete it when they leave? or create it when they make an inventory then delete it when they exit the inventory.
Add an update button to the gui 🙂
If the stats are going to change frequently then just create it when they open an inventory
It’s not as expensive as you’re imagining
As long as the data is stored somewhere it's relatively cheap to create on demand. Do not create them all and store/update every second as that's using up too much memory for no gain.
alright so create on command
I have an auto updater that I can run when the inventory is created, so should be relatively easy
Wasn't really thinking of the tax it would put on the system, just wanted to know what would be the best course of action
well you were talking about lag
Have one runnable for all of them with something like a Map<Player, GUI> which can be ticked.
If nobody has the guy open then the map is empty and the overhead of the runnable is negligible.
Start the runnable when the server starts and stop it when the server stops.
Its important that you have a proper observer pattern in place. The GUI should ONLY display data
and delegate user input. It should not have any other functionality.
huh I guess I was lmao
alright seems simple enough ima work on it later today its 3 AM for me
[1.8.8 question] Is there a way to send action bars, without the use of NMS? I want to use nms, but I simply do not understand how to. 😆
If it's not possible without nms, please direct me towards a tutorial on how to set it up and use it. Thanks in advance
Update to a non ancient version and just use the methods there. Nobody supports 1.8 anymore.
Also almost nobody uses that version anymore
Yeah i know mold is growing on 1.8.8, and it's hella deprecated, but that's what i have to use sadly. There must still be a way, right?
Does Player have the .spigot() method for you?
Then it should be just
Player player = ...;
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Something"));
Wish i could send pictures, but intellij underlines it all with red. inside of the sendMessage()
Um you migrate it to a 1.15.2 project?
reverse engineer what the methods do lul. nms is undocumented and unsupported.
If you use 1.17+ you can use moj mapped files so you have properly named variables and names.
You have to make your questions more specific. Asking "how to migrate" is way to generic and asking somebody to walk you through an entire process rather than a single question.
someone help please
oh god...
this is my plugin but when i run it don't sendmessage on console and actionbar not working
Please send it in a pastebin so it doesn't take up a kilometer of chat
ok sorry
https://ghostbin.com/oKxh4
this is my plugin but when i run it don't sendmessage on console and actionbar not working
someone help please
Is anyone german and can help me on a nullpointer-Exception
I am. But i will help you in english 😄
Can some one help me that please
Did you add the command in your plugin.yml?
Sure i added cord in command
Can you german its simple for me
But my english is very bad
Just using google translate like me :D
Pls print the error here. I will try to explain it in simple words.
Okay thanks i try
@lost matrix do you know how to fix this?
This error is cooming by this line: if (player.getInventory().getChestplate().getType().equals(Material.ELYTRA)) {
This line is run by rightclick on block or air
A player can have nothing on his chestplate.
This means that the return value of player.getInventory().getChestplate() might be null.
If you use a method on a null value then you get a NullPointerException
So you have to check if the player has an item in his chestplate slot.
Ill see what else could be wron
Ok thanks
Show your code pls
First:
Ohh
its pastebin okey?
This wont fix anything. Add some
System.out.println("Something")
calls into your code to see what was actually executed.
Does your plugin appear when you type /pl?
In what exact line is the error?
Wait i Try now
its very weird
its a new line thats the error came
and its a new error
Already is a nullPointer when send the Messages, from the Config. But i can fix this. Thanks for the Help
Dear god, just attach a debugger lol