#help-development
1 messages · Page 505 of 1
you could do all your math async after you get the initial entities
can i do raytraceblocks async
ill try that ig
thanks for all the help
Ok one more issue
I changed up my code a bit
and now when I punch a mob it's completely crashing the server
and spamming the console with unreadable errors
// Get every mob within 20 blocks of player that is in line of sight
player.getNearbyEntities(Config.CLASSES.BERSERKER.ABILITY_RANGE.XZ_RANGE, Config.CLASSES.BERSERKER.ABILITY_RANGE.Y_RANGE, Config.CLASSES.BERSERKER.ABILITY_RANGE.XZ_RANGE).stream().forEach(nearbyEntity -> {
if (!(nearbyEntity instanceof Damageable)) {
return;
}
Damageable nearbyDamageable = (Damageable) nearbyEntity;
if (!nearbyDamageable.equals(mob) && isFacing(player, nearbyDamageable) && hasLineOfSight(player, nearbyDamageable)) {
nearbyDamageable.damage(event.getDamage(), player);
}
});
I could send the error but I don't think it'll be of any use
yes
delay damage 1 tick
.damage calls the damage event
Which runs your code again
Which calls the event again
yeah but i have a check at the beginning
oh wait
if (!(event.getDamager() instanceof Player)) {
return;
}
if (!(event.getEntity() instanceof Mob)) {
return;
}
Well the damager will be a player
yeah i just realized
And the damagee will be a mob
You need to toggle a Boolean before you call the .damage method
Then ignore the event while that Boolean is set
got it thx
mhm
before you apply damage set ignore = true
ignore = true;
nearbyDamageable.damage(event.getDamage(), player);
ignore = false;
done
and put the check at the beginnign
in the start of the event, if (ignore) { ignore = false; return;}
this works too
wait no it doesnt
mine will
cause there can be like 5 mobs getting hit
yours won't
wait instead
mine works
I use it myself
single threaded MC
Oh no what about folia
im still running into an issue where sometimes a few mobs in view wouldn't be hit
haha
good one
but ill try to figure this out
i love how folia devs are always like "this plugin has to fix their issues" while they claim to be bukkit compatible but cannot even manage to implement the scheduler, then claim it's "my job" to get it working lol
like wtf
so do your job you slacker 😉
I got a github bot running that closes every issue mentioning "folia" after 24 hours
folia is supposed to fix itself before I try to
oh and paper's "paper-plugin.yml" is a bad joke
sometimes some mobs behind get hit too
at first I thought it's actually a joke but somehow, those people are serious haha
i've done some testing and when I hit in this angle
all the cows including the 2 at the front of the camera get it
but when i turn around and try only the two cows next to where im looking get hit
actually if i don't use a sword literally only the cow im looking at gets hit only
seems to hit all mobs around me when I'm facing south, but no mobs when I'm facing north
Ok wait
It seems to hit all mobs around me when I'm facing any direction but north
its an issue with the isFacing function
public boolean isFacing(Player player, Entity entity) {
Vector playerDir = player.getEyeLocation().getDirection();
Vector entityDir = entity.getLocation().getDirection();
double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(),
playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;
return (relativeAngle <= 135 && relativeAngle >= -135);
}
sounds like it
any ideas?
use teh isBehind method and see if only ones behind you get hit
alr
also check to teh sides
try with the isBehind, it shoudl only hit behind you and the one you hit in froint
see if that works
nope
The isBehind still works for the other ability
with the damage increase on a backstab
that makes no sense
unles
I think I see
isBehind is anythign out of view, so not just behind but to the side too
Isn’t it because isbehind compares where the entities are looking?
no, its body facing
no
so only 90 degrees directly behind
about
I think the issue is that isBehind checks to see if the direction of the player is almost the same as the direction of the entity
isFacing is trying to check if a mob's location is in view of a player's direction, but doesn't really have any logic to compare location in it
Hi... I feel dumb asking this but how do I delete a world?
Becauses the .delete() doesn't actually work
lemme test
now its only hitting every mob when im facing south
and none in any other direction
I'll have to test myself
ok wait
but its a ilttle random
sometimes itll work
sometimes itll hit mobs behind me and not in front
i cant really describe the behavior precisely
its a little random
the thing i dont understand is why Vector entityDir = entity.getLocation().getDirection(); this exists in the first place
because i don't need the entity's direction at all
I just need to know if the entity's location is within my direction
yeah it doesn;t look quite right to me either
it can;t deduce teh behind/in front just from the directions
as they are unit vectors
it shoudl be taking a vector from their locations
then usign teh direction of the target to see if it's behind or in front
Probably ```java
public boolean isBehind(Entity player, Entity ent) {
Vector playerDir = ent.getLocation().subtract(player.getLocation().toVector());
Vector entityDir = ent.getLocation().getDirection();
double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(), playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;
return (relativeAngle <= 60 && relativeAngle >= -32);
// inFront return (relativeAngle <=-135 || relativeAngle >= 135);
}```
but not tested
isBehind?
look at the last line
oh
just a different return depending on which method you do
I'm assuming you meant ent.getLocation().toVector()
ok backstab works
the splash attack is still very erroneous
idk how to describe it
just random cows get hit every time
when i punch this cow the two cows in the circles get hit
are you using paper?
no
post the output of /version please
font scaling not 100 😭
@eternal oxide I got it fixed
public boolean isFacing(Player player, Entity entity) {
Vector toEntity = entity.getLocation().add(0, entity.getHeight() , 0).toVector().subtract(player.getEyeLocation().toVector());
double dot = toEntity.normalize().dot(player.getEyeLocation().getDirection());
return dot > 0.5;
}
I just altered some code from an online thread and it works
Idk how it works but it just does
lol ok 🙂
Is it possible to make a moving particle effect
EnumWrappers.PlayerInfoAction.REMOVE_PLAYER
Is removed in 1.19.4
What's the new one
who is the guy who helps with 1.8.8
choose = new ItemStack(Material.STAINED_GLASS_PANE);
How can I make this light gray stained glass?
ah nvm ItemStack nop = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.LIGHT_BLUE.getData());
Patterns in 'instanceof' are not supported at language level '8'
Is there a way to use this in language 8? (For 1.8purposes)
Same goes with the advances switch blocks (I can just use static to normal switch if itcomes to that)
or would
static boolean isPlayer(CommandSender sender) { try { Player player = (Player) sender; player.getWorld(); } catch (Exception ignore) { return false; } return true; } just work
why teh fuck
are you doing this
What’s wrong with if (sender instanceof Player)
you really should be learning java more if this is your solution to an instanceof check
well than what should I put?
even better
if(sender instanceof Player player){
// stuff here
}
1.8 java
And?
did you not see my message?
okay I fail to see the issue then
What I wrote is perfectly valid for java 8
instanceof checks have been around since day 1 afaik
Patterns in 'instanceof' are not supported at language level '8'
And I cant upgrade
(sender instanceof Player) = fine
Patterns in 'instanceof'
clearly you did it wrong or your IDE is just hallucinating
(sender instanceof Player player) = not fine
more likely the former
now that works
that's not valid java 8 code
it works though
it won't if you're using java 8
if you really are targeting java 8 it won't work on compile
doesnt give me a error in the ide
I don't know what to tell you
you will have an error if you are targeting java 8
may not be right now
ill try compiling
may not even be on compile could be a RuntimeException
though I'd lean towards a Compiletime if your IDE is really targeting java 8
as that wouldn't be valid syntax
it works
You aren't using Java 8 in that case
How to make gun recoil
04:33:02 [INFO] [EthanGarey] <-> ServerConnector [lobby1] has connected
04:33:02 [INFO] [EthanGarey] <-> DownstreamBridge <-> [limbo] has disconnected
04:33:06 [INFO] [EthanGarey] <-> ServerConnector [survival] has connected
04:33:07 [INFO] [EthanGarey] <-> ServerConnector [limbo] has connected
04:33:07 [INFO] [EthanGarey] <-> ServerConnector [survival] has disconnected
04:33:07 [INFO] [EthanGarey] <-> DownstreamBridge <-> [lobby1] has disconnected
04:33:34 [INFO] [EthanGarey] <-> ServerConnector [lobby1] has connected
04:33:35 [INFO] [EthanGarey] <-> DownstreamBridge <-> [limbo] has disconnected
04:33:37 [INFO] [EthanGarey] <-> ServerConnector [survival] has connected
04:33:37 [INFO] [EthanGarey] <-> ServerConnector [limbo] has connected
04:33:37 [INFO] [EthanGarey] <-> ServerConnector [survival] has disconnected
04:33:37 [INFO] [EthanGarey] <-> DownstreamBridge <-> [lobby1] has disconnected
Now can someone explain this to me...
ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF("Connect"); out.writeUTF("survival"); player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray()); player.sendMessage("debug");
No errors
Is there a way to speed up hopper movement and the rate it absorbs items?
how i can check if a plugin installed on server ? there is any way to get a list of installed plugin on server ? (Ping Me pls)
Bukkit#getPluginManager()#getPlugin(String <name>)
thx for help
I could be wrong, but I don't think there is something that would allow this in the SpigotAPI
Those are the only settings I could see that would relate to it, so maybe what you're after @fierce prawn
Legend

