#help-development
1 messages · Page 2259 of 1
and how can i do a verison control for my plugin (inform op player to update the plugin)?
Go ingame and click your mouse button really fast and then brag about your cps. Usually helps.
you can type fast
maybe you'll be good at 1.8 pvp?
if its not on your server you have to add it to your plugin.yml in the libraries section or shade it into your jar
This is not integrated in Bstats. You would need another framework / approach for this.
It still doesn't work.
i know it not integrated
how do I shade it
you know anything?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how to change player name above head?
teams or packets
thanks
ok so how could i do this with teams
i know that i can change name like global in a team
Hello, I want to loop a .yml file. But:
List<ItemStack> bestellingenList = (List<ItemStack>) main.getSpelerbestelling().getList("Bestelling");
if(bestellingenList == null) bestellingenList = new ArrayList<>();
for (ItemStack bestelling : bestellingenList) {
bestellingen.addItem(bestelling);
}
doesn't seem to work.
Anybody know why?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
can i change name in a team for current player?
I am adding a head to a .yml file what works but if I try to add it in a inventory it doesn't work.
There is no error btw.
is 'you unvanished' english lol
Show your whole code and your config
Alr
everything can be english if you try hard enough
and everyone would understand it so its a word now, your fault.
You mean if you try unsoft enough
bruh
if you try desofted enough, yeah
It's in https://paste.md-5.net/
Oh f its away
gone(
You need to save first
F
Add a debug message and check if the code is even executed.
Also "Bestelling" does not contain a list. Its a single object.
if this is my .yml how would i do .getKeys() inside myMap
so i would get a list<string> with [number1,number2,number3]
But how isn't it a list
Get myMap as a ConfigurationSection and call getKeys() on it.
How do you write in your config?
main.getSpelerbestelling().set("Bestelling", getPlayerHead(plr.getName()));
This sets a single ItemStack there. Not a list of ItemStacks
ohh
thx
this do so i make that when some one is in the invisible_list then thay can't pick up things?
@EventHandler
private void Pickup(PlayerPickupItemEvent e){
Player player = e.getPlayer();
for (int i = 0; i < plugin.invisible_list.size(); i++){
e.setCancelled(true);
}
}
me?
yes
forget it i did fix it
Can anyone explain to me how projectile damage works? in the case of a bow if a player is wearing armor, the damage will be, or if the armor is enchanted
sorry to bother you but did you find anything?
Arrow damage depends on: velocity, power enchantment
Reduced by: Armor, armor toughness, protection and projectile_protection
For details refer to the wiki
Nah im going to sleep now
ah alright
do you know is it possible to make it deal damage by a projectile without having to spawn it?
duplicated code smh
anyways is Collection#toArray(Type[]::new) gonna infer the size for the array?
yes
or well
might
iirc the default Collection#toArray thing just creates it with size 0 ?
but JIT already fixes that anyway
oh well it uses an infunction, i thought the signature was T[] toArray(Supplier<T[]>)
so it infers the size via that i guess
smh cat go off my keyboard
nb;
stupid cat
iirc, toArray(new int[0]) is/was faster than toArray(new int[size]) anyway
hmm
i have
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://imgur.com/a/462PQjL
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
yep
okay i need help, im trying to save mulitple locations in a file for 1 person, how can i do that?
https://prnt.sc/0vqunSr6udQl
Could someone explain to me how I can solve this error?
make them a list
or a key value thing
yeah, but how should i put them in a list, never worked that much with lists bc strings are easier to handle
there is a FileConfiguration#getList
There is more than one error here. This is a mess.
could you explain me please
for(XRayPlayer player : XRayPlayer.players) {
}
Btw exposing collections like that is very unclean
not even via a getter
Bro don't you dare try to code spigot with that many syntax errors
Please learn syntax at the absolute least
I'm learning java, I'm not an expert
Me either but syntax is basic level
Entity died = e.getEntity();
Player player = e.getEntity().getKiller();
String playerId = player.getUniqueId().toString();
if(!(died instanceof Monster)) {
player.sendMessage("Dada");
}
}```
error:
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getUniqueId()" because "player" is null
at me.placek.levelrpg.listeners.EntityDeathListener.combatHandler(EntityDeathListener.java:29) ~[levelRPG.jar:?] at me.placek.levelrpg.listeners.EntityDeathListener.onEntityDie(EntityDeathListener.java:22) ~[levelRPG.jar:?]```
so how could i get killer of entity?
Entities can die without being killed by a player
https://prnt.sc/ZZT3A2qO2uyj
This also has bad syntax?
Yes. Because the line above will throw a Nullpointer if the entity was not killed by a player.
thanks
Please learn the basics of java before writing spigot plugins.
Nothing here makes sense.
ok
I'm working on this core library, and need a way to grab an instance of the core plugin. The ol' core = (AxiusCore) getServer().getPluginManager().getPlugin("AxiusCore");
Up until recently that was working fine, but then it began crashing with an NPE.
I tried switching over to the service manager;
from AxiusCore.java
getServer().getServicesManager().register(AxiusCore.class, instance, this.getJavaPlugin(), ServicePriority.High);
from AxiusPlugin.java
List<RegisteredServiceProvider<?>> providers = getServer().getServicesManager().getRegistrations(Bukkit.getPluginManager().getPlugin("AxiusCore"));
core = (AxiusCore) providers.get(0).getProvider();
So far, so good. the plugin utilising the core finds what im looking for, but i keep getting an error saying i cant cast AxiusCore to AxiusCore;
Error occurred while enabling GUIHomes v1.2.1 (Is it up to date?)
java.lang.ClassCastException: class uk.co.benkeoghcgd.api.AxiusCore.AxiusCore cannot be cast to class uk.co.benkeoghcgd.api.AxiusCore.AxiusCore (uk.co.benkeoghcgd.api.AxiusCore.AxiusCore is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @760ac762; uk.co.benkeoghcgd.api.AxiusCore.AxiusCore is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @32e8e121)
at uk.co.benkeoghcgd.api.AxiusCore.API.AxiusPlugin.onEnable(AxiusPlugin.java:234) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:518) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:432) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:263) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1007) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3486-Spigot-b6d12d1-f3c7a6a]
at java.lang.Thread.run(Thread.java:833) [?:?]
Any ideas?
Illegal cast from AxiusCore to class
You can't cast an object to a class directly iirc
does BossBar#addPlayer display it at the top or bottom of the screen (when you have multiple bossbars active already)
Why dont you provide a static getter for your plugin if you need to expose it?
RegisteredServiceProvider makes absolutely no sense at all here.
The boss bars stack from the top downwards
I do have a static getter. I resorted to RSP because the getter was always returning null;
private static AxiusCore instance;
public AxiusCore() {
instance = this;
}
public static AxiusCore getInstance() {
return instance;
}
That would be it's not loading before you get it
the RSP registry runs from the constructor too, and that returns an object
So your trying to retrieve the instance before its initialized
And how do I do that?
Ill make some changes and get back to ya on that
Make sure your plugins actually depend on your core so that the load order is correct.
multiply the vector my a scalar.
// <- Get velocity
velocity.multiply(2.0);
// <- Set velocity
alr, ty
there is a repo like this
how can i update the 25 commits on a localy clowned repo of the fork ?
softdepend or depend on the core plugin
?plugin.yml
Heh. Clowned
L
You'll have to rebase your commits onto the base branch
Though this is generally why it's advised to make commits to a new branch when forking an active repository
i need to use this plugin
https://github.com/CritterzNFT/Essentials
this fork
but its old
kinda
like so?
Vector v = p.getFacing().getDirection();
v.multiply(2.0);
m.setVelocity(v);
how can i update the 26 commit to it
I would do it a bit differently. But this could kind of work.
if an entity has a passenger can you not modify the rotation of the passenger?
also will the passengers rotation change with the parent entity?
Still nothing.
And to answer questions; Yes, i have the plugin depended. I also get the same casting error when i use the regular core = (AxiusCore) getServer().getPluginManager().getPlugin("AxiusCore");
nah, sadly doesnt work
Hey! I'm making an addon system for my plugin
I came up with some steps for the addon system
- The base plugin will be loaded and checks for JARs inside its addon folder
- The base plugin loads all JARs inside the addon folder (Java deserialization / Java class loader / Java stuff somehow...)
- The base plugin executes a main method of the addon, so the addon can handle its stuff (all addons must provide a main method, so the base plugin could invoke it by reflection)
- The addon registers its events
- Communication between both plugins given by direct references (maybe the base plugin passes its instance to the addon constructor)
Disadvantage: The addon needs to hook deeply to register it's own commands, since the addon itself is not a plugin and has no plugin.yml and gets not loaded by Spigot
I've coded most of the stuff, I just can't figure out to complete steps 4 and 5, I think I should pass a instance of the base plugin to the addon, but I'm not sure how.
Help would be greatly appreciated
as you never numbered anythign we don't know what steps 4 and 5 are
Sorry, i've changed it
teh addon has access to Bukkit via the main plugin so it can register it's own Listeners
okay im crushing my head, how do i do it the best way? im using 1.16.5 and still didnt found any good way
the way i handle addons is by having it implement a specific interface and adding it to the main plugins classloader and then once thats done you can just do your logic like you normally would
Take a look at how i register other plugins within my own plugin. The way i register commands can be easily manipulated to register just about anything from the main script
Thanks!
are those addons full plugins?
No, there not even extending javaplugin

