#help-development
1 messages · Page 1230 of 1
so lets say I write a method called doSomething() in the main plugin class of a plugin called TestAPI
I load that plugin into my server
then
I make another plugin called TestPlugin
md5 will i get admin
if I do PluginManager#getPlugin and get the TestAPI, how would TestPlugin know what TestAPI does?
TestAPI apiPlugin = JavaPlugin.getPlugin(TestAPI.class);
apiPlugin.doSomething();
Because you code it to do API plugin.doSomething()
That's what I'm saying I can't do, how would the TestPlugin create a TestAPI object?
like how do I import TestAPI into my TestPlugin?
I can't just create a TestAPI object from nothing, right?
Add it as a dependency and use the code 7smile put above
thats what i've been asking...
how do I do that
You get the object the server made
TestAPI is now a dependency of your TestPlugin.
This means you use a dependency management system like Maven or Gradle to ensure your dependencies are present at compile time.
It isn't, how do I get the dependancy?
Well how did you get spigot api
Are you using maven or gradle?
maven
Copy that but change spigot to testplugin
a plugin in IntelliJ does it for me
lmao this would not work
have you ever actually used an api?
♿
Do you need this API to be accessible publicly, or is it okay if its only present in you local maven repository?
I would like it to be accessible publicly
I was assuming I need to do something on github or maybe some other website idk
Yeah I made this one called Spigot
lmao
What's spigot?
so you made spigot?
if you made spigot how are you so bad at explaining things 💀
Just doing my best bro
well ty for trying
now I understand since you probably know a ton more than me it's hard for you to know what I don't know and I didn't explain that well
Yes, this is not trivial, depending on which approach you select for hosting your dependency.
One way would be to use JitPack. It compiles your projects directly from github.
This can cause problems in a lot of cases, for example if you want to use NMS.
For a plugin which just uses the spigot api, you can simply push it to github and make it accessible via JitPack:
https://www.jitpack.io/
cool
also
oh
i can't post a picture
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
!verify
Usage: !verify <forums username>
uh
anwyays
I found this random image uploading site
hopefully that works
that's my plugin rn
You need to work on your semantics. The questions you asked werent conclusive, and we had to take a lot of wild guesses before we understood what you are actually asking.
scarry link
I need to be able to create instances of AbstractGuiPage and AbstractGuiItem
yeah I said that, sorry for not explaining enough
theres a less scarry link
i think
same picture
yes
would doing JitPack allow me to do all this?
so whats the problem?
im trying to figure out how to turn my plugin into an api so I can use it in other plugins
no, what you are trying to figure out is how to deploy your api artifact for other people to build against
that is a completely different problem and this is why you got bogus answers
You need to add one plugin as the others plugin dependency, than you can access it with for exaple a static getApi method or using the bukkit api mentioned before
Before you start with JitPack, try to keep everything local.
Compile your project using the install goal from maven.
This way your project will be installed in the local maven repository.
When you go this, create a second project and add your API as a dependency.
Come back if you got this working and you can isntantiate classes from your API.
Alr ty
Why so hostile bro I don't know what I'm doing just looking for help
Could've said it nicer
I would be more thankful if you did
But thank you regardless
if you're rude to people like this, don't expect people to be nice back to you
I was asking becuase he was giving me responses that didn't help at all. I know that I didn't give any information, but instead of asking for more information he kept telling me stuff that did not help and they were responses that sounded like stuff someone who didn't know what they were talking about would say
What he said is correct
just becuase something is correct doesn't mean it helps
You know what also doesn't help being rude to people for no reason instead of asking more questions
There was a reason that I already stated multiple times
this is a channel for help developing stuff not continuing a pointless argument just drop it
oh what i thought this was a joke LOL
it was fr I didn't know mb
u lucky i aint own the server wouldve banned ur ass 🙏
bro what
In the past I've had people give me advice when they had no idea what they were talking about
since he wasn't being very descriptive I thought this was one of those times
still woudlve banned u
aight bro didn't ask
come join my server just so i can ban u
banned by id 508354320274685953 L
anyways
You don't deserve help in the first place with this kind of attitude
i agree
I am in the wrong I know and am sorry
discussion over
anways
back to old discussion
the one that matters
I got it working locally
When I have my dependencies local like this do I need to have the API plugin on the server?
Yes (usually an API abstracts a plugins internals tho, so, yea. Or it is a utlity, then you'd shade it)
whether they are local or not, unless you are shading the into the plugin in which you depend on them, yes
The server needs all classes provided on runtime. Either you shade your API into your plugin, or you need to add the API as well as your Plugin to the plugins folder.
just because the plugin was built against something like the api doesn't mean that it can be absent at runtime
building against it only means that the compiler can check for compile time errors and emit correct bytecode
if the stuff the bytecode is trying to reference doesn't exist at run time, it explodes
How do I shade it? And can I now go to using JitPack so others can use it too?
you typically don't shade in an api
It's a pretty small API so I don't want to have little stuff like this cluttering my server
is this a library or an api?
uh
what does it do?
does it have a javaplugin class?
and also a listener that listens for any custom guis clicked
yes
then you don't want to shade it in
you will want that plugin on the server
the plugin will then implement the api against which you build your other plugins
Is there a way to make it not have a JavaPlugin class?
public final class LazyGui extends JavaPlugin {
@Override
public void onEnable() {
new GuiManager(this); // init gui pages
getServer().getPluginManager().registerEvents(new GuiListener(), this);
}
}
that's literally my whole javaplugin class
well yes, if you want to make it into a library, you could have the plugin using it register the gui listener
this way it doesn't need to be a plugin of its own, but it becomes a "part of" the plugin using it
how can I do this?
public final class LazyGui {
void init(JavaPlugin plugin)
{
new GuiManager(plugin); // init gui pages
plugin.getServer().getPluginManager().registerEvents(new GuiListener(), plugin);
}
}
would this work?
remove the LazyGui class from it and replace it with a comment telling the developer to include
getServer().getPluginManager().registerEvents(new GuiListener(), this);
in their plugin
that would also work
that said if you want other people to be able to use this library (in this case by shading it in as it's a library now), you still want to deploy the artifact somewhere like jitpack for people to build against it
me either, i only do private github repositories and jitpack doesn't like them
lol
alternatively just like pore through the jitpack documentation, i vaguely remember looking at it and it wasn't complicated at all
I suck at using github so I gave up on jitpack
how do I shade it?
nvm figured it out
that's the spirit
There isn't anything similar to: import org.bukkit.event.server.ServerShutdownEvent; ?
for 1.20
Back up trunk contents in case of crash server
If the server crashes your code won't be called
Or at least that's what you should assume
Well, how do I save the contents of the trunk if the server crashes?
Save things on a regular interval with the scheduler
You cannot, a crash can mean some data is lost
For example power is lost to the machine
No power means no code can run
Ha
or someone using the kill button on a panel like pterodactyl
Just like vanilla you should save things every couple minutes
Ok so just pray that the server doesn't crash lol?
hm? why did you copy paste that message
I translate into French
I just mentioned a senario that would cause data loss
No, save your data regularly
Yes but a Minecraft server can crash for no reason, right?
Anything can
Can I make a backup every 1 second?
That would just be a bad idea
Why?
I/O isn't free
You'll slow things down for little to no benefit
You usually don't need to save things more frequently than the server saves the world
Yeah that's fine
Ok thank you very much for your help
im having an issue on my server when chunks unload minions are turning into normal armorstands but when i come back minion does come back but that broken armorstand which supposed to be a minion are there too..
how should i fix that in code?
These “minions” are they apart of your plugin? Or another plugin you’re using?
Because you aren’t giving much detail about how you’re implementing them. Are you using PDC?
general minecraft enchantment question: When i say enchantment A is exclusive with B, do i have to say B is exclusive to A or does A handle everything?
Does it hurt to do both?
It would depend on the instance being invoked. If you check both then it doesn't matter, but if you're only checking one, then that's a problem
How do i give absorption heart to player without potion effect?
I believe you can use this attribute
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html#MAX_ABSORPTION
I trying to make a fast hopper plugin. How can I program the hopper to output to below and target direction if there is a item in its inventory?
Hoppers have internal cooldown, I'd suggest just changing that to make the hoppers faster.
Leave all the item logic to vanilla.
EpicHoppers from Songoda, I making that but my version. Don't tell me that I not allowed to edit the speed of hoppers. Cobblestone Generater with a hopper auto block break
Actually, there is a spigot server setting that allows you to change the global speed of all hoppers.
I don't want to change all hoppers
Just adding a custom one with features. Currently it only goes one direction, not downwards
Got it
So you can transfer items only to one direction ?
Sent to ChatGPTI have something like this set but this only goes at the pointed direction, not downwards like normal hoppers do
What setAbsoptionAmount does?
oh its capped at max_absorption
so like if i give 2 absorption heart to player and the player gets damaged then the max_absorption attribute decreases?
Ah, I think I see your problem.
Hoppers do two things with items and inventories.
They push and pull.
What you probably made is the push part, now you need the pull.
(Hence why I said that if you're just making faster hoppers, editing the cooldown will be easier)
Oh I don't know how absorption works, never used it.
Unless someone else knows, you'll have to
?tas
Search EpicHoppers and you see what I trying to create
No global editing required
I am not talking about global editing here. You can do that per-block.
If spigot has API for that.
Per-Block?
Is this really true information?
Wait, let me rephase this. I trying to edit the stack sizes. 1 for normal hoppers and 8 for fast hoppers
I have a plugin that uses ProtocolLib to summon packet based armor stands written for Minecraft 1.20. However, my server also runs ViaBackwards and ViaVersion. When I try to join with 1.8.9, I get an entity metadata error. Any suggestions on how to fix this?
https://paste.md-5.net/baxogihaji.bash
Is that all of the conversion steps shown
wdym
You want to see code?
I'm talking about the log
Alright show your code
okay
but why you need it as i said its written for 1.20
Have you tried asking in the ViaVersion discord?
Why do the armor stands need to be packet based
You don't need packet based armor stands for that?
The api allows for entities only visible to certain players
It would be easier to just use display entities
And would also look smoother
I'm not sure how via handles those tbh
Iirc it just converts them all to armorstands
Uh well my plugin has options for hiding pets etc soo
^^
The codes works well for 1.16.5 and above
The only argument for making this packet based I can see is the entity tracker performing somewhat poorly with thousands of extra entities to track
How many pets you spawning?
But this probably shouldn't be an issue with small pets
No point in overcomplicating it with protocol fucknuggetry then
Easy solution, don't support versions that are over a decade old
If PvP mechanics are of concern, you can emulate them really well with latest versions
And as stated before, this can be done with API
You can
as we've said
hideEntity/showEntity and setVisibleByDefault depending on what you want
oh
okay
is there a way to figure out the remaining Δt or do you have to guess?
what delta t
isn't that a client thing
tick delta is a rendering thing
you can guess it by taking a millis/nanos timestamp in a bukkit scheduler task at the start of the tick and then comparing to it in your other logic, but you'll have to assume that ticks take 50ms
and by the time you guess it and do anything with it the player is probably like 70ms behind
so it isn't of much use
the client also processes packets sent by the server (except for very few specific ones like pingpong) on the main thread at the start of the tick
so whatever delta t you end up sending is going to happen at the start of the tick on the client, so you might as well not bother
don't they just get processed immediately
processed as in polled and read from the bytebuffers, maybe, i'm not sure
but as in applied to the game world? start of the tick
conversely pingpong gets processed and responded to immediately
or no, i have it backwards, pingpong gets synchronized to main before response
keepalive is what gets responded to immediately
that being practically the only difference between the two
im not trying to do shit to the client lol
im trying to see how much processing time i have left; some of my code requires the modification of potentially hundreds of thousands of blocks
so i figured id dodge the lag and distribute the load over time
that'd be this
but afaik on spigot you can't get your logic to run at the end of the tick
on paper you have ontickend event
knowing how much time you have left doesn't help if you don't know how much ticking work the server has left
on tick end you can assume it's zero
im writing my plugins for spigot bc almost every server ever that can run plugins is a spigot fork of some sort, so it works more or less everywhere
?workdistro
yes that gave me this idea
paper's market share is like 90% of recent versions
the easiest way to go about this is to just split it into 20-30ms chunks
adapting to mspt is neat but not really something that you'll die without
Trying to setup a spigot plugin, but its saying it cant find the dependency, i have it as org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT
Did you add the repo
yeah i have
Could you send you build.gradle
bruh
Matrix multiplication (without SIMD, gpu etc)
1st row vs 2nd column based one
that's why CPU L1/L2/L3 cache matters
tldr always multiply by row when you can folks
yes, CPUs love contiguous arrays of data
what just got deleted
heh?
how is that possible lol
You mean prefix or something?
Yeah that's not a good idea
If people want to change the plugin name they can just do so in the plugin.yml
Some real trickery would be required otherwise and it's not worth the effort
hello
Do you want the plugin name to dynamically update based on the value set in the config?
Well, I don't know how to do that or if it's even possible. Maybe someone else can help you
nvm fixed
ive done it manually and added the jar file as a lib
pls dont remove the question after you fix it, looks like a very one sided conversation
xD
How to send a packet so that the player's effect is to display Speed in 1.21.4
i just packaged my plugin into a jar file with intellij maven, but the server wont run it, it doesnt recognise it when i do /plugins and it doesnt load
you should have an error in your console then
it doesnt print anything at all
It certainly does if it is in the plugins folder and ends with .jar. Scroll to the top of the log
does it have a plugin.yml
oh sorry didnt see it
it does have plugin.yml but console says it doesnt
you're probably not including your resources in the jar
so it does print something?
yeah my bad didnt see it
thought it would be nearer the bottom
yea, then presumably your plugin.yml is not in src/main/resources
ah, its just in src
or in whatever location you have set as your resources root in your build config
should config and plugin be in main
no
source code goes into src/main
other things you want included in the jar go in src/main/resources
i think i mightve structured everything wrong, should EVERYTHING be under src/main? everything currently is just under src
kind of depends what you're building it with and how you've configured it
the only thing in src rn should be the folder main
not everything, but the java components
maven uses src/main resources and java by default
and in main you have java and resources
other build systems may use other directories
okok got it thanks
and even with maven they can be assigned arbitrarily
all my classes/java components are currently in a package called duels, can i just drag this folder into main/java and not have to change any of my package defenitons, so they stil; say duels.commands ?
or do i include main and so its main.java.classicduels.commands
ok luv
@blazing ocean Hi, can I add an external file to the resource pack that I want to generate using packed directly in the pack object ?
just tried to package it and its saying none of my bukkit packages exist
you don't include "java" in the package name
your package names (and the class contents, with the package declaration on the first line) stay the same
you just move the classes to the correct sources root
i would send a screenshot as an example but i'm not allowed to embed media
can i dm you
let's see what it says specifically and where
copy the error in whole
i'm guessing your sources root was set to that directory like i alluded to earlier
if you're using mavan with intellij, you can right click on src/main/java and select mark directory as... > sources root
then right click src/min/resources and mark it as resources root
but again this advice is based on like 8 different assumptions like that you're using maven and the specifics of the error
so let's hear some more details
that's the answer i was looking for, thanks!
basically says package doesnt exist for everything i try to import like:
import org.bukkit.entity.Player;
this only happened since i moved the stuff into main/java, im using the api.jar in a libs package which is under the same parent as src. Should this lib be put under src or main maybe
my sources root is set to the resources folder under main
ive unmarked resources and marked java but im still getting the same issue
Are you building with maven
You don't want an api jar then
yeah i have one under libs
As a maven dependency?
You don't want to do that
ah okay
With maven, you add the api as a dependency in pom.xml
i tried to do that but it wasnt working, i can try again tho
Adding libraries like how you did it is for building with just the ide without maven
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>your.plugin</groupId>
<artifactId>MyPlugin</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
thats my pom.xml
trying to use this and it says dependency not found
is 1.8 a issue
That was the first thing I asked and you said you did
thought you meant the api
And yeah don't add jars manually use maven or gradle
i added the repo it still says the dependency not found
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
It will work but it's like 10 years old at this point and there's no reason to use it
idk if thats right
for the pvp
You can do that in modern versions
Anyways if you're using Intellij make sure to reload the pom
Should be a button for that in the top right or in the maven tab
means that pvp texturepacks arent compatible, and newer versions need more hardware ability to run smooth
ah amazing thanks the package has worked now
see if it loads properly
You don't need any crazy hardware to run modern versions
mainly more ram but it still makes it not worth it for me
the referance for the main class goes from java right? console saying it cant find the main class
path is main/java/classicduels/utils/classicduels.java
so id just write utils.classicduels
leave out the classicduels package
.
is that the full class path?
full cclass path is src/main/java/classicduels/utils/classicduels.java
idk where im meant to referance it from
ive tried that it js says it cant find main class
wont let me post media in here
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
ah
jesus i need to change this name
this is how i have it rn and console says it cant find the mainclass
oh
you have a main folder outside of your java folder
and then anotehr java folder in it
everything should be in the green java folder
The class name is lowercase on the plugin yml
oh that too
that layout is correct they just fucked up their folder definitions 
so its just case sensitive
I assumed the green folder was correct
thats fucked 😭
no, windows is fucked for not giving a shit about case sensitivity
if this acc works im gunna bash my toes against my bed willingly
ok now its spitting out a different error
Progress has been made
[20:50:35 ERROR]: Error occurred while enabling DuelsPlugin v1.0.0 (Is it up to date?)
java.lang.NullPointerException: null
at classicduels.utils.ClassicDuels.onEnable(ClassicDuels.java:28) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:408) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:372) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:327) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:267) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
[20:50:35 INFO]: [DuelsPlugin] Disabling DuelsPlugin v1.0.0
progress has indeed been made
Looks like a nullpointer
Something is null
i may know what it is holdup
ClassicDuels.java:28
thats just a getcommand
(passive agressive note, both paper and spigot for 1.8.8 have an exploit count probably reaching 100, you should be running a maintained fork)
oh shiz
i literally had it defined before but i deleted it by accident im gunna kms
thank god its finally working
got a few things getting spat out in console but ill fix that myself
thanks guys
java.lang.NullPointerException: null
ah yes
back before helpful NPE's
only took oracle a good 20 years to get that in
i was using a system where it clones a arena world then teleports the players to it, but turns out multiverse for 1.8.8 is possibly fucked, does anyone know any alternative plugins for this, or any alternative methods of doing this?
without bungee
Just clone the world yourself
it's been like 10 years since i last touched the 1.8 api but there is maybe probably a WorldBuilder or some other api method to load a world
copy over the world files manually and then use that to load it
you don't need multiverse to have multiple worlds, multiverse is just a popular way of setting it up, and comes with many convenience features and utilities like loading/unloading shit at runtime
im just using multiverse as a way to clone the world
i was thinking about creating a copy of the world then hard deleting it after but idk how easy that would be
like js coding it into the plugin
Files.copy
or that might not exist on java 8
🤡 got to for loop your directory tree recursively
rn it works by cloning it, then putting the 2 players names on the end of the world, teleporting them to it, then deleting it once the games over
but its doing that all through multivers
it would be very easy
do it with plain old java and the bukkit api instead if you don't want to rely on multiverse
change the folder name and delete uid.dat
you can load it in using new WorldCreator(folderName).createWorld()
remember to copy it first or it'll be single-use
if you want to be fancy you could zip it as a resource in the jar and extract it at runtime
nah ill just have the arenas as worlds within the server folders then make copies
no you would have to copy it to the asset resolution's directory
Keep a template world without the uuid data file and just copy that
I tend to use a uuid as the name for my temporary worlds
How do I get the direction of the hopper?
Its not detecting it if( !direction.getFacing().equals(BlockFace.DOWN) ) { event.getDestination().addItem(new ItemStack(Material.BONE,1)); }
== on enums
BlockFace is a enum?
yeahhttps://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/BlockFace.html
declaration: package: org.bukkit.block, enum: BlockFace
Still not detecting so here is the code
ItemListeners.java: https://paste.md-5.net/gosaranawa.java
add a debug statement before you return printing the blockface
No player for InventoryMoveItemEvent
because its not an event for a player
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
okay thanks
I know, you told me to add debug statements. I just trying to add a filter system to the hoppers
Without using EpicHoppers (Made by Songoda)
That is my goal
sysout or broadcast or logger before isValid,
in a plugin I'm experimenting with, I'm trying to detect when a right click air/block by a player has occured when the client attempts to place a block, even when the block being click is a "ghost block" or "lag block", by that I mean a block that is only client sided and isn't really there on the server. however, my event doesn't get triggered at all when it's a ghost block. although I can tell that the server is receiving data from the client, since on testing, I see that the block my client places against a ghost block gets removed. could anyone explain or help me understand why this doesn't fire my event at all in that situation? I don't even get the event fired for the real block that should be there. also what are some ways I can detect when this happens? I just need to set a value, or trigger a method, or really anything of that sort when the event takes place. right now I'm unsure of a way to access that incoming data from my players even though I see my server is recieving and responding to it. I also do not need to get the player, the block position, or any special event data at all, just need to know that it has happened.
I usually just ProtocolLib to handle that
I see what is happening. It was detecting it, its just I need to detect the direction of the target inventory (Not the hopper its self)
So how can that be done?
That is for getting the inventory, not the direction of the target block
the inventory is a block inventory
what do you mean "target block"
where the item is going?
You know how hoppers work?
You can get the location of the inventory then get the block, blockdata and rotation from that
yes. they take items from a source inventory and put them in a destination inventory
destination here being equivalent to your target
The inventory being destination*
a complicating factor is the fact that the destination inventory can be the hopper itself when it's pulling items
what are you trying to do again?
The reason I need the direction of the target block is because the hopper can be pointed SOUTH or WEST and it can still drop to below block
I trying to create a plugin like EpicHoppers (Songoda)
what
what is it supposed to do
Search it
no
explain it
you're in a help channel trying to get help for what you're trying to do
you best at least explain what it is that you're trying to do if you want help for it
You correct, I in the help channel. But I do better to show what I trying to do then trying to explain it
as long as you know the location of the hopper or obtained it early on this isn't an issue to compare when you get the inventories location
you only have to use the hopper.getRelative(direction of blockData)
gives you the block where the hopper is targeting
but i'm a little bit doubtful that we're not talking about the same "target"
Wrong.
When hopper is pointing SOUTH
And it has a hopper below it, the hopper below pulls the items from the top inventory.
block.getRelative( ((Directional) block.getBlockData() ).getFacing() )
gives you the target Block
thats too easy
we need to overcomplicate it unnecessarily
update. I discovered I don't need any libraries for this it seems. apperently, the issue is that, right clicking on a client side/ghost block, counts as a LEFT click, and I was checking for right clicks. anyone know why this might be? just want to understand this better. if I right click on real blocks, it says right click, but it specifically says left click in my console, each time I right click a ghost block in-game
event.isLeftClick() and event.isRightClick()
what about it? I'm asking why placing a block on my client would be detected as a left click?
I'm also using " e.getAction()" in my console output message so it should be exactly what type of action it's detecting
Hey! Trying to compile CoreProtect but I'm not sure where I am going wrong. First I tried compiling with java 17, but in build.gradle they've set the sourceCompatibility to 21, so then I tried that. Each time I get errors. For java 21 I keep getting missing dependencies but no matter how far down the rabbit hole I go I can't manage to build successfully
Ok so after using my brain I know I should use java 21, I'll go at it once more and see if I can resolve the missing dependencies
they're open source now?
This is so annoying
From the Start, I place STONE.
Before STONE goes into End 1, the filters gets checked then allows STONE to go into End 1 due to being on the whitelist
The rest goes into End 2
But somehow, everything goes to End 2 like filters is impossible to make
But if Songoda did it, its possible
I suppose so but their latest major minecraft version isn't public aside from their source code
I just can't figure out why it isn't compiling because it seems I need java 21 but also one of the dependencies seems to require java 17?
Which dependencies are missing?
It's not unusual for folks like them to use locally provided deps that others can't get
I refuse to pay for another filter hopper plugin
These were missing
implementation 'com.github.oshi:oshi-core:6.1.0'
// Add Log4j dependency
implementation 'org.apache.logging.log4j:log4j-core:2.20.0' // Use the latest stable version
implementation 'org.apache.logging.log4j:log4j-api:2.20.0' // Include the API as well```
after adding them I am getting the error "Unsupported class file major version 65
The hopper below pulls before the hopper on top has a chance to push
No clue what oshi is but log4j is publicly available
I just need a example if a filter hopper working and I look at how to put it into my plugin. Because at this point, I really close to just give up and I cannot rely on people not fixing stuff
Who other than ChatGPT comments their grade file?
Push the filtered items manually on pull
They still exist?
Yes
Arguably
Didn’t they have hella controversy. change ownership. Change name. And they are back???
Roaches are hard to stomp on for good
I rmemeber hearing something about the founder, being a questionable individual. Never sure if it was true.
I don't know what happened but I heard they might be banned from here so I recommend not going in detail about the case
Damn
Probably compiled with Java 22 or something silly
Yes, I keep bringing them up. That is because I have one goal in mind, that is to create a filter hopper plugin. The block breaking and suction is working
That or maybe your gradle process is running on j17
I can't tell if I should be insulted or flattered. However, in this case, I include the comments so I remember what I've been doing more clearly as I'm being constantly distracted at the moment
Yeah I had that issue at first but it's running J21 now
No it’s just peculiar to me that people comment their build file.
commenting can be useful 🤷♂️
I just wait until this talk is done since my task is not complete
I know I'm asking for help with my issue and discussing it here, but are you honestly expecting someone to just make it for you?
I'm asking because earlier you said I just need a example if a filter hopper working and I look at how to put it into my plugin. Because at this point, I really close to just give up and I cannot rely on people not fixing stuff
I don't always expect people to make it for me but I tried everything possible. But if someone does not want to make it, I won't beg them. I might end up paying for another plugin that has this feature I guess since I cannot do it
I don't have the money for it
It could be useful to take a break from the project and let your mind work through it as you do other things. Alternatively try rubberducking, explaining the issue to something or someone else, in the simplest terms possible, and it might unlock something for you
Or that ^^
(can also look at source for inspo for ur own)
I also need BlockBreak feature
fork it and add it, or us it as inspo for ur own
I might look at the code and try to add it to my plugin. Thanks
So, Core Protect: I figured it out. I needed to import the project from github as a gradle project, then import pom.xml as maven project and package it. Worked flawlessly. Had to change the plugin.yml to say branch: development
i always did prefer prism
coreprotect feels profoundly lacklustre after having to switch back to it from prism
i'll update it to 1.21.4 one of these days
why in the fuck does coreprotect have both
This is my old code of the hopper, its not working properly. Any fixes?
ItemListeners.java: https://paste.md-5.net/uweseqosid.java
I'll look into it
fuck if I know lol
having both is scuffed af
Indeed
...
are you getting an error
No error, its just not working the way I want it to be
This is how I need it to work but all items appear to be going to End 2, no matter the lists
Posted in #general
I not getting help here
be patient
I been at it for hours and hours
Well we're not gonna write the code for you and from what it seems you want to do nothing to try and figure out the issue
in epic hoppers?
I trying to create EpicHoppers but I don't need help with that plugin, just mine
Why not just clone EpicHoppers and adapt it to what you need it to do?
^
I don't mind doing it, its just I tried everything and it still malfunctions
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I used to use EpicHoppers but there is alot of bugs
Let's see the code and an actual explanation on what you want to happen vs what does happen
It's in general for some reason
🤡
Sounds like you have a few options, the one vcs2 suggested, where you fix the issues with what you've made, or you can try fix the bugs with the EpicHoppers plugin
I now have brain damage
if( hopper.getBlackList().size() != 0 ? hopper.getBlackList().contains(invItem.getType()) : false ) { continue; }
-# if I speak I am in big trouble
Now, I don't mean to be harsh but maybe try something simpler before trying to do whatever it is that you are trying to do now
💪
Nice job
ItemListeners.java: https://paste.md-5.net/uweseqosid.java
Now you see what I trying to do
have you added debug statements to figure out what code is happening and where its triggering stuff
Like I said an hour ago, the hopper below is pulling before the one on top can push
Either prevent the hopper below from pulling filtered items, or push filtered items manually on pull
Have you blacklisted stone from the hopper below
Ah hopper logic. Fun
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/HopperInventorySearchEvent.html
try adding a pdc key/value to the target block and then listening to this event
?pdc (For reference)
He barely knows java syntax, I think generics are reaching a little high for now
I going to attempt something
pdc doesnt actually expose that bad of generics
There's a fairly simple explanation / example
And he would need a primitive in this case anyway
I wrote my inventory system for my farming rod and the gps compass by myself. So that said @thorn isle has been blocked
Not like you've read a single thing I've said so far (and I know you just clicked on this to read this message)
@slim wigeon
@slim wigeon trust me bro, it might sound weird but try replacing ternary operator with && and ||
in && and || we trust 🙏
There are a couple comments in general as well
I recommend keeping a discussion in a single place to avoid loss of information
&& and || is jus easy to debug also
Yeah don't crosspost in the future ^^
Hey im trying not to use AnvilGUI, and use NMS to implement a function that returns the name of the typed in name for anvil GUI but i cant seem to access it, ive gotten as far as accessing the AnvilMenu container, but i cant seem to access the name in any way.. any ideas?
val craftPlayer = player as CraftPlayer
val nmsPlayer = craftPlayer.handle as ServerPlayer
val craftContainer = nmsPlayer.containerMenu
val delegateField = craftContainer.javaClass.getDeclaredField("delegate")
delegateField.isAccessible = true
val container = delegateField.get(craftContainer) as net.minecraft.world.inventory.AnvilMenu
println("Container Class: ${container::class.qualifiedName}")
if (container is net.minecraft.world.inventory.AnvilMenu) {
try {
val itemNameField = container.javaClass.getDeclaredField("itemName")
itemNameField.isAccessible = true
val itemName = itemNameField.get(container) as String
println("Renamed Text: $itemName")
return itemName
} catch (e: NoSuchFieldException) {
println("No itemName field found in the container!")
}
}
return null
}```
correct me if im wrong, but isnt the named text stored in a data slot?
container.getSlot(0).item.hoverName
that looks familiar, i may have tried it earlier on today and get met with null, i've been through so many different variations that i dont remember, im taking a break rn and ill confirm in a bit but i believe i had tried that but with getSlot(2) as thats the return item, though that item seems to be a phantom item
Now non-whitelisted items won't go downwards
ItemListeners.java: https://paste.md-5.net/ediditewiy.java
I got a feeling I going to get banned from here
Why?
I getting annoyed and I might say something extremely rude
is there an easy way to get the total number of blocks a player has mined?
loop stats
Yep, its going to be a lot easier to just query stats than internally keep track of it yourself.
? Thats not what I said.
ah wasnt referring to that
ingame the stats show the blocks individually, but the api doesnt seem to expose that
it just has MINE_BLOCK
oooh
isnt MINE_BLOCK individual for materials?
Yeah
i found it, its a overload methodd
Statistic.MINE_BLOCK, Material.DIAMOND_ORE
yep
well, if you just use getStatistic(MINE_BLOCK) i believe it just spits out the total
nope it gives 0 iirc
rly?
ill check but i believe so
nvm it gives java.lang.IllegalArgumentException: Must supply additional parameter for this statistic
i was just giving 0 for the stat if it errored
well then
How do I fix this?
is it to do with if( event.getInitiator() != event.getSource() )??
Its working now. I guess it fixed its self
long total = 0;
for(Material material : Material.getEntries()) //or whatever gets all enums
{
if(material.isBlock())
total += player.getStatistics(Statistic.MINE_BLOCK, Material);
}
dis then
GOD NO PLEASE NO
i did that.. it crashed the server instantly
not the md format
?
brace on a new line
thats me being too lazy to press the left arrow key coz i wrote the comment first
i swear i normally dont code like this :kek:
😂
though youre giving me ideas
yeah iterating over every material crashes the server in seconds
No, that does not work either. I tried
im running it for every player for a leaderboard so its executing for ~300 players
long total = 0; for(Material material : Material.getEntries()) /*or whatever gets all enums*/ {if(material.isBlock()) total += player.getStatistics(Statistic.MINE_BLOCK, Material);}``` did you know? java doesnt need newlines
yeah its awesome
anyway, this should lag and maybe kick all players but not outright crash
private double getStatistic(OfflinePlayer player) {
if (statistic.isBlock()) {
int total = 0;
for (Material material : Material.values()) {
if (material.isBlock()) total += player.getStatistic(Statistic.MINE_BLOCK, material);
}
return total/scale;
}
return player.getStatistic(statistic) / scale;
}```
probably shouldnt have that as an int now that i think about it
can you elaborate what that statistic.isBlock() is for
if the statistic type is a block
are you doing stuff with globals you really shouldnt?
public boolean isBlock() {
return this.type == Statistic.Type.BLOCK;
}``` is what the Statistic enum has
So there is no way to add filters to hoppers? That is what it feels like
its part of org.bukkit.Statistic
did you check teh source code of the 2 plugins i sent to see how they did it
declaration: package: org.bukkit, enum: Statistic
heads up, the Statistics of Type.BLOCK are NOT the group of statistics for 'blocks broken'
I did but they don't really show how a custom item is done. I won't want filters on all hoppers
use pdc
yes. MINE_BLOCK type is Type.BLOCK
but Type.BLOCK would also be in blocks placed
I using that here but that plugin is not
if you want the count of blocks broken, you only want to loop the block materials, and query the block broken statistic
placed comes under USE_ITEM 😂
there is no stat for placed
it comes under USED
wot
anyway, point being there very likely are other type.BLOCK stats
interactions possibly
did they shove that into untyped then?
yea
thats its own stat 😭
yea its a separate statistic but im talking abt the type
oh yeah its untyped
the only typed ones are:
DROP
PICKUP
MINE_BLOCK
USE_ITEM
BREAK_ITEM
CRAFT_ITEM
KILL_ENTITY
ENTITY_KILLED_BY```
other than that everything is untyped
hm
anyway, as for your issue, i think its potentially an issue with you doing something using globals
coz i dont see what else it could be
or the recursion
if that is one, i cant tell
its called here:
List<OfflinePlayer> topPlayers = Arrays.stream(Bukkit.getOfflinePlayers())
.filter(player -> player.hasPlayedBefore() || player.isOnline())
.sorted(Comparator.comparingDouble(this::getStatistic).reversed())
.limit(10)
.collect(Collectors.toList());```
how the hell do you not err on a method that requires an arg lol
does this refer to the object in which the stream is executed? i guess that works
only idea i have is to put the isBlock check onto material
i do :)
if (material.isBlock())
i might try running it off the main thread and using BlockType instead of Material
i clearly am too tired for this, and i can't see any reason for this to fail in that case bar divide by zero nonsense
Material should be fine. my recommendation is to step through with a debugger and see when it fails / crashes
good luck i guess?
I guess its impossible to set filters for hoppers. This is my 3rd day of trying. PaperMC won't help me
cant you just
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryMoveItemEvent.html
cancel that?
I using that here but its not working
ItemListeners.java: https://paste.md-5.net/ediditewiy.java
yea im missing context here lol
do you know why its not working?
No, I don't. I tried every possible way. ChatGPT returned useless code
I tried but not working stillif( event.getInitiator() != event.getSource() ) { return; }
if those two equal something has seriously gone wrong lol
query. does this work for hopper chains, and fail to block it when picking up items?
thats the only case i can think of where those might equal
That part is not working
im pretty sure moving down hopper towers when the facing direction is sideways is done by the hopper below
that might be the problem if thats not accounted for. you either need to do it via the hopper below, or move the item manually
I don't know how this can be done but I like if it just work. Given the amount of time trying to get this to work, I like to see a example code otherwise I might have no choice but to end the project
The best advice i can give is start from scratch and think what needs to happen for it to work, eg item is grabbed by hopper, decide if it being moved out of normal order then deal with that
And also take a break and come back to it after sleeping on it
I not re-writing the whole code. I not waiting for months for a functional plugin
You do know epic hoppers is open source too right
I not using them either. I tried reading their code and its unreadable, I cannot tell what it does
Well, it's written by songoda so it's not that surprising.
From a quick scan it doesn't look hard to understand
If I get a chance tomorrow ill make an mvp of what I gather that you want
I don't want to use nms as well, I did see that
anyone know what ItemDisplay.ItemDisplayTransform.GROUND does?
I told you a pretty viable solution
There’s an event you can listen to and filter the target inventory from there
.
[String] item_display: The model to display. Describes item model transform applied to item (as defined in display field in model JSON). Can be none, thirdperson_lefthand, thirdperson_righthand, firstperson_lefthand, firstperson_righthand, head, gui, ground, and fixed. Defaults to none.
I cannot seem to get this hopper filter system working
Do I do this with InventoryMoveItemEvent?
Anyone here?
ServerCommonPacketListenerImpl & ClientInformation is changed to what in 1.20 & 1.20.1
@jagged thicket You still there?
?
I cannot get the filter system working. Since no one wants to help me with it, that is why I asked for that plugin
I tried InventoryMoveItemEvent
Just now InventoryPickupItemEvent
Nothing works
@jagged thicket
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
.
can you form a proper sentence
oof I was using that wrong no wonder it didn't work the way I wanted it to. Thank you for clarifying that for me.
i cant tell if thats a question or a statememt
not you
mb
the guy above
Is there an event thats called when a sign breaks because the block it was attached to breaks? Or do I just need to check BlockBreakEvent and see if my sign is attached to it?
i mean, there's no ServerCommonPacketListenerImpl in 1.20 and 1.20.1. it exists in newer versions like 1.20.2, but not in 1.20 and 1.20.1. was it renamed to something else?
?mappings
Compare different mappings with this website: https://mappings.dev/
How's it possible to enroll custom advancements into the client? I've seen plugins like Advanced Achievements by LucidAPs, but these aren't really advancements, and are more so "milestones" with affects, but they don't actually invoke the Advancements Toast on the client.
Recently I saw a video in Spanish(?) showcasing a plugin but I'm curious how this is achieved. How in code are you able to do this?
En este tutorial les enseño a utilizar el plugin Custom Advancements que permite agregar logros en tu servidor y modificar completamente el sistema de progresos de Minecraft. Los usuarios, al completar los logros, podran ganar diversas recompensas que puedes especificar utilizando comandos por consola de otros plugins.
El sistema de progresos d...
datapacks
Wow, you're amazing @blazing ocean
Actually NMS cant do it?
You ever used Kore?
Nah but I know the person who made it
Jesus, how well connected are you?
Being active in discords like spigot and fabric really helps you lol
after a while you tend to know people
who are you again?
I like md used to be a bukkit dev staff member long time ago. I also helped bring the first hologram plugin to minecraft servers 🙂
yes
theres no ServerCommonPacketListenerImpl in mappings
i cant find
uh
it was probably part of the PlayerConnection
yes
i want to modify player's latency using the latency field of ServerCommonPacketListenerImpl, but it doesn't exist in older versions. how can I modify latency in older versions? 😭
Ddos the player
wdym 😭
how can I keep an Item from moving?
An item entity?
tape it down
ahhhh i was trying to use bubble gum, silly me
sadly it doesnt have enough tension, thats where u went wrong :(
If you want it to stop from spinning and moving, use Item Display Entity
serverplayer got latency field
yeye
oh yes
it was moved to ServerCommonPacketListenerImpl in newer versions
What does that field even get used for
for changing ping/latency
if i do that it floats up 8 or 10 blocks in the air :p
Are you trying to spoof clients ping to the server ?
That's not a nice thing to do ::)
i want the spinning and bobbing just not water and lava pushing it around
if you just want to display an Item so it can;t be picked up or moved use an item Display
ItemDisplay just sits there though, I want the bob and the pivot
hey i wanted some help, can anyone give me a example code to check if a player has armour with specific trim on it like Vex trim or any other
ill really appreciate it
?paste for me
I believe trim is stored in item meta, so just access the slot see if there is anything there and if it has meta then see if it has the meta you seek
Sample code https://paste.md-5.net/utafosezow.cs
I believe it’s ArmorMeta you need to cast to
i'm working on a spoof plugin that adds fake players to the server. i'm modifying their ping to make them look real.
Isn’t that just a field in the packet
Thank you ElgarL but it may be overkill for a dinky chestshop
just have a single runnable to process each display
You can make the item entity ride some display entity
It will stop it from moving & display entity is the most efficient
Smort
That code I supplied is very simple and the minimum to simulate a dropped item
hmm so i would need to keep track of all the display items in one spot, i guess i could do that
is there an easy way to see if they are loaded or not though?
store teh UUID and if it exists its loaded
I wonder what happens if you make something ride a marker entity
Since markers aren’t sent to the client
ok, storing the uuid already in persistent data
- I believe that is not possible (on vanilla at least, surely spigot can force that)
- Most likely a desync
- ?tas
Yay desync
You got there buddy
Shouldnt even work in any way
Afaik or atleast how they've been described they are basically non-existent
Not really even an entity except for basic data and position
on the other hand, it's still an entity
Okay, mc wiki says this:
They cannot support passengers (even when summoned with a Passengers tag, the passengers are not created).
?whereami
and that can be safely ignored
ahhhh
How can I change nametags on players that are client side with packets? I want for example that only my teammates can see my HP and enemies cannot. How would I do this?
teams and scoreboards
I would like to know, if it is possible, how to apply a texture to an item? Like we have the resource pack put on the server, the players must put it on the game (we have an interface that opens in this case, done directly by the game) and they must put it to see the custom textures, except that the textures inside are not necessarily on items that exist but that we will want to make the illusion that they are in the game, as if we added a water pistol but on a stick for example. But if I want to call it "water pistol" is it possible or am I necessarily obliged to put the name of the texture to "stick"?
custom model data / custom models (1.21.4+)
gson is a dependency of bungeecord chat which is a dependency of paper api
thats why its nested
hi i am looking for a server dev can anyone help ?
?services or check pins in #general
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thanks
Hi Guys, just a quick question. What is the go to way for handling subcommands with tab completion. I've gotten quite used to bigger plugins like LuckPerms having tab completion for all main commands but it doesn't seem like the spigot api has some prebuilt methods/abstractions for this.
The Spigot API has the TabCompleter interface you implement
though it is a bit less powerful than what LuckPerms does
as it's older than Brigadier
I can recommend using Cloud or ACF for commands
cloud 🫶
Yeah its just gonna be a very small QoL plugin for a server me and my gf use. Don't think I need a feature complete solution, but I'll take a look at the ease of implementation
then the tab completer is probably enough
Damn as someone who enjoys software quality, and comes from the c# world, cloud looks like a well built option
Yeah
I would just have your command implement TabExecutor
LuckPerms is also well built
How do i solve this 3 years old asked question i am getting the same issue
I'm currently working on a plugin that displays the items you're looking for in the boss bar. I have a tool that goes through every texture in the item/ and block/ directory and creates a unicode for the resourcepack. But how do I do this with slabs, for example, because slabs are created with the model and the texture is defined in the model, so it is not a separate texture
there's this if you just want vanilla items/blocks
if you have custom blocks or have custom textures for them, you'll have to render them yourself probably
the game essentially computes the item icon on the fly from the model
Only packets is the solution i think
The answer hasn't really changed. Get the packet containing the absorption amount and clamp it
you wouldnt have to use packets
I assume you replied to the wrong message
yea i didnt even notice i hit a reply lol
Using packets isn't the only option clamping the the attribute and then ensuring that the absorption hearts don't go down is also an option ofc
That's how the scaled health api works
long time ago i made a guild plugin that let you get more health the higher you advanced, just had to do all the math in the plugin, same number of hearts it just took more for them to go down
How to force a resource pack? So when denied, then kick
How can i re ask to download it once i declined it? I have an infinite kick loop now...
xd
edit the server list entry
whats that? :p
the server list entry in your game
alright thanks for your help
Hey, i created 2 item stacks with custom model data 10 and custom model data 20 but both items are looking like the custom model data 10? Why is that? Version 1.21.1
?paste
Howcome my nms mappings aren't working, I've got this here for my pom.xml https://paste.md-5.net/iqototarom.xml, but to get, for example, the playerConnection from EntityPlayer, I need to do entityPlayer.f, which is obviously not correct, right? And I have ran build tools with the correct flags, because I've had this working before
show your item model overrides
generally looks fine to me
how to make it appear to the player that theyre freezing
yeah for me too T-T
but you are setting the CMD to 1 and 2
setFreezeTicks and setIsInPowderedSnow does nothing
instead of 10 and 20
yeah bit older code, i have 10 and 20 ingame and they look the same
wait
what the f
So i removed the override for 10, reloaded the texture pack and added it back and reloaded it again