#help-development
1 messages ยท Page 1459 of 1
ik, because i don't need to with forEach
i just wanted to iterate thru it
and thats how i did it
no i do
no you dont
^
you can use the higher order function forEach, fori and for each
The ONLY reason to use iterator is cause of removing while iterating. Otherwise you are basically taking away performance
for each loop
I mean an enhanced for uses the iterator anyway...
but for the sake of clarity...
why?
@EventHandler
public static void onExplosion(EntityExplodeEvent event) {
HashMap<Block, Material> reset = new HashMap<>();
event.blockList().forEach(b -> {
reset.put(b, b.getType());
b.setType(Material.BEDROCK);
event.setCancelled(true);
});
event.getLocation().getWorld().createExplosion(event.getLocation(), 4F);
reset.forEach((b, m) -> b.setType(m));
}
there is the code but better
Otherwise you are basically taking away performance
talking about this
why tho
they are the same speed actually
wait shoot
well yes, because enhanced for loops compile to iterator
i screwed up
i forgot to add the if statement back
there we go
now its actually fixed
@EventHandler
public static void onExplosion(EntityExplodeEvent event) {
HashMap<Block, Material> reset = new HashMap<>();
event.blockList().forEach(b -> {
if (!(Bedwars.weakBlocks.contains(b.getType()))) {
reset.put(b, b.getType());
b.setType(Material.BEDROCK);
}
});
event.getLocation().getWorld().createExplosion(event.getLocation(), 4F);
reset.forEach((b, m) -> b.setType(m));
event.setCancelled(true);
}
Do static event handlers even work..?
Block::setType though ๐
how do i make a command that reloads my plugin
cuz, that way it treats it like obsidian (blocks behind it relative to the explosion aren't exploded)
/rl confirm?
in a gui
nah that makes memory leaks
aNd i just want to reload my plugn
how can i cancel riptide
PlayerRiptideEvent
declaration: package: org.bukkit.event.player, class: PlayerRiptideEvent
@obsidian tree
there is no setCancelled() method
yep thats intentional
i want the weak blocks destroyed, and all the other blocks treated like obsidian (the blocks behind them wont get destroyed)
it does tho
like in game, it works
that is intentional
thats what i want
so that only weak blocks can be destroyed
no, it is intentional, that way the explosion treats it like its bedrock
lol
so the blocks behind it dont get destroyed
lol
yes
you know, you can skip the vanilla mechanic and jump directly to setting which blocks are exploded or not...
because the way i had it before blocks behind unbreakable blocks would still get destroyed
oh
and to fix that, i did what i did
Yeah that isn't fun to code
um
exactly, PulseBeat_02 the only other way i could fix it is by ray tracing the explosion myself and that seems painful, so i used vanilla which did that for me
ok
is there a way to disable block updates for a short amount of time?
wait
i have a much better way of doing what i did
lmfao
i just have a list of blocks placed by a player
and if the block isnt in blockList then i remove it
lmfaoooooooooooooo
when ur brain is too big to physically fit
when your brain is too tiny to fit your skull
๐คก
they should not.
I'm sorry what
lol
idk this tutorial i watched told me to put them in
hey so i have this class that has a constructor and an event i want to register right
but i can register it because the constructor passes other variables other than the main file
i cant register events from this class because it requires different variables in the constructor
and also this class is meant to be extended
alright i would bash on you any day
about a ton of stuff
but im confused from what you are asking tho
are you trying to make Scoped_Rifle be an event too?
you really shouldent be putting listeners in object classes tbh
also you need to follow naming conventions
hmmmmmmm, im getting a CME with this:
@EventHandler
public void onExplosion(EntityExplodeEvent event) {
for (Block b : event.blockList()) {
if (!(placedBlocks.contains(b))) {
event.blockList().remove(b);
} else {
placedBlocks.remove(b);
}
}
}
- stop using
publicfields and start using moreprivatefields - Name your variables and classes better. Instead of mag_size, name it magSize. Always name it camelcase. Your class has to be PascalCase, so instead of Scoped_Rifle do ScopedRifle.
- stop using static when you don't have to
you are calling remove in a foreach loop is what im guessing
but you got to provide us with the error my dude
- Keep your name forever i love it
bruh didnt we just go over this..
- How i can filter META-INF :v?
what is wrong with meta inf ๐ญ
What do you mean filter
maven
remove it from the compiled jar ig
I feel like thatd be an XY
e :v?
if it is from the shading plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/maven/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
use filters
yes, but its like really confusing how we talked about it, like someone mentioned that i could use that for loop for this, but but im not sure why it doesn't work now
but if you arent using shade plugin, then its an xy problem likely
This Is The Simple Answer
You
Cannot
capo ๐ ๐
a
more specifically like the for/foreach loops
it's spanish uh
how would i then?
As mentioned above... iterator
mystical magic called ๐ learn ๐ java ๐ before ๐ apis
^
but this still throws:
@EventHandler
public void onExplosion(EntityExplodeEvent event) {
Iterator<Block> iterator = event.blockList().iterator();
while (iterator.hasNext()) {
Block b = iterator.next();
if (!(placedBlocks.contains(b))) {
event.blockList().remove(b);
} else {
placedBlocks.remove(b);
}
}
}
^^
ok
dear lord
you arent using iterator correctly
oh
you physically CANNOT remove something from an immutable list
i think that was how conclure told me
sorry i left cuz i had to do something
yeah im used to using python so i use the python naming convention a lot by accident
ic
is there actually no way?
Not like that
and for the static thing it fixed an error with creating a variable before the "super"
didn't md say blockList was mutable tho?
it is
ima check this
im mutated it before
it does
It doesn't say shit about mutable/non in the JD
so how would i mutate it correctly?
ok wait so is there a way for me to register the class as an event?
it may be the placedBlocks.remove(b);
or do i have to rewrite shit
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
srry
is there a way to get the max of an explosion size?
like the max block list of an explosion
define max
yes
yes
is there a way to get the max range that it breaks?
ok
you could maybe look into nms to find or come up with a math function that roughly estimates it for a given hardness
the number i found (not counting hardness) is 1.3 * power
what are you trying to do anyway
it's not like i have to read it
write it down and someone might read it at some point
ok
so at the core, what im trying to do is make explosions only break certain block
but the way i do it doesn't account for randomness
the way i do it is I get the blocklist of an EntityExplodeEvent, then I take all of those blocks that aren't in my list of explodable blocks and set them to bedrock
then i cancel the original explosion, and create a new one
then i set all the blocks that i set to bedrock back to what they originally were
the issue is, the blockList of the original explosion can be different from the blockList of the new explosion, which causes some blocks to still explode
can't you just remove the blocks from the list to make them not blow up
it's mutable iirc
that wouldnt work, lemme explain why
if i did that then the blocks behind the non-explodable blocks would still be exploded because the explosion raytracing would not treat the blocks like bedrock/obsidian
do your own raytraces and remove them from the list if they're blocked
thats what im trying to avoid
but if you think its necessary I guess i could
it just seems very hard
yeah well it's still infinitely better than running around creating several explosions and setting shit to bedrock
no its only 1 extra explosion
you don't even need to access the world, you just need to check whether any given block in the list is blocked by a block you've removed from the list
a good excercise in how to vector math and do spatial logic if nothing else
fair point
i would also have to research minecraft's explosion system
and get all the rays that it uses
as well as how it does hardness
not necessarily
wdym
or well i don't really remember how explosions work but iirc it's pretty trivial
just a plain raytrace checking whether there are obstructing blocks in between the center of the block being tested and the center of the explosion will probably be enough
but i would need to detect hardness because blocks can be destroyed 2+ deep
by obstructing blocks i mean your special whatever blocks that you removed from the list
the server has already done the calculations for the other blocks
the only change that removing them should make is to prevent blocks from blowing up
and the only blocks that are prevented from blowing up are the blocks you remove
and the blocks that are shielded by the blocks that you removed
therefore; raytrace outward from each removed block and then protect those blocks as well
i see
ok, so how would you ray trace from those removed blocks?
i know how to raytrace from where entities are looking, but im not sure how to continue the line between the tnt & the block
i'd probably draw a line from the center of each block to the center of the explosion, and see if it intersects with any of the blocks I removed from the list
which would involve writing my own simple raytrace function, but that is quite easy
the alternative method is to get the distance of the removed block from the explosion center, normalize, and then repeatedly add the normalized distance to the location of the block
drawing an outward stretching line of blocks starting from the removed block
and then calling .remove on the list or set or whatever with each iteration
the results aren't as good and the performance is probably a bit worse if you have a lot of removals for a large explosion
but it should still be 'fine'
Hello, So recently I learn java. But I am having to figure out how the plugin.yml works and tutorials on yt arent helping. I am looking for anyone that could help me or spigot example plugin that is working on 1.16.5. The server keep saying unable to find main class
thanks
it isn't working
like the github porject?
nonono
send a screencap of ur plugin.yml
and also
your project hierarchy
like that
send a screencap of ur plugin.yml
lol
does ServerCore extend JavaPlugin?
how is it not showing an error
you have two public class ServerCore
class within a class
mismatched brackets
how did it even compile
lol
also it really should be a maven project
oh? what that do? btw thanks
well you made your first plugin project that way
but it basically does all the building for you
its not working
and adds dependencies
oh ok
"its not working" is not enough for us to help you. ideally, you would explain what you changed and what the current problem is
org.bukkit.plugin.InvalidPluginException: Cannot find main class `ca.imperialskies.core.SpigotPlugin'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:382) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:224) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.ClassNotFoundException: ca.imperialskies.core.SpigotPlugin
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:138) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
... 8 more
i was trying to get this up lol but I couldn't figure out how to copy the log
yes you explained that the problem was that the main class was not found
so? what am I looking for
did you change anything?
and after recompiling and replacing the plugin it still shows the error?
yes
https://github.com/PopGTN/ServerCore this the plugin here
well it's private
oh lol didnt know
there
but why isnt this working https://github.com/PopGTN/ServerCore
still private
what it is I thought I fixed that sorry
ooh there it is
yep thanks btw
is it working now or no?
org.bukkit.plugin.InvalidPluginException: Cannot find main class `ca.imperialskies.core.SpigotPlugin'
says SpigotPlugin
class name is ServerCore
but in your repo's plugin.yml the class name is right
did you try again after fixing this?
or is it the same error?
My brain is like so tried rn i am sorry for these stupid mistakes
lol np im tired asf too
can u try running the plugin on the most recent code, and paste the stack trace?
looks like the error in the link above doesnt match up with what's in the plugin yml
it says Server core not SpigotPlugin
stack trace?
like the log?
yep
org.bukkit.plugin.InvalidPluginException: Cannot find main class `ca.imperialskies.core.SpigotPlugin'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:382) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:224) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.ClassNotFoundException: ca.imperialskies.core.SpigotPlugin
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:138) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[server.jar:3076-Spigot-9fb885e-1e8c432]
... 8 more```
move the ServerCore.java up so it's right under the package core (out of the folder)
then, set your main: in the plugin.yml to:
ca.imperialskies.ServerCore
idk my best guess is that the package is reading itself without any classes
so it doesnt think your ServerCore.java is part of the core package
the white icon usually means empty
ok
send the same screenshot after youve done that
the package would be package ca.imperialskies;?
yes
it worked thank you!
nice!!
btw do permission get set in the plugin.yml or the code or both?
both
although if you want to set a direct command permission you can set it only in the plugin.yml i believe
This means that the folder isn't part of the build path btw. "ca/imperialskies" is but "core" is not
thanks
can anyone help me? I can't run my plugin, and this is the error code
[ERROR] Could not load 'plugins/test.jar' in folder 'plugins'
show the full error
why my .xml broke any1 can help me?
show the xml
like
whats the error
How to get offline player's name?Bukkit.getOfflinePlayer(uuid).getName() it returns uuid ๐ฆ
it shouldnt return the uuid if it's a valid player
u know how?
well 1.8 is an unsupported version so ยฏ_(ใ)_/ยฏ
what
why not just use 1.8 spigot repo
can u give me or edit the pom.xml for me, i jsut lost in finding spigot one
remove the bukkit dependency
[WARNING] Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[WARNING] Legacy plugin HellowWord v1.16.5 does not specify an api-version.
[ERROR] Could not load 'plugins/test.jar' in folder 'plugins'
you need to put the api-version in the plugin.yml
um
i removed
still said error
Failed to execute goal on project Spectaculation: Could not resolve dependencies for project Spectaculation:Spectaculation:jar:1.0-SNAPSHOT: Failure to find net.citizensnpcs:citizens:jar:2.0.27 in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
halp
that's not gonna stop the plugin from failing to load, lol
still should
they dont listen
i said show the full error
@quaint mantle can you, check out the error for me? Its ok if u dont wanted to
its said "Missing Artifacts"
WHEN i remove bukkit from dependencies
this happended
package net.minecraft.server.v1_8_R3 does not exist
doesn't work
i have swapped to spigotmc
still
perhaps you have to add -SNAPSHOT to the maven version of citizens
i did
the problem here is the spigot mc
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>everything</id>
<url>https://repo.citizensnpcs.co/</url>
</repository>
<repository>
<id>enginehub-maven</id>
<url>http://maven.enginehub.org/repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
so its saying it can't resolve spigot-api?
is it like this one or different?
I'd like to see the error perferably
when i complie and run the plugin
[10:50:41 INFO]: [Spectaculation] Enabling Spectaculation v1.0-SNAPSHOT
[10:50:41 ERROR]: Error occurred while enabling Spectaculation v1.0-SNAPSHOT (Is it up to date?)
java.lang.Error: Unresolved compilation problem:
Unhandled exception type ClassNotFoundException
at me.superischroma.spectaculation.Spectaculation.onEnable(Spectaculation.java:129) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-db6de12-18fbb24]
at java.base/java.lang.Thread.run(Thread.java:832) [?:?]
this
and heck tons of errors
what class is line 129 referring to
ok
huh?
[WARNING] Spectaculation-1.0-SNAPSHOT.jar, bukkit-1.8.8-R0.1-SNAPSHOT.jar, commons-lang-2.6.jar, ebean-2.8.1.jar, gson-2.2.4.jar, guava-17.0.jar, hamcrest-core-1.1.jar, json-simple-1.1.1.jar, junit-4.10.jar, persistence-api-1.0.jar, snakeyaml-1.15.jar, sqlite-jdbc-3.32.3.2.jar define 1 overlapping resource:
[WARNING] - META-INF/MANIFEST.MF
[WARNING] commons-lang-2.6.jar, persistence-api-1.0.jar define 1 overlapping resource:
[WARNING] - META-INF/LICENSE.txt
[WARNING] hamcrest-core-1.1.jar, junit-4.10.jar define 22 overlapping class and resource:
[WARNING] - LICENSE.txt
[WARNING] - org.hamcrest.BaseDescription
[WARNING] - org.hamcrest.BaseMatcher
[WARNING] - org.hamcrest.CoreMatchers
[WARNING] - org.hamcrest.Description
[WARNING] - org.hamcrest.Factory
[WARNING] - org.hamcrest.Matcher
[WARNING] - org.hamcrest.SelfDescribing
[WARNING] - org.hamcrest.StringDescription
[WARNING] - org.hamcrest.core.AllOf
[WARNING] - 12 more...
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /Users/giakhanh/Documents/Spectaculation-main 3/target/Spectaculation-1.0-SNAPSHOT.jar with /Users/giakhanh/Documents/Spectaculation-main 3/target/Spectaculation-1.0-SNAPSHOT-shaded.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Spectaculation ---
[INFO] Installing /Users/giakhanh/Documents/Spectaculation-main 3/target/Spectaculation-1.0-SNAPSHOT.jar to /Users/giakhanh/.m2/repository/Spectaculation/Spectaculation/1.0-SNAPSHOT/Spectaculation-1...
annd its said build success
but cannot execute
:/
ok
which output file are you using
.jar
shaded or not
so this one? Spectaculation-1.0-SNAPSHOT.jar
ye\
ingame its like this plugins (2) Specta, worldedit
still recognized as a plugin
have you opened the jar to check it has all the classes that you made?
it is
i have opened
have u checked the pom
idk if its wrong there
well one thing might be that your not shading anything
sooo where its making errors, this is an abandoned plugin, i added something and doesn't know how to complie
:/
I mean I could be wrong but in order for things to be shaded you have to set up relocations within the shade plugins config
maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
?????
the problem said is "net.minecraft cannot be resolved"
where at? within the build or on the server console?
the source code
well yeah if you use the spigot api it's not gonna fuckin work
?bt you need to use this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
then move the retirved file to?
or just this
did you run buildtools or just download it blindly
should be good to follow my instructions then
Current Path: C:\Users\Gia Khanh\Desktop.
*** Could not find PortableGit installation, downloading. ***
Starting download of https://github.com/git-for-windows/git/releases/download/v2.30.0.windows.1/PortableGit-2.30.0-64-bit.7z.exe
Downloaded file: PortableGit-2.30.0-64-bit\PortableGit-2.30.0-64-bit.7z.exe with hash: 6497e30fc6141e3c27af6cc3a081861043a7666dd54f395d47184e8eb75f5d61
Extracting downloaded git install
congratulations, you are running buildtools
gud
yo quick (non spigot) question,
im messing with a silly project and I have almost no networking experience
any tools out there to create a bridge between a local Java applet, and a remote Node server?
I'm completely unfamiliar in this territory and I don't know what direction to take.
And before ya say it, a 'quick google search' aint helpin
I mean you could use websockets I guess
ooh a good thought
i have almost no idea where to go with that
but it's a start
ty
I found spark/jetty to be good for websockets
ty
Anyone have any tips or anything to set up a config...I tried a lot of youtube videos and websites , but nothing really helped me.
ok thanks ,
funny thing is I already looked @ like 3 differn't spigot config stuff
yup, good to keep in mind and keep an eye on that hierarchy
spent the past few hours messing with a number of libraries and I have a prototype working.
Thanks for setting me in the right direction
Is there like a way I could "save" or reference a class/string inside a Inventory so I can later identify the inventory by it?
Or if you don't use a random library, you could implement your own InventoryHolder
That's the unsupported usage of api ๐
yeah this is implementing InventoryHolder
So is reflection XD
it seems like a good idea
To be honest, a Map<Inventory,X> works great
Happy to help :D
right
eh
that's what i meant
too much unnecessary work
๐คจ
Ahhaaa. Unnecessary work is the basic idea of spigot API what are you talking about
implementing InventoryHolder seems simpler and a more object oriented approach
and having a Map would be finicky and very error prone
I mean custom inventory holder seems fine too yeah
Nah its hacky api usage of interface thst wasnt designed to be implemented by plugins
and yet it has worked in every case ๐
So XD I don't see your point
Isn't even marked for depreciation
They tried to remove it in a PR once, failed.
What will happen if md_5 will add some new methods in this interface?
I mean realistically they will rarely just fuck over so many plugins by changing a interface so drastically
Works != good
Eh, I mean the interface is specifically not to be implemented XD
Like manya is right, this is not supposed to be used
So I wouldn't count on spigot not changing it
It's like saying "oh sure that NMS method won't change because people use it"
Tbh I hadn't had any issues with a straight up map approach
If you are increadiblty scared of leaking inventories you can also periodically cleanse the map
well my issue is currently: I allow the server admin to change inventory names and translations and stuff.
And up to this point I have been identifying the inventories in the clicks/closes by their name, so this has been getting a bit dirty.
And if the name Strings are the same, it's impossible to distinguish...
But using a map with Map<Inventory, Class> wouldn't work, would it?
cause there would possibly be many many copies of different Inventory of the same Class.
So?
which would lead to it being hard to manage and unnecessary memory and speed wasting
its doesn't want to workat all! Any1 tell me how i can complie a craftbukkit plugin
i tried bukkit repos
A hashmap has O(1) lookup
but its gone
Not much of a speed issue
Memory wise, idk how many inventories you open simultaneously, but eh
You are removing inventories from the map the second they are closed/no longer displayed
Well, nearly, but it's more the amount of operations I'd need to do. So add/remove for nearly every inventory click, some checks when clicking etc. etc.
I imagine a lot of code
I haven't looked at an inventories hashcode function but I can't imagine that speed difference actually being an issue
definitely do not use the name of the inventory to find the one you need
what if someone renames a chest to it?
I just figured, as I have implemented a inventory state system, I could maybe cache the handler class' in there and change it
Well this and inventory translations is the reason for me trying to figure out a fix.
I mean, tbh inventory holder hasnt changed in a long time. You can use it XD just know that it might be changed
Keep an eye out for changes in new releases
And update things accordingly if you use InventoryHolder
where can one even see spigot releases and their changelog/commit log
Spigot may be just disable custom inventoryholder implementations, like they did with Recipes or MaterialChoices, for example
I mean, check in with new changes on the spigot sourc code repositories
Tho breaking changes like this are usually only to be expected with a new version
Breaking things like this mid version is doubtful
hi how can i set timeout to 1 second in this code?
String hostname = instance.getConfigHandler().CONNECTION_MYSQL_HOSTNAME;
int port = instance.getConfigHandler().CONNECTION_MYSQL_PORT;
String database = instance.getConfigHandler().CONNECTION_MYSQL_DATABASE;
String options = "?autoReconnect=true";
String username = instance.getConfigHandler().CONNECTION_MYSQL_USERNAME;
String password = instance.getConfigHandler().CONNECTION_MYSQL_PASSWORD;
String connectionString = "jdbc:mysql://"+hostname+":"+port+"/"+database+options+"&user="+username+"&password="+password;
Properties properties = new Properties();
properties.put("connectTimeout", "1000");
con = DriverManager.getConnection(connectionString, properties);
or like not make it to reconnect 3 times
can i use Objects#equals if i want to check if two materials are the same?
I think there is an initial timeout you can set using DriverManager#setLoginTimeoit
okay
Obviously that only works for the initial creation of the connection
I think other timeouts are specific to the statements ?
maaybe socketTimeout?
Just use ==
ok
declaration: module: java.sql, package: java.sql, interface: Statement
There is this
oh nice ill try
declaration: module: java.sql, package: java.sql, interface: Connection
This seems to be the method for you then
what do i put into the executor thing?
Idk XD
me too xd
The "Creating a GUI with the Spigot API" article on the wiki references libraries of which all I've checked implement InventoryHolder
oh nice found smthing
Just because they use it doesn't mean it's right XD
It's a common way to do it, just not supported
I mean if the Spigot Wiki acknowledges their existence and their usage, I doubt they'd just fuck all of them over
If you wanna believe that XD
Tbh with spigots healthy obsession with backwards compatibility you are probably right
yeah imagine like 1.18 releasing and all of the old stuff to just be gone
I'd imagine they'd be deprecated but who cares if I am calling deprecated functions if they work
Doesn't seem like a problem for me
Tbh plugins that are not maintained and don't update to new API standards might not be a very good choice for usage in the first place
yeah obviously
big releases like 1.10 and 1.20
Hence I wouldn't have much of an issue with things being gone lol
and if they deprecate it, I would figure they'd supply us with a new alternative option
Executors.newFixedThreadPool(1)
Ah okay
yea
It would be interested to know what executed the jdbc connections use by default
Tho I guess that differs from jdbc impl to impl
how do I combine TextComponent's
@eternal night do you know how to fix smth like this?
cuz like everytime i use my reload method it duplicates messages
Never use reload command XD
just test server with viaversion and my plugin so i dont mind
Is that your plugin ?
yes
I mean I don't know what it would send twice. Must be faulty logic somewhere in your code base then
where are you removing your listeners o.O
nowheree xd
if you have custom reload logic you might wanna do that
could maybe also explain double sending
maybe some listeners are doing funky action
Event.getHandlerList.unregister(Listener) unregisters listener right?
I think just HandlerList.unregisterAll or something
wait not all xD
that is all listeners
I lied
HandlerList.unregisterAll(myListenerInstance);
obviously means you will need to store your listener instances somewhere
or if you wanna remove all listeners registered by your plugin
there is HandlerList.unregisterAll(myPluginInstance)
oh nice that will be better
Yea just means you will have to register everything again
np
umm how can i make maven to not put some of my dependencies not in jar?
maven shade plugin should not compile dependencies marked with the provided scope
if you need further customisation, lookup the maven shade plugin excludes/includes
any1 willing to complie a plugin for me :/ just ask
you can do it yourself, we've given you solutions to all your problems
wanna go voicecall and screenshare?
lol
just to screenshare not to talk or anything
dm
lets just dm
lol
is it possible to limit markers on maps? It can be exploited to lower client's fps significantly
Is editing spigot/paper jar and using allowed?
can i just .toString to get the items name from material
@quaint mantle i mean like ACACIA_BOAT
Yes forks are allowed. Just don't distribute NMS
thanks you, but i have question
spigot copy pasted nms to their jar
but why I cant copy and paste?
You can do it in the same way as them
Fork does not equal edit.
You basically โforkโ the repository or code to your own namespace, your own version which you then can edit in any way you want without affecting the original repository or code.
I assume you ask this because of a git reference? If you search Git you can see some basic terms and what they mean.
It has to do with version control.
ah thanks you!
hmm
I have question
you said -> "affecting the original repository or code." did you mean that I can't remove original code?
like Bukkit.broadcastMessage()
or change name
example: Bukkit.broadcastMessage() -> Bukkit.hehehe()
No
I missed some context to your original message. But if your talking about โforkingโ a project. You can do whatever you want with the code after that. Itโs your own version.
Forking does not mean that you can add methods to the Bukkit class.
ahhh so I can't add / remove / change method in original class or package?
but i can create class
and package
I scrolled back a little bit. You were walking about forking bukkit? Yeah then you could add everything you like to it. Also methods.
Thatโs the theory. If you want to do that, I doubt it ๐
thanks you
how can i get the server/plugins/ folder?
okay ty
you get the parent directory of your plugin directory
both the world container and the plugin directory locations can be changed arbitrarily
okay
how do I make intellij auto-upload the artifact to sftp
I think I did find this page
the next step is to read it
I followed it and set the sftp server up, but what do I do with it
what
how do I access the UI to upload it
look at the sidebar on the left
this page is for further customization
you need to set the actual deployment up
I added the sftp, what next
ask the page
It's basically like copying someones code, so you already have a foundation to edit/create things of off
it's called a fork because it's like a fork in the road
up to this point everything has been the same
and then it goes 2 paths
one path is the way you edit you part
and the other is how the bukkit devs edit the main part
see the license for whether it's allowed or not
that too
okay
generally you are free to edit and change mostly anything for your own private use
but some licenses will prohibit you from republishing the changes or distributing the modified product
Hi
ik this may seem not releated to spigot but I'm making a plugin that have a discord bot but the JDA community is not helpful at all they just send docs links that doesn't have enough description, so please can anyone help me I'm trying to edit the channel perms
huh?
This channel is for Spigot/Bungee plugin development. If you need help on setting up your server you need the channel #help-server
it's a plugin
no this is not server
its not discord srv
what do you need help with
I'm trying to edit the channel perms
i made a semi-complete proximity chat plugin with discord
can you send the block of code where you want to do that?
channel.getManager().putPermissionOverride(<the role>,<what should I put here?>, <and what in here also?>);
yea that too
the sultions are for old version
permissionoverrides aren't what you need
What do I need?
and how do you get your channel?
event.getChannel
can I see the line of code?
TextChannel channel = event.getChannel();
ok
one sec
do you have an Ipermissionsholder?
and what did the jda discord link you to
channel.getManager().putPermissionOverride(role,allowedPermissions,deniedPermissions).queue()
Or smtng iirc
yes
but he needs a ipermissionsholder
unless a role already extends that
which it probably does
It does
but when I use Permission.WRITE_MESSAGES and Permission.VIEW_CHANNEL it shows an error
what error
just a sec
and you need a collection
Cannot resolve method 'putPermissionOverride(net.dv8tion.jda.api.entities.Role, net.dv8tion.jda.api.Permission, net.dv8tion.jda.api.Permission)'
yea
becuz you need a collection of permissions
or
one sec
do this
Permission.WRITE_MESSAGES.getRawValue()
add the rawValue bit for both of them
try it
it should work
but why would you want them to be able to write messages but not see the channel
No errors
no I just fliped it
Thank u so much
what does the error say?
and I would assume, that the reason itemstack isn't there is becuz you would need the same itemmeta and stuff
k
in the ssh config it says successfully connected but in Deployment it gets stuck on connecting, what could be happening
oo
you need at exact choice
do this
recipe.setIngredient('D', new ExactChoice(ItemHandler.AncientGem()));
try that
but it only works for shaped recipes
ok
try it
the code I put
recipe.setIngredient('D', new ExactChoice(ItemHandler.AncientGem()));
oh
yea
same thing
does it work?
ok
is there any reason Intellij times out when trying to connect to the sftp server but filezilla works fine?
what's a defauly diamond>
screenshot?
wait
wdym?
could you screenshot?
like your game
yes
i know that
but what do you mean by it's a default diamond
what is a default diamond
oh
hmmmmm
so it only works with a regular diamond?
maybe you can't have a custom one
can i get tab completer class from tab complete event?
maybe from tab complete packet event
hello, how would i add an action bar countdown to my tag plugin?
is there a possibility to change the prefix from essentials with a plugin?
no
okey
I mean maybe
But essentials has a Lang file
Why does this code:
ItemStack[] contents;
contents = inventory.getContents();
Set<Player> players = this.plugin.getSlaves(inventory.getLocation());
if (players == null) return;
if (players.size() == 0) return;
for(Player player : players) {
player.getOpenInventory().getTopInventory().setContents(contents);
player.getOpenInventory().getTopInventory().setItem(0, new ItemStack(Material.RED_STAINED_GLASS_PANE));
}
Keep causing a stack overflow error
the getSlaves is just this:
public Set<Player> getSlaves(Location location) {
return this.benchSlaves.get(location);
}
questionable method naming
lmao
show an excerpt of the stack trace
they aren't slaves in the traditional message
sure
whats the limit on paste
?paste
master and slave is a well established pair of terms in technology and software
i only need like 20 lines or so
master and slave is being sorted out everywhere from git main branch names and the linux kernel
There is quite a chunk, its talking about something being null
lemme find the caused by bit
gh never even used slave as a branch name i don't think
no mostly master in git
my log is 50,000 lines long ><
not to be confused with npe
im confused?
yeah...
modifying the crafting matrix in any way fires a pre craft event
CraftEventFactory.callPreCraftEvent
which fires your listener
have a boolean field or something in your listener that you set to true when you're handling an event
and ignore subsequent events if it's true
set it back to false once you're done handling the event
could i just add the item stack to the contents?
i just found it didn't always work
bruh stop doing that lmao
Isnโt that a clone
well no matter how you set it, it's still going to spin the event logic
Huuuuuuhhh
can anyone make me a plugin ?
no
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
me slow
beat ya to it
declare a field
then write to the field and read from the field accordingly
if (bool) return;
bool = true;
//event logic here
bool = false;
at teh beginning of your listener java if (myBool) { myBool = false; return; }
You donโt want to be setting it back to false there
you reset the bool every time its true else you skip ALL iterations of your loop after the first one.
no, you don't
if you do that, you will set it to false every time you recurse
which makes your event fire again
and you get a new stackoverflow
you only want to skip the one triggered by your code
Best to just set it back after your code
it looked like it was his setItem that fired it
The one upside of it all being sync
my plugin NEED craft bukkit, but org.bukkit died so i swapped the version to my local file, can it be possible?
i have already did this
What
TagCommand = https://paste.md-5.net/ohametixun.java
line 30: this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
is underlined in red because Description Resource Path Location Type The method scheduleSyncRepeatingTask(Plugin, Runnable, long, long) in the type BukkitScheduler is not applicable for the arguments (TagCommand, new Runnable(){}, long, long) TagCommand.java /tag/src/me/renndrew/tag line 30 Java Problem
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/Users/giakhanh/Documents/craftbukkit-1.8.8-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
Run buildtools and then depend on spigot
?bt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i have a whole project based on craftbukkit
cb is IN spigot
where do you actually define myBool?
in the class
a global field
ok
it's a field, so it's declared in the class
sorry ><
variables are declared in method bodies
mport org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
oh that makes sense
Does anyone know why it doesn't work?
Cool?
as expected of a typical 1.8 user
gl
Hypixel the server or hypixel the person
what? @eternal oxide
server
Are you sure
i wish there was a :cringe:
wrong quote. Text scrolled
Spigot sees its fair share of unregulated cloning
ahh, np!
you have to clone everything because stuff is mutable and the developer base can't be trusted not to fuck up with mutable stuff
I would love to see the result of non-cloned locations in the move event
"oops"
if (shouldntRun) return;
shouldntRun = true;
this seems to be kinda mucking other things up
is that sentence supposed to mean something
i mean, it is having an adverse affect on other pieces of code that set items
but idk what to do, cause the PrepareItemCraftEvent is the only one that reliably gets called when items change
what do you mean > i mean, it is having an adverse affect on other pieces of code that set items
one sec
put the if at the top of your code, reset to false at the bottom.
View distance doesn't make fog like render distance's fog
yes
is there way exists to make fog?
fog is clientside
spawn 2000 million smoke particles
xd
Boss bars have a setting to mess with stuff