i use ClassGraph to register my addons
https://github.com/DarkEyeDragon/RandomTeleport/blob/dev/Common/src/main/java/me/darkeyedragon/randomtp/common/addon/AddonManager.java
then an addon can look something like this: https://github.com/DarkEyeDragon/RandomTeleport-Addons/blob/master/TownyValidator/src/main/java/me/darkeyedragon/randomtp/addon/TownyValidator.java
Thats more like it. What i dont approve is this:
private static final String ABSTRACT_CLASS = "me.darkeyedragon.randomtp.api.addon.RandomAddon";
oh yeah it needs some more fine tuning
but since i'm the only one bothering making them
¯_(ツ)_/¯
If you have RandomAddon on your classpath then you can as well make it compile time safe with RandomAddon.class.get...()
It works until someone else tries to use this.
What happens if someone just does this:
AxiusCore.registeredPlugins.add(new TestPlugin());
Is the plugin then enabled?
Or if they are funny they can just do this:
AxiusCore.registeredPlugins.clear();
Not encapsulating is just purposefully sabotaging your codes robustness.
So the following commit fixed a decade old bug with chunks requiring you to do -1 when using getHighestBlockYAt to get the actual highest block and not just air, this change "breaks" my plugin cuz now i need a way to detect if it was before or after this commit, is there a way to do this?
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/ce373be660c95d5ca2b2d167545565f9636f9cd8
Uh. That is a tricky one.
this.exp += exp;
Player player = Bukkit.getPlayer(UUID.fromString(playerId));
player.sendMessage(LevelRPG.getPrefix() + ChatColor.GREEN + "Zdobyłeś " + ChatColor.YELLOW + exp + ChatColor.GREEN + " punktów doświadczenia w walce.");
if(exp >= expNeeded) {
levelUp();
}
}```
currently i just say fuk it and stated that new versions dont work before that commit, but i'd like at least some backward compat
error:
at java.util.UUID.fromString(UUID.java:237) ~[?:?]
at me.placek.levelrpg.skills.skillManager.SkillManager.addExp(SkillManager.java:56) ~[levelRPG.jar:?]
at me.placek.levelrpg.listeners.EntityDeathListener.combatHandler(EntityDeathListener.java:42) ~[levelRPG.jar:?]
at me.placek.levelrpg.listeners.EntityDeathListener.onEntityDie(EntityDeathListener.java:25) ~[levelRPG.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor591.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]```
regarding that, im doing it differently i think
try {
URLClassLoader loader = new URLClassLoader(new URL[] { myJar.toURI().toURL() },
CustomClass.class.getClass().getClassLoader());
Class classToLoad = Class.forName("org.plugin.addons.addon", true, loader);
System.out.println(classToLoad);
Method method = classToLoad.getDeclaredMethod("helloWorld");
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();
}
``` I'm using this code to invoke a method on an external jar file. That was a previous step. How could i give an instance of my plugin when accessing that method?
till ya check the recent commit
Best i can think of: Use the version as a threshold and hope that the latest version is being kept up-to-date by the server.
I dont think you can get the commit id from within spigot.
did anyone know how to fix this error?
you have to send code...
Yes. Make sure name is not null. Or at least dont do anything with it if its null.
PaperLib has a "isVersion" which accepts a patch but i doubt thats the commit?
So in my plugin I load a players data when they join and I save it when they leave through MongoDB, but with this if the server crashes it rolls everybody back because it can’t save them. Is there a way to make it so I can detect if the server thread has crashed and if it has save the player.
but i'm putting string into method so it's shouldn't be null
oh nvm thats minecraft version 🤦♂️
i dont quite understand the question
Do a soft flush every N minutes on your whole cache.
guys when a block gets broken or changed to air, if a pressure plate is on it it will drop
how can i cancel the drop in 1.8.8 ?
there is no BlockDropItemEvent
i want one of the method paremters in the addon class to ask for an instance of the main plugin, im not sure how i can GIVE an instance of the main plugin when invoking that method
if someone says update
Update to a version that is supported. 1.8 was dropped years ago and only a few people are still playing it.
i will block them
unless its a JVM crash onDisable is called, so you could "flush" to disk in onDisable, out of memory crashes and such you're shit out of luck
We've tried but there's issues with saving the cache at the same time the cache is being called
wrong reply
Yeah lol
I'll try adding it to onDisable but I don't think it'll work
best thing to do is periodically save
i-
bump (:
Its not an opinion. Using ancient software is an unintelligent choice. Thats factual.
And i find it extraordinarily rude that you suggest suicide as a result of stating this fact.
Say we have 100 players across the network, saving everybody all at once will put immense load on the DB
will you fix the pvp of this "new software" with your precious OlD cOmBaT mEcHaNiC ?
What issues?
You can disable the new pvp
i have a method on my addon that allows me to get the instance, but the way i do it is a bit hacky
yeah sure deal with the ram usage
I didn't see that, could you explain it?
MongoDB has a 2gb memory cache on default. This wont put a high load on your db.
i once done this disable new pvp thing
You wont even notice it
and ate all my ram because new software fancy
new software more usage
Make it efficient then
i guess if you know, you can help me im being asked to code the plugin in 1.8.8
@Override
public boolean isValid(RandomLocation randomLocation) {
//TODO this is a dirty hack since the addon manager is only set after instantiating the addon so it cannot be done in the constructor.
if (plugin == null) {
plugin = ((RandomTeleport) getAddonManager().getInstance()).getPlugin();
landsIntegration = new LandsIntegration(plugin);
}
return !landsIntegration.isClaimed(WorldUtil.toLocation(randomLocation));
}
basically set the instance of your plugin when you construct the addon, then have a method to retrieve it
show what code you got until now
if you are gonna pay me the amount im getting paied
then ok i will use 1.17
for a pvp minigame plugin
now if you know help, how can i cancel the thing
You can run a server with 1.17 and softlock it so only 1.8 clients can connect
quick question: is it possible to use reflection to copy an Event bukkit class while also preserving its values ?
this shit
Uh elaborate
How can you change the behaviour of a particle?
a class has no values
Cuz reflection is mainly invocation, and class scanning
- only a few people *
that is just one of 5 lobbies
@fleet comet
/**
* @param clazz the {@link Class} to instantiate. Must extend {@link RandomAddon}
* @return the {@link } {@link RandomAddon} instance.
*/
protected final RandomAddon createAddonInstance(Class<? extends RandomAddon> clazz) throws ReflectiveOperationException {
RandomAddon randomAddon = clazz.getConstructor().newInstance();
randomAddon.setAddonManager(this);
return randomAddon;
}
i do it like this, but i'm sure theres better ways
i don't have time for this 1.8 argue
when a block gets broken or changed to air, if a pressure plate is on it it will drop
how can i cancel the drop in 1.8.8 ?
literally less than 1.12.2 even
Check the block above if pressure plate set air
Alright, thanks
Hello, I'm new at development of plugins. How can I get the world from the Server class?
i said i don't have time for this argue
im getting payed to code in 1.8.8
i just dont mention i work with ancient versions and hope it still applies
Bukkit#getWorld
🥲
wait so this is in the addonmanager right?
yeah
sec
dont worry it rarely happens
like given an event (ex: InventoryClickEvent, Event extended classes, PlayerJoinEvent), is it possible to use reflection to duplicate this class during @EventHandle section? and be able to refer to it in future in time even after that event has been fired/cancelled since it might be async/sync?
Yes but I need a uuid for that
what exactly should the addon class look like?
Is this for a specific type of block like sand, or tnt?
You can also use a string
Duplicate the class?
For world name
I’m very baffled
public static boolean setLocation(String frak, Location loc) {
cfg.set(frak + ".world", loc.getWorld().getName());
cfg.set(frak + ".x", loc.getX());
cfg.set(frak + ".y", loc.getY());
cfg.set(frak + ".z", loc.getZ());
try {
cfg.save(f);
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
thats it, the only one i got working bc the list ones require that im using arraylist on the location itself too
im just setting a block to air
dont harass me
If you are doing programatically then you can check the block above and set it to air too if its a pressure plate.
That duplicates/instantiates an instance but that might just be what they mean
the block type is pressure plate right ?
add all your locations to a list and set the list to the config
its just an interface/abstract class that defines what should be required for you. in my case it looks like
https://github.com/DarkEyeDragon/RandomTeleport/blob/dev/Api/src/main/java/me/darkeyedragon/randomtp/api/addon/RandomAddon.jav
Not sure how many of the pressure plates are present in 1.8
yea but event doesn't have clone() so could it be done with reflection?
doesnt exist hehe
So I just need to get the world name?
no i mean the whole block type is pressure plate ?
Why do you want to clone/copy the event?
is it 404? its a public repo
yeah
Yes? You cant really have 2 types on a single block, can you?
oh add an a at the end lol
yep
accidentally removed it
a better scenario would be where you just pass the AddonManager or plugin instance in your case in the constructor of the addon, but i dont think an interface can enforce that
locations are configuration serializable. You can just throw them into a config.
yeah
he was trying to set a list of locations or smth
oh ok thanks
hope that helps, i'll be afk for a bit but feel free to ping me if you have other questions
okay
Perfect. You can set a list of everything that is ConfigurationSerializable. Its perfectly fine to just
List<Location> locations = ...;
FileConfiguration config = ...;
config.set("some.locations", locations);
throw it in there.
@dense crow
okay im trying, ty
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1));
p.sendMessage(ChatLib.t("&7[&a+&7] Night vision enabled"));
}
else {
p.removePotionEffect(PotionEffectType.NIGHT_VISION);
p.sendMessage(ChatLib.t("&7[&a+&7] Night vision disabled"));
}``` why doesnt this work? it gives me night vision fine but when i run the command when i have night vision it still tries to give me night vision
Use p.hasPotionEffect(PotionEffectType type) instead
[17:24:03 WARN]: [Roleplay Utilities] Could not submit bStats metrics data
java.io.IOException: Server returned HTTP response code: 429 for URL: https://bStats.org/api/v2/data/bukkit
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1997) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) ~[?:?]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224) ~[?:?]
at org.manfry.roleplayutilities.MetricsBase.sendData(MetricsBase.java:196) ~[?:?]
at org.manfry.roleplayutilities.MetricsBase.lambda$submitData$4(MetricsBase.java:161) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]```
anyone can help me whit bstats?
Rate limiting. You are sending an ungodly amount of requests to bstats.
lol
you should send ONE at startup
how can i fix that, i use the base code
?paste
You might be sharing an IP Address with a lot of other people. Do you use a VPN?
no
did you put your own plugin ID in your startup and not use teh default?
Well then either wait for some time or use one. This code doesnt look like it should be rate limited.
ok
How can I inject my own arguments into the minecraft command like /summon?
List<Location> locations = what do i put in there? my brain almost stopped working so im sorry for asking this
If you want a custom entity to spawn then you will have to properly register it in the nms registry.
Which is quite hard since Mojang locks them now
Rly? That doesnt sound very data driven to me...
I mean I register my custom entity type, and It works with /summon good, but I want to add it to the arguments list
Just your locations. I have no idea how your plugin is structured.
I found a writable registry in nms idk what it's for though
im trying to put the locations in but it says i have to provide a list and im providing a location
Yeah, frozen
They are locked after a certain point in startup. Not sure if plugins can enable early enough. Maybe onLoad can work
Maybe try looking at the WritableRegistry 🤷♂️
Never witnessed that? Which registry does this for example?
All of them iirc
yes
hmm interesting
Yea, but with plugin you can unfreeze it
do i need to convert my locations somehow or how can i throw it in?
No transformation. Try it out. Create a list of locations and set this list in your config.
its from a Event with event.getClickedBlock.getLocation
During runtime you should never tinker with configs. Load the data when a session starts and save the data when a session ends.
In between you use all the data from memory.
what kind of features would be useful in a lib?
I mean mostly framework classes that aim to abstract repetitive patterns you want to avoid writing every time
There is no real limit. But here are some suggestions:
- GUIs
- Holograms
- IO support
- Serialization
- Language support
- Persistent Block data storage
- Task and scheduling utility
- ItemBuilder is a big one
- Getting player input through signs, chat, anvils etc
- Custom head api
- Generally a bunch of util classes
Basically everything you would copy/paste into every new plugin.
oh boy thats a lot
ok yea I can work on that, ty both! Dont know if I should make my own api or fork a api like Red Lib
How do I make it so staff can't see ip from console?
- Custom recipe api
- Clickable message bridge api
- enchantment api
- Custom item usils
- Region api
- multiblock structures
- nms helpers
okay now it throws out just nothing, in intellij or in console nothing, and nothing in file
ooh even more ok
is there something wrong in this? ```java
public static boolean setLocation( Location loc, String frak) {
List<Location> locations = new ArrayList<>();
locations.add(loc);
FileConfiguration config = YamlConfiguration.loadConfiguration(f);
config.set(frak, locations);
locations.remove(loc);
try {
cfg.save(f);
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
Looks expensive (2 io calls)
Why are you removing the loc? Why do you even have a list at all?
you read from config but save cfg
I've tried this already, the chunk stays loaded but it is not ticking (my horse does not pathfind)
argh no
Entities outside a certain range dont get ticked.
This can be changed in the spigo.yml iirc.
Not sure if you can change this from within an entity. You need to dig around a bit.
need that list bc i wanna list those locations in the file
Ok but your list will always have only a single element. No reason to use it at all then.
yep, but my dumb brain wont tell me what i have to put behind the = at the list<location> locations
actually im pretty lost with that as my heads smoking since 4 hours bc of that lol
I believe there is also a range check if any unloaded chunk is nearby it will not tick
Yes that one.
So all he has to do is override the inactiveTick() with his usual tick method.
So all neighboring chunks have to be loaded for a chunk to tick
hm?
i can add a chunk load ticket to every chunk around the horse then
try it and see
but sorry where am i overriding this in
do I put this in my custom horse entity?
@Override
public void inactiveTick() {
super.inactiveTick();
super.tick();
}
@Override
public void inactiveTick() {
this.tick();
}
isn't there extra stuff that is run in super.inactiveTick() though
and also I haven't really overriden the tick method, I've just added many pathfinder goals. you think the pathfinding will still work fine?
How do I put spaces in a config?
how can i check if an item can fit in an inventory?
aight just tested, it works sick
Not easily. The lazy way, copy the inventory, add the items and check the return map to see if its empty.
The classic old question...
Cleaner would be to handle overflow because the addItem method already returns the items that didnt fit.
Cant you just drop the overflown items to the players feet?
smth like inv.addItems(item).values().isEmpty()?
my goal is only to check
that ADDS the item to the inventory
i dont want that
oh checking
i would like something simple like inventory.canFit(item)
Is it ok for it to be very expensive?
what would be an efficient way to add plugin chunk tickets to chunks around a horse as it moves around, while also remove plugin chunk tickets when it moves away from added ones
]: Error occurred while enabling DeepSmpPlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Crafting recipes must be rectangular
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.0.1-jre.jar:?]
at org.bukkit.inventory.ShapedRecipe.shape(ShapedRecipe.java:72) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at deepsmpplugin.deepsmpplugin.Main.onEnable(Main.java:39) ~[DeepSmpPlugin-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[paper-1.19.jar:git-Paper-41]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-41]
there's something wrong
Check if it moves over a border and then change the loaded chunks
make sure your crafting recipes are rectangular
1 sec
use pastes or codeblocks (```) for large stack traces
how do I check if it moves over a border? Should I just keep track of the last position the horse was in and see if a chunk border is in between the last position and the current position?
https://paste.md-5.net/idesisuvus.xml
help im getting
Cannot resolve commons-lang:commons-lang:2.6
Cannot resolve me.tigerhix.lib:scoreboard:1.0.1-SNAPSHOT
Cannot resolve org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT
Cannot resolve com.google.guava:guava:21.0
Cannot resolve org.yaml:snakeyaml:1.27
Cannot resolve com.google.code.gson:gson:2.8.0
Cannot resolve net.md-5:bungeecord-chat:1.16-R0.4
mvn reload?
i guess i will just copy the logic from addItem but instead of setting items in the inventory, i will set them in a map
just check if x << 4 and z << 4 from your previous and next location are the same
how does that even work
i even cleared cache and restarted
does it show errors in your pom?
yes
why does that work i mean
If you just run mvn clean install once?
I dislike these remote build systems for this very reason
Doesnt matter. Run mvn clean install.
]: Error occurred while enabling DeepSmpPlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Crafting recipes must be rectangular
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.0.1-jre.jar:?]
at org.bukkit.inventory.ShapedRecipe.shape(ShapedRecipe.java:72) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at deepsmpplugin.deepsmpplugin.Main.onEnable(Main.java:39) ~[DeepSmpPlugin-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[paper-1.19.jar:git-Paper-41]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-41]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-41]
SHIT WRONG ONE
Failure to transfer me.tigerhix.lib:scoreboard:1.0.1-SNAPSHOT/maven-metadata.xml from http://repo.tigerhix.me/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of tiger-repo has elapsed or updates are forced. Original error: Could not transfer metadata me.tigerhix.lib:scoreboard:1.0.1-SNAPSHOT/maven-metadata.xml from/to tiger-repo (http://repo.tigerhix.me/content/repositories/snapshots/): Transfer failed for http://repo.tigerhix.me/content/repositories/snapshots/me/tigerhix/lib/scoreboard/1.0.1-SNAPSHOT/maven-metadata.xml
You rather copy all your dependencies in and manually go through all the sites to check for updates
and you manually exclude duplicated dependencies etc?
Could not transfer metadata org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT/maven-metadata.xml from/to tiger-repo (http://repo.tigerhix.me/content/repositories/snapshots/): Transfer failed for http://repo.tigerhix.me/content/repositories/snapshots/org/spigotmc/spigot-api/1.16.5-R0.1-SNAPSHOT/maven-metadata.xml
and many similar errors
tf have you been doing lol
ffs
ItemStack CustomItem1 = new ItemStack(Material.NETHERITE_AXE);
ItemMeta meta = CustomItem1.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "Random!");
meta.addEnchant(Enchantment.DIG_SPEED, 6, true);
meta.addEnchant(Enchantment.DURABILITY, 5, true);
meta.addAttributeModifier(Attribute.GENERIC_LUCK, modifer);
ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "Random"), CustomItem1);
recipe.shape(" NN"," SN"," S");
recipe.setIngredient('N', Material.NETHERITE_INGOT);
recipe.setIngredient('S', Material.STICK);
Bukkit.addRecipe(recipe);
should work ?
use code blocks please```java
stuff
Looks like tiker-repo is your problem
i wanna use scoreboardlib tho
its not even https
You are missing a space
where ?
no
Your recipe looks like this:
[ ,N,N]
[ ,S,N]
[ ,S]
Which is not a rectangle
@drifting halo hey so heres my code for the addon
package org.cloud.addon;
import org.eternitystudios.plugins.cloud.Cloud;
public class Addon {
Cloud instance;
public Addon(Cloud instance) {
this.instance = instance;
}
public void addonMain() {
instance.server
}
}
how can i fix
And heres the addonmanager class ```java
package org.eternitystudios.plugins.cloud.utils;
public class AddonManager {
Cloud instance;
public AddonManager(Cloud instance) {
this.instance = instance;
}
public void registerAddons() {
File [] files = instance.af.listFiles();
for (File file : files) {
if (file.isFile()) { // this line weeds out other directories/folders
if (file.getName().endsWith(".jar")) {
registerJAR(file);
}
}
}
}
public void registerJAR(File jar) {
try {
URLClassLoader loader = new URLClassLoader(new URL[] { jar.toURI().toURL() },
Cloud.class.getClassLoader());
Class classToLoad = Class.forName("org.cloud.addon.Addon", true, loader);
System.out.println(classToLoad);
Class<?>[] type = {Cloud.class};
Object instance = classToLoad.newInstance();
Constructor<?> cons = classToLoad.getConstructor(type);
Object newInstanceObj = cons.newInstance(instance);
Method method = classToLoad.getDeclaredMethod("addonMain");
Object result = method.invoke(instance);
} catch (MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException
| InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
if (instance.getConfig().getBoolean("debugMode")) e.printStackTrace();
Bukkit.getLogger().warning("Could not load addon " + jar.getName());
}
}
}
funny
package org.eternitystudios.plugins.cloud;
import org.bukkit.Server;
import org.bukkit.plugin.java.JavaPlugin;
import org.eternitystudios.plugins.cloud.utils.AddonManager;
import java.io.File;
public final class Cloud extends JavaPlugin {
public File af;
public AddonManager addonManager;
public Server server;
public Cloud() {
}
@Override
public void onEnable() {
// Set server
server = getServer();
// Save config
saveDefaultConfig();
// Instantiate addonManager
addonManager = new AddonManager(this);
// Save addons folder if It's not there.
String configPath = getDataFolder().getAbsolutePath();
File addonFolder = new File(configPath);
af = addonFolder;
if (!addonFolder.exists()) addonFolder.mkdir();
// Start searching for addons
addonManager.registerAddons();
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
``` this is the main plugin
lol
on the addon, i cant access any of the server functions, how can i fix this?
i hate maven
the best way to do a damage is *, + or /?
This is not an answerable question...
What do you even mean?
depends??
Depends on the operands
You can multiply by 0.0001 and then it takes literally millions of hits to kill a player
I mean if you send in a value that is smaller than 1 the damage would effectively decrease
hehe i stuck with the addon system
:>
use pastes 
its better then before
multiply by 1/(2* sin(x))
Sometimes you do 50% damage and sometimes you do 1000000% damage
Any idea as to why does my config get extra spaces automatically?
is there anything like the new /place feature command in spigot?
bump
BRO WHAT THE FUCK
IM USING A COMPLETELY DIFFERENT LIB
AND THIS ERROR
IS STILL FOLLOWING ME
So you're the problem
IntelliJ trolling you then probably lol
will a chunk automatically unload when a plugin chunk ticket is removed?
as in unload as normal
Probably 5 minutes to despawn
No. Only if it would unload normally.
link an offline lib
ok thanks
Hello, hi to create config file to my plugin?
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Go away with your anti build system doctrine
thx 🙂
(:
Whos ready to fall some guys??!
Wait since when is this command a thing
I've created like 50 custom commands
imma restart intellij one more time
?workdistro
stumble guys 🥺
if it doesnt work
5 MB?
Probably just docs
Its not intellij its most probably an issue with your setup.
offline is just a work around it doesn't actually fix the current build setup
IntelliJ yields some pretty interesting (to the fucking extreme extent irrelevant as well) issues when you have slight mistakes in your setup occasionally
Any ideas on this? It is working, but i would like to know if it is possible to improve it https://gist.github.com/WizardlyBump17/585d54fc2d6f6ccb91793ae1be64996b
Need help with reflection and spigot and addons
You want to make it cleaner in other words?
not exactly
i would like to know if it is possible to avoid the array creation, for example
Exactly where? Or everywhere?
let it there
Aight
But well, if you have to use Inventory::getContents, then you can’t avoid that array
i actually need it
because the method uses ItemStack#setAmount
and i would like to not edit the items in the inventory
Don’t think getContents return the actual view tho
So you don’t need to clone, or maybe Im mixing things up now
let me see
Yeah check the impl (:
Thats good
Oh that’s less ideal
people dont know that you can iterate over the inv 😳
i do
im now implementing Iterable on all my repo stuff kekw
no longer exposing collections
That’s solid design
I have an EventHandler looking at BlockBreakEvent in which I want to check if any of the drops of a block broken are an ore (ie gold ore or diamond ore or iron deepslate ore). I was looking for some kind of interface that was implemented somewhere so I could check instanceof ore or something, but it looks like that isn't an option for my use case.
Right now, I just have a big case statement for all the ores, but as Mojang updates, I'm going to inevitably need to update said case statement.
That lead me to the Tag class (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Tag.html) where I think I might be finding a solution to this by checking if the drop has a tag of STONE_ORE_REPLACEABLES or DEEPSLATE_ORE_REPLACEABLES. However, I saw this note which is giving me some pause:
" * Represents a tag that may be defined by the server or a resource pack to
- group like things together."
Does anyone have a more clever way to check if a material or item stack is an ore like gold ore, coal ore, nether quartz ore, etc?
declaration: package: org.bukkit, interface: Tag
I might be completely in the wrong direction because this seems to be doing something with resource packs.
That's so cursed lol
Create a Set<Material> that contains all ores. Stream them on runtime and check for contains "_ORE"
private static final Set<Material> ORES = Arrays
.stream(Material.values())
.filter(mat -> mat.toString().contains("_ORE"))
.collect(Collectors.toSet());
stream, filter, reduce
That looks familiar lol
The pattern never dies
lol
Surprised there isnt a Tag.ORE
Can anyone help me set up the config in my plugin?
Would you use a Tag or the above method?
the method above
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
😐
do you think its a good idea to just load all chunks within a 3x3 radius of the horse and unload all chunks within 4x4 radius of the horse, ignoring the inner 3x3?
or actually idk how this would work if there are multiple horses next to each other
add a getter for the plugin instance to your interface
i figured that out, i think im almost done
👍
can u check over my code on github once i am, i love tips and criticism lol
Send it here 🙂
It would be nice if you linked one in your profile
450 lines for vanish command now aaaa
I’m on vacation in the middle of the desert oh a phone but I’ll still look
how to shade a dependency
sounds like effort 😓
you dont have too lol
@paper viperhere u go https://github.com/JadeStudioss/Cloud/tree/Main
3G 3 bars data lmao
import java.lang.*;
class ${
java.lang.Void To_String($ this,
Character... Characters )
{
for (Integer CurrentIndex = new Integer(0);
CurrentIndex < Characters.length;
CurrentIndex += new Integer(1)
)
{
java.lang.System
.out
.println(Arrays
.asList(Characters).
get(CurrentIndex))
;}
how to shade a maven dependency
$ this?
what
Receiver parameter
im using this
and its telling me to shade it
Cannot resolve symbol '$' :(
RE this and the answers, any idea how to track ingots like iron ingot, emerald, diamond, etc?
Any result from an ore?
oh god
oh no the zero
the zero >:(
i need internal methods aaa
𝘚 = 𝓀ᵦ ln Ω
i have a simple problem with coding my plugin. so i want to make it so when i leave a server i get deop automatically. I already coded the onLeave listner just need the deop string
🤔 = 1
what string?
lol
event.getPlayer().setOp(false);
yeah thx
also this isnt a string
a string is covered between quotes
so you should ask "how do i deop a person"
:(
google it (:
or just ask here
yeah im new at coding i mess up words alot lol
honestly google is mean
its fine :D
just ask here
imajin is mean too 😠
everyone is mean
depends on how you interprete it
since
investing is basically taking advantage of other people
Programming community is going to be toxic. I’ve always had toxic people in the beginning when they give me tips. So honestly deal with it and just grow up or smthing
google is mean, it cuts out its server just for me
Choose not to be offended usually works
i mean u werent necessarily nice to me when i started :O
Unless you get flamed in which you might wanna contact mods of said community
still, u being somehow offensive helped me
Yeah you’re a chad programmer now
people who teach stuff the hard way usually help the most
like that dude which got banned year ago
Nnyak?
not really but somewhat i assume if thats not sarcasm :o
i really wanted that addon system
He’s still around here I’d presuppose just laying very low
idk someone with random uppercase chars in his name
Well you didn’t focus on what I told you…
elgarl know who im talking bout
It’s not like I wanted to change stuff either when I was a beginner
you were telling me to make it an api
Yes really
i wanted addons that werent plugins lol
If you want to learn fast, you have to be open minded
who? @tardy delta
im not a beginnner lol
Your repository clearly shows it lol
i just told idk lol
Anyways
i dont use github often, or reflection. also i took a huge break with plugin dev
NNY... was his name
i mean using github is something u do daily if u code often
man with the skeleton head with christmas hat in his pfp
ill remember him
That’s fine. I’m just saying that you didn’t rlly have to use reflection and could’ve make your life easier
when im learning something like reflection. i like to make stuff out of it. like an addon system for a minecraft plugin
thats how i learn fast
well anyways goodnight
Sleep tight
you too
If you truly wanna practice reflection then create something like a dependency injection library
I’m not sure if an addon system is really useful for learning reflection…
it was though
Even something like using NMS would be better
tomorrow morning my profile will be like: playing ij for 16 hours ¯_(ツ)_/¯
Sounds exciting
i learned a ton actually
Pulse remember block us… I mean we kinda learned some stuff from that piece of garb
Ya obviously
🥲
But at least we listened to what people said lol
True
Even tho it was a fuckmess
In your addon manager class, you should use encapsulation, cache your reflection fields, and divide your code into more methods
Remove the System.out lines and replace them with actual logging stuff
oh yeah duh
whats encapsulation?
cache your reflection fields, h o w?
divide your code into more methods, thats the only thing i understand
In your main class, I’d encourage you to not do ‘public static JavaPlugin’
Also, use Java NIO instead of Java IO
I’m on phone give me some time
I fucking roflmao everytime I go back to check that junk loll
LOL
then how should i access the plugin from the method?
DI
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Encapsulation is when you make your class variables private so they cannot be accessed outside the class directly. Getter/setter methods are used in conjunctive with encapsulation to retrieve/set the variable with the actual method, rather than directly
oh
what classes should i use that in?
hmmm usually its tragedy genre
i find them more realistic
Make your reflection variables (Method, Constructor) static. And in a static block, initialize them and reuse them when necessary
Hmm, alright I see I see
Always
also isnt that more complicated? other devs are going to making addons so it should be farely simple
No
It’s better OOP wise
Conclure can give better explanation
@ivory sleetgimme
Uh what should I explain?
di
DI vs mono state?
ngl there should be official spacing styles
similar to indentation styles
Welcome to Nevada
Okay so I assume you’ve done something like
(Aka Monostate)
static Plugin heeheeeheehawPlugin;
@fleet comet
heeheeheehaw
Lmao
hehehehaw, bitch ive beat the odds
JavaPlugin
isnt there a song like that
Yes but whatever, the point is the static
You basically have a butch of static variables that are re-assignable, which means the value of them can be changed throughout the runtime of the server
This is bad, veri bad
why would they?
(I’m exaggerating a bit now since in some select few scenarios it might be fine) but let’s keep to the rules
psssht, conclure we might be getting the first valhalla previews in java 20
ye
Woooohooo
Sry Jade 1 sec I need to see this
(also thanks mini for showing me that site, never knew it existed)
you didnt knew about openjdk?
not about the dashboard for JEPs xD
Light weight JSON API
Yea hype af
Lol
Is there a reason why PermissionAttachments are not exposed in the API?
was about to mention that
Good bye fast util 👀
value classes
PermissionAttachment is a part of the API 🤔
You can only get Effective Permissions but that excludes Attachments that don't have any Permissions attached
So any Attachments added by Permissible#addAttachment(Plugin plugin) are excluded from that
and the ones added with Permissible#addAttachment(Plugin plugin, int ticks) too
@ivory sleetb u m p
Anyway continuing,
Static variables / mono state causes:
- Tight coupling
• Classes suddenly depend on a specific instance/variable, this becomes hard to manage and degrades flexibility - General unmaintainability, for instance it becomes harder to test different layers of your application and refactoring details in different modules
- Extreme pain when dealing with multi threading
To sum it up, you become immobile, fragile, rigid and prone to viscosity
This is why programmers avoid certain patterns and try to write code defensively
This is for instance why we like encapsulation
- Extreme pain when dealing with multi threading
that is the most accurate thing ive ever heard
It makes our code more robust and flexible
Yeah
Especially since Java doesn’t have anything to just magically fix concurrency update problems, dead locks and all that crappy stuff
it needs that
(It does have a memory model and some classes)
But I mean it’s till up to you to incorporate those tools effectively
okay continue
How to convert a String to a InetSocketAddress?
InetAddress.getByName(String host)
@ivory sleet
yeah that too prob
Any Input on this
thats not a InetSocketAddress
Oh true fair enough
yeah where can I convert String to InetSocketAddress?
Use this Constructor
That's probably not a good thing to suggest without more context about the use case
I mean do you really need a InetSocketAdress or is a InetAdress enough
How can I make a mob shake similarly to how a Zombie Villager shakes while being cured?
Yes?
thanks
Idk if there’s much to add
I mean I could be here all day rambling about best practices
But that wouldn’t get you anywhere
yeah and i dont know how to add
How to add what? Owo
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
How can I make a mob shake similarly to how a Zombie Villager shakes while being cured?
I'm trying to completely overwrite a method from NMS
Extend the class and override it
wait lmao
so my custom entity is called SuperiorHorseEntity
which extends Horse
which extends AbstractHorse
which extends Animal
what I'm trying to do is directly call Animal#aiStep() directly from SuperiorHorseEntity, completely skipping AbstradctHorse#aiStep()
because AbstradctHorse#aiStep() has some private method calls that I can't exactly do with normal overriding
that's basically what I'm doing
serialize it to a byte[] and save it directly
I've tried doing
animalAiStepMethod = Animal.class.getDeclaredMethod("w_");
...
animalAiStepMethod.invoke(this);
Why
Mongo have codec for that
actually nah
but it ends up doing an infinite recursive loop
That won't work as it's being overriden
Looks harcoded that thing for aving
+1
if I want to remake the entire method I'm gonna have to use reflection to access every private field and method that the super classes use 😐
yessir
is this really my fate
I wasted like an hour remaking pathfinders so that zombies can't walk through client-sided blocks
only had to remake 2 classes
this is very helpful except you're asking for code help and not presenting any code
i'm just trying to stop horses from doing the eating grass animation damnit
lmfao you can probably avoid that with pathfinders or some shit
lol ok thanks bukkit
its in its own method, with a random chance of it happening every tick
which is a god damn pain
I mean
i worded it wrong, its inside a crucial method that makes horses work properly
if you want to go that custom just fork spigot and remove it
but it want to delete that one part
oh god
Oh god
bro
Lol
?paste
?paste
can't though
Oh ok
sry
i'm trying to make it work on any spigot server
then like
Oh yes
remake the entire horse logic
welp this is gonna take a long time
Pulse i couldnt fix my issue with mongo :/
or just call the private methods via reflection
Haha 2 days and still cannot fix it
Heheh
Im still reading about fixing it
what's the part of append("id", POJO); that you don't understand
as long as it's annotated with @Serializable you're good
Ilusion ait i ill send code
**Hello i have problem with config creationg. **
**If i creating config (?configs) **
1) config.yml dont install on server
2) Events (playerOnJoin) dont work
?doesntwork
public class ClaimManager {
private final Set<Claim> claims = new HashSet<>();
private final StorageManager sotrage;
public ClaimManager(Main plugin) { this.storage = plugin.getStorage(); }
public void load() {
for (Claim claim : this.storage.getClaims().find()) this.claims.add(claim);
}
public void save() {
for (Claim claim : this.claims) this.storage.getClaims().updateOne(Filters.eq("uuid", claim.getUuid()), (Bson) claim, new UpdateOptions().upsert(true));
}
]```
Plugin's probably not even loading
There you have Ilussion
Create a new document and append it
Then I don't want to help you
@Getter
@Setter
public class Claim {
private final UUID uuid;
private final UUID owner;
}```
I cannot use document
Becaue it not a document
The info i read explain that when you are using POJO's classes you dont need document thing
What is your goal
MongoCollection#updateOne()
do you guys know any up-to-date guides about custom enchants?
Pule: The exception is obviously (the reason) I just dont know how it should be updated
There's like multiple ways to do them depends
Hmns
Also im reading official mongo docs
So i dont kno why it doesnt work
Hahaha
you miss out the 3 tons of annotations and codecs underlying
He?
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");
}
}```
Look its working
Just don't use DBs people
Everything works except MongoCollection#updateOne()
oh lmao
I would ill have to wait smile
Also ImIlussion and Pulse thanks for trying to help i just will be pacient and wait for Smile to get online
Have a nice day
Ey, https://paste.md-5.net/oxobegaded.java i fixed events bud dont create config.yml file...
On main class do: getConfig()
Smile Probably will only Go on tomorrow for the record (or He has a messed Up sleep cycle)
In which line should I put it exactly?
Smile lives in Central Europe and it's 11pm there - chances are He is asleep
Check because i dont remember i used that thing 1 time when i was just starting . Them i moved up to my own FileHandler which uses the YamlConfiguration one
Ohh ok Me because im holidays and its 6 pm
Yeah you are totally right
Geol dont you know about mongo?
Never used DBs in my life
Oh allright really thanks dont worry
oh lmao i have discovered a nice trouble about doing DI into an Enum
For some reason, player.getVelocity() is showing 0 for both X and Z even when I'm moving around, it only changes when I'm jump running, how do I get the actual velocity for X and Z?
🤔
🤔
Lol
or should be
Lombok
I know but what about for getting config values?
Also an interface is better for constants if you don’t want the stupid type
What do you mean "for getting config value"
Well nobody knows rlly how to do it lol
Then your enum holds the yaml paths
yes
And you pass the config to the method
Im trying to do that
But like, this fails so early
Im ondering to do:
Messages.Invalid_Sender
Well not but they aren't generic
You are totally right
I usually just write an interface for language
? English
Because interface neither abs class can be initialized
Component levelUpMessage(int level);
For example
Rip the closing bracket
Well
You implement that
Lol I do something similar but much cursed for messages
component 
Yeah i use components too
Welcome to the staff
XD
lmfao
Yes pulse that is cursed
I dont kno how i can confuse colors
Lmfao
why would anyone even begin to want to moderate this discord 💀 hello conclure
yes i remember hahaha
When u don’t have generic var args 😦
Mongo bro? <== ==>
Sql bro?
Oh