#help-development
1 messages · Page 809 of 1
rip shark 2023
Do not touch logs tho
change log-named-deaths to false
some1 can read the help-server section
i dont want to disable it for all
just for certain sitations
looking for a way to cancel it on the entity death event or sometihg like that
will an entity.remove count as a entity death event?
[17:50:44 INFO]: Starting Javalin ...
[17:50:44 INFO]: You are running Javalin 4.6.8 (released May 4, 2023. Your Javalin version is 207 days old. Consider checking for a newer version.).
[17:50:44 ERROR]: Error occurred while enabling LiquidREST v0.1.0 (Is it up to date?)
java.lang.NoSuchMethodError: 'void org.eclipse.jetty.servlet.ServletHolder.<init>(javax.servlet.Servlet)'
at io.javalin.jetty.JettyServer.start(JettyServer.kt:57) ~[LiquidREST-0.1-all.jar:?]
at io.javalin.Javalin.start(Javalin.java:174) ~[LiquidREST-0.1-all.jar:?]
at io.javalin.Javalin.start(Javalin.java:148) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.LiquidREST.onEnable(LiquidREST.java:36) ~[LiquidREST-0.1-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:273) ~[forge:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) ~[forge:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:502) ~[forge:7e29f765-296df566-9fb885e8]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:414) ~[forge:7e29f765-296df566-9fb885e8]
at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:427) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:347) ~[?:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:227) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:768) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:267) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[17:50:44 INFO]: [LiquidREST] Disabling LiquidREST v0.1.0
[17:50:44 INFO]: Disabled LiquidREST```still
?paste please
did you make this plugin?
yes i'm trying to learn
What are you trying to make?
well show us the code that failed
Whats Javalin??
java/kotlin web framework
web framework
for Java and Kotlin
Try updating javalin
it previously triggered another error on the latest version
i'm retrying tho
trying to track an Arrow after it hits the ground, anyone know the Event for that? (if it's ArrowBodyCountChangeEvent could someone send me the method to get the data of the arrow and not the entity it hit, Thanks!)
How do i open old intellij projects? xDxD
Main Menu -> Open -> Main project folder (outside src)
Thanks mate! :-}
yup
on latest version it throws: java.lang.IncompatibleClassChangeError: class org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory can not implement org.eclipse.jetty.websocket.api.WebSocketPolicy, because it is not an interface (org.eclipse.jetty.websocket.api.WebSocketPolicy is in unnamed module of loader cpw.mod
player.sendMessage(Colorize.color("&fYou can't run this command, before" + (10000 - timeElapsed) + "seconds"));
How do i do, so this is seconds, and not milliseconds?
i asume your tracking either system time or ticks correct?
: 1000 ?
Im not sure how to check XD - Just followed a toturial.
Im trying, thanks!
milliseconds / 1000 = seconds
We'll see ;P
There are 1000 milliseconds in one second. Therefore, to convert milliseconds to seconds, you divide the number of milliseconds by 1000.
he said he used a totorial and i was just assuming there could be an error especially if it was something like a thread post
Kody Simpson 😎
like a repeating task instead of System.getTimeInMili. . .
also ima re-link my question bc im hopefull
the goat!
divide by 1000
ProjectileHitEvent
When i / 1000, its just saying 9999
THX
weird
wana send a larger snipit
or link the vid
A larger bit of my code?
yea
An easy to use Paste site for Minecraft Server logs.
Here ya go
this is so shit, no one wanna use it anyways
((10000 - timeElapsed) / 1000)
Meteoren
Brug den nye date api, mega nem og mindre hovedpine
Instant.now()
Date api is leet
Hvordan bruger jeg den aha? Skal jeg ikke have alt muligt andet sejt kode, også?
stop speaking danish im getting flashbacks
xD
THATS WHAT IT WAS
GAGHAAHAHAHAH
Så, sæt Instant i dit map og sæt Instant.now() som du bruger lige nu. Derefter kan du bare gøre Duration.between(gemtInstant, nyInstant).getSeconds()
im there in few months
Aarup
come visit me in copenhagen when im there will ya
denmark so small cant be more then 2h dive
drive
When are you here?
I am quite busy with school, so maybe?
alright xd
if im spawning an arrow entity can i just grab the var and do arrowVar.getLocation to track it through the air?
Ehh
what exactly are you trying to do
Altså, lyder klogt, bevares - Kan du komme med et kort eksempel, hvis du magter? ahaha
ive been having issues using the Plugin type to create repeating and delayed tasks bc I dont understand how the Plugin class fully works
and Its for a friend
Fik bing til at skrive noget da jeg er på mobil.
I can try to rewrite the code for you using instants and duration for the cooldown. Here is my attempt:
public class EatCommand implements CommandExecutor {
//key = uuid of the player
//Instant = the instant of when they ran the command
private final HashMap<UUID, Instant> cooldown;
public EatCommand(Plugin6 plugin6){
this.cooldown = new HashMap<>();
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
if(sender instanceof Player p){
Player player = (Player) sender;
if (!this.cooldown.containsKey(player.getUniqueId())){
this.cooldown.put(player.getUniqueId(), Instant.now());
p.setFoodLevel(20);
p.sendMessage(Colorize.color("&8[ &e&lEAT &8]"));
p.sendMessage(" ");
p.sendMessage(Colorize.color("&fHerren sørgede for din sult! &eDu blev mættet."));
}else{
// Difference in seconds
long timeElapsed = Duration.between(cooldown.get(player.getUniqueId()), Instant.now()).getSeconds();
// 10 sekunder..
if (timeElapsed > 10){
this.cooldown.put(player.getUniqueId(), Instant.now());
p.setFoodLevel(20);
p.sendMessage(Colorize.color("&8[ &e&lEAT &8]"));
p.sendMessage(" ");
p.sendMessage(Colorize.color("&fHerren sørgede for din sult! &eDu blev mættet."));
}else{
player.sendMessage(Colorize.color("&fDu kan &cikke &fbruge kommandoen, før om &e" + (10 - timeElapsed ) + "sekunder"));
}
}
}
return true;
}
}```
Du kan nok reducere det lidt endnu
oh
well repeating tasks are easy
I just dont know what the parameter does bc all the resources online are like: here you go its done now. but they dont explain why or how
chat gpt lol
What parameters
for syncRepeatingTasks
Too lazy to write it on phone.
well you pass in the plugin
Oh no
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(parent, () -> bullet.getWorld().spawnParticle(Particle.SONIC_BOOM, bullet.getLocation(), 1), 0, 1);
but how do I specify which of my 3 repeating tasks to cancel if the id's are the same due to them being the same plugin
use them as a object in your code
like as a BukkitTask?
Har massere af spørgsmål, hvis du bare vidste hvor mange jeg holdte inde. Men tester lige
Altså det var mere så du fik ideen til hvordan man brugte det.
could think of many ways rn
Nårh ja, jeg tror jeg har en nogenlunde idé nu :)
You can encapsulate each task in a class
what if the task uses data from the class that your implementing it in
ive tried that with other things but you can't pass in data throught the run() method
Med koden jeg sendte burde der ikke stå mere end 10
Korrekt, den skifter faktisk slet ikke
Udover det, virker det fint
Altså, den står kun på 10 aha
Virker mærkeligt, men forstår du brugen af instants of duration ud fra den?
Du kan prøve at genskrive det ordentligt
Velbekomme
hey
hey
how can I check if player has a permission such as "homes.limit.<number>" ? number can be anything in a range of int (above 0)
do I have to loop through their permissions?
anyone used docker desktop beore, some reason i cant download images, none of the versions work its always error code 500
Is that how I retrieve their permissions?
hmm I could check if player has a permission of (homes.limit.<current number of homes + 1>)
and then so on?
without retrieving their permissions
if you have the other permission just split it at the dots get the last entry and then use player.hasPermission
yeah, getEffectivePermissions does retrieve their permissions right?
Yes
Ok perfect
do you guys think that sparkjava may be better to embed in a plugin?
javalin is revealing as a pain in the ass
java.lang.IllegalStateException: This must be done before route mapping has begun this, what..
java.lang.IllegalStateException: This must be done before route mapping has begun
at spark.Service.throwBeforeRouteMappingException(Service.java:504) ~[LiquidREST-0.1-all.jar:?]
at spark.Service.port(Service.java:169) ~[LiquidREST-0.1-all.jar:?]
at spark.Spark.port(Spark.java:1014) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.LiquidREST.onEnable(LiquidREST.java:39) ~[LiquidREST-0.1-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:273) ~[forge:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) ~[forge:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:502) ~[forge:7e29f765-296df566-9fb885e8]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:414) ~[forge:7e29f765-296df566-9fb885e8]
at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:427) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:347) ~[?:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:227) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:768) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:267) ~[?:?]
at java.lang.Thread.run(Thread.java:829) ~[?:?]```
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClassLoader());
init();
port(restPort);
Thread.currentThread().setContextClassLoader(classLoader);
get("/econ/balance/:name", (request, response) -> {
User user = getUserClass(request.params(":name"));
BigDecimal balance = getMoneyExact(user);
DecimalFormat numberFormat = new DecimalFormat("#.00");
return numberFormat.format(balance);
}
);```port is done before routing
That's not Javalin?
yes that's sparkjava
Load the chunk the entity is in first
that's all?
Probably?
after chunk load: ```[ERROR] .... Error occurred while enabling spawn v1 (Is it up to date?)
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Unknown Source) ~[?:?]
at pl.playgroundhc.spawn.Spawn.onEnable(Spawn.java:59) ~[spawn-1.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-399]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-399]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-399]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Paper-399]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Paper-399]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733) ~[patched_1.17.1.jar:git-Paper-399]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:317) ~[patched_1.17.1.jar:git-Paper-399]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-399]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-399]
at java.lang.Thread.run(Unknown Source) ~[?:?]```
[19:21:34 WARN]: at spark.embeddedserver.EmbeddedServers.initialize(EmbeddedServers.java:41)
[19:21:34 WARN]: at spark.Service.lambda$init$2(Service.java:618)
[19:21:34 WARN]: at java.base/java.lang.Thread.run(Thread.java:829)
[19:21:34 WARN]: Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
[19:21:34 WARN]: at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:178)
[19:21:34 WARN]: at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:133)
[19:21:34 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
[19:21:34 WARN]: ... 3 more```
i managed to get it running, it starts but still throws an error
Well try to figure out why that error occurs
ok
is there a way for me to re-enable a canceled task
Just schedule a new task
BlockBreakEvent
isn't that just for players?
yeah idk how else a block would break outside of explosions
which is like ExplodeSomethingSomethingEvent
one second
water
?jd-s
@grim hound lucky for you there are a trillion block events
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockEvent.html
declaration: package: org.bukkit.event.block, class: BlockEvent
you can't track setType though
I mean you can you'll just need to mixin or patch the server
I assigned the task to an object and call it with task.runTimedTask(plugin, 0L, 1L);
the task runs and cancels correctly 1 time
then you cannot re-run it
Correct
canceled with task.cancel();
Make a new one
oh
is there a way to make a new one every time
the task object is assigned to a new BukkitRunnable() {};
it should create a new one instance every time it's called should it not?
In many situations, you can prevent constantly cancelling and restarting tasks.
What are those tasks for and why do you re-enable them?
im fireing an arrow and using the repeating task to spawn particles on it till it hits the ground where the task is canceled and players in a radius are hit with effects
Please dont capslock. Its considered rude.
And this channel is for development related questions. Pls move it to #help-server
Then create a single task when the server starts, let it always run. This task has access to a collection of projectiles.
Simply add the projectiles to this collection and let the runnable go over it when ticking.
7smile theres stuff in general
would i make a listener for projectiles spawning in order to add them to the collection which is allways running?
Yes, one runnable that is always running.
You then add projectiles to it.
*Dont forget to remove them, or at least check isValid() on them
ok
thanks
one more thing
should i store the data with a hashmap or an arrayList in your opinion
Which data?
the arrow data bc I have different arrows that do different things
I would use an abstract class which defines the custom behavior and a LinkedList for my runnable.
Want a short example?
yes
lmao
i am very confused by that XD
also im handling the arrow initialization in a separate class
from onEnable
public abstract class CustomProjectile {
private final Projectile projectile;
public CustomProjectile(Projectile projectile) {
this.projectile = projectile;
}
public boolean isAlive() {
return this.projectile.isValid();
}
public abstract void onTick();
}
public class CustomProjectileRunnable implements Runnable {
private final LinkedList<CustomProjectile> projectiles = new LinkedList<>();
public void addProjectile(CustomProjectile projectile) {
this.projectiles.add(projectile);
}
@Override
public void run() {
this.projectiles.removeIf(this::tickAndCheck);
}
private boolean tickAndCheck(CustomProjectile projectile) {
projectile.onTick();
return !projectile.isAlive();
}
}
This might me a bit much for less experienced devs
im using the Arrow type, is the Projectile type handeled differently?
Arrow extends Projectile, so you can use this code 1:1 for arrows, snowballs and any other projectile
This example however lacks custom impact handling.
You still need a manager class which Maps your projectiles to your CustomProjectile instances.
oh
Because they depend on each other
but I click
to make it add it
anyway
so what's the problem?
I click OK
it ain't working
The problem is that those dependencies depend on each other. Dont just click ok. Resolve the problem.
there is
absoulutely no problem
also I can't change that since it's made by others
Intellij tells us otherwise
You cant add circular dependencies. How do you expect the project to compile. Be glad you have intellij.
Compiling by hand might result in a compiler bomb, trashing your entire RAM
it worked before
but I had to get the repository from github and have it synchronized
Then restore the original setup where it worked
and now it's not working anymore
I can't
it's in another project
which isn't github synced
and is just a copy of the project
instead of a synced github rep
so how do I add a projectile to the CustomProjectile list inside the Runnable?
Implement
the Runnable class
it's an interface
and it's one of the core java mechanics
im refering to this
i know that it is but i have never used them
Take a look at this. Its a minimal setup example.
https://paste.md-5.net/ekakuwoqor.java
Try to play around and understand the purpose of every class.
Start with basic html, then some css, and embed basic js.
Afterwards you can choose a framework like Vue or React and suffer until the next framework comes out. (This happens every few weeks it seems)
There are plenty of websites that teach you web dev out there
*And dont use Angular as your first framework pls
im more interested in backend
i don't need to be extraordinary at frontend, basic skills are ok
If you think so...
The simplest way to serve a website is either Flask or Django in python (literally just 10 lines)
Or to use Spring (Preferably bootstrapped aka SpringBoot) in java.
Latter will confuse you a ton because it heavily relies on meta programming and cdi.
Other nice frameworks for java are: Quarkus and Micronaut.
i alr know java
so id rather that
Check out Javalin
Yeah Javelin might be nicer if you havent done any enterprise java before
ugh
JS runs in your browser, so the frontend.
Node simply lets you run javascript in the backend, thats all.
You can go full stack with only javascript this way.
hi , uhh ihave a question :-: so i did remake my project , and now its using modules , but some methods and tasks require JavaPlugin which is the main class that run , but i don't have it in core , i have in game module and lobby module
so some methods in core require a JavaPlugin to work
for example in core :
i was thinking about making a loader class :
its in the api moudle *
and i thought maybe i can do it in the Game class ?
dk if that is correct , anyone have a good idea?
How can i check if a clicked item is in the players inventory or in an open inventory? e.g. chest, etc
getClickedInventory or smth like that
Check if getClickedInventory == view.getBottomInventory
yeah ive tried checking if event.getClickedInventory().equals(player.getInventory) but still nothing
ah thanks
i think its because the variable is final and is not initialized
can't say smth for sure with the provided code tho
if you have a constructor then its probably something else
How can i get the title of the top inventory?
ah ok, thanks
does anyone know how the fuck i ignore some files in git that have been accidentally committed in the past
nah iam not talking about that
nvm i figured it out
thanks anyway
im gonna start tweakin soon
i think if u delete in that git menu it doesnt delete from your end but it does on git end
dont quote me on that tho
did that once and it worked iirc
bet
tell me if it works cause i actually dont 100% remember
i deleted it with right click delete and its still there lmao
the files still there right
so gitignore it now
and i think it should remove it in next push iirc
yeah its still there but i gitignored it and its still in the commit list
Yknow
That .
Is actually there
oh my lord
now its just gray
Xpdz wilding
yeah i think thats right? i forgot exactly
Gray is good
i think?
💀
ya that seems to have done it ty
trying to remove files from the git repo?
i just wanted to remove them from the commit i didnt care if they were already on the repo
i just wanted them to fuck off from my screen ong 😭 🙏
you can exclude files on commit, gitignore is also an option if you want it permanent
that should accomplish both
yeah it did work thank u
yippie no dementia yet
sike
fuck
hmmm....yet....
so that means eventually you will have it?
How do people make their plugin work on a large version fork? Like 1.8.9-1.19.2 ?
I am making a plugin rn and would like it to be functionning on 1.8.9-1.16.5
If you dont use nms then starting with the lowest possible version should work most of the time.
There is a great barrier between 1.13+ and below, often requiring workarounds like the X-Series.
But keep in mind that you will loose a ton of API from later versions and that there is a high
chance of eventual deprecation conflicts.
ok so 1.8.9-1.12.2 should be easy?
quick one, can EntityDamageByEntity detect if an arrow was hit
i.e. would the event even fire if I hit an arrow with my fist for example
Try and see!
got a bit of a potato pc so wanted to check beforehand but thanks anyway
hey what's the max. chest inventory size again? 54?
Yes. Or 1.13 upwards (which covers >90% of servers 🙂 )
It fires. Keep in mind that there is the ProjectileHitEvent as well.
Might make two versions then because what I want to do is like 2 classes total
yeah I need it to fire when a player actually punches an arrow so that's why I needed it
If you dont use sounds, materials etc, then you can just use 1.8 and probably have compatability up to latest.
to simulate a sort of deflection system
Wait i read that wrong. I thought you meant an arrow hitting something.
I cant imagine that you will be able to hit an arrow with your hand.
This would lead to a horrible melee experience when you are being fired at.
good point...
I need someone else to test it with though cause my pc is dying as it is
So I'll wait until a friend logs on and then report my findings
Skeleton or hoppers exist.
Or you can write 5 lines of code and fire an arrow at yourself from the front when you right click
if it doesn't work I can always just raycast and see if the result is an arrow ig
that should be close enough in most scenarios
Yep that would be my first idea as well
how do we add custom (and persistent) item data again?
I have this:
ItemStack itemStack = player.getItemInHand();
I want to add a custom tag to the item
?pdc
i'm in 1.8.8 :/
You'll need nms then
is there no super reaction anymore ?
you only get a few per month with nitro or need to pay for extra
Also uhm doesn't look like I have NMS installed
maybe is not the right server but this is getting me dumb sh [22:57:52 INFO]: [LiquidREST] Enabling LiquidREST v0.1.0 [22:57:52 INFO]: Enabled LiquidREST [22:57:52 WARN]: 2023-11-27 22:57:52.887:INFO::Thread-97: Logging initialized @208903ms to org.eclipse.jetty.util.log.StdErrLog [22:57:52 WARN]: Exception in thread "Thread-97" java.lang.NoSuchMethodError: 'javax.servlet.SessionCookieConfig spark.embeddedserver.jetty.JettyHandler.getSessionCookieConfig()' [22:57:52 WARN]: at spark.embeddedserver.jetty.EmbeddedJettyFactory.create(EmbeddedJettyFactory.java:52) [22:57:52 WARN]: at spark.embeddedserver.EmbeddedServers.create(EmbeddedServers.java:80) [22:57:52 WARN]: at spark.Service.lambda$init$2(Service.java:624) [22:57:52 WARN]: at java.base/java.lang.Thread.run(Thread.java:829)
build.gradle -> https://paste.md-5.net/yicesapami.bash
lmfao net.*
import net.*;
How can I make this thread safe:
I have a database that stores Polls. You can retrieve and save a Poll object.
Scenario: Two users vote at the same time on different threads. Both threads get the Poll from the database, and increment the poll by one vote. Then they both save the poll back to the database.
once a poll is saved it may only increment by one, even though two users voted due to thread safety
I was recommended to have a method like
PollManager#upvotePoll(String pollID);
but what should I do if I have a different object with a bunch of fields to change
is there any sane util to copy a resource folder and not a single file
and also
this shi doesnt seem like a folder to me ngl
what about files
or do i need to do the funny ZipInputStream
idk if that matters tho
both threads:
get the Poll (assume 5 votes)
both threads read 5 votes, and increment it to 6 votes
both threads save the poll at 6 votes instead of it being 7 votes
pls
2 people asked this and all got ignored sheesh
tf u trying to do
i think it is too
here is my pom.xml file if someone knows how to fix it to include nms:
https://paste.md-5.net/ihalabixif.xml
?nms
no one knows?
is there a way to set the info for an Arrow before spawning it?
anyone know how to do this?
use World#spawn(Location, Class<? extends Entity>, Consumer<? super Entity>)
in the consumer set the info that you need before it spawns
cool
isn't it T extends Entity
Class<T> Consumer<T>
Yes, but same idea lol
Spawn a virtual arrow, edit that, and then add it to world
I realized half way through but couldn't be fucked
anyone?
is there a way i can have 2 folders opened on vscode? Local and SSH?
I would just do YamlConfiguration.loadConfiguration(file)
sounds like bungee
Ah
prob ij fucking imports for the 19th time
what abt that
byond me
show your imports
you need to code more
also tht
Do you have the bungee api as a dependency
Ah
Then this applies
what abt that
how do i save in spigot
FileConfiguration#save
thats not a thing
I assure you it is
what is a virtual entity and how do they work, how do I spawn an arrow without adding it to a loaded world
Notice the #, it’s not a static method
World.createEntity
you have to provide the File object
it says you need a location parameter to do the createEntity method
Yes
The location doesn’t really matter, but I would make sure it’s in a loaded chunk
like that?
If you want to keep it around for a long time, I would advise converting it to a template after you make your changes
the template is what I need
Yes, but if you are using teh default config it has built in file handlers
Then yeah, create a virtual entity, edit it, and covert it to a template
Plugin#getConfig()
what is the template under in the documentation
imma just do that
do i need to do that or can i do it in the file?
ok
Then just do saveDefaultConfig in your onEnable
bruh neither EntityDamageByEntity nor PlayerInteractAtEntity fires
so raycasting ig
does anyone know if links will parse automatically?
fixed my issue from changing this:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
to this:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
removing the "api"
Respawn anchors only work in the nether, right?
right
should try it in the overworld
I think... It is possible that there is a bug within my program
speak for yourself
hey
do you want more than 1 @river oracle's
how do you hide itemstack attributes again? with attribute modifiers? I don't know 1.20.2 stuff since a lot has changed
attributes such as enchantments, etc..
think of all those prs paper would have to fix
nvm its ItemFlag 🫡
I'm the best
we don't need any more
Guys I need a hand how can I add multiple lines of text to an armorstand? because it doesn't work if I go over putting
armorstand#setcustomname(text + "\n" + newLine);
The entity practically doesn't spawn at all, but it doesn't give errors
You have to do more armor stands
Or use display entities
think of all the prs paper would have to fix if there was 10 of you
Ok thanks
anyone got ideas
atleast 2
Is this on two different servers?
[ERROR] Failed to execute goal on project core: Could not resolve dependencies for project org.skywars:core🫙1.0-SNAPSHOT: org.skywars:api🫙1.0-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
[ERROR]
how i can fix this ? :-:
:0
hey how do you retrieve a friendly material name?
eg. for Material.GRASS_BLOCK,
retrieve Grass Block, and so on
Is there a function that already does that or do I have to manually replace "_" and so on
how could I go about making ghast fireballs break cobblestone, this is what I have so far
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Fireball) {
for (Block block : event.blockList()) {
Material blockMaterial = block.getType();
if (blockMaterial == Material.COBBLESTONE | |
blockMaterial == Material.DEEPSLATE | |
blockMaterial == Material.STONE ||
blockMaterial == Material.COBBLED_DEEPSLATE) {
block.breakNaturally();
}
}
}
}
no
How would it be voted on from 2 different threads
even if its different server, im sure mysql will handle that just right
dont worry
how
because there is lock mechanism, as i already said
both threads:
get the Poll (assume 5 votes)
both threads read 5 votes, and increment it to 6 votes
both threads save the poll at 6 votes instead of it being 7 votes
well id say you just add a queue
Is it possible to hide NoEffect on potion in GUI
I tried ItemFlag.HIDE_POTION_EFFECTS
but it is not working
wdym
the only possible way rn I can think of is a method with like
Manager#upvotePoll
and a single thread executor
you add a method which adds it to a queue then you just run it as quick as you can
there is really no need for that
who you talking to
how ur managing to get multi threaded stuff for this one 1 server is the thing you should probably fix first
You could just
if this were to be the scenario, then how would you approach it
Keep the poll in memory with an atomic int
yeah but then
ima have to deal with like
player stats
or should i keep them in memory too
https://stackoverflow.com/questions/3802370/java-time-based-map-cache-with-expiring-keys
would you recommend something like this
What exactly are you trying to do
edit values from a database
and make sure it is thread safe
like multiple threads can edit values from one database
how easy would it be to parse this plugin to other versions?
https://github.com/xef5000/ItemKeeper
Not hard just make a core module a 1.8 to 1.13 modules then a module for 1.14 and higher using pdc
lmao what
its one single jar
search up a ytbe tutorial on how to make a plugin for multiple versions
but in the maven, what version of spigot do I import?
unless you use NMS you don't need to worry about it
then just use NBT API
NBT API is pretty much uneeded in newer versions though
why
PDC pretty much invalidates it
I mean when you do use NBT you should just put it to where PDC goes with modern versions
which is pretty easy to do since Bukkit Source is public
we forking folia :(
pretty sure it's per-version
but then how would I use PDC for newer versions?
use NBT API
not NMS
you can look at CraftBukkits code and see where they put PDC
?pdc
Hey ik this is a dumb question thats probably been asked millions of times by where do I get the version of spoigot for my Pom.xml file
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Ik that but I have to but in the version manually
<version>1.8.8-R0.1-SNAPSHOT</version>
this one is for 1.8.8
Ill go until i find 1.9.4 thanks
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Go in "History" and find the right post
Alrighty will do!
Ok how do I replace a external library on maven-
I want to change my 1.20.2 plugin into a 1.19.4 plguin (Note this is a very basic plugin that just makes a command run nothing complicated or different)
would it be easier to change the external libraries to downport it or just copy and paste all the new files and code?
just do mvn install and upload the new one to your local maven repo
Ah I sohuld ahve been more specific the external library is spoigot-api1.20.2 I just want to replace it to be spoigot 1.19.4
Not replaceing a entire maven thing
IntelliJ wont let me delete and add the external libraries for some reason
with eclipse ide I could just cpoy and paste libraries but for intelliJ it doeesnt seem so
nv I figured it out thanks!
nw i got u 😄
OK i did a bootleg version of just copying everythign and pasting it with the new libraries XD
in thet main class that I had
If you guys have any idea of maybe how to do that better then tell me id love new ideas
api works really great for 1.8 and neighbour versions.
However, in 1.20.2, for example, the netherite sword is added. And I get this error: https://paste.md-5.net/olemebupaj.bash
Early logs I get this: https://paste.md-5.net/vifuleloyo.coffeescript
error is pretty self explanatory
ItemStack can't be null/air/amount of 0
the item is air or null
or the amount is 0
does it error on a diamond sword?
works on any other item from 1.8.9
didn't in 1.8
can try in 1.20
also this in logs early on:
[22:08:52] [Server thread/WARN]: Legacy plugin ItemKeeper v1.0 does not specify an api-version.```
yeah thats fine if your plugin is on legacy API
what versions are you trying to support
1.8-1.20
do you use 1.8 yourself?
works fine on other swords
yes
rough thne
also I gtg off my pc so is there anything else I should test rn?
still break with netherite?
must be something with the material conversion though it should work
so I'm not sure why
same error: ItemStack can't be null/air/amount of 0! This is not a NBTAPI bug!
ill investigate more tommorrow
what are you using to get the new ItemStacks
creative tab
public final class GlidePlugin extends JavaPlugin implements Listener {
public ArrayList<Player> players;
@Override
public void onEnable() {
players = new ArrayList<>();
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onJumpTwice(PlayerToggleFlightEvent event) {
System.out.println(players);
Player player = event.getPlayer();
if(players.contains(player)) {
player.setGliding(false);
player.setAllowFlight(false);
players.remove(player);
return;
}
player.setGliding(true);
player.setAllowFlight(true);
players.add(player);
}
@EventHandler
public void onGlideCancel(EntityToggleGlideEvent event) {
if(players.contains((Player) event.getEntity())) event.setCancelled(true);
}
}
events not getting called
is the if condition being met
well it should print the players arrray atleast
is your plugin being enabled?
indeed
are you actually Triggering the event
I cannot update/place BlockStates from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Palette.html#getBlocks() , in a World
The issue is that these BlockStates location's World is null while x,y,z are an offset from the placing location.
Is there an API approach?
declaration: package: org.bukkit.structure, interface: Palette
@NotNull Location location parameter is placing location
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Structure.html#place(org.bukkit.Location,boolean,org.bukkit.block.structure.StructureRotation,org.bukkit.block.structure.Mirror,int,float,java.util.Random)
declaration: package: org.bukkit.structure, interface: Structure
i am indeed trying to toggle flight by jumping twice however i am in survival
ahh
the event is only triggered when you are in creative
how would i detect it in survival then?
ig you could try checking on player move event, and then when he jumps you save the system time and the next time he just u do oldsystime - newsystime, and if it's over a second, you set him as flying
ahh
how do i make a player be able to glide and shit without a elytra (i dont want players to see elytra dats it)
Pretty sure you can make it so other players cant see the elytra
But initiating the gliding is clientside and requires the player to have it in their inventory
i can call setGliding that makes them glide ive tested
but dunno how to make it invisible
since i also want them to be ale to wear chestplates
does bukkit not have a harp instrument
any reasons why the plug-in is working fine without errors o. local machine and on vps host it throws an error
happened with every package i used
VPS probably has
- a different spigot version
- different java version
- other plugins than your local machine
Send the exception
i pasted the server folder and java version was the same
but maybe is some other plugins, i’ll test
@lost matrix this
Your relocations are doing nothing
doesn’t look like a good thing
so the relocations are useless
Because you are not using them correctly 🙂
You cant relocate a dependency, only a package.
There is also no need to relocate everything.
i tried to relocate everything to see if changes something. what should i relocate then?
If you shade a dependency, and someone else has the same dependency but with a different version, then you should relocate.
You have a bunch of relocations which arent even dependencies of your project. That wont work either.
"implementation" dependencies will get shaded into your jar.
You can find the package of them and relocate their path to another.
This way the classloader doesnt have the same path+class when two plugins load with
the same dependencies.
What would be the best way to implement a factions health block?
Basically it'll function like a bedwars bed but for a faction, and each hit from an enemg will deduct its health
Would you need to store this in chunk data itself to check when the egg was hit and which faction it belongs to
I can't wrap my head around it
There are multiple ways of handling this. Does 'hit' mean when someone breaks the block?
Is this a minigame or are factions always loaded?
@short pilot ?
i can handle that, how would i make it so players cant see elytra
Wtf
You can modify the packet or send a new one to update their equipment from other players.
well wouldnt that make their chestplates gone??
They wouldn’t have one if they have an elytra
exactly
i wanna make em glyde
without an elytra
it works without elytra i know for sure
I did it today, but the event that initiates it only gets called when in creative (EntityToggleFlightEvent)
Just allow the player to fly in survival
@EventHandler
public void onJumpTwice(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
player.setFlying(false);
player.setGliding(true);
players.add(player);
}
@EventHandler
public void onPlayerTrySneak(PlayerToggleSneakEvent event) {
Player player = event.getPlayer();
if(players.contains(player)) {
player.setGliding(false);
players.remove(player);
}
}
@EventHandler
public void onGlideCancel(EntityToggleGlideEvent event) {
if(players.contains((Player) event.getEntity())) event.setCancelled(true);
}
bro what if i want them to glide?
use UUIDs
oh yea i forgot
mb
setAllowFlight on join
Then they will trigger the event when they try to fly
Can someone tell me how to work with placeholders?
like PAPI placeholders?
Yeah
damnnnn ty man
Atleast i think it’ll work
oh no i left programming for good i just came back after like 6-7 months
Tried looking at their documentation?
ah k
ur pfp and name r similar so i was js askin
yea
damn it works nice, except at first when trying to initiate the glide the player starts flying.
is Spring useful to learn?
by flying i mean like creative double space
depends on what u are aiming for
might want to delay the setFlying false one tick then
Thank you
money
indeed then
I mean anything can be useful.
I would instead look at what positions you can get and what their requirements are.
Then start learning things they need
I'm not necessarily looking to get a position
I just want to be good enough for most
Get a CS degree then
Not really an option for me
Hello there
iam getting an error while connecting to jedis : the information are correct , i checked the ubuntu server i have its the same information
Error while validating pooled Jedis object.
me.dev.mskywars.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
i tried to login to jedis server and i put the password it correct , but the plugin can't seems to be able to connect
Im still struggling on this if anyone can help
not relevant to your question but please dont put any auth stuff into source code - put it in a config setup separately!
ik , just testing it!
yeah i did saw that , but it didn't work
well what’s your thread situation like?
same as we did yestrday?
i didn't change the code
If I want my plugin to work from 1.8 to 1.20, what should I change?
The main thing is:
-> I want to use PDC when possible
-> I want to make sure newer blocks and items are taken into account and won't crash anything.
- How should my pom.xml look like? Should it use spigot 1.8 or 1.20 api?
- If I use 1.8, how can I make sure newer blocks/items/materials will work?
- How do I make a switch in the code to detect above and below 1.14 to use pdc or not?
You could use Xseries library
If you want to support that low use 1.13 as API version
Yep, I use this
private fun ensureVersion(minimum: Int, block: () -> Unit) {
val numericalVersion = Bukkit.getBukkitVersion() // e.g. 1.19.3-R0.1-SNAPSHOT or 1.19-R0.1-SNAPSHOT
.split(".")[1] // e.g. ["1", "19", "3-R0.1-SNAPSHOT"] -> "19" or ["1", "19-R0", "1-SNAPSHOT"] -> "19-R0"
.split("-")[0] // e.g. ["19"] -> "19" or ["19", "R0"] -> "19"
.toInt() // e.g. "19" -> 19
if (numericalVersion < minimum) {
block.invoke()
}
}
Very very handy
if I'm needing a version I usejava public static final String BUKKIT_VERSION = Bukkit.getServer().getBukkitVersion().substring(0, Bukkit.getServer().getBukkitVersion().indexOf('-'));Else I just check the method exists before using it.
But PDC is only introduced in 1.14 no?
Ok as long as I can store booleans thats fine
You'd have to use byte
The boolean type is new
Also the early 1.13 PDC is not compatible with the new PDC
can i change entity's facing with vector3?
Maybe I should simply store it in nbt...
you say to me?
inventory.getViewers().forEach(HumanEntity::closeInventory); This seems to throw a CME, I really don't know how I would close the inventory for every viewer otherwise, can anyone give me a hand
Clone the collection
Also if you are doing this in an inventory even make sure to delay 1 tick
Alright thanks coll :D
new ArrayList<>(inventory.getViewers()).forEach(HumanEntity::closeInventory); bop
or I could use an iterator?
uhh how could I do this?
@EventHandler(priority = EventPriority.HIGHEST)
it is what u call an Annotation
Actually wait I just realised my event requires the lowest priority. Because my issue is that it thinks that the event isnt cancelled from another plugin
I assume its EventPriority.LOWEST then?
Lowest is called first, highest* is called last
what would I make the "priority"
oh
ok thanks
hmm
io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT/maven-metadata.xml failed to transfer from https://oss.sonatype.org/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of sonatype has elapsed or updates are forced. Original error: Could not transfer metadata io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT/maven-metadata.xml from/to sonatype (https://oss.sonatype.org/content/groups/public/): status code: 502, reason phrase: Bad Gateway (502)```
paper
?
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
Ok
It is enough to have it above the method. Cannot be called within the method.
I am, going to, use Thread.sleep() for a 10 second delay in my code. Surely it cant be that bad?? 😏
On the main thread it will
Am i tripping or spigot does not have BossBar packet? (1.17)
on the main thread indeed
why'd you use packets for boss bars
i shall increase the delay
Because i'd like to do something that's much more harder to acomplish using default API
And i would prefer to do it on my own
the bossbar api is pretty complete
I just want to check if the player has a tag named Flyer, should i just Player#getScoreboardTags and then #toString and then check if they have a flyer enrty?
man i m doing it for someone else and they have another plugin give them the tag
so yea
rip
requires a named entry thing
Then yeah just use contains
Let's imagine you have 600 players on the server and for every one of them you need to create specific bossbar with only one player because you want to send some personal info. So you need 600 BossBar objects in list, iterate through this list every time someone leaves the server and iterate it all every time you want to update it for one player or everyone
? what version
Seems like a good way to handle it
1.20.2
In latest getScoreboardTags is a Set<String>
oh
or use the right data structure
i.e. a map
Yay maps
Col1234567 you are a legend
ACTIVATE HASHMAP-UH
my b ad
It might be map but still you are 24/7 holding 600 objects where you can do that in much more efficient way
Like?
do you know how much memory that is
What are you going to hold instead?
no yeah it is definitely far far less than a MB lol
🤓
You can just do File IOs instead of storing objects 👀
Not a list
a set*
a map*
Why a map
i mean if you're doing one bar per player a map player -> bar is ideal
Ah, he wants to store a bossbar for each player
private final UUID id;
public Component name;
protected float progress;
public BossEvent.BossBarColor color;
public BossEvent.BossBarOverlay overlay;
protected boolean darkenScreen;
protected boolean playBossMusic;
protected boolean createWorldFog;
private final Set<ServerPlayer> players = Sets.newHashSet();
private final Set<ServerPlayer> unmodifiablePlayers = Collections.unmodifiableSet(this.players);
public boolean visible = true;
That's all it holds
not much at all
the component is the worst one probably if you're doing rainbows n shit
Great for you so is there a BossBar packet in spigot or not?
but even then you need several thousands for it to be impactful
Why do you want packets
just use the api lol
Bukkit*
Bukkit also does not have packets
Emily, is there a get a million dollars packet in paper?
there is!
OMG
it doesn't affect the server tho
Oh, that's sad.
Everything in the API is api
Some of it is basically just sending a packet, but that's an implementation detail
I am eating white chocolate popcorn, amercians are weird.
Never thought popcorn had flavours
wtf
quite tasty tbh
I just noticed Jan is purple
does Player#setFlying remove their ability to get fall damage?
yes
Well how would you counter that
you want flying players to take fall damage?
could anyone please help me with that i can't import javaplugin? plugin version 1.20.1, using eclipse workspace, project Java 17 version, spigot 1.20.1 build path imported
Skill issue.
Tried using maven or gradle? They make it much easier and it's nice to start up with using a build tool straight from the getgo
what is maven?
Look it up, most spigot guides actually use it.
eclipse EE
So since a player in creative, is able to BOTH FLY & GLIDE depending on the context, how would someone track if they want to glide or fly
when they want to fly they quicly press jump twice, when they want to go elytra mode, they either have a small delay between 2 jump presses or press jump when falling once
There is events for toggling both
ah'
damn
but the Glide Event is only called when player has an elytra, how could i make it trigger when they dont have an elytra
is there some way i can make it serverside that player has an elytra but not send it to any client
I believe the client needs to have it in order for the event to fire
Uh, what is the correct way to have a multi-java-version gradle setup (for MRJs) without causing gradle to use a ridiculous amount of resources?
any other way to detect a jump mid fall?
i.e. it took 21 minutes to SIGKILL the gradle process. Like, that isn't supposed to happen
I really ought to write my own build tool from scratch one of these days
milfs mihds: man i hate gradle sometimes
Maven unfortunately is not an option (the architecture simply doesn't give it away for my usecase), and other build tools likely have to be forked and a lot of investment has to be put into them to make them viable.
iirc the client won’t send another jump packet if they’re mid air
how do these double jump plugins work then
you can check the players velocity
You don't based on ur current usage
see, heres what i m trying to achieve
the player, (survival mode) has the ability to both fly like creative, and glide like an elytra
but i dont want them to see the elytras
Is this a hub server?
You could have an item that toggle between gliding and flying
looks like the way people make a double jump plugin is by activating flight, coild you use this in your elytra setup? https://www.spigotmc.org/threads/most-efficient-way-of-making-a-double-jump-plugin.204269/
He is already using the flight event
Sadly he wants to do both gliding and flying.
Which is kinda 👀
@ashen quest I suppose you can check locations and if they're falling set them to gliding instead of using the toggle flight event
why not have an item to toggle between the two? or like a double shift mode
so many ways to restructure this
i woul want to make it so they only do it when they want to, not when they fall
Could make a custom item that takes some interesting stuff
indeed
let me ask the client
if it was my own plugin id have deleted it by now
Unless they want a modded client with a toggle.
they could just hide the elytra in the inventory as an invisible item 🙂
Not for the player though
texture packs?
client would need to initiate the gliding and it doesn't do that unless it has an elytra.
how
you can have invisible items in inventories o.O
The client as i said again
needs to know it has an elytra
to initiate the gliding.
also he wants breastplates
i think he said earlier?
in that case, just use a custom texture for the elytra
Do they choose flight with a command?
but texture pack isnt possible for me in this case
would be slow in a minigame fight thing
should be an item then
your texture would be quite small, literally a single image XD
u cant be typing /flymode set glide while someones coming at you 50kmph with a mystirous wing in a block game (BOOM)
ill ask the client if they are fine with an item
I can
do you forget gaming keyboards exist where you can setup macros and gaming mouses that do the same?
Could add some extra difficulty
and be quite fun when used correctly
frostalf, you are the wizard of minecraft as i try to explain in the shortest of words, not everyone is capable of achieving the level of pro-ness you have your majesty
indeed
its not that I am pro lmao, its just I have a gaming keyboard and mouse that lets me setup stuff that is real handy in games