#help-development
1 messages ยท Page 1538 of 1
how can I export the maven project? I'm following a tutorial but I dont have the options he does
can someone help me ?
helping is forbidden
You don;t export when using Maven
Right hand side window marked Maven, lifecycles
The jars will be produced in the target folder
Bump! (Of course, I don't want to use any api that includes worldedit, fawe)
mvn install
Will need to have maven jar plugin
I mean there aren't rules against addons for free plugins as far as I know
- mvn clean install, omitting clean produces jars in a manner that may not be wanted
should i make my new plugen premium
Yep, there aren't any as far as I know too
Yep this, i mean i always delete my target files so yea
neither premium I think ? aren't they all under the license: "feel free to use it and do what ever you want, but it's not my problem if something goes wrong?"
Is there even a license that holds creator accountable for anything going wrong
Yes, I think I've seen 1 or 2, but they're for very specific jobs
Outside of that scope, nope
The WTFPL is one of them
Right
hi, I need to know how to get all item id (not in upper case) because Material.getId() is deprecated
What should the return type be?
int or String?
If String it is toString or name, if int it is reflection ahoy
I think string hence the bracket
do you want to get all material values or do you want to parse a string as a material
To string works???
or name
II just need the minecraft:stone in str
is someone using updater to update their plugin? i cant find the artifact
Yeah, then you do not search for the int id
But he is asking how then haha
Remind me to never try to auto-complete the material class
there is a reason that it's deprecated
.getId WILL always throw an exception on 1.13+
Id's aren't used anymore, They use the enum values now
public int getId() {
org.apache.commons.lang.Validate.isTrue(this.legacy, "Cannot get ID of Modern Material");
return this.id;
}
Not exactly true, the ids are still defined, though I have absolutely no idea to why
I do not even know what these IDs are
how can i know if the player press a key in spigot
But to get back on track, use Keyed#getKey() for your stuff
impossible
compatibility I guess ?
nah
Not possible, only if you create your own client
Materials like Tuff have their IDs defined
W A S D and such I guess ?
yeah
Cobbled deepslate for example has an id of 8021, Tuff an id of 24364 and dripstone block an id of 26227. It makes no real sense to define the IDs if there are not used anywhere
for some reason it cant find updater
so?
Material.AIR.getKey().toString()
oh thx
Im using maven, after building my maven project, the target folder doesnt appear in my project files
How can I make it appear?
package it
I just drag and dropped the jar from some other target folder to my plugins folder
and then when i started the server i got an error
say abrakadabra or alakazam
which is?
Try to clean, some times it works no clue why
how did you get there
inb4 not imported as a maven project
are you using intellij?
yes
y
how can i know if the projictile hit a player or a block ?
you don't build
you run maven goals
by doubleclicking the goals in the lifecycle menu
namely package
which shits out the jar to /target
wait for build success
omg light mode
not light mode
kinda
no target folder still, it gives me a few warnings when building, idk if that is important but here:
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven ---
[INFO] No tests to run.
Nietzsche was right
dark theme just makes me depressed
he saw this coming
I'm also using light theme tbf
I like dark, but not all the time
๐
the error was from other plugin
jetbrains fun here ๐
thanks
๐คฃ
depression is f u n /s
i know one
There's a black theme on eclipse ^^
yeah but the light eclipse theme is the best theme
watching hackers on television is like if you were a doctor and saw someone try to take blood pressure with a potato
On the marketplace, you can download others themes if you want to ^^
So you can choose a better one
im using intellij
Same
๐
Vim is my text editor of choice, but not when it comes to programming
nano is mine
So i'm using 1.12 and used this code;
BlockState blockState = block.getState();
Door door = (Door) blockState.getData();
if (!door.isOpen()) {
door.setOpen(true);
blockState.update();
Which works fine, but after this i wanted to close it again after 3 seconds so i used a schedular.
new BukkitRunnable() {
@Override
public void run() {
BlockState blockState = block.getState();
Door door = (Door) blockState.getData();
door.setOpen(false);
blockState.update();
}
}.runTaskLater(this.plugin, 60);
Can anyone explain why this doesn't work? Oh and yes this is in a different method so that's why I declared the bockstate ect again
programming with nano makes you look like a fucking madman
@toxic mesa next time please use ?paste
good point
I'm trying to hook SlimeWorldManager with SuperiorSkyblock, but I got an issue, basically on island creation, SuperiorSkyblock will call a method to get a location from the world, but the world hasn't loaded yet so the location will always be null, how can I fix it?
Method that will be called on the island creation: https://paste.md-5.net/vipaxevoko.cs
I'll ask the obvious, but is the block the same ?
yup
That's why im confused, the method is triggerd and all, but it just doesnt close the door
can you try to interact with in another way to see if it's going to be updated? e.g put a block above it or something
After the 3 seconds
Already tested that, doesn't close the door
have you tried debugging it to make sire it's actually being ran
yup
.
why are you using this.plugin ?
setBlockData()?
alr imma try this
bump
use a scheduler I guess to check later
What do you mean?
what
oh
yeah aglerr, try loading it later on? like delay the code execution a bit
?paste
How can I do that?
like what @toxic mesa did above, do something similar
Bukkit.getScheduler().runTaskLater
Current method https://paste.md-5.net/pasocinoxu.java
Still doesn't close the door
try setting the data then updating the door
aight
I've done that, and the worlds is listed on the Bukkit#getWorlds, but how can I return a delayed value?
Are you trying to say I have to modified the SuperiorSkyblock source code?
when are you loading your plugin in
https://www.spigotmc.org/resources/auto-door-closer-and-opener-1-12-x-1-13-2.44093/ check this it may be helpful
Current method: https://paste.md-5.net/usupapowej.java
Still doesn't close the door. as you can see ive put some debug messages in and everything is still called correctly
alr ill have a loot
If you are using the newer version, Door is Openable.
using 1.12.2
Before SuperiorSkyblock. I've copied the way the author of the SuperiorSkyblock add SWM add-on.
It's not the problem on that, the plugin register successfully, without errors.
i didn't say it did
So basically a world will be created everytime player create a new island.
how do i make like the \n make a new line?
https://paste.md-5.net/ogucovukux.http
show me your codes
And SuperiorSkyblock trying to get a Location from that world, but the problem is the world hasn't loaded/created yet.
You could split the lines and write the individual lines as individual messages
๐คท I guess look into CompletableFutures
I like to use StringBuilder and append new lines for new mesasges
Will it delay the method?
futures are most often delayed
I want something like this
public Location getLocation(){
SlimeWorld slimeWorld = createSlimeWorld(...);
// wait after world created
World world = Bukkit.getWorld(slimeWorld.getName());
Location location = ...
return location;
}
use a dark theme with bright colors ._.
I dun think should use completablefuture in hope that operation is delayed, not what cf is
you mean headache?
Do you have other alternatives?
Not really, unless there is an event that triggers when the world loads
Then you can use that
declaration: package: org.bukkit.event.world, class: WorldLoadEvent
Well, I found another alternatives. Thread#sleep
dont sleep server thread pls
do it
it'll stop worlds from loading so you'd still be in the shitstorm you're in now though
whats even the best way to use an updater in your plugin?
Don't do it
๐คฃ don't tell him to do it when you know it's not a good idea
Hello! How to get Blocks Enum as a List<String>? (Blocks Enum doesn't have values())

i know that xd, don't worry
They are values
i was just joking
wdym?
.values()
uh
It doesn't exists
Use Set for that and someone had the same problem as you a while ago, just scroll up
he gave the solution too
Is Blocks your own enum?
Most likely, cause I can't find Blocks in the javadoc
make an EnumSet?
Material#isBlock and Material#values should be enough.
I'm guessing he's actually wanting the name of all Materials that are blocks
Materials#values returns all materials, not just blocks
But you know, filter
As in filter with isblock
we've solved that a while ago ๐
someone uploaded a solution using streams
Streams way to go
exactly ๐
when a player is banned, does it trigger a PlayerQuitEvent or a PlayerKickEvent?
nop
Kick iirc
thank
should trigger both no ?
Blocks does not exists in Spigot
how would you differentiate them tho
it's nms 1.15R1
oh shd i just not differentiate during the event, andd instead on the command
Show me the import
import net.minecraft.server.v1_15_R1.Blocks;
here you go
hmm, how to do?
I see Block I dont see Blocks
"Hey, this, this and this are from NMS"
Yea, it's not from spigot, it's from nms
I can't help you when it comes to NMS, sorry
Yes, in nms I see Block import. I don;t see Blocks
oooh, my bad
Blocks does not seem to be a valid nms import, but why are you using nms?
because my worldedit need Blocks
private static void setBlock(org.bukkit.World world, Location location, net.minecraft.server.v1_15_R1.Block block, boolean applyPhysics)
Block
Where is this method from
wait lets find in spigot
((CraftBlock) block).getNMSBlock; No idea for 1.15
However I find it unlikely that method actually wants a NMS block as it accepts a Bukkit world
^ but if this method comes from worldedit's api or sth, they prob have another method to handle the conversion
None of that is worldedit
You are also going to find none of those examples update lighting
Continuing this, what about using while loop?
int limit = 0;
while(world == null){
if(limit > 20) break;
world = Bukkit.getWorld(slimeWorld.getName());
limit++;
}
anyone know if i can disable collision between a few select mobs and none others
preferably without teams so i dont touch teams set up by players or other plugins
how do you do the equivalent of a 'move' command using the worldedit api?
ask in their discord?
MainMenuGUI.getType().getDefaultTitle();
move command? what do you mean?
what is the way to get title of an Inventory
ok?
16.67 ms is how many ticks?
ohhh wait, I just needed blocks list
sorry I was small brain
0 - 1 tick; 50ms = 1 tick (provided no lag)
what
there is no 16.67 milliseconds in ticks?
Run the loop on another thread and have the loop run once every 16.67 ms
is there some way how would i make this?
&cEmail: &f%emailStatus% <-- replace the %emailStatus with TextComponent clickable?"
1 tick = 50ms
how would I do that?
does Bukkit.getLogger().info() supports colors on cmd?
Yes
with ChatColor.COLOR or what?
you could do ยง
You can't
Yes
oh okay
thanks
is there a way to disable for players too? sorry i worded my question poorly
What's the best way to make multiple config files with custom names, do spigot have a method which allows multiple config files? Or should I use just plain java and write a algorithm that makes a yml file, writes to it, reads from it or use a library?
cheers
Are you sure it's not just a coincidence?
Nothing there looks like it'd make that happen
nice
runTaskAsynchronously runs in how many milliseconds?
you define it
yeeeep, but 1 tick = some milliseconds or something
unless it's lagging of course
i think not
yes ๐
1 tick = 1/20th of a second
but is async no longer made for that?
no dude, I just wanted to show the method -_-
?jd
tf
So you want to run something every 16.67 ms?
why is 16.67 so important?
In that case, you would need to write your own scheduling logic (java.base should provide it already though!) - just beware that it is pretty much impossible to sync with bukkit, so do not run anything that requires bukkit in it
no important
1 tick is 50ms
try
{
try
{
//TRY
//Exception
}
catch(Exception e)
{
//Catch
}
}
catch(Exception e)
{
//Catch
}
finally
{
//Finally
}
IF there is an exception in the innner try/catch, will it then always run the last finally ?
Where did you get this number?
read up
because no execption is called in the outer try/catch
yeah, or just get rid of the inner try/catch
because it'll be caught by the outer one
okay...
why? in your example you've generalized so much the exception that it's going to catch everything
Lol 16.67 ticks what on earth
wait am I wrong?
the finally block is going to be run no matter what
yeah, for some reason I thought it would be ran only if some exception was called, I'm tired lol
sorry I'm dumb yes it will
Nope, when it exits the try block it will execute it
Oh ok, so it will always run the last finally?
yes
yes
Ok thx
What is making you do this :3?
just optimizing a code
20 ticks = 1 sec, uhmm good luck ๐คฃ
Wdym?
What does that optimize
And what are you trying to loop on another thread again?
good would be much better than having to create a runnable for each person ๐
i dont know
by a guy who offered me a guide on how he has made a system
do you want to describe your problem so we can contribute our thoughs ?
let me show
brb 5m
obviously there were some changes, but the basics are the camera movement
i don't know if the camera would get stuck?
that's interesting in it's own way
and yea, 17ms shouldn't make that big of a difference
Thread.sleep can do approx 17ms
joke
NMS
and pathfinding
Yes, but you can use inheritance to make it way easier
hmmm, maybe there is a way around it, but if you go creating thousands of entities just go and make a standalone game
How about using MythicMobs?
the hypixel server is so far from spigot/paper/vanilla basically it is its own game
exactly and it took them YEARS with a TEAM
So yeah gl with thousand of custom entities ๐
it's gonna be interesting to see thousands of classes
re-write part of the NMS then
you can do it for certain things, like damage, speed and what not as far as I know, but there are limitations
not only that, you will have to do it again in each minecraft version
and if you want each entity to have different AI, yea, forget it
check this: https://github.com/Iltotore/CustomEntityAPI though
new ProcessBuilder("sh", "", scriptFile.getAbsolutePath()).start(); I can't run a sh file, I am 100% sure the file exists
what is the magical empty string at index 1 ?
I can't put null
does it have executable permission the user ?
System can't find the pad
Want it windows/linux compatible
windows does not have sh by default
What can we do else?
I use it to remove a old plugin file
you can do the same with java ?
rm "CustomMOTD.jar"
rm "TvheeAPIUpdateScript.sh"
It simply doesn't delete the file
After an update I try to delete the old file
aren't there like 5 million "auto update" java snippets on spigot
Ok show one then
I don't know why you are trying to reinvent the wheel using sh files
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
there is even one on the fucking wiki
damn, did you not look into this at all ?
gradle has great documentation
probably a lot more effective to read than to have the high quality spigot dev community try to help you
what ?
Files.copy will this overwrite the jar, even if it's running?
tho, overwriting your own jar while it is loaded. You gotta be very very careful
Yes I disable it first
But I can download the update, rename, disable current plugin, enable new plugin, but I can't remove the old jar file
How do I uninstall a plugin?
Remove from /plugins ?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
@quaint mantle
on the spigot MC website
I can not find
On the bottom of the resource page, before the recent updates section and beside the edit button.
How are big plugin MySQL databases working?
Like is it only the plugins owner localhost based database
So they have to enter their information in the config?
And then start their XAMPP everytime they start the server?
authentication information is usually supplied through a configuration file yes
yea, that's what I'm doing in my plugins
where the SQL database is hosted is up to the administrator
So they have to start their xampp everytime?
no one uses xampp for SQL
xampp is only used in windows
even on there, docker container exist
Docker container?
yeep
No idea whats this xd
Our life savior
very lightweight virtualisation technology
but if you are running a production server on your local windows computer you have bigger issues anyway
Na im just trying to create a plugin with mysql database
but i was just wondering how it works then cuz all tutorials use xampp
then yea, xampp will do for now
But when i want to release the plugin?
Then how people will be able to access the database?
I mean they all aint gonna download xampps i assume?
...
Im just wondering, all the tutorials showed xampp only
That's a way to create a db
So im kinda stuck rn
You don't need XAMPP
The plugin just needs to connect to a db
with the credentials you'll give in the config or hardcoded in the plugin
https://stackoverflow.com/questions/47017755/how-can-a-jar-file-delete-itself Will this also work on Linux or MacOS?
linux does not lock the jar file so it's a non issue in the first place
So the database will be connected to downloader's database with localhost credentials?
with whatever credentials they supply
It will work on any platform as it's a JVM
to whatever database they run
Ok thx
So they dont need xampp?
No one needs it
If they want to access the database then they need xampp?
God sake x) inform yourself of what's a database
why xampp specifically ?
To create easily a db
Cause making a database without it it's pretty much a pain in the ass
And so, you use it to set it up easily
So I dont need a xampp at all I can just do everything but without the xampp?
yes
what are you trying to do?
to create a database which holds player uuids and some more stuff
you don't need xampp at all
if you want a database then use something like mysql/mariadb
and if you are trying to write a plugin to connect to it then use a connection pool like hikari
XMAPP is just the "I use windows and never saw a shell" way of setting up MySQL
accurate xD
if you have a mysql database running then as long as it works then you don't need to worry how the user installed it
Runtime.getRuntime().exec("cmd /c ping localhost -n 6 > nul && del " + oldFile.getAbsolutePath()); does not delete the current running jar, even running manually through cmd, the plugin is disabled and I can remove it from Explorer
Hi fellas !
I'm trying to do something when a player enters an area. So I use PlayerMoveEvent and have created a method that returns true if the player is in the area.
The problem is that when I do my loop on PlayerMoveEvent if (player is in area), I want for example to send him a message, but the thing is he will always be in the area after he enters it, right ? so the function will apply each time he moves and is in the area !
Do you have any idea on how could I make it so that it execute the code only ONE time when it checks that he is in the area for the 1st time and then dont do it anymore ?
please help
An hashmap with area name as key and players list as values, if players is already in, then don't send
the plugin is disabled and I can remove it from Explorer
it's disabled if it threw an exception on startup, and of course it won't delete the jar if you pasted that literally into cmd
You may need to pipe the output it into sh instead
I want multi platform support
I manually disabled the plugin with pluginmanager
You can't get multi-platform support by doing system calls
hmm oh yea sounds like a good idea ! I'll think on how to make that
Thanks a lot !
Ok I just want to delete the current jar file, it seems like impossible
After enabling an updated jar
Everything works, except deleting the jar
Use the update folder to do that
is this for your framework that fucks with classloaders and does everything wrong
have the updated jar delete the old one, windows will lock it if it is still running
Yes, but how will I pass the updated jar which file it needs to delete
create an sh process, pipe your command into it and if it isn't supported you go to the next shell interpreter
Updater - Version 2.3
Updater is an easy-to-use but robust and fully policy-compliant plugin updating system. It provides plugin developers with the...
Or perhaps just dont fuck with that
Sorry but it does nothing wrong and it works good
or just do it the real way and just distribute a wrapper for your actual plugin jar
assuming it still works the way you made it work when we last talked it's horrible in every possible way
What is a wrapper?
not to mention needlessly so
It was horrible
actually I don't think spigot would allow that would it ?
are you still fucking with pluginclassloaders and extending javaplugin twice and that horrid shit
you were
I didn't do that, but why would we discuss it's a waste of time
i don't remember the exact specifics of your setup but it definitely was ass backwards
hopefully it's better now
I will publish the source in couple of days
I just need to finish the updater and test everything
Nice source, but I can't find where it deletes the old plugin
So placing the jar in the "update" folder will auto overwrite?
At restart yes
And has Bungee also this kind of feature?
Ok nice
idk, since it's a bukkit feature
But you can try
anyway, I wouldn't implement an auto updater
That's bad.
not sure, but how come you don't keep backups using git ? xD
maybe if you decompile it, you can copy and paste your project
building it doesn't delete the original .java files
how can i stop the execution of the onCommand() method again?
when a player does not meet a condition
return false?
return true
Honestly I don't know what's the difference but I always use return true idk why.
oh that one I think return false iirc.
i always forget it ๐
How do you set the usage anyways?
in the plugin.yml
hi, when I try to restart a schedule when he is activated, he throws me this error : bat [16:19:50] [Server thread/WARN]: [custom_scroll] Task #11 for custom_scroll v0.0.1 generated an exception java.lang.IllegalStateException: Already scheduled as 11 at org.bukkit.scheduler.BukkitRunnable.checkNotYetScheduled(BukkitRunnable.java:162) ~[server.jar:3096-Spigot-9fb885e-296df56] at org.bukkit.scheduler.BukkitRunnable.runTaskLater(BukkitRunnable.java:78) ~[server.jar:3096-Spigot-9fb885e-296df56] at fr.cookiesc.customscrolls.CooldownStorageData$1.run(CooldownStorageData.java:20) ~[?:?] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:81) ~[server.jar:3096-Spigot-9fb885e-296df56] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:400) ~[server.jar:3096-Spigot-9fb885e-296df56] at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1179) ~[server.jar:3096-Spigot-9fb885e-296df56] at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:394) ~[server.jar:3096-Spigot-9fb885e-296df56] at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1127) ~[server.jar:3096-Spigot-9fb885e-296df56] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:966) ~[server.jar:3096-Spigot-9fb885e-296df56] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[server.jar:3096-Spigot-9fb885e-296df56] at java.lang.Thread.run(Thread.java:834) [?:?] so someone can help me?
java.lang.IllegalStateException: Already scheduled as 11
is there a "caused by" piece?
yes but how can I solve this problem
ne there isn't
Well, don't register it again with the same id ?
It does says it all ^^'
at fr.cookiesc.customscrolls.CooldownStorageData$1.run(CooldownStorageData.java:20) ~[?:?]
Looks like you're registering the same scheduler twice
normal, when I activate it he regester it another time
well don't make "him" register another time
package fr.cookiesc.customscrolls;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class CooldownStorageData {
private BukkitRunnable dataTask;
public Player player;
public Integer id;
public CooldownStorageData(Scroll scroll, Player player) {
this.player = player;
dataTask = new BukkitRunnable() {
@Override
public void run() {
Integer cooldown = scroll.getCooldown();
if(!(cooldown == 0)) {
scroll.setCooldown(cooldown - 1);
dataTask.runTaskLater(Main.getInstance(), 20L); // here
} else {
CooldownStorage storage = CooldownStorage.getInstance();
dataTask.cancel();
storage.removeTask(id);
player.sendMessage("cooldown finished");
}
}
};
dataTask.runTaskLater(Main.getInstance(), 20L); // and here for the first time
id = dataTask.getTaskId();
}
}
like that
That's not how you use schedulers...
I mean, yes, you can, but that's not a good practice
You should extend the actual class and create the scheduler and then you use it as the scheduler
I have a second file with a list of this class
That's what I was thinking yeah
learn java
Don't do that
Just a little side note, please do cooldown != 0 or cooldown > 0 instead.
You don't have enough knowledge to mess with schedulers. That's an obvious point.
I just need to do a little cooldown
hmm, what about when you use lambda expressions ?
I have created a jar file, tested it and ran it and it works. If I add this jar to the resources folder and then place it in the plugins folder I get "Error: Invalid or corrupt jarfile"
That's a functional way to use it, and it's ok for singular usage
But here, he wants to manipulate the scheduler more than once
So making an extension is the way to go
I think I will do more simple
Like doing "Integer cooldown" it's a lack of knowledge
Don't use the object if you don't need methods from it. It's only a waste of memory. Use the primitive type.
@opal sluice thanks for elaborating ๐
Yes
now I did the schedule execute it 1 time
You can't, since it's not a project but a compilated jar file
hey can someone give me a hand here please
https://hastebin.com/odubesojir.swift
but every time someone clicks the gray area in the listed inventories i get this error
https://hastebin.com/kuzofokede.properties
Google, "Java decompiler"
what @opal sluice said and I would suggest you to put those values in an a set or something to make the code more readable
The error here, is because your current item is null/air so you need to check for it before manipulating the item
So add, citem != null && citem.getType() != Material.AIR
Import archive. Please, use google.
possible create inventory with items?
I recommend using tools that are actually meant for this, such as recaf
Mmh yes ?
you can create the inventory and add the items the instant after
how?
there are many example in the spigot site
Use Google
it only gives the error when i click the gray area while holding an item
Yeah...
That's what I just said...
Since the gray area is not an item
the citem is null
a this I know
but how do this?
Could you please, use Google ?
Google your question before asking it:
https://www.google.com/
and if you fail then come back here with the stack trace and have you tried
I know how create inventory ๐คฆโโ๏ธ
Didn't he just said that he didn't ?
You want to add items then ?
I asked how to create inventory with items right away
new ArrayList<>(Arrays.asList(1,2,3,4,5));
If you've used google, you would know how to
@minor garnet next time use ?paste please
how I can create ArrayList with define value how I want create inventory with items
Can you set velocity async?
well, I am doing a continuous update of when players within a list, but I need to get their speed at a certain time, but these players on the list when they move, don't update their speed,
Well, you need to use itemstack in your array and you need to populate your inventory, after that you can open it
Assuming your arraylist is the actual slot array, you should instanciate each array slot to air and instanciate the actual slot to the item you want
Then loop and populate
yes ?
gj
Files.copy(TvheeAPI.getInstance().getResource("FileRemover.jar"), fileRemover.toPath(), StandardCopyOption.REPLACE_EXISTING);
If copying the jar from the resources folder to the plugins folder it gets corrupt?
If the actual jar is used, it's locked, and you can't copy it
No it's just an external jar
no I thinking about create inventory with define this items
in one line
I don't think you can do it in 1 online, check the javadocs though
well at least not the way you mean it
So, it tries to copy the file you're running
No it's just like copying a config to a file
Not that jar
I am in my plugin, and in my plugin I copy FileRemover.jar
As you can see, the jar gets 1 kB more
Hard to know what's wrong here
Yep
What's the executor
is there an alternative way to MapMeta::setMapId()
File fileRemover = new File(TvheeAPIPlugin.getInstance().getDataFolder().getParentFile(), "FileRemover.jar");
InputStream in = TvheeAPI.getInstance().getResource("FileRemover.jar");
OutputStream out = new FileOutputStream(fileRemover);
byte[] buf = new byte[1024];
int len;
{
out.write(buf, 0, len);
}
in.close();
out.close();
Runtime.getRuntime().exec("java -jar FileRemover.jar \"" + thisJarFile.getAbsolutePath() + "\" 10");
Well, you have the answer ๐
ah found it meta.setMapView(view);
how to reduce the amount of diamonds or other ores ?
does not really says alot
At the end, it says what to use instead ^^
if i didnt know that the xxx is set then i didnt find it ๐
That's just pure logic x)
https://stackoverflow.com/questions/10308221/how-to-copy-file-inside-jar-to-outside-the-jar/44077426
ok this is strange
I was thinking about creating an extra maven module
apparently window open can open window with 32 bit integer
packet window id
but window data packet only accept unsigned byte sized number
wtf
and Window data packet accepts byte
the api, the nms packet classes, and the protocol don't always match up exactly
but its true
for example the relative move packet classes take doubles, but the protocol uses ints
how get the player velocity by your location ?
well yes, if the underlying protocol doesn't support it, it'll fail
then why tf send window id in the first place
if one is bigger and the other is smaller
just as the relative move packets can't actually send full double coordinates
but only 1/8000ths of a block
well that makes sense, but why would we need to send window id in the first place from the server if we won't use it.
because you can only open one gui at a time
dunno
if notchian server increments id as the chest or other container is created
Is there any pet library for Spigot?
that would overflow the byte value
i need to make a test
by placing 255 chests in one place
to see what happens lol
wait
this is even more bizarre
when i open the inventory it increments the id
every time i open it
not place it
you can do via preferences
and compiler tab
Window -> Preferences -> Compiler
compliant java version
I want to sum up two commands in one command like:
/spawn ---> teleport to spawn + fix all
Is there a plugin??
if i were you
i would use skript for this dirty job
to execute both commands
but plugin is better
ok
I think there is a plugin already capable of doing that
does anyone know how to get the velocity of player from your previous and current coordinates ? ...
you need time between in order to calculate velocity
if you're asking for that
yes but i do it
yep
i'm using a thread to take a last coordinate
im not sure, im using Sublime text 4 with Eclipse java language server
it feels like Intellij but way less resource consuming
@minor garnet depending on how you do it, many things will go wrong
yay..
Bukkit.getOnlinePlayers().forEach(player -> {
if (gunManagement.getMove(player) == null) return;
Vector vel = player.getLocation().toVector().divide(gunManagement.getMove(player));
// vel.setY(0.0);
double x = vel.getX(),
y = vel.getY(),
z = vel.getZ();
gunManagement.addMove(player);
player.setVelocity(vel);
Bukkit.broadcastMessage("ยงaX: " + x + " Y: " + y + " Z:" + z);```
get the coordinates subtract those coords and do a proportion
you have to take into account if the play move straight forward, backwards or left and right
proportion ?
I think Maven is the problem
is because added an effect that makes the player have a much lower speed, but can move very slowly, I'm trying to take this lower speed that he walks and multiply it and add it to the player's speed
x1 - x2, y1 - y2, z1 - z2 = x,y,z distance
distance / time = velocity
you need to manage the negative and positive axis tho
Yes, but take note, that the x2, y2 and z2 can be bigger than x1, y1, z1
Nah, Math way more elegant
Nope, not as far as I know at least
I know the feels, rewriting my json logic here, though they're still not perfect they're better than before ๐
well you can make the mob target someone
but that's vanilla kinda
you can make an AI without NMS but that's not practical
since AI requires high computation power
and Bukkit API isn't built for power
but for simpicity and backwards compatbility
that's not practical at all, with a few entities it's going to crash the server, no ?
well no
you can do it without any lag
but directly accessing the server
would increase the performance
use paper's ai goals api
I thought,
said that it's better to don't use NMS. ๐ค
he wants to create thousands of custom entities ...
and that 1.8 plugins must never break
anyone know how to setup armor tools for teleporting
for thousands, you probably want some sort of a boid based ai system
i remember someone on paper tried it for fish schools, but i don't know how it turned out
What's the fucking point of window id if it resets every 100th opening of container
What do you mean ?
what is time
Their is a plugin called armour tools
I want to set up lobby like hypixel or any other server
When we click the server we just teleport to other worlds like bed wars
Which lib does spigot use to parse yaml files?
I'm pretty sure hypixels teleports you to other servers, not worlds
Okk
snakeyaml
your best bet is to ask the developer or read the documentation
Ok thanks for helping
you shouldn't expect help with nms
how can i get the display name of the people who shot the projictile ?
ProjectileHitEvent
Get the shooter from the projectile
it's either #getEntity or #getProjectile
Then Projectile has #getShooter
Hi, is BukkitScheduler#runTaskAsynchronously guranteed to complete when the server shuts down?
Assumed it's triggered by a command, running some file IO which I would like to complete.
bump
no, it is not guaranteed to be completed or even run
if you want to ensure it is completed before the server shuts down, you need to wait for it to finish in your plugin's onDisable
Like running Thread#join for the IO thread on the main thread in onDisable()? Okay, thx.
can anyone suggest me a beginner plugin to work on?
assuming it's a dedicated thread, yes
but the bukkit scheduler threads are cached, so joining them doesn't make sense
what this will return ?
e.getEntity().getShooter();
once your task finishes, the thread will wait for another task to be executed on it
something like a CompletableFuture or a dedicated thread may be better
Yeah. Seems like I would need my own thread then. Though not sure if threads from Executors#newSingleExeutorService
might be acquirable, so I could spare the caching part on my end. But thx so far!
I need some help, because im new to SPIGOT Coding... I want to make if an MOB (mushroom cow this wouldnt help to answer) is strike by lighting to get name
SnakeYAML
consider learning english before learning java
Listen to damage event. Check if lightning then set name
you want to know strucked mob by lightning name?
no, i want to check IS MOB struck by LIGHTNING/THUNDER
oh, so simple
me who didnt got this idea
iirc LivingEntity
where did I put my holocaust button
but how to see WHICH mob is struck by thunder/lightning because i want to be specially "mushroom cow"
pull that information from the event
check the mob type
unfortunately the javadocs are written in english
so you won't be able to understand them
i will use instanceof
you should prefer gettype
since interfaces could change in the future, we don't know what mojang will do with mobs in the future
and the getType() method couldn't (99%)
thanks ๐
what distro u using? ๐
I prefer the deepin environment tbf
i3-gaps ๐
EndeavourOS
oh cool, i havent used it personally, is it any good so far?
arch is the best ~
how to make a discord bot that will send commands to the spigot server. For example /ban teest1
what's the --rev for 1.17 buildtools?
java -jar BuildTools.jar --rev 1.17 I don't think anything changed
You'll need to make a discord bot first, see https://discord4j.com/ for a nice java discord library, then you can use this to send a command:
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "command";
Bukkit.dispatchCommand(console, command);
If you don't know how to make a discord bot I'd suggest learning about discord.py in python first
thanks
I know how)
cool
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - DV8FromTheWorld/JDA
That's quite nice
I'd say that's more helpful for more complex projects tho
(discord4j imo is easier to setup, but not nice for big projects)
Never used it, I've only used what I sent. But yeah just make it into a plugin
cheers my buildtools was out of date
Ah, yep that explains it ๐
(oh and it's Java 16 I'm dumb)
yeep
hello does anyone know any maven repository that has spigot 1.7.10?
?
consider not depending on software that is almost 10 years out of date
is there some way how to replace text in string with textcomponent thats clickable and stuff?
How I can create skull with Texture (no skullOwner)
Could someone send a screenshot of any spigot maven project? I've forgotten the directory layout ๐
does the package name for the main class matter?
(If I have this dir layout, and MCMain is the main class, what is the path for plugin.yml's Main)?
you have an src/main directory where you have java where you put like .java stuff and resources stuff for plugin like config and stuff
for no apparent reason
its not used anywhere
it just increments
for no reason whatsoever
okay, so your one would be something like:
main: pavlyi.authtools.spigot.Main
yes
cheers
Where's it coming from? What's your code?
the main: field in your plugin.yml isn't related to where your code is in your project
it is the package + class name of the class
you can find the package at the top of the source file
and the class name should be obvious
yeah
hey can anyone help me
?bt
?
Nah it's just for me
no idea... maybe try to find which LINE OF CODE is causing the error by DEBUG MODE
why are you CAPITALIZING some random THINGS for no REASON
Are you not able to understand a stacktrace?
that's a NMS implementation of inventory id counter
just thats making the people
i just doesn't seem to know why is it counting in NMS
it seems it has no purpose whatsoever
when talking online XD
that's not how language works
guys quick question
generally, things like italic or bold are preferred
thats how online language works
as all-capsing looks dumb as shit
and bold
caps is easier to type than bolding out in discord
guys, how can you tell if a player abort breaking a block from nms, apart from ABORT_DESTROY_BLOCK
one * for ITALIC and two ** for BOLD ๐
Rip Cord dumb race
iirc underscores also work
check SolarRabbit's message - i got focused on ABORT_DESTROY_BLOCK
wait is debug mode a spigot thing, tell me more, what have I been missing out on?
at least they did when I last used discord ages ago
regardless, all caps is retarded and makes you look dumb and nobody other than borderline illiterate people do it
USES BOLD ITALICS AND CAPS BECAUSE WHY NOT
USES BOLD ITALICS CAPS AND UNDERLINE BECAUSE WHY NOT
lol
is double underscore underline
on your IDE, you can use debug mode
*||lol||
im using it
guys, ||fuck you||
oh, do you have your ide set to run the spigot jar?
I just compile it, copy it over, and run it
using the console
ok guys need some development help here
uwu
discord client
what are we even talking about
does it use auth tokens
gay
Imagine spigot, but instead of getting stack traces, you just get the error with no context
So I was trying to mock a normal block break process on bedrock, dun ask why.
I have a method for BlockDamageEvent cuz that's obv what's called while attempting to 'break' the block. And I listen in to ABORT_DESTROY_BLOCK packets to cancel the event if player stop breaking the block.
But....
Players can punch the bedrock repeatedly and still qualify as normal BlockDamageEvent without any ABORT_DESTROY_BLOCK packets generated. Any way to overcome this?
that's strange
iirc there's a packet which updates the block breaking state animation
i think just punching the block by clicking it should initiate the breaking animation
it's just cancelled immediately after
hmm, but it seems like it might not be cancelled since I set up a scheduled task for the block to actually break after a certain amount of time
and the event isn't cancelled by then
Can you help me compile SPIGOT PLUGIN? I compiled it to JAR, but my server doesnt DETECT it
restart