so in the README of CraftBukkit... what does PAIL actually mean when it is used?..
link?
When comparing ItemStacks, does their amount compares too? If so, is it possible to check the item, but not pay attention to the amount?
declaration: package: org.bukkit.inventory, class: ItemStack
oh it allows an easy way to find what needs renamed or set from private to public
IE lets say the method is named unload, but instead you want it renamed to save you would do
// PAIL: rename save
you add that to the end of the closing bracket of the method in question
yes i understand that part of the why, but not why its called PAIL..
because it makes it easier to find
dam 
I am not aware of any utility called pail so the only thing I can think of
the only thing i can think of is a clever play on words actually
not to say that i forgot what a pail was IRL but i definitely had to look it up to refresh my memory
a bucket
like
bukkit
normally they are called Access Transformers, but it’s probably Public Access Something Something
mayb
Help me please. I have a config with List<ItemStack>, it is filled in the format as in the screenshot. I need to know if the inventory contains the first item? If so, get the second item.
I wrote this, but I'm not sure if it will work correctly.
There’s Inventory#contains and containsAtLeast
like that?
Hello, how can I check if an entity is moving ?
x/z velocity > 0 maybe?
event.getEntity() [x z velocity > 0]
I want to make a quick sand block, and only players are killed by it
how is that related to an entity moving
Where can I put this ?
There isn't a EntityMoveEvent
I am confused what killing only players has to do with entities moving
what happens instead
or use words
I don't want to kill only players
can you say what you want to do
.
and I want to kill all entities
what is the code of TempBlock
isnt the sand just going to replace the cobweb
yes but wont it solidify once it falls onto something
also you use blockLock for both blocks
shouldnt the location be different in that case?
well if a falling block touches a solid block it will solidify
think what happens when sand falls...
dont know if its possible
cancel the event maybe?
it didn't help me 😦
I think that kills the block
so guess not possible
open a feature request, although it might be glitchy
?jira
- this is the development channel; 2) you tried to give it more ram than your system has. reduce xmx
i realised wrong channel
hello can anyone explain me about minecart speed?
i wanna make them like 10 times faster
i see minecart#setMaxSpeed
but i don't really know how that will work, will minecart always reach that max speed?
if not, when does it reach max speed
how to name them
it's good as it is, I suppose
pain
what is cat fm
a radio channel? idk
Cat female?
What should I do to make rate of fire?
I found one thread and i cant understand
is it a lib? don't they have docs?
not enough
wiki was not enough to solve my error
i had opened ticket them dc server
but they didnt returned me
as a developer myself, they may be busy
you are, aren’t you?
just i want create a hologram with this code
public void onClaimBlockPut(BlockPlaceEvent event) {
Block placedBlock = event.getBlockPlaced();
Player player = event.getPlayer();
if(placedBlock.getType() == Material.BEDROCK && player instanceof Player) {
player.sendMessage("+2");
double placedBlockX = placedBlock.getX();
double placedBlockY = placedBlock.getY();
double placedBlockZ = placedBlock.getZ();
Location placedBlocksHologram = placedBlock.getLocation().add(0.5, 1.0, 0.5);
List<String> lines = Arrays.asList("Line 1", "Line 2");
Hologram hologram = DHAPI.createHologram("claimlan", placedBlocksHologram, lines);
hologram.setDefaultVisibleState(true);
hologram.show(player, 0);
}
}````
and i had this error: Caused by: java.lang.ClassNotFoundException: eu.decentsoftware.holograms.api.DHAPI
i was downgrade and upgrade api version but didnt worked
are you using maven?
yep
?paste your pom
Is DecentHolograms installed on the server?
oh i forget about plugin libs
is it necessary?
hmm
I'm trying right away
thank you much
but will the user of this plugin always have to use this plugin?
Yes
Any chance of integrating?
hmm okey thank you so
you gotta shade it
https://blog.jeff-media.com/common-maven-questions/ read the second headline
(if you use maven)
if you use gradle, you need the shadow plugin instead
hmm thank you i will try that now
oki. are you using maven?
yes
great, then just do what the blog post says, and it should (hopefully) work
👍
oh and then use mvn package to compile. do NOT use "File -> Build artifacts" or anything
okey
No don't shade another plugin 💀
it is a plugin?
I thought it was a library or sth
They're using the API of another plugin
did you add the other plugin as depend in plugin.yml?
How can I make events fire faster (more in the same amount of time) than they fire when the mouse is held down?
I mean, let's say pressing the left mouse for 1 second fires an event 5 times. So what if I want the click event to fire 6 times in 1 second?
how do I store base64 string in a config
When I try to, it turns into something horrible
\ndmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFibGVNYXAk\r\
\nU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAlsABGtleXN0ABNbTGphdmEvbGFuZy9PYmplY3Q7WwAG\r\
\ndmFsdWVzcQB+AAR4cHVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAR0AAI9\r\
\nPXQAAXZ0AAR0eXBldAAGYW1vdW50dXEAfgAGAAAABHQAHm9yZy5idWtraXQuaW52ZW50b3J5Lkl0\r\
\nZW1TdGFja3NyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5s\r\
\nYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAoadAAGU1RSSU5Hc3EAfgAOAAAAAg==\r\n"```
Why does it put \n and \r there, even if I remove them with .replace I can't deserialize it to itemstack
```java
public static ItemStack itemStackFromBase64(final String data) throws IOException {
try {
final BukkitObjectInputStream bukkitObjectInputStream = new BukkitObjectInputStream((InputStream)new ByteArrayInputStream(Base64Coder.decodeLines(data)));
final ItemStack itemStack = (ItemStack)bukkitObjectInputStream.readObject();
bukkitObjectInputStream.close();
return itemStack;
}
catch (ClassNotFoundException ex) {
throw new IOException("Unable to decode class type.", ex);
}
}
public static String itemStackToBase64(final ItemStack item) {
try {
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final BukkitObjectOutputStream bukkitObjectOutputStream = new BukkitObjectOutputStream((OutputStream)byteArrayOutputStream);
bukkitObjectOutputStream.writeObject((Object)item);
bukkitObjectOutputStream.close();
return Base64Coder.encodeLines(byteArrayOutputStream.toByteArray());
}
catch (Exception ex) {
throw new IllegalStateException("Unable to save item stacks.", ex);
}
}````
Why are you doing this instead of config.set(.., itemstack)
Does it work like that? Didn't even know
I will try, thank you
Because you were reading/writing it as lines and not as a single string
how can I store a list then?
I mean that you should Base64.getDecode().decode("") instead if Base64Coder.decodeLines
Same thing for the other method. That one is adding these new line characters /n/r
How do I remove pressing F in the inventory?
declaration: package: org.bukkit.event.player, class: PlayerSwapHandItemsEvent
^^
no
You're not using the event I sent ._.
i used it
https://hub.spigotmc.org/jira/browse/SPIGOT-6145?focusedId=38814&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-38814I found this. Does it mean that I will not be able to realize my idea?
You can always update
It's fixed in 1.17+
Or try the word around in the comments ig
same
i havent done anything with bows..
but sometimes my bow just doesn't fire at all
even tho its loaded
any ideas why?
Are you cancelling the interact event anywhere?
me?
Not you
like so tho
how cna i get all online players on a server
Bukkit.getOnlinePlayers()
If I give the same ItemStack to two players, are they still the same ItemStack? Is there a difference?
help why does my plugin say it needs to update like idk why does the api says the version is 1.0.0 altho i already realesed the 1.0.1
It says 1.0.1 for me
^^
Probably cached somewhere
oh wierd
it says 1.0.0 for me
and in my server it says update needed
wait let me check one more time in my sv
see it says the last plugin version is 1.0.0
its wierd
im guessing its how you check the version then
imagine not using SpigotUpdateChecker
This is why we make sure the new version is actually newer than the installed version
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getClick() == ClickType.SWAP_OFFHAND) event.setCancelled(true);
}
Works for me
show your update checking code
use this ^
how you check the version from the api is before or after the current version
try {
HttpURLConnection con = (HttpURLConnection) new URL(
"https://api.spigotmc.org/legacy/update.php?resource=109696").openConnection();
int timed_out = 1250;
con.setConnectTimeout(timed_out);
con.setReadTimeout(timed_out);
latestversion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
if (latestversion.length() <= 7) {
if(!version.equals(latestversion)){
Bukkit.getConsoleSender().sendMessage(ChatColor.RED+name+ " | There is a new version out there! | We highly recomend you to update to it | New version : "+latestversion);
Bukkit.getConsoleSender().sendMessage(ChatColor.RED+"You can download it at: "+ChatColor.WHITE+"https://www.spigotmc.org/resources/109696/");
}
}
} catch (Exception ex) {
Bukkit.getConsoleSender().sendMessage(name + ChatColor.RED +"Error while checking update.");
}
}``` i am new making plugins
yeahhh that isnt gonna work how you want it
i barely understand what i done
how
read it
k lol
https://www.spigotmc.org/wiki/creating-an-update-checker-that-checks-for-updates/ & https://github.com/The-Epic/EpicSpigotLib/blob/master/epicspigotlib-core/src/main/java/me/epic/spigotlib/SimpleSemVersion.java
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
what it your version api?
whos updated do i use
I tested on 1.19.4
whichever you want
and i have a problem on 1.16.5
alex's is probably easier
I told you to update earlier
And you said you did ._.
That is, I can use api 1.17 on the server 1.16.5?
update server ¯_(ツ)_/¯
I can't do that.
No you can’t use the new api on an old server
Well you can, but it won’t fix your issue
And can very easily lead to problems
This isn't an API issue. You yourself linked to a Mojang bug
You need to update
the part "new updatechecker" is in red and i cant import anything
did you add the dependency
Probably not
no, but hwo
maven or gradle
^^
Do read things before copy pasting
Hey does anyone know how to delete a world? .delete() isn't consistent and when I tried to use FileUtils it made my .jar file 35MB in size.
sorry, i am really new to making plugins do i have to create a git repository to host my html web?
No
What does HTML web even have to do with your plugin
What's the best approach to register listeners only when a game mode or something specific is about to begin?
I dont know :/
You need to unload the World first
I already have done that
dont, register it always but only do what you want when thats going
FileUtils worked for some reason it makes my jar absurdly big though
so how and where do i implement the maven
do you have a pom.xml
try (Stream<Path> pathStream = Files.walk(dir.toPath())) {
pathStream.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
}
. i have 0 idea
do you have a pom.xml
o sorry i thought it was for another personm
Hello, how can I paste a schematic in my plugin ?
no i dont have
Worldedit api is easiest
okay thanks
Or make your own schematic reader
I am not quite sure what this is doing?
Basically you need to delete the contents of a folder before deleting the folder
So what that code does it recursively loop all contents and deletes them
Alright how do I integrate it I am not necessarily sure where to put the path/file
Idk why i cant add a maven proyect into eclipse
Btw you know anyway to remove unused dependencies using maven in intellij?
not many of us use eclipse so cant really help
open the pom and delete it?
Idk cuz I used a auto import thing for apache commons and it threw a whole bunch of stuff its fine Ill just manually take it out
damn, is there a way to make the updatechecker without maven as i started with plugins yesterday and i dont think my brain understands that
An update checker might be too advanced for you then
seems to be the case lol
i thought it would be easier
any way i can count a players playtime through a whole bungecoord network
well i will start again with another plugin to learn more i guess, any tutorial series recomendation? as i also have the wrong code editor i guess
Do you want to start counting from now or get all their previous playtime too
start counting from now
IntelliJ, and yeah there are a ton of good tutorials out there
https://lp.jetbrains.com/academy/learn-java/ pretty good
https://www.youtube.com/watch?v=lJyTEuqLQfU i watched this series when i started its goog
Learn to code your own Spigot plugin in this complete tutorial series! In this episode, we setup our workspace, download our dependencies, and get ready to begin development.
--- Important Links ---
● Java JDK8: https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
● IntelliJ: https://www.jetbrains.com/idea/download/#section=wind...
TechnoVision is making good stuff in general
Just make a bungee plugin then
i want to acsess the playtime in my server sided plugins too tho
Thanks ❤️
techno vision is good but u wont learn the language itself
Then use a database or share with plugin messaging channels.
is it complicated to work with a database? i have one set up for luckperm but i never really used one for my own plugins
Do you know SQL
Not that hard.
0kay i will see what i can do thx for the help
na
Yummy logic visualization for conditions
but it becomes complicated if u wna write it robustly
just setting it up doesn't take long on a whim
setting up part isnt the problem i just dont know how to make my plugins acsess it
Script 2.0
Recreating this from MM
the longer i look at it the more it makes sense lmao
ikr, basic binary tree
may i get some help with something probably hundreds of people already asked for
?justask
Thats fair, wanted to get every tiny little ounce of performance out as im a perfectionist lol
is there like an optimized version for the spigot that you put on your plugin, cause i made a really quick first plugin and it was like 20mb
using maven?
Oh yeah that must be
nono, that means a yes lol the thing is i dont now how to use maven but dont worry as i am really new
do you have any dependencies?
meaning other plugins you deliberately chose to depend on
did you shade spigot itself in ur plugin? 
No, is just a simple welcome event that sends a message and you can configurate it in the config.yml
eclipse lol
I see
He probably shaded spigot
well I have 0 experience with eclipse
Spigot tends to be a bit big in your plugin :P
what is to shade spigot?
what does your pom.xml look like?
you included all of spigots code in your jar file
which you dont need
i dont jave no pom.xml i dont understand that
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i alredy read that, i cant seem to understand it, is there a video?
probably
yourtube has a bunch of videos
just look for spigot maven setup in eclipse
Kay thanks+
i have no idea how IntelliJ works
how can i create a maven file on my folder
I'd look more general
not specifically for spigot
you are narrowing down your search results by including "spigot"
firstly look on how to setup Maven with java
it will give you a more comprehensive setup guide than adding with spigot to the end
Okay but firstly with maven does it import the spigot file for the plugin?
this is what i got
just create a scratch maven project with Intellij
IntelliJ actually has a Spigot Dev plugin
I'd reccomend using that
called Minecraft Development
k so i delete everything i got on my plugins and i create a new maven proyect named as i want my plugin
what do i put
java and maven?
download the minecraft development plugin first
then create a spigot project
I think that will be the easiest way
^^
k
File>settings>plugins>marketplace
who knows how to use flask cors and sqlalchemy, i am trying to create a database and its not working, thanks to chat gpt
sorry i am taking long i have to smth i am back in 10m i already instralled the plugin
Python 💀
chat gpts choice man
So what is your goal?
Just starting a database?
Or connecting your python program
i fixed it, i defined the models after creating the tables
which was why there was no tables
probably still ownt work tho. my end goal is a web interface manageble access control system. i already made the physical boards with arduino and it works with card scanning and door locks but i want to add a database and have multiple boards manageable from one place
this man using a RFID chip to remote into his minecraft server
actuslly nothing to do with minecraft this is just my safe space
I've done that with java before
Well the arudino communication
and a web interface
Sounds like exactly what im doing. Except one of the big problems i need to solve is the thing will still need to work without network. So it stores credentials from the server priodically and updates them. Authorization happens locally
in case of network outage
dont want to be locked out
okay i did it
yess i saw them thanks now i have the maven
great plugin
How can i export my plugin to test it ?
its eclipse so we need an @eternal oxide
nono i passed to intellij
oh
eclipse was a lit easier but i couldnt get help, and there wasnt many tutorials lol
do what olivo said
i see the mavent tab on the right but where is the "package"
its under lifecycles
oh there is it it exported it to "target" right?
correct
and whats the difference between the 3 exports
idk, I just take the one without the extra wordings xD
lol kay
[13:08:04 INFO]: SimpleServerRestart Enabled | Creator : Chiru | Version : 1.0.0 now this, this is what i love to see lol
If my server is offline server, can I get real uuid in case from a premium account player?
is it possible to trade with a villager in code?
why does it create an empty config folder? this is my main code :
it was too long
this is my config : Config: enabled: true time: 120 message: "&e&l[Simple Server Restart] &4&lServer Restarting In : "
you dont need the register config method, use saveDefaultConfig() on onEnable
k although it now works, the config wasnt on the resources part
although my broadcast and restart dont work lol
Does anyone know why if I get a player's yaw and pitch, and give it to an entity by using Entity#setRotation, if the yaw is in the range of 90 to 180 it will be completely off when given to the entity?
This works for every yaw degree, except in the raneg of 90 and 180
how can i convert into for example: 1 year ago
asked chatgtp and says to use in a apart of the code loadConfig(); but it says it doesnt exist
chat gpt can work for spigot but it makes loads of mistakes when you use more then one class
expecially when working with older versions too
I asked him and said to create a funciton ```public void loadConfig() {
// Load the configuration file
FileConfiguration config = getConfig();
// Set the default values if they are not present in the configuration file
config.addDefault("enabled", true);
config.addDefault("time", 120);
config.addDefault("message", "&e&l[Simple Server Restart] &4&lServer Restarting In : ");
// Save the configuration file if the defaults were added
if (config.getDefaults() != null) {
config.options().copyDefaults(true);
saveConfig();
}
// Get the values from the configuration file
time = config.getInt("time");
message = config.getString("message");
}
i think this will work
Yeah i know, i used a really wierd language that is barely new and if you ask chatgtp questions for that programing laguanges it gives you awnsers from where it was in beta
well if you are very exact it can still help. In a new session try to explain that you want him to use spigot and the version you are making the plugin for
if you get an error send chat gpt the error and he will try to correct his code
it ofc not a perfect solutiojn but can help with smal parts
i think errors in java are pretty self explanatory, no need to use ai for it
not if you are new to spigot
new to java *
well theres java errors and errors that come from spigot itself
someone thats perfect with java may still have issues using the libary
im sure someone thats perfect with java will understaind error that is thrown
okay well perfect may be the wrong word
but still
it doesnt hurt
better to have help you dont need then to need help but not get it
Oh my bad i didnt respond i have been using it, i resolved it
the only thing the load config that he gave me, makes like the config have the "config" 2 times in the same file ``` public void loadConfig() {
// Load the configuration file
FileConfiguration config = getConfig();
// Set the default values if they are not present in the configuration file
config.addDefault("enabled", true);
config.addDefault("time", 120);
config.addDefault("message", "&e&l[Simple Server Restart] &4&lServer Restarting In : ");
// Save the configuration file if the defaults were added
if (config.getDefaults() != null) {
config.options().copyDefaults(true);
saveConfig();
}
// Get the values from the configuration file
time = config.getInt("time");
message = config.getString("message");
}```
hey, does anyone have a, idea on how i can modify a player's reach ? None of the solutions i tried worked
here is the config that that loaded : ```Config:
enabled: true
time: 120
message: '&e&l[Simple Server Restart] &4&lServer Restarting In : '
enabled: true
time: 120
message: '&e&l[Simple Server Restart] &4&lServer Restarting In : '
and here is like the config i made for my plugin : Config: enabled: true time: 120 message: "&e&l[Simple Server Restart] &4&lServer Restarting In : "
do you have saveDefaultConfig on enable
this is redundant since you are using the default config.yml
the method you have there is only useful if you have yaml files that you want to load that are not config.yml
Hi, I am using the Build Gradle action from GitHub Actions to build my project. The problem is that I have a dependency in my build.gradle that is hosted on GitHub Packages and everytime the action tries to build it gives a 401 error. How can I fix that?
are you passing the env vars to the workflow for it to grab it
github packages is dumb and you cant access their repo unauthed
how can I do that?
Yes
And how do I do it
this is my file
well you can add defaults in 2 ways
the loadConfig can be condensed down to ```java
public void loadConfig() {
FileConfiguration config = getConfig();
this.time = config.getInt("Config.time", 120);
this.message = config.getString("message", "&e&l[Simple Server Restart] &4&lServer Restarting In : ");
}
the easiest way is to just include a config.yml in your jar and extract that, the second is the way you are adding defaults
or the code above like Epic has
what does your build.gradle look like
even this is a bit redundant as you don't need to assign getConfig();
yeah, just making it somewhat like it was before to show the difference
also, you probably should check for the presence of the config.yml file as well and not just assume it is there
otherwise you will encounter some NPE's
I don't understand anything but, when I get back home I'll try it
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
usually better to ask for help when you are home and not out and about unable to utilize the help
this way, you get the help while we are here instead of waiting till some unknown time where we most likely will forget about your problem and or you forgetting some of the things presented 🙂
in other words it doesn't waste either of our time
it is a multi module project, but here is one of the build.gradle
show the parent build.gradle
but most likely you need to add a username and password to that repo
Yes my bad I was home, but I ended up having to quickly rush outside because of smth, my bad I undertand
no problem
?
take care of what you have to go do, someone will be here when you get back most likely 😛
the dependency on the GitHub packages is in a public repository
yeah github packages is fucking dumb and annoying
you cant access the repos un authorized
but it is already here
iirc you can add a username + github secret so you just have to add a username = "username" & password = System.getenv("github_secret") then in the workflow just pass an env var as github_secret: ${{GITHUB_TOKEN}}
git init
Git is for version control, its real nice to have, but not necessary (but some would argue it IS necessary)
to host HTML web content, u would use software like Nginx or Apache
they may be referring to github pages
oh
then yes they will need a git repository
<github username>.github.io will be the repo name
like this?
thanks
follow how the link goski sent to add the variables but yeah
I am getting this now
👍
hey yall i was just wondering how stressfull upating a players persitentdatacontainer is because i want to have like player levels and instead of storing them in a database you can store them in persistent data container for that player, but i dont know if it is better on the server to store them in a map and save it to the player every once in a while or if i should just save it directly to the persistentdatacontainer
Hello, how can I get the highest block in a chunk ? (with a good accurate)
I think you can just store them in pdc directly
im only unsure about when you like relog or whatever but I assume its getting stored in player data
e.getview.getttitle i think
its saved on relog and server shutdown cuz its persistent
thats why im worried about stress on the server
oh nah you are fine
there is already a lot of player data that gets saved already
so adding like an int doesnt make it bad
thats what pdc is meant for
don't compare inventories using titles
my problem is id be updating it constantly, like whenever a player breaks a block or kills a mob
thats fine
ok good to go thank you
please read the thread I sent above it pertains to actual well managed inventories
I highly reccomend reading and understanding what the thread has to say
is there a good way to have text above a players head besides sending armor stands with packets?
or create an inventory holder class
heh, arent u working on a PR for this @young knoll
yeah he is
maybe with scoreboards?
those new 1.19.4 display entities 
yes they are sexy arent they
idk i havent used them
well, they are
I hope my new Inventory#setTitle PR discourages people from using InventoryView#getTitle to check what inventory they are in
Now knowing that it can be changed it should be obvious its nolonger a safe way to compare inventories
declaration: package: org.bukkit, interface: World
well
or it will do the opposite
Could you please link the pr in question?
that's why I added "with a good accurate"
"hey I can change the title at any point, this means I can make wacky comparisons"
yes, so load the chunk before using the method
😭 that'd kill me
that is what it means
maybe, but it would not surprise me
I do hope it makes it more obvious that THIS can be changed I better not use this as an ID for an inventory
like it would be an easy way to change what events are handled by which inventories just by checking an setting their titles dynamically
"You've logged in" 😭
Still no basecomponents there 😭
Spigot adds that stuff
it was out of scope for the PR
thats @worldly ingot 's job
tps 
Is there a pr in the works for that?
yep
Choco is working on all things components
still waiting on choco
yes choco has a PR to Component-ize spigot
whats your usecase
generate structures
with a populator
so I think it's a bad idea loading chunks
now we need a native Bukkit implementation of Components and well be golden
I doubt that would ever happen
oh i just got a disgusting idea
what does java yell at, same method name, different return type, or same method name, different parameter types
the former one if any
because the second is just operator overloading
which is a feature believe it or not
yea as i was typing it i was like wait this is literally overloading
Where? No idea how to search for these things 😭
oh yeah
u also need a stash account to see the PRs p sure :v
yes ^
which means you need to sign CLA
sacrifice ur life to Michael D5
ur a CLA
michale tardis 5
💀 wtf happened that PR hasn't been updated since october
me personally i am a big bungee chat components enjoyer
you need to load chunks anyways in order to generate structures
so not entirely sure what the issue is
don't let adventure fans hear that
you'll get ripped apart
frostalf feels like talking to chatgpt except its a real person behind the screen
i like chat components until I want item names and lore
how so?
o.O
idk
cuz u are robotic
I am?
think ive pinged choco at least once a month mentioning components the past 3 months
we all do
i wonder how paper will react if my PR gets accepted 
theyve already had one of the 2 methods i pr'd since 1.16 api
what PR
send a link lol
not sure, they are probably too busy messing with their multi-threaded stuff
yeah I am not a fan of it, I will probably never use it either
all theyll have to do is remove like 2 patch files anyway
1 api 1 server
i basically had the same implementation anyway by coincidence, only now i just directly access a field instead of using a setter
same method name too so their api wont need a redundant entry :p
I suppose it was eventually bound to happen some sort of implementation for what they are doing
I say paper explodes
one day paper will finally stop using spigot
god i Hope so...
hard fork 🦀
nah im joking
how could you hannah
i havevnt talked to you enough to know if you are robotic
i am my reviewer 
i removed him bc i looked at other PRs n saw like they didnt have a reviewer assigned
so i was like maybe i shouldnt have done that
so i removed md
its fineeee
funnily enough he checked out the PR like a few hours later
commented on my CB impl to do a more minimal diff
hes only gonna delete you off the face of the earth
true
interesting
why is it blue
stash borkered
real
git goober
just refresh cache
it loadsed now
by default bitbucket is blue then...
yes?
?paste
declaration: package: org.bukkit.generator, class: BlockPopulator
this does not remove the fact that a chunk needs to be loaded first
this allows one to change or add blocks to a chunk that generates automatically
or to a chunk that loads
does anyone know why this error is occuring?
im dynamically loading all libraries in a file libraries.txt, downloading them from repos, into a URLClassLoader called libraryLoader
all libraries are loaded into libraryLoader successfully as Class.forName("someLibraryClass", true, libraryLoader) completes successfully
but when i try to execute the actual program using
// find URL for JAR of bootstrap class
ProtectionDomain domain = ClusterBootstrap.class.getProtectionDomain();
CodeSource source = domain.getCodeSource();
URL file = source.getLocation();
// create child loader with our JAR file
URLClassLoader appLoader = new URLClassLoader(
new URL[] { file }, libraryLoader);
// load cluster class and execute
Class<?> cluster = Class.forName(
"net.neonpvp.Cluster",
/* initialize */ true,
appLoader
);
cluster.getMethod("execute", String[].class)
.invoke(null, (Object) args);
i get an error saying it cant find one of the library classes, which did pass the direct Class.forName test
the boostrap (main) class: https://paste.md-5.net/fedaruwine.java
the error: https://paste.md-5.net/ovasiluket.txt
The name of that class should give it away in what it does or its purpose is anyways
it populates blocks to be used
hence, if you read the javadoc comment, it says it can also be used in combination with a chunkgenerator
which is ideal if you wanted to alter or have custom chunks generated automatically instead of just changing them after they are created
so the chunkgenerator needs a blockpopulator to know what blocks it needs to have
Can someone help me with this
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), new,(this), 1,p); 2L)
It says:
Identifier expected Not a statement Unexpected token
how can i make a command in my plugin override the command from another plugin
dear God
Sorry, im new to this
its okay
u almost got it right so thats good, just a little off the mark
the new,(this) part is very not right
that should be a Runnable that executes code inside a run() method
the part after it isnt very correct either
Which one is more efficient
public static Collection<Component> mm(List<String> strings) {
Collection<Component> components = new java.util.ArrayList<>(Collections.emptyList());
for (String string : strings) {
components.add(miniMessage.deserialize(string));
}
return components;
}
or
public static List<Component> mm(List<String> strings) {
return strings.stream()
.map(miniMessage::deserialize)
.collect(Collectors.toList());
}
So what should i replace with what?
?jd-s 1 sec i gotta see the params of the run task method
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
Why did they remove spigot?
alright, so scheduleSyncDelayedTask takes 4 arguments
or wait i read the repeating one woops
alright
it takes 3 arguments
spigot was never hosted there - you need to build it manually with buildtools (anywhere on ur pc) so its in your local maven folder (it will go there by itself no need to copy anything around) , then what you have will work fine
the first one is an instance to ur Plugin, which u provide via Core.getInstance(), the second is a Runnable, this is what code will actually get executed when the task runs, and the third is a delay (in ticks) that the server will wait before running ur code @quaint mantle
ie.
scheduleSyncDelayedTask(Core.getInstance(), () -> Bukkit.getServer().broadcastMessage("hello, world!"), 20L);
that code will print "hello, world!" into the game chat after 20 ticks (1 second)
the () -> broadcastMessage... part is the actual task, theres many ways to write it
So i can replace mine getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), new,(this), 1,p); 2L) with Bukkit.getServer().broadcastMessage("hello, world!"), 20L); right?
that will send a message immediately; not delayed
ur original code doesnt hint at what it does, either
its not valid code, either :v
ur erroneous code is the new,(this), 1,p); part
Sorry im completely losted right now
u would do getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> { /* DO CODE */ }, 2L);
where /* DO CODE */ is whatever u need to run 2 ticks later
you are too advanced for them it appears
im not a very good teacher :v
i can sign off with this tho
?learnjava
maybe they are just not a good student
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
So is this right?
getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> { 1,p }, 2L);
ur getting close-ish
what is 1, p ?
that still is not valid java code
what exactly are you trying to do?
Its on a player death listener
Here is it all
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import static org.bukkit.Bukkit.*;
public class PlayerDeathListener implements Listener {
public PlayerDeathListener() {
RegisterClass.newListener(this);
}
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Player p = e.getEntity().getPlayer();
e.getDrops().clear();
getServer().getScheduler().scheduleSyncDelayedTask(Core.getInstance(), () -> { 1,p }, 2L);
p.updateInventory();
but what are you trying to do 2 ticks after that event (in the scheduled task)
you should avoid star imports
My advice: Dont use a lambda expression.
- Create a new class
- Let it implement
Runnable - Create an instance of that class
- Pass it in the
scheduleSyncDelayedTask(...)method
Lambdas are often very confusing for fresh devs
yeaaa, i did mention new class somewhere instead
Justorg.bukkit.*?
oh maybe i didnt
no, avoid them all
that is still a star import
you should explicitly declare the specific imports you are needing
oh i meant to build upon this by saying use a class that implements Runnable since itll be easier to comprehend but i mustve yeeted the msg
fortunately in most cases the star import typically gets turned into a proper one, however on some occasions you can inadvertently add all the imports under the package you put the star for which just clutters and wastes space on the metadata
I cant this....
Do your guys have any method on how i can fix it, i just wanna get it fixed
you are running a task, one that will run 2 server ticks after a player dies, what is it that youre trying to run those 2 ticks later
1, p is not valid java, and your code has no context for what is supposed to happen
we just need to understand why youre trying to do, your end goal
hey, im working on a custom spawners plugin, and i change the spawner types by CreatureSpawner#setCreatureTypeByName()
the spawners work fine normally when the player is opped, but when deop players place it, its an empty spawner (or a pig spawner if server is 1.17.1)
does anyone know why this error is occuring?
im dynamically loading all libraries in a file libraries.txt, downloading them from repos, into a URLClassLoader called libraryLoader
all libraries are loaded into libraryLoader successfully as Class.forName("someLibraryClass", true, libraryLoader) completes successfully
but when i try to execute the actual program using
// find URL for JAR of bootstrap class
ProtectionDomain domain = ClusterBootstrap.class.getProtectionDomain();
CodeSource source = domain.getCodeSource();
URL file = source.getLocation();
// create child loader with our JAR file
URLClassLoader appLoader = new URLClassLoader(
new URL[] { file }, libraryLoader);
// load cluster class and execute
Class<?> cluster = Class.forName(
"net.neonpvp.Cluster",
/* initialize */ true,
appLoader
);
cluster.getMethod("execute", String[].class)
.invoke(null, (Object) args);
i get an error saying it cant find one of the library classes, which did pass the direct Class.forName test
the boostrap (main) class: https://paste.md-5.net/fedaruwine.java
the error: https://paste.md-5.net/ovasiluket.txt
Just found out that i didnt need it anymore.....
But i got this other ploblem..
(new 1(this, item)).runTaskTimer(Core.getInstance(), 2L, 1L);
identifiers cant start with a number
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Did you shade jgit?
thats exactly what im trying not to do
im trying to dynamically load the libs
so the jar isnt like a gigabyte
Are you on 1.17.1+?
but it takes so long to build and transfer bruh
You might have two different classloaders. And the one trying to instantiate CredentialsProvider
might not have it on its classpath.
and the loading works
Check which instance the classloader is before you get this exception
i dont know exactly how java classloading works but basically i have a loader structure like this
AppClassLoader (by JVM)
- libraryLoader - URLClassLoader with all libraries
- myAppLoader - URLClassLoader with the applications JAR file
-> loads the main class, so it should have access to all libs right?
and im loading the main class like Class.forName("mainClass", true, myAppLoader)
i cant
i think
oh wait maybe
to be more precise, the classloader needs to delegate to the higher one for the actual loading
this way problems like this are not encountered, assuming the libs/jars being loaded also don't load their own classloaders and if they do hope they delegate to the higher one as well
wdym
the library loader has the jvm app loader as its parent if thats what you mean
every loader has a parent, but that doesn't mean the parent is the one actually loading any classes or is delegated to do so
there is a hierarchy when it comes to class loaders
and this is how classes can see each other or not see each other

