#help-development
1 messages Ā· Page 2257 of 1
charset broken
PRs are always welcome š
You seem to be having fun with server internals lol
Inventories are notoriously messy
Server internals are always fun
If I weren't under 18 maybe I'd start doing prs but when I get home I'll probably just fork and dig around fuck with some changes
Why does it matter how old you are?
Le contract
Anyone under 18 in the US is not legally allowed to enter into a contract if any form without parental signing
lmao
Applies to any contract iirc
Everyone here is so extremely young that I start worrying about what I say here lol
There are generally specific clauses in the contract that states you require parental co-signatures
Bruh im not 5 lmao
11
6 at most
Holy shit if I could code this well at 6 I'd be so crazy good now
I'd be likely producing less shit code then I am now
Ah, Spigot CLA does say parent signature if < 18
If You are less than eighteen years old, please have Your parents or guardian sign the Agreement
mbmb
Not all contracts have that clause
No contributions from me for the next 2 years. Not like I have anything to contribute then my shitty code
It probably depends on the countryās laws too. In germany you can sign contracts with 8, or 13 if its not a āthis is only good for youā contract. No idea on how to explain it in english lol
Right, unless the contract says otherwise heh
Hi, does someone know how the server tells the client to not e.g. take an item out of an inventory if the client clicks on a slot in an inventory?
Check inventory click event implementation
Could not find anything packet related in the stash yet, maybe im blind tho
You need to go to implementation
i think the term youre looking for might be consideration
and its 7 or 14 iirc
Idk lol
how do i tell the stupid compiler that it wont be null lol
Supressions
i cant
surpress or Objects#requireNotnull
Just do @SupressUntrueWarnings
Though the digital age of consent is 16
Don't ask how I know
Basically sends the client a response packet depending on the action they took in the inventory saying "NO!!! >:(("
c: i clicked this item
s: shit u put that back right this second
Basically
Yo me too!
the only thing i hate is that you dont need ;
Hm no
u dont even need commas for switch branches
Thankyou š
more stuff but i forgot
structs
š
struct Rectangle {
width: u32,
height: u32,
}
impl Rectangle {
fn square(size: u32) -> Rectangle {
Rectangle {
width: size,
height: size,
}
}
fn area(&self) -> u32 {
self.width * self.height
}
fn can_hold(&self, rect2: Rectangle) -> bool {
self.width > rect2.width && self.height > rect2.height
}
}``` good code no cap
unsafe impl Rectangle for u32 {
}```kekw
Yes, hence you are Not allowed to use discord in Germany If you are 15 or younger. Most disregard that, but that is the case
hehe i see youre following the guide thing
You have a tough time registering for anything on the net If you are blow 16
the end thing is very nice
reading one chapter a day
multithreaded webserver lol
i saw a snak peack by accident
yeah
im very excited
didnt understand any of the code
so i jumped back to chpater 5
lmfao
How do I remove tab completion from specific commands?
How can i calculate Velocity in the same way as server does?
serverSocket.accept() does not return any Socket object, but calling new Socket(ip, port) on the client works fine. I can even send data to the client's outputstream. But on the server (BungeeCord) I never got any socket object from serverSocket.accept() so I cannot send / receive data. This method is running in a different thread. Waiting for connections... is printed
I mean Velocity that applied to player when it gets hit
It didn't make sense what this thing return
Actually maybe it is, but it didn't help me anyway
its not very accurate i don't think
sadly, your getting that velocity from the server, and that is NOT accurate. The client-side velocity should be more accurate. i dont know if you can get that tho.
how can i detect when a falling block turns into a regular block
google it
i did...
already found somethin
I want to emulate hit by player, I don't think that method could help me
Oh it's FormBlockEvent
I was close :((
Read further down the thread. I'm right. Change block event

what kind of hit? like a w-tap hit, a non-moving hit?
W tap + kb1
okay so toy with pushing a player back until it feels right
and also push them a bit up cause of that w-tap
There is no way to make it exact same way as server does?
i dont think so, without using nms
It should be pvp bot that standing still and hits players nearby
then you want to use nms
how can i get the vector i need to get a fallingblock to go to a 2nd point from a 1st one kinda hard to explain but i have 2 entities one 5 blocks above the other and i want the falling block to spawn at the 1st entity (which i have) and i need it to have a velocity to go to the 2nd one i have fb.setVelocity(targetLocation.toVector().normalize().subtract(startingLocation.toVector().normalize())); but the blocks just fall
ive been here so long to ask 1 question lol
you need to magnify the velocity its a unit length of 1 so its small/
thats what she--
fb.setVelocity(targetLocation.toVector().subtract(startingLocation.toVector()).normalize().multiply (5));```
ah thanks
Which packets should I use to give a player a custom nametag
I cannot find the ones I want with protocol website
is it better for a vanish plugin to hide myself for all players or only for the players on the current world and listen for worldchange and do stuff?
public final class Cloud extends JavaPlugin {
@Override
public void onEnable() {
Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
File dir = new File(addonPath.toString());
if (!dir.exists()) {
dir.mkdir();
}
Bukkit.getLogger().info(addonPath.toString());
File[] listOfFiles = dir.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
getCall(file);
}
}
// Plugin startup logic
saveDefaultConfig();
}
public void getCall(File theJar) {
try {
URLClassLoader loader = new URLClassLoader(new URL[] { theJar.toURI().toURL() },
Cloud.class.getClassLoader());
Class classToLoad = Class.forName("newJar.org.cloud.addons.test", true, loader);
System.out.println(classToLoad);
Method method = classToLoad.getDeclaredMethod("test");
Object instance = classToLoad.newInstance();
Object result = method.invoke(instance);
} catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
| InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}``` Okay so I'm trying to access a jar in my addons folder and I'm getting this error
``` java.lang.ClassNotFoundException: newJar.org.cloud.addons.test ```
Here's the jar class its trying to access
package org.cloud.addons.test;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class Test extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
public void test() {
System.out.print("test");
}
}
Also as and extra, how would i do the same, like allow the jar im accessing to access my api and keep its classes and methods saved
why not getting the plugin via the pluginmanager and calling ::getClass?
anyways is calling == on world objects fine?
the jar is in a folder inside the cloud plugin's config folder
lol
i found some stuff there, mby thats more simple xd https://gist.github.com/IllusionTheDev/b770d8e2ffd7a7d80351686c5ea46963
gfu
Hey, I'm doing player.breakBlock(block) but the breaking sound is not played, how can I add a breaking sound depending on the block breaked?
Which packets should I use to give a player a custom nametag
I cannot find the ones I want with protocol website
cmon guys plz
can u be patient /
not rlly
dude
can i register a plugin outside a plugin folder?
can i load it tho?
or if i cant how would i approach this?
Is there something like a EntityTick event or how do we evaluate code around a specific entity on an ingame tick?
minigames plugin that has a huge api but the minigames come in addons
i wouldnt let those minigames come in their own jar
hi
well i want the core plugin free, but the minigames not free
so other creators can make addons
Well, you could turn the core into an API, so creators can use that in their addon plugins
thats what hes doing
i'd say just make an api and let those minigames be.. ah got ninjad
the thing is, i also want to learn how to add addons to like a folder inside config, not just a plugin.
He is probably referring to the plugins being loaded by the parent plugin, but it uses the api of the parent
How do I explain this
let the addons be separate plugins which are either free or not free
which use the api that the core plugin provides
like a lib for mini games
So you want to specifically have the addons being loaded form a different folder other than plugins?
yes, so you can load new addons without /restart or /reload
an array lol
You are basically making plugman but even worse
english was difficult at that moment
Well, you could have a /plugin reload command that you api uses to reload the plugin addons without having to restart the server
i dont understand why dont just enable those addons when they are in the plugins folder
you will run into a linkeshashset of issues
@paper viper š
Lol
does that even exist idk
bump
do u guys know why i get this error tho?
So you are going to ignore usā¦
what error lol
Hey, I'm doing player.breakBlock(block) but the breaking sound is not played, how can I add a breaking sound depending on the block breaked?
i dont want to but i want to
I mean we arenāt the type of people to rlly lead you the wrong direction
yeah, do u think i could just load the plugins from that folder?
with the pluginclassloader ye lol
what about the loadPlugin method?
fb.setVelocity(targetLocation.getLocation().toVector().subtract(baseLocation.getLocation().toVector()).normalize()); with this the armorstand at the bottom has a fallingblock spawn on it which is supose to shoot to the 2nd armorstand, the x and z work fine but the y value doesnt seem to corrispond to the others? its way to low https://cdn.discordapp.com/attachments/829796363188830218/993893604181418025/unknown.png
And use your API
organization man
also i can delete it more easily if i have too
Look at WE
Or ProtocolApi
Does it have an addons folder?
Or even go further and look at mods
Mods have libraries and they are loaded separately
Donāt add unnecessary work for yourself
what is the best way to detect when a player puts an item from their inventory into another?
eyoo is it safe to compare world objects with ==?
probably
as they come from Bukkit.getWorld
Unless they get unloaded and loaded again or something
i have a custom command /giveObject
if i do /giveObject player1 how would i make it that the command runs on player1 and not on the sender
Bukkit.getPlayer(cmd arg)
(i tried looking at the spigot wiki, but wasnt much what i could find)
ohoho, so all the things you need to create out of nowhere, they are in the class Bukkit
- get the 1st argument
args[0]
and then pass it inBukkit.getPlayer(args[0])
and this possibly returns a valid player
if it is a valid player, do your stuff
also, validate the name and make sure its not wrong as that might give u errors if u dont handle em
Sadly
Hey, I use player.breakBlock(block) but the breaking sound is not played, how can I add a breaking sound depending on the block breaked?
ty
is there a method called breakBlockAndUpdate or something which also updates?
o.O Player#breakBlock() should 100% play the sound
It literally just forces the player to break the block
I use it for vein miner and there's sound iirc
so you are the person who made Vein Miner?
Yeah he made it
no
anyone?
sheeesh big fan sir
You can do block.getBlockData().getSoundGroup().getBreakSound() if you'd like and just play that to the player if you're not getting anything
but I'm certain it should play it
might be smth with the client?
too bad the video doesn't want to be sent but I can confirm that the sound is not played, but thanks to that
I was certain it did. Maybe I'm wrong
but yeah, those are the methods you want. getBreakSound() returns you a Sound, you can just World#playSound() that
Not Player#playSound() ?
Player plays it for that player
Well, World#playSound() will broadcast it to all nearby players, much like what would happen if a player broke a block normally
If you want it to be sent just to that one player, then the one from the Player interface is fine
Oh thanks I will do World#playSound() in my case
But little problem, the sound played when you break a block of dirt is the sound played when you break an iron block
Wot
From getBreakSound()? You're doing this before you actually break the block, yeah?
If you do it after, the default sound may be stone (which iron uses iirc)
Oh... I'm dumb you're right
(you can use the SoundGroup#getPitch() and #getVolume() too by the way)
Nice I will do that too
.getH is not a method
Make sure itās a living entity just
obviously lol
fb.setVelocity(targetLocation.getLocation().toVector().subtract(baseLocation.getLocation().toVector()).normalize());
with this the armorstand at the bottom has a fallingblock spawn on it which is supose to shoot to the 2nd armorstand, the x and z work fine but the y value doesnt seem to corrispond to the others? its way to low https://cdn.discordapp.com/attachments/829796363188830218/993893604181418025/unknown.png
can i cast it to a living entity
Why doesn't this work?
check instanceof Player and then cast and use the casted object to get the health
@tardy deltayou were right about the errors lol
somebody said i get a lot of errors
i got one
and i have NO IDEA WHAT IT MEANS
What did it say to begin with? lol
duplicated code aaa
https://paste.md-5.net/nabutimefa.java
?
The `error`
here
public final class Cloud extends JavaPlugin {
public List<Plugin> addons = new ArrayList<>();
@Override
public void onEnable() {
Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
File dir = new File(addonPath.toString());
if (!dir.exists()) {
dir.mkdir();
}
Bukkit.getLogger().info(addonPath.toString());
File[] listOfFiles = dir.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
try {
Plugin addon = getPluginLoader().loadPlugin(file);
addons.add(addon);
getPluginLoader().enablePlugin(addon);
} catch (InvalidPluginException e) {
throw new RuntimeException(e);
}
}
}
// Plugin startup logic
saveDefaultConfig();
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
package org.cloud.addons.test;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class Test extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
getCommand("test").setExecutor(new TestCommand());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
``` addon code. and it cannot invoke getCommand becuase it returns null
My condolences
Looks kinda fun tho
well the command handling is less pain now when using acf
JadeStudios you did not declare the command in your plugin.yml
i did tho
hehehe
And try again :3
okay
switch looking pretty hot there
Oh well youād have to maybe inject bytecode
@ivory sleetshould i mention that the plugin im loading is inside a folder called addons inside the plugin cloud's config folder? but same error
Or other crazy stuff in case you wanna run it on another jvm instance
Wait
Ugh
The Plugin api is not meant to be implemented this way Jade Iām afraid
then whats the loadPlugin method for?
That is for enabling or disabling actual plugins
also it is an actual plugin, just not in the plugins folder
okay so my this is what is looks like
- plugins
- Cloud
- Addons
- THE JAR FILE
if itās an add-on system donāt use the plugin api spigot has
Extend ur own url class loader or sth
can anyone help with this?
I believe placeholder api and luckperms are good examples for you in this case
yeah i tried doing that but a ton of errors. but i don't know how i can access spigot stuff from something thats not a plugin thats in another jar
It is a bit hard
What exactly were you not able to access a
Apart from the command
You might have to disable gravity
Or add extra height
its not enabled if i have it enabled it sends the block to space
and when the armorstands are abvoe each other it works fine so adding extra height would mess that up
That was me
try {
URLClassLoader loader = new URLClassLoader(new URL[] { myJar.toURI().toURL() },
CustomClass.class.getClass().getClassLoader());
Class classToLoad = Class.forName("newJar.org.cloud.addons.test", true, loader);
System.out.println(classToLoad);
Method method = classToLoad.getDeclaredMethod("test");
Object instance = classToLoad.newInstance();
Object result = method.invoke(instance);
} catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
| InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
``` this was the code i was using
gimme a sec to replicate the error

Which command api is that
acf
Anyone know of a website that shows 1.19 Mojang mappings?
Screaming mappings
@ivory sleet```java
package org.cloud.addons.test;
public class Test {
public void test() {
System.out.print("test");
}
}
@Override
public void onEnable() {
Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
File dir = new File(addonPath.toString());
if (!dir.exists()) {
dir.mkdir();
}
Bukkit.getLogger().info(addonPath.toString());
File[] listOfFiles = dir.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
getCall(file);
}
}
// Plugin startup logic
saveDefaultConfig();
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
public void getCall(File jar) {
try {
URLClassLoader loader = new URLClassLoader(new URL[] { jar.toURI().toURL() },
Cloud.class.getClass().getClassLoader());
Class classToLoad = Class.forName("jar.org.cloud.addons.test", true, loader);
System.out.println(classToLoad);
Method method = classToLoad.getDeclaredMethod("test");
Object instance = classToLoad.newInstance();
Object result = method.invoke(instance);
} catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
| InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}``` main class thing
@ivory sleetand i get classnotfound
Just use the plugins folder
Just create an API and make the mini games their own separate plugins that use the API
Man
dude im just trying to learn how to do this
if i was making a good api i would do that
And?
but im not, im trying to learn how to do that stuff
You are still going to have to use the core API either way
not true
If that wasnāt true, then what would be the point of your mini game pluginā¦.
Iām just saying that you can avoid the error and save a load of time
how about instead of yelling at me, try to help me
Iām not yelling at you, Iām just trying to give you advice that will help you and you are refusing to listen.
because thats not what im trying to do
Because your problem is an XY problem
?
Ugh whatever
?xy
Asking about your attempted solution rather than your actual problem
i better had commented my old code smh š„ŗ
idk why the error is appearing tho
@tardy delta ```java
org/cloud/addons/Main has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0
does getWorlds.get(0) always return the overworld?
Stop pinging people smh
Maybe you should do Bukkit.getWorld(āworldā)
the java version you compiled with is newer than the java version you are using to run
You can set another compile version in maven
oh yeah thanks
Depends on Spigot version
OKAY so i accessed the jar, i can run stuff on it now, but how the hell should i run spigot stuff on it????
Elaborate?
so it will take java17 in like mc1.18
it takes java 17 in mc 1.10 too
stuff ON it?
okay so this is my main class```java
package org.eternitystudios.plugins.cloud;
public final class Cloud extends JavaPlugin {
@Override
public void onEnable() {
Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
File dir = new File(addonPath.toString());
if (!dir.exists()) {
dir.mkdir();
}
Bukkit.getLogger().info(addonPath.toString());
File[] listOfFiles = dir.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
getCall(file);
}
}
// Plugin startup logic
saveDefaultConfig();
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
public void getCall(File jar) {
try {
URLClassLoader loader = new URLClassLoader(new URL[] { jar.toURI().toURL() },
Cloud.class.getClass().getClassLoader());
Class classToLoad = Class.forName("org.cloud.addons.Main", true, loader);
System.out.println(classToLoad);
Method method = classToLoad.getDeclaredMethod("test");
Object instance = classToLoad.newInstance();
Object result = method.invoke(instance);
} catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
| InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Yes
package org.cloud.addons;
public class Main {
public void test() {
System.out.print("test");
}
}
``` heres the addon. it accessed it
the addon jar is located in the config folder of the main plugin
and i want it to access that and run something back on the server but from the code thats on the addon
why are you doing that via reflection? o.o
im tryna learn reflection
do u know how i could do that
So you package the addon inside your jar?
the folder is like this:
plugins:
Cloud.jar
cloud:
addons:
addon.jar
config.yml
so its external actually
that won't work then
It has to be loaded
so either another plugin or compiled inside your own
why not just letting those addons be loaded thro the plugins folder š¤
Is there a way to disguise a player as another player? Like when using commands and stuff it would think that it's the other player executing it?
as your core plugin provides an api
@flint coyoteokay so i want other people to make the addons but i want them in a addon folder, is there anyway i can do that besides another plugin?
Why not just let the addons be different plugins?
Those plugins could then implement an interface that you create in your core and deliver the instance via an api that you provide in your core
thats whar we are telling the whole time now
So basically they would "register" and then go idle/can be disabled
idk I didn't follow the whole convo xD
What is better for performance?
@flint coyotei really want u to reload just those addons those without restarting the server
so u can add more easily
Yeah he just refused to listen and waited for other people to give him the same advice lol
You can add spigot plugins during runtime (like /reload does) but there isn't an easy way to do it.
Changes to plugins during uptime isn't intended since it can lead to unenjoyable sideeffects
any resources to do that?
Well in that case - that's what I did xD
Lol
There's some forum posts on spigot. Feel free to check them out but I still highly advice you to not implement it like that
how else could i?
I just told you o.o
oh yeah api
wait @flint coyote can i still load plugins normally even if they arent in the plugin folder
im gettin braindamage of this conversation š„
im just curious
Obviously you can but it will just be a lot of "hacks" around spigot that might break every update
/execute (playername) ~ ~ ~ (command)
:xd:
There's a reason that while running a 0 downtime web-application you provide multiple instances. Applications are not made for code base changes during runtime
#help-development gave me dementia
oh uhh
i mean like load the plugin at startup when the other plugins load
but in a different folder then the pl folder
No just
Just leave things in the plugins folder
Just make it the same folder
Yeah
And make depend attribute in plugin.yml handle loading
You can take spigots code and replicate the plugin loading. But that's unnecessary work. Please just take the way we provided. That's the common way of doing it.
anyone experience with acf and knows if i can do stuff like
void onAction(Player sender, String action) but with knowing the action at compiletime, so i can write different methods for each action instead of having to use a swwitch?
okay
im sry i like making things overlay complicated
acf docs kinda suck
šæ
Why not use a class to represent actions?
Then you can add a mapper or whatever itās called in ACF
then i would have to parse those and still handle stuff differnently on each case :/
wait are they any resources for plugin api's
wdym?
I mean fourteen register a context
I mean a single function can be your api if that is sufficient. And in your case you probably just want a "registerAddon(...)" function with some parameters
how do i access that api from another plugin
And well, if the argument is invalid just throw InvalidCommandArgument or whatever ACF calls it
You can build it locally if you use Gradle or Maven
Or you could use a repository manager
You use the core plugin as a dependency. Basically just as you are using spigot right now
ohhh
Having an addon system isnāt overly complicated
Itās just not beginner friendly
But it becomes essential for independent redeployment
yeah I'm trying to do that rn, I believe the only thing I am struggling with is di... cant wrap my head around it
conclure could you explain a bit more on how to handle those different actions, i have a commandcontext then which represents the actions, what then?
handling them internally in the action or smth?
Wait can you show me the initial code? With the switches that is
Well
di?
Dependency injection?
yeah, ive looked at the di page from the command a couple times. maybe i gotta watch a few youtube videos
Oh well isnāt that just passing objects to functions?
or well doesnt @SubCommand("action") work for such purposes
vanish enable
vanish disable
etc```
(To simplify)
I assume
I shall elaborate
I shall listen then
Technically yeah
If the sub commands are literals
And not arguments
``` does this work in online mode or would it like kick the target player?
uhh whats the difference
/eco <add|remove> <player> <amount>
subcommands vs arguments that you pass in (for example player name) or smth?
The plugin instance is supposed to be non static, correct?
That means I would have to have an instance of the plugin to get an instance of the plugin?
I dont know how to get the instance for getting the config file for example in the same plugin and in the dependencies
Here add and remove are literals/real sub commands
<player> and <amount> are arguments
ah ye then i understand
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Thatās the way mojang handles it also btw
makes sense
Yeah Shreb instances canāt be static
Well
Most systems do it like this
They use reflection, method handles or unsafe to instantiate an instance of a/the main class of an addon
Which spigot for instance does
bruhh i was such an idiot when i wrote this code
would it be possible to make a dependent plugin by getting the instance of the dependency via Bukkit#getPluginManager()#getPlugin(), casting it and doing whatever? or would that not get the actual instance of the plugin?
ok, thats easier to understand for me
switch on its best
Gosh, a pseudo lambda switch š„²š„“
Just make sure it's the right version or else you'll create massive black hole of errors
I have the functionalities of my dependency nailed down to a point where it should no longer be necessary to change, just to add. Thank you for the heads up tho š
ItemStack it = new itemstack(material)
hello, how would I check if a player has this itemstack in inventory of any amount greater than 1?
is a playerquit event fired when the whole server crashes and all players are kicked?
no
That's unreadable af lol
crashed server send no packets
If youāre lucky
ah f*
Some players might be disconnected before the server explodes
only when you lambda them
šš
p.getPlayerProfile().update();```
Any idea why this isn't doing anything?
Does anyone here have any idea why .getCenter() returns an empty location (location{world=null,x=0.0,y=0.0,z=0.0,pitch=0.0,yaw=0.0})?
i want to be sure that this is correct
wait isn't the worldborder center 0 0 0 by default?
Maybe the world border is world independent
So unless you set another center for that player it will be 0 0 0
Its set to a location, the wb exists, for this player.
and it's the only one online?
getting a random player?
use Player randomPlayer = Bukkit.getOnlinePlayers().iterator().next() instead
If you like two liners
can you print the worldborder size? is that correct?
streams are expensive
it is correct.
I don't believe that's all too random
I'd advise use of Iterables instead
Iterables.get(Bukkit.getOnlinePlayers(), generateARandomNumberHere)
and the worldborder is not set to at 0?
Anyone know bedrock coding?
oh never heard of that method
The world is also null xD
It'll be failry simple to make one
I'm confused because you check that the border is not null. I would expect a null border to return exactly that
but then again it's a method of border so you would get a npe
You could start a remote debugger xD
https://www.spigotmc.org/wiki/intellij-debug-your-plugin/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Anyone know how to create custom hud in bedrock edition?
because at this point it's either a bug in spigot or you have old code runningš¤
difficult for me
U a plugin dev?
Use the credits plugin api and subtract credits
Use the buycraft api generate coupon
what should i look for?
Check the values of border directly and follow your code until it shows weird values. Then run it again and step into the method that returned weird stuff and rinse repeat
I think the following is causing the error:
When the player joined, I set the WB #1 for the player. When the player updates the WB for himself, I think Spigot saves the reference to WB #1 and does not return the current value.
doesn't /worldborder center set it for everyone?
Yeah
so it overrides the players worldborder
On clientside, yes
why only clientside?
300 lines for a vanish command smh
Myes
myes look if you want
https://paste.md-5.net/usutetaxox.php
Doesnāt look too bad
Iām proud of you actually
ty cutie
we dont code clientside mods here

but I know one mod who can do this
I assume they're making some cheats or smth or else they would ask in the right place
fb.setVelocity(targetLocation.getLocation().toVector().subtract(baseLocation.getLocation().toVector()).normalize());
targetlocation is the location the blocks should be going to and baselocation is the location the blocks spawn at, both the locations are taken from the position of these armorstands in this picture
https://cdn.discordapp.com/attachments/829796363188830218/993893604181418025/unknown.png
the bottom one is the base top is target, the green arrow is what the falling blocks are doing and the red arrow is where they should be going, x and z works fine but the y axis doesnt go any higher then in the pic which doesnt really make sense
I have vanilla optimized modpack but whenever I join specific servers i get kicked out for using fabric
oh boy, Fabric modloader is 1.14+
Why hide it
Because Lunar gives an unfair advantage
Use Vanilla
So you want to cheat
I use it because I have sodium enriched vanilla modpack which allows me to boost fps and some servers just block fabric or forge completely without even checking modlists so I use this to bypass this
How nice of you
its not as If I am using it for cheats
just wait until you make it modproof and cancel packets. It will get worse xD
yes
its modproof
this modlist allows me to get 400-600 fps
Lunar has a history of making pvp smoother by making changes that are unfair and thus are hacks
cmn bro just tell me what to do please
its not about adventage i just want to use smooth client
Doesnāt hidePlayer already get rid of packets?
I thought
but there is batmod and other clients and their client brand is vanilla
New album 'Given by Nature' out now !
ā Download http://merchlinks.com/givenbynature
ā« More music like this? https://spoti.fi/2E2px3O
ā Instagram http://www.instagram.com/uppermostmusic
ā Facebook: http://www.facebook.com/uppermost
ā Soundcloud: http://www.soundcloud.com/uppermost
ā Twitter: http://www.twitter.com/uppermostmusic
OMG I FOUND THIS TRACK
NOSTALGIA
2011
ooh that stuff
it didn't in earlier versions. I don't know how it is these days
Like 99% sure thatās the case now
I remember coding a plugin and using hidePlayer for vanish and my friend couldnāt even see me on tab list
Lol
Hello, someone know how get instance of a ItemStack ?
Hallo
it was always hiding your from the tab list. But packets weren't a thing in like 1.12. Didn't check after that
So i tried to report timings but i am not on pc
yup
And the link canāt take me anywhere can i be helped
I already create instance i want get the instance
Oh hm
Because my server is lagging badly
anyone?
I store the item in Hashmap public static HashMap<ItemStack, Long> cooldowns; but that didn't work like i want
Yup
Hello
Iād recommend to have some sort of identifier on the item instead
Of using the actual ItemStack
a beam with shooting
Anyways
well you can use itemstack
How i get the identifier ?
Is grabbing from the map not working?
Yeah I think he was doing a different object
i am not that familiar with the api š
That work but in all item on the server
Wdym?
Thanks olivo, but the attention is being called to how can i get Timings results from a link I canāt click
NMS itemstacks are being copied when moved inside another slots but bukkit objects arent afaik
just get point a and point b, as vectors, do point b-point a
then u have the offset
That makes so much sense
?
I donāt understand your issue
then divide the vector and add it to point a in a for loop
and u have new points for ur line
spigot has a raycast api that's pretty simple to use
You do what we said. Move to #help-server and send the link. You should be able to copy paste it from the console
?spoonfeed
The cooldown work but for all item from the server on not only with the item i have in my hand
lol one sec
the raytrace thing isnt working, its just a simple ray but the result never returns an entity
i deleted the code]
take my word
Only for one item
I've done some raytracing stuff https://github.com/Adelemphii/Zeus/blob/master/src/main/java/tech/adelemphii/zeus/events/RaycastLineEvent.java don't mind the messy code
Add a UUID to the item with PDC so you can identify them
?pdc
I donāt have a copy and paste function
I'm in 1.8 š¬
I got an idea
Can a player hold multiple of those items? You could also make a per player cooldown.
Yeah
- Update
- NBTApi⦠I guess
Oh well you'll have to do everything the hard way
Get used to that
Use NBT APi for generate an "identifier" ?
private void drawLine(Location l1, Location l2, int subSegments) {
Vector offset = l1.toVector().subtract(l2.toVector()).multiply(1 / subSegments);
for (double i = 0; i < subSegments; i++) {
Location loc = l1.clone().add(offset.clone().multiply(i));
//dostuffwithloc
}
}
No you can use any Identifier. Just use UUID.randomUUID()
i got that down
that works just fine
what do u need then?
So store it using NBTApi or PDC
its just choppy as shit and i also need to get the entities that it hits
ohh well u probably wanna do a raycast then
now i solution i thought of would be rayTraceEntites, 1 block at a time, i just dont know how performant running a raycast (max 40 iterations) per player every second would be
well how many players u expect to be on at once?
Idk
max?
lmfao
So here are the results and I donāt understand any of it
What is causing my server lag and how can i be turned down
i want to save a list of locations that isnt fixed (so everyone can add and remove locations from this list). but this list shoudnt reset when te server reloads, how would i save these locations
i thought about a json, but idk if thats the best go here
fb.setVelocity(targetLocation.getLocation().toVector().subtract(baseLocation.getLocation().toVector()).normalize());
targetlocation is the location the blocks should be going to and baselocation is the location the blocks spawn at, both the locations are taken from the position of these armorstands in this picture
https://cdn.discordapp.com/attachments/829796363188830218/993893604181418025/unknown.png
the bottom one is the base top is target, the green arrow is what the falling blocks are doing and the red arrow is where they should be going, x and z works fine but the y axis doesnt go any higher then in the pic which doesnt really make sense
uhm, you dont mean in the plugin.yml right?
Error : Caused by: de.tr7zw.nbtapi.NbtApiException: [?]Method not loaded! 'COMPOUND_SET_UUID' when i did nbtItem.setUUID("UUID", UUID.randomUUID());
aha, and does it have to be a specific path
or can i just save it in the same loacation as my java script
fair
I don't know the nbt api, sorry
How* you get the identifier of itemstack without nbt api ?
UUID.randomUUID() gives you an identifier. I guess the error is about setting it.
The uuid class that generates it is plain java
Yeah i saw that
Ok NBI API use setUUID and getUUID in 1.14+
That why i have this error
Thx now it's working
i cant find anything about yml, but a lot of yaml
are they the same?
this guy is doing this
List<Employee> colleagues = new ArrayList<Employee>();
colleagues.add(new Employee("Mary", 1800, "Developer", null));
colleagues.add(new Employee("Jane", 1200, "Developer", null));
colleagues.add(new Employee("Tim", 1600, "Developer", null));
colleagues.add(new Employee("Vladimir", 1000, "Developer", null));
// We want to save this Employee in a YAML file
Employee employee = new Employee("David", 1500, "Developer", colleagues);
// ObjectMapper is instantiated just like before
ObjectMapper om = new ObjectMapper(new YAMLFactory());
// We write the `employee` into `person2.yaml`
om.writeValue(new File("/src/main/resources/person2.yaml"), employee);```
but i cant do that
Nope, you need to be verified
oh oof , let me do that first
and access to put pics
i cant verify
cus the server SpigotMC.org doesnt exist
at least that sais my minecraf
or is it a website
it's a website
send pic
the guy is doing this
ok?
what does it say when u hover objectmapper?
yea
oh...
is it really that bad to use sjon, cus thatone i used more ofthen then the yml
never seen yml in my life untill like 3 days ago
yml only exists because json does not allow comments
but yes it's a standard in spigot so you should get used to it. It ain't that hard
I wonder why toml still isn't natively implemented
is there any good docs on how to use yml
cus the onces i find eather dont say anything on how to move data from script to yml and reverse
or just miss things like thisone
YAML Ain't Markup Language (YAML) has a risen in popularity over the past few years. Here's a YAML tutorial to get you started quickly.
thnx
anyone know any html?
I do
I am making a plugin that needs to efficiently check if a player passes through a very small 3x1 passage. I know how to do it with the PlayerMoveEvent, but that doesnt seem efficient. There will be mutliple of the passages, so checking each one doesnt sound too great. Is there another way I could about this? (I dont want to have to use WorldGuard or any plugin like it)
Would packets instead of events be a viable option?
Is it 3*1*1 or 3*infinite*1?
but this is for py
it still explains the yml syntax
which is basically json but spaces instead of square brackets
It is basically json
and linebreaks
yaml is a superset of json
So you can just write json and it is valid yaml code
Best lifehack
If it is just a manageable amount of blocks per passage (which would be the case for 3x1x1 or 3x2x1), you could have a Set<Location> to determine if a player is in a passage
Create a BoundingBox for each area https://hub.spigotmc.org/javadocs/spigot/org/bukkit/util/BoundingBox.html#contains(org.bukkit.util.Vector)
Then in the MoveEvent (ONLY when they move a full block) check box.contains(event.getTo().toVector())
If it is 3*infinite*1 you can make use of a Set<Map.Entry<World, Long>> or similar (where as the long is a combination of x and z coords)
or just write json and use a json to yaml converter
it isnt
it is a 3x1x1 area
Ah then
If you want to do it really fast you can just as well use a boolean[][][][][] and spread the bits out through the indices of the individual arrays
just pointless as I said
Any valid json is already valid yaml
yaml accepts json
Though I am not 100% sure whether arrays are faster than maps for 3D spaces
I know it is but if he publishes a plugin with a config.yml full of json people gonna be like "what? why?"
I know they are faster for 2D spaces (provided you want to use it concurrently, otherwise you'd use LongToObjectMap)
I will try this, thanks!
the fuck
Why would you need a 5d boolean array
can I use reloadConfig() in a command to reload the config?
Yes
But all that does is load a new config instance that will be returned by Plugin#getConfig
So if you're keeping instances of the config elsewhere you'll need to update them
Basically any process you use for loading config will need to be run again when reloading
but basically if there are only messages in the config it'll reload the messages to the server right?
Not sure what you mean by "reload the messages to the server"
The new config will be returned by Plugin#getConfiguration()
That is the only thing that will happen
aight thanks
why when i try to read it, does it give red flags, and the only thing is suggest is "delete unreachable statement"
Show more code
You're likely doing something that is guaranteed to return above that code
but you do know that classes arent methods
naming conventions š
Also you shouldn't be using a path like that in your code
also locations.yml should be in resources
š³ oops
And you should be using nio
And you shouldn't have underscores in your package names
you can
?
you actually should not, word seperation is done with a .
it is very much against package naming convention to do so š
but insted of arguing about that lets
help the @dawn plover with his question
first part is bullshit, but i agree to the second part
its totally fine to use underscores in your package names
please provide me with a source that proves your right
^
and there is no convention that says otherwise
yea XD, i am dumb again, i placed it in a method, as GodCipher said
a quick google search should help you out
there is a convention that says that you should use lowercase and word seperation with .
Google's official style guide, which to my knowledge is the most respected style guide for java, says not to use underscores
You can
And it's not possible to prove that it shouldn't be allowed
a quick google search disproves what you are saying but ok š
It's just against the most popular naming convention out there
https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html does it disprove me?
You've linked the oracle style guide and I've linked the google style guide
There are multiple style guides
Oh my god can you shut up already
...
this is so cringe
Seriously can you shut up
nah
Nobody is proving anything here
I said underscores shouldn't be used
idc
It was feedback, not a compiler error
guys, you know you already solved my problem right?
Yes, GodCipher is just being pedantic

1984
idk but google java style guide says that you shouldnt use underscored š¤
weird
ókey fair enough I guess in this case its a matter of opinion
well google didnt make java oracle does
so he is right although I dont agree
style guide isn't a convention
its a "code like google"
arnt all conventions "code like X" then?
i wouldnt say that, but its getting close
I mean camelCase is seen as a convention in java but I am pretty sure it was made but someone who had nothing to do with java
so arnt all conventions just code like X?
not really. its the standard which is expected in the underlying language
well you could say its a "code like java", but at this point we would just spin in circles
yes but the fact is that its only expected cause someone made it up others liked it and then it became a convention eg a "code like X"
so why umm
if(world.getServer().getAverageTickTime() <= (float)OverlordConfig.spawnerMinTps) return;
gets flipped
strange
You don't need to cast number types for comparisons
what do you mean? All of those are accurate lol
š why does my spawner disable when tps are 20 and config value is 19.8
but it works when tps are 13
Oracle also says this
interesting
how big is reflection overhead when you cache field objects
it sucks how many NMS fields I need are private and final
and there's no setters for them
I donāt think itās too much?
Should be fine
Yes lol
build a lag machine =P
If you want your server to perform poorly and you're on Windows you can lower the priority of the server task
not an option
hell nah im not using windows
oh I'm sure it's a horrible idea lol, just joking
overdrive or something?
Yes
well i spawned like thousand turtles tho
tps still 20 š
is there any clientside mod that purposefully desyncs you from the server
sometimes its useful to test what's clientside and what's not
2^96bit large bitfields :) of course a bit overkill but eh - overkill is Just a myth anyways
Hack clients š¤”
Probably not but you could probably easily make one with fabric
number limits are lame
world.getServer().getAverageTickTime()
whats the timespan or whatever
How do i update a mongo collection when the im not using a document. Instead im using a class object?
You'll have to ask Paper
thank you!
okay so a problem i'm trying to fix for a long time:
i have a method in another class that takes Player for argument.
and i have PlayerJoinEvent fired when a player joins the server, it kinda gives this code
playerjoinevent event{
player = event.getplayer().
class.method(player);
}
but when someone joins it says that class.method(player) nullpointerexception
i know my player is not null, made different checks but i cant seem to understand, its like the player never existed when calling the method
i would assume you are getting the npe from something else in the data.createPlayer method, not the player object
Hello, dumb question...
How can I change where my maven clean install outputs to?
method(player){
sysout(check1)
method body
sysout(check2)
}
both checks arent firing
could you send the exception youāre getting?
I didn't quite understand the question... can you explain a little more please?
Do you mean an external program, which executes some actions on the server?
how am i supose to do this outside the main plugin class
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
this sais the doc plugin.getConfig().set("player-name", name); , and thats what i did right?
.ClassCastException: dev.alex.net.api.claim.Claim cannot be cast to dev.alex.net.libraries.bson.conversions.Bson
Claim class:
@Getter
@Setter
public class Claim {
private final UUID uuid;
private UUID owner;
private Type type;
public Claim(UUID uuid, UUID owner) {
this.uuid = uuid;
this.owner = owner;
}
public enum Type {
User, Admin
}
}```
Database:
```java
public class ClaimManager {
private final Set<Claim> claims = new HashSet<>();
private final Main plugin;
public ClaimManager(Main plugin) { this.plugin = plugin; }
public void load() {
for (Claim claim : this.plugin.getStorage().getClaims().find()) this.claims.add(claim);
}
public void save() {
for (Claim claim : this.claims) this.plugin.getStorage().getClaims().updateOne(Filters.eq("uuid", claim.getUuid()), (Bson) claim, new UpdateOptions().upsert(true));
}
}
Maybe that is not the correct way for saving pojo's
Main user šæ š¤§š¤§šæšæ
I mean the error is literally there. You are casting Bson onto claim and you canāt do that lol
Is there a way to block lightning strikes?
Why not? if it a pojo class
Mongo has an option for using java objet instead of Documents
Let me send an example
I donāt need to look at the API, you just are not supposed to cast there cause itās pretty clear that your class is not a subclass lol
what is bson
Bson is the thing that use mongo for working
Its like a document
Show class
Bson
public class StorageManager {
private final Main plugin;
private MongoClient client;
@Getter private MongoCollection<Claim> claims;
public StorageManager(Main plugin) {
this.plugin = plugin;
}
public void open() {
Logger.getLogger("org.mongodb.driver").setLevel(Level.OFF);
this.client = new com.mongodb.MongoClient(new MongoClientURI(""));
CodecProvider provider = PojoCodecProvider.builder().automatic(true).register(Cuboid.class).build();
CodecRegistry codec = CodecRegistries.fromRegistries(MongoClient.getDefaultCodecRegistry(), CodecRegistries.fromProviders(provider));
this.claims = this.client.getDatabase("test").withCodecRegistry(codec).getCollection("claims", Claim.class);
this.plugin.getLogger().info("Connected to database");
}
public void close() {
this.client.close();
this.plugin.getLogger().info("Disconnected from database");
}
}```
I dont know i just trying to understand how to save the pojo class
Yeah i know it should be extended or implemented to be cast right?
How can I know the private fields from an Entity class?
Yes
Isnāt that an interface?
So how would i save the document pulse?
Yes i think
There are no fields in an interface
Btw let me check
For mongo
Iām on vacation right now and Iām on phone lmao
Well, I'm trying to access a ZombieVillager class fields
Oh, yeah, they are all interfaces
You should use decompiler and check the private fields
ZombieVillager is an interface too
Go to the implementation
But be careful, realize that when you are dealing with interfaces any class that implements it may use it
So make sure that the implementation that you are getting the private fields from is specific
Allrigh really thanks
Look the link i send
You will understand better what im doing
I based on that example
What I actually want to do is to modify the ConversionTime (NBT?) variable in a ZombieVillager without using the method setConversionTime(int time), because when that method is used the "entity.zombie_villager.cure" sound plays automatically
Does anyone know how the placeholderapi ecloud expansion works?
ask them
Or is there a way to silence those automatically played sounds temporarily?
Yes
Ecloud is just a cloud where placeholder api expansion are saved
Its like a maven repository
How can I modify a mob's NBT similarly to the /data modify entity <entity> command?
I need help with placeholder stuff/java scripts
You have to use Reflection
How does reflection allows me to do